text:
Q: Date gets overwritten (Spring/Hibernate) Right now I have a "bookings" table on my main page which shows information about different bookings. One of the fields is "Booking Date" which shows the date and time of the creation of the booking. But when I edit the booking it automatically gets overwritten by a new date. How do I keep that from happening?
My Booking class
@Entity
@Table(name="booking")
public class Booking {

    @Id
    @Column(name="id")
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    private Long id;

    @ManyToOne
    @JoinColumn(name="R_id")
    private Restaurant restaurant;

    @Column(name="date")
    @Temporal(TemporalType.DATE)
    private Date date;

    @Column(name="start")
    private String start;

    @Column(name="duration")
    private float duration;

    @Column(name="amount_of_people")
    private int amountOfPeople;

    @Column(name="name")
    private String name;

    @Column(name="contact_preference")
    private String contactPreference;

    @Column(name="phone_number")
    private String phoneNumber;

    @Column(name="comments")
    private String comments;

    // Date that gets overwritten
    @Column(name="current_datetime")
    @Type(type="timestamp")
    private Date currentDatetime;

    @Column(name="new_date")
    @Type(type="timestamp")
    private Date newDate;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Restaurant getRestaurant() {
        return restaurant;
    }

    public void setRestaurant(Restaurant restaurant) {
        this.restaurant = restaurant;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public String getStart() {
        return start;
    }

    public void setStart(String start) { this.start = start; }

    public float getDuration() {
        return duration;
    }

    public void setDuration(float duration) {
        this.duration = duration;
    }

    public int getAmountOfPeople() {
        return amountOfPeople;
    }

    public void setAmountOfPeople(int amountOfPeople) {
        this.amountOfPeople = amountOfPeople;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getContactPreference() {
        return contactPreference;
    }

    public void setContactPreference(String contactPreference) {
        this.contactPreference = contactPreference;
    }

    public String getPhoneNumber() { return phoneNumber; }

    public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; }

    public String getComments() {
        return comments;
    }

    public void setComments(String comments) {
        this.comments = comments;
    }

    public Date getCurrentDatetime() {
        return currentDatetime;
    }

    public void setCurrentDatetime(Date currentDatetime) { this.currentDatetime = currentDatetime; }

    public Date getNewDate() { return newDate; }

    public void setNewDate(Date newDate) { this.newDate = newDate; }

    // Comparator
    public static class BookingDateComparator implements Comparator<Booking> {
        @Override
        public int compare(Booking booking1, Booking booking2) {
            if (booking1.getDate().compareTo(booking2.getDate()) == 0) {
                return booking1.getStart().compareTo(booking2.getStart());
            }
            return booking1.getDate().compareTo(booking2.getDate());
        }
    }

}

Relevant methods in my MainController class:
@RequestMapping(value = "bookings", method = RequestMethod.GET)
public String bookings(Model model) {
    List<Booking> bookingList = bookingService.getBookings();
    model.addAttribute("bookings", bookingList);
    initModelList(model);
    return "bookings";
}
    @RequestMapping(value = "booking/create", method = RequestMethod.GET)
public String createBooking(Model model) {
    model.addAttribute("booking", new Booking());
    initModelList(model);
    return "newBooking";
}

@RequestMapping(value = "booking/create", method = RequestMethod.POST)
public String createBookingAction(@Valid @ModelAttribute ("booking") Booking booking, BindingResult result, Model model) {
    BookingFormValidator bookingFormValidator = new BookingFormValidator();
    bookingFormValidator.validate(booking, result);
    if (result.hasErrors()) {
        initModelList(model);
        return "newBooking";
    }
    bookingService.addBooking(booking);
    return "redirect:/bookings";
}

@RequestMapping(value = "booking/edit/{id}", method = RequestMethod.GET)
public String editBooking(@PathVariable Long id, Model model) {
    initModelList(model);
    Booking booking = bookingService.getBooking(id);
    model.addAttribute("booking", booking);
    return "editBooking";
}

@RequestMapping(value = "booking/edit/{id}", method = RequestMethod.POST)
public String editBookingAction(@Valid @ModelAttribute ("booking") Booking booking, BindingResult result, Model model) {
    BookingFormValidator bookingFormValidator = new BookingFormValidator();
    bookingFormValidator.validate(booking, result);
    if (result.hasErrors()) {
        initModelList(model);
        return "editBooking";
    }
    bookingService.updateBooking(booking);
    return "redirect:/bookings";
}

The .jsp of my main page

<jsp:include page="../fragments/menu.jsp"/>

List of bookings

            Add restaurant
            Create New Booking

                    Booking information

            <c:forEach items="${restaurants}" var="restaurants">

${restaurants}

                    Edit restaurant

                            <col align="left" width="100">
                            <col align="left" width="60">
                            <col align="left" width="60">
                            <col align="left" width="60">
                            <col align="left" width="60">
                            <col align="left" width="90">
                            <col align="left" width="90">
                            <col align="left" width="90">
                            <col align="left" width="100">
                            <col align="left" width="100">

                                Date
                                Start
                                Duration
                                # Of People
                                Name
                                Contact Pref.
                                Phone #
                                Comments
                                Booking date

                            <c:forEach items="${sortedBooking}" var="sortedBooking">
                                <c:choose>
                                    <c:when test="${restaurants == sortedBooking.restaurant.restaurantName}">

                                            ${sortedBooking.date}
                                            ${sortedBooking.start}
                                            ${sortedBooking.duration}
                                            ${sortedBooking.amountOfPeople}
                                            ${sortedBooking.name}
                                            ${sortedBooking.contactPreference}
                                            <c:choose>
                                                <c:when test="${sortedBooking.phoneNumber.equals('')}">
                                                    NO PHONE
                                                </c:when>
                                                <c:otherwise>
                                                    ${sortedBooking.phoneNumber}
                                                </c:otherwise>
                                            </c:choose>
                                            <c:choose>
                                                <c:when test="${sortedBooking.comments.equals('')}">
                                                    NO COMMENTS
                                                </c:when>
                                                <c:otherwise>
                                                    ${sortedBooking.comments}
                                                </c:otherwise>
                                            </c:choose>
                                            ${sortedBooking.currentDatetime}
                                            Edit booking

                                    </c:when>
                                </c:choose>
                            </c:forEach>

            </c:forEach>

<jsp:include page="../fragments/footer.jsp"/>

My editBooking.jsp:

<jsp:include page="../fragments/menu.jsp"/>

Edit

        <form:form modelAttribute="booking">

                    Restaurant*:
                    <form:select path="restaurant.id">
                            <form:option value="" label="--- Select ---" />
                            <form:options items="${restaurants}" itemValue="id" itemLabel="restaurantName" />
                    <form:errors path="restaurant.id" cssClass="error"/>
                    </form:select>

                    Date*:
                    <form:input path="date" type="date"/>
                    <form:errors path="date" cssClass="error"/>

                    Starting time*:
                    <form:input path="start" type="time"/>
                    <form:errors path="start" cssClass="error"/>

                    Duration*:
                    <form:input path="duration"/>
                    <form:errors path="duration" cssClass="error"/>

                    Amount of people*:
                    <form:input path="amountOfPeople"/>
                    <form:errors path="amountOfPeople" cssClass="error"/>

                    Name*:
                    <form:input path="name"/>
                    <form:errors path="name" cssClass="error"/>

                    Contact preference*:
                    <form:select path="contactPreference">
                            <form:option value="" label="--- Select ---" />
                            <form:option value="e-mail" label="E-mail" />
                            <form:option value="phone" label="Phone" />
                            <form:option value="other" label="Other" />
                    <form:errors path="contactPreference" cssClass="error"/>
                    </form:select>

                    Phone number:
                    <form:input path="phoneNumber"/>
                    <form:errors path="phoneNumber" cssClass="error"/>

                    Comments:
                    <form:textarea path="comments" rows="5" cols="30"/>
                    <form:errors path="comments" cssClass="error"/>

                    <input type="submit" />

        </form:form>

            Back to List

<jsp:include page="../fragments/footer.jsp"/>

Any help is appreciated! Sorry for the long post.
EDIT: I tried changin my code to disable updating, but it still doesn't work.
@Column(name="current_datetime", updatable=false, nullable=false)
@Type(type="timestamp")
private Date currentDatetime = new Date();

A: Do not use @Type(type="timestamp") for storing dates. In many databases timestamps are intended to track changes instead of being an ordinary date field for your application logic. So, switch to DATETIME in the database and remove the @Type annotation, as hibernate already converts Date to the proper type.
See also:

*

*Should I use field 'datetime' or 'timestamp'?

*When to use datetime or timestamp


text:
Q: iOS - multipart/form-data post I am developing an iOS app which is using multipart/form_data. But I've got stuck on it.
What I have is data structure from Http Analyzer 7.
Raw stream from Http Analyzer
I've googled and tried a lot to accomplish this in iOS app but didn't get any chance of success.
Could someone help me?
Here is what I've tried.
- (void)signUpOnWeb:(NSString *)strStrToken {

NSMutableURLRequest *request=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http//www.karelboele.com/forms/signups"] cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:10];

[request setHTTPMethod:@"POST"];
[request setValue:@"www.karelboele.com" forHTTPHeaderField:@"Host"];
[request setValue:@"keep-alive" forHTTPHeaderField:@"Connection"];
[request setValue:@"text/javascript" forHTTPHeaderField:@"Accept"];
[request setValue:@"Mozilla/5.0 (Windows NT 6.3; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0" forHTTPHeaderField:@"User-Agent"];
[request setValue:@"http://www.karelboele.com/app" forHTTPHeaderField:@"Referer"];
[request setValue:@"gzip, deflate" forHTTPHeaderField:@"Accept-Encoding"];
[request setValue:@"en-US,en;q=0.5" forHTTPHeaderField:@"Accept-Language"];
[request setValue:@"XMLHttpRequest" forHTTPHeaderField:@"X-Requested-With"];

NSDictionary *params = @{@"authenticity_token" : strStrToken, @"page_id" : @"406", @"return_to" : @"http://www.karelboele.com/app", @"email_address" : @"", @"signup[first_name]" : @"Vuhar", @"signup[last_name]" : @"Mamedov", @"signup[email]" : @"vuharmamedov@gmail.com", @"signup[born_at_chronic]" : @"10/12/1985", @"signup[email_opt_in]" : @"0", @"signup[email_opt_in]" : @"1", @"signup[mobile_number]" : @"123456789", @"signup[mobile_opt_in]" : @"0", @"signup[mobile_opt_in]" : @"1", @"signup[phone_number]" : @"123456789", @"signup[submitted_address]" : @"1, kyiv, kyiv, kyiv, 130000", @"signup[country_code]" : @"UA", @"signup[is_volunteer]" : @"0", @"signup[activity_is_private]" : @"0", @"commit" : @"Accept Terms and Conditions and submit"};

NSString *boundary = @"---------------------------1388669659902";
NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", boundary];

[request setValue:contentType forHTTPHeaderField: @"Content-Type"];

NSData *httpBody = [self createBodyWithBoundary:params boundary:(NSString*)boundary];

[request setHTTPBody:httpBody];

NSString *postLength = [NSString stringWithFormat:@"%d", (int)[httpBody length]];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];

NSOperationQueue *queue = [[NSOperationQueue alloc] init];

[NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error)
 {

     NSHTTPURLResponse *responseCode = (NSHTTPURLResponse *)response;

     if([responseCode statusCode] != 200){
         NSLog(@"Error getting HTTP status code %li", (long)[responseCode statusCode]);

     }

     else {

         NSString* htmlResponse = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
     }
 }];

}
- (NSData *)createBodyWithBoundary:(NSDictionary *)parameters boundary:(NSString*)boundary {
NSMutableData *httpBody = [NSMutableData data];

// add params (all params are strings)

[parameters enumerateKeysAndObjectsUsingBlock:^(NSString *parameterKey, NSString *parameterValue, BOOL *stop) {
    [httpBody appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
    [httpBody appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"\r\n\r\n", parameterKey] dataUsingEncoding:NSUTF8StringEncoding]];
    [httpBody appendData:[[NSString stringWithFormat:@"%@\r\n", parameterValue] dataUsingEncoding:NSUTF8StringEncoding]];
}];

