text:
Q: VB.net While Loop Never Ends I have a meeting registration database. When people register, tblAttendance.RegistrationType gets "W" for Wait List or "F" for Full Registration.
I'm working on a page to move folks from the waiting list to Fill registration.
Here is my chicken scratch for how this should work

*

*Get meeting details

*Create email to be sent

*lookup event registration to see if there is more capacity than attendees.

*Lookup folks on the wait list.

*do while (capacity > attendance) & (there are Folks on waiting list)
6. move the top person on the waiting list to full registration.
7. Send them email with connection info for the zoom meeting.

*lookup event registration to see if there is more capacity than attendees.

*Lookup folks on the wait list.

*loop
The Code:
 Page Language="vb" AutoEventWireup="false" CodeBehind="offWaitlist.aspx.vb" Inherits="Parish_Faith_Formation.offWaitlist" %>

<%@ Import Namespace="System.Net.Mail" %>

<%@ Import Namespace="System.Data" %>

<%@ Import Namespace="System.Data.SqlClient" %>

<!DOCTYPE html>

    <title></title>

    <%
        Response.Write("Meeting: " & Request.QueryString("meeting") & "

")

        Dim connetionString As String
        connetionString = ConfigurationManager.ConnectionStrings("SQLServer").ConnectionString
        Dim connection As SqlConnection
        Dim command As SqlCommand
        Dim sql As String
        Dim adapter As New SqlDataAdapter(command)
        Dim dsOpenings As New DataSet
        Dim dsWaitingList As New DataSet
        Dim dsMeetings As New DataSet
        connection = New SqlConnection(connetionString)
        connection.Open()
        command = New SqlCommand()

        ' 1. get meeting details.
        sql = "SELECT tblmeeting.* FROM tblmeeting WHERE (((tblmeeting.ID)=" & Request.QueryString("meeting") & "));"
        command.CommandText = sql
        command.Connection = connection

        adapter.SelectCommand = command
        adapter.Fill(dsMeetings)

        '2. create email body.
        Session("body") = ""
        Session("body") = Session("body") & " <!DOCTYPE HTML >"
        Session("body") = Session("body") & " "

        Session("body") = Session("body") & " <meta charset=""utf-8"">"
        Session("body") = Session("body") & " <meta http-equiv=""X-UA-Compatible"" content=""IE=edge"" />"

        Session("body") = Session("body") & " <title>RCDA.org Custom Applications</title>"
        Session("body") = Session("body") & " <meta name=""viewport"" content=""width=device-width, initial-scale=1.0"">"
        Session("body") = Session("body") & ""

        Session("body") = Session("body") & ""

        Session("body") = Session("body") & ""

        Session("body") = Session("body") & ""

        Session("body") = Session("body") & ""
        Session("body") = Session("body") & "
 "
        Session("body") = Session("body") & "

"

        Session("body") = Session("body") & "
"
        Session("body") = Session("body") & "

 "

        Session("body") = Session("body") & "Thank you for registering for: " & dsMeetings.Tables(0).Rows(0).Item("meetingName") & "
on " & dsMeetings.Tables(0).Rows(0).Item("Occurrence") & "
"
        Session("body") = Session("body") & "
"

        Session("body") = Session("body") & "Join Zoom Meeting: " & dsMeetings.Tables(0).Rows(0).Item("URL") & "
"

        Session("body") = Session("body") & "Password: " & dsMeetings.Tables(0).Rows(0).Item("password") & "
"

        Session("body") = Session("body") & "
One tap mobile
"
        Session("body") = Session("body") & "+16465588656,,687241195# US (New York)
"
        Session("body") = Session("body") & "+13126266799,,687241195# US (Chicago)
"

        Session("body") = Session("body") & "
"

        Session("body") = Session("body") & "Dial by your location
"
        Session("body") = Session("body") & "+1 646 558 8656 US (New York)
"
        Session("body") = Session("body") & "+1 312 626 6799 US (Chicago)
"
        Session("body") = Session("body") & "+1 301 715 8592 US
"
        Session("body") = Session("body") & "+1 346 248 7799 US (Houston)
"
        Session("body") = Session("body") & "+1 669 900 9128 US (San Jose)
"
        Session("body") = Session("body") & "+1 253 215 8782 US
"
        Session("body") = Session("body") & "Meeting ID: " & dsMeetings.Tables(0).Rows(0).Item("meetingID") & "
"
        Session("body") = Session("body") & "
"
        Session("body") = Session("body") & "Find your local number: https://zoom.us/u/arsh7lTr5"

        Session("body") = Session("body") & "
"

        Session("body") = Session("body") & "

 "

        If Session("payment") = "check" Then
            Session("body") = Session("body") & "
You indicated that you intend to pay by check.
 Please mail your check for $" & dsMeetings.Tables(0).Rows(0).Item("cost") & " to:

Office of Lay Ministry and Parish Faith Formation
40 N. Main Ave
Albany, NY 12203
"
        End If

        If Session("payment") = "paypal" Then
            Session("body") = Session("body") & "
Your transaction has been completed, and a receipt for your purchase has been emailed to you. You may log into your account at www.paypal.com to view details of this transaction confirming your purchase.
"
        End If

        If Session("payment") = "College Students Free" Then
            Session("body") = Session("body") & "
As a college student, you have been invited to attend this meeting for free. Enjoy!

"
        End If

        Session("body") = Session("body") & "
"

        Session("body") = Session("body") & ""
        Session("body") = Session("body") & "   "

        '3. lookup to see if there are any openings.
        sql = "SELECT tblmeeting.ID, tblmeeting.Capacity, Count(tblAttendance.Registrant_ID) AS Attendance FROM tblmeeting INNER JOIN tblAttendance ON tblmeeting.ID = tblAttendance.Meeting_ID GROUP BY tblmeeting.ID, tblmeeting.Capacity HAVING (((tblmeeting.ID)=" & Request.QueryString("meeting") & "));"
        command.CommandText = sql
        command.Connection = connection

        adapter.SelectCommand = command
        adapter.Fill(dsOpenings)

        Response.Write("Capacity: " & dsOpenings.Tables(0).Rows(0).Item("capacity") & "
")
        Response.Write("Attendance: " & dsOpenings.Tables(0).Rows(0).Item("attendance") & "
")

        If (dsOpenings.Tables(0).Rows(0).Item("capacity") > dsOpenings.Tables(0).Rows(0).Item("attendance")) = True Then
            Response.Write("there are openings!
")
        Else
            Response.Write("there are NO openings!
")
        End If

        '-----------------------------------------------------------
        '4. lookup to see if there are people on the waiting list.
        sql = "SELECT tblAttendance.ID, tblAttendance.Meeting_ID, tblAttendance.Registrant_ID AS Attendance, tblAttendance.RegistrationType, tblAttendance.RegistrationDate, tblRegistrants.Fname, tblRegistrants.Lname, tblRegistrants.Email FROM tblRegistrants INNER JOIN tblAttendance ON tblRegistrants.ID = tblAttendance.Registrant_ID WHERE (((tblAttendance.Meeting_ID)=" & Request.QueryString("meeting") & ") AND ((tblAttendance.RegistrationType)='W')) ORDER BY tblAttendance.RegistrationDate;"
        command.CommandText = sql
        command.Connection = connection
        adapter.SelectCommand = command
        adapter.Fill(dsWaitingList)
        If dsWaitingList.Tables(0).Rows.Count > 0 Then
            Session("email") = dsWaitingList
        End If
        If dsWaitingList.Tables(0).Rows.Count > 0 Then
            Response.Write("There are people on the waiting list!

")
        Else
            Response.Write("There are NO people on the waiting list!

")
        End If

        '5. Loop
        Do While ((dsOpenings.Tables(0).Rows(0).Item("capacity") > dsOpenings.Tables(0).Rows(0).Item("attendance")) And dsWaitingList.Tables(0).Rows.Count > 0)
            Response.Write("Processing the next person (" & dsWaitingList.Tables(0).Rows(0).Item("lname") & ", " & dsWaitingList.Tables(0).Rows(0).Item("fname") & ") off the waiting list.

")

            '6. move the person into full registration
            sql = "UPDATE tblAttendance SET tblAttendance.RegistrationType = 'F', tblAttendance.RegistrationDate = getdate() WHERE (((tblAttendance.ID)=" & dsWaitingList.Tables(0).Rows(0).Item("id") & "));"
            Response.Write("

" & sql & "

")
            command.CommandText = sql
            command.Connection = connection
            command.ExecuteNonQuery()
            Session("sendEmail") = 0

            '7.send email

            Dim mail As New System.Net.Mail.MailMessage()
            mail.IsBodyHtml = True

            mail.To.Add(dsWaitingList.Tables(0).Rows(0).Item("email"))

            mail.Subject = dsMeetings.Tables(0).Rows(0).Item("MeetingName")

            mail.Body = Session("body")

            Dim dsMailServer As New DataSet
            sql = "SELECT tblSMTPServer.* FROM MailServer.dbo.tblSMTPServer WHERE (((tblSMTPServer.ID)=1));"
            command = New SqlCommand(sql, connection)
            adapter.SelectCommand = command
            adapter.Fill(dsMailServer)

            Session("smtpClient") = dsMailServer.Tables(0).Rows(0).Item("SMTPClient")
            Session("port") = dsMailServer.Tables(0).Rows(0).Item("port")
            Session("UserName") = "username@company.org"
            Session("Password") = "password"
            Session("Domain") = dsMailServer.Tables(0).Rows(0).Item("domain")
            Session("ssl") = dsMailServer.Tables(0).Rows(0).Item("SSL")

            Dim smtp As New SmtpClient(Session("SMTPClient"))
            smtp.Port = 587

            mail.From = New MailAddress(Session("username"))

            mail.To.Add("registrant@email.org")
            mail.ReplyTo = New MailAddress("username@company.org")
            smtp.UseDefaultCredentials = False
            smtp.Credentials = New System.Net.NetworkCredential(Session("username"), Session("password"), Session("domain"))
            If Session("SSL") = -1 Then
                smtp.EnableSsl() = True
            Else
                smtp.EnableSsl() = False
            End If
            If Session("sendEmail") = 0 Then
                smtp.Send(mail)
                Session("sendEmail") = 1
            End If

            '8. lookup to see if there are any openings.
            sql = "SELECT tblmeeting.ID, tblmeeting.Capacity, Count(tblAttendance.Registrant_ID) AS Attendance FROM tblmeeting INNER JOIN tblAttendance ON tblmeeting.ID = tblAttendance.Meeting_ID GROUP BY tblmeeting.ID, tblmeeting.Capacity HAVING (((tblmeeting.ID)=" & Request.QueryString("meeting") & "));"
            command.CommandText = sql
            command.Connection = connection

            adapter.SelectCommand = command
            adapter.Fill(dsOpenings)

            Response.Write("Capacity: " & dsOpenings.Tables(0).Rows(0).Item("capacity") & "
")
            Response.Write("Attendance: " & dsOpenings.Tables(0).Rows(0).Item("attendance") & "
")

            If (dsOpenings.Tables(0).Rows(0).Item("capacity") > dsOpenings.Tables(0).Rows(0).Item("attendance")) = True Then
                Response.Write("there are openings!
")
            Else
                Response.Write("there are NO openings!
")
            End If

            '9. lookup to see if there are people on the waiting list.
            sql = "SELECT tblAttendance.ID, tblAttendance.Meeting_ID, tblAttendance.Registrant_ID AS Attendance, tblAttendance.RegistrationType, tblAttendance.RegistrationDate, tblRegistrants.Fname, tblRegistrants.Lname FROM tblRegistrants INNER JOIN tblAttendance ON tblRegistrants.ID = tblAttendance.Registrant_ID WHERE (((tblAttendance.Meeting_ID)=" & Request.QueryString("meeting") & ") AND ((tblAttendance.RegistrationType)='W')) ORDER BY tblAttendance.RegistrationDate;"
            command.CommandText = sql
            command.Connection = connection
            adapter.SelectCommand = command
            adapter.Fill(dsWaitingList)

            If dsWaitingList.Tables(0).Rows.Count > 0 Then
                Response.Write("There are people on the waiting list!
")
            Else
                Response.Write("There are NO people on the waiting list!
")
            End If

        '10. loop
        Loop

        connection.Close()

            %>

To try and get this to work, I swapped out the do while loop for an if statement and it ran perfectly fine for one person. I know it ran fine because I put a ton of screen writes in & verified the data in the table afterwards.
With the loop, the browser spins and never finishes. I get no screen output either. I did try commenting out the email send command so I could rule out the sending as causing the delay.

A: The answer is this:

*

*In the loop, #8, I forgot to look at attendance as people with tblAttendance.RegisrtationType="F". I was grabbing all registered people since I left out part of the where clause. Thus the attendance number never changed. This would cause the loop to never execute since under normal circumstances the query would never see max capacity greater than attendance.

*After fixing my queries in the loop, I learned that I needed to close the connection to the SQL server and reopen it in order for the DataSets to update properly #8 & #9.
After these 2 changes, the loop executed as expected.


text:
Q: drop-down values referenced from another drop-down value I am making a bookings page for a movie theater. I would like the user to be able to choose days in which movies are showing and then based off the day, the sessions that are available.
For example, the first drop-down menu displays movies currently showing. if someone wants to see Pixels, then the second drop down menu displays the days Pixels is showing. Once the user selects a day, then the third drop down menu will provide the times that Pixels is showing on that particular day.
    <label>Movie Name:
                                <select id="movie" name="movie">
                                    <option selected="selected" value="">Please select a movie</option>
                                    <option value="Pixels">Pixels</option>
                                    <option value="Straight_Outta_Compton">Straight Outta Compton</option>
                                    <option value="Last_Cab_To_Darwin">Last Cab To Darwin</option>
                                    <option value="Nicki_and_The_Flash">Nicki and The Flash</option>
                                    </option>
                                </select>
                            </label>

                            </br>

                            <label>Session Day:
                                <select id="day" name="day">
                                        <option selected="selected" value="">Please select...</option>
                                        <option value="Monday">Monday</option>
                                        <option value="Tuesday">Tuesday</option>
                                        <option value="Wednesday">Wednesday</option>
                                        <option value="Thursday">Thursday</option>
                                        <option value="Friday">Friday</option>
                                        <option value="Saturday">Saturday</option>
                                        <option value="Sunday">Sunday</option>
                                </select>
                            </label>

                            </br>

                            <label>Session Time:
                                <select id="time" name="time">
                                        <option selected="selected" value="">Please select...</option>
                                        <option value="1200">12:00</option>
                                        <option value="1300">13:00</option>
                                        <option value="1500">15:00</option>
                                        <option value="1800">18:00</option>
                                        <option value="2100">21:00</option>
                                </select>
                            </label>

Lets say Pixels shows on Mondays and Tuesdays and the only times it shows is at 13:00 and 18:00. How would i write the jQuery to provide this sort of functionality?

A: A quick exemple on how you can handle this :

JS
$("#movie").on("change", function(){
    $("#day option, #time option").hide();
    var days = $("option:selected", this).attr("data-days").split(",");
    var times = $("option:selected", this).attr("data-times").split(",");
    for(i=0; i<days.length; i++){
        $("#day option[value="+days[i]+"]").show();
    }
    for(i=0; i<times.length; i++){
        $("#time option[value="+times[i]+"]").show();
    }
});

CSS
#day option, #time option{
    display:none;
}

You have to store all informations about each movie in data-days and data-times attribute.
This way, once selected, you can retrieve all this informations, split them, and display corresponding <option>

Be carreful, you have a useless </option> tag at the end of your "#movie" <select></select>
Live Demo

Edit 1:
From your comment, the solution I can provide could look like this exemple
First, store all info in a data- attribute, like day1[time1,time2];day2[time1,time2] and so one.
After some split() & substring() on #movie .change() event, you can dynamically add specific options for the #day select tag (which will now look like <option value="Monday" data-times="13:00,18:00">Monday</option>).
Same as before, just make a function that will handle the data-times on #day .change() event to dynamically create the desired #time options

redpajama_set_name: RedPajamaStackExchange


text:
Q: How do I get current route in onMounted on page refresh? When reloading page, I want to get current route. Sadly route.name is undefined, router.currentRoute is RefImpl object, which has correct route with '/team' inside. router.currentRoute.value is just root '/', not '/team', as expected. Is it possible to get correct value from RefImpl?
import { useRouter, useRoute } from 'vue-router'

export default {
  name: 'Canvas',
  components: { Ring2, Map },
  setup() {
    const router = useRouter()
    const route = useRoute()

    onMounted(() => {

      console.log(route.name) //undefined
      console.log(router.currentRoute) //RefImpl with correct value ('/team')
      console.log(router.currentRoute.value) // route is '/'
      const rawObject = {...router.currentRoute}
      console.log(rawObject) // value is '/'
      ...

Router is set up like this:
import { createRouter, createWebHistory } from 'vue-router'
import Home from '../views/Home.vue'

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/team',
    name: 'Team',
    component: () => import('../views/Team.vue')
  },
   ...
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router

A: This happens because the router hasn't yet completely resolved the initial navigation when you refresh the page, so route refers to the default (/) initially in onMounted.
Vue Router's isReady() returns a Promise that resolves when the router has completed the initial navigation, so your onMounted hook can await that Promise before trying to read route.path:
import { useRoute, useRouter } from 'vue-router'
import { onMounted } from 'vue'

export default {
  setup() {
    const route = useRoute()
    const router = useRouter()

    onMounted(async () => {
      await router.isReady()
      console.log('route.path', route.path)
    })
  },
}

demo

A: Try using the composable function useRoute :
import {
   useRoute
} from 'vue-router'
import {
   computed
} from 'vue'

setup() {
   const route = useRoute();

   const path = computed(() => route.path)
}


text:
Q: Balanced - Set card as default funding source I have a buyer account with several, valid cards associated with it. According to Balanced's documentation the most recently added card is the default funding source. How do I set another, existing card as the default funding source without asking the user to resubmit their card details to create a new card?

A: You cannot currently set an alternate funding source, the most recently added card is always the default. To debit or credit a specific funding instrument such as a card or bank account you must pass through the URI of the object as the parameter funding_source or funding_destination respectively:
buyer = balanced.Account.find(uri_of_account)
card = buyer.cards[x]
debit = buyer.debit(amount_in_cents, source_uri=card.uri)

merchant = balanced.Account.find(uri_of_account)
bank_account = merchant.bank_accounts[0]
credit = merchant.credit(amount_in_cents, destination_uri=bank_account.uri)


text:
Q: create Hyperlink to network drive folder dynamically I try to use in MS Excel 2013 the Hyperlink function to create a link to a folder on my network drive (for example \192.168.2.254).
I would that the name of the path use the content cell in the final part
For example =HYPERLINK("\192.168.2.254\myfolder", "text") where "myfolder" is the content of the B25 cell.
Anybody can help me, or know another way to solve my problem.
Thank you

A: try this:
=HYPERLINK( "\192.168.2.254\" & B25 , "text")


text:
Q: Perl Tk update(redraw) widgets in sub(in thread) I have some widgets, checkboxes actually. And I have variables that contains their value. I have shared this variables and called a sub with creating new thread.
Variables change into this sub but look of widgets stays unchanged. So that is the question: how colud I redraw widgets or update their look somehow... or how could I rebuild my programm so they will update automatically or something.
Thank you!

A: Using threads and Tk is not easy. See Perl Tk and Threads on PerlMonks for tips and tricks.
Do you really need threads? Using Tk::after or $widget->update you can usually update widgets to changing values.


text:
Q: Paypal API integration for debit and Credit card with Node JS I am tiring to add credit debit card integration that are already saved in our database and I don't want user to fill those information to the paypal debit/credit card payment form.
I want to know

*

*Is there a way to auto populate information from my database to paypal from?

*Or how can I use orders API to directly pass the information to the paypal using API integration.

The Paypal really is a mess. Can anyone please help me in the integration.
NOTE  : I am using React JS as front-end and nestjs as back-end.

A: You can't populate a form, and storing credit card information in your database is a potentially problematic practice you should review (better to tokenize/vault it) and requires a full PCI self-assessment review.
But as for how to send credit cards to PayPal via an API, if anaccount is enabled for Advanced Credit and Debit Card processing, the below might allow you to use the v2/checkout/orders API with card details in the payment_source object
(Edit: apparently more permissions are needed from PayPal for this)
{
    "intent": "CAPTURE",
    "payer": {
        "name":{
            "given_name": "John",
            "surname": "Doe"
        },
        "email_address":"johndoe@buyersemail.com"
    },
    "purchase_units": [
        {
            "reference_id": "0000",
            "description": "Transaction description",
            "custom_id": "Optional arbitrary private transaction-related ID/data, 127 chars",
            "soft_descriptor": "Shows On CC statement",
            "amount": {
                "currency_code": "USD",
                "value": "100",
                "breakdown": {
                    "item_total": {
                        "currency_code": "USD",
                        "value": "100"
                    },
                    "shipping": {
                        "currency_code": "USD",
                        "value": "0"
                    }
                }
            },
            "shipping":{
                    "name":{
                        "full_name":"John Doe"
                    },
                    "address": {
                        "address_line_1": "123 nowhere lane ",
                        "address_line_2": "Unit 123",
                        "admin_area_2": "San Jose",
                        "admin_area_1": "CA",
                        "postal_code": "95131",
                        "country_code": "US"
                    }
            }
        }
    ],
   "payment_source": {
                "card": {
                    "number": "4032038000494967",
                    "expiry": "2023-04",
                    "security_code":"123",
                    "name": "John Doe",
                }
            }
        }


text:
Q: How to create a Target shortcut to link the application with the correct program- Inno Setup? I need to add idl virtual machine to my Target location for my IDL .sav file
I am using Inno Setup,
And the following code lines
[Icons]
Name: "{group}\clas";  Filename:  "{code:GetIDLPath}"; Parameters: """{app}\bin\BATCH_CLAS_MAIN.sav"""; IconFilename: "{app}\clas_icon.ico"

[Code]
function GetIDLPath(dummy: string): string;
begin
  RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\idlrt.exe', '', Result);
  if Result = '' then
    Result := 'idlrt.exe';
end;

But the Target location end up being:
C:\clas\bin\BATCH_CLAS_MAIN.sav

It should be:
"C:\Program Files\Exelis\IDL82\bin\bin.x86\idlrt.exe" -vm C:/clas/bin/BATCH_CLAS_MAIN.sav

I checked the idlrt.exe location in registry and I am providing the correct path,
Does anyone know what's wrong?

A: At least I can see something wrong with the Parameters parameter value. You can't get the expected result with -vm option followed by the {app}/bin/BATCH_CLAS_MAIN.sav path with forward slashes if you pass an expandable "{app}\bin\BATCH_CLAS_MAIN.sav" constant. This might be better a  bit:
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName=My Program

[Icons]
; because of use of the "useapppaths" flag, there's no need to have the
; GetIDLPath function anymore; that flag do its work for you
Name: "{group}\clas"; Filename: "idlrt.exe"; Parameters: "{code:GetIDLParams}"; IconFilename: "{app}\clas_icon.ico"; Flags: useapppaths

[Code]
function GetIDLParams(Value: string): string;
begin
  // prepare the -vm option followed by a quoted application path to a file
  Result := '-vm ' + AddQuotes(ExpandConstant('{app}\bin\BATCH_CLAS_MAIN.sav'));
  // and replace backslashes to forward slashes
  StringChangeEx(Result, '\', '/', False);
end;


text:
Q: Get list of classes in namespace in C# I need to programmatically get a List of all the classes in a given namespace. How can I achieve this (reflection?) in C#?

A: Without LINQ:
Try:
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
List<Type> myTypes = new List<Type>();
foreach (Type t in types)
{
  if (t.Namespace=="My.Fancy.Namespace")
    myTypes.Add(t);
}

A: var theList = Assembly.GetExecutingAssembly().GetTypes()
                      .Where(t => t.Namespace == "your.name.space")
                      .ToList();

A: Take a look at this How to get all classes within namespace? the answer provided returns an array of Type[] you can modify this easily to return List

A: I can only think of looping through types in an assebly to find ones iin the correct namespace
public List<Type> GetList()
        {
            List<Type> types = new List<Type>();
            var assembly = Assembly.GetExecutingAssembly();
            foreach (var type in assembly .GetTypes())
            {
                if (type.Namespace == "Namespace")
                {
                    types.Add(type);
                }
            }
            return types;
        }


text:
Q: SolrCloud: Is it possible to get the shard id of a document in the search results When debugging Solr schema and indexing in a SolrCloud, it is important to easily know into which shard a document was indexed. Is it possible to define a schema field for the shard id such that the automatically assigned shard id is then available in search results?

A: You dont need to store shard id in your schema explicitly to get it in results. if in fl parameter you add [shard] with other required fields, it will return you the shard id of that document:
/solr/collection_name/select?q=*:*&fl=[shard],*&wt=json&indent=true


text:
Q: How do I print my output table with 5 parallel arrays from my main class to a .txt file? I am trying to employ a class to print (append) to a .txt file. I have been unsuccessful so far. I am using a simple logger class to output simple Strings, but how can a output to console and also a .txt file?
Current console output:
11/18/20 14:09:24
Current status of all items being tracked:
Item|             Supply on hand| Last 24 Hr Usage|    Days on hand|          Status|
-------------------------------------------------------------------------------------

1                               1                1                1         Critical

Process finished with exit code 0

Main class code in question:
        //Display all data, collected and calculated
        System.out.println("Current status of all items being tracked:");
        System.out.printf("%-16s %16s %16s %16s %16s", "Item|", "Supply on hand|", "Last 24 Hr Usage|", "Days on hand|", "Status|");
        System.out.println();
        System.out.println("-------------------------------------------------------------------------------------");
        System.out.println();

        for (int index = 0; index < items.length; index++)
            System.out.printf("%-16s %16d %16d %16d %16s \n", items[index], supplyOnHand[index], last24HourUsage[index], daysOnHand[index], status[index]);

Logger.log("How do I get my table to print here?");

Logger code:
    public class Logger {
        public static void log(String message) throws IOException {
            try (PrintWriter out = new PrintWriter(new FileWriter("output.txt", true), true)) {
                out.write(message);
                out.close();

Current file output:
How do I get my table to print here?

A: Ok so I found a work around. It is not pretty but will suffice for now.
I am using:
 PrintStream o = new PrintStream(new FileOutputStream("DashboardLog.txt", true));

And then
System.setOut(o);
System.setOut(console);

To separate between console output and file output.

A:   try (PrintWriter out = new PrintWriter(new FileWriter("output.txt", true), true)) {
            out.write(message);
            out.close();}
catch(Exception e){
}
finally(){
            System.out.println(message);
}

?


text:
Q: "Microsoft Excel has stopped Working" when running a macro after having added more data in a table I've been looking for an answer before, many topics similar  but not the same are existing, and I couldn't find an answer to my issues.
I have a macro allowing me to change the filter of a PVT automatically, and refreshing the PVT. The filter is changed accordingly to the value of a cell (copy / paste of the value of the cell in the PVT filter)
Lately, every since I add some more data into the table related to the Pivot Table, I cannot run the macro anymore otherwise

"Microsoft Excel has stopped working".

The VBA code is still the same, nothing elsa hsa changed so I don't really understand.
Please find after the code:
Sub update_Filter()

    Application.ScreenUpdating = False

    ActiveSheet.Calculate

    'Set the Variables to be used

    Dim pt As PivotTable
    Dim Field As PivotField
    Dim NewFilter As String

    'Here you amend to suit your data

    Set pt = Worksheets("PVT Competition Data").PivotTables("PivotTable3")
    Set Field = pt.PivotFields("PN ******")
    NewFilter = Worksheets("PVT Competition Data").Range("B4").Value

    On Error Resume Next

    'This updates and refreshes the PIVOT table

    With pt
        Field.ClearAllFilters
        Field.CurrentPage = NewFilter
        pt.RefreshTable

        Range("E12:I12").Select
        Range(Selection, Selection.End(xlDown)).Select
        Selection.Borders(xlDiagonalDown).LineStyle = xlNone
        Selection.Borders(xlDiagonalUp).LineStyle = xlNone
        Selection.Borders(xlEdgeLeft).LineStyle = xlNone
        Selection.Borders(xlEdgeTop).LineStyle = xlNone
        Selection.Borders(xlEdgeBottom).LineStyle = xlNone
        Selection.Borders(xlEdgeRight).LineStyle = xlNone
        Selection.Borders(xlInsideVertical).LineStyle = xlNone
        Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
        Range("E12").Select
    End With

End Sub

If you find something wrong to this or if you have any explanations, you will save my day (and for sure the followings...).
Also please ask if you need more details.
Thanks in advance!


text:
Q: JButton and jgraphx wont show up at the same time I have tried several ways, but still havent found the solution. I have a jgraph in a frame and I want to add a Jbutton in that frame also in a specific location. However I only get one of them when i run the program, because they expand to the whole window. Any ideas how to fix this?
Thanks in advance.
public class GUIquery extends JFrame {

    JFrame frame;
    static JGraph jgraph;
    final mxGraph graph = new mxGraph();
    final mxGraphComponent graphComponent = new mxGraphComponent(graph);

    public GUIquery() {
        super("Test");
        GraphD();
        imgbtn();
    }

    public void GraphD() {
        Object parent = graph.getDefaultParent();
        graph.getModel().beginUpdate();
        try {
          ........
        }catch  {
          ........
        } finally  {
           graph.getModel().endUpdate();
        }
        getContentPane().add(graphComponent);
    }

    public void imgbtn() {
        JPanel jpanel = new JPanel();
        jpanel.setSize(100, 100);
        jpanel.setLocation(1200, 60);
        JButton imgbtn = new JButton("Export as Image");
        imgbtn.setSize(100, 100);
        imgbtn.setLocation(1200, 60);
        jpanel.add(imgbtn);
        add(jpanel);
    }

    public static void main(String[] args) {
        GUIquery frame = new GUIquery();
        frame.setLayout(null);
        frame.pack();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(400, 320);
        frame.setVisible(true);
    }
}

A: Don't use null layouts. They inevitably result in trouble.
From your code snippet it is impossible to tell where you want them to be relative to each other, the following puts the button below the graph.
The content pane uses BorderLayout by default. For BorderLayout, you need to use place components at different positions:
// the default position, but it does not hurt to be explicit
add(graph, BorderLayout.CENTER);

...

// and the panel
add(jpanel, BorderLayout.SOUTH);

If the positioning is not what you want, take a look at the visual guide to layout managers to pick the layout manager that suits your needs best.
In the button panel the setLocation() and setSize() calls are useless. The layout manager of the panel is responsible for setting the button's bounds. If the default FlowLayout is not what you want for it, use the guide to pick another for the panel too.


text:
Q: Firefox x64 for Windows: why does its installer choose the x86 folder I have Windows 7 64-bit.  When I downloaded the 64-bit version of FF, it wanted to install in the (x86) directory.  What's going on? This description from the FF website isn't exactly clear:

Although Linux, Mac OS X and Windows are released for x86-64 OS
  platform, officially build by mozilla.org / mozilla.com is still for
  x86 only. This is native 64 bit coded mozilla (Firefox).

A: This translation into English might help you:Although there are x86-64 versions of the Linux, Mac OS X, and Windows NT operating systems, the official build of Mozilla/Firefox by the Mozilla Foundation is still only 32-bit.  The project discussed on this WWW site is an unofficial 64-bit build of Mozilla/Firefox by Makoto Kato.
Further reading

*

*Sebastian Anthony(2011-07-20). Firefox 8 for Windows x64: Has 64-bit browsing finally come of age?. ExtremeTech.

*Bug 471090 — Windows x64 build tracking bug. Bugzilla.

*Where are the Firefox 8 beta 64-bit builds?. Firefox Help.


text:
Q: vee-validate regex does not work as expected I am working with VUE and VEE-VALIDATE and want to check if an input is an valid decimal with comma as seperator.
My input with regex look like this:
<input type="text" v-model="myDecimal" v-validate:myDecimal="{ regex: /^(\d+|\d+,\d+)$/ }" :class="{'error': errors.has('mydecimal') }" ref="mydecimal" name="mydecimal" />
NOT CORRECT DECIMAL!

This works quite good for "1", "1,2", "0,4", "12,28761". Perfect!
Errors are displayed correctly for ",0", "foo", "1e". Perfect!
But if I type in the following I get NO error, but I would expect one: "1,1,1" or "1,1foo".
Any ideas what i am doing wrong?? Thanks!

A: Before (not working example):
<input v-model="myDecimal" v-validate:myDecimal="{ regex:/^([0-9]+|[0-9]+,[0-9]{0,2}?)$/ }" />

After (working example):
<input v-model="myDecimal" v-validate="{ regex:/^([0-9]+|[0-9]+,[0-9]{0,2}?)$/ }" />


text:
Q: Validate Manually Created Typescript Definition Files Background
I have created a component library using react (plain js).  I am in the process of creating Typescript definitions for the components so that consumers of the component library can use the components in a type-safe manner in their Typescript applications.
Question
What is the recommended way, if there is one, to check that the definitions manually created are correct?  I am trying to catch issues before consumers have to highlighting any problems.
Investigation so far...
I have looked at https://github.com/asgerf/tscheck but it doesn't always work.
I also looked at DefinitelyTyped contribution guide:  https://github.com/DefinitelyTyped/DefinitelyTyped#create-a-new-package.  This says to create a typescript file with sample code for type-checking only...is this just a matter of compiling the *.test.ts file with the typescript compiler?


text:
Q: Could not return from if statement using Javascript/Jquery I am facing one issue. The return statement is not working as expected using Javascript/Jquery. I am explaining my code below.
$.each(resultArr,function(i,data){
            console.log('dt',data);
            var rule = $("#sub"+i).val();
            if (rule == '') {
                var subject=data.sub_name;
                toastr.error('Attendance for '+ subject +' can not be blank');
                return false;
            }else if (parseInt(rule) > 100) {
                var subject=data.sub_name;
                toastr.error('Attendance for '+ subject +' can not be more than 100');
                return false;
            }else{
                data.attendance=rule;
                if (data.id == '') {
                    flag=0;
                }else{
                    flag=1;
                }
            }
        })

Here I need if else if is true it should return after displaying the error message. but in my case its showing the error message and also the else part is executing and value is assigning to flag variable. Here I need once error message will display it should return from there.

A: It seems to work: note how the line console.log('The input is fine') runs only once.
The only thing I wasn't able to reconstruct was toastr.error, so I guess the problem lies somewhere there.

let resultArr = [{
  sub_name: 1
}, {
  sub_name: 2
}];

let ans = null;

$.each(resultArr, function(i, data) {
  console.log('dt', data);
  var rule = $("#sub" + i).val();
  if (rule == '') {
    var subject = data.sub_name;
    ans = ('Attendance for ' + subject + ' can not be blank');
    return false;
  } else if (parseInt(rule) > 100) {
    var subject = data.sub_name;
    ans = ('Attendance for ' + subject + ' can not be more than 100');
    return false;
  } else {
    console.log('The input is fine');
    data.attendance = rule;
    if (data.id == '') {
      flag = 0;
    } else {
      flag = 1;
    }
  }
});

console.log(ans);

<input id="sub0" value="1">
 - This element's value is valid

<input id="sub1" value="101">
 - This element's value is invalid

A: Your code is working very much fine. Adding this as an answer so that you can see answer using Run Code Snippet.

var resultArr = [{
    'sub_name': 'a',
    'id': 1,
    'attendance': ''
  },
  {
    'sub_name': 'b',
    'id': 2,
    'attendance': ''
  },
  {
    'sub_name': 'c',
    'id': 3,
    'attendance': ''
  }
];

function test() {
  $.each(resultArr, function(i, data) {
    console.log('dt', data);
    var rule = $("#sub" + i).val();
    if (rule == '') {
      var subject = data.sub_name;
      //toastr.error('Attendance for ' + subject + ' can not be blank');
      return false;
    } else if (parseInt(rule) > 100) {
      var subject = data.sub_name;
      //toastr.error('Attendance for ' + subject + ' can not be more than 100');
      return false;
    } else {
      data.attendance = rule;
      if (data.id == '') {
        flag = 0;
      } else {
        flag = 1;
      }
    }
  });
}

 Call me
<input id="sub0" name="sub0" value="" />
<input id="sub1" name="sub1" value="100" />
<input id="sub2" name="sub2" value="2" />
<input id="sub3" name="sub3" value="4" />


text:
Q: How to display review stars above a custom field? Woocommerce I am having trouble to display the star ratings (or more specifically 0 star ratings) below the product title, but above the taste notes description (which is a custom field). If you view the image below, you can see the stars are being displayed below the taste notes.

How can I move the star ratings to be below the product title? At the moment Woocommerce only displays star ratings if there is a rating so I had to write some code to display the stars if there is 0 ratings but in doing this, it moved these 0 star ratings to below the tastenotes and not underneath the product title.
Here is the code in my functions.php
add_action('woocommerce_after_shop_loop_item_title', 'get_star_rating' );
function get_star_rating()
{
    global $woocommerce, $product;
    $rating_count = $product->get_rating_count();

    if ($rating_count == 0){
   $rating_html  = '

(0)';
    echo $rating_html;
    }
}

Here is the code in archive-product.php where you can see the product-title heading and below that is the taste notes. I am assuming I need to somehow add my code or call on the code above between the product title and taste notes fields.
do_action( 'woocommerce_before_main_content' );

?>

    <?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?>

<?php // woocommerce_page_title(); ?>

<?php the_field('taste_notes'); ?>
    <?php endif; ?>

A: The possible solution is by overriding WooCommerce template from your theme
Create new woocommerce directory inside your theme directory (if not exists), for WooCommerce compatible theme it should already available.
Create new single-product directory inside your-theme/woocommerce (if not exists)
Create new file rating.php inside single-product directory, and place this code
<?php
if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly.
}

global $product;

if ( ! wc_review_ratings_enabled() ) {
    return;
}

$rating_count = $product->get_rating_count();
$review_count = $product->get_review_count();
$average      = $product->get_average_rating();

function custom_wc_get_rating_html( $rating, $count = 0 ) {
    $html = '';

    //if ( 0 < $rating ) {
        /* translators: %s: rating */
        $label = sprintf( __( 'Rated %s out of 5', 'woocommerce' ), $rating );
        $html  = '
' . wc_get_star_rating_html( $rating, $count ) . '
';
    //}

    return apply_filters( 'woocommerce_product_get_rating_html', $html, $rating, $count );
}
?>

        <?php echo custom_wc_get_rating_html( $average, $rating_count ); // WPCS: XSS ok. ?>
        <?php if ( comments_open() ) : ?>
            <?php //phpcs:disable ?>
            (<?php printf( _n( '%s customer review', '%s customer reviews', $review_count, 'woocommerce' ), '' . esc_html( $review_count ) . '' ); ?>)
            <?php // phpcs:enable ?>
        <?php endif ?>

The code above I copied from WooCommerce and modify to show zero star rating. I have tested it on WooCommerce's Storefront theme, and it works!
Show start rating 0


text:
Q: .Net Core - How to creating multiple instances of a class with dependency injection I have a specific scenario where I need to create multiple instances of a class that has dependency injection.
foreach (var setting in settings)
        {
            var client = new ServiceClient();
            dict.Add(somekey, client);
        }

ServiceClient class constructor has implemented DI for other dependent classes. How do I instantiate ServiceClient class?

A: You could inject a IServiceProvider to get a service with the GetService method "via code".
The service to inject should be transient to get a new Instance each time you request a service from the service provider. If the service to be injected has a scoped lifetime you have to create a new scope around the code to get a new service.
var service = serviceProvider.GetService<IService>();

Consider using a factory method depending on your use case.


text:
Q: Is an alamofire request to a HTTPS domain any different from that to HTTP? I just added SSL to my backend framework (Django REST API) and I want my iOS application to talk to it. Do I have to do anything differently on the iOS side of my project? How do I tell Alamofire to encrypt the data its sending? Or Does it happen automatically?

A: The only difference is using https instead of http. I have the same setup at work, and originally thought I was going to have to delve into certificates. I started heading in that direction and then realized all my requests worked as soon as I stuck the "s" on the end.
I will say, while using NSStream, you do have to setup the stream to handle the certificate. I am doing this in another application, but that is below the URLRequest class. I am unsure of how low level Alomofire actually delves, but it will definitely handle everything you desire without doing anything differently.

A: Just update URLs inside your app to use "https" and you are done.


text:
Q: Image loading in multithreading manner When I'm trying to load image's source in standalone thread that leads to memory leak (tons of HWNd pointers) (ImgSource1 is bindable property at VM)
Thread task = new Thread(() =>
        {
            try
            {
                ImageSource newSource = CreateImageSource(imageList[CurrentSourceIndex], true);
                Application.Current.Dispatcher.Invoke(() =>
                {
                    ImgSource1 = newSource; // <==  Memory leak is here
                });

                GC.WaitForPendingFinalizers();
                GC.Collect();
                GC.WaitForPendingFinalizers();
            }
            catch(Exception ex)
            {
                LogService.WriteLog(ex);
            }
            IsImageChangeAccessible = true;

        });
        task.IsBackground = true;
        task.Start();

If I'm using this code that lead to memory leak and wpf stop to draw images after ~20-30k loaded images. Memory leak based on Window pointer stored by Dispatcher. Here some images from memory profiler:
Call tree:

And memory diagram, leaked object at last spot of biggest objects diagram (HwndSubclass):

But when i'm using same code without Thread all work fine.... (didn't test thought in a long run test yet).
So how to load imagesource from file at multithreading maner without such memory leaks?
Image loading code:
var src = new BitmapImage();
                src.BeginInit();
                src.UriSource = new Uri(file, UriKind.Absolute);
                src.CacheOption = BitmapCacheOption.OnLoad;
                src.EndInit();
                src.Freeze();
                return src;

A: If you have the possiblity to binding the Source property of  the Image control, and setting IsAsync=True, wpf will care about getting the image in a background thread by itself.
Generally speaking, wpf will keep controls in memory if they have a Name defined (or x:Name), so you should look out for that.


text:
Q: Error in executing JEST Unit Test cases in react-native project with Salesforce Mobile SDK created by forcereact We are creating React-Native mobile App Using Salesforce Mobile SDK.
In this project we setup JEST for unit test cases writing. But whenever it goes into Salesforce Mobile SDK API it failed and sends timeout error. So due to this we are not able to get response and unit test cases are not working.
It would be great if anyone suggest something for how to write unit test cases for a component/react-native project that uses Salesforce mobilesdk.

A: Unit tests should not depend on external api calls, instead they should be mocked to provide a success and error response.
to mock or spy on a function please find documentation from jest

*

*https://jestjs.io/docs/mock-functions

*https://jestjs.io/docs/jest-object#jestspyonobject-methodname
I would prefer to use spy with a mockResolvedValue and mockRejectedValue but you can decide on basis of your usecase.


text:
Q: tableview doesn't see the title for header in section method I was trying to create a custom viewForHeaderInSection for my tableview.Tableview itself
    works fine, but for some reason, compiler skips,
-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{}

Delegate method, and I tried what is written on the reference , and this .But for some reason it just doesn't read these methods. Obviously, I am doing something wrong. If someone can point my mistake out, I would appreciate. Thank you in advance.
#import "TableViewController.h"

@interface TableViewController ()

@end

@implementation TableViewController
@synthesize settingTableView,audioPlayer,labelSwitch,descriptiveSwitch,autoPlaySwitch;;

- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.settingTableView.tableFooterView = [[UIView alloc]init];
    self.settingTableView.scrollEnabled = NO;

    settings = @{@"Animation Sets" : @[@"Set1",@"Set2",@"Set3"],@"Settings" : @[@"Label",@"Sound",@"Autoplay"]};
    values = [[settings allKeys]sortedArrayUsingSelector:@selector(localizedStandardCompare:)];

    [settingTableView setRowHeight:44];
    [settingTableView reloadData];

}

-(void)close:(id)sender
{
    [self dismissViewControllerAnimated:YES completion:nil];
    [self.delegate closeView];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // Return the number of sections.
    return [values count];
}
-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {

    return [values objectAtIndex:section];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of rows in the section.
    NSString *sectionTitle = [values objectAtIndex:section];
    NSArray *sectionValue = [settings objectForKey:sectionTitle];
    return [sectionValue count];
}

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    CGRect frame = tableView.frame;
    NSString *value = [values objectAtIndex:section];

    UILabel *title = [[UILabel alloc]init];
    UIView *headerView = [[UIView alloc]init];

    //if (section == 0 && section == 1) {

    if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) {
        title.frame = CGRectMake(10,10,150,30);
    }
    else
    {
        title.frame = CGRectMake(10,5,100,30);
    }

    title.backgroundColor = [UIColor clearColor];
    title.text = value;

    headerView.frame = CGRectMake(0,0,frame.size.width,frame.size.height);
    headerView.backgroundColor = [UIColor clearColor];
    [headerView addSubview:title];
        [headerView setBackgroundColor:[UIColor blueColor]];
    //}
    return headerView;
    [settingTableView reloadData];
    }

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell* cell = nil;

    static NSString *MyCellIdentifier = @"Cell";

    cell = [tableView dequeueReusableCellWithIdentifier:nil];

    if (cell == nil)
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
                                      reuseIdentifier:MyCellIdentifier];

        cell.textLabel.numberOfLines = 2;
        cell.textLabel.font = [UIFont fontWithName:@"Helvetica" size:17.0];

        NSString *sectionTitle = [values objectAtIndex:indexPath.section];
        NSArray *sectionValue= [settings objectForKey:sectionTitle];
        NSString *settingValues = [sectionValue objectAtIndex:indexPath.row];

        cell.textLabel.text = settingValues;
        return cell;
    }
}

A: You need to make sure that the class that implements that delegate method is the delegate and dataSource of your table view.


text:
Q: Reading content of an array in a list I am making a windows form application that would receive routing information from Google Maps API. In order to save the request links with the related information (Route ID, origin coordinates, destination coordinates, link to request route from Google Maps) I am using two dimensional array. However, I don't know how many routes will be search at a given time (might be 2 or 10 or 100), so I cannot set an array with a fixed size. I tried using Link and it works, the data is saved, but I don't know how to read the contents of the array from the list. My code is the following:
string gMapLink [4];
List <Array> arlist = new List<Array>();
arlist.Add(gMapLink);

Data is retrieved from the database to gMapLink array and then the array is stored in arlist. What I need to do is read the content of a specific array in the list of arrays. Something like arlist [3].gMapLink[3];
Also, is using an array good enough or should I create a class or a struct for the gMapLink and then make a list of that class?
Thanks in advance.

A: You're last assumption is the bet way to do it: Create a class for the gMapLink and then make a list of that class. This way you get strongly typed property for your gMapLink object.
public class MapLink {
    public int RouteId { get; set; }
    public string OriginCoordinates { get; set; }
    public string DestinationCoordinates { get; set; }
    public string Link { get; set; }
}

And now you can do something like this:
MapLink gMapLink; //Get the object from db
List <MapLink> list = new List<MapLink>();
list.Add(gMapLink);


text:
Q: Working with objects from Global Environment in loops (R) I am trying to fill an existing sheets in object wb (Formal class workbook XLConnect) with data frames from my Global Environment
I have a list of names of my data frames - dataframe_list, and a list of sheet names - sheetsname, both are character vectors
I have created a loop to fill corresponding sheets in wb if the name from my dataframe_list and the name of sheet sheetsname in wb are equal
My problem is, when I am running a loop, in particular data=dataframe_list[k], loop uses a name but not the data frame with corresponding name.
Hope for you help
for(k in 1:length(dataframe_list)) {
for(i in 1:length(sheetsname)) {

if (dataframe_list[k]==sheetsname[i]) {
        writeWorksheet(wb,data=dataframe_list[k],sheet=as.character(dataframe_list[k]),startRow = 49,
                       startCol = 3, header = FALSE)

}}
}

A: To return the actual data frame from its name, rather than just the name itself, use get.  As in
    writeWorksheet(wb, data = get(dataframe_list[k]),
       sheet=as.character(dataframe_list[k]), startRow = 49,
       startCol = 3, header = FALSE)

Note, not tested, as this was not a complete reproducible example provided

A: XLConnect's writeWorksheet is vectorized, so you can provide a list of data.frames and a vector of sheet names like so:
# Collect data.frames in a list
dfs <- lapply(dataframe_list, get)

writeWorksheet(wb, data = dfs, sheet = sheetnames, ...)

No need for a for loop here.


text:
Q: How do I calculate the impulse applied to an object?
A 100g toy car moving at 3m/s hits a wall at right angles and rebounds at 2.8m/s. The collision with the wall takes 0.25s.
a) Calculate the impulse applied to the wall by the car
b) Calculate the impulse applied to the car by the wall.

The answers for these 2 questions say that the impulse would be 0.58Ns away from the wall and 0.58Ns onto the wall, respectively. However, I am still confused at the notion of "applied impulse". For question a), I interpret it as how the car changes the walls momentum, which, since the wall doesn't have momentum to begin with, shouldn't the correct answer be 0Ns?

A: Two bodies that collide exchange momentum. If not fully, then partially. Some amount of momentum is transferred from one body to the other. This is why total momentum is conserved. The amount exchanges is called the impulse, and due to Newton's 3rd law it is applied in equal and opposite measure to the two colliding bodies. In fact is applied through the same point, and the two impulse vectors lie on the same infinite line.
The reason this might be confusing when a ball hits a wall is that after the impact the wall still has zero momentum. Or so it seems. Since the wall is attached to the earth, when a ball impacts a wall, the impulse-momentum does get transferred to the earth but because the mass of the earth is 26 orders of magnitude greater than the ball, it is not noticed.
But go to space and throw a heavy ball against a spaceship and you will see the exchange in momentum where the lighter faster ball will transfer some of its momentum and the heaver spacecraft is going to slowly start moving.
If you do become an astronaut one day and are stationed in space, I do recommend doing this experiment.

A:
I interpret it as how the car changes the walls momentum, which, since the wall doesn't have momentum to begin with, shouldn't the correct answer be 0Ns?

No. It is true that net change of momentum of the wall is 0 but the impulse by the car is non zero. There are other external forces on the wall by ground such as friction  and other constraint forces due to which the total net impulse of the wall is 0.


text:
Q: How to add a result column into my table? I am doing data cleaning practice in SSMS. I made a mock postcode table which needs to be cleaned:

Then I used SUBSTRING to grab the first half and second half:
SELECT SUBSTRING(post_code,1,3)
FROM PostCode;

SELECT SUBSTRING(post_code, LEN(post_code)-2,LEN(post_code))
FROM PostCode

For the next step, I am trying to add the 2 columns into my table then I can combine them together.  How should I do that?
Thank you very much for and help!

A: Is this what you want?
SELECT
    SUBSTRING(post_code,1,3) AS first,
    SUBSTRING(post_code, LEN(post_code)-2,LEN(post_code)) AS second
FROM PostCode;

I see that your postal code may or may not have extra stray characters such as space or comma.  You may try removing them before you apply string operations:
WITH cte AS (
    SELECT REPLACE(REPLACE(post_code, ' ', ''), ',', '') AS post_code
    FROM PostCode
)

SELECT
    SUBSTRING(post_code,1,3) AS first,
    SUBSTRING(post_code, LEN(post_code)-2,LEN(post_code)) AS second
FROM cte;

A: I would suggest LEFT() and RIGHT() to extract the components:
SELECT LEFT(post_code, 3) as firsthalf,
       RIGHT(post_code, 3) as secondhalf
FROM PostCode;

This will not work if post_code is stored as a char(7) rather than a varchar(<something>).  In that case, use:
SELECT LEFT(post_code, 3) as firsthalf,
       SUBSTR(post_code, LEN(post_code) - 2, 3) as secondhalf
FROM PostCode;

For the rest of this answer, you can replace RIGHT(post_code, 3) with the above expression, if you need that.
Using LEN(post_code) for the length argument for secondhalf is allowed, but misleading, because you know it is 3 characters.
I'm not sure what you mean by:

I am trying to add the 2 columns into my table then I can combine them together

But SQL Server supports computed columns:
alter table PostCode add firsthalf as (LEFT(post_code, 3));
alter table PostCode add secondhalf as (RIGHT(post_code, 3));

firsthalf and secondhalf will then appear as columns in the table, just like any other columns (except you cannot explicit alter or set their values because they are computed from post_code).
You can create a "clean Postal code" with similar logic:
alter table PostCode add cleanedPostCode as (LEFT(post_code, 3) + ' ' + RIGHT(post_code, 3));

A: You need to concatenate:
SELECT SUBSTRING(post_code,1,3) + SUBSTRING(post_code, LEN(post_code)-2,LEN(post_code))
FROM PostCode;

if this gives you the right results then update:
update PostCode
set post_code = SUBSTRING(post_code,1,3) + SUBSTRING(post_code, LEN(post_code)-2,LEN(post_code))

A: From your comment

I am trying to combine them together into a column, then add it to my table replace the original post_code column.

Simply, you can do as
UPDATE PostCode
SET Post_Code = LEFT(Post_Code, 3) + RIGHT(Post_Code, 3);

Or if you have whitespaces in the begening/end of the string
UPDATE PostCode
SET Post_Code = LEFT(TRIM(Post_Code), 3) + RIGHT(TRIM(Post_Code), 3);

Note that TRIM() is only available on 2017 version, if you don't have it, you can use LTRIM() and RTRIM() functions as
UPDATE PostCode
SET Post_Code = LEFT(LTRIM(RTRIM(Post_Code)), 3) + RIGHT(LTRIM(RTRIM(Post_Code)), 3);

A: Since your messing with dirty data, if you have a lot of rows you may want to follow up with some validation.
You can build a validation column, something like:
case when
    len(postcodeClean) = 6
    and isnumeric(SUBSTRING(postcodeClean, 1, 1)) = 0
    and isnumeric(SUBSTRING(postcodeClean, 2, 1)) = 1
    and isnumeric(SUBSTRING(postcodeClean, 3, 1)) = 0
    and isnumeric(SUBSTRING(postcodeClean, 4, 1)) = 1
    and isnumeric(SUBSTRING(postcodeClean, 5, 1)) = 0
    and isnumeric(SUBSTRING(postcodeClean, 6, 1)) = 1
then
    'valid'
else
    'not valid'
end [isItValid]

And/Or - depending on how dirty your data is, you may want to compare it to all valid Canada postal codes.
You can download them from
https://fusiontables.google.com/data?docid=1H_cl-oyeG4FDwqJUTeI_aGKmmkJdPDzRNccp96M#rows:id=1
Import them, and then compare your final result set to make sure they're all good.


text:
Q: Linux 3.0 TCP Stack Receive Buffer Kernel Architecture (Linux 3.0, x86_64)
If I stop calling recv(2) for a while on a connected tcp socket, and the other host keeps sending data, than presumably this data is received and buffered by the kernel, so the next time I call recv it will return quickly with all the waiting data.
My question is how big is this receive buffer, and how does it work?  Are there any relevant kernel or socket settings I can use to tune its behavior?  What does the tcp stack do when it fills up?

A: The receive buffer can be changed with setsockopt(SO_RCVBUF). The default size is controlled by the tcp_rmem sysctl. If the buffer fills up, the stack will stop extending the receive window it offers to the other side, forcing the other size to stop sending data until there's space in the buffer.


text:
Q: Angular slow ng-repeat: is there a way to refresh single items manually My ng-repeat takes 3.5 seconds to load 850 items:

            T
            W
            F
            G

I tried different improvements. I played with bindonce library until I realized it was added natively to Angular 1.3. I started using translate-once to remove watchers from translated text. Still I experience slowness when loading 850 items. Is there a way to remove most of the watchers and repaint the UI manually per ng-repeat row (when I detect a change)?

A: If there is no need to display all at once, you can load 50 by 50.

  ....

  <button class="btn-block btn btn-primary" ng-click="lmt=lmt+50">MORE.....</button>

A:
Is there a way to remove most of the watchers and repaint the UI manually per ng-repeat row (when I detect a change)?

I'll go for some shameless self-promotion here and suggest you give angular-bind-notifier a go.
To decrease the amount of watchers you would do roughly the following:

*

*Convert all your bindings to onetime bindings with the :: syntax.

*Setup a notifier to watch a single property, exposed to the view (through $scope, or this in the case of controllerAs).

*Pass in a key between the :: in your bindings, to give them semi-static/semi-dynamic binding, based on the use of $on/$broadcast.

*Either manually change said property when you want bindings to refresh, or leave it up to the outer world to manipulate the property and have the bindings refresh automatically.

It'd look something like so:
// In your controller/directive/whatever.
$scope.localisation = 'en';

// In your view

    {{:locale:boundValue}}

I will say this though; I was under the impression that the original angular-translate translate directive had a built-in way of de-registering watchers when they become 'stale', but perhaps that is not the case.

As the notifier directive is still in the early stages, your mileage may vary.


text:
Q: Is the equation true that $P(A\cap B|C) = P(A|C)P(B|C)$ while A, B are independent. Since I got into grad school to study computer sicence, I have been a T.A. and mid-term procter.
Plus, I should check students answering sheets.
To make answers, I would like to check the equation true which is
$P(A\cap B|C) = P(A|C)P(B|C)$ while A, B are independent.
I think that is true.
But I am still little bit not sure.
If that is true, could you prove why?
Thank you for helping in advance.

A: Let $A$ and $B$ be the events that two independently tossed coins come up heads. Let $C$ be the event "exactly one coin comes up heads". Then the LHS is $0$, while the RHS is $1/4$.


text:
Q: Python - how to protect attributes from being modified I know that we have the property decorator in Python so we can use it to protect attributes from being set (if we don't define the setter), but what about protecting an attribute from being modified?
Here is an example:
class TestClass:
    def __init__(self, lst):
        self._lst = lst

    @property
    def lst(self):
        return self._lst

a = TestClass([1, 2, 3])

I know that a.lst = [10, 15, 20] leads to AttributeError since I did not define a setter. But this doesn't return any error:
b = a.lst
b[0] = 10

and changes the attribute to [10, 2, 3].
Is there any way to prevent any modification for the attribute?
I know one way which is to return a deep copy of the attribute but I guess there should be better ways doing this but can't find the solution.


text:
Q: Find Duplicates in a Column with a Variable Range and Count in a Separate Column I'm trying to identify any duplicates in a column that is a variable range. I found this code:
Public Sub assignSeq()

targetRng = "A2:A14" 'Define the Range you want to assign number

For Each Rng In Range(targetRng)

Rng.Offset(0, 1).Value =

Application.WorksheetFunction.CountIf(Range(Split(targetRng, ":")(0) & ":" & Rng.Address), Rng.Value)

Next

End Sub

I tried to modify it hoping that I could use it to work for a column that will have a variable range (I will be using this code along with other code in many workbooks so I can't have it with a set range, i.e. E2:E15).
Sub assignSeq()

Dim lastRow As Long

Dim targetRng As Range

Dim rng As Range

'Column E won't be the same length every file that this macro is ran in. Column B is used to tell how long column E is.

lastRow = Cells(Rows.Count, "B").End(xlUp).Row

'Define the Range you want to assign number

Set targetRng = Range("E2:E5" & lastRow)

Set rng = Range("E2:E5" & lastRow)

 For Each rng In Range("E2:E5" & lastRow)
 rng.Offset(0, 1).Value =

Application.WorksheetFunction.CountIf(Range(Split(targetRng, ":")(0) & ":" & rng.Address), rng.Value)

 Next

End Sub

When I run the code I get Run-time error '13': Type mismatch.
Below, Column F is what I want this code to do all the way down the column no matter how long it is.
Column G is done by a separate code that I have written and works so I'm not necessarily looking for help with that but rather I was wanting to show what I'm ultimately trying to accomplish.
Column E           Column F     Column G

PermAssetNumber    Count        PermAssetNumber w/Count
B02061               1          B02061
B02061               2          B02061_2
B02079               1          B02079
B02081               1          B02081
B02081               2          B02081_2
B02063               1          B02063
B02070               1          B02070
B02062               1          B02062
B02081               3          B02081_3
B02086               1          B02086
B02087               1          B02087
B02088               1          B02088
B02089               1          B02089
B02090               1          B02090
B02091               1          B02091
B02065               1          B02065
B02082               1          B02082
B02083               1          B02083
B02048               1          B02048
B02081               4          B02081_4

A: Try this.

*

*You had some typos Range("E2:E5" & lastRow) - the 5 was an error.

*Split(targetRng, ":") is wrong because Targetrng is a range not a string so  we use its Address property which is a string.
Sub assignSeq()

Dim lastRow As Long
Dim targetRng As Range
Dim rng As Range

lastRow = Cells(Rows.Count, "B").End(xlUp).Row

Set targetRng = Range("E2:E" & lastRow)

For Each rng In targetRng
    rng.Offset(0, 1).Value = _
        Application.WorksheetFunction.CountIf(Range(Split(targetRng.Address, ":")(0) & ":" & rng.Address), rng.Value)
Next

End Sub

A: Anytime duplicate counts are involved, I use the dictionary object. The dictionary is an enhanced hashtable that allows only unique key-value pairs. Below is an example that you can modify to fit your needs.
Option Explicit

Public Sub RunningCounts(ByVal strWBName As String, ByVal strWSName As String, _
                         ByVal strTargteRngAddress As String, ByVal strColToFindLR As String)

 Dim objDict As Object
 Dim objWB As Workbook
 Dim objWS As Worksheet
 Dim rngToLookUp As Range
 Dim lngLastRow As Long, i As Long
 Dim arrySheet As Variant, arryOut() As Variant
 Dim varKey As Variant

    Set objWB = Workbooks(strWBName)
    Set objWS = objWB.Worksheets(strWSName)
    lngLastRow = objWS.Cells(objWS.Rows.Count, strColToFindLR).End(xlUp).Row
    Set rngToLookUp = objWS.Range(strTargteRngAddress & lngLastRow)

    If rngToLookUp.Columns.Count > 1 Then
        MsgBox "The input Range cannot be more than" _
        & " a single column.", vbCritical + vbOKOnly, "Error:" _
        & " Invalid Range Dimensions"
        Exit Sub
    End If

    arrySheet = rngToLookUp.Value2

        ReDim arryOut(1 To UBound(arrySheet, 1), 1 To 1)

        Set objDict = CreateObject("Scripting.Dictionary")

            For i = LBound(arrySheet, 1) To UBound(arrySheet, 1)
                'each time a key occurs, add one to the item associated with that key
               varKey = Trim(arrySheet(i, 1))
               If Not objDict.Exists(varKey) Then
                  objDict(varKey) = 1
                  arryOut(i,1) = 1
               Else
                  objDict(varKey) = objDict(varKey) + 1
                  arryOut(i,1) = objDict.Item(varKey)
               End If
               varKey = Empty
            Next i

    rngToLookUp.Offset(0, 1).Resize(UBound(arryOut, 1), _
    UBound(arryOut, 2)).Value2 = arryOut

End Sub

Public Sub ExecuteRunningCount()

 Dim strTgtWBName As String
 Dim strgtWSName As String
 Dim strTgtRangeAddress As String
 Dim strTgtColToLookInLR As String

    strTgtWBName = "SomeWBNamew.xlsm"
    strTgtWSName = "SheetName"
    strTgtRangeAddress = "A2:A"
    strTgtColToLookInLR = "A"

    Call RunningCounts(strTgtWBName, strTgtWSName, strTgtRangeAddress, strTgtColToLookInLR )

End Sub


text:
Q: Python 3.5 SMTP library I need connect my python code to my SMTP Azure server to retrieve some emails, I was checking the documentation of imaplib and I can connetc without problem to my gmail account but I can't to my azure one!
Does someone of you know how to connect to Azure with python?
Do you have an example of code to connect and retrieve all the email of today?
Thanks so so much :D


text:
Q: Import a Static HTML Vue Component inside another Vue Component Context :
I have a vue component(s) that are stored in an S3 repository in the form of static HTML (name it child). Now I want to import these vue components inside another Vue Component inside a Nuxt Project (name it parent). So it's gonna be a page where the content is dynamically rendered
Current workaround :
In the parent component, I have a snippets like this :
<div id="content-test" v-html="content"/>

Where content is a HTML string that is rendered by child component
Current issue :
The styling for the parent component is broken. Probably caused by some scripts/css that runs in the child component
Some other workaround I've done / think about :

*

*Render the child component inside iframe : Not good, because I want the content of the child to be SEO-friendly

*Export child as a npm package / repository so that it can be used in parent component dynamically : Not good, because the node_modules of the parent component might grows large if the child component is too large

Do anyone ever had this issue and how to solve this? Thanks


text:
Q: finding the syntax error in my function in bash Here is the function.
function a {
    ...
    ...
    ...
    ...
    done < "path{path_in}"

#working code above. If I put '}' here the code runs and works.
    echo
    echo "--Letter Count--"
    for letter in "${LETTERS[@]}" do
        letter_upper=`toupper $letter`
        upper_int= `atoi $letter_upper`
        lower_int= `atoi $letter`
        upper_count= ${myArray[${upper_int}]}
        lower_count= ${myArray[${lower_int}]}
        echo "$letter_upper $(($upper_count + $lower_count))"
    done

} #line 102

#error: line 102: syntax error near unexpected token `}'

This is the broken part of the function for some reason. If I put the '}' at any line after

done < "path(path_in)"

then the running the code will give me that syntax error.

A: best way to know if you have too many or too less { } is to count them and after counting you had 7 in your function a so you would receive an error for this.
I don't think you need to use { } in your function, just when you declare it, i have an article which should help you with Bash variables and command substitution at the following webpage,
http://www.compciv.org/topics/bash/variables-and-substitution/

A: There are multiple issues but the predominant one is that you put spaces after the = signs. You need to remove those spaces; e.g. upper_int=`atoi $letter_upper`  instead of upper_int= `atoi $letter_upper` .
But, perhaps more importantly, you need to run ShellCheck on your code and heeds its warnings.
Of course this doesn't explain the error you're observing. Based only on the fragment you've posted we can't help you fix that.


text:
Q: Does $A$ have infinite order in $G= \langle A,B \ |\ B A B^{-1} = A^2 \rangle $? I have a group (arising from the fundamental group of a manifold)
$$G= \langle A,B \ |\ B A B^{-1} = A^2\rangle $$
and

I would like to show that $A$ is an element of infinite order inside $G$.

Notice that in the abelianization ${\rm Ab}(G)\simeq \mathbb{Z}$, the image of $A$ is the identity.
Nevertheless, $A$ is a non-trivial element in $G$, indeed we can find a representation $G\to{\rm SL}(2;\mathbb C)$ that sends $A$ to the diagonal matrix  ${\rm diag}(e^{i2\pi/3},e^{-i 2 \pi/3})$.

A: The comments have already given two solutions; here's a third.  (It's not really new, just a disguised version of those arguments, but I like the elementary description it gives.)
Choose $n$ odd and consider the cyclic group $C_n=\langle\rho\rangle$.  The map $\phi:C_n\to C_n$; $$\phi(g)=g^2$$ generates a subgroup of $\mathrm{Aut}{(C_n)}$ that is cyclic of order $m$.  Now form a semidirect product $$C_n\rtimes C_m$$ where conjugation by the generator of $C_m$ acts as $\phi$.  Then $$\tau\rho\tau^{-1}=\phi(\rho)=\rho^2$$ and so the map $\psi:G\to C_n\rtimes C_m$; \begin{gather*}
\psi(A)=\rho \\
\psi(B)=\tau
\end{gather*} is a homomorphism.
Moreover, $\psi(A)$ has order $n$.  Varying $n$, we see that $G$ has quotients in which the image of $A$ has arbitrarily-large order.  But quotients can only decrease the order of an element, so $A$ must have infinite order to begin with.


text:
Q: gcc compile error on simple code I need help with a simple c structure and can't find it why it's not compiling using gcc (opensuse 11.4)
I have this code:
struct Image {
 int w;
 int h;
 // other code
};

in the same file I have another struct array like this:
struct ShapeImage
{
  Image image[10];
  // other code
};

when I compile I get:
syntax error before [' token`

Why I am getting this error if is specify the number 10 in the image
the image[10]; looks good to me, what is wrong?

A: It should be:
struct Image image[10] ;

Or use typedef while defining the struct:
typedef struct {
 int w;
 int h;
 // other code
} Image;

And use the code otherwise same as in your question.


text:
Q: Different Arrowheads bend differently (Tikz) I have stumbled upon some weird behaviour regarding arcs and arrowheads.
Here is a MWE:
\documentclass[tikz]{standalone}
    \usepackage{tikz}
    \usepackage{graphicx}
    \usetikzlibrary{arrows.meta}
    \def\Rad{2cm}
    \begin{document}
        \begin{tikzpicture}
                            \draw[blue, thick] (0:\Rad) arc (0:360:\Rad);
                            \draw[orange,->]  (90:\Rad)    arc (90:90-170:\Rad);
                            \draw[orange,-{Triangle[length=1mm, width=1mm]}] (90:\Rad) arc (90:90+170:\Rad);
    \end{tikzpicture}
    \end{document}

If you look closely at the outcome, one can notice that the orange arcs bend differently:

I would rather use the triangular arrowheads, but it is the one that bends differently than the actual circle, so I can not use it as it seems to be inaccurate.
I appreciate your help.

A: All you need to do is to also load bending to cure this.
\documentclass[tikz]{standalone}
\usetikzlibrary{arrows.meta,bending}
\def\Rad{2cm}
\begin{document}
\begin{tikzpicture}
 \draw[blue, thick] (0:\Rad) arc (0:360:\Rad);
 \draw[orange,->]  (90:\Rad)    arc (90:90-170:\Rad);
 \draw[orange,-{Triangle[length=1mm, width=1mm]}] (90:\Rad) arc (90:90+170:\Rad);
\end{tikzpicture}
\end{document}

Explanation: pgfmanual p. 194-195


text:
Q: How to generate a list of all dependencies for a given LaTeX document? I have a couple of relatively complicated multilingual LaTeX documents, I need to work with on several different Linux machines, and in collaboration with various people. The complexity has the side effect, that a huge number of different LaTeX (TeXLive) packages has to be installed in order to compile the respectiv document.
This leads to the problem, that whenever a new player joins the group, who has to fiddle with one of the files, I need to tell him, which dependencies the given LaTeX file has, to make him able to install the needed packages, and to compile the file respectivly.
This is relatively uncomfortable, as it is complicated for me to keep track of the dependencies and not everyone has the capacities to install a broad range of packages (without actually needing them for the given task).
This brings me to my question: Is there a way, to put out a list of needed packages in a human readable format and, ideally to translate this list programmatically in a list of distribution packages? Preferable a command line, which puts out such a list.


text:
Q: FOR loop not looping I have the below script that uses 2 for loops. for some reason they loop is not looping
#! /bin/ksh
CURR_PATH='/main/nedcor/flexcube'

cd $CURR_PATH

for DIR1 in 'WIP' 'INPUT';do

    echo $DIR1
     for DIR in $(find . -name $DIR1);do

        RESULT=`ls -A $DIR | egrep -v "BKUP|BKP"`

        echo $DIR
        echo $RESULT
        echo $RESULT1
        if [ -z "$RESULT" ] ;
        then
            echo "No Files found"
            exit 0
        else
            echo file $RESULT found
            exit 1
        fi
    done
done

A: You should not be using exit inside your for loops - this causes the script to exit, and is why you're only getting one result.  You should be using continue, which will stop the current loop from going on, but will go to the next element in the for loop.
Swap both your exit statements to continue and you should find very different behavior, more in line with what you're looking for.


text:
Q: Vue3: Warning on changing routes with transitions to route containing transitions In my App.vue I have declared
<router-view v-slot="{ Component }">
  <transition name="fade" mode="out-in">
    <component :is="Component" />
  </transition>
</router-view>

to switch between routes like $router.push({ name: 'ComponentName' }). When I switch to another route, I get the following warning:
runtime-core.esm-bundler.js?5c40:38 [Vue warn]: Vue received a Component which was made a reactive object. This can lead to unnecessary performance overhead, and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.
Component that was made reactive:  {name: "Step1_add", components: {…}, methods: {…}, data: ƒ, render: ƒ, …}components: {Multiselect: {…}}data: ƒ data()methods: {submitForm: ƒ}name: "Step1_add"render: ƒ render(_ctx, _cache, $props, $setup, $data, $options)__emits: null__file: "src/components/steps/Step1_add.vue"__hmrId: "db590442"__props: []__proto__: Object
  at <Add onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< Proxy {updateView: ƒ, …} > >
  at <BaseTransition mode="out-in" appear=false persisted=false  ... >
  at <Transition name="fade" mode="out-in" >
  at <RouterView>
  at <App>

I have noticed, this happens only with routes, where I declared another transition within the route like
<transition name="fade" mode="out-in">
  <component
    :is="view"
    @previous-page-s1="$router.replace({ name: 'Home' })"
    @next-page-s1="updateView('Step2')"
    @previous-page-s2="updateView('Step1_add')"
    @next-page-s2="updateView('Step3')"
    @previous-page-s3="updateView('Step2')"
    @next-page-s3="updateView('Step4_add')"
    @previous-page-s4="updateView('Step3')"
    @next-page-s4="$router.replace({ name: 'Home' })"
  ></component>
</transition>

What exactly is causing this warning and how can I avoid it with keeping all transitions? I'd appreciate a hint. Thanks


text:
Q: random variables and their maximum expected value I read a statement in a book and I can't realize what exactly it means, and why it is true.

a set of random variables are given. in general, the expected value of the maximum of random variables is not equal to the maximum of the expected  values of these variables.

I would like to know what exactly it means and why it is true.
thanks

A: Take two independent coins $c_1,c_2$ which have equal probability of heads or tails.
Assign a value of $1$ for a head and $0$ for a tail.
Then $E c_1 = E c_2 = {1 \over 2}$ and $\max (E c_1, E c_2) = {1 \over 2}$.
Now consider $\max(c_1,c_2)$, that is, toss both coins and take the 'best' result. Then $E [\max(c_1,c_2)] = {3 \over 4}$ (just look at all 4 possibilities).
Hence $\max (E c_1, E c_2) \neq E [\max(c_1,c_2)]$.
Addendum:
Note that in the first case, heads and tails are equally likely so
$E c_1 = {1 \over 2} 0 + {1 \over 2} 1 = {1 \over 2}$.
In the second case, each pair of possibilities is equally likely so
\begin{eqnarray}
E [\max(c_1,c_2) &=& {1 \over4} \max(0,0) + {1 \over4} \max(0,1) +{1 \over4} \max(1,0) +{1 \over4} \max(1,1)\\
&=& {1 \over4} 0 + {1 \over4} 1 +{1 \over4} 1 +{1 \over4} 1 \\
&=& {3 \over 4}
\end{eqnarray}


text:
Q: #1054 - Unknown column 'wp_usermeta.meta_key' in 'where clause' I've been breaking my head on a SQL-query that stopped working for me. I have the following query:
SELECT count(ID) AS total FROM `wp_users` WHERE ID NOT IN (SELECT user_id FROM `wp_usermeta` WHERE `meta_key` = 'wp_capabilities' AND (`meta_value` LIKE '%overleden%' || `meta_value` LIKE '%oudlid%' || `meta_value` LIKE '%adverteerder%')) AND ((wp_usermeta.meta_key = 'plaats' AND wp_usermeta.meta_value LIKE '%michiel%') OR (wp_usermeta.meta_key = 'achternaam' AND wp_usermeta.meta_value LIKE '%michiel%') OR (wp_usermeta.meta_key = 'roepnaam' AND wp_usermeta.meta_value LIKE '%michiel%'))

What am I doing wrong? The code should give me a count on users with the name "michiel".
Kind regards,
Michiel

A: Table name wp_usermeta is in WHERE subquery, and you can't use it in other conditions.


text:
Q: Open source text editor with a "save draft" feature? Our current Rails application is using jwysiwyg for our text editor but it is not very feature rich. We want:

*

*User to be able to save their work and return to it later if necessary. A "Save draft" feature similar to what Wordpress uses would be great.

*Upload images from their hardrive rather than have to copy and paste an image URL.

What options are out there that will provide us with these two features? Is it possible to expand upon the currently existing jwysiwyg? Or would we have to go with an alternative option? We are currently using wysiwyg through Javascript integration but we are open to a Rails Ruby gem alternatives as well.

A: My answer to drafts is that they are really versions... so a version control system is really what you want.
Nowadays that's usually a distributed one such as git.
I would get into the workflow of using git and have that be your process for drafts.
So use an IDE that supports DVCS, for example Eclipse can include git support.


text:
Q: form tag submission in HTML vs document.getElementById("form1").submit() in JS Hey so I am currently learning how to code in JS and I have a question;
why do I need to use document.getElementById("form1").submit() when I can just submit a form and data within it by adding a submit button in html and keeping it within a form tag? Sorry if this sounds like a completely noob question but I am trying to learn to here :)
p.s also googled this query and did my research but could not really find a definitive answer :(

A: You can only use html submit on an <input> tag which comes with default CSS stylings. If you want to do something different with your submit button, like have it be an image or a link, you can use any CSS stylings you want, and then programmatically call submit()

A: You don't NEED to, but you can use document.getElementById("form1").submit() if you want to trigger the submit event of the form (which is EXACTLY the same as clicking the HTML submit button) programmatically.
If you for example have another even, like, a custom button outside the form that you want to act as the submit button for the form, then you can use the document.getElementById("form1").submit() in order to trigger the submit of the form from a button that doesn't have to be inside the form.


text:
Q: id/class based selector v/s forms based selectors Given the following HTML:
<fieldset>
    <legend>
        <input type="checkbox" name="amazon_activated" />
    </legend>

                Amazon Data

</fieldset>

next code allows hide/show the data container table related to the checkbox:
$("input[name='amazon_activated']").click(function(){
    $(this).parent("legend").next("table").toggle( $(this).is(":checked") );
});

and next code it should init the hide/show state after page's load:
if ( ! $("input[name='amazon_activated']").is(":checked")){
    $(this).parent("legend").next("table").hide();
}

Well, it is failing.
I already know why: this refers to the page element, not the checkbox element.

So I wonder:
Is it the best policy immediately choose an id/class:
$("#id")

for the important elements in order to facilitate their control through jquery, over form-based selectors?:
$("input[name='amazon_activated']")

A: Cache the element.
var element = this;

When this is in the right context.

You usually code Javascript for a given markup, not the other way around.  ID's and classes have meaning other than being used as selectors.

A: I think you can cache your elements at the top of the outer function. It will be convenient to use them in other places. Also, caching elements will also enhance the performance.
You can do something like this:
var input = $("input[type='checkbox']"),
    table = $("fieldset table");

A: if ( ! $("input[name='amazon_activated']").is(":checked")){
    $(this).parent("legend").next("table").hide();
}

within above code this belong to page element scope, where
$("input[name='amazon_activated']").click(function(){
    $(this).parent("legend").next("table").toggle( $(this).is(":checked") );
});

in above code this belongs to input[name='amazon_activated']'s callback scope which point to input[name='amazon_activated'].
So to make active first code you should try
if ( ! $("input[name='amazon_activated']").is(":checked")){
    $("input[name='amazon_activated']").parent("legend").next("table").hide();
}

Its better to keep reference of input in a variable and use that
var checkboxElement = $("input[name='amazon_activated']"); // you can also use id

then you this like
if ( ! checkboxElement.is(":checked")){
    checkboxElement.parent("legend").next("table").hide();
}

checkboxElement.click(function(){
    $(this).parent("legend").next("table").toggle( $(this).is(":checked") );
});

A: I think the reason every answer is telling you to cache your objects is that it will be tremendously faster. To answer the specific question, disregarding the rest, i.e.:

Is it the best policy immediately choose an id/class for the important
  elements in order to facilitate their control through jquery, over
  form-based selectors?

First, I would say "attribute selectors" over "form-based selectors" as I don't believe jQuery distinguishes between, say $('input[name="amazon_activated"]') and $('a[href="#"]') as far as how it searches.
That said, the general rule of thumb is:

id selectors are faster than class selectors are faster than attribute
  selectors.

So, if all you care about is jQuery speed, that's key. However, adding ids and classes, only for the sake of targeting via jQuery could slow down your page load times more than the corresponding speed-up in selector performance.
In summary to this overly-long answer:

*

*Cache the result of a jQuery selector when possible

*Use ids and classes when possible, but

*Don't add unnecessary ids and classes unless testing proves them necessary

A: Thanks to all for your answers. All have been very helpful (I give +1 to all).
I want to add my final solutions that takes in account your tips.
Indeed there are several checkbox elements involved, so I have cached them and use an associative array to iterate over it (avoiding add more id/class).
var checkboxElements = {
    "amazon_activated" : $("input[name='amazon_activated']"),
    "clickbank_activated" : $("input[name='clickbank_activated']"),
    "ebay_activated" : $("input[name='ebay_activated']")
}

$.each(checkboxElements, function(i, el){
    $(el).parent("legend").next("table").toggle( $(el).is(":checked") );
    $(el).click(function(){
        $(el).parent("legend").next("table").toggle( $(el).is(":checked") );
    });
});


text:
Q: If the improper integral exists, must the limit exist if the function is continuous and differentiable? Let $f:\mathbb{R}\rightarrow \mathbb{R}$ be a continuous differentiable function, and suppose $\int_0^\infty f(r)dr<\infty$ and that $f(0)<\infty$. Is it true that $\lim_{r\rightarrow\infty}f(r)=0$?
My physics class seems to assume this. I see why, if the limit exists, it must be zero, but I don't see why the limit has to exist. Perhaps one line of logic would be that, since we assume the derivative exists, we can assume $\int_0^\infty f(r)\frac{df(r)}{dr}dr$ exists, and by integration by parts this is equal to $|_0^\infty f(r)^2-\int_0^\infty f(r)\frac{df(r)}{dr}dr$, so moving everything else to one side the limit is finite, and thus zero. But by using integration by parts aren't I already assuming the limit exists?
For context, this is an introductory quantum mechanics course. They state the only properties a wavefunction $\psi$ must have is that $\int_{-\infty}^\infty |\psi(x)|^2dx<\infty$ and $\psi$ is continuous and have continuous derivative. To prove the momentum operator is hermitian, we need $|_{-\infty}^\infty|\psi|^2=0$.

A: No, let consider for example
$$f(r)=\sin (r^2)$$
and refer to

*

*Trig Fresnel Integral

A: No. Consider
$$ f(x) = \sum_{n\geq 1}n\exp\left[-n^6(x-n)^2\right]. $$


text:
Q: Asymptotic Notation Comparison Is O(logn) = O(2^O(log logn))?
I tried to take the log of both sides
log logn =  log2^(log logn)
log logn = log logn log2
We can find a constant C > log2 s.t C log logn > log logn log2
So they are equal to each other. Am I right?

A: I think what you want to ask is if log n = O(2^(log log n))?
Think of O (big-O) as a <= operator, but the comparison is made asymptotically.
Now, to answer your question, we have to compare log n and 2^(log log n).
We use asymptotic notations only when we need to visualize how much an algorithm will scale as the input grows drastically.
log n is a logarithmic function.
2^(log log n) is an exponential function. (Notice that log log n is the exponent of 2)
It will always be true that a logarithmic function is asymptotically less than an exponential function. If you want to understand, try computing both the functions for very large values of n (like 10000 or 100000000).
So, it can be very easily inferred that log n = O(2^(log log n)).
NOTE: We do not compare asymptotic notations like you asked (O(logn) = O(2^O(log logn))). We compare functions (like log n) using these notations.


text:
Q: Compare state of Windows Server 2022 VSphere instances Apologies for the noob question regarding Windows and VSphere. I am looking to solve a problem in my current organization where we never seem to know the current state of our servers due to too many people being able to log in and make changes. While I want to move us to something like DSC (and ultimately will), I am just trying to see if there are tools that will tell me the current state of any of my machines so I can compare them.
Example information that I would like to see reported would be:

*

*OS Version (this one is easy but included for completeness)

*Services installed and versions

*Frameworks/SDK's installed (e.g. .net, java, and go versions)

*User folder structures (to see if the same folders exist on both servers)

*IIS state (services, routing, etc.)

I'm fairly new to this space, especially for windows servers, and would appreciate any help or direction.

A: There isn't a great single solution for this. Your instinct is correct, to get to a place of using config management to define what a new server should look like, but expecially on Windows it's really tough to get "current state" or "Drift detection".
For OS version and installed software, any off-the-shelf inventory software for Windows will be able to gather this info easily.
Your best path forward for checking on folder absence/existence would be to write some scripts to gather this info yourself and store it in a way that works for you (database, TXT files, depends on how you're going to use it)

A: Consider implementing a Change Control process at your company so that changes to systems are logged/approved ahead of time and leave a searchable historical record.
Also enable audit logging to a centralized system so that you have a way to search for who made changes to a server after the fact.
If a person is found to be making changes to a server without an approved Change Request then that's something for their manager to deal with.


text:
Q: Need to find registry entry where the Dragon Profile Path is stored Have a task to update Dragon Profile Path. Dragon v11
Kind of an overview here of the application.
http://nuance.custhelp.com/app/answers/detail/a_id/6887/kw/dragon%20profile%20path
I found the ini file that stores the dragon profile path however when i update it in the ini file, it doesn't replicate over to the application itself and still has the old path.
Was wondering if anyone has run into something similar and may have any suggestions.
btw: dragon profile path can be changed from the application but i have a task to update about 150 systems that on and don't want to go manually on each system and do it :)
Thanks in advance!

A: Dragon's support website lists the following keys in their lengthy uninstall doc:
HKCU:\Software\Dragon
HKCU:\Software\Dragon Systems
HKCU:\Software\ScanSoft\NaturallySpeaking x.x
HKLM:\Software\Dragon
HKLM:\Software\Dragon Systems
HKLM:\Software\Elan Informatique
HKLM:\Software\L&H\NaturallySpeaking
HKLM:\Software\ScanSoft\NaturallySpeaking x.x
Where "x.x" is any version number.

Be aware HKCU: is only valid for the logged-in user.
In general, I recommend using ProcessMonitor to see which file or registry key gets changed right as you make the change (if you can't find it any reasonable way.)


text:
Q: Struggling with using drop-down input menus to calculate & print results [HTML, JS, CSS]
.
I'm trying to make code for a dining calculator that takes an inputted value, inputted tip amount (from a drop-down menu), and an inputted amount of customers (also from a drop-down menu), then calculates ([startPrice * tipAmount] + [startPrice/peopleEating]) and prints the results.
The problem is that I don't know how to calculate and print results using the inputted values of those drop-down menus. Can anyone give me a simple explanation?
Thanks.

A: You simply need to use the .value of the dropdown. I have attached a runnable code snippet below:

function processForm() {
      var startPrice = document.getElementById("startPrice").value;
      var tipAmount = document.getElementById("tipAmount").value;
      var peopleEating = document.getElementById("peopleEating").value;
      console.log("Start price is " + startPrice);
      console.log("Tip Amount is " + tipAmount);
      console.log("People Eating is " + peopleEating);
      console.log((startPrice * Number(tipAmount)) + (startPrice/Number(peopleEating)) + " Is the calculated number");
    }
<!DOCTYPE html>

  Start Price
  <input type="number" name="startPrice" id="startPrice">

  Tip Amount
  <select id="tipAmount" name="tipAmount">
    <option value="10">10</option>
    <option value="20">20</option>
    <option value="30">30</option>
  </select>

  People Eating
  <select id="peopleEating" name="peopleEating">
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
  </select>
  <button onclick="processForm()">Calculate</button>

PS: I have used the Number() function in the dropdown values, because by default they are stored as strings, and converting them into numbers is important.