text:
Q: How do different languages convey shades of meaning as English does with stress? Browsing this site recently, I noticed a lot of discussion, not to say bickering, about whether some languages are more expressive or nuanced than others.  It reminded me of a question I had in my head long before I discovered Stack Exchange: how do languages that don't use stress for emphasis convey shades of meaning?  An example [paraphrased from memory] from an almost-forgotten BBC radio show :-
Patient: I was at an orgy the other night ...
Doctor: An orgy you say?
Patient: Yes, I live in Purley.
Now, if the patient had said, "Yes, I live in Purley", it would have been mildly funny, suggesting that Purley is a place where orgies often happen.  But by stressing the word 'live', he's saying that it's understood that Purley is the place for orgies, but because he lives there, it's easy for him to get
to them.
My question is, Can this nuance be expressed in other languages, whether by emphasis or by re-phrasing?  I know, for example, that in French, "I live in Purley might be expressed as something like "C'est a Purley que j'habite", but I can't see how you'd exactly translate "I live in Purley".
[By the way, I asked this question of a multi-lingual EU
translator, and he couldn't get past finding different countries' equivalents of Purley.]

A: There's a Wikipedia article on topic and comment in a sentence that strives to explain how various languages devise to stress the focal element in a sentence.
I quote the initial passage:

In linguistics, the topic, or theme, of a sentence is what is being talked about, and the comment (rheme or focus) is what is being said about the topic. That the information structure of a clause is divided in this way is generally agreed on, but the boundary between topic/theme depends on grammatical theory.

The topic-comment distinction was studied in great level of detail by the Prague Linguistic Circle, presumably in connection to various shades of meaning one can achieve in Czech by opting for different word orders in a sentence. (Czech, as a richly inflected language, offers a good deal of freedom to the speaker as regards word order.)


text:
Q: Get Rotativa PDF working on shared hosting I recently used the Rotativa nuget package for exporting an MVC view to PDF.
This worked locally as well as on a dedicated Windows server but does not work on shared hosting.
I get the generic Rotativa errors. I do not have access to change permissions to the executable and the hosting provider will not change permissions either.
What other solutions can I try to get this working on shared hosting?

A: I came across a solution for this that worked for me.
The version that is currently in NuGet is an older version.
You need to go to http://wkhtmltopdf.org/downloads.html and download the latest stable release. For me it was the 64bit version as the shared hosting server is Windows Server 2008 R2 64bit.
This will download an EXE. Extract the EXE using 7Zip or WinRar or the likes.
Open the unzipped folder, look for the folder called bin. Copy the following :

*

*wkhtmltoimage.exe

*wkhtmltopdf.exe

*wkhtmltox.dll

FTP these files to your live sites wwwroot -> Rotativa folder. You will need to overwrite the existing files in that folder.
Now your PDF export action will work correctly for shared hosting.
Hope this saves you a lot of time.

A: It works for now but since Rotativa is using the wkhtmltopdf exe which is an executable outside of your code, you might experience again issues if you try to switch to another environment.
If portability is an issue i would roll with a 100% managed c# code library such as ITextSharp or HtmlRenderer for PDF in combination with RazorViewEngine for converting views to html code.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Local notifications are not being added I have code that used to work until recently. It is supposed to schedule a number of local notifications based on a list of given dates.
The code looks like this:
static func scheduleNotifications()
{
    // Here, a list of dates when notifications should appear is
    // created. This is called pendingNotifications. It contains
    // a list of dates and the number of events on that date
    ...

    // Now I want to schedule up to 20 local notifications for
    // each of the dates. The badge should show the number of events
    let sortedDates = pendingNotifications.keys.sorted()
    for i in 0 ..< min(20, sortedDates.count)
    {
        let notificationDate = ...

        let content = UNMutableNotificationContent()
        content.title = "The title"
        content.body = "The description"
        content.sound = UNNotificationSound.default()
        content.badge = NSNumber(value: pendingNotifications[sortedDates[i]]!)

        let ident = UUID().uuidString
        let trigger = UNCalendarNotificationTrigger(dateMatching: calendar.dateComponents(in: calendar.timeZone, from: notificationDate), repeats: false)
        let request = UNNotificationRequest(identifier: ident, content: content, trigger: trigger)

        let center = UNUserNotificationCenter.current()
        center.add(request) { error in
            center.getPendingNotificationRequests() { requests in
                print(requests.count)
            }
        }
    }
}

This code executes without error, but the request count I print in the completion handler always outputs 0 and I don't get any notification displayed.
Then I have a second function that just schedules a sample notification independently of any other criteria:
static func scheduleSampleNotification()
{
    let content = UNMutableNotificationContent()
    content.title = "Test"
    content.body = "Sample Notification!"
    content.sound = UNNotificationSound.default()
    content.badge = 5

    let ident = UUID().uuidString
    let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 60, repeats: false)
    let request = UNNotificationRequest(identifier: ident, content: content, trigger: trigger)
    let center = UNUserNotificationCenter.current()
    center.add(request)
}

If I add a line to scheduleNotifications that calls scheduleSampleNotification right before the comment I wrote about the list of dates being created, the number of pending requests is always 1 and the sample notification also appears after a minute.
I actually don't know what I'm doing wrong here and I'm a bit lost, especially as the same code worked fine before I changed the minimum required iOS version from 9 to 10.3 (in the previous version I checked whether I was running on iOS 9 and used the old way to provide local notifications - now I removed that code as from 10.3 I understand you're supposed to use UNUserNotificationCenter).
I'm testing in the simulator and on an iOS 12 device. I use XCode 10.1.

EDIT
Interesting: When I change from UNCalendarNotificationTrigger to UNTimeIntervalNotificationTrigger all the notifications are scheduled. Maybe something's wrong with my trigger - but all the dates are in the future?

EDIT 2
OK, I found the problem. Obviously, the following does not work anymore:
let dateComponents = calendar.dateComponents(in: calendar.timeZone, from: notificationDate)
let trigger = UNCalendarNotificationTrigger(dateMatching: dateComponents, repeats: false)

while the following does work:
let dateComponents = calendar.dateComponents([.day, .month, .year, .hour, .minute], from: notificationDate)
let trigger = UNCalendarNotificationTrigger(dateMatching: dateComponents, repeats: false)

No idea why, especially as it used to work before...


text:
Q: How can I differenciate this two operator overloading? I am trying to clone the std::map class in c++; I use a std::vector which stores std::pair. And now I am implementing the [] operator. I made two definitions, one is const to acces without modifying and the other is not const.
When compiling it tells me that there is no difference.
This are the declarations:
Using this template:
template<class TClau, class TValor>

TValor& operator[](const TClau& clau);
const TValor& operator[](const TClau& clau);

And this are the definitions:
//m_map is the actual vector with pairs.

template<class TClau, class TValor>
TValor& Map<TClau, TValor>::operator[](const TClau& clau) {
    int l = 0, r = m_length - 1;
    int m;
    if (r >= l) {
        while (r >= l) {
            m = l + (r - l) / 2;
            if (m_map[m] == clau)
                return m_map[m].second;
            if (m_map[m] > clau)
                r = m - 1;

            l = m + 1;
        }
    }
    return TValor;
}

template<class TClau, class TValor>
const TValor& Map<TClau, TValor>::operator[](const TClau& clau) {
    int l = 0, r = m_length - 1;
    int m;
    if (r >= l) {
        while (r >= l) {
            m = l + (r - l) / 2;
            if (m_map[m] == clau)
                return m_map[m].second;
            if (m_map[m] > clau)
                r = m - 1;

            l = m + 1;
        }
    }
    return aux;
}

I would appriciate if someone could help me with this.

A: These operators differ only by the return type.
TValor& operator[](const TClau& clau);
const TValor& operator[](const TClau& clau);

The second operator should be declared with the qualifier const
const TValor& operator[](const TClau& clau) const;

In this case the declarations of the operators are different.
The first operator will be called for a non-constant object and the second operator will be called for a constant object.


text:
Q: Why my swipeleft or swiperight doesn't work with hammerjs? I am using Hammerjs and I just implemented this, but for some weird reason doesn't work. While if I use the dragleft or dragright, it does work but in a weird way where instead of going to the next one, goes to the 2nd image.
Here is the code
            //Hammer(sliderH).on('swiperight',function () {
        $('.slide-horizontal').hammer().on('swiperight', function() {
            $('.slide-horizontal > div').animate({
                'left': '+=' + sliderWidth
            }, 600);
        });
        //Hammer(sliderH).on('swipeleft', function () {
        $('.slide-horizontal').hammer().on('swipeleft', function() {
            $('.slide-horizontal > div').animate({
                'left': '-=' + sliderWidth
            }, 600);
        });

Here I have an example of what I am trying to do.
http://labs.lesevades.com/recipe-book/


text:
Q: editing HTML template I am trying to edit this free template but im stuck with banner. I need to  edit banner so that only image remains and not this red transparent background over it.
Here is the link to the template: http://app-radetic.com/ivanj_t/index.html
and this is css file. I can't find out where in banner section I can change it.