[httpBody appendData:[[NSString stringWithFormat:@"--%@--\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];

return httpBody;

}
I am not too sure what mistake I made.
Any help greatly appreciated!
Thanks,
Vuhar

A: Use AFNetworking multipart form data. It will save your time and also you can track how much data is uploaded or even your request failed in failure block.

redpajama_set_name: RedPajamaStackExchange


text:
Q: JRE library System I want to add Jre Library System to my Project. For that I clicked the name of my project (projet1), then properties ---> java build path ---> Libraries and after I add Jre system library [jre8].
I even added the library, but it does not appear in my project. I want to have something like this:

In my class path I got this
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7" />

How can I do that?

A: your .classpath file must have line
 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
Open navigator view and check .classpath file contents
If you are using another jdk ... u should see JRE NAME you added instead of JRE_CONTAINER
like
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_27"/>


text:
Q: Subscript out of bounds error while computing accuracy at different cutoffs I have constructed a logistic regression and now I want to calculate the predictive accuracy for various cutoff values ranging from 0 to 1. This is the for loop I have been using. But I am getting

subscript out of bounds

Here predtrain contains 300 predicted output probabilities each ranging from 0 to 1. Each value is compared to cutoff eff. Finally a table/confusion matrix has to be generated comparing the original values (train$CAN) with f1. Some thing like this:
tab
# pred2
#     0   1
# 0   1  93
# 1   0 206

code I have written is this:
predtrain <- predict(logreg1, newdata = train, type = 'response')
eff<-seq(0,1,by = 0.05)
for (i in 1:length(eff) {
  f1 <- ifelse(predtrain > eff[i], 1, 0)
  t1 <- table(train$CAN, f1)
  effy <- (t1[1,1]+t1[2,2])/(t1[1,1]+t1[1,2]+t1[2,2]+t1[2,1])
  eff[[i]] <-effy
}

A: The reason you're getting subscript out of bounds errors is that you're trying to create confusion matrices with cutoffs like 0 and 1 -- this will create a confusion matrix with a single column (all predictions are either positive or negative), causing code like t1[2,2] to cause your error.
In reality all you're trying to do is to compute the predictive accuracy at different cutoffs, which can be accomplished without creating tables at all with something like:
cutoffs <- seq(0, 1, by=0.05)
eff <- sapply(cutoffs, function(cutoff) {
  sum((predtrain > cutoff) == train$CAN) / length(predtrain)
})

To see this in action, let's consider a small example model:
set.seed(144)
x <- runif(100)
train <- data.frame(x, CAN=as.numeric(runif(100)+x >= 1))
logreg1 <- glm(CAN~x, data=train, family="binomial")
predtrain <- predict(logreg1, newdata = train, type = 'response')

Now we can get the predictive accuracy at each cutoff:
eff <- sapply(cutoffs, function(cutoff) {
  sum((predtrain > cutoff) == train$CAN) / length(predtrain)
})
plot(cutoffs, eff)

You could alternately use a package like the ROCR package to grab metrics. For instance, here is how you could grab the sensitivity at each cutoff:
library(ROCR)
pred <- prediction(predtrain, train$CAN)
perf <- performance(pred, "sens")
eff <- sapply(cutoffs, function(cutoff) max(perf@y.values[[1]][perf@x.values[[1]] >= cutoff]))
plot(cutoffs, eff)

A: But to calculate something like specificity and sensitivity doesn't it become more difficult? I have written using two for loops, I know it is not very effective but I do get the table from which I can calculate performance variables. Can this method be improved?
enter code here
    z <- seq(0,1,by = 0.05)
    t1 <- vector(mode = "list", length = length(z))
for(i in 1:length(z)) {
            predtrain <- predict(logreg1, newdata = train, type = 'response')

                for(j in 1:length(predtrain)){
                     predtrain[j] <- ifelse(predtrain[j]>z[i], 1, 0)
                }
        t1[[i]] <- table(train$CAN, predtrain)
      } t1


text:
Q: Can someone explain countability and cardinality simply? One of the questions in my book asked: Show that the set $\Bbb Z^+ \times \Bbb Z^+$ is countable.?
Now I don't want the solution to this particular problem, rather how to go about solving these types of problems. What if it was $\Bbb Q^+\times \Bbb Q^+$ or some other thing etc. etc.
To start of to show countability you have show it is cardinal (ie it is one-to-one and onto), but then what?
Thank you so much! I have an exam tomorrow and am very lost, the book is not helping.

A: I guess in the general case there is probably no other way then to find an explicit injection in either direction to/from $\Bbb N$. But in a simple case like this you can prove it graphically (I think this prove came originally from Cantor):
Write the elements of $\Bbb Z^+\times \Bbb Z^+$ in an infinite square, starting in the upper left. Now count the elements on each diagonal starting from the upper left, thereby associating each element with an element from $\Bbb N$. In this way you can associate each element of your square with an element of $\Bbb N$.
This works in a similar way for $\Bbb Q$ or all kinds of finite cartesian products of countable sets.
(Note that this construction even finds a Bijection between $\Bbb N$ and the given set, even though in the general case its enough to find an injection for both directions.)


text:
Q: How to reuse the same SwiftUI ForEach structure for NSOrderedSet and FetchedResults I have a SwiftUI view where the bulk of the logic displays a list of recipes with a LazyVGrid. The code looks something like this:
struct RecipeGrid: View {
    let recipes: [Recipe]
    var body: some View {
        return LazyVGrid {
            ForEach(countries) { country in
                Text(recipe.title)
            }
        }
     }
}

This is the hello world of SwiftUI. Straightforward stuff. Two real-world requirements make things a bit more interesting/challenging.
First, we have over 20,000 recipes. So we don't want to pass everything in as an array, as suggested by 1 and 2.
Second, there are two different ways we get the recipes.
The first is to show the most popular recipes using a FetchRequest. It looks something like this:
@FetchRequest(sortDescriptors: [SortDescriptor(\.likes, order: .reverse)])
private var recipes: FetchedResults<Recipe>

The second is to get all recipes using the same ingredient. There is a ManyToMany relationship between Ingredient and Recipe. The declaration of Ingredients looks like this:
class Ingredient: Entity {
    @NSManaged var recipes: NSOrderedSet
}

I am wondering what would be the recommended way to declare the recipes inside RecipeGrid so that it will support both the use cases above.
I have tried the following
struct RecipeGrid: View {
    let recipes: RandomAccessCollection
    ...
}

The above doesn't work. Swift gives the following error message: Protocol 'RandomAccessCollection' can only be used as a generic constraint because it has Self or associated type requirements.
What is the best practice way to approach this? I guess another way to ask my question is:
How do I declare the associated type for RandomAccessCollection?

A: Thanks to @Asperi's help. I figured out a way to achieve what I had in mind.
There are two parts to the answer.
The first is to rewrite RecipeGrid's signature to bind to the RandomAccessCollection protocol, Based on passing FetchedResult to Preview.
This opens up the possibility to test the view using an array and FetchedResult.
struct RecipeGrid<Recipes: RandomAccessCollection>: View where RandomAccessCollection.Element == Recipe {
  let recipes: Recipes
  ...
}

The second part is to give up using the CoreData relationship Ingredient.recipes. The recipes is of type NSOrderedSet, which does not conform to the RandomAccessCollection protocol.
The swift-collections' OrderedSet does support RandomAccessCollection but unfortunately it doesn't work with CoreData.
I rewrote the code to have a second FetchedResult to replace the ingredient.recipes call.


text:
Q: Error using VS 2015 code analyzers Using Visual Studio 2015 RTM, I have a .NET 4.0 class library project.
I've added the Microsoft.CodeAnalysis.FxCopAnalyzers NuGet package to the project. This results in the following Analyzers being listed for the project in Solution Explorer.

*

*Microsoft.AnalyzerPowerPack.Common

*Microsoft.AnalyzerPowerPack.CSharp

*System.Runtime.Analyzers

*System.Runtime.CSharp.Analyzers

*System.Runtime.InteropServices.Analyzers

*System.Runtime.InteropServices.CSharp.Analyzers

However in the Error List window, the following error appears:

Unable to load Analyzer assembly
  C:\Dev\git\MySolution\packages\System.Runtime.Analyzers.1.0.0\analyzers\dotnet\cs\System.Runtime.Analyzers.dll
  : Could not load file or assembly 'System.Runtime.Analyzers,
  Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or
  one of its dependencies. Strong name validation failed. (Exception
  from HRESULT: 0x8013141A)

(and similar for System.Runtime.CSharp.Analyzers and System.Runtime.InteropServices.Analyzers)
The first two analyzers do work correctly, but I'm not getting anything for the last four (probably related to the above errors).
Is there a way to get these to work, or is it possibly related to the project being .NET 4.0?

A: Thank you for reporting this issue. The System.Runtime.* analyzer assemblies uploaded to nuget are indeed only test-signed, and hence cause the assembly load failures. We are working uploading newer nuget packages for System.Runtime.Analyzers and System.Runtime.InteropServices.Analyzers which will have signed assemblies.
Meanwhile, you can get the non System.Runtime based FXCop analyzers by installing "Microsoft.AnalyzerPowerPack" from here: https://www.nuget.org/packages/Microsoft.AnalyzerPowerPack/. These do contain all signed assemblies and should work fine.
I'll post an update on this thread once we have uploaded signed System.Runtime analyzer packages.
Sorry for the inconvenience and thanks again for reporting it!
Regards,
 Manish


text:
Q: Different width `th` & `td` in Table My problem is to put for example th at 50px and td at 500px, is this at least possible?
For my problem, i use datatable but so that most people can be reply i share a simply code :

.abc {
  width: 500px;
}

.def {
  width: 50px;
}

  <title> Data Table </title>

        dkjg
        fdsg
        dsgs

        sdkhgdlg
        dsghj
        dfsjhn

        sdkhgdlg
        dsghj
        dfsjhn

A: No, it's not possible. All columns in the table will always have the same width.
You can possibly do this by declaring two separate tables. Table 1for the header and table 2 for the contents.


text:
Q: SQL Server 2017; Memory troubleshooting; There is insufficient system memory in resource pool 'internal' to run this query We are running a local SQL Server 2017 to support a datawarehouse database. The database is loaded on a schedule through SSIS largely through the use of staging tables and the MERGE function. Recently, we have begun seeing the error "There is insufficient system memory in resource pool 'internal' to run this query.". It has become more and more rampant over the last couple weeks.
We have tried:

*

*Turning off query store

*Updating SQL Server thru CU27

*Tracing the query (no good results)

*Running as many reports as we can find to pinpoint the issue

Recent changes that correlate to the timing of the error:

*

*Turning on Query Store

*Addition of a large number of indexes

Other information:

*

*We have 32gb of memory on the server and allocate 26gb to sql server

*The TARGET table of the MERGE is a CLUSTERED COLUMNSTORE INDEX

*The SOURCE table of the MERGE is a HEAP

*Over time/multiple failures, the SOURCE table that has staged the changed records has grown to over 200,000 records. The TARGET table is ~10 million rows.

Any help would be appreciated. I have scoured the internet for the last couple days looking for any guidance. All I've seen so far is:

*

*Update SQL version

*Modify your query

*Add memory to the server

MERGE STATEMENT:
 DROP TABLE IF EXISTS #Changes;
DROP TABLE IF EXISTS #TransformedChanges;

CREATE TABLE #Changes
(
    [Change Type] VARCHAR(100)
);
MERGE [dbo].[FactOrderLine] AS TARGET
USING ( SELECT
[FactOrderLine].[OrderLine_Key],
[FactOrderLine].[BookedDate_Date_Key],
[FactOrderLine].[BookedDate_Time_Key],
[FactOrderLine].[Account_Key],
[FactOrderLine].[CCN_Key],
[FactOrderLine].[BillTo_SalesOffice_Key],
[FactOrderLine].[BillTo_Territory_Key],
[FactOrderLine].[ShipTo_SalesOffice_Key],
[FactOrderLine].[ShipTo_Territory_Key],
[FactOrderLine].[AssemblyLocation_Key],
[FactOrderLine].[ProductDivision_Key],
[FactOrderLine].[Product_Key],
[FactOrderLine].[Booked Date],
[FactOrderLine].[Ordered Quantity],
[FactOrderLine].[Unit Price - CCN],
[FactOrderLine].[Unit Price - Transaction],
[FactOrderLine].[Discount Factor],
[FactOrderLine].[Split Factor],
[FactOrderLine].[Is Split?],
[DW_Checksum] = CHECKSUM([FactOrderLine].[BookedDate_Date_Key],
[FactOrderLine].[BookedDate_Time_Key],
[FactOrderLine].[Account_Key],
[FactOrderLine].[CCN_Key],
[FactOrderLine].[BillTo_SalesOffice_Key],
[FactOrderLine].[BillTo_Territory_Key],
[FactOrderLine].[ShipTo_SalesOffice_Key],
[FactOrderLine].[ShipTo_Territory_Key],
[FactOrderLine].[AssemblyLocation_Key],
[FactOrderLine].[ProductDivision_Key],
[FactOrderLine].[Product_Key],
[FactOrderLine].[Booked Date],
[FactOrderLine].[Ordered Quantity],
[FactOrderLine].[Unit Price - CCN],
[FactOrderLine].[Unit Price - Transaction],
[FactOrderLine].[Discount Factor],
[FactOrderLine].[Split Factor],
[FactOrderLine].[Is Split?],
0)
FROM [changeLog].[FactOrderLine] ) AS SOURCE
ON [Source].[OrderLine_Key] = [Target].[OrderLine_Key]
WHEN MATCHED AND ISNULL([Source].[DW_Checksum], 0) <> ISNULL([Target].[DW_Checksum], 0) THEN UPDATE SET
[Target].[BookedDate_Date_Key] = [Source].[BookedDate_Date_Key],
[Target].[BookedDate_Time_Key] = [Source].[BookedDate_Time_Key],
[Target].[Account_Key] = [Source].[Account_Key],
[Target].[CCN_Key] = [Source].[CCN_Key],
[Target].[BillTo_SalesOffice_Key] = [Source].[BillTo_SalesOffice_Key],
[Target].[BillTo_Territory_Key] = [Source].[BillTo_Territory_Key],
[Target].[ShipTo_SalesOffice_Key] = [Source].[ShipTo_SalesOffice_Key],
[Target].[ShipTo_Territory_Key] = [Source].[ShipTo_Territory_Key],
[Target].[AssemblyLocation_Key] = [Source].[AssemblyLocation_Key],
[Target].[ProductDivision_Key] = [Source].[ProductDivision_Key],
[Target].[Product_Key] = [Source].[Product_Key],
[Target].[Booked Date] = [Source].[Booked Date],
[Target].[Ordered Quantity] = [Source].[Ordered Quantity],
[Target].[Unit Price - CCN] = [Source].[Unit Price - CCN],
[Target].[Unit Price - Transaction] = [Source].[Unit Price - Transaction],
[Target].[Discount Factor] = [Source].[Discount Factor],
[Target].[Split Factor] = [Source].[Split Factor],
[Target].[Is Split?] = [Source].[Is Split?],
[Target].[DW_Checksum] = [Source].[DW_Checksum],
[Target].[DW_ModifiedOn] = GETUTCDATE(),
[Target].[DW_IsDeleted?] = 0
WHEN NOT MATCHED BY TARGET THEN INSERT
(
[OrderLine_Key],
[BookedDate_Date_Key],
[BookedDate_Time_Key],
[Account_Key],
[CCN_Key],
[BillTo_SalesOffice_Key],
[BillTo_Territory_Key],
[ShipTo_SalesOffice_Key],
[ShipTo_Territory_Key],
[AssemblyLocation_Key],
[ProductDivision_Key],
[Product_Key],
[Booked Date],
[Ordered Quantity],
[Unit Price - CCN],
[Unit Price - Transaction],
[Discount Factor],
[Split Factor],
[Is Split?],
[DW_IsDeleted?], [DW_Checksum], [Source_ModifiedOn], [DW_ModifiedOn], [DW_CreatedOn] ) VALUES (
[Source].[OrderLine_Key],
[Source].[BookedDate_Date_Key],
[Source].[BookedDate_Time_Key],
[Source].[Account_Key],
[Source].[CCN_Key],
[Source].[BillTo_SalesOffice_Key],
[Source].[BillTo_Territory_Key],
[Source].[ShipTo_SalesOffice_Key],
[Source].[ShipTo_Territory_Key],
[Source].[AssemblyLocation_Key],
[Source].[ProductDivision_Key],
[Source].[Product_Key],
[Source].[Booked Date],
[Source].[Ordered Quantity],
[Source].[Unit Price - CCN],
[Source].[Unit Price - Transaction],
[Source].[Discount Factor],
[Source].[Split Factor],
[Source].[Is Split?],
0,
[Source].[DW_Checksum],NULL,GETUTCDATE(),GETUTCDATE()
)
OUTPUT $action INTO #Changes;
CREATE TABLE #TransformedChanges
    (
        [Update Record Count] INT,
        [Insert Record Count] INT
    );
INSERT INTO #TransformedChanges
SELECT *
FROM
    (
        SELECT
            TRIM(#Changes.[Change Type])+' Record Count' AS [Change Type],
            COUNT(*) AS [Record Count]
        FROM #Changes
        GROUP BY TRIM(#Changes.[Change Type])+' Record Count'
    ) A
PIVOT
    (
        SUM([Record Count])
        FOR A.[Change Type] IN ([Update Record Count], [Insert Record Count])
    ) [B];
DECLARE @TransformationChecker INT;
SET @TransformationChecker = (SELECT COUNT(*) FROM #TransformedChanges);
IF @TransformationChecker = 0 INSERT INTO #TransformedChanges VALUES(0,0);
SELECT ISNULL([Update Record Count], 0) [Update Record Count], ISNULL([Insert Record Count], 0) [Insert Record Count] FROM #TransformedChanges;

DROP TABLE IF EXISTS #Changes;
DROP TABLE IF EXISTS #TransformedChanges;

A: Thanks to the help of multiple commenters I found that my issue was resolved by removing the use of the MERGE statements and instead running independent INSERT/UPDATE/DELETE statements. This was recommended by multiple blogs, a DBA I work with and the commenters here but because of no available documentation that would suggest MERGE and memory issues may be linked (and my own stubborn-ness) I did not attempt switching them until trying multiple other routes.
I am still curious what exactly is going on under the hood that is causing the memory issues when on the surface you would expect the same number of updates, inserts and deletes to require the same (or a similar) amount of resources. Obviously, the MERGE statement does not operate this way and sometimes you have to be practical with solutions.

A: "There is insufficient system memory in resource pool 'internal' to run this query."
Check the spid associated with the error message in the error log. Because the target of the merge is a clustered columnstore index, I strongly suspect the error is not directly associated with the the MERGE, rather a consequence of the MERGE.  A message from the MERGE itself shouldn't be in the internal resource pool.
The background tuple mover does run in the internal resource pool. Unless any remaining delta stores are compressed with a reorg with (COMPRESS_ALL_ROW_GROUPS = ON), at some point the tuple mover will close and compress delta stores. It needs a memory grant to do so. If the tuple mover times out for its memory grant or the minimal grant for tuple mover isn't available, that error is the outcome.  I believe the tuple mover always uses a 1 GB memory grant.


text:
Q: How to change activity title when switching between tabs in Kotlin? There are many answers to that question in Java language, but I can not apply it
using Kotlin.
I use ViewPager to switch between tabs and I want MainActivity title to be changed every time when I swipe.
class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        setSupportActionBar(toolbar)

        container.adapter = TabPagerAdapter(supportFragmentManager)
        container.addOnPageChangeListener(TabLayout.TabLayoutOnPageChangeListener(tabs))
    tabs.addOnTabSelectedListener(TabLayout.ViewPagerOnTabSelectedListener(container))
    }

    override fun setTitle(title: CharSequence?) {
        supportActionBar?.title = title
    }
}

I use "kotlin-android-extensions", so container is id of ViewPager and tabs is id of TabLayout. I also created class TabPagerAdapter that extends FragmentPagerAdapter. It returns correct tab, which is Fragment derivative, with getItem method. I tried to achieve my goal by overriding getPageTitle method but it doesn't work.
class TabPagerAdapter(fragmentManager: FragmentManager) :
FragmentPagerAdapter(fragmentManager) {

    override fun getItem(p0: Int): Fragment {
        return when (p0) {
            else -> TestTab.newInstance()
            }
    }

    override fun getPageTitle(position: Int): CharSequence? {
        return "test title"
    }

    override fun getCount(): Int {
        return 1
    }
}

My tab example:
class NotificationsTab : Fragment() {
    private val _title = "Notifications"

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        return inflater.inflate(R.layout.fragment_notifications, container, false)
    }

    companion object {
        fun newInstance(): NotificationsTab {
            return NotificationsTab()
        }
    }
}

I want variable _title to be the MainActivity title.
XMLs that I use:
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/main_content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        tools:context="com.androidtest.activities.MainActivity"
        android:orientation="vertical">

    <android.support.design.widget.AppBarLayout
            android:id="@+id/appbar"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="63"
            app:elevation="0dp">

        <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="50"
                android:background="#ffffff"
                app:layout_scrollFlags="scroll|enterAlways"
                app:title="@string/app_name">

        </android.support.v7.widget.Toolbar>

        <android.support.design.widget.TabLayout
                android:id="@+id/tabs"
                android:background="#ffffff"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="50"
                app:tabIndicatorColor="@color/tabIndicatorColor"
                app:tabIndicatorHeight="3dp">

            <android.support.design.widget.TabItem
                    android:id="@+id/tab_profile"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="1"/>

            <android.support.design.widget.TabItem
                    android:id="@+id/tab_notifications"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="2"/>

        </android.support.design.widget.TabLayout>
    </android.support.design.widget.AppBarLayout>

    <android.support.v4.view.ViewPager
            android:id="@+id/container"
            android:layout_weight="390"
            android:background="#ffffff"
            android:layout_width="match_parent"
            android:layout_height="0dp"/>

</LinearLayout>

fragment_notifications.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    <TextView
            android:layout_width="wrap_content"
            android:text="notifications"
            android:layout_gravity="center"
            android:textAlignment="center"
            android:textSize="56sp"
            android:layout_height="wrap_content"/>
</LinearLayout>

A: viewPagerAtmosphericInfo.addOnPageChangeListener(object: ViewPager.OnPageChangeListener{
override fun onPageScrollStateChanged(state: Int) {

}

override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {

}

override fun onPageSelected(position: Int) {
   // code here
})

A: If you want to set the title of your activity with tabs, You have to set the  title of activity(s) actionbar which you can set from fragment by using activity instance.
Example :
//initialize activity instance
lateinit var mActivity: AppCompatActivity

//get activity inside your onViewCreated of fragment
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    super.onViewCreated(view, savedInstanceState)

    mActivity = activity as MainActivity

}

// inside your fragment
override fun setUserVisibleHint(isVisibleToUser: Boolean) {
    super.setUserVisibleHint(isVisibleToUser)
    if(isVisibleToUser){
        //change your title from here, make sure that activity is not null
        mActivity.supportActionBar?.title = "Your Title"
    }
}

Let me now if you have any query! :)

A: As I understand when users swipe between tabs, you will set the tab's text as title of the activity. Here is a solution
First remove all TabItem tags from activity_main.xml layout file because you are using TabLayout with ViewPager. The ViewPager will handle how to setup tab (number of tabs, fragment at each tab, title at each tab, etc).
<android.support.design.widget.TabLayout
        android:id="@+id/tabs"
        android:background="#ffffff"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="50"
        app:tabIndicatorHeight="3dp">

    <!--<android.support.design.widget.TabItem-->
            <!--android:id="@+id/tab_profile"-->
            <!--android:layout_width="wrap_content"-->
            <!--android:layout_height="wrap_content"-->
            <!--android:text="1"/>-->

    <!--<android.support.design.widget.TabItem-->
            <!--android:id="@+id/tab_notifications"-->
            <!--android:layout_width="wrap_content"-->
            <!--android:layout_height="wrap_content"-->
            <!--android:text="2"/>-->

</android.support.design.widget.TabLayout>

Then change your code in MainActivity
container.adapter = TabPagerAdapter(supportFragmentManager)
// Comment-out or remove these lines
// container.addOnPageChangeListener(TabLayout.TabLayoutOnPageChangeListener(tabs))
// tabs.addOnTabSelectedListener(TabLayout.ViewPagerOnTabSelectedListener(container))

// Pass viewpager to tablayout to setup tabs.
tabs.setupWithViewPager(container)

// Handle event when users swipe to a tab, here we set tab's text as title of the activity.
tabs.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
    override fun onTabSelected(tab: TabLayout.Tab) {
        title = tab.text // the value of tab's text is the returned value from `getPageTitle` method in TabPagerAdapter class.
    }

    override fun onTabUnselected(tab: TabLayout.Tab?) {
    }

    override fun onTabReselected(tab: TabLayout.Tab?) {
    }
})

// For the first time open the app, we set first tab's title as title of this activity
title = container.adapter!!.getPageTitle(0)


text:
Q: Find biggest document in Mongo Collection I would like to find the biggest document in a mongo collection. "Biggest" would mean the one that takes up the most units towards the 16MB document size limit. Bonus points for finding that document's _id too .

A: give a collection called "requests" :
db.requests.find().toArray().map(function(request) { return {size:Object.bsonsize(request), _id:request._id}; }).sort(function(a, b) { return a.size-b.size; }).pop();

// { "size" : 3333, "_id" : "someUniqueIdHere" }


text:
Q: How do I shrink the child view like in the GridView Does any one know how to accomplish the shrinking of the child view in Flutter as show here in the first picture. I used a gridView which does the job very well.
On the second picture I used a row, I tried it with Container and Constrains but it didn't worked out very well. ;D

 return new GridView.count(
    crossAxisCount: 3,
    padding: const EdgeInsets.all(16.0),
    mainAxisSpacing: 4.0,
    shrinkWrap: true,
    crossAxisSpacing: 4.0,

    children: widget.foodItems.map((FoodViewModel food){
        return new FoodTile(
            name: food.name,
            icon: food.icon
            , onPressed: (bool state) {
              food.isSelected = state;
              widget?.onFoodItemTaped(food, state);
            },
        );
    }).toList(),
);

Here the row-code without any constrains
    return new SingleChildScrollView(
        child: new Container(
          margin: const EdgeInsets.all(16.0),
      child:new Row(
        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
        children: <Widget>[
          new Container(
            padding: const EdgeInsets.all(2.0),
            child: new FoodTile(name: "Tile one", onPressed:(bool state){}),
          ),
          new Container(
            padding: const EdgeInsets.all(2.0),
            child: new FoodTile(name: "Tile two", onPressed:(bool state){}),
          ),
          new Container(
            padding: const EdgeInsets.all(2.0),
            child: new FoodTile(name: "Tile three", onPressed:(bool state){}),
          )

        ],
      )
    ));

Complete source code to the tile

A: You should wrap the instances of FoodTile in a Flexible or Expanded so that the Row will apply a flexible layout model to them and space them evenly.

A: Just if someone is wondering how the end result looks. I'm still a bit unhappy with the "LayoutBuilder-Solution" but it works for me right know.
return new SingleChildScrollView(
    child: new Container(
      margin: const EdgeInsets.all(16.0),

      child: new Row(
        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
        mainAxisSize: MainAxisSize.min,
        children: <Widget>[
          new Expanded(child: new LayoutBuilder(builder: (BuildContext context,  BoxConstraints constraints){
            return new Container(
              constraints: new BoxConstraints.tightFor(width: constraints.maxWidth, height: constraints.maxWidth),
              padding: const EdgeInsets.all(2.0),
              child: new FoodTile(name:"hallo",onPressed: (bool state){}),
            );
          })),
          new Expanded(child: new LayoutBuilder(builder: (BuildContext context,  BoxConstraints constraints){
            return new Container(
              constraints: new BoxConstraints.tightFor(width: constraints.maxWidth, height: constraints.maxWidth),
              padding: const EdgeInsets.all(2.0),
              child: new FoodTile(name:"hallo 2",onPressed: (bool state){}),
            );
          })),
          new Expanded(child: new LayoutBuilder(builder: (BuildContext context,  BoxConstraints constraints){
            return new Container(
              constraints: new BoxConstraints.tightFor(width: constraints.maxWidth, height: constraints.maxWidth),
              padding: const EdgeInsets.all(2.0),
              child: new FoodTile(name:"hallo 3",onPressed: (bool state){}),
            );
          })),
        ],
      ),


text:
Q: Why are all Super Mutants male? At least they all sound male...but why? I don't really know of any super mutant backstory, such as how they were created (which may lead to an answer), but I never once heard a super mutant that sounded female when they spoke.

A: Actually the super mutant females are confirmed in Fallout 1 alongside the problem they can not breed. The strange thing is you never see a female super mutant or maybe you do see them but are unable to identify them.
To clear it up there will be some spoilers from Fallout 1 so you best stop reading if you intend to play it.
The last objective in Fallout 1 is to dispose of the leader of these super mutants. It is a strange mutant which seems to be an ex overseer hiding in his vault. When you meet him you start with a debate which if done right (includes some previous side quests) will lead to your victory without any battle.
It will explain that humans and super mutants don't go along and will battle each other until there is nothing left. That is why he established this cult and engaged the war between the 2 species, but he had to chose which side to join and he joined the mutants simply because they have a better chance of survival in this new world (what a great guy).
Now this leads to the situation where you may have a proof that super mutants simply lack the ability to breed (a quest). By showing him the proof he will then call his female super mutants to confirm that none of them are pregnant while expecting that some of them should be by now. Since it is such a good guy it is now in its conflict and sees it chose the wrong side. He proceeds by setting a countdown timer on a nuclear bomb in its possession. You run away and the whole cult is being destroyed.

A: Super Mutants were created through use of the Forced Evolutionary Virus (FEV for short). There have been several variation of the virus, but they all tend to leave those affected sterile, and without their secondary sexual characteristics (some strains of FEV remove all signs of pre-mutation gender).
The virus was originally designed to make humans immune to a wide variety diseases (among other things) by re-writing the genetic code. So while the virus is doing its thing, it sees the genetic code for the gender split as damage and... 'fixes' it.
There have been a few super mutants that identified as female (Tabitha and Lily from Fallout New Vegas). It is difficult to tell how many super mutants might have been female before mutation, as the games tend to not show us their genitals (assuming their particular strain of the virus kept those). So it is really only the super mutants who remain intelligent (somewhat rare) and aware of their past life (even rarer) who can express their old gender.

A: Not all super mutants are male.
Super Mutants are sterile. The nature of the FEV virus rewrites their genetic code from scratch, from exposure to particular strains of the virus -- mutants are NOT born, but rather they are recreated. The virus removes both primary and secondary sexual characteristics and leaves all the mutants sterile.  Some mutants have male genitalia (seen by losing an arm wrestling match with Francis in FO2, then becoming his personal gimp for the night).  Of course, this doesn't stop them from engaging in intercourse, but they are unable to breed.
The only two super mutants that attempt to pass off as female are Tabitha on Black Mountain and Lily from Jacobstown in FO:NV.  Their voices, however, are not female, but rather attempting to emulate a female voice, similar to a male speaking in a falsetto tone.
Not all Super Mutants are male, it's just we haven't seen any female Super Mutants yet in any of the games to confirm this.  East Coast super mutants seen in Fallout 3 and Fallout 4 lack genitalia, but the West Coast super mutants seen in Fallout 1 (not F:NV) could have genitalia (a few have it).


text:
Q: How to rotate the D3 chart so that the selected arc is at the bottom? I am trying to develop an application where users can click on the D3 pie chart and see information which relates to the selection. How can I rotate the arc's so that the clicked arc comes to the bottom (the centre of the arc clicked on should be at the bottom)? I have been playing around with rotating the pie by selecting the arc group but I would appreciate any idea on how to achieve this.
Here is some code I have so far.
 var self = this;
    var instanceId = Math.floor(Math.random() * 100000);

    var margin = {
        top: 5,
        right: 15,
        bottom: 50,
        left: 20
    };

    self.width = this.htmlElement.parentElement.parentElement.offsetWidth - margin.right - margin.left;
    self.height =   window.innerHeight / 3 ;
    self.curAngle = 0;

    self.svgParent.html("
Sponsors

");

    // Update data for the chart
    self.updateChartData = function () {

        if(!self.svg) {
            this.svg = this.svgParent
                .classed("svg-container", true)
                .append("svg")
                .attr("preserveAspectRatio", "xMinYMin meet")
                .attr("viewBox", "0 0 " + this.width + " " + this.height)
                .append("g")
                .classed("svg-content-responsive", true);
                //.attr("transform", "translate(" + this.width / 2 + "," + this.height / 2 + ")");
        }

        var svgg = this.svg
          .append("g")
          .classed("svg-content-responsive", true)
          .attr("transform", "translate(" + margin.left + "," + margin.top + ")");

        self.svg.selectAll(".arctext").remove();
        self.svg.selectAll(".pie-widget-total-label").remove();

        var pie = d3.pie().sort(sort)(self.selectedData.map(function (d: any) {
            return d.count;
        }));

        var path = d3.arc()
            .outerRadius(radius)
            .innerRadius(radius / 2);

        var outsideLabel = d3.arc()
            .outerRadius(radius * 0.9)
            .innerRadius(radius * 0.9);

        var middleLabel = d3.arc()
            .outerRadius(radius * 0.75)
            .innerRadius(radius * 0.75);

        var insideLabel = d3.arc()
            .outerRadius(radius * 0.6)
            .innerRadius(radius * 0.6);

        var g = self.svg
            .attr("width", self.width + margin.left + margin.right)
            .attr("height", self.height + margin.top + margin.bottom)
            .append("g")
            .attr("transform", "translate(" + self.width / 2 + "," + self.height / 2 + ")");

        var defs = g.append("defs");

        var lightGradients = defs.selectAll(".arc")
            .data(pie)
            .enter()
            .append("radialGradient")
            .attr("id", function (d: any) {
                return "lightGradient-" + instanceId + "-" + d.index;
            })
            .attr("gradientUnits", "userSpaceOnUse")
            .attr("cx", "0")
            .attr("cy", "0")
            .attr("r", "120%");

        var darkGradients = defs.selectAll(".arc")
            .data(pie)
            .enter()
            .append("radialGradient")
            .attr("id", function (d: any) {
                return "darkGradient-" + instanceId + "-" + d.index;
            })
            .attr("gradientUnits", "userSpaceOnUse")
            .attr("cx", "0")
            .attr("cy", "0")
            .attr("r", "120%");

        lightGradients.append("stop")
            .attr("offset", "0%")
            .attr("style", function (d: any) {
                return "stop-color: " + d3.color(color(d.index)) + ";";
            });

        lightGradients.append("stop")
            .attr("offset", "100%")
            .attr("style", function (d: any) {
                return "stop-color: black;";
            });

        darkGradients.append("stop")
            .attr("offset", "0%")
            .attr("style", function (d: any) {
                return "stop-color: " + d3.color(color(d.index)).darker(0.5) + ";";
            });

        darkGradients.append("stop")
            .attr("offset", "100%")
            .attr("style", function (d: any) {
                return "stop-color: black;";
            });

        self.tooltip = d3.select("body")
            .append("div")
            .attr("class", "pie-widget-tooltip")
            .style("opacity", 0);

        self.arc = g.selectAll(".arc")
            .data(pie)
            .enter()
            .append("g")
            .attr("class", "arc");

        var arcpath = self.arc.append("path")
            .attr("id", function (d: any) {
                return d.index;
            })
            .attr("d", path)
            .attr("stroke", "white")
            .attr("stroke-width", "2px")
            .attr("fill", function (d: any) {
                return "url(#lightGradient-" + instanceId + "-" + d.index + ")";
            })
            .on("click", function (d: any) {
                console.log("About to send::::" + getStudyLabel(d.index));
                self.selectedIndustryTypeService.sendMessage(getStudyLabel(d.index));
                self.showDialog();
                self.rotateChart();
             })

            .transition()
            .duration(function(d:any, i:any) {
                return i * 800;
            })
            .attrTween('d', function(d:any) {
                var i = d3.interpolate(d.startAngle + 0.1, d.endAngle);
                return function (t: any) {
                    d.endAngle = i(t);
                    return path(d);
                }
            });

        function arcTween(a: any) {
            var i = d3.interpolate(this._current, a);
            this._current = i(0);
            return function(t: any) {
                return path(i(t));
            };
        }

        var gtext = self.svg
            .append("g")
            .attr("transform", "translate(" + self.width / 2 + "," + self.height / 2 + ")");

        var arctext = gtext.selectAll(".arctext")
            .data(pie)
            .enter()
            .append("g")
            .attr("class", "arctext");

        var primaryLabelText = arctext.append("text")
          .on("click", function (d: any) {
            console.log("About to send::::" + getStudyLabel(d.index));
            self.selectedIndustryTypeService.sendMessage(getStudyLabel(d.index));
            self.showDialog();
          })
            .transition()
            .duration(750)
            .attr("transform", function (d: any) {
                return "translate(" + middleLabel.centroid(d) + ")";
            })
            .attr("dy", "-0.75em")
            .attr("font-family", "sans-serif")
            .attr("font-size", "15px")
            .attr("class", "sponsor-pie-widget-label")
            .text(function (d: any) {
                if (d.endAngle - d.startAngle < 0.3) {
                    return "";
                } else {
                    return getStudyLabel(d.index);
                }
            });

        var secondaryLabelText = arctext.append("text")
          .on("click", function (d: any) {
            console.log("About to send::::" + getStudyLabel(d.index));
            self.selectedIndustryTypeService.sendMessage(getStudyLabel(d.index));
            self.showDialog();
          })
            .transition()
            .duration(750)
            .attr("transform", function (d: any) {
                return "translate(" + middleLabel.centroid(d) + ")";
            })
            .attr("dy", "0.75em")
            .attr("font-family", "sans-serif")
            .attr("font-size", "10px")
            .attr("class", "sponsor-pie-widget-label")
            .text(function (d: any) {
                if (d.endAngle - d.startAngle < 0.3) {
                    return "";
                } else {
                    return getPatientsLabel(d.index);
                }
            });

        var n = 0;
        for (var i = 0; i < self.selectedData.length; i++) {
            n = n + this.selectedData[i]["count"];
        }
        var total = self.svg
            .append("g")
            .attr("transform", "translate(" + (self.width / 2 - 20 ) + "," + self.height / 2 + ")")
        total.append("text")
            .attr("class", "pie-widget-total-label")
            .text("Total\r\n" + n);
    }.bind(self);

    self.showDialog = function() {
        this.router.navigateByUrl('/myRouteName');
    }.bind(self);

    self.rotateChart = function() {
      self.arc.attr("transform", "rotate(-45)");
    }.bind(self);

A: You could rotate the arcs by changing their start/end angles as appropriate, but this would be more complex than needed.
A simpler solution would be to just rotate a g that holds the entire pie chart, at the same time, rotate any labels the other way so they remain level.
I've just used the canonical pie chart from this block as an example:

var svg = d3.select("svg"),
    width = +svg.attr("width"),
    height = +svg.attr("height"),
    radius = Math.min(width, height) / 2,
    g = svg.append("g").attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");

var color = d3.scaleOrdinal(["#98abc5", "#8a89a6", "#7b6888", "#6b486b", "#a05d56", "#d0743c", "#ff8c00"]);

var data = [ {age:"<5", population: 2704659},{age:"5-13", population: 4499890},{age:"14-17", population: 2159981},{age:"18-24", population: 3853788},{age:"25-44", population: 14106543},{age:"45-64", population: 8819342},{age:"≥65", population: 612463} ]

var pie = d3.pie()
    .sort(null)
    .value(function(d) { return d.population; });

var path = d3.arc()
    .outerRadius(radius - 10)
    .innerRadius(0);

var label = d3.arc()
    .outerRadius(radius - 40)
    .innerRadius(radius - 40);

var arc = g.selectAll(".arc")
    .data(pie(data))
    .enter().append("g")
      .attr("class", "arc");

arc.append("path")
    .attr("d", path)
    .attr("fill", function(d) { return color(d.data.age); })
    .on("click",function(d) {
      // The amount we need to rotate:
      var rotate = 180-(d.startAngle + d.endAngle)/2 / Math.PI * 180;

      // Transition the pie chart
      g.transition()
        .attr("transform",  "translate(" + width / 2 + "," + height / 2 + ") rotate(" + rotate + ")")
        .duration(1000);

     // Τransition the labels:
     text.transition()
       .attr("transform", function(dd) {
         return "translate(" + label.centroid(dd) + ") rotate(" + (-rotate) + ")"; })
       .duration(1000);

    });

 var text = arc.append("text")
      .attr("transform", function(d) { return "translate(" + label.centroid(d) + ")"; })
      .attr("dy", "0.35em")
      .text(function(d) { return d.data.age; });

.arc text {
  font: 10px sans-serif;
  text-anchor: middle;
}

.arc path {
  stroke: #fff;
}
<svg width="960" height="500"></svg>


text:
Q: Prove that the Legendre polynomial holds true using the generating function and a binomial expansion. I tried using that
$$P_{2n}(z)=\frac1{2^{2n}(2n)!}\frac{d^{2n}}{dz^{2n}}(z^2-1)^{2n} $$
but I am having trouble taking the derivative when $n$ is unknown and $z$ is $0$.
Any help would be greatly appreciated!


text:
Q: Can't display images from block content with PortableText It been really long time I stuck with this issue. I'm still learning but can't move because of this partically case.
Links and texts are good but I couldn't show the images whatever I did, didn't work.
I'm working on standard project that I generated here
import markdownStyles from "./markdown-styles.module.css";
import { PortableText } from "@portabletext/react";

export default function PostBody({ content }) {
  return (
    <div className="max-w-2xl mx-auto" className={markdownStyles.markdown}>
      <PortableText value={content} />
    </div>
  );
}

This is the output I get from the content. I can see image type. I also tried by adding custom component, but still didn't work
    [
    {
    "_key": "5ce765e42eb5",
    "_type": "block",
    "children": [
        {
        "_key": "c57bc9898e06",
        "_type": "span",
        "marks": [
            "836416fa85ed"
        ],
        "text": "Welcome to my new blog!"
        }
    ],
    "markDefs": [
        {
        "_key": "836416fa85ed",
        "_type": "link",
        "href": "https://google.com"
        }
    ],
    "style": "h2"
    },
    {
    "_key": "11b612a096de",
    "_type": "block",
    "children": [
        {
        "_key": "bf13eac39637",
        "_type": "span",
        "marks": [],
        "text": "Sanity.io lets me work with structured content. That means I can add more content types. Who knows, I might add my portfolio, "
        },
        {
        "_key": "c9fe6a6bb0f3",
        "_type": "span",
        "marks": [
            "e202c343ba02"
        ],
        "text": "maybe a podcast"
        },
        {
        "_key": "7a203dce7337",
        "_type": "span",
        "marks": [],
        "text": ", "
        },
        {
        "_key": "94459dbc472b",
        "_type": "span",
        "marks": [
            "9fbf2c53c020"
        ],
        "text": "some products that I need to market"
        },
        {
        "_key": "e5d3752691f2",
        "_type": "span",
        "marks": [],
        "text": ", or my poetry collection (that I totally have)! I can even connect other frontends to my Sanity project when I find that new framework I just need to try out."
        }
    ],
    "markDefs": [
        {
        "_key": "e202c343ba02",
        "_type": "link",
        "href": "https://github.com/kmelve/sanity-plugin-podcast"
        },
        {
        "_key": "9fbf2c53c020",
        "_type": "link",
        "href": "https://www.sanity.io/blog/e-commerce-sample-schema"
        }
    ],
    "style": "normal"
    },
    {
    "_key": "5cdb13c0961f",
    "_type": "block",
    "children": [
        {
        "_key": "a0d77a44e824",
        "_type": "span",
        "marks": [],
        "text": ""
        }
    ],
    "markDefs": [],
    "style": "normal"
    },
    {
    "_key": "23a029d1e942",
    "_type": "image",
    "asset": {
        "_ref": "image-a526b96131f4da2799071600492f8afbe4de62a3-900x900-webp",
        "_type": "reference"
    }
    },
    {
    "_key": "a8744e882bab",
    "_type": "block",
    "children": [
        {
        "_key": "f028ef71c8e2",
        "_type": "span",
        "marks": [],
        "text": "img"
        }
    ],
    "markDefs": [],
    "style": "normal"
    },
    {
    "_key": "398aea7e852b",
    "_type": "block",
    "children": [
        {
        "_key": "ce6249854da8",
        "_type": "span",
        "marks": [],
        "text": "But firstly, how could I make this blog my own special place on the internet?"
        }
    ],
    "markDefs": [],
    "style": "normal"
    },
    {
    "_key": "4e33a24403f6",
    "_type": "block",
    "children": [
        {
        "_key": "0a678ac11d25",
        "_type": "span",
        "marks": [],
        "text": "I should probably check out the tutorial videos on how to get started with customizing both the content schema and the frontend accordingly."
        }
    ],
    "markDefs": []
    },
    {
    "_key": "13ba10479b9c",
    "_type": "block",
    "children": [
        {
        "_key": "2c71eab6accc",
        "_type": "span",
        "marks": [],
        "text": "There's plenty of cool things I could explore:"
        }
    ],
    "markDefs": []
    },
    {
    "_key": "be751db6e0d0",
    "_type": "image",
    "asset": {
        "_ref": "image-c6f278aa0550e1c5617d26e67944086f8a21a4c8-800x800-webp",
        "_type": "reference"
    },
    "crop": {
        "_type": "sanity.imageCrop",
        "bottom": 0,
        "left": 0,
        "right": 0,
        "top": 0
    },
    "hotspot": {
        "_type": "sanity.imageHotspot",
        "height": 1,
        "width": 1,
        "x": 0.5,
        "y": 0.5
    }
    },
    {
    "_key": "557a095c0eed",
    "_type": "block",
    "children": [
        {
        "_key": "43364982b47a",
        "_type": "span",
        "marks": [
            "27519f331ef1"
        ],
        "text": "How to customize content schemas"
        }
    ],
    "level": 1,
    "listItem": "bullet",
    "markDefs": [
        {
        "_key": "27519f331ef1",
        "_type": "link",
        "href": "https://www.sanity.io/docs/the-blog-template"
        }
    ]
    },
    {
    "_key": "698010eacb6f",
    "_type": "block",
    "children": [
        {
        "_key": "2913625481f0",
        "_type": "span",
        "marks": [
            "e7e3f00bdddf"
        ],
        "text": "How to use structure builder to make my own workflows"
        }
    ],
    "level": 1,
    "listItem": "bullet",
    "markDefs": [
        {
        "_key": "e7e3f00bdddf",
        "_type": "link",
        "href": "https://www.sanity.io/docs/content-studio/structure-builder"
        }
    ]
    },
    {
    "_key": "36bf78dc4fad",
    "_type": "block",
    "children": [
        {
        "_key": "81b76c937c46",
        "_type": "span",
        "marks": [
            "0a3a661f75ef"
        ],
        "text": "How to manage widgets on my dashboard"
        }
    ],
    "level": 1,
    "listItem": "bullet",
    "markDefs": [
        {
        "_key": "0a3a661f75ef",
        "_type": "link",
        "href": "https://github.com/sanity-io/sanity/blob/next/packages/%40sanity/dashboard/README.md"
        }
    ]
    },
    {
    "_key": "5112fa59322d",
    "_type": "block",
    "children": [
        {
        "_key": "8901d5ceef26",
        "_type": "span",
        "marks": [
            "bd816d006b06"
        ],
        "text": "the friendly developer community"
        },
        {
        "_key": "ff01f7459236",
        "_type": "span",
        "marks": [],
        "text": "."
        }
    ],
    "markDefs": [
        {
        "_key": "bd816d006b06",
        "_type": "link"
        }
    ]
    }
]

A: In order to render the images coming from your portable text, you need to generate the URL for those images using some utilities provided by Sanity: Sanity image url-builder and optionally Sanity asset utils to get images dimensions, etc.
Once you configure these tools following docs instructions, you can customize how you render your content using the components prop of the PortableText component (basically styling the output however you want). Read more about this here.
When it comes to querying for images in Sanity documents, most of the time you don't really need the url-builder since you can directly query for the URL of the asset. However, it's different when you query for images that have been added in a rich text editor since Sanity doesn't provide a URL for the asset, you need to build it.


text:
Q: Mocking a private method in an Expectations block causes "IllegalStateException: Missing invocation to mocked type at this point" I have a JUnit test that uses a JMockit Expectations block:
@Tested
private MyTestedClass myTestedClass;

@Injectable
private MyOtherClass myOtherClass;

@Test
public void publicBooleanMethodTest() {

    new Expectations() {{
        invoke(myOtherClass, "privateMethod");
        result = true;
    }};

    myTestedClass.run(); // Calls myOtherClass.privateMethod();
}

However, this results in the following error:

java.lang.IllegalStateException: Missing invocation to mocked type at this point; please make sure such invocations appear only after the declaration of a suitable mock field or parameter

As you can see, myClass is mocked via @Injectable, so I'm not sure why the error is happening. I have also found that if I change the scope of privateMethod() to public, everything works.
What is going on and how can I fix this? It worked fine in JMockit 1.22, but now fails in JMockit 1.23 and greater.

A: JMockit 1.23 removed support for mocking private methods in Expectations blocks. From the release notes:

Version 1.23 (Apr 24, 2016):

*

*Dropped support for the mocking of private methods/constructors when using the Expectations API, to prevent misuse. If still needed, they can be mocked or stubbed out with the application of a MockUp<T>.

Unfortunately, the erroneous error message is currently seen as "too costly too fix" by the development team. A better error message was added in JMockit 1.28 as a result of this discussion.
The error log says to use MockUp<T> as an alternative. In this case, the code would be as follows:
@Tested
private MyTestedClass myTestedClass;

@Injectable
private MyOtherClass myOtherClass;

@Test
public void publicBooleanMethodTest() {
    // Partially mock myOtherClass
    new MockUp<MyOtherClass>(myOtherClass) {
        @Mock boolean privateBooleanMethod() {
            return true;
        }
    };

    myTestedClass.run(); // Calls myOtherClass.privateMethod();
}


text:
Q: How to edit the text prase by Json after assigning it to the TextFormFeild in Flutter? I prase a json and assign the text to a TextFormField. I want to edit that text again. How to do it. I tried, but again the text displayed by json is still displaying.
    var disConroller = TextEditingController();
    disConroller.text = snapshot.data[0].note

My TextTextFormField

 TextFormField(
            maxLines: null,
            minLines: null,
            controller: disConroller, // enterd text
            decoration: InputDecoration(
            hintText: "type here..",
            focusedBorder: OutlineInputBorder(
            borderSide:
            BorderSide(width: 2.0)),
            enabledBorder: OutlineInputBorder(
            borderSide:
            BorderSide(width: 1.0),)

A: by seeing your code it is hard to ans but if have parsed your json correctly decoded it and converted to a string then then assign that string to the controller change the state and this will work i can only tell this much with the code you have shared


text:
Q: Reducing to one row per duplicate row same table Table Name - Enrolments
 +-----------+------------------+-------------+-------------+-------------+----------------------+
 +  unit_id  +  student_number  +  unit_code  +  course_id  +  status_id  + last_modified_date  +
 +-----------+------------------+-------------+-------------+-------------+----------------------+
 +   20102   +    SN0001        +  HP-306.12  +   BPL-12    +  WITHDRAWN  +   2/8/2016 15:08     +
 +-----------+------------------+-------------+-------------+-------------+----------------------+
 +   20102   +    SN0001        +  HP-306.12  +   BMin-12   +  COMPLETED  +   2/8/2016 15:08     +
 +-----------+------------------+-------------+-------------+-------------+----------------------+
 +   20110  +     SN0002        +  AS-105.11  +   BBS-12    +  WITHDRAWN  +   2/9/2016 12:01     +
 +-----------+------------------+-------------+-------------+-------------+----------------------+
 +   20110   +    SN0002        +  AS-105.11  +   BMin-13   +  WITHDRAWN  +   2/9/2016 15:13     +
 +-----------+------------------+-------------+-------------+-------------+----------------------+

I've this data as shown in the table-enrolments, there are matching unit_id, student_number
2 conditions i would like to run a sql queries on the table:
a. I would like to remove the 'duplicated' rows and only retain the row that does not have status_id widthdrawn.
b. however, if the 2 'duplicated' rows both have withdrawn status_id and i just want to keep one.
The end result should look like the following table screen shot
Table Name - Newly changed table
 +-----------+------------------+-------------+-------------+-------------+----------------------+
+  unit_id  +  student_number  +  unit_code  +  course_id  +  status_id  +  last_modified_date  +
+-----------+------------------+-------------+-------------+-------------+----------------------+
+   20102   +    SN0001        +  HP-306.12  +   BMin-12   +  COMPLETED  +   2/8/2016 15:08     +
+-----------+------------------+-------------+-------------+-------------+----------------------+
+   20110   +    SN0002        +  AS-105.11  +   BMin-13   +  WITHDRAWN  +   2/9/2016 15:13     +
+-----------+------------------+-------------+-------------+-------------+----------------------+

Anyone can help on this ?

A: Your solution
Perhaps something like
SELECT * FROM (SELECT * FROM table ORDER BY `status_id`) t1 GROUP BY `unit_id`, `student_number`;

Be warned, I've not tested this query myself so I cannot guarantee it works, report back if it does not and let me know the error ^_^


text:
Q: Bash script - remove lines by looking ahead I have a csv file where some rows have an empty first field, and some rows have content in the first field. The rows with content in the first field are header rows.
I would like to remove every unnecessary header row. The best way I can see of doing this is by deleting every row for which:

*

*First field is not empty

*First field in the following row is not empty

I do not necessarily need to keep the data in the same file, so I can see this being possible using grep, awk, or sed, but none of my attempts have come close to working.
Example input:
header1,value1,etc
,value2,etc
header2,value3,etc
header3,value4,etc
,value5,etc

Desired output:
header1,value1,etc
,value2,etc
header3,value4,etc
,value5,etc

Since the header2 line is not followed by a line with an empty field 1, it is an unnecessary header row.

A: awk -F, '$1{h=$0;next}h{print h;h=""}1' file

-F,: Use comma as a field separator
$1{h=$0;next}: If the first field has data ( other than 0 ), save the line and go on to the next line.
h{print h;h=""}1: If there is a saved header line, print it and forget it. (This can only execute if there is nothing in $1 because of the next above.)
1: print the current line.

A: These kind of tasks are often conceptually easier by reversing the file and checking if the previous line is a header:
tac file |
  awk -F, '$1 && have_header {next} {print; have_header = length($1)}' |
  tac


text:
Q: Javascript - div inside div problem I need the hideall() function to execute when the mouse moves out of id1. With the code below, it calls hideall() correctly but it calls it again when the mouse moves out of id2.

This is inside id1 div

http://i.stack.imgur.com/hrfsM.png

A: There is a proprietary event in Internet Explorer called mouse leave that I believe is exactly what you are looking for. Unfortunately, this will not work in all browsers. I recommend you use a javascript library like jQuery. It has the event built in. See http://api.jquery.com/mouseleave/ for details. So what you would probably be looking for is something like this:

This is inside id1 div

A: Adapting another answer I had previously:

This is inside id1 div

function showTarget(target, state) {
    switch (state) {
        case 1:
            state = 'block';
        break;
        default:
            state = 'none';
    }
    console.log(state);
    document.getElementById(target).style.display = state;
}

http://jsfiddle.net/gMpkX/


text:
Q: Is it possible to see razor.g file? Using Visual Studio 2019 is it possible to see myComponent.g.cs files? I notice that Visual studio code shows you those files only when there is an error in one of them. I would like to see those files just to learn how a *.razor file is compiled.

A: Yes.
First turn on "Show All Files" in the Solution Explorer window.
Then open the obj/debug/netcoreapp3.0/Razor/pages folder.


text:
Q: mysql alter table stuck in preparing state I recently tried to change a column in my database with a south migration for my django project from a CharField to a IntegerField
I did a python manage.py schemamigration appname --auto
i then applied the migration and it just hung. I stupidly ran this right on my production server before trying out locally. Once I tried locally I got this error in my traceback
  File "/Library/Python/2.7/site-packages/MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg/MySQLdb/cursors.py", line 92, in _warning_check
_mysql_exceptions.Warning: Data truncated for column 'pickup_id' at row 1

When I go into mysql workbench and just try to revert the changes back to a CharField it just hangs in the "preparing" state and eventually times out. My site just hangs wherever this table is used and I cant preform any queries on this particular table.
I'm open to any suggestion. Thank you

A: What ended up working was applying the --fake parameters to my migrate call
./manage migrate appname --fake


text:
Q: Mongoose saving with objectId I am trying to save comments for a post. When I POST a comment from client side, the comment should be saved with the ObjectId of the post, which I collect from the post page - req.body.objectId. I have tried the method below, but it only gives me VALIDATION ERROR.
MODEL
var Comment = db.model('Comment', {
    postId: {type: db.Schema.Types.ObjectId, ref: 'Post'},
    contents: {type: String, required: true}
}

POST
router.post('/api/comment', function(req, res, next){
    var ObjectId = db.Types.ObjectId;
    var comment = new Comment({
        postId: new ObjectId(req.body.objectId),
        contents: 'contents'
    }

How can I achieve this? and Is this the right way to implement such functionality? Thank you in advance.

A: That's not proper way of inserting reference typed values.
You have to do it like,
router.post('/api/comment', function(req, res, next){
    var comment = new Comment({
        postId: db.Types.ObjectId(req.body.objectId),
        contents: 'contents'
    }

It will work as you desired.

A: You need to use mongoose.Types.ObjectId() method to convert String representation of an Object ID to an actual Object ID
var mongoose = require('mongoose');

router.post('/api/comment', function(req, res, next){
    var comment = new Comment({
        postId: mongoose.Types.ObjectId(req.body.objectId),
        contents: 'contents'
    })
}


text:
Q: How can I move View from Y position to another Y I have a button and I want to make an animation of going down. I made it but the functionality is left at the previous position(like the button moves but if I click on it, it doesn't work, but if I click its previous position it will work)
Animation logbtn = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.logbtnanim);
button.startAnimation(logbtn);
And the animation code is this.
P.S. Parent is the constraint layout.
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true">
    <translate
        android:fromYDelta="0"
        android:toYDelta="100"
        android:duration="1000"/>
</set>

A: First of all you don't need the AnimatorSet Tag if you only have one animation. This is used if you want to play multiple animations together.
Second you are using TranslateAnimation which does not animate the Buttons property, it only moves the pixels on the screen, so after the animation, Android still thinks the view is at the old position, that is why it is still clickable there.
I suggest doing it in Java code using ViewPropertyAnimator something like :
button.animate().translationY(...f).duration(1000);

Or ObjectAnimator which is a little more flexible since you can also do it in xml.


text:
Q: Cannot read data "objectname" of undefined angular directive Unable to read the data from parent scope to directive. Getting error like

TypeError: Cannot read property 'rowCollection' of undefined

Can you please help me out of this.
HTML

   <ltcg-table options="one.rowCollection"></ltcg-table>

Grid HTML

        first name
        last name
        birth date
        balance
        email

        {{row.firstName}}
        {{row.lastName}}
        {{row.birthDate}}
        {{row.balance}}
        {{row.email}}

Javascript Controller
(function () {

      var myApp = angular.module('myApp', ['smart-table']);

          function one() {
                       this.song="Murali";
                      // alert("gg");
                     this.rowCollection = [
                        {firstName: 'Laurent', lastName: 'Renard', birthDate: new Date('1987-05-21'), balance: 102, email: 'whatever@gmail.com'},
                        {firstName: 'Blandine', lastName: 'Faivre', birthDate: new Date('1987-04-25'), balance: -2323.22, email: 'oufblandou@gmail.com'},
                        {firstName: 'Francoise', lastName: 'Frere', birthDate: new Date('1955-08-27'), balance: 42343, email: 'raymondef@gmail.com'}
                    ];
                      //alert($scope.gridOptions.columnDefs[1].name);
                       //alert($scope.gridOptions);
             };

        myApp.directive('ltcgTable', function() {

            return {
                restrict: 'E',
                transclude: true,
                scope: {
                    'options': '='
                },
                templateUrl: "ltcg-table.html",
                link: function(scope, element, attr) {
                        alert(scope.$parent.options.rowCollection);
                        scope.rowCollection = scope.options.rowCollection;
                }
              }
        });

      myApp.controller('ctrl1', one)

})();

A: So, you have a directive with isolated scope. In this case scope parameter in link function referes to this scope, in your case this next object
{
    'options': '='
}

So when you do in html options="one.rowCollection" value of one.rowCollection was binded to options property, so for access to it you should use scope.options in link function, on just options in view.
also $parent property set to parent scope, in your case - "ctrl1" controller scope. So you can directly go to controller and get what you want.
When use controller as syntax reference to controller saved in controller scope. So for access controller you should use it name.
Sample:

var myApp = angular.module('myApp', []);

function one() {
  this.song = "Murali";
  // alert("gg");
  this.rowCollection = [{
    firstName: 'Laurent',
    lastName: 'Renard',
    birthDate: new Date('1987-05-21'),
    balance: 102,
    email: 'whatever@gmail.com'
  }, {
    firstName: 'Blandine',
    lastName: 'Faivre',
    birthDate: new Date('1987-04-25'),
    balance: -2323.22,
    email: 'oufblandou@gmail.com'
  }, {
    firstName: 'Francoise',
    lastName: 'Frere',
    birthDate: new Date('1955-08-27'),
    balance: 42343,
    email: 'raymondef@gmail.com'
  }];
  //alert($scope.gridOptions.columnDefs[1].name);
  //alert($scope.gridOptions);
};

myApp.directive('ltcgTable', function() {

  return {
    restrict: 'E',
    transclude: true,
    scope: {
      'options': '='
    },
    templateUrl: "ltcg-table.html",
    link: function(scope, element, attr) {
      //go to controller directly
      scope.rowCollection = scope.$parent.one.rowCollection
    }
  }
});

myApp.controller('ctrl1', one)

    <ltcg-table options="one.rowCollection"></ltcg-table>

A: You added options to your directive scope, so you can directly access it throughscope.options. By the way, directives scopes are isolated (with the scope: {} notation), so you can't just go up and try to read parent scopes.


text:
Q: StructureMap pass arguments in constructor I have a constructor with some artuments
public class AppEngine:IAppEngine
{
    private IGreeter _greeter;
    private string _str;
    public AppEngine(IGreeter greeter,string str)
    {
        _greeter = greeter;
        _str = str;
    }
    public string Run()
    {
        return _greeter.Greeting()+":"+_str;
    }
}

Here from the factory i want to get instance
 var obj = ObjectFactory.GetInstance<IAppEngine>();

Here I want to pass Arguments that the constructor is accepting.
how could i do this.
Regards

A: If you want to specify the argument when you call ObjectFactory you can do it like this:
ObjectFactory.With("str").EqualTo(someValue).GetInstance<IAppEngine>();

If you need to do multiple arguments you can just chain these together. Note that you can also define a constructor value for all instances when inializing like this:
ForRequestedType<IAppEngine>().Use<AppEngine>().WithCtorArg("str").EqualTo(someValue);

A: //Arguments Constructor
Example(int id,String Name){    //Define    }//main method
//Object Creation
//Object  Creation for Default Constructor
Example e1=new Example();
//Object Creation for Arguments Constructor
Example e2=new Example(101,"kathik");}


text:
Q: What's the difference between caller- and callee-saved registers? In particular, how can you know the number of save/restore operations executed for variables in a piece of code in a caller-saved register vs callee-saved register?

A: Caller-saved registers, also known as volatile registers, are any CPU core registers that a calling function must save (generally to the runtime stack) if the calling function needs the value in the register; i.e. if the value is "live".  Callee-saved registers, also known as nonvolatile registers, are any CPU core registers that contain values that a function must promise to not destroy.  If the callee (called function) needs to use those registers, it must first save the values in those registers (generally on the runtime stack), and then restore them before returning back to the caller.
As Carl Norum mentions, which CPU core regs are caller-save & which are callee-save are defined by a calling convention (historically poorly documented, and historically compiler-specific), or defined by a ABI (Application Binary Interface).
Although its information is decidedly x86-specific, the following document by Agner Fog does a really good job of describing calling conventions & caller-save/callee-save registers:
http://www.agner.org/optimize/calling_conventions.pdf
The following describes the PowerPC EABI, including its calling convention.  But in this document, search for "volatile" and "nonvolatile" (caller-save and callee-save, respectively):
http://www.freescale.com/files/32bit/doc/app_note/PPCEABI.pdf

A: Physically, there is no difference between a caller-saved and a callee-saved register.  The distinction is made only by a procedure call standard (calling convention) or ABI.  If you need to analyze a piece of code, you can compile it (but not assemble) or disassemble a binary and go through it function by function and instruction by instruction, using an ABI or calling convention manual as a reference.


text:
Q: Website broken with message "Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?" Working on WordPress with Jupiter Theme. I cannot determine when this error occurred but here's what it is:
Go to website www.coloradopcbassembly.com. Two things are different than when I left it 2 weeks ago:

*

*The spacing and formatting is different - there are huge page breaks

*I cannot click on menu items

*There are huge errors on the top of the page, as follows:

Warning: "continue" targeting switch is equivalent to "break". Did you
  mean to use "continue 2"? in
  /home3/colorcl3/public_html/wp-content/plugins/revslider/includes/operations.class.php
  on line 2854
Warning: "continue" targeting switch is equivalent to "break". Did you
  mean to use "continue 2"? in
  /home3/colorcl3/public_html/wp-content/plugins/revslider/includes/operations.class.php
  on line 2858
Warning: "continue" targeting switch is equivalent to "break". Did you
  mean to use "continue 2"? in
  /home3/colorcl3/public_html/wp-content/plugins/revslider/includes/output.class.php
  on line 3708
Warning: "continue" targeting switch is equivalent to "break". Did you
  mean to use "continue 2"? in
  /home3/colorcl3/public_html/wp-content/themes/jupiter/framework/includes/minify/src/Minifier.php
  on line 227

I am not a developer. I am a business owner, learning WordPress as I go. As of 2 weeks ago, the site was fine, however, here are the changes:
10/30/19 - I added a few pages and buttons, really nothing major (that I can think of)
10/30/19 - I installed a plugin called Duplicate Post by By Enrico Battocchi (I have deactivated that to see if it fixes the issue; it does not)
11/12/19 - WordPress updated to version 5.3
Here's the problem: I don't know if this break in the website occurred yesterday when WordPress updated to 5.3 or if this happened 2 weeks ago on 10/30/19 when I made updates. I don't know where to go from here, but this is the train I'm on:

*

*Roll back WordPress to whatever it was before (I don't know how to do this)

*Disable Revolution Slider (the revslider error on 3 of the 4 messages)

*Roll back changes somehow? Just somehow make the page what it was 2 weeks ago?

Last note: Of the 3 ideas above, I have disabled Slider Revolution, and it does remove 3 of the 4 errors. It does not fix the formatting or the 4th error, though. I re-enabled Slider Revolution solely for the purpose of this post, so you guys could see the error in all its glory - and so anyone kind enough to help me wouldn't think this error is just with the Jupiter directory.
2 updates: in my research, I'm finding many people with this error associating it with PHP7.3.
Also, I went to my theme homepage to submit a ticket and they show this error: "Please do not upgrade your WordPress to 5.3 Until Jupiter X 1.13 is out
There is a compatibility issue with Jupiter X, Raven and WP 5.3 which is currently fixed and is waiting to be released. It is highly recommended to not to update WordPress to 5.3 until Jupiter X 1.13 is out. "
Well of course it updated last night automatically - but I think this must be it, right?
Next update: I downgraded from Wordpress 5.3 back to version 5.2.4 (confirmed no bug). It did not work.
SOLVED!!!!! Here is the answer for anyone who comes across this thread in the future. I have copied and pasted the recommendation from Artbees support (theme dev):
Usually, the warning "Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?" appears when PHP version 7.3 is used. Downgrading to PHP 7.1 or 7.2 will fix it.
Otherwise, add this code in the wp-config.php file before the line "/* That's all, stop editing! Happy publishing. */":
ini_set('display_errors','Off');
define('WP_DEBUG', false);
define('WP_DEBUG_DISPLAY', false);

A: HOW I SOLVED !!!
For me downgrading php version wasn't possible.
Didn't work disabling php errors and warnings
ini_set('display_errors','Off'); define('WP_DEBUG', false); define('WP_DEBUG_DISPLAY', false);

So what I did is
1.  /home3/colorcl3/public_html/wp-content/plugins/revslider/includes/operations.class.php 2253
       commented continue; and ended if with ;
    if(!isset($layer['video_data']->id) || empty($layer['video_data']->id));// continue;

 2. /home3/colorcl3/public_html/wp-content/plugins/revslider/includes/operations.class.php 2257
       commented continue; and ended if with ;
    if(!isset($layer['video_data']->id) || empty($layer['video_data']->id));// continue;

 3. /home3/colorcl3/public_html/wp-content/plugins/revslider/includes/output.class.php on line 3163
   commented continue;
    case 'none':
        //continue;
    break;

*I got an array issue in base-admin.class.php file

    change private static $arrMetaBoxes = '';  to private static $arrMetaBoxes = array();

I know this is not the proper solution but didnt get any other solution.


text:
Q: CheckStyle doesnt work for me I am trying to run CheckStyle 5.6 with Eclipse 4.2.1. but unable to do so.
Then i Saved the Sun Checks (Eclipse) with myConfig

Then I modified the properties as below , making empty block and need braces at error level in new config
Now in Code i have code like
if(true){}

When i save java file i was expecting it to show as error in "checkstyle violations" view
Check Styles is Enabled it for my project
but didnt get ... what am i doing wrong ??

A: Maybe "build automatically" is not activated in your Eclipse (in the menus under "Project").
Checkstyle only runs as part of the Build (triggered by the Checkstyle Builder).