/* Banner */
#banner {
  -ms-flex-align: center;
  -ms-flex-pack: center;
  background-color: #111111;
  color: rgba(255, 255, 255, 0.5);
  -moz-align-items: center;
  -webkit-align-items: center;
  -ms-align-items: center;
  align-items: center;
  display: -moz-flex;
  display: -webkit-flex;
  display: -ms-flex;
  display: flex;
  -moz-justify-content: center;
  -webkit-justify-content: center;
  -ms-justify-content: center;
  justify-content: center;
  background-image: url("../../images/banner.jpg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  border-top: 0;
  display: -ms-flexbox;
  height: 35rem !important;
  min-height: 35rem;
  overflow: hidden;
  position: relative;
  text-align: center;
  width: 100%; }
  #banner input, #banner select, #banner textarea {
    color: #ffffff; }
  #banner a {
    color: #ce1b28; }
  #banner strong, #banner b {
    color: #ffffff; }
  #banner h1, #banner h2, #banner h3, #banner h4, #banner h5, #banner h6 {
    color: #ffffff; }
  #banner blockquote {
    border-left-color: rgba(255, 255, 255, 0.25); }
  #banner code {
    background: rgba(255, 255, 255, 0.075);
    border-color: rgba(255, 255, 255, 0.25); }
  #banner hr {
    border-bottom-color: rgba(255, 255, 255, 0.25); }
  #banner input[type="submit"],
  #banner input[type="reset"],
  #banner input[type="button"],
  #banner button,
  #banner .button {
    background-color: transparent;
    box-shadow: inset 0 0 0 1px #ffffff;
    color: #ffffff !important; }
    #banner input[type="submit"]:hover,
    #banner input[type="reset"]:hover,
    #banner input[type="button"]:hover,
    #banner button:hover,
    #banner .button:hover {
     /box-shadow: inset 0 0 0 1px #ce1b28;
      color: #ce1b28 !important; }
      #banner input[type="submit"]:hover:active,
      #banner input[type="reset"]:hover:active,
      #banner input[type="button"]:hover:active,
      #banner button:hover:active,
      #banner .button:hover:active {
        background-color: rgba(206, 27, 40, 0.25); }
    #banner input[type="submit"].primary,
    #banner input[type="reset"].primary,
    #banner input[type="button"].primary,
    #banner button.primary,
    #banner .button.primary {
      box-shadow: none;
      background-color: #ce1b28;
      color: #ffffff !important; }
      #banner input[type="submit"].primary:hover,
      #banner input[type="reset"].primary:hover,
      #banner input[type="button"].primary:hover,
      #banner button.primary:hover,
      #banner .button.primary:hover {
        background-color: #e2212f;
        box-shadow: none; }
        #banner input[type="submit"].primary:hover:active,
        #banner input[type="reset"].primary:hover:active,
        #banner input[type="button"].primary:hover:active,
        #banner button.primary:hover:active,
        #banner .button.primary:hover:active {
          background-color: #b71824; }
  #banner label {
    color: #ffffff; }
  #banner input[type="text"],
  #banner input[type="password"],
  #banner input[type="email"],
  #banner input[type="tel"],
  #banner input[type="search"],
  #banner input[type="url"],
  #banner select,
  #banner textarea {
    background-color: rgba(255, 255, 255, 0.075);
    border-color: rgba(255, 255, 255, 0.25); }
    #banner input[type="text"]:focus,
    #banner input[type="password"]:focus,
    #banner input[type="email"]:focus,
    #banner input[type="tel"]:focus,
    #banner input[type="search"]:focus,
    #banner input[type="url"]:focus,
    #banner select:focus,
    #banner textarea:focus {
      border-color: #ce1b28;
      box-shadow: 0 0 0 1px #ce1b28; }
  #banner select {
   background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' preserveAspectRatio='none' viewBox='0 0 40 40'%3E%3Cpath d='M9.4,12.3l10.4,10.4l10.4-10.4c0.2-0.2,0.5-0.4,0.9-0.4c0.3,0,0.6,0.1,0.9,0.4l3.3,3.3c0.2,0.2,0.4,0.5,0.4,0.9 c0,0.4-0.1,0.6-0.4,0.9L20.7,31.9c-0.2,0.2-0.5,0.4-0.9,0.4c-0.3,0-0.6-0.1-0.9-0.4L4.3,17.3c-0.2-0.2-0.4-0.5-0.4-0.9 c0-0.4,0.1-0.6,0.4-0.9l3.3-3.3c0.2-0.2,0.5-0.4,0.9-0.4S9.1,12.1,9.4,12.3z' fill='rgba(255, 255, 255, 1.0)' /%3E%3C/svg%3E"); }
    #banner select option {
      color: rgba(255, 255, 255, 0.5);
      background-color: #111111; }
  #banner input[type="checkbox"] + label,
  #banner input[type="radio"] + label {
    color: rgba(255, 255, 255, 0.5); }
    #banner input[type="checkbox"] + label:before,
    #banner input[type="radio"] + label:before {
      background: rgba(255, 255, 255, 0.075);
      border-color: rgba(255, 255, 255, 0.25); }
  #banner input[type="checkbox"]:checked + label:before,
  #banner input[type="radio"]:checked + label:before {
    background-color: #ce1b28;
    border-color: #ce1b28;
    color: #ffffff; }
  #banner input[type="checkbox"]:focus + label:before,
  #banner input[type="radio"]:focus + label:before {
    border-color: #ce1b28;
    box-shadow: 0 0 0 1px #ce1b28; }
  #banner ::-webkit-input-placeholder {
    color: rgba(255, 255, 255, 0.4) !important; }
  #banner :-moz-placeholder {
    color: rgba(255, 255, 255, 0.4) !important; }
  #banner ::-moz-placeholder {
    color: rgba(255, 255, 255, 0.4) !important; }
  #banner :-ms-input-placeholder {
    color: rgba(255, 255, 255, 0.4) !important; }
  #banner ul.alt li {
    border-top-color: rgba(255, 255, 255, 0.25); }
  #banner table tbody tr {
    border-color: rgba(255, 255, 255, 0.25); }
    #banner table tbody tr:nth-child(2n + 1) {
      background-color: rgba(255, 255, 255, 0.075); }
  #banner table th {
    color: #ffffff; }
  #banner table thead {
    border-bottom-color: rgba(255, 255, 255, 0.25); }
  #banner table tfoot {
    border-top-color: rgba(255, 255, 255, 0.25); }
  #banner table.alt tbody tr td {
    border-color: rgba(255, 255, 255, 0.25); }
  #banner .highlights .content {
    background: #111111;
    box-shadow: 0px 0px 4px 1px rgba(255, 255, 255, 0.025); }
  #banner .testimonials .content {
    background: #111111;
    box-shadow: 0px 0px 4px 1px rgba(255, 255, 255, 0.025); }
    #banner .testimonials .content .credit strong {
      color: #ce1b28; }
  #banner > .inner {
    -moz-transform: scale(1.0);
    -webkit-transform: scale(1.0);
    -ms-transform: scale(1.0);
    transform: scale(1.0);
    -moz-transition: opacity 1s ease, -moz-transform 1s ease;
    -webkit-transition: opacity 1s ease, -webkit-transform 1s ease;
    -ms-transition: opacity 1s ease, -ms-transform 1s ease;
    transition: opacity 1s ease, transform 1s ease;
    opacity: 1;
    position: relative;
    z-index: 3; }
    #banner > .inner > :last-child {
      margin-bottom: 0; }
  #banner h1 {
    font-size: 4rem;
    margin-bottom: 1rem; }
  #banner p {
    font-size: 1.5rem; }
  #banner a {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none; }
    #banner a:hover {
      color: #ffffff; }
  #banner video {
    -moz-transform: translateX(50%) translateY(50%);
    -webkit-transform: translateX(50%) translateY(50%);
    -ms-transform: translateX(50%) translateY(50%);
    transform: translateX(50%) translateY(50%);
    bottom: 50%;
    height: auto;
    min-height: 100%;
    min-width: 100%;
    overflow: hidden;
    position: absolute;
    right: 50%;
    width: auto; }
  #banner:before {
    -moz-transition: opacity 3s ease;
    -webkit-transition: opacity 3s ease;
    -ms-transition: opacity 3s ease;
    transition: opacity 3s ease;
    -moz-transition-delay: 1.25s;
    -webkit-transition-delay: 1.25s;
    -ms-transition-delay: 1.25s;
    transition-delay: 1.25s;
    background: #111111;
    content: '';
    display: block;
    height: 100%;
    left: 0;
    opacity: 0.45;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 1; }
  #banner:after {
    background: linear-gradient(135deg, #ce1b28 0%, #111111 74%);
    content: ' ';
    display: block;
    height: 100%;
    left: 0;
    opacity: 0.6;
    position: absolute;
    top: 0;
    webkit-linear-gradientidth: 100%;
    width: 100%;
    z-index: 1; }
  #banner.small {
    height: 30vh !important;
    min-height: 30vh; }
  @media screen and (max-width: 1280px) {
    #banner video {
      display: none; } }
  @media screen and (max-width: 736px) {
    #banner {
      height: auto !important;
      min-height: 0;
      padding: 4rem 2rem 4rem 2rem; }
      #banner .inner {
        width: 100%; }
      #banner h1 {
        font-size: 1.75rem;
        margin-bottom: 0.5rem;
        padding-bottom: 0; }
      #banner p {
        font-size: 1.25rem; }
      #banner br {
        display: none; }
      #banner .button {
        width: 100%; } }
  @media screen and (max-width: 480px) {
    #banner p {
      font-size: 1rem; } }
  body.is-preload #banner .inner {
    -moz-transform: scale(0.99);
    -webkit-transform: scale(0.99);
    -ms-transform: scale(0.99);
    transform: scale(0.99);
    opacity: 0; }
  body.is-preload #banner:before {
    opacity: 1; }

A: This rule is creating the gradient overlay, so try removing it
#banner:after {
     background: linear-gradient(135deg, #ce1b28 0%, #111111 74%);
}

or adding this:
#banner:after {
     background: none!important;
}

Should fix it


text:
Q: how can i verify text under iframe tag Iframe want to verify text
there is a link: Xbshhdss that click it open a iframe and under the iframe there is only a Scripts tag which comes the api frome the other functionality
it is a form that that is to be filled and i want to verify text in the form ho can i please refer image link

A: Please follow the link
Steps to use Frame elements:

*

*Identify the frame by id or name

*Switch to the frame

*find your element.


text:
Q: Python: ModuleNotFoundError and cross-computer compatibility of 'import' (i.e. for homework submissions) I'm trying to submit a script where I tabulate a datalist.
So I go:
from tabulate import tabulate
datalist = [...]
...
print(tabulate(datalist, headers = [..., ..., ...]))

Now on my laptop, I can pip install tabulate through Powershell admin (but not through Python directly, which is another question I have: why?). This allows tabulate to be imported from my script because I guess it's in the path now.
My question is: how do I account for my TA's or prof's computer? They probably won't take the extra step to pip install tabulate.
I am supposed to submit a .zip file so I was thinking maybe I could download some file into my project folder. So I searched for the tabulate documentation and I saw downloadable files (.whl and .tar.gz) but I don't really know what to do with them.
So TLDR:
I wanna learn how to:

*

*make the import function work in my script (straight from the script) no matter which computer it is ran in, and

*use .whl or .tar.gz files to add to my project folder so that no matter what, import still works.


text:
Q: Diazo theming in Plone 4.3 is unresponsive The theming tab in Plone 4.3 on my server is unresponsive. The New theme and Upload zip file buttons both do nothing when clicked and if i press the Save button at the bottom I get the following traceback:
Traceback (innermost last):

Module ZPublisher.Publish, line 60, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 46, in call_object
Module plone.app.theming.browser.controlpanel, line 50, in __call__
Module plone.app.theming.browser.controlpanel, line 166, in update
Module plone.app.controlpanel.skins, line 147, in set_use_popups
AttributeError: 'NoneType' object has no attribute 'setEnabled'

The only thing on the theming control panel that works is activating the theme and also the help button. When clicking on themes or advanced it brings me to the front page of Plone with #fieldsetlegend-advanced in the URL.


text:
Q: Session management in the client side of gwt application Hello All
I am working on the gwt-ext application.On the server side I am using Hibernate.
I am mantaining session on the server side.it's time out is 5 minute (In action class).
Now take a secenario in which a user logged in & remains it open for five minute.After five minutes expires it do a click on a button on the screen.There is some process on the client side & it is of 2 minutes and after that it goes for a server call.When it go for server call it is already session out (as session time is 5 minutes which is already expired).And a message of session out popped up with redirecting the login page.
In this whole case user feels that I am active on the system (After 5 minutes on the client side actually) so why I am redirected to login page.
Reason behind is that that session is maintained on the server side.And server hit is after seven minutes.
So I am thinking to maitain the session on the client side also.How to achieve this in the gwt based application.
Is there any other way to do solve this issue.
Thanks to all.

A: One method would be to check the server regularly, if a timeout has occurred. You would have to write a servlet method which performs that check without renewing the server session timeout! And of course this will result in lots of server hits. (Not necessarily a bad method though!)

But maybe I would use a dfifferent solution, which tries to keep a timer on the client side approximately synchronous with the server's timer, e.g.
Client side:
import com.google.gwt.user.client.Timer;

public class ClientTimers {

    private static final Timer SESSION_MAY_HAVE_EXPIRED_TIMER = new Timer() {

        @Override
        public void run() {
            // Warn the user, that the session may have expired.
            // You could then show a login dialog, etc...
        }
    };

    public static void renewSessionTimer() {

        // First cancel the previous timer
        SESSION_MAY_HAVE_EXPIRED_TIMER.cancel();

        // Schedule again in 5 minutes (maybe make that configurable?)
        // Actually, let's subtract 10 seconds from that, because our timer
        // won't be synchronized perfectly with the server's timer.
        SESSION_MAY_HAVE_EXPIRED_TIMER.schedule(5 * 60 * 1000 - 10000);
    }
}

I assume that your server session timeout gets renewed every time the client performs an interaction with the server, e.g. a GWT-RPC call (if the session hasn't timed out already).
So on the client side, I would then also renew the client timer, in order to keep it roughly synchronous:
 myService.performSomeAction(...) {

     @Override
     public void onSuccess(String result) {

          ClientTimers.renewSessionTimer();

          // remaining onSuccess handling
     }

     @Override
     public void onFailure(Throwable caught) {

          if (failedBecauseOfSessionTimeout()) {

              // redirect to login

          } else {

              ClientTimers.renewSessionTimer();

              // remaining onFailure handling...
          }
     }
 }

Don't forget to call renewSessionTimer() on all interactions (especially directly after login).
Important Note: For all security checks, only use the server session. The client "session timer" is just a convenience for the user. Don't make security/authorization checks dependent on that timer, or on any kind of client session.

A: Considering your scenario when a user does a click on a button on the screen. You can make a server hit and check whether session is alive or not.
let me know if I have get the situation or not.

A: This code will do log out automatically as the time out occurs.For my code I want that on click or key down it should do logout.
Case is like:If user is logged in and time to log out is 5 min.User don't do any activity on the screen than right now as per the above code it will log out automatically as the 5 min complete.
Now my requirement is that if user logged in and it doesn't do any thing for 5 mins.It should not do any logged out automatically.Instead of logging out on completion of 5 min,If user do click or key down on 6 min then it should do the log out process.
Basically the log out process as the timer exceed the specified time should be done on the user activity, not automatically.

A: do get the every page event I have don this....it is working fine.
Ext.get("pagePanel").addListener("click", new EventCallback() {
            @Override
            public void execute(EventObject e) {
                //MessageBox.alert("On Mouse Click");
        });

        Ext.get("pagePanel").addListener("keydown", new EventCallback() {

            @Override
            public void execute(EventObject e) { //
                //MessageBox.alert("On Key Press Click");
            }
        });


text:
Q: How to get SharePoint Site authentication information to use it in an ASP.NET website which is integrated inside that SharePoint Site? I have integrated my ASP.NET website into a SharePoint Site by using an IFrame in the SharePoint Page via a Content Editor Web Part. The ASP.NET web application doesn't have any authentication & authorization implemented in it.But the SharePoint site is having some authentication implemented. Now my requirement is how to get and use that SharePoint authentication information in my ASP.NET web application programmatically to do some code manipulations based on the authenticated user level.Any help would be appreciated.Thanks in Advance

A: The 'Right' way of doing it would be to redevelop your site as a collection of Application pages.  This allows you to limit permissions to Site Collection Administrators, or just about any level of SharePoint Authentication.
http://msdn.microsoft.com/en-us/library/Ee231581(v=vs.100).aspx
This allows you to use the SharePoint object model directly in your 'web' application.
It's a bit complicated to shift from a traditional web application to getting all the pieces running under the Sharepoint _layouts folder, but its worth the time spent and pretty easy to update.
It should be noted that your existing IIS website would be removed and the pages re-homed to that layout folder, via a SharePoint Feature containing your application pages.


text:
Q: I want to remove index from codeigniter URL which have parameters I want to remove index from codeigniter URL which have parameters. Its not index.php but index function inside a controller. Currently my URL looks like this
www.example.com/app1/index/param1/param2
Here i wanna remove index from url so that URL would be
 www.example.com/app1/param1/param2

If i do so now it shows me error as 404 probably because it searhces for function param1 inside app1 controller

A: <IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

try this .htaccess
if this code is not work then goto application/config/config.php
//  Find the below code
$config['index_page'] = "index.php"
//  Remove index.php
$config['index_page'] = ""
//and
//  Find the below code
$config['uri_protocol'] = "AUTO"
//  Replace it as
$config['uri_protocol'] = "REQUEST_URI"

i hope it will be helpful

A: Hey please do following steps ,
application/config/config.php
$config['index_page'] = "index.php" to $config['index_page'] = ""

Root folder create .htaccess  file
Note : Make sure create .htaccess  file not text file .
<IfModule mod_rewrite.c>
  RewriteEngine On
  #RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^ index.php [QSA,L]
</IfModule>

For working .htaccess  file please download here http://wikisend.com/download/862912/.htaccess
Note : In some cases the default setting for uri_protocol does not work properly. Just replace
$config['uri_protocol'] ="AUTO" to $config['uri_protocol'] = "REQUEST_URI"

Coming to the routings :
Codeigniter support two types of routings
i)Wildcards
ii)Regular Expressions
I am giving you wildcards example please check bellow :
application/config/routes.php place this line
$route['/app1/index/(:num)/(:num)'] = "/app1/$1/$1";

For more information please refer the official document  http://www.codeigniter.com/userguide3/general/routing.html

A: Try this:
add route in application/config/routes.php
$route['app1/(:any)/(:any)'] = "app1/index/$1/$2";
use in the App1 class :

public function index($param1, $param2) {
//do something
}

A: As your URL above, your controller looks like this:
<?php
class App1 extends CI_Controller
{
  public function __construct()
  {
    parent::__construct();
  }

  public function index($param1, $param2)
  {
    // ...your code here
  }
}

Try to change your controller again so you don't have to use index as a function.
<?php
class Apps extends CI_Controller
{
  public function __construct()
  {
    parent::__construct();
  }

 public function app1($param1, $param2)
 {
   // ... your code here
 }


text:
Q: If [1 0 -1] and [0 1 2] serve as bases for a subspace, could [1 0 -1] and [1 1 1] also serve as a basis? Since [1 1 1] is a linear combination of [1 0 -1] and [0 1 2], would it be wrong to say that [1 1 1] and [1 0 -1] can serve as the basis for the subspace (assuming that [1 0 -1] and [0 1 2] are the "correct" bases)? If so, why?
I realize that there are an infinite(?) amount of bases for a given subspace (except the subspace of the zero vector), and this situation seems like it should be an example of that, but it also feels wrong somehow. Can anyone confirm or deny?
I think my main confusion stems from the fact that, when you're finding the basis of a column space for example, you eliminate all the column vectors that don't contribute to the vector space because they're dependent on the other vectors. But how do you choose which columns to eliminate and which ones to keep (since all of them can be written as a combination of the others)?
In my example, why do you prioritize keeping [0 1 2] over [1 1 1], even though they can both be written as combinations of each other (with [1 0 -1])?

A: Basis is not unique.
Yes, you are right, it works. The subspace has dimension $2$. Any two non-zero vectors in the subspace that are not multiples of each other do form a basis.
There are some results that help us to find a basis. For example, if you want to find a basis for a row space, one common strategy is to reduce it to RREF, then we know that the non-zero rows form a basis. If we want to find a basis for the column space, then the columns of the corresponding pivot columns of the RREF is  a basis. That gives us a procedure to always being able to find a basis for row space and column space.
Remark:
If we are given two basis, to say that a basis is better than another basis require justification in the sense of what does one mean by "better". Perhaps, by a measure of how other vectors can be expressed as linear combination of them? or by sparseness? If you look at the first set, given a vector in the subspace, we can easily write
$$(x_1, x_2, x_3) = x_1(1,0,-1)+x_2(0,1,2)$$
very quickly.
$$(x_1, x_2, x_3)=(x_1-x_2)(1,0,-1)+x_2(1,1,1)$$
You can see that you still have to compute $x_1-x_2.$
Another possible consideration is perhaps you know that you are collecting data and you know that your data lies inside a subspace. We might purposely want to choose a basis and perhaps even arrange the vector inside the basis as some "directions"
can tell us more information. Your data might tend to lie along a few directions and the other directions are behaving like noise.
If the question is asking us to find a basis, any basis will do. I am just giving you a glimpse of possible applications of linear algebra.

A: The linear combination of the two vectors will fill different subspaces of $R^3$.
In fact, because the vectors are two, the subspaces will be planes.
Thus, we can say that, for these choice of vectors, the subspaces that are originated will be different.
Let's take another example and analyze the vector space $R^2$.
If we consider the vectors [1,0] and [0,1], their linear combination will fill the whole space $R^2$. Now consider another pair of vectors [1,2] and [2,9]; being the vectors linear indipendent, they will fill the whole space $R^2$.
The vectors both originate the same subspace $R^2$, thus, it does not matter which 'bases' we use to originate the same subspace.
If we repeat this process, we will soon realize that there are infinite set of vectors that fill $R^2$. The only condition is that the two vectors are linear indipendent from each others.


text:
Q: selecting records from two csv files python I have two csv files. train_all.csv :
    msno                                         is_churn
0   waLDQMmcOu2jLDaV1ddDkgCrB/jl6sD66Xzs0Vqax1Y=    1
1   QA7uiXy8vIbUSPOkCf9RwQ3FsT8jVq2OxDr8zqa7bRQ=    1
2   fGwBva6hikQmTJzrbz/2Ezjm5Cth5jZUNvXigKK2AFA=    1
3   mT5V8rEpa+8wuqi6x0DoVd3H5icMKkE9Prt49UlmK+4=    1
4   XaPhtGLk/5UvvOYHcONTwsnH97P4eGECeq+BARGItRw=    1
5   GBy8qSz16X5iYWD+3CMxv/Hm6OPSrXBYtmbnlRtknW0=    1
6   lYLh7TdkWpIoQs3i3o6mIjLH8/IEgMWP9r7OpsLX0Vo=    1

It has 1963891 records, but only 1082190 unique records. Thats why i sorted unique msno-s with pandas.
The other csv is about 30GB, cointaining more than 900 million records with user logs.
msno    date    num_25  num_50  num_75  num_985 num_100 num_unq total_secs
rxIP2f2aN0rYNp+toI0Obt/N/FYQX8hcO1fTmmy2h34=    20150513    0   0   0   0   1   1   280.335
rxIP2f2aN0rYNp+toI0Obt/N/FYQX8hcO1fTmmy2h34=    20150709    9   1   0   0   7   11  1658.948
yxiEWwE9VR5utpUecLxVdQ5B7NysUPfrNtGINaM2zA8=    20150105    3   3   0   0   68  36  17364.956
yxiEWwE9VR5utpUecLxVdQ5B7NysUPfrNtGINaM2zA8=    20150306    1   0   1   1   97  27  24667.317
yxiEWwE9VR5utpUecLxVdQ5B7NysUPfrNtGINaM2zA8=    20150501    3   0   0   0   38  38  9649.029

I would like to iterate through the unique msno-s in train_all.csv and search for 5 user_log records in user_logs.csv for each msno. My code stops after about 20 minutes with only 104 records in the results.csv - desired output file with matched msno - user_logs.
import pandas as pd
import csv

reader = csv.reader(open('user_logs/user_logs.csv','r'))
writer = csv.writer(open('results.csv','w',newline=''))

data = pd.read_csv("train_all.csv")
unique_msnos = data["msno"].unique()

i = 0

for msno in range(len(unique_msnos)):
    counter = 0

    for row in reader:
        results_row = row

        if unique_msnos[msno] == row[0]:
            writer.writerow(results_row)
            counter+=1
            if counter == 5:
                i+=1
                break
            else:
                continue
        else:
            continue

A: Probable reason why it stops without finding everything:

*

*the inner loop advances the position in the file every time it reads a row.

*when you break out of the inner loop the the file counter/pointer/position(?) remains at the place it left off

*during the next iteration of the outer loop, the inner loop starts at the last file position instead of at the beginning. So it cannot find any valid msno's in the previous lines/rows of the file. You can verify this by printing the file's position (file.tell()) just before the inner loop (remember ctrl-c to break out of it.)

You can fix this by sending the file back to the beginning after the inner loop has completed (whether by StopIteration or a break) so that the inner loop can search through the whole file looking for the msno. Be prepared for a much longer wait.
with open('user_logs/user_logs.csv','r') as infile:
    reader = csv.reader(infile)
    for msno in range(len(unique_msnos)):
        counter = 0
        #print(infile.tell())
        for row in reader:
            #inner_loop_stuff...
            #inner_loop_stuff...
            #inner_loop_stuff...
        infile.seek(0)

unique_msnos has 1.1E6 records, reader has 9E8 records.  For each record in unique_msnos you will iterate 9e8 times - that would come to 1e15-ish  iterations.  You have to be careful with nested loops.
When checking for membership you should use a set.
unique_msnos = set(unique_msnos)

You want to keep track of the number of records you find so maybe make unique_msnos a dictionary with the value holding the count.
unique_msnos = dict.fromkeys(unique_msnos, 0)

Then iterate over reader check for membership and adding logic to see if there are already 5:
for row in reader:
    c = unique_msnos.get(row[0], None)
    if c in (5, None):
        continue
    writer.write(row)
    unique_msnos[row[0]] += 1
    ...

This should alleviate it somewhat - 9e8 iterations.  There are probably other optimizations.

If the msno-s are guaranteed to all be the same length you may get an incremental improvement using slicing instead of using a csv.Reader.  I really don't know how fast csv readers are but slicing is pretty fast.
Something like
# unique_msnos is a dictionary
with open(open('user_logs/user_logs.csv','r') as f:
    for line in f:
        c = unique_msnos.get(line[:44], None)
        ....

It won't reduce the iteration count but if if you get (a_small_improvement * 9e8) improvement it might be noticeable.

Looks like you are making a DataFrame then throwing it away. It may be faster to just make unique_msnos directly from the file:
unique_msnos = {}
with open("train_all.csv") as f:
    for line in f:
        _, msno, churn = line.split()
        unique_msnos[msno] = 0

You would need to try it to see if it is faster.

You may want to make yourself some smaller files to work with while you are trying to get it to work and making optimizations. Just do it once for each file then use the small files for debuging.  Using cprofile or timeit to try and figure out where the bottlenecks are
limit = 10000  # or whatever
with open(file_path, 'r') as infile, open(small_filepath, 'w') as outfile:
    for n, line in enumerate(infile):
        outfile.write(line)
        if n == limit:
            break


text:
Q: How do I put array into columns     $db = mysql_connect("", "", "") or die("Could not connect.");
mysql_select_db("",$db)or die(mysql_error());
$sql = "SELECT * FROM table where 1";
$pager = new pager($sql,'page',6);
while($row = mysql_fetch_array($pager->result))
{
    echo $row['persons']."
";
}
 mysql_close($db);

above code output :
Mathew
Thomas
John
Stewart
Watson
Kelvin
What I need is it should split inot multiple columns say:
Mathew   Stewart
Thomas   Watson
John     Kelvin
HOw do I do this??

A: $i = 0;
$columnCount = 2;
echo '
';
while($row = mysql_fetch_array($pager->result))
{
     $newRow = ( $i % $columnCount == 0 );
     if( $newRow ) {
        echo '
';
     }
     echo '' . $row['persons'] . '	';
     if( $newRow ) {
        echo '
';
     }
     $i++;
}
echo '
';


text:
Q: modifiy .csproj from AfterBuild target I have a Afterbuild target in which I add some generated files to a project (.csproj). Now when the build completes Visual Studio says 'the project has been modified outside the environment' and asks whether I want to reload.
Is there to make it auto-reload (without using tools->options or environment->options) from msbuild?


text:
Q: Performance benchmarking nifi template flow I have developed a NiFi template, which would be run out of several client environments. I would like to know what are my options with respect to performance benchmarking the template flow against a pre-defined hardware configuration?

A: This question is too broad to answer in detail, but the basic steps:
1. Set up a representative environment (with a good amount of data flowing in/out)
2. Configure the system properly
The second step is more art than science, but the answer to this HCC question lists is a nice set of things to consider: https://community.hortonworks.com/questions/82485/nifi-sizing-benchmark-conditions-and-number-of-sou.html
It covers IO, CPU, RAM


text:
Q: Combine rows together that are duplicates I have a data frame with 4 columns and several thousands rows.  The first two columns are geographical identifiers, the third one is a date, and the last one is the number of shipments in that date.
For example:
London UK 4/4/2018 1
London UK 4/4/2018 1
London UK 4/5/2018 3
London UK 4/5/2018 2

I would like to combine the rows so as to have only one row per city, country, and date.
For example, the above data would become:
London UK 4/4/2018 2
London UK 4/5/2018 5

Thank you for all help in advance.

A: Here is your solution:
# 1. Data set
df <- data.frame(
  country = c("UK", "UK", "UK", "UK"),
  city = c("London", "London", "London", "London"),
  date = c("4/4/2018", "4/4/2018", "4/5/2018", "4/5/2018"),
  shipment = c(1, 1, 3, 2))

# 2. Group by 'country', 'city', and 'date' features
df %>%
  group_by(country, city, date) %>%
  summarise(shipment = sum(shipment))


text:
Q: Terra extract returns Nan value I have tried to extract some temperatures for a given shapefile over North America. I used the terra package for extracting this data. It works for 14 of 16 areas in the shapefile. When I even try to only include the shapefile that does not work, I still receive Nan values.
library(terra)
temperature = rast('path/temperature.tif)
shape = vect('path/shape.shp')
plot(temperature)
plot(shape, add = T)

x = extract(temperature,shape, "mean")
x

  ID Temp_1
1  1  NaN

The crs are the same for both the shapefile and tif file, I checked:
[1] "GEOGCRS[\"WGS 84\",\n    DATUM[\"World Geodetic System 1984\",\n        ELLIPSOID[\"WGS 84\",6378137,298.257223563,\n            LENGTHUNIT[\"metre\",1]]],\n    PRIMEM[\"Greenwich\",0,\n        ANGLEUNIT[\"degree\",0.0174532925199433]],\n    CS[ellipsoidal,2],\n        AXIS[\"geodetic latitude (Lat)\",north,\n            ORDER[1],\n            ANGLEUNIT[\"degree\",0.0174532925199433]],\n        AXIS[\"geodetic longitude (Lon)\",east,\n            ORDER[2],\n            ANGLEUNIT[\"degree\",0.0174532925199433]],\n    ID[\"EPSG\",4326]]"

Why do I get this error?
The data is here.

A: The issue comes from NA values. Temperature raster has some NA in the continent. Sea is masked out as well:
plot(is.na(temperature))
plot(shape, add = T)

You must use a function able to handle NA values:
extract(temperature, shape, function(x) mean(x, na.rm = T))
#  ID     DC_1
#1  1 12.54495


text:
Q: Is there Sparse Matrix in Matlab allowing reading data entry in O(1) time? To efficiently add/delete any non-zero entry in the sparse matrix, binary-tree etc will be used to let such operation completed in O(logN) time where N is the number of non-zero entries. Thus, reading a non-zero entry can also cost O(logN) time.
However, in practice,  we may have no need to add/delete any entry on a sparse matrix A, but only need to read its non-zero entries to do matrix-vector multiplication Ax. So, I hope to read any non-zero entry of A very fast, maybe in O(1) time.
My question is, Matlab can do such thing?

A: It is theoretically possible. From what I saw on the internet (this and this), Matlab uses  Dictionary of keys (DOK) to store sparse matrix, though I couldn't find any solid statement on that part. A dictionary has an access time of O(1) ofc.
To answer if Matlab actually does this I would suggest running some simple testing with time measuring (using timeit or tic + toc).


text:
Q: Firewall Blocked Port Remains Open I'm using Windows Firewall to block port 4643, however when I do a Open Port Scan 4643 is shown to be open.
Firewall rule settings are set to block connections on all profiles (Domain, Private & Public), IP scope is set to Any, this is an Inbound Rule.
Does anyone know why it would still show the port as open? Thanks.


text:
Q: Problems with HD after reboot My computer suddenly ran out of battery, and when i started it again, it doesnt recognize my external hd, and also is showing "efi" and "Filesystem root" options in the file explorer, and it does not show my second partition of the hd, that was only with pdf's and some codes.
Detail: Using Debian
Other locations option in file explorer
The options that appear in the file explorer

A: fsck can likely help fix. Easiest way to fix is to use a Live USB and boot into a Ubuntu Linux Live environment, open the 'Disks' utility and under the options, click the partition in quesiton, and try 'Repair the filesystem' under the 2 gears icon. If this is really sensitive data I think you may be able to mount it and copy off the files before you run the repair, though not always the case depending on how damaged Ubuntu thinks the partition is.
More info on fsck: https://www.tecmint.com/fsck-repair-file-system-errors-in-linux/


text:
Q: Approximating exp(x) with a piecewise-linear function accurately I am looking for the best way to approximate $\exp(x)$ on a finite domain $[0,M]$ with a piecewise-linear function. My initial approach is to take $K$ evenly-spaced segments from $0$ to $M$. For each segment $[s_k, s_{k+1}]$, I add the line from point $(s_k, \exp(s_k))$ to point $(s_{k+1}, \exp(s_{k+1}))$.
But what I've noticed is that the approximation gets worse for segments closer to $M$. Intuitively, this suggests that the segments need to start large and then reduce in size as we approach $M$. But how would one approach this formally? I am also interested in heuristics, or approximations.

A: For $b$ not much larger than $a$, the maximum difference between $e^x$ and the line from $(a,e^a)$ to $(b,e^b)$, for $x\in[a,b]$, is approximately $\frac 18 (b-a)^2 e^a$.
So you should choose your points so that $(b-a)^2 e^a$ is approximately constant for each interval. After selecting the first interval, use this rule to select further intervals. They will get gradually smaller.

A: If you choose the $L^2$ norm, computing
$$\Phi(a,b)=\int_a^b \Big[\alpha+\beta\, x -e^x\Big]^2\,dx$$ and minimizing, we have
$$\beta(a,b) =\frac{6}{(b-a)^3}\Big[(b-a +2)\,e^a+(b-a-2)\,e^b\Big]$$
$$\alpha(a,b)=\frac{e^b-e^a}{b-a}-\frac{1}{2} (a+b) \, \beta $$
$$2(a-b)^3\, \Phi_{\text{min}}(a,b)=
\left(-e^a (a-b-2)-e^b (a-b+2)\right)\times $$ $$ \left(e^a \left(a^2-2 a (b+3)+b
   (b+6)+12\right)-e^b \left(a^2-2 (a+3) b+6 a+b^2+12\right)\right)$$
So, for the next point $c$, if we want to keep the same $\Phi_{\text{min}}=k$,  we need to find it such that
$\Phi_{\text{min}}(b,c)=k$. This does not make any problem using Newton method
$$\Phi'_{\text{min}}(b,c)=\frac{\left(e^c \left(b^2-2 (b+2) c+4 b+c^2+6\right)+2 e^b (b-c-3)\right)^2}{(b-c)^4}$$
For the first $c$, we can use $c_0=b+\theta(b-a)$, the first $\theta$ being empirically set equal to $0.5$ ad the next would be updated readjusting $\theta$ from the previous iteration
Suppose that we start with $a=1$ and $b=3$; this gives $k=e^2 \left(e^2-7\right)$ and the iterates are
$$\left(
\begin{array}{cc}
n & c_n \\
 0 & 4.000 \\
 1 & 4.133 \\
 2 & 4.104 \\
 3 & 4.101
\end{array}
\right)$$
This allows a recursive definitions of the next points to be used.


text:
Q: Optimal memory configuration on Dell R610 - 4 x 4GB and 2 x 8GB? I'm trying to install memory into a Dell R610 server, and am honestly at wit's end.
The DIMMS I have are:

*

*4 x 4GB DDR3

*2 x 8GB DDR3

I tried putting in the 4 x 4GB sticks in A1, A2, B1, B2 and the 2 x 8GB sticks in A3, B3 - but it complained:
The following DIMMS should match in size and geometry: DIMM A1, A2 & A3

I then tried putting in the 4 x 4GB sticks all on one CPU - A1, A2, A3 and A4. With the 2 x 8GB sticks on B1, B2.
However, it then complained about:
The memory configuration is not optimal.

CPU 1
A1:  DIMM A
A4:
A2: DIMM A
A5:
A3: DIMM
A6:

DIMM configuration on each CPU should match.

I tried to follow the guide at http://www.dell.com/downloads/global/products/pedge/en/server-pedge-installing-upgrading-memory-11g.pdf, but couldn't seem to get it optimal.
Does anybody know what configuration I should be using?

A: The 610 has got three RAM channels, so A1, A2, A3 should have the same module size & type, and B1, B2, B3 should have the same module size & type.
Single CPU:
With 4 + 2 modules, there's no optimal layout.
The best solution is to replace one of the 4 GB DIMMs with a 8 GB DIMM, so you get two matching triplets.
Dual CPUs:
Plug 8 + 4 + 4 GB into each CPU's sockets, one DIMM per channel.


text:
Q: Found corrupted data while opening file using Google Sheets I've been able to query from a Google Sheets table just fine for the past 6 months to a year and then all of a sudden I'm receiving the error: "Found corrupted data while opening file." Does anyone know why this is occurring even though there were no changes made to the Google Sheet.

A: I had the same problem. My tables' source format was CSV while using a spreadsheets.
To solve it, I deleted the table and recreated it with "Google Sheet" as source format.
For other tables I couldn't delete, I changed the source format by making a REST call.
https://cloud.google.com/bigquery/docs/reference/rest/v2/tables/update
Both solutions worked.

A: this happens occasionally...the error is on Google's side. the best course of action is to contact Google Sheets support and request recovery of your spreadsheet. it may take them 1-3 weeks to do so.


text:
Q: How to replace javascript file in some condition on pageload I'm trying to build a script that replaces original javascript file in some conditions.
When I ran the code(link inside) itself, it worked fine.
But it doesn't work when i uploaded the js file and appended it.
// ==UserScript==
// @name         test
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        http://agar.ddack.oa.gg/
// @grant        none
// ==/UserScript==
if (window.top === window.self) {
    var script = document.createElement( 'script' );
    script.type = 'text/javascript';
    script.src = 'http://yourjavascript.com/2020170916/botcore.js';
    $("body").append(script);

} else {
}

I tried this but it doesn't work..
It seems that it doesn't work on pageload and I have no idea to make this work.
please help my noob question.

A: You can use document.write to get your script to run immediately.
if (window.top === window.self) {
    document.write('<script type="text/javascript src="http://yourjavascript.com/2020170916/botcore.js"></script>'
}


text:
Q: Using an enum loaded from another Groovy file (Jenkins Pipeline issue) I have the following Groovy script as part of a Jenkins pipeline
permissions.groovy
enum PermissionType {
  ANONYMOUS,
  AUTHENTICATED
}

def get_job_permissions(PermissionType permission) {
  ...
}

return this

I load this file into another Groovy file as part of my Jenkins pipeline and call get_job_permissions passing through one of the enums as a parameter.
pipeline.groovy
def job_permissions = load 'permissions.groovy'
job_permissions.get_job_permissions(job_permissions.PermissionType.AUTHENTICATED)

Jenkins fails on this with the following error (I've verified that in this case 'Script3' is the call to get_job_permissions with the enum parameter).
groovy.lang.MissingPropertyException: No such property: PermissionType for class: Script3

I know the script load and call is correct, as I can change the signature of get_job_permissions to the following, pass through a random string in pipeline.groovy and the call goes through correctly.
def get_job_permissions(def permission) {
  ...
}

If I don't change the signature, and still pass through a random string, Jenkins fails the build as it can't find the method it thinks I'm calling (which is true, it's not there, it's expecting a PermissionType type).
I've tried a number of different things to expose PermissionType to the calling script

*

*Adding @Field (not legal Groovy)

*Changing the enum definition to public def PermissionType (not legal Groovy)

*Removing and adding public to the enum definition

*Changing the case (though I believe enums need to start with an upper case character?)

None of these solutions allow me to reference the enum type from the calling script, and I understand this is because I'm trying to access a type by referencing it through an instance of the script.
But if I can't do it this way, what is the best way to do it?
Thanks

A: I managed to get something to work - I certainly know it's probably not the right, or even good, way to do it, but it unblocked me and gave me what I needed.
Rather than define the enum in a script as you normally would
enum PermissionType {
  ANONYMOUS,
  AUTHENTICATED
}

I created a class containing the enum with member variables initialised to the values within the enum.
permissions.groovy
public class PermissionTypes {

  public enum Values {
    ANONYMOUS,
    AUTHENTICATED
  }

  public final PermissionTypes.Values ANONYMOUS = PermissionTypes.Values.ANONYMOUS
  public final PermissionTypes.Values AUTHENTICATED = PermissionTypes.Values.AUTHENTICATED
}
@Field final PermissionTypes Permissions = new PermissionTypes()

I can then expose an instance of that class in the script, load it as normal and I finally get access to the enum values.
pipeline.groovy
def job_permissions = load 'permissions.groovy'
job_permissions.get_job_permissions(job_permissions.Permissions.AUTHENTICATED)

I think we can all agree this is slightly bonkers, but it gave me what I needed.
Only issues I have with this (which I can live with for now)

*

*You can only load the file ones in a script otherwise you get a duplicate class exception

*You can't use the type in an external method, only the values - OK for me since any methods taking in the type are local to the class definition

Would still love to know the right way to do this :)

A: I ran into this problem recently and found a different solution that looks less hacky.
enum PermissionType {
  ANONYMOUS,
  AUTHENTICATED
}

def get_job_permissions(PermissionType permission) {
  ...
}

// Do this before you return out to make the enum available as well
this.PermissionType = PermissionType

return this

A: I prefer to use:
MyEnumClass.groovy:
package cl.mypackage.utils

class MyEnumClass {
    static enum MyEnum {
        FOO, BAR, QWERTY
    }
}

How to use:
import cl.mypackage.utils.MyEnumClass

def in_some_place() {
    def fooEnum = MyEnumClass.MyEnum.FOO
}

Regards


text:
Q: Using javascript "GroupImage.src=GroupDB[i].picture" adds "%26/#47" I'm trying to add an image to a 'div' dynamically generated. For that I use:
GroupImage = document.createElement("img");
            GroupImage.src=GroupDB[i].picture;

CurrentGroup.appendChild(GroupImage);

CurrentGroup is a div and "GroupDB[i].picture" contains an URL. In this case the URL is: https://lh4.googleusercontent.com/-ugAXmjWxPm0/UNfk2VwTa6I/AAAAAAAAGpE/88dMKe8VaeI/s144/376290009_1ddbf70515_b.jpg
 which points to a picture but when using it with GroupImage.src=GroupDB[i].picture I get the URL plus '%26/#47'
but when I use "GroupImage.src=GroupDB[i].picture" what I get is <'img src="https:&#47/lh4.googleusercontent.com/-ugAXmjWxPm0/UNfk2VwTa6I/AAAAAAAAGpE/88dMKe8VaeI/s144/376290009_1ddbf70515_b.jpg'> which adds the "%26/#47" portion and does not open the link. Can anyone help me unsertand what happens?
Thanks!

A: As you can see here (http://jsfiddle.net/q4vEu/), it's working..
var CurrentGroup = document.getElementById('currentgroup');
var GroupDB = [{
    picture: "https://lh4.googleusercontent.com/-ugAXmjWxPm0/UNfk2VwTa6I/AAAAAAAAGpE/88dMKe8VaeI/s144/376290009_1ddbf70515_b.jpg"
}];
var GroupImage = document.createElement('img');
GroupImage.src = GroupDB[0].picture;
CurrentGroup.appendChild(GroupImage);

The image is successfully loaded.


text:
Q: How to convert TikZ coordinates into PGF coordinates? I have several coordinate specified in TikZ, say
\coordinate (a) at (0.4, 1.7);
\coordinate (b) at (3.2, 1.7);
\coordinate (c) at (1.7, 4.7);
\coordinate (cog) at ($1/3*(a) + 1/3*(b) + 1/3*(c)$);

Now I'm trying to use the (cog) coordinate in PGF commands, for example:
\pgftransformshift{<the (cog) coordinate>}

I already tried putting in (cog) or cog but it doesn't work as desired. So my question is: How do I convert my coordinate specified in TikZ so that I can use it inside PGF commands?

A: Coordinates also have anchors (well, only center anchor) and that can be used for referencing.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\draw[style=help lines] (0,0) grid[step=1cm] (5,5);
\coordinate (a) at (0.4, 1.7);
\coordinate (b) at (3.2, 1.7);
\coordinate (c) at (1.7, 4.7);
\coordinate (cog) at ($1/3*(a) + 1/3*(b) + 1/3*(c)$);
\pgftransformshift{\pgfpointanchor{cog}{center}}
\draw (0,0) -- (2,2);
\end{tikzpicture}
\end{document}


text:
Q: Is it possible to Add the Notepad++ Open to Close tag Lines to Visual Studio? I would like to add the lines that Notepad++ has that go from the opening tag to the closing tag to Microsoft Visual Studio.
I have searched all over and cant really find much on this so I thought I would take a shot here.

A: This VS Extension does what you want: Indent Guides Extension - Visual Studio Gallery

Adds vertical lines at each indent level.
...
Guides can be shown and customized for any language in Visual Studio.

It's also open sourced on CodePlex and can be customized if the behavior is not particularly to your liking.
Based on StackOverflow - Visual Studio 2013 Vertical Brace Lines, it appears that a form of this is native to the newest versions of Visual Studio. However, some users don't appear to be fond of its formatting. See @stevethethread's answer  to that question for how to remove it if you don't like that formatting style.


text:
Q: Index controller action is not executed and view not rendered Rails 3.2

In my admin/tickets_controllers.rb, I have the following:
def index
  params[:direction] ||= "desc"
  params[:sort] ||= "requested_date_start"
  @tickets = Ticket.solr_search( include: [:customer_info, :customer, :executor, :notes] ){
    fulltext params[:query] if params[:query].present?
    with :status, (params[:status] || params[:filter]) if (params[:status] || params[:filter]).present?
    order_by( params[:sort], params[:direction] ) if params[:sort].present? && params[:direction].present?
    paginate :page => params[:page], per_page: params[:per_page]
  }.results
  render partial: 'tickets' if request.xhr?
end

def destroy
  @ticket = Ticket.find params[:id]
  existing_workflow_state = @ticket.workflow_state
  msg_success = "Ticket #{@ticket.number} status has been changed from  #{existing_workflow_state} to cancelled"
  msg_already_cancelled = "Ticket #{@ticket.number} is already cancelled"
  msg_failure = "Ticket #{@ticket.number} status is  #{@ticket.workflow_state}, it cannot be cancelled"
  if existing_workflow_state == 'cancelled'
    redirect_to admin_tickets_path, alert: "Ticket #{@ticket.number} has already been cancelled"
  elsif !ticket_can_be_deleted(@ticket).nil?
    @ticket.workflow_state = 'cancelled'
    @ticket.save
    redirect_to admin_tickets_path, notice: "Ticket #{@ticket.number} status has been changed from  #{existing_workflow_state} to cancelled"
  else
    redirect_to admin_tickets_path, alert: "Ticket #{@ticket.number} status is  #{existing_workflow_state}, it cannot be cancelled"
  end
end

private
  def ticket_can_be_deleted(ticket)
    w = ticket.workflow_state
    if (w == 'closed') || (w == 'completed') || (w == 'submit_for_billing') || (w == 'needs_correction') || (w == 'cancelled')
      return nil
    else
      return true
    end
  end

The following is the route:
admin_tickets GET   /admin/tickets(.:format) admin/tickets#index

However, when I execute the Destroy action, nothing happens. The log file tells me:
Started DELETE "/admin/tickets/177685" for xx.xxx.xxx.x at 2018-09-06 16:58:53 +0000
Processing by Admin::TicketsController#destroy as */*
  Parameters: {"id"=>"177685"}
  ......
Redirected to http://test.myapp.com/admin/tickets
Completed 302 Found in 43.8ms (ActiveRecord: 30.9ms)
Started DELETE "/admin/tickets" for xx.xxx.xxxx.xx at 2018-09-06 16:58:54 +0000
Processing by ApplicationController#routing_error as */*
  Parameters: {"unmatched_route"=>"admin/tickets"}
  ....
Completed 404 Not Found in 14.0ms

ActionController::RoutingError (No route matches admin/tickets):
  app/controllers/application_controller.rb:129:in `routing_error'
  app/middleware/catch_json_parse_errors.rb:8:in `call'

But, if I hit the browser refresh button, immediately after, I get the tickets Index, with the following alert on top:
Ticket 177685 has already been cancelled

And the log file has in it:
Started GET "/admin/tickets" for xx.xxx.xxx.x at 2018-09-06 17:05:07 +0000
Processing by Admin::TicketsController#index as HTML
.....
  Rendered shared/_index_search_form.html.slim (0.8ms)
  Rendered admin/tickets/_ticket.html.slim (87.5ms)
  Rendered shared/_no_result.html.slim (0.0ms)
  Rendered admin/tickets/index.html.slim within layouts/application (95.8ms)
Completed 200 OK in 140.2ms (Views: 101.5ms | ActiveRecord: 14.7ms | Solr: 4.0ms)

Any ideas why the admin/tickets Index view is not rendered, and needs a browser refresh for that to happen?

A: You need to specify the status when redirecting:
redirect_to ..., status: 303
Explanations in a Redirect_to from Destroy action always gets DELETE verb whatever :method I declare
 and https://api.rubyonrails.org/classes/ActionController/Redirecting.html#method-i-redirect_to
The documentation says the following:
It is also possible to assign a flash message as part of the redirection. There are two special accessors for the commonly used flash names
+alert+ and +notice+ as well as a general purpose +flash+ bucket.

  redirect_to post_url(@post), alert: "Watch it, mister!"
  redirect_to post_url(@post), status: :found, notice: "Pay attention to the road"
  redirect_to post_url(@post), status: 301, flash: { updated_post_id: @post.id }
  redirect_to({ action: 'atom' }, alert: "Something serious happened")

So it is possible to specify both status and notice options. However, make sure to put them in the same order as the doc.
If that still fails for you, you can try using the flash option instead


text:
Q: Node.js parallel tasks with Napajs I'm trying to sort array of 10million values. Found new technology from Microsoft - Napa.js that allows use multi-threading with Node.js.
There we use following code:
const napa = require('napajs')
const zone = napa.zone.create('zone', { workers: 4 });
zone.execute((...args) => {
  // here I can take anything I want to execute in a native thread
  // but it is also possible to implement shared memory for all
  // threads, but I can't find out how
}, [args])

Help me to understand, what to allocate. what is handler and how to use TransferContext if it needed for this task.
Ant at least how to use all this knowledge to create shared memory for my threads ?

A: An update:
Napa.js (>=0.2.0) now supports transporting JavaScript built-in types such as SharedArrayBuffer without copying. You may find example Parallel Quick Sort for particular this problem.

This is an interesting problem. Currently, arguments passing between workers are serialized/deserialized by default in Napa.js. We may want a better solution of sharing array across workers without copying.
I saw the feasibility as following:

*

*Assume we use int32 array to hold the 10M values in main JS
thread.

*Create an addon to get the raw pointer of the array via
v8::Int32Array::Buffer()::Externalize(). (This let user to manage
the memory, we may need some lifecycle management)

*Pass the raw pointer to another worker.

*Worker to create an v8::Int32Array
from a raw pointer (through a externalized ArrayBuffer).

This pattern is so common that I think it might be a good idea to have it included in Napa.js. I have placed a feature request Introduce Buffer class that can be transferred across workers without copying.
BTW, TransportContext is used to transfer std::shared_ptr from one worker to another worker, in this case I think it's more about how we share array across workers.


text:
Q: Python xpath - how to get textcontent from node? I am trying to convert a script from PHP (which I know well) to Python (which I am just learning).
Conceptually, I use an xpath selector to find a node from a DOM tree which I construct using html.fromstring. This gets me, example, a reference to a "TD" node from a table.
In PHP, I can then use $node->item(0)->textContent to get whatever the text is in that node, regardless of any other markup. This is helpful because sometimes there are other HTML tags - font, b, p, etc., and the pattern where the text ends up isn't consistent.
In Python, I use the following syntax:
text = row.xpath("./td[1]/text()")
However that comes back as matching nothing. If I omit the /text(), it matches the node, and if I try and print the node, I get something like [] - so it's clearly an object, not a string.
if I use this syntax:
text = row.xpath("./td[1]/b/font/p/text()")
This does get me the text (in list format), however the HTML is not always bolded, and is not always within a font tag.
So my question is, how can I get any text that is within the selected object?


text:
Q: Python setup.py with private repository on GitLab as dependency_links based on commit ID I am trying to install a private dependency (not something that Python could find on PyPI).
I have added to the file setup.py this (as explained here: https://python-packaging.readthedocs.io/en/latest/dependencies.html#packages-not-on-pypi):
dependency_links = [
        'https://gitlab.com/<PRIVATE_ORG>/<PRIVATE_REPO>.git@<COMMIT_ID>'
      ]

On that official documentation they don't really explain in details what's the format of that URL, however using a <COMMIT_ID after the @ sounds reasonable (as it's done in a variety of other languages and dependency management tools).
When executing the command python setup.py install then I see in the logs/output this:
Reading https://gitlab.com/<PRIVATE_ORG>/<PRIVATE_REPO>.git@<COMMIT_ID>

but then I don't see that package being actually installed as I can see from the logs/output for other dependencies.
I know there is a valid GitLab access token setup for my git command, because I've run this:
git config \
      --global \
      url."https://<ACCESS_TOKEN_NAME>:<ACCESS_TOKEN_VALUE>@gitlab.com".insteadOf \
      "https://gitlab.com"

and I can see it when checking the git config with:
git config --list | grep gitlab
url.https://<ACCESS_TOKEN_NAME>:<ACCESS_TOKEN_VALUE>@gitlab.com.insteadof=https://gitlab.com

*

*Is Python using the git command when running setup.py?

*How can I specify a private GitLab dependency inside a Python setup.py file? It should be based on a commit ID rather than a package version

*What's wrong with the above?

*I have also the feeling this may be running differently when using pip install and targeting setup.py instead of running python setup.py install, is there a unique way of making this work with both flavors of Python installations? I am asking this because when fiddling with dependency_links I was trying various things like git+ssh instead of https and other variations, all of them failing to install that private repository with various log/outputs saying that repository was not found.

Edit
I've avoided dependency_links because it seems deprecated, so I used the solution proposed in the answer as:
install_requires=[
    ...
    "mylibraryname @ git+https://<ACCESS_TOKEN_NAME>:<ACCESS_TOKEN_VALUE>@gitlab.com/<PRIVATE_ORG>/<PRIVATE_REPO>.git@<COMMIT_ID>",
    ...
],

However when executing python setup.py install --record installed_files.txt, then the installation fails with this message:
Searching for mylibraryname@ git+https://<ACCESS_TOKEN_NAME>:<ACCESS_TOKEN_VALUE>@gitlab.com/<PRIVATE_ORG>/<PRIVATE_REPO>.git@<COMMIT_ID>
Reading https://pypi.org/simple/mylibraryname/
Couldn't find index page for 'mylibraryname' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.org/simple/
No local packages or working download links found for mylibraryname@ git+https://<ACCESS_TOKEN_NAME>:<ACCESS_TOKEN_VALUE>@gitlab.com/<PRIVATE_ORG>/<PRIVATE_REPO>.git@<COMMIT_ID>
error: Could not find suitable distribution for Requirement.parse('mylibraryname@ git+https://<ACCESS_TOKEN_NAME>:<ACCESS_TOKEN_VALUE>@gitlab.com/<PRIVATE_ORG>/<PRIVATE_REPO>.git@<COMMIT_ID>')

So I tried to use pip install . assuming there is a setup.py file in the current directory, this worked:
Collecting mylibraryname@ git+https://<ACCESS_TOKEN_NAME>:<ACCESS_TOKEN_VALUE>@gitlab.com/<PRIVATE_ORG>/<PRIVATE_REPO>.git@<COMMIT_ID> from git+https://<ACCESS_TOKEN_NAME>:****@gitlab.com/<PRIVATE_ORG>/<PRIVATE_REPO>.git@<COMMIT_ID> (from <MY_LIBRARY_WITH_SETUP_PY>==<MY_LIBRARY_VERSION>)
  Cloning https://<ACCESS_TOKEN_NAME>:****@gitlab.com/<PRIVATE_ORG>/<PRIVATE_REPO>.git (to revision <COMMIT_ID>) to /tmp/pip-install-bakazwe2/mylibraryname
  Running command git clone -q https://<ACCESS_TOKEN_NAME>:sYzRKNsYAnv5GtS6zLZj@gitlab.com/<PRIVATE_ORG>/<PRIVATE_REPO>.git /tmp/pip-install-bakazwe2/mylibraryname

This solution seems to work only when using pip install . in a directory containing setup.py. This does not work with python setup.py install --record installed_files.txt.

A: https://python-packaging.readthedocs.io/ is quite old and outdated. Its sources was last updated at Dec 29, 2016 and most parts of it were not updated since 2012. Python packaging landscape changed significantly since that times. The new docs are at https://packaging.python.org/
dependency_links were declared obsolete and finally removed in pip 19.0. The replacement for it is install_requires with special syntax (supported since pip 19.1):
install_requires=[
    'package_name @ git+https://gitlab.com/<PRIVATE_ORG>/<PRIVATE_REPO>.git@<COMMIT_ID>'
]

See https://pip.readthedocs.io/en/stable/reference/pip_install/#requirement-specifiers and https://www.python.org/dev/peps/pep-0440/#direct-references
This requires pip install including pip install . and doesn't work with python setup.py install.

A: I've read multiple answers, but only this one worked for me (using pip 20.2.3 and Gitlab Pypi feature):
pip3 install --extra-index-url https://__token__:my_personal_token@gitlab.com/api/v4/projects/347/packages/pypi/simple .

My setup.py looked like:
from setuptools import setup

setup(name='whatever_production_scripts',
      version='0.0.1',
      description='Whatever production scripts',
      url='https://gitlab.com/user/whatever',
      author='Me Myself',
      author_email='user@whatever.com',
      license='All rights reserved',
      scripts=[
          'whatever_production_scripts/production/insomnia.py',
          'whatever_production_scripts/production/rdsmaintenance.py',
          'whatever_production_scripts/production/changeinstancetype.py',
      ],
      packages=[
          'whatever_production_scripts',
          'whatever_production_scripts.production',
      ],
      classifiers=[
          "Development Status :: 3 - Alpha",
          "Intended Audience :: System Administrators",
          "Operating System :: POSIX :: Linux",
          "Topic :: Internet",
          "Topic :: System :: Systems Administration",
          "Programming Language :: Python :: 3 :: Only"
      ],
      install_requires=[
          'privatepackage1>=0.1',
          'publicpackage1>=7',
          'publicpackage2>=2'
      ],
      zip_safe=False)


text:
Q: How to include relations in Rails with Grape In My Grape app I want to change return (in response) number of used campaign_codes and all campaign_codes for each campaign. To do so I need to return also the relationship objects. Here is my serializer:
module V1
  module AdminPanel
    module Serializers
      class CampaignSerializer
        include FastJsonapi::ObjectSerializer

        attributes :total_campaign_codes_amount, :used_campaign_codes_amount

        attribute :total_campaign_codes_amount do |campaign|
          campaign.campaign_codes.count
        end

        attribute :used_campaign_codes_amount do |campaign|
          campaign.campaign_codes.where(state: 'used').count
        end
      end
    end
  end
end

But with this code I receive an error:

ArgumentError (campaign_codes is not specified as a relationship on V1::AdminPanel::Serializers::CampaignSerializer)

If I add has_many :campaign_codes it will worked but in additional I'm returning all campaign_codes which is not what I want to.
Is there any chance to include somewhere this campaign_codes without getting a response with all codes?


text:
Q: Firebase FirAnalyticsConnector Build Error After running pod install with:
  pod 'Firebase/Analytics'

I am now getting the following build error:

ld: framework not found FirAnalyticsConnector clang error: linker
command failed with exit code 1 (use -v to see invocation)

I have tried removing FirAnalyticsConnector from the Build Setting's Other Linker Flags (as similar questions' answers suggested), but it does not solve the issue
Any ideas as to why I am getting this build error when I was previously able to build the project?

A: I managed to fix this by removing the Firebase pod completely, then reinstalling.
I first removed it from my podfile, did another pod install, then deleted all references in my code (and Other Linker Flags). I also had some old (previously Twitter, then Google) Fabric code.
Once I got the project to build and run without that cocoapod, I tried installing it fresh following Firebase documentation and it works with no errors now.


text:
Q: If statement for numbers in sql I'm trying to create an SQL query to set a number in a column if another number is present.
UPDATE vrp_user_moneys
SET
when bank = 0 then SET bank = 500000 ELSE bank end

I've had a look around but to no avail. How would I correct this query?

A: Try this:
UPDATE vrp_user_moneys as v
SET v.bank = 500000
WHERE v.bank = 0;

A: I think you want:
UPDATE vrp_user_moneys
SET bank = 500000
WHERE bank = 0;


text:
Q: Custom column for SharePoint 2013 I want to create a new field type for SharePoint 2013.
It should be for the large lookup list, in edit or new form it'll be represented by a combobox with jQuery for selecting choices.
Do you have a sample on how to do this in Visual Studio?
Will I be able to customize the list display for the custom field?
I have tried this solution from CodePlex but it is showing following error when I am typing anything in textbox:

A: My issue was when i created column.
After selecting your list lookup you have to select the field where you want searching.
In my case i had a list with an id and title.
So i select title like this when you'll start to write something it'll search in this column.


text:
Q: Does anyone know what the name of the tech that displays graphics in a terminal window on linux? What i mean by that question is, like when installing nvidia drivers manually. you will either leave the CLI to display some graphics to install the driver or the graphics part just goes full screen or something.
this is an image of install a xmbc os.

Just want to be able to pop up a graphical screen from and within the terminal similar to the picture. its looks like graphics has some pixel control to is. it doesnt look like highlighted text.
Plus is there is something that can interface with a touch screen for the touch clicking.
probably going to be doing this all through ssh or straight off the device!
The language that i know most is C++.

A: These are ncurses: http://invisible-island.net/ncurses/ncurses-intro.html
You can do all kinds of fancy console stuff with this library.
If you need a simpler (and somewhat more limited way) to build such GUIs, you can use a dialog utility, directly from a shell script: http://invisible-island.net/dialog/ (it uses ncurses internally).
Both ncurses and dialog are typically available out of the box on most distros.

A: Your screenshot looks like it was made with Newt.  It's actually using text mode, so it's not really graphics.  It's using the text-mode screen as a "character-cell" display, where the software can change the character and colors at any location on the screen at any time, rather than as a "teletype" (tty), which can only print new lines at the bottom and scroll upward.
There's a lower-level library called ncurses, which provides basic character-cell display functionality.  You can use that to build a completely custom text-mode UI, or use a UI library such as Dialog which builds on top of it.
I don't know if Newt supports mouse input — from a quick look at the docs, it doesn't appear to — but ncurses and Dialog do, so if your touchscreen system can translate touch input into virtual mouse events, you should be able to handle those from an ncurses-based UI.


text:
Q: TFS 2013 rest api basic authentication is not working I've tried to get the projects from the TFS on-premise version using below API,
http://tfs2013.ilinktrichy.com:8080/tfs/{organization}/_apis/projects?api-version=1.0
Used the basic authentication and enabled the basic authentication in IIS as well. Still am getting 401 unauthorized issue.
Do i need to do any other changes on IIS?

A: This is an easy answer, but you're not going to like it.
TFS 2013 did not have REST APIs. They were introduced in TFS 2015.
You can use the old SOAP .NET client for automating tasks against TFS 2013, or (better yet) you can upgrade to a modern version.
update
What I said is not entirely accurate: some of the APIs were present in 2013, but they were not officially introduced until 2015 and are thus largely undocumented and totally unsupported.


text:
Q: Calculate the arc length parametrization of a curve in terms of s(u) Consider the parametrized curve r(u)=(5+u, 4u+7, 3u). Which one of the following functions is the arc length parametrization of the curve which starts from s=0 at the point (4,3,-3) along the curve?
I have calculated r'(u)= (1,4,3) and thus ||r'(u)||=√ 26.
However I'm confused on what to do next to find s(u). I understand there should be some sort of integration next wrt u and that would give [√ 26*u].
Any help would be greatly appreciated!

A: The arc starts from $r(0)$ and ends in $r(-1)=(4, 3, -3)$. Hence the arc signed-length is the value of the integral
$$\int_0^{-1} \lvert r'(u)\rvert\,du=\int_0^{-1} \sqrt{26}\,du=-\sqrt{26}$$
Similarly when computing the area of regions bounded by graphs of functions, the definite integral takes signed values. Anyway, the arc length is $\sqrt{26}$


text:
Q: Hi, does BigQuery support materialized views? Does BigQuery support materialized views? The documentation suggests to materialize the query output. does this mean materialized views are supported or is this as good as creating a new table with the query output?

A: Materialized views are not (yet) supported in BigQuery at the time of this writing. You can follow along with the relevant feature request, however. In the meantime, you need to create a table explicitly from a view, e.g.:
CREATE TABLE dataset.materialized_view AS
SELECT *
FROM dataset.view;

A: BigQuery materialized views has been released as a beta.
https://cloud.google.com/bigquery/docs/release-notes#April_08_2020

A: If it is still relevant, maybe materialized query results will do the work.

A: In February 25, 2021 this feature has gone GA:
https://cloud.google.com/blog/products/data-analytics/bigquery-materialized-views-now-ga
Here is an example on how to create a Materialized View:
CREATE OR REPLACE MATERIALIZED VIEW schema_name.view_name
PARTITION BY ... -- the partition column, if used
CLUSTER BY ... -- the partition columns, if used
OPTIONS(labels=[("...", "...")], enable_refresh=true, refresh_interval_minutes=60) -- the options
AS
SELECT ...
FROM ...

Check the documentation:
https://cloud.google.com/bigquery/docs/materialized-views-intro


text:
Q: Conditions in Parsec If I have a parser than reads a string of numbers separated by spaces into a list of Ints, how do I handle a trailing space? At the moment I have:
row :: Parser [Int]
row  = do
  optional spaces
  f <- (many (oneOf "0123456789"))
  r <- ((char ' ') >> row) <|> pure []
  pure (read f:r)

Which works fine with a string that does not have a trailing space but fails with a trailing space.
>λ= parse row "" " 2  0 12  3     7"
Right [2,0,12,3,7]

>λ= parse row "" " 2  0 12  3     7  "
Right [2,0,12,3,7,*** Exception: Prelude.read: no parse

What is the solution to this problem and more so, how would I have a condition where if '\n' is consumed then the parser returns []
EDIT:
From reading @amalloy's answer and the parsec source code, I thought it useful to add a version that works here (although, @amalloy's advice to not try and roll existing functions makes more sense)
row :: Parser [Int]
row = do
  spaces
  f <- (read <$> many1 digit)
  do
    many1 $ char ' '
    r <- row
    pure (f:r) <|> pure [x]
  <|> pure []

A: Instead of implementing all this low-level stuff yourself, I suggest just using sepEndBy. For example,
row :: Parser [Int]
row = spaces *> (int `sepEndBy` many1 space)
  where int = read <$> many1 digit


text:
Q: Outer Joins in Spark Structured Streaming Is there a way to perform outer_join (specifically left outer join) in Spark Structured Streaming? I noticed this JIRA #22053 that enables inner join for streaming datasets (and it works great!). I was wondering if there was something similar for outer_join as well.
I tried using the same logic from the JIRA for outer join and haven't been able to get the right output. Thanks!

A: I was able to get the stream-stream Inner join and outer join working. Here's some sample code that I have. Hope it helps!
Stream-Stream Join (JIRA Spark-22053 & JIRA Spark-22136):
streamA.join(streamB, expr("streamA_ID = streamB_ID AND timeA BETWEEN timeB - INTERVAL 15 minutes and timeB"), joinType="{joinType}")
The {joinType} can be either "inner", "leftOuter" or "rightOuter".
You can find more information on this in the article which will be published with Spark 2.3 release: https://spark.apache.org/docs/latest/structured-streaming-programming-guide.html#stream-stream-joins

A: Stream-stream join will be supported in Apache 2.3.0. Here are the document of 2.3.0 RC2: https://dist.apache.org/repos/dist/dev/spark/v2.3.0-rc2-docs/_site/structured-streaming-programming-guide.html#stream-stream-joins


text:
Q: Do I need a concurrent collection for adding elements to a list by many threads? static final Collection<String> FILES = new ArrayList<String>(1);

for (final String s : list) {
    new Thread(new Runnable() {
        public void run() {
            List<String> file2List = getFileAsList(s);
            FILES.addAll(file2List);
        }
    }).start();
}

This collections gets very big, but the code works perfect. I thought I will get a concurrent modifcation exception, because the FILES list has to extend its size, but it has never  happened.
is this code 100% threadsafe ?
The code takes a 12 seconds to load up and a few threads are adding elements at the same time.
I tried to first create thread and later run them, but I got same results (both time and correctness)

A: No, the code is not thread-safe. It may or may not throw a ConcurrentModificationException, but you may end up with elements missing or elements being added twice. Changing the list to be a
Collection<String> FILES = Collections.synchronizedList(new ArrayList<String>());

might already be a solution, assuming that the most time-consuming part is the getFilesAsList method (and not adding the resulting elements to the FILES list).
BTW, an aside: When getFileAsList is accessing the hard-drive, you should perform detailed performance tests. Multi-threaded hard-drive accesses may be slower than a single-threaded one, because the hard drive head might have to jump around the drive and not be able to read data as a contiguous block.

EDIT: In response to the comment: This program will "very likely" produce ArrayIndexOutOfBoundsExceptions from time to time:
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

public class ConcurrentListTest
{
    public static void main(String[] args) throws InterruptedException
    {
        for (int i=0; i<1000; i++)
        {
            runTest();
        }
    }

    private static void runTest() throws InterruptedException
    {
        final Collection<String> FILES = new ArrayList<String>(1);
        // With this, it will always work:
        // final Collection<String> FILES = Collections.synchronizedList(new ArrayList<String>(1));

        List<String> list = Arrays.asList("A", "B", "C", "D");
        List<Thread> threads = new ArrayList<Thread>();
        for (final String s : list)
        {
            Thread thread = new Thread(new Runnable()
            {
                @Override
                public void run()
                {
                    List<String> file2List = getFileAsList(s);
                    FILES.addAll(file2List);
                }
            });
            threads.add(thread);
            thread.start();
        }
        for (Thread thread : threads)
        {
            thread.join();
        }
        System.out.println(FILES.size());
    }

    private static List<String> getFileAsList(String s)
    {
        List<String> list = Collections.nCopies(10000, s);
        return list;
    }

}

But of course, there is no strict guarantee that it will. If it does not create such an exception for you, you should consider playing the lottery, because you must be remarkably lucky.

A: It is not thread safety at all even if you only add elements. In case that you only increase your FILES there is also some multi access problem if your collection is not thread safe.
When collection exceeds their size it has to be copied to new space and in that moment you can have problems with concurrent access, because in the moment that one thread will do the copy stuff... another can be trying add at the same time element to that collection, resizing is done by internal arraylist implementation but it is not thread-safe at all.
Check that code and lets assume that more than one thread execute it when collection  capacity is full.
 private int size; //it is not thread safe value!
 public boolean add(E e) {
             ensureCapacityInternal(size + 1);  // Increments modCount!!
             elementData[size++] = e;   //size is not volatile value it might be cached by thread
             return true;
         }

  public void add(int index, E element) {
        rangeCheckForAdd(index);

        ensureCapacityInternal(size + 1);  // Increments modCount!!
       System.arraycopy(elementData, index, elementData, index + 1,
                        size - index);
        elementData[index] = element;
        size++;
    }

public void ensureCapacity(int minCapacity) {
        if (minCapacity > 0)
            ensureCapacityInternal(minCapacity);
    }

    private void ensureCapacityInternal(int minCapacity) {
        modCount++;
        // overflow-conscious code
        if (minCapacity - elementData.length > 0)
            grow(minCapacity);
     }

In the moment that collection need to exceed its capacity and copy existed element to new internal array you can have real problems with multi-access, also size is not thread because it is not volatile and it can be cached by some thread and you can have overrides :) and this is answer why it might be not thread safe even if you use only use add operation on non synchronized collection.
You should consider using FILES=new CopyOnWriteArrayList();, orFILES= Collections.synchronizedList(new ArrayList()); where add operation is thread-safe.

A: Yes, you need a concurrent list to prevent a ConcurrentModificationException.
Here are some ways to initialize a concurrent list in Java:
Collections.newSetFromMap(new ConcurrentHashMap<>());
Collections.synchronizedList(new ArrayList<Object>());
new CopyOnWriteArrayList<>();

A:
is this code 100% threadsafe ?

This code is 0% threadsafe, even by the weakest standard of interleaved operation. You are mutating shared state under a data race.
You most definitely need some kind of concurrent control; it is not obvious whether a concurrent collection is the right choice, though. A simple synchronizedList might fit the bill even better because you have a lot of processing and then a quick transfer to the accumulator list. The lock will not be contended much.


text:
Q: Creating a Script to import users from a CSV to AD I'm trying to build a script that will take a CSV with the fields
firstname, lastname, password
and create a user in AD in a specific OU with that info. I've done a bunch of googling, and this is what I've come up with (from this blog):
Import-Csv .\userImport.csv | ForEach-Object {
  New-ADUser
    -Name $_.DisplayName
    -UserPrincipalName $_.UserPrincipalName
    -SamAccountName $_.Username
    -FirstName $_.FirstName
    -DisplayName $_.DisplayName
    -LastName $_.Lastname
    -Path $_.Path
    -AccountPassword (ConvertTo-SecureString $_.Password -AsPlainText -force)
    -Enabled $True
    -PasswordNeverExpires $True
    -PassThru
}

I have a few questions:

*

*I want to specify the OU in my command, instead of having it be in the CSV. Can I just change it to:
-Path OU=MyOU,DC=Domain,DC=Local

*What is the -PassThru line for?

*Is the -AccountPassword line correct? I got that from a blog that suggested this is the right way to take a password and set it as my AD user's password.

*Do I need the PrincipalName, SamAccountName and DisplayName all as separate fields? This can be as minimal as possible, at least for now.

*Any tips or changes you would make? This is my first time doing a script like this so I'm willing to learn.

A: *

*Yes, you can specify parameters whichever way you like, they don't need to come from the input file.

*-PassThru makes New-ADUser echo the created user object. By default the cmdlet doesn't return anything.

*Yes, the -AccountPassword argument is correct, provided the password field from the CSV contains the plaintext password.

*You don't necessarily have to have a separate CSV field for each parameter argument if you can construct an argument from existing field values. For instance, you most likely can create values like DisplayName or SamAccountName from first and last name, e.g. like this:
-SamAccountName ($_.firstname.Substring(0,1) + $_.lastname).ToLower()
-DisplayName ('{0} {1}' -f $_.firstname, $_.lastname)

You also don't need to specify every argument. For instance, the UPN (User Principal Name) will automatically be generated when omitted, and the display name will default to the name.

*You can't wrap the lines like you have. PowerShell can't read your mind and won't know that you intend to continue the statement in the next line unless you tell it that or the statement is obviously incomplete. Use backticks to escape the linebreaks. Also, the parameters for first and last name are -GivenName and -Surname, not -FirstName and -LastName.
$csv = '.\userImport.csv'
$ou  = 'OU=MyOU,DC=Domain,DC=Local'

Import-Csv $csv | ForEach-Object {
  $name = '{0} {1}' -f $_.firstname, $_.lastname
  $acct = ($_.firstname.Substring(0,1) + $_.lastname).ToLower()
  $pw   = ConvertTo-SecureString $_.password -AsPlainText -Force

  New-ADUser -Name $name `
    -SamAccountName $acct `
    -GivenName $_.firstname `
    -Surname $_.lastname `
    -Path $ou `
    -AccountPassword $pw `
    -Enabled $true `
    -PasswordNeverExpires $true `
    -PassThru
}

A: *

*OU - If you want them all in the same OU, you can hard code it (remember the quotes)
-Path "OU=MyOU,DC=Domain,DC=Local"

*-PassThru

The -PassThru parameter lets you request output from cmdlets that return no output by default. (The PassThru Parameter: Gimme Output)

i.e. Instead of New-ADUser just executing and then returning you to the next line, it will actually print out the new user created info to the prompt.

*Yes the -AccountPassword takes a SecureString as the argument. The command ConvertTo-SecureString converts a plain text string to a SecureString, which then can be passed to the -AccountPassword parameter

*You don't need -UserPrincipalName. You do need -SamAccountName. -DisplayName can be changed to:
-DisplayName "$($_.FirstName) $($_.Lastname)"

*This is a pretty standard script for mass producing accounts, so it is pretty good the way it is. The only change I would look at is -PasswordNeverExpires $True You typically only really set the Password Never Expires on Service accounts, so if you are creating plain old user accounts, you wouldn't need it.


text:
Q: Ionic Capacitor Deploy App on ios 13.3 device freeze splashscreen After I have run the latest update on my iphone and then want to deploy the app to my iphone using XCode, the app is started on the iphone and then the splash screen freezes. In XCode the following is displayed:
dyld: Library not loaded: @rpath/Capacitor.framework/Capacitor
  Referenced from: /private/var/containers/Bundle/Application/BB53AC39-F58D-47D4-8860-273E51D8171B/App.app/App
  Reason: no suitable image found.  Did find:
    /private/var/containers/Bundle/Application/BB53AC39-F58D-47D4-8860-273E51D8171B/App.app/Frameworks/Capacitor.framework/Capacitor: code signature invalid for '/private/var/containers/Bundle/Application/BB53AC39-F58D-47D4-8860-273E51D8171B/App.app/Frameworks/Capacitor.framework/Capacitor'

    /private/var/containers/Bundle/Application/BB53AC39-F58D-47D4-8860-273E51D8171B/App.app/Frameworks/Capacitor.framework/Capacitor: code signature invalid for '/private/var/containers/Bundle/Application/BB53AC39-F58D-47D4-8860-273E51D8171B/App.app/Frameworks/Capacitor.framework/Capacitor'

    /private/var/containers/Bundle/Application/BB53AC39-F58D-47D4-8860-273E51D8171B/App.app/Frameworks/Capacitor.framework/Capacitor: stat() failed with errno=1
    /private/var/containers/Bundle/Application/BB53AC39-F58D-47D4-8860-273E51D8171B/App.app/Frameworks/Capacitor.framework/Capacitor: code signature invalid for '/private/var/containers/Bundle/Application/BB53AC39-F58D-47D4-8860-273E51D8171B/App.app/Frameworks/Capacitor.framework/Capacitor'

    /private/var/containers/Bundle/Application/BB53AC39-F58D-47D4-8860-273E51D8171B/App.app/Frameworks/Capacitor.framework/Capacitor: stat() failed with errno=1
(lldb)

Many thanks in advance for your help!

A: This is a bug in Xcode or CocoaPods.
Free Apple dev accounts can't run apps on real devices if they use some CocoaPods frameworks (such as Capacitor, but it's affecting a lot of more).
So the only solution for now is to pay for an Apple dev account or use the simulator.
You can also try to remove use_frameworks! from ios/App/Podfile and run npx cap sync ios, but not sure if some other thing will break.

A: On the 24th of March Apple released iOS 13.4. This update includes a fix for the code signature issue! Please refer to the iOS 13.4 beta 3 for more information.


text:
Q: Как получить объект из двух массивов? В методе приходит два массива array1(id1...idn) array 2(aelem1...elemn).
Как из них составить объект новый вида
Obj = {
  array1[I]: array2[j]
}

Например
Obj = {
   Id1: elem1,
   Id2: elem2,
   Id3: elem3,
   ...
}

A:

var arr1 = ["id1", "id2", "id3"];
var arr2 = ["elem1", "elem2", "elem3"];
var obj = {};
for(var i = 0; i < arr1.length; i++) {
 obj[arr1[i]] = arr2[i];
}
console.log(obj);

A: Для разнообразия
function Fu_0001(_arr, _markerKey){
    if(_arr.length){
        this[(_markerKey || "") + _arr.length] = _arr.pop()
        this.constructor.apply(this, Array.prototype.slice.call(arguments));
    }
}

console.log(new Fu_0001(["elem1", "elem2", "elem3"],"Id"))

A:

var keys = ['foo', 'bar', 'baz'];
var values = [11, 22, 33]

var result = {};
keys.forEach((key, i) => result[key] = values[i]);
console.log(result);

A: var arr1 = ["id1", "id2", "id3"];
var arr2 = ["elem1", "elem2", "elem3"];
var obj = arr1.reduce(function(map, x, idx){ map[x] = arr2[idx]; return map; }, {});