text:
Q: jSoup How to Whitelist tags matching certain class patterns? I am using Whitelist as follows:
           Document doc = Jsoup.parse(urls[0], 5000);
            if (doc != null){

                Whitelist wl = Whitelist.basicWithImages();
                // wl.preserveRelativeLinks(false);
                Cleaner cleaner = new Cleaner(wl);
                cleanedDoc=cleaner.clean(doc);
                if (cleanedDoc != null){
                   whiteListedHtml = cleanedDoc.html();
                }
            }
        }catch(IOException e){
           Log.d(TAG,"exception="+e.getMessage());
        }

Now this is so painfully close to what I would like to do except:
There are div tags whose class have "nav" or "ad" and are filling the page
with rubish.  I want to keep div tags for example but not if the class happens to have 'nav' or 'ad' appearing in it.
This makes me think about subclassing Whitelist ....
RTFM http://jsoup.org/apidocs/org/jsoup/safety/Whitelist.html  I see
addTag(), and removeTag() (somehow removeTag() is not available but thats another issue).  What I really want to do is remove if and only if the class of the tag contains certain values in the sting such as 'ad' or 'nav'.
The only method that looks hopeful is:
protected boolean isSafeTag(String tag)

Test if the supplied tag is allowed by this whitelist

Parameters:
    tag - test tag
Returns:
    true if allowed

So how can I pull out the class value of this string for test?  Is there anyway to do this check without subclassing whitelist?  Now I am trying this:
    protected boolean isSafeTag(String tag){
      Boolean retVal = true;
    Document doc = Jsoup.parse(tag);
    if (doc.getAllElements().size()>0){
        Element e = doc.getAllElements().get(0);
        String attribute =  e.attr("class");
          if ((attribute != null) && (attribute.contains("ad") ||   attribute.contains("nav"))){
            retVal = false;
           }
       }
       if (retVal == false)
          return false
       else
          return super.isSafeTag(tag);

A:
Is there anyway to do this check without subclassing whitelist?

One way is to remove the unwanted divs then clean the resulting document.
SAMPLE CODE
String html = "
Remove

Hello word

Don't remove
";

System.out.println("** BEFORE:\n" + html);
Document dirtyDoc = Jsoup.parse(html);
for (Element div : dirtyDoc.select("div.ad, div.nav")) {
    div.remove();
}

Whitelist whitelist = Whitelist //
        .basicWithImages() // your original choosen list
        .addTags("div"); // Without this line, any div will be removed

Cleaner cleaner = new Cleaner(whitelist);
Document cleanedDoc = cleaner.clean(dirtyDoc);

System.out.println("\n** AFTER:\n" + cleanedDoc.html());

OUTPUT
** BEFORE:

Remove

Hello word

Don't remove

** AFTER:

Hello word

   Don't remove

Jsoup 1.8.3


text:
Q: program to handle Heterogeneous Lists in Scala; I have to find out the maximum/minimum from this list:
 val data= List(List(1,2), List(3,4,91,9,10),11,211,456,345)

From some stack over flow example ,i can see below solution:
val flatdata=data.collect{case i:Int => List(i); case l @ a :: b => l}.flatten

[
But this is giving error]
Can some one please help.
want the solution using pure scala and not spark

A: Let's go through your code in more detail:
sacla> val data= List(List(1,2), List(3,4,91,9,10),11,211,456,345)
data: List[Any] = List(List(1, 2), List(3, 4, 91, 9, 10), 11, 211, 456, 345)

The type of data is a List[Any] because the list is not one specific type. The compiler tries to infer the type, but since Int and List[Int] aren't compatible, it resolves to Any.
scala> data.collect{case i:Int => List(i); case l @ a :: b => l}
res0 List[List[Any]] = List(List(1, 2), List(3, 4, 91, 9, 10), List(11), List(211), List(456), List(345))

This second part, tries to consolidate the entries to be a List of Lists. It matches an Int and wraps it in a List.
However, you see the type here is still List[List[Any]].
Now the last part, the .flatten
scala> res0.flatten
res1: List[Any] = List(1, 2, 3, 4, 91, 9, 10, 11, 211, 456, 345)

This takes you from a List[List[Any] to List[Any].
Now the key part here is that if you try to call .max or .min on this list, it won't work. Since there is no such Ordering for Any.
<console>:13: error: No implicit Ordering defined for Any.

The fix will be to force the this type in the original collect call.
scala> data.collect{case i:Int => List(i); case l : List[Int] => l}
res6: List[List[Int]] = List(List(1, 2), List(3, 4, 91, 9, 10), List(11), List(211), List(456), List(345))

scala> .flatten
res7: List[Int] = List(1, 2, 3, 4, 91, 9, 10, 11, 211, 456, 345)

scala> .max
res8: Int = 456

scala> res7.min
res9: Int = 1

A: One thing wrong with your code is that the result is List[Any], which isn't going to be terribly useful.
This gives a compiler warning but produces a List[Int] result.
data.flatMap{case li:List[Int] => li; case i:Int => List(i)}

A: There's nothing wrong with your code, it evaluates fine. Not sure what error you're getting.
scala>  val data= List(List(1,2), List(3,4,91,9,10),11,211,456,345)
data: List[Any] = List(List(1, 2), List(3, 4, 91, 9, 10), 11, 211, 456, 345)

scala> data.collect{case i:Int => List(i); case l @ a :: b => l}
res0: List[List[Any]] = List(List(1, 2), List(3, 4, 91, 9, 10), List(11), List(211), List(456), List(345))

scala> data.collect{case i:Int => List(i); case l @ a :: b => l}.flatten
res1: List[Any] = List(1, 2, 3, 4, 91, 9, 10, 11, 211, 456, 345)

redpajama_set_name: RedPajamaStackExchange


text:
Q: Uniqueness of the Laplace Transformation Today; when I was doing some Inverse Laplace transformation in the class, I encountered the following problem cited in Zill's book:

The inverse Laplace transformation may be not unique. In Problems 29 and 30 evaluate $\mathscr{L}\{f(t)\}$.
29. $f(t) = \left\{
        \begin{array}{ll}
            1, & \quad t\ge0,~ t\ne1, t\ne2 \\
            3, & \quad t=1 \\
            4, & \quad t=2 \\
        \end{array}
    \right.$
30. $f(t) = \left\{
        \begin{array}{ll}
            \text{e}^{3t}, & \quad t\ge0,~ t\ne 5, \\
            1, & \quad t=5
        \end{array}
    \right.$

I did them, but I was wondered how to explain the students if they ask me about the criteria for the uniqueness. I think it is rooted in the functional analysis, however, I am weak in this area. Is there any easier way to explain the uniqueness for second year graduate students? Thanks for your time.

A: The issue here is continuity, since you typically cannot hope to recover the behavior of a function at a point which is not a point of continuity from an integral transform.  If you consider continuous functions which decay fast enough (for example, subexponentially decaying functions) then you can prove uniqueness fairly easily by a standard calculation.  For example, see here.


text:
Q: Received status code 502 from server: Bad Gateway with exo player I am getting this error
> Could not GET 'https://google.bintray.com/exoplayer/io/flutter/x86_debug/1.0.0-890a5fca2e34db413be624fc83aeea8e61d42ce6/x86_debug-1.0.0-890a5fca2e34db413be624fc83aeea8e61d42ce6.pom'. Received status code 502 from server: Bad Gateway"

my current settings
distributionUrl = https://services.gradle.org/distributions/gradle-6.7.1-all.zip
classpath 'com.android.tools.build:gradle:4.1.0'
compileSdkVersion 30
targetSdkVersion 30

A: As bintray.com is out of service, most dependencies have moved to mavenCentral. So what worked for me was to add mavenCentral() where you have defined google() in your android/build.gradle.
buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        google()
        mavenCentral() <-- Added
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.32"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral() <-- Added
    }
}


text:
Q: Does a WCF application using IIS require any additional installation for the customer? Going to work on a WCF application that will communicate with an apache server (that we host), as well as sharepoint (customer hosted). The WCF application will also be deployed on the customers side.
My question is if this will require the customer to install something (IIS?) before it will work for them? Of course we would prefer that they wouldn't have to.

A: IIS is not the only way to host a WCF service - you can also self-host it in another .NET app or via a Windows service.
If you use, for example, a console app to host your service, the only thing required on the customer's box is the appropriate .NET runtime (the same one that the WCF service is built in).
Take a look at Hosting Services for more information.


text:
Q: Remove Category from a Sum I have a dataset with Company Values and a Rate.
What I would like to do is Sum the Rate by company. However, for Company A, I only want to sum the Rates for Companies B, C, D (in other words, all companies except A). Similarly, for Company B, I want the sum for Companies A, C, and D (all companies but B).
I've tried a couple different ways:
VAR SelectComp = SELECTEDVALUE(dataset[Company]) RETURN' 'CALCULATE(SUM(dataset[Rate]), dataset[Company] <> SelectComp)
I've also tried:
NewTable = SUMMARIZE(dataset, dataset[Company], "SUM", CALCULATE(SUM(dataset[Rate]),REMOVEFILTERS(dataset[Company])))
The results I'm looking for with the sample data below would equate to:
Company  GroupedSum
A        68
B        72
C        65
D        56

Company
Rate

A
4

A
4

A
4

A
3

A
3

A
1

B
2

B
2

B
3

B
2

B
1

B
5

C
1

C
5

C
2

C
4

C
5

C
5

D
5

D
5

D
2

D
5

D
4

D
5

D
5

A: Try this
Measure =
VAR _visibleCompany =
    MAX ( 'Table 1'[Company] )
VAR _sum =
    CALCULATE (
        SUM ( 'Table 1'[Rate] ),
        FILTER ( ALL ( 'Table 1' ), NOT 'Table 1'[Company] IN { _visibleCompany } )
    )
RETURN
    _sum

A: Try this and let know if I missed anything.
Sum of Rate = CALCULATE(SUM('Table'[Rate]),ALL('Table'[Company]))-CALCULATE(SUM('Table'[Rate]))

A: SUM everything and then subtract the sum of each individual company using ALLEXCEPT
SUM(Table[Rate]) - CALCULATE(SUM(Table[Rate]),ALLEXCEPT(Table, Table[Company]))


text:
Q: Private Repository Composer json Confused I need to create a Private Composer Repository - it has 300 zipped extensions. which I want to install on Magento 2 site.
Each zipped extension file inside has its own composer.json file. as some extensions rely on other extensions to be installed aswell in order for them to work.
However when I try to run composer update it is looking for composer.json in the main directory url
Is there any way I can create a simple composer.json to direct it to look for the composer.json of the extensions I want to install inside the different extensions zipped files.
I have spent 2 days looking for tutorial or help on this but its very confusing for me.
tried to get composer to look inside the zipped folders
I just created a new private reposotory and uploaded all the zipped extensions to there - Do I have to do anything futher or is that it?
do I need to convert it to package - very confused
I manage to create the composer.json file
However if I try to run composer update it is giving errors like
- Root composer.json requires extcrea/extension == 1.13.5.0, found extcrea/extension[1.13.5] in the lock file but not in remote repositories, make sure you avoid updating this package to keep the one from the lock file.
I tried to change the urls of the extensions inside composer.lock file to the new private repo
then run
composer update --lock
which is suppose to sync to new repository but I get same error again - how do I tell it to look for extensions in the new repository
tried deleting the composer.lock file but getting extension not found error
tried these aswell
composer dump-autoload
composer clear-cache
Or can someone provide a more simple way of being able to do what I want as


text:
Q: Rails accepting terms before creation Let's say before a user is allowed to view the creation page of a Model, they are required to accept some terms.  The workflow would be like:
User clicks on "create MODEL" -> Brought to a terms page, must accept before moving on -> MODEL creation page
If a user copies the url to the creation page, they should be redirected to the terms page.
What's the best way of going about this?  I was thinking of using the session variable somehow...but I can't think of a clever enough idea.  Any suggestions?

A: You can add the acceptance of the terms to the model itself, then you don't need a construction with an extra page and redirect if someone enters in the wrong place. Instead the user can only submit the form for creation when he/she accepts the terms.
You can add the following to the model:
class Model < ActiveRecord::Base
    validates :terms_of_service, :acceptance => true
end

And then make sure you have the checkbox for this in the new %{model} form.
Also see: http://guides.rubyonrails.org/active_record_validations_callbacks.html#acceptance and Accept terms of use rails

A: You can have the following routes:
get 'terms' => 'MODEL#terms'
get 'new' => 'MODEL#terms'
post 'new' => 'MODEL#new'

The "create MODEL" should send a GET request for /terms. Accepting the terms should POST to /new. If the user pasted /new in the URL, he'll be directed to terms instead.
Alternatively (or additionally), you can have the /terms POST a variable, :terms_accepted => true to the MODEL creation page, and on that page, check if :terms_accepted == true. If not, redirect to the terms page.


text:
Q: Resize the bitmap Im my project I am capturing the image from Camera app and displaying image in listview by using following code .
MySimpleCursorAdapter:
public class MySimpleCursorAdapter extends SimpleCursorAdapter {

    public MySimpleCursorAdapter(Context context, int layout, Cursor c,
        String[] from, int[] to) {
        super(context, layout, c, from, to);
    }

    @Override
    public void setViewImage(ImageView image_v, String id) {

        String path = id;
        Bitmap b = BitmapFactory.decodeFile(path);
        image_v.setImageBitmap(resizedBitmap);

    }

}

List.java
String[] from = new String[]{DbManager.babyName, DbManager.baby_image};
        int[] to = new int[] {/*R.id.list_id,*/ R.id.drname12,R.id.imageView1};//,R.id.list_date};{
        MySimpleCursorAdapter   Adapter = new MySimpleCursorAdapter(this, R.layout.rowlayout, c1, from, to);
        list.setAdapter(Adapter);

Every things is working fine till this point But when I try to resize the bitmap by using this piece of code
 Bitmap resizedBitmap = Bitmap.createScaledBitmap(b, 200, 200, true);

its giving following error :
05-22 07:13:07.562: E/AndroidRuntime(478): FATAL EXCEPTION: main
05-22 07:13:07.562: E/AndroidRuntime(478): java.lang.NullPointerException
05-22 07:13:07.562: E/AndroidRuntime(478):  at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:380)
05-22 07:13:07.562: E/AndroidRuntime(478):  at com.example.tottal.baby.care.MySimpleCursorAdapter.setViewImage(MySimpleCursorAdapter.java:22)
05-22 07:13:07.562: E/AndroidRuntime(478):  at android.support.v4.widget.SimpleCursorAdapter.bindView(SimpleCursorAdapter.java:143)
05-22 07:13:07.562: E/AndroidRuntime(478):  at android.support.v4.widget.CursorAdapter.getView(CursorAdapter.java:256)

A: Error is here  check this properly
 Bitmap b = BitmapFactory.decodeFile(path);

your variable path or b may be null.
check these variable not equal to null then use them.


text:
Q: Past - past perfect In what way do I represent the task which I did yesterday night? I want to know the usage differences between "Past" and "Past perfect" tenses
Can anyone give me idea to clarify this?

Last night, unexpectedly, I met my college mate in a shopping mall. Then, I reached my hostel and had dinner. After that, I read a novel. It was very interesting. Then, I called my schoolmates and spoke with them. At 11'o' clock I went to bed

A: As you say in the question, you did it last night, which tells you the tense.
There no firm rule relating tense to how long ago an event was, as in this conversation:
"Have you done all your homework?"
"Yes, I have."
"When did you do it?"
"I finished it a week ago/last night/this morning/a minute ago."

A: The past tense is used to describe an action or an event which took place at a specific time in the past, and which has been completed at the time of speaking. You would therefore use it to refer to last night's task. The past perfect would not normally be used in this context, but the present perfect might be used if performance of the task was relevant at the time of speaking.


text:
Q: How to create "please wait" Swing dialog while component paints Still relatively new to Swing but after a couple of hours of search, I couldn't find the answer online, hence this post (sorry if already answered and I overlooked it).
I'm using JFreeChart in a Swing application. Some charts are relatively heavy (180k data points) and the JFreeChart's ChartPanel needs ~6 seconds to do its first paintComponent().
Hence I would like to show a "Please wait" message in a dialog while the component paints (no need to show progress with a SwingWorker). I tried to override the paintComponent method but unfortunately the message never appears on screen (I guess the thread directly goes into painting the chart, without taking the time to paint the dialog).
My code looks like this:
public class CustomizedChartPanel extends ChartPanel{

private static final long serialVersionUID = 1L;
private JDialog dialog = null;
boolean isPainted = false;

public CustomizedChartPanel(JFreeChart chart) { super(chart); }

@Override
public void paintComponent(Graphics g) {
    //At first paint (which can be lengthy for large charts), show "please wait" message
    if (! isPainted){
        dialog = new JDialog();
        dialog.setUndecorated(true);
        JPanel panel = new JPanel();
        panel.add(new JLabel("Please wait"));
        dialog.add(panel);
        dialog.pack();
        GuiHelper.centerDialog(dialog); //Custom code to center the dialog on the screen
        dialog.setVisible(true);
        dialog.repaint();
    }

    super.paintComponent(g);

    if (! isPainted){
        isPainted = true;
        dialog.dispose();
            super.repaint();
        }
}
}

Any pointer on how to solve this / best practices would be very much appreciated!
Thanks,
Thomas

UPDATE:
Thanks for the hints & debate: very helpful.
I started implementing the suggested solution with the invokeLater() as I'm fearing that the JLayer solution won't work since it's also running on the EDT.
Unfortunately I'm having a null pointer exception when the paintComponent() is called by the invokeLater().
My code looks like this:
    @Override
public void paintComponent(Graphics graph) {
    //At first paint (which can be lengthy for large charts), show "please wait" message
    if (! isPainted){
        isPainted = true;
        dialog = new JDialog();
        dialog.setUndecorated(true);
        JPanel panel = new JPanel();
        panel.add(new JLabel("Please wait"));
        panel.add(new JLabel("Please wait !!!!!!!!!!!!!!!!!!!!!!!!!!!!!"));
        dialog.add(panel);
        dialog.pack();
        GuiHelper.centerDialog(dialog); //Custom code to center the dialog on the screen
        dialog.setVisible(true);
        dialog.repaint();
        RunnableRepaintCaller r = new RunnableRepaintCaller(this, graph, dialog);
        SwingUtilities.invokeLater(r);
    }
    else super.paintComponent(graph); //NULL POINTER EXCEPTION HERE (invoked by runnable class)
}

And the runnable class is:
public class RunnableRepaintCaller implements Runnable{
private ChartPanel target;
private Graphics g;
private JDialog dialog;

public RunnableRepaintCaller(ChartPanel target, Graphics g, JDialog dialog){
    this.target = target;
    this.g = g;
    this.dialog = dialog;
}

@Override
public void run() {
    System.out.println(g);
    target.paintComponent(g);
    dialog.dispose();
}
}

Again, any pointer would be much appreciated !
Thomas

A: Here is an example and/but it uses SwingWorker. You should seriously consider using this because if somehow the OS invalidates your frame and the loading of your JFreeChart is done on the EDT (Event Dispatching Thread), then your GUI will look frozen.
It also allows you to give better user feedback while you are processing the data. (sorry if the code is a bit long but most of the interesting code is in the initUI and the SwingWorker).
Note: instead of the dialog, you could use the JLayer (if you use Java 7), but this was unnecessary in my example.
The code is highly inspired from http://www.vogella.com/articles/JFreeChart/article.html
/**
 * This code was directly taken from: http://www.vogella.com/articles/JFreeChart/article.html
 * All credits goes to him for this code.
 *
 * Thanks to him.
 */

import java.util.List;

import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PiePlot3D;
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.data.general.PieDataset;
import org.jfree.util.Rotation;

public class PieChart extends JFrame {

    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                initUI();
            }
        });
    }

    protected static void initUI() {
        // First we create the frame and make it visible
        final PieChart demo = new PieChart("Comparison");
        demo.setSize(500, 270);
        demo.setVisible(true);
        // Then we display the dialog on that frame
        final JDialog dialog = new JDialog(demo);
        dialog.setUndecorated(true);
        JPanel panel = new JPanel();
        final JLabel label = new JLabel("Please wait...");
        panel.add(label);
        dialog.add(panel);
        dialog.pack();
        // Public method to center the dialog after calling pack()
        dialog.setLocationRelativeTo(demo);

        // allowing the frame and the dialog to be displayed and, later, refreshed
        SwingWorker<JFreeChart, String> worker = new SwingWorker<JFreeChart, String>() {

            @Override
            protected JFreeChart doInBackground() throws Exception {
                publish("Loading dataset");
                // simulating the loading of the Dataset
                try {
                    System.out.println("Loading dataset");
                    Thread.sleep(2000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                // This will create the dataset
                PieDataset dataset = demo.createDataset();
                publish("Loading JFreeChart");
                // simulating the loading of the JFreeChart
                try {
                    System.out.println("Loading JFreeChart");
                    Thread.sleep(2000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                // based on the dataset we create the chart
                JFreeChart chart = demo.createChart(dataset, "Which operating system are you using?");
                // we put the chart into a panel
                return chart;
            }

            @Override
            protected void process(List<String> chunks) {
                label.setText(chunks.get(0));
                dialog.pack();
                dialog.setLocationRelativeTo(demo);
                dialog.repaint();
            }

            @Override
            protected void done() {
                try {
                    // Retrieve the created chart and put it in a ChartPanel
                    ChartPanel chartPanel = new ChartPanel(this.get());
                    // add it to our frame
                    demo.setContentPane(chartPanel);
                    // Dispose the dialog.
                    dialog.dispose();
                    // We revalidate to trigger the layout
                    demo.revalidate();
                    // Repaint, just to be sure
                    demo.repaint();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

        };
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                     worker.execute();
            }
        });
        dialog.setVisible(true);
    }

    public PieChart(String applicationTitle) {
        super(applicationTitle);
    }

    /** * Creates a sample dataset */

    private PieDataset createDataset() {
        DefaultPieDataset result = new DefaultPieDataset();
        result.setValue("Linux", 29);
        result.setValue("Mac", 20);
        result.setValue("Windows", 51);
        return result;

    }

    /** * Creates a chart */

    private JFreeChart createChart(PieDataset dataset, String title) {

        JFreeChart chart = ChartFactory.createPieChart3D(title, // chart title
                dataset, // data
                true, // include legend
                true, false);
        PiePlot3D plot = (PiePlot3D) chart.getPlot();
        plot.setStartAngle(290);
        plot.setDirection(Rotation.CLOCKWISE);
        plot.setForegroundAlpha(0.5f);
        return chart;

    }

}

A: You can use JLayer as explained here.
This is specifically for a busy indicator as you want.
Further more you can keep the JPanel with setEnabled(false) till your data completely loads. This prevents unwanted clicks on the JPanel.

A: It's been a long time since I've done anything in Java, but as far as I know, the repaint() method does not actually cause any drawing to happen.  It simply flags the control as needing to be redrawn at the soonest possible opportunity.  You need to call the paint() method directly if you want a component to be drawn immediately.

A: You need to start the waiting Dialog in a new Thread. I don't know how you create your chart, but here is a sample
SwingUtilities.invokeLater(new Runnable() {
        public void run() {
             dialog = new JDialog();
             dialog.setUndecorated(true);
             JPanel panel = new JPanel();
             panel.add(new JLabel("Please wait"));
             dialog.add(panel);
             GuiHelper.centerDialog(dialog);
             dialog.setVisible(true);

            Thread performer = new Thread(new Runnable() {
                public void run() {
                    dialog.setVisible(false);
                    //Here the code that prepare the chart
                }
        });
        performer.start();
    }
});


text:
Q: Can anyone identify this manufacturer? "E3"? This has everyone I ask stumped. The board is a Siemens 115U CPU (6ES5943-7UA11) from the Simatic S5 rack, circa 1990's. It has some LEDs and two SPDT, O-ring sealed toggle switches on the front, one of which is an exotic ON-OFF-Momentary style. I've tried running the numbers (26-11 06xx), nothing. Tried looking through hundreds of manufacturer logos, nada. Even went to patent trademark websites and searched through countless combinations of "E3" "3E" "EE" "33" etc... nope.  Can anyone confirm whom made these switches?  Was it Siemens in an act of obscurity?

Inside they are pretty neat. Flipping the lever moves a spring-loaded ball bearing along a pointed track for the "snap" action feel. While the shaft holding the ball bearing, once it reaches position, pushes against a top and bottom set of tiny switch contacts.

A: Not a proper answer, but I was interested to see if a logo search would show up anything so I created one in Inkscape and dropped it and its negative into Google's Image Search. No joy. They may be of some use to you.

A: Dunno about the logo, but it's a Hartmann part number.

There's been a lot of consolidation in the electronics industry- maybe they bought someone up before being swallowed up themselves by Phoenix Mecano.
I used to go to Electronica in München fairly frequently back in the day and was struck by the number of small (less than 1000 employees) successful family owned companies doing electronics in Western Europe.


text:
Q: User Profile Access in SharePoint Can anybody tell me in which scenario User Profile Access is maintained in SharePoint even though profile is deleted/disable from Active Directory and We ran Incremental Synch followed by My_Site_CleanUp job .

A: Mostly it happens when user profile service application  "Profile Synchronization Status" is stuck in synchronizing state.
If Account is removed in AD but User Profile still exist
You can perform the following to resolve the issues:

*

*Make sure User Profile Synchronization service is running
In the user profile service application make sure "Profile Synchronization Status" is not stuck in synchronizing state.

*Start a full User Profile Synchronization
Re-add forest and make sure the password of the account used for synchronization isn't expired


text:
Q: My `qsort` program is not working as expected I have some problems with the use of qsort. I've searched through different documentations, but don't see why my qsort is not working!
Here's the code:
char** suffixArray = makeSuffixArray(string, strlen(string));
qsort(*suffixArray, strlen(string) + 1, strlen(string) + 1, (int(*)(const void*, const void*))strcmp);

Notes:
makeSuffixArray makes an array of all the possible suffixes of the word "bananas".
Qsort then should sort these in lexicographical order.
The function makeSuffixArray does work, I've checked it over and over in the debugger.
Thanks in advance.
EDIT: Would like to post a picture of the suffixArray in debugger, but don't got the repuation for it :^).

A: You did not post the code for makeSuffixArray().  Lets suppose it allocates an array of char* of length one more than the number of characters, since including the empty suffix, there are indeed one more possible suffixes than there are characters.
There are 3 problems with your code:

*

*You pass the first element of the array to qsort instead of a pointer to the string array itself.

*The array element size is sizeof(*suffixArray).  You erroneously pass strlen(string)+1 as the 3rd argument to qsort.

*Casting strcmp to a different prototype is not portable. Furthermore, the comparison function receives pointers to the array entries, not their values, thus strcmp is completely inappropriate.  You must define a specific function as follows.

Here is a modified version:
int scmp(const void *a, const void *b) {
    return strcmp(*(const char **)a, *(const char **)b);
}

char **suffixArray = makeSuffixArray(string, strlen(string));

qsort(suffixArray, strlen(string) + 1, sizeof(*suffixArray), scmp);


text:
Q: How to make a request with the body of url form encoded structure? I have a post request where i need to send x-www-form-urlencoded keyValue pair parameters and content-type should be x-www-form-urlencoded.Here,I am sending Json as a body.I just wanna know how to send this in body and call it in cart function

url: http://something/carts/{cart_id}
postman form body = {id}: {value}

   static post(url, headers, body, resolve, reject) {
   fetch(`${this.data}${url}`, {
   headers: headers,
   method: 'POST',
   body: JSON.stringify(body)
 })
      .then((resp) => {
        resolve(resp.json());
      })
      .catch(err => reject(err))
    }

   static Cart(id, product_id) {
   return new Promise((resolve, reject) => {
   this.post(`/carts/${cart_id}${product_id}`, {
  //Does this url correct.

   "Content-Type": "application/x-www-form-urlencoded",
   "X-Authorization": this.authorization_key
        }, resolve, reject)
    })
 }


text:
Q: Reading an URL with fopen + fgetcsv: does it use a cache? I have a CSV online which is sometimes updated. I'm opening and reading it with:
$f = fopen("http://www.example.com/myfile.csv", "r");
$headers = fgetcsv($f);
while ($row = fgetcsv($f))
{
    echo $row[0];
}
fclose($f);

Sometimes I notice the following problem: I know that the online CSV is already updated, but it seems that this PHP code reads an older version of the CSV (that was read previously a few seconds/minutes before by a precedent call of the same PHP code), like if it would use a cached version of myfile.csv.
Where is the cache setting for fopen($url, "r")? Is there a way to force re-download the URL and bypass any cache system?
PS: Internally, what does fopen use for opening non-filesystem-files but distant files/internet URLs?

A: In fact fopen does not seem to be affected by caching, the documentation https://www.php.net/manual/en/function.clearstatcache.php states:

Affected functions include stat(), lstat(), file_exists(), is_writable(), is_readable(), is_executable(), is_file(), is_dir(), is_link(), filectime(), fileatime(), filemtime(), fileinode(), filegroup(), fileowner(), filesize(), filetype(), and fileperms()


text:
Q: AsynchronousFileChannel write failure I am trying to write an image to a file using AsynchronousFileChannel.write:
    ...
    Path filePath = Paths.get(path + "/" + System.currentTimeMillis()
            + ".jpeg");
    try (AsynchronousFileChannel channel = AsynchronousFileChannel.open(filePath,
            StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE);) {
        CompletionHandler<Integer, Object> handler = new CompletionHandler<Integer, Object>() {

            @Override
            public void failed(Throwable exc, Object attachment) {
                logger.error("Write failed: ", exc);
            }

            @Override
            public void completed(Integer result, Object attachment) {
                ...
            }
        };

        ByteBuf buffer = Unpooled.buffer(request.getImage().length);
        buffer.writeBytes(request.getImage());
        channel.write(buffer.nioBuffer(), 0, null, handler);
    } catch (IOException e) {
        logger.error("Failed to open file: ", e);
        throw new RuntimeException(e);
    }

....

I very often receive the following exception:
java.nio.channels.AsynchronousCloseException: null
    at sun.nio.ch.SimpleAsynchronousFileChannelImpl$3.run(SimpleAsynchronousFileChannelImpl.java:380) ~[na:1.8.0_25]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_25]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_25]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_25]

I run this code on Linux using Oracle JDK 8u25. This is exception occoured a lot less on Windows. And I also noticed when I run the code in debug mode, stepping over each line of code, it rarely happens.
When I do not use the CompletionHandler, but rather use:
    Future<Integer> writeFuture = channel.write(buffer.nioBuffer(), 0);
    Integer integer = writeFuture.get();

I don't get the exception.
What could be causing this?

A: I think it is because you auto close the Channel when you leave the try {...} block and the write you are doing is async, which means that if your write is not done fast-enough you will try to write to a closed channel.


text:
Q: Orthonormal basis for Sobolev Space $H^1[0,1]$ in one dimension Let $H$ be the space of all absolutely continuous functions $f:[0,1]\to\mathbb R$ with $f'\in L_2[0,1]$, equipped with the norm
\begin{align*}
||f||_H=\sqrt{\int_0^1f(x)^2dx}+\sqrt{\int_0^1f'(x)^2dx}.
\end{align*}
Then $H$ should be a Hilbert space with inner product
\begin{align*}
\langle f,g\rangle=\int_0^1\big[f(x)g(x)+f'(x)g'(x)\big]dx.
\end{align*}
My question now is: What is an "easy" orthonormal basis of $H$?
I know that $O:=\{c_n\ |\ n\in\mathbb N_0\}\cup\{d_n\ |\ n\in\mathbb N_0\}$, where
\begin{align*}
d_0(t):=1,\quad
c_0(t):=\sqrt{3} t,\quad
c_n(t):=\frac{\sqrt{2} \cos (2 \pi  n t)}{\sqrt{4 \pi ^2 n^2+1}},\quad
d_n(t):=\frac{\sqrt{2} \sin (2 \pi  n t)}{\sqrt{4 \pi ^2 n^2+1}},
\end{align*}
is an orthonormal system of $H$, but is it also a basis?
Background information: I'm considering the functional $T:H\to\mathbb R$, defined by $Tf:=f(0)$. This functional is linear and bounded in $H$ with $|Tf|\leq||f||_H$. By the Riesz Representation Theorem I would like to find its representative $g\in H$ such that $Tf=\langle f,g\rangle$ for all $f\in H$.
I know that if $(e_n)$ is an orthonomal basis of $H$, then $g=\sum_{n\in\mathbb N}Te_n\cdot e_n$. I tried $O$ and came up with some weird function $g$, for which I tested numerically if $g$ is the desired representative. However, these tests seem like $g$ is not the representative, and that's why I doubt that $O$ is complete.
Any help is highly appreciated. Thank you!!!

A: I made a mistake by considering $c_0=\sqrt{3}t$, which neither is normalized nor orthogonal to the other functions. However, my question has already been answered here:
https://mathoverflow.net/questions/261941/orthonormal-basis-in-w1-20-1


text:
Q: R package: using lapply to do.call a list of internal functions I am developing an R package in which I have an exported function that needs to call several unexported functions and store the results from each in a list.
Which functions are called is variable and depends on user input.
My approach to this was to lapply a (character) vector of function names with do.call, but it seems like this makes the unexported functions invisible to the exported function.
Consider the following example package code:
tmp1 <- function(x) print(paste("Function 1 called with x =", x))
tmp2 <- function(x) print(paste("Function 2 called with x =", x))
tmp3 <- function(x) print(paste("Function 3 called with x =", x))

#' @export
test1 <- function() {
  tmp1("test")
  tmp2("test")
  tmp3("test")
}

#' @export
test2 <- function() {
  funs <- c("tmp1", "tmp2", "tmp3")
  for (fun in funs) do.call(fun, list(x = "test"))
}

#' @export
test3 <- function() {
  funs <- c("tmp1", "tmp2", "tmp3")
  lapply(funs, do.call, list(x = "test"))
}

After building and loading the package, running the three test functions yield the following output:
test1()
#> [1] "Function 1 called with x = test"
#> [1] "Function 2 called with x = test"
#> [1] "Function 3 called with x = test"

test2()
#> [1] "Function 1 called with x = test"
#> [1] "Function 2 called with x = test"
#> [1] "Function 3 called with x = test"

test3()
#> Error in tmp1(x = "test"): could not find function "tmp1"

Calling the functions directly works, and calling them with do.call works when using do.call directly, but it fails when calling them via lapply.
I can make a workaround with the for-loop, but I am curious as to why this happens.
So, my question is twofold:

*

*Why are the unexported functions invisible to do.call when called inside lapply?

*Can I make the lapply(funs, do.call, list(...)) approach work?

A: This has partly been covered elsewhere, I recommend you to read these two(1, 2) threads here at stackoverflow on global variables and scoping assignment.
To solve your problem, add "<<-" when assigning your functions, i.e.
tmp1 <<- function(x) print(paste("Function 1 called with x =", x))
tmp2 <<- function(x) print(paste("Function 2 called with x =", x))
tmp3 <<- function(x) print(paste("Function 3 called with x =", x))

Output:
> test1()
[1] "Function 1 called with x = test"
[1] "Function 2 called with x = test"
[1] "Function 3 called with x = test"
>
> test2()
[1] "Function 1 called with x = test"
[1] "Function 2 called with x = test"
[1] "Function 3 called with x = test"
> test3()
[1] "Function 1 called with x = test"
[1] "Function 2 called with x = test"
[1] "Function 3 called with x = test"
[[1]]
[1] "Function 1 called with x = test"

[[2]]
[1] "Function 2 called with x = test"

[[3]]
[1] "Function 3 called with x = test"

A: Following the comments on the question, I have a (partial) answer:

*

*do.call by default evaluates character arguments in parent.frame(), and when called inside lapply, this is a different environment  than the one the tmp functions are defined in (though I'm not sure about the specifics)

*Supplying the current environment to do.call makes the lapply approach work:
lapply(funs, do.call, args = list(x = "test"), envir = environment())


text:
Q: Clamscan cannot remove 'Read Only' viruses in /media/user/Windows I ran a clamscan -r -i --remove / on my Ubuntu 22.04, which is installed alongside Windows 10 on my computer, and it gave me the following results:
/media/<me>/Windows/Program Files/Common Files/Adobe/Microsoft/EdgeWebView/PlayReadyCdm/_platform_specific/win_x64/playreadycdm.dll: Win.Ransomware.Generic-9977355-0 FOUND
traverse_unlink: Failed to unlink: /media/<me>/Windows/Program Files/Common Files/Adobe/Microsoft/EdgeWebView/PlayReadyCdm/_platform_specific/win_x64/playreadycdm.dll
Error:Read-only file system
ERROR: Can't remove file '/media/<me>/Windows/Program Files/Common Files/Adobe/Microsoft/EdgeWebView/PlayReadyCdm/_platform_specific/win_x64/playreadycdm.dll'
/media/<me>/Windows/Program Files/Common Files/microsoft shared/ClickToRun/C2RUI.en-us.dll: Win.Malware.Genpack-9879542-0 FOUND
traverse_unlink: Failed to unlink: /media/mark/Windows/Program Files/Common Files/microsoft shared/ClickToRun/C2RUI.en-us.dll
Error:Read-only file system
ERROR: Can't remove file '/media/<me>/Windows/Program Files/Common Files/microsoft shared/ClickToRun/C2RUI.en-us.dll'
LibClamAV Warning: cli_codepage_to_utf8: iconv error: An incomplete multibyte sequence has been encountered in the input.
/media/<me>/Windows/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/Tools/mfc140jpn.dll: Win.Malware.Fileinfector-9834808-0 FOUND
traverse_unlink: Failed to unlink: /media/<me>/Windows/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/Tools/mfc140jpn.dll
Error:Read-only file system
ERROR: Can't remove file '/media/<me>/Windows/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/Tools/mfc140jpn.dll'
/media/<me>/Windows/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/Tools/mfc140rus.dll: Win.Malware.Fileinfector-9835297-0 FOUND
traverse_unlink: Failed to unlink: /media/<me>/Windows/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/Tools/mfc140rus.dll
Error:Read-only file system
ERROR: Can't remove file '/media/<me>/Windows/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/Tools/mfc140rus.dll'
/media/<me>/Windows/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Redist/MSVC/14.16.27012/debug_nonredist/x64/Microsoft.VC141.DebugMFC/mfcm140d.dll: Win.Malware.Barys-9833088-0 FOUND
traverse_unlink: Failed to unlink: /media/<me>/Windows/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Redist/MSVC/14.16.27012/debug_nonredist/x64/Microsoft.VC141.DebugMFC/mfcm140d.dll
Error:Read-only file system
ERROR: Can't remove file '/media/<me>/Windows/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Redist/MSVC/14.16.27012/debug_nonredist/x64/Microsoft.VC141.DebugMFC/mfcm140d.dll'
/media/<me>/Windows/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Redist/MSVC/14.16.27012/debug_nonredist/x64/Microsoft.VC141.DebugMFC/mfcm140ud.dll: Win.Malware.Barys-9833088-0 FOUND
traverse_unlink: Failed to unlink: /media/<me>/Windows/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Redist/MSVC/14.16.27012/debug_nonredist/x64/Microsoft.VC141.DebugMFC/mfcm140ud.dll
Error:Read-only file system
ERROR: Can't remove file '/media/<me>/Windows/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Redist/MSVC/14.16.27012/debug_nonredist/x64/Microsoft.VC141.DebugMFC/mfcm140ud.dll'
LibClamAV Warning: SWF: declared output length != inflated stream size, 12999492 != 16405452
LibClamAV Warning: SWF: declared output length != inflated stream size, 2303109 != 2379158
LibClamAV Warning: cli_scanxz: decompress file size exceeds limits - only scanning 27262976 bytes
LibClamAV Warning: cli_scanxz: decompress file size exceeds limits - only scanning 27262976 bytes
/media/<me>/Windows/Windows/System32/mfcm140d.dll: Win.Malware.Barys-9833088-0 FOUND
traverse_unlink: Failed to unlink: /media/<me>/Windows/Windows/System32/mfcm140d.dll
Error:Read-only file system
ERROR: Can't remove file '/media/<me>/Windows/Windows/System32/mfcm140d.dll'
/media/<me>/Windows/Windows/System32/mfcm140ud.dll: Win.Malware.Barys-9833088-0 FOUND
traverse_unlink: Failed to unlink: /media/<me>/Windows/Windows/System32/mfcm140ud.dll
Error:Read-only file system
ERROR: Can't remove file '/media/<me>/Windows/Windows/System32/mfcm140ud.dll'

The files I checked from the list say they have been accessed and/or modified at various times over the last four years. Are these, as strange as it may seem, supposed to be there, or do I actually have viruses I need to remove?
How would I have gotten these viruses, and how can I remove them given these errors?


text:
Q: How do I send a url to a database after it is clicked using PHP and a MySQL database <?php

$db = mysql_connect("localhost", "test", "test");
mysql_select_db("test");

// yada yada ..code ...

echo ("
" . $item_title . "");

$sql = mysql_query("insert into myTable(item_link , item_title ,) values('$item_link ', '$item_title ')");

mysql_close($db);
?>


text:
Q: rbind all dataframes of a folder to one dataframe How can I rbind all .RData dataframes which are stored in the same folder with identical column structure?
I tried:
my_list <- list.files(my_path, full.names=TRUE)
my_files <- lapply(my_list, load, envir=.GlobalEnv)
library(dplyr)
df <- bind_rows(my_files, .id = "column_label")

A: You can try :
lapply(my_files, load, .GlobalEnv)
df <- do.call(rbind, mget(sub('\\.RData', '', basename(my_files))))


text:
Q: Iterate Through, Save, and Format Cells in VBA I have an automated report that generates a table of values that need to be iterated through and saved to a different format.
Here is the table:
John Smith      5/26/2018   12345   IT Pro     John Gault   Permitting  Sarasota
Winston Smith   5/30/2018   54321   Henchman   Bob          Licensing   Oceania

The format that I'm looking to get that information to is the following:
Name:   John Smith
Date Starting:  5/26/2018
Employee ID#:   12345
Title:  IT PRO
Supervisor: John Gault
Bus Ctr:    Permitting
Location:   Oceania

Name:   Winston Smith
Date Starting:  5/30/2018
Employee ID#:   54321
Title:  Henchman
Supervisor: Bob
Bus Ctr:    Licensing
Location:   Oceania

The amount of employees on the report will change on a given day, so I believe a For Each is in order, something to the effect of:
For Each Cell In ActiveSheet.UsedRange.Cells

I'm just uncertain what to put into the For loop.

A: You can do some interesting stuff with Excel's Get & Transform functions. First - here are the manual steps:

*

*Add a row as header with column names

*Select the table and press Ctrl+T to create a table

*On the Data Tab, click From Table

*In the new editor that pops up, select all columns

*On the Transform tab, click Unpivot

*Save and exit

This isn't as straight forward as a macro, but Get & Transform is very powerful in cases like this.

A: Could you try this code.
I suppose that your data is in a sheet "data".
Sub test()
Application.DisplayAlerts = False

Dim sh_final As String
sh_final = "final"

Dim sh_data As String
sh_data = "data" 'change if different

Dim sh_template As String
sh_template = "template"

'create sheet template
Dim ws As Worksheet
For Each ws In Worksheets
    If ws.Name = sh_template Then
    ws.Delete
    End If
Next ws

 With ThisWorkbook
     .Sheets.Add(After:=.Sheets(.Sheets.Count)).Name = sh_template
 End With
With ThisWorkbook.Sheets(sh_template)
     .Range("A1").Value = "Name :"
     .Range("A2").Value = "Date Starting:"
     .Range("A3").Value = "Employee ID#:"
     .Range("A4").Value = "Title :"
     .Range("A5").Value = "Supervisor:"
     .Range("A6").Value = "Bus Ctr:"
     .Range("A7").Value = "Location:"
 End With

'create sheet final
For Each ws In Worksheets
    If ws.Name = sh_final Then
    ws.Delete
    End If
Next ws
 With ThisWorkbook
     .Sheets.Add(After:=.Sheets(.Sheets.Count)).Name = sh_final
 End With

'Copy data from sheet data
    For i = 1 To ThisWorkbook.Sheets(sh_data).Range("A" & ThisWorkbook.Sheets(sh_data).Rows.Count).End(xlUp).Row

    LastRow = ThisWorkbook.Sheets(sh_final).Range("A" & ThisWorkbook.Sheets(sh_final).Rows.Count).End(xlUp).Row + 1

    'Copy the template
    With ThisWorkbook.Sheets(sh_template)
    .Activate
    .Range("A1:A7").Copy
    End With

    With ThisWorkbook.Sheets(sh_final)
    .Activate
    .Range("A" & LastRow).Select
    End With
    ActiveSheet.Paste

    'copy the data
    With ThisWorkbook.Sheets(sh_data)
        .Activate
        .Range("A" & i & ":G" & i).Copy
    End With

    With ThisWorkbook.Sheets(sh_final)
        .Activate
        .Range("B" & LastRow).Select
    End With
    Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=True

    Next i

Application.DisplayAlerts = True

End Sub

A: Approach via transposed datafield array
Get data via a transposed datafield array (rows and columns changed), rearrange the array structure once after a reverse loop (within the same array) and write the array back to a target sheet:
Code example
This code example assumes you have a header line in row 1:1 in your data sheet:
Option Explicit                                      ' declaration head of your code module

Sub Iterate()
  Dim i As Long, j As Long, n As Long
  Dim nCol As Long, sCol As String
  Dim v                                               ' short for Dim v As Variant
  Dim ws As Worksheet, ws2 As Worksheet

  Set ws = ThisWorkbook.Worksheets("MyData")          ' << change to data sheet name
  Set ws2 = ThisWorkbook.Worksheets("MyTarget")       ' << change to target sheet name
' [1] get last row in column A containing data
   n = ws.Range("A" & ws.Rows.Count).End(xlUp).Row
' [2] count header columns A:G (=7) and add one column to receive free line
   nCol = 7 + 1          ' nCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column + 1
' [3] get column letter after multiplication of rows with nCol
   sCol = Split(Cells(1, (n - 1) * nCol).Address, "$")(1)
' [4] get values to transposed one based 2dim array
   v = Application.Transpose(ws.Range("A1:" & sCol & n).Value)
' [5] rearrange data by reverse loop
  For i = n To 2 Step -1
     For j = 1 To nCol
       ' assign header (col 1) and data (col 2) to array items
         v((i - 2) * nCol + j, 1) = v(j, 1)  ' header
         v((i - 2) * nCol + j, 2) = v(j, i)  ' data
     Next j
  Next i
' [6] write back to target sheet
  ws2.Range("A:B") = ""                         ' clear columns A:B in target sheet
  ReDim Preserve v(1 To UBound(v), 2)           ' redim array to 2 columns
  ws2.Range("A1").Resize(UBound(v), 2) = v      ' write back
End Sub

Notes
Usually the (not yet transposed) datafield array would contain n data rows and nCol columns.
As this example tries to reuse the original array, the data range gets greater to include all items multiplied by 8 (i.e. 7 columns plus an empty one).

*

*As the data range will be transposed, columns change to rows.

*As the total lines have to contain the product rows (n-1, i.e. without header line) * 8, it's necessary to define a greater column range to receive a greater array for later rearrangement - see section [3] with definition of a column letter.

*The array item v((i - 2) * nCol + j,2) rearranges the data items only in column 2 to write them back later to target sheet column B. The new row index ((i- 2) * nCol + j has to calculate i-2 considering the header line (-1) as well as a start from zero (-1), multiplied by nCol plus column j.


text:
Q: Pronunciation of Van Vogt How did A. E. van Vogt pronounce his last name? Does it rhyme with joked, goat, or go? I'm looking for an authoritative answer, preferably a direct quotation from Van Vogt himself or a personal acquaintance. The following remarks, quoted from the Wikipedia talk page, are not very convincing:

Ben Bova introduced me to Van Vogt at the WorldCon back in '76 and I thought he pronounced it "Vo" as in "go", but I could easily be wrong about this....

The witness could have misheard or misremembered, or Van Vogt may have been too polite to correct a common mispronunciation of his name.

Vogt is pronounced as "vote." The "g" is silent. My encounters with this pronunciation include a pun, I think by Forry Ackerman, something about "he gets my Vogt for" a distinction; and visits to a few science fiction conventions where Van was introduced.

No doubt Ackerman would have known the correct pronunciation. However, it was not his pun; Ackerman quoted it in his introduction to Van Vogt's collection Monsters, attributing it to the 19-year-old fan Ray Bradbury in a 1940 letter to the editor of Unknown Fantasy Fiction. Anyway, "vote" and "voked" are close enough for a pun.
Update. After posting this question, I found an answer in L. Sprague de Camp's Science-Fiction Handbook (first edition, Hermitage House, New York, 1953), p. 163:

Alfred E. van Vogt (rhymes with "joked"), "Van" to intimates, was born in 1912 in Manitoba of Dutch descent. He lived in various parts of Canada until in 1944 he moved to Los Angeles where he has resided ever since, recently becoming an American citizen. He is a tall moose-like man with angular features; a pince-nez secured to one prominent ear by a golden chain gives him a quaintly old-fashioned air. He has a gentle, courteous manner and loves to talk about theories of education and psychology. During the last couple of years he has been a dianetic auditor. Between Dianetics and the revision of his novels for book publication he has produced little magazine copy lately, but expects to do more henceforth.

I was considering submitting this as an answer and accepting it; however, Richard's contrary answer is even more convincing.
Update. Thanks to all who answered or commented. The information about the etymology of the name Van Vogt and its pronunciation in High German, Low German, and Dutch is very interesting, maybe more interesting than my original question. My question, however, was not about the authentic "old country" pronunciation, nor about how Van Vogt pronounced his name as a child speaking Low German, nor about how the mature Van Vogt would pronounce the name in the company of his parents, blood relatives, or childhood friends, now was it about how anyone else named Vogt may have pronounced it. The question was about how Van Vogt himself, as an adult (or better yet, as an established author), in an English-speaking setting, would pronounce his own name, or how he would advise English speakers to pronounce it. The only plausible choices for an anglicized pronunciation of Vogt are "voked" (as in "revoked") and "vote". I accepted Richard's answer because it cites earwitness testimony to Van Vogt personally endorsing the "vote" pronunciation. As noted above L. Sprague de Camp voted for the "voked" pronunciation, and he should have been in a position to know; however, it's understandable that Van Vogt might have refrained from "correcting" someone trying to approximate the original pronunciation of his name.

A: The wikipedia page (not the talk page) has the pronunciation as /vænvoʊt/ or "vanvote" - which is the original German pronunciation of the word - http://www.pronouncenames.com/pronounce/vogt

A: It's pronounced Van Vote
In 1994, author Isaac Walwyn met Van Vogt at a science fiction book signing event.
I've quoted him directly;

It was also at this time that I learned how to pronounce his name: he
  was telling someone that the "G" in "Vogt" was silent, making it sound
  identical to "vote." But by and large he did very little talking. He
  seemed very happy to be there, though, and when my turn came, shook my
  hand with a smile.

Additionally, Randall Garrett published a poem with the following title: "How to pronounce van Vogt" which was produced for the Omniumgathum, a vanity print of short prose and poems specifically intended to be read by members of the sci-fi writers community.
This poem was later reproduced in Isaac Asimov's Science Fiction Magazine, a magazine which regularly carried stories by Van Vogt.

Randall Garrett had met van Vogt on numerous occasions by this point and his poem clearly indicates the correct answer; Vogt to rhyme with wrote and mote (or as Wikipedia has it, /vænvoʊt/;).

A: I wanted to reply to KorusKol's comment, but apparently i need 50 (!) reputation to add a comment, god knows why.
The German pronunciation is very different from the American. Van is pronounced Fun (almost perfect match) and Vogt Fohgt (likely no soft 'V').
OP wanted to know how the man himself pronounced it and I imagine Van Vote is quite close.
Edit: Here the German version, "Michael Vogt" in this case:

 Note how every letter is audible.

A: I don't think we have any definitive proof to say for sure how he himself pronounced it. All evidence seems to be either hearsay or anecdotal examples where he himself may have adjusted the name to fit the audience.
I happen to be Dutch with a reasonable knowledge of German too.
Based on that:
We would pronounce Van Vogt as follows:
Van with a soft V-A sound and with no particular emphasis on any part of the word.
(I don't really know a good equivalent in English.)
Vogt with a soft V-O and short O sound, similar to "vodka". And a harsh G, almost a K. The T is quite noticable too.
(Germans use a harsh F and change the O sound into something closer to "vogue", clear sample in the first few seconds of the video in Adrians answer.)
Low German as spoken by Amish and other immigrant groups in the USA is still very similar to modern Dutch/northern German (I have no problem understanding Low German) so it would be likely that during his youth he would have pronounced it like that himself.
It is just as likely that in later years he gradually "Americanized" his name.


text:
Q: Delay Between Mail Receive in Exchange 2010 on SBS2011 I've just migrated my servers from Exchange 2003, and decided to rather use SBS 2011 with Exchange 2010.
Some users are complaining about the delay between mail collection. I set the pop connector to 5 minutes, I could override this, But I've read that if the mail is large it can fail if the collection time is to short.
Is there any way to receive mail quicker?

A: Point your MX records to your SBS Exchange server.  To do this make an A record for your public IP such as mail.yourdomain.com then make an MX record pointing to mail.yourdomain.com.


text:
Q: Python BadYieldError: yielded unknown object HTTPError('HTTP 599: Connection closed',) I want to know why in this function:
@tornado.gen.engine
def check_status_changes(netid, sensid):

    como_url = "".join(['http://131.114.52:44444/ztc?netid=', str(netid), \
               '&sensid=', str(sensid), '&start=-5s&end=-1s'])

    http_client = AsyncHTTPClient()
    response = yield tornado.gen.Task(http_client.fetch, como_url)

    if response.error:
        raise Exception(response.error)

when there's response.error, I obtain the title error... what I have to yield in order to catch the returned value in another function?
I would after do something like:
try:
        periodic = tornado.ioloop.PeriodicCallback(check_status_changes(netid, sensid), 5000)
        value = periodic.start()
        print("Secondo")
        print value
    except:
        print("Quarto")
        periodic.stop()
        self.finish()
        return
    else:

I don't know... I would just compare the returned value with another....
Thank you.

A: That function has a gen.engine decorator, you can't return a value from inside it (not tornado related, you can't return a value inside a generator).
If you are trying to get a value out of that function -provided you are calling that on IOLoop-, that function should have a callback (callable) keyword argument as such:
@tornado.gen.engine
def check_status_changes(netid, sensid, callback=None):
    response = yield tornado.gen.Task(do_your_thing)
    if response.error:
        raise response.error
    callback(response.body)  # this is how you make the value available to the
                             # caller; response.body is HTTPResponse specific iirc

Now you can call this function somewhere else as such:
# somewhere in a gen.engine decorated async method
body = yield tornado.gen.Task(check_status_changes, netid, sensid)

A: You can use
raise tornado.gen.Return(response)

A:     class MainHandler(tornado.web.RequestHandler):
        @gen.coroutine
        def get(self):
            http_client = AsyncHTTPClient()
            http_client = tornado.httpclient.AsyncHTTPClient()
            response = yield http_client.fetch('http://localhost:1338/api/getDistinctGeoPositions/?durationInMinutes=9000')
            if response.error:
                print response.error
            self.finish(response.body)


text:
Q: Any official or semi-official continuation of Terminator - the Sarah Connor Chronicles TV-show? I've been re-watching the 2nd and final season of "Terminator - the Sarah Connor Chronicles" (I used to love that show) with great joy, and wonder if there were any official or semi-official continuation of the show - E.g. books, graphic-novels/comics, cartoons, audio-plays?  Has the plans/outlines for the never-made 3rd season been leaked?
Alternatively, are/were there any really good fanfiction that took up the threds from the show in a good way?
BTW, were there any books, graphic-novels etc. released while the show ran (that tied in to episodes)?

A: As far as I know, there are no series, books, graphic novels or cartoons that are sequels to Terminator TSCC. Althrough I'm not sure about fanfictions.

A: Ok, good TSCC FanFiction. Well, there's 'I Love You Too' by King Steve, which serves as a very good season 3 substitute. It's long, dark and gritty, but very well written.
If you want something more lighthearted, there's the 'Wintertale' series by Troll99, which focuses on John and Cameron's relationship, but also has the heroes fighting bad guys. More family-oriented but still entertaining.

A: There's no official continuation of TSCC however there is many Season 3 TSCC fanfiction some good, some bad.
I've also heard there is a cyborg novel series coming out that is heavily inspired by TSCC and Total Recall, but TSCC than Total Recall. Which is unfortunately another official continuation :(


text:
Q: Unable to set Text in Combox Box in DropDownList I want to set the text in a combo box. Below is the code-
private System.Windows.Forms.ComboBox selectModel;
this.selectModel = new System.Windows.Forms.ComboBox();
this.selectModel.Name = "selectModel";
this.selectModel.FormattingEnabled = true;
this.selectModel.Size = new System.Drawing.Size(64, 21);
this.selectModel.Location = new System.Drawing.Point(3, 76);
this.selectModel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;

The following line is not working-
selectModel.SelectedText = getModelNameFromConf();

The documentation says that "it Gets or sets the text that is selected in the editable portion of a ComboBox". I can't make it editable to user.
Any workaround please.

A: This is because when you use ComboBoxStyle.DropDownList, the dropdown has no editable portion. To make it editable, use ComboBoxStyle.DropDown.
Note too the remarks on the SelectedText property relating to whether the control has focus. You may find the Text property more suitable for many purposes.
EDIT For example:
selectModel.Text = getModelNameFromConf();

Assuming the combo contains that value in its list, setting Text will also set the SelectedIndex property of the dropdown.
(I think some of the property names of this control are particularly confusing, including DropDown vs. DropDownList. Someone at MS had a bad day when this control was coded. Note also that the word selection is being used in two different ways: here, you want to set the selected item, whereas SelectedText means some text that is selected—which might not be the whole of the item text. This is the same as in a textbox where the user has dragged the mouse to highlight some of the text but not all of it.)


text:
Q: Why does the Guava Resources class not have String versions of the methods? The construct Resources.toString(Resources.getResource("foo"), Charsets.UTF_8) feels a little cumbersome.  Why the insistence on conversion to URL's first?  Since the getResource() method doesn't throw an exception, why not have parallel String methods as well?

A: I'm pretty sure this all comes down to orthogonality and composability. The API clearly separates getting the URL of a resource from doing something with that resource. This is important because there are a number of ways that you can get the URL of a resource. Resources.getResource("foo") is one, but it just won't work in some situations. If you need to ensure that a specific ClassLoader is used (because Guava may be loaded by a different ClassLoader than your application files), you need an alternative way of getting the URL such as Resources.getResource("foo", SomeApplicationClass.class).
If Resources were to provide overloads of its methods to handle all those cases, the number of methods in the class would triple. That might seem acceptable in this particular case, but if similar "shortcuts" were added throughout the library, the number of methods would balloon up very quickly. The library would become much more difficult to digest because you'd have to dig through a sea of methods that do almost the same thing to find what you want. For that reason, Guava favors powerful methods that do one thing and which combine well with other methods. Combining Resources.toString with Resources.getResource is an example of this.
Of course, that doesn't mean that Guava never provides such shortcuts... it just only does so when the addition really seems worth it. For example, most of the methods in the Files class could be removed since you can just combine Files.newInputStreamSupplier, Files.newWriterSupplier, etc. with the methods in the ByteStreams and CharStreams classes to accomplish the same things. Given how common operations on Files are, though, the shortcuts were deemed worth it. (Note that overloads that take a String filename were not added, though.)


text:
Q: sql: percentage of a type in a column I'm trying to get percentage of missed calls for each user, so I used the following sql query:
select distinct a__contact
       , count (case when a__type = 'missed'
                     then 1 else 0 end) / count(*) * 100
                                                  as "percentage of missed calls"

from table
group by 1

However, for each user I got 100 which do not seem to be correct output at all. Could someone help me to identify the error in my query? thank you so much!

A: Here is a simpler way to express the logic you want:
select a__contact,
       avg(case when a__type = 'missed' then 100.0 else 0 end) as percentage_missed_calls
from table
group by 1;

Your version is failing because you are using count() in the numerator.  You really intend sum().  count() counts the number of non-NULL values and both "1" and "0" are non-NULL.


text:
Q: get all data of listview by 5 column and more than 2 row I have a listView by 5 column and more than 2 row...
I want to get all field and copy them in arrays.
For example if I have these listview:
column1       column2     column3     column4     column5
data1         data2       data3       data4       data5
data6         data7       data8       data9       data10
I want to have array like this:
array={data1,data2,data3,data4,data5,...,data10}

I tried :it dose not work because in this array is just one column
var myList = new List<string>();
        foreach (ListViewItem Item in listView2.Items)
        {
            myList.Add(Item.ToString());
        }

A: ListViewItems is a list so you should use an index to get valued
your code should be like that:
var myList = new List<string>();
    foreach (ListViewItem Item in listView2.Items)
    {
       for ( int i = 0 ; i < item.Count ; i++ )
       {
            myList.Add(Item[i].ToString());
       }

    }

This should normally help you.


text:
Q: T-SQL, Remove space in string I have two strings in SQL and the REPLACE function only works on one of them, why is that?
Example 1:
SELECT REPLACE('18 286.74', ' ', '')

Example 2:
SELECT REPLACE('z z', ' ', '')

Example 1's output is still "18 286.74" whereas Example 2's output is "zz". Why does SQL not react the same way to both strings?
UPDATE:
When running select replace('123 123.12', ' ', '') that works fine, still not with '18 286.74'.

A: Test it the following way.
select unicode(substring('18 286.74', 3, 1))

If the code returns 32 then it's a space, if not, it's a different Unicode character and your replace ' ' won't work.

A: maybe cast is needed.
UPD: or not(on sql 2005 works fine too)

A: Are you sure it is a space? i.e. the same whitespace character that you are passing as the second argument? The code you've posted works fine for me on SQL Server 2008.
Re working on your friends PC - perhaps the whitespace got normalized when you sent it to him?

A: You are probably using non-breakable space.
I could reproduce it by typing ALT+0160 into the number in SELECT REPLACE('18 286.74', ' ', '')
Could you please issue this following:
SELECT CAST('18 286.74' AS BINARY), REPLACE('18 286.74', ' ', '')

by copying the '18 286.74' from REPLACE into CAST?

A: I was having the same issue and found that it was a char(10) (line feed). when copied out of Managment Studio it became a char(32) but in the record it was a char(10) try
Select Replace(@string, char(13), '')


text:
Q: Proper vector notation I wrote a vector as $(a, b)$ in a maths exam but I was told it is not vector notation. However, I have seen this notation used all over this site and elsewhere. Is it correct or not?

A: This is a cultural thing. I think it's perfectly fine, in general. However, to give you some examples of why someone could find it non-fine:

*

*In secondary school (high school) here in Norway, students learn that the coordinates of points are written $(a, b)$, and the coordinates of vectors are written $[a, b]$. As my calculus book says, this leads to pedantic double bookkeeping, as there is no mathematical reason to distinguish between points in the plane and vectors in the plane.

*In linear algebra, the coordinates of your everyday vectors are usually written in column form: $\left(\begin{smallmatrix}a\\b\end{smallmatrix}\right)$, or $\left[\begin{smallmatrix}a\\b\end{smallmatrix}\right]$. Writing it as $(a, b)$ makes it a row vector, which is a different kind of object.

*As pointed out in the comments: Some don't like using coordinates at all, and want you to explicitly write your vectors as linear combinations of the unit vectors, giving something along the lines of $a\vec i + b\vec j$ or $a\vec{e_x} + b\vec{e_y}$.

A: Notation is (almost) never unilateral, there are good reasons for choosing one or another. Lastly, if you use a different notation to the agreed one, you should declare it.
For instance, consider the set $\mathbb{R}^2:=\mathbb{R}\times \mathbb{R}$. Therefore the points of $\mathbb{R}^2$ are, by definition of cartesian product, the couples $(a,b)$ where $a$ is in the first copy of $\mathbb{R}$, and $b$ in the second copy.
Now, $\mathbb{R}^2$ can be given the structure of vector space, so now you have $\mathbb{R}^2$ with a rule for summing points of $\mathbb{R}^2$ and a rule of multiplying points in $\mathbb{R}^2$ by scalars. An element $v$ of this vector space (a vector, by definition), is still a point of $\mathbb{R}^2$, so to emphasize that you could write $v=(a,b)$ for some $a,b$.
But then, since most of the times we do matrix-vector multiplications in linear algebra, a convenient way of writing vectors might be $v=\begin{bmatrix}
a\\b
\end{bmatrix}$.
The thing with notation is that it has to be declared in advance in order to be understood by others, and you choose one instead of the others depending on your goal, what you want to emphasize.

A: I've also been told by my math teachers not to write vectors using the $(a, b)$ notation in order to avoid confusion, since that notation is often used to represent a single point on an $xy$-coordinate plane. Another answerer mentioned that it seems like something that varies by country/region, which makes sense—in the USA (the part that I'm from, at least) I was taught to write vectors as either $<a, b>$ or $a\vec x + b\vec y$.


text:
Q: How to get a list of items from one table and total of their related items from anther in mySql? I'm going to have a list of all order_status items with total number of related orders. I tried to use inner join and left join, but none of them worked for me.
select
order_status.order_status_id, order_status.name, sum(order.order_id)
where language_id = 1

http://sqlfiddle.com/#!9/7efcbe
Here are tables:
CREATE TABLE IF NOT EXISTS `order` (
    `order_id` int(11) NOT NULL AUTO_INCREMENT,
    `store_id` int(11) NOT NULL DEFAULT '0',
    `order_status_id` int(11) NOT NULL DEFAULT '0',
    `language_id` int(11) NOT NULL,
    PRIMARY KEY (`order_id`)
) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `order_status` (
    `order_status_id` int(11) NOT NULL AUTO_INCREMENT,
    `language_id` int(11) NOT NULL,
    `name` varchar(32) NOT NULL,
    PRIMARY KEY (`order_status_id`,`language_id`)
) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;

A: Here is the query, perhaps your looking for this data --
select os.order_status_id,os.name,count(o.order_id)
from order_status as os
left outer join `order` o on os.order_status_id = o.order_status_id
group by os.order_status_id,os.name

A: try:
select os.order_status_id, os.name, sum(o.order_id)
from `order_status` os JOIN `order` o on os.order_status_id=o.order_status_id
AND o.language_id = 1
GROUP BY o.order_status_id;

A: You can try this solution for your problem :
select order_status.order_status_id,order_status.name,count(o.order_id) AS no_of_order
from order_status
left outer join `order` o on order_status.order_status_id = o.order_status_id
group by order_status.order_status_id,order_status.name

you can also visit http://sqlfiddle.com/#!9/7efcbe/22


text:
Q: Trying to define method that makes datetime entries by day of week I have a datetime column in one of my tables (team_opps) called start_date.
I am trying to write methods in my model that allow me to classify them as Monday, Tuesday, etc... opportunities.
  def self.friday_team_opps
    where('WEEKDAY(start_date) = ?', 4)
  end

In my view I am trying to call a .each on it.
  <% TeamOpp.friday_team_opps.each do |team_opp| %>
     <%= render team_opp, :team_opp => :team_opp %>
  <% end %>

Error is:
SQLite3::SQLException: no such function: WEEKDAY: SELECT "team_opps".* FROM "team_opps"  WHERE (WEEKDAY(start_date) = 4)

Thanks

A: First of all, you need to define the method on the TeamOpp class by defining the method as def self.friday_team_opps.
Moreover, you can't call methods on the column since it would require ActiveRecord to load all the data in your table and then call the Ruby method on that data. What you can do is use direct SQL functions, like for example MySQL's WEEKDAY (monday = 0, tuesday = 1, etc.):
def self.friday_team_opps
  where("WEEKDAY(team_opps.created_at) = ?", 4)
end

In SQLite, you can use the strftime function (sunday = 0, monday = 1, etc.):
def self.friday_team_opps
  where('strftime("%w", "created_at") = "?"', 5)
end

A: You define it as an instance method
def friday_team_opps

And it should be defined as a class method
def self.friday_team_opps

A: If you want to make it a instance function then you should use it like this
def friday_team_opps
    return self.start_date.strftime("%A")
end

Subsequently you will have to modify your view like this :
<% TeamOpp.select("start_date").each do |team_opp| %>
     <%= team_opp.friday_team_opps() %>
<% end %>


text:
Q: Django select related performance So I am debating whether or not to use Django's select_related or not for performance issues.
In the documentation, it says that this is a "performance booster" because it does not need to query the database anymore, but that would clearly mean it has to store a lot more data locally, which can be exhaustive if you need to do a lot of separate calls for a lot of different users.
What are the pros and cons of performance with Django's select_related? And when should (or shouldn't) it be used?

A: If you dont use select_related or not you will eat memory each time you access a related object, so if you have to access related objects it won't make that much of a difference wrt/ memory usage and can indeed save a lot of db access cost - specially if your db server is not on the same node as your django instance(s). To make a long story short:

*

*as a general guideline: use select_related (with appropriate params to limit what relationships should be followed) when you know you'll need the related object.

*if in doubt, don't try to guess, test and profile (yes it requires quite some infrastructure to do proper testing and profiling here but hey, that's how it is).

My own experience: careful use of select_related can vastly improve execution time, never had a problem with memory but we usually do our best to avoid loading millions of rows when we just need a couple ones (doing proper filtering, slicing etc before the query is actually eval'd).


text:
Q: Installation of RODBC on OS X Yosemite When installing the R package RODBC in RStudio on OS X Yosemite, I get the following error:
configure: error: "ODBC headers sql.h and sqlext.h not found"

This is a common error and indicates that ODBC drivers haven't been installed (iODBC headers aren't included in OS 10.9 hence the separate install required). So, I install unixODBC and confirm that the header files are present in the PATH.
Sys.getenv("PATH") gives me the correct path including where the two files are found.
However, when I try install.packages("RODBC",type = "source") again, the same error persists. Have tested this with iODBC as well as unixODBC.
Are there any other tests I can perform to help diagnose the issue?

A: I got a 404 when calling RODBC_1.3-10.tar.gz so I made a tiny change to the script above and it worked perfectly:
brew update && brew install unixODBC &&   wget "http://cran.r-project.org/src/contrib/RODBC_1.3-11.tar.gz" &&   R CMD INSTALL RODBC_1.3-11.tar.gz

A: I'm using OS X Yosemite 10.10.5, R version 3.2.2. By following below steps, I'm able to make it work.

*

*brew install unixodbc

*brew link unixodbc (if missing this step, R still can not find those header files)

*install.packages('RODBC', type='source')

A: We have a bunch of Yosemite systems with R 3.1.2 that are all up-to-date with Xcode & Xcode command-line tools. The following consistently works with each major R update or new system install (at the Terminal):
brew update && brew install unixODBC && \
  wget "http://cran.r-project.org/src/contrib/RODBC_1.3-10.tar.gz" && \
  R CMD INSTALL RODBC_1.3-10.tar.gz

It (obviously) requires Homebrew, but that's what we've standardized on in our shop.
As RODBC is updated, the version number (1.3-10, 1.3-11, ...) will change.  To find out the current version, look at https://cran.r-project.org/web/packages/RODBC/index.html.

A: On my OS X Yosemite system with unixODBC installed from MacPorts and R 3.3.2,  install.packages() failed (whether from repo or from a tarball I had saved locally) but R CMD INSTALL RODBC_1.3-14.tar.gz did the job.


text:
Q: why my result is 1436189223 ? Please help me explan this result public static void main(String[] args) {

    int[]myArray = new int[5];
    for(int index =0;index<myArray.length;index++)
    myArray[3]=100*myArray[3]*myArray[3]+3;
    System.out.println("myArray[]="+myArray[3]);

}

please help me why myArray[] result is 1436189223

A: Let's go over it step by step (which is what you can do in the debugger as well!!):

*

*int[]myArray = new int[5];: This will be an array {0,0,0,0,0}. An array of size 5, with default int-value 0.

*for(int index=0; index<myArray.length; index++): Loop in the range [0, 5):

*myArray[3] = 100*myArray[3]*myArray[3]+3;: Let's split this into substeps below:

*

*myArray[3] = 100 * 0 * 0 + 3 results in 3

*myArray[3] = 100 * 3 * 3 + 3 results in 903

*myArray[3] = 100 * 903 * 903 + 3 results in 81540903

*myArray[3] = 100 * 81540903 * 81540903 + 3 results in -749594073

*myArray[3] = 100 * -749594073 * -749594073 + 3 results in 1436189223

*System.out.println("myArray[]="+myArray[3]);: Print the value of myArray[3], thus 1436189223.
Some things to note. First of all, why use myArray[3] to begin with.. This would be a simpler alternative, since you don't use the array at all:
int result=0;
for(int i=0; i<5; i++)
   result = 100*result*result+3;
System.out.println("Result: "+result);

But the part where your question is probably mostly about is why 100 * 81540903 * 81540903 + 3 results in -749594073. This is because the maximum int size is 232-1 (2,147,483,647). After that it will wrap around. So int i = 2147483647 + 1 will result in -21474836481 (or more in general Integer.MAX_VALUE + 1 == Integer.MIN_VALUE).
The same applies to other data types, like byte, short, long, etc. Here you can see some of those ranges per data type.
Since long is 64-bit instead of int's 32-bit, it can be used to get the correct result here:
long result=0L;
for(int i=0; i<5; i++)
   result = 100*result*result+3;
System.out.println("Result: "+result);

Try it online.
Or using your original code:
long[]myArray = new long[5]; // <- This is a long-array now
for(int index =0;index<myArray.length;index++)
   myArray[3]=100*myArray[3]*myArray[3]+3;
System.out.println("myArray[]="+myArray[3]);

Try it online.
PS: If you have to go even beyond the size of long, you'll have to use java.math.BigInteger.

A: Its pretty simple actually, your loop runs 5 times. In each iteration it uses the previous values of myArray[3], computes the new value and then the stores that value in the same index.
When :-

index = 0 ; myArray[3] = 3
index = 1 ; myArray[3] = 903
index = 2 ; myArray[3] = 81540903
index = 3 ; myArray[3] = -749594073
index = 4 ; myArray[3] = 1436189223

Also, note that since you have not used brackets around the for-loop, it considers only the next immediate line to be a part of the loop.


text:
Q: - is not different from  in virtual console I rarely use virtual consoles. Thus I just noticed that some of my bash key bindings do not work there. The reason is probably that the key codes (what is shown after pressing Ctrl-V) for Ctrl-→ and → are the same i.e. the Ctrl seems not to be recognized with the arrow keys. The regular Ctrl combinations (C, Z, Y...) do work.

*

*What is the reason for this behaviour?

*How can that be changed?


text:
Q: React component not re-rendering on props object change This simple issue has puzzled me for the last days and I can't seem to find an answer.
Question: Why is my Child component not re-rendering when I click the button?
const Child = ({ data }) => {
  return (

      {data.value}

  )
}

const Parent = () => {
  const [object, setObject] = useState({ value: 0 })

  const handleClick = () => {
    setObject(o => {
      const newObject = o
      newObject.value += 1
      return newObject
    })
    console.log(object)
  }

  return (

      <button onClick={handleClick}>Click me!</button>
      <Child data={object} />

  )
}

I know it has to do with the prop value being passed being an object and React not deep comparing the object to trigger a re-render. But what would be a good pattern here? I would like to keep my data organised in objects.
I can work around the issue by ensuring I set my state to a new object instead of a reference to the same by changing my click handler function to const newObject = { ...o }. But is there a better pattern here?


text:
Q: Teradata-- Qualify with Rank not giving exact results I am stuck in an issue where I want the two latest values of a column(REVISION) based on the max(last_updated_date).
Scenario:
There is a Revision column corresponding to each part column( hardware part). Whenever there is any change in the part, the revision gets changed and the last_updated date also changes. Revision can be anything numbers, alphabets, - _ etc.
Suppose if I have 100 parts and 60 parts do not change and 40 changes. So 40 will have at least two latest revisions. In total there would be 60+40*2=140 parts in the output.
Without using QUALIFY, I am getting more than 5M distinct parts. So at least I should get 5M records(in case when no part has underwent any revision).
SELECT DISTINCT FROM_NAME
FROM(
select
CDR_ODS_R_GE_OBJ_HST .FROM_ID as FROM_ID,
CDR_ODS_R_GE_OBJ_HST .FROM_NAME as FROM_NAME  ,
CDR_ODS_R_GE_OBJ_HST .FROM_REVISION as FROM_REVISION,
max(CDR_ODS_R_GE_OBJ_HST .LAST_UPDATE_DATE) as LAST_UPDATE_DATE
--RANK( )  OVER ( ORDER BY max(CDR_ODS_R_GE_OBJ_HST .LAST_UPDATE_DATE) DESC) AS RANK1
from GEEDW_PLM_ODS_BULK_V.CDR_ODS_R_GE_OBJ_HST CDR_ODS_R_GE_OBJ_HST
--WHERE CDR_ODS_R_GE_OBJ_HST.FROM_name='323A4747UUP15A'
--QUALIFY RANK1<=2
group by 1,2,3
) TM

14728.20721.304.13308(from_id)       R-0331128(from_name)                   -(revision)                     8/7/2013 20:30:02(last_updated date)
But while using qualify <=2 with rank getting only 186 parts.
select
CDR_ODS_R_GE_OBJ_HST .FROM_ID as FROM_ID,
CDR_ODS_R_GE_OBJ_HST .FROM_NAME as FROM_NAME  ,
CDR_ODS_R_GE_OBJ_HST .FROM_REVISION as FROM_REVISION,
max(CDR_ODS_R_GE_OBJ_HST .LAST_UPDATE_DATE) as LAST_UPDATE_DATE
,RANK( )  OVER ( ORDER BY max(CDR_ODS_R_GE_OBJ_HST .LAST_UPDATE_DATE) DESC) AS RANK1
from GEEDW_PLM_ODS_BULK_V.CDR_ODS_R_GE_OBJ_HST CDR_ODS_R_GE_OBJ_HST
--WHERE CDR_ODS_R_GE_OBJ_HST.FROM_name='323A4747UUP15A'
QUALIFY RANK1<=2
group by 1,2,3

In Nutshell, from the below query, i want the top two values for revision 0024 corresponding to the latest 2 updated date.
select FROM_NAME,FROM_REVISION, LAST_UPDATE_DATE
from GEEDW_PLM_ODS_BULK_V.CDR_ODS_R_GE_OBJ_HST CDR_ODS_R_GE_OBJ_HST

0024    301345498360631 1/24/2014 11:22:17
0024    431365606243002 12/16/2013 20:16:44
0024    491333037555534 6/6/2013 18:08:51

A: You need to add a PRATITION BY, otherwise it's ranking over all parts. In your case there where 186 parts with the same max date, all got the same rank 1 and the next rank was 187.
select
   CDR_ODS_R_GE_OBJ_HST .FROM_ID as FROM_ID,
   CDR_ODS_R_GE_OBJ_HST .FROM_NAME as FROM_NAME  ,
   CDR_ODS_R_GE_OBJ_HST .FROM_REVISION as FROM_REVISION,
   max(CDR_ODS_R_GE_OBJ_HST .LAST_UPDATE_DATE) as LAST_UPDATE_DATE
  ,RANK( )
   OVER (PARTITION BY FROM_NAME
         ORDER BY max(CDR_ODS_R_GE_OBJ_HST.LAST_UPDATE_DATE) DESC) AS RANK1
from GEEDW_PLM_ODS_BULK_V.CDR_ODS_R_GE_OBJ_HST CDR_ODS_R_GE_OBJ_HST
--WHERE CDR_ODS_R_GE_OBJ_HST.FROM_name='323A4747UUP15A'
group by 1,2,3
QUALIFY RANK1<=2

Btw, are you sure you need the GROUP BY? Maybe you confused this with the old deprecated RANK syntax where GROUP BY was used instead of PARTITION. This might return the same result more efficiently:
select
   CDR_ODS_R_GE_OBJ_HST .FROM_ID as FROM_ID,
   CDR_ODS_R_GE_OBJ_HST .FROM_NAME as FROM_NAME  ,
   CDR_ODS_R_GE_OBJ_HST .FROM_REVISION as FROM_REVISION,
   CDR_ODS_R_GE_OBJ_HST .LAST_UPDATE_DATE as LAST_UPDATE_DATE
  ,RANK( )
   OVER (PARTITION BY FROM_NAME
         ORDER BY max(CDR_ODS_R_GE_OBJ_HST.LAST_UPDATE_DATE) DESC) AS RANK1
from GEEDW_PLM_ODS_BULK_V.CDR_ODS_R_GE_OBJ_HST CDR_ODS_R_GE_OBJ_HST
--WHERE CDR_ODS_R_GE_OBJ_HST.FROM_name='323A4747UUP15A'
QUALIFY RANK1<=2


text:
Q: send HTML markup from Custom Field to the Email Campaign I have an E-commerce website and is integrated to InfusionSoft
What currently happening is that...
Customer completes an order on my website and purchases, let say 2 products.
Upon Order Completion, Order Received tag is added and customer's info is added to InfusionSoft, and the Order Detail HTML Markup (which is generated on my website via code) is added to a Custom Field, ~_myCustomField~
There is already a campaign running which send simple Thank You Email to customer.
What I want is that I can send the Order Detail(which is stored in ~_myCustomField~) along with the Thank You Email
What I have tried that, I have added the custom field into Campaign's Email just like ~Contact._myCustomField~ but it sends the only HTML, not generated one!
_myCustomField contains for example

     This is your order detail

A: Instead of saving the HTML into a custom field, you can just send the thank you email at that point.
You can use the email service to send an email:
https://developer.infusionsoft.com/docs/read/Email_Service
example:
$title = "template API test";
$category = "API Category";
$fromAddress = "from@infusionsoft.com";
$toAddress = "~Contact.Email~";
$ccAddress = "";
$bccAddresses = "";
$subject = "My Fancy Subject Line";
$textBody = "This is the text email body";
$htmlBody = "HTML"
$contentType = "Contact";
$mergeContext = "";
$tmpId = $app->addEmailTemplate($title, $category, $fromAddress, $toAddress, $ccAddress, $bccAddresses, $subject, $textBody, $htmlBody, $contentType, $mergeContext);

If you want to keep the interaction with the campaign, you can use the goal feature. Learn more about goals here.
You will be after the funnel service to see if a goal has been completed (such as an order) and send the Thank you email at that point.


text:
Q: Testing the validity of a Cox Time-Varying regression model in Python Lifelines Using the lifelines library for python, I've fitted a Cox Time-varying regression to some customer data, to see which coefficients have an effect on customer churn. The dataset is a combination of time-independent and time-dependent variables. The time-dependent variables are measured at the end of each month, for 6 years.
Inspecting the model output, almost 50% of all the coefficients are significant at the 0.05% level, which to me sounds like there are at least some false positives.
While the lifelines library offers a great function for checking the general assumptions for ordinary cox proportional hazard, the CoxTimeVaryingFitter has no such solution. I have also not found any good sources for checking time-varying models in the lifelines documentation or elsewhere.
Is there some general solution or function I could use? If there is a potential solution in R or other statistical software that would also be very helpful!

A: First, don't worry too much about having a lot of "statistically significant" predictors if you have a large data set (as you presumably do with customer churn analysis). With a large enough data set almost any predictor might show a "statistically significant" association with outcome, even if it isn't of much practical significance. That's like the problem with normality testing: with a large enough real-world data set you will in practice tend to find "statistically significant" deviations from normality that don't fundamentally matter.
In terms of validating a model with time-varying covariate values, I don't know many details of what's possible in lifelines, but in principle the tools for evaluating Cox models can be applied to models with time-varying covariates. The problem is that some of those tools implicitly involve making predictions. For example, an optimism bootstrap builds the model on multiple bootstrapped samples of the data and evaluates the models' predictions on the full data set. Predictions with time-varying covariates, however, aren't straightforward and can easily lead to circular reasoning and violations of causality.
The lifelines author has put this quite clearly on another page on this site:

you can't predict for epistemological reasons... To predict, you must have time-varying $X$, that is, $()$. But, if you have $()$, then you must be making measurements on a customer, so they are not dead!

That said, some but not all survival tools in R can nevertheless make predictions from a time-varying covariate model. For example, the Predict() function in the rms package won't handle them, but its survest() function and the standard survival package survfit() function can. The rms validate() function will perform an optimism bootstrap on such a model, although I couldn't readily get its calibrate() function to work.
Standard tools for checking proportional hazards (PH) work with these packages (as I suspect they might in lifelines, as the usual scaled Schoenfeld residuals test for PH just uses model-expected versus observed covariate values at event times and thus doesn't involve event predictions). I don't immediately see a reason why you couldn't use martingale residuals to evaluate the functional form of a continuous time-varying covariate (although I haven't done that myself and might be missing something important).
The question is just what is being predicted or validated. With data and analysis in the (startTime, stopTime, event) counting-process format, these functions evidently treat each line of data as a separate observation, left truncated at startTime with an event or censoring at stopTime. That makes sense from the way that the data are modeled in situations with at most a single event per individual. As the R survival time-dependence vignette (a superb introduction to handling different types of time dependence in Cox models) says near the end of Section 2, in that case:

The likelihood equations at any time point use only one copy of any subject, the program picks out the correct row of data at each time.

So in that situation it makes sense to think about separate data lines as independent (albeit time-limited) observations.
It's possible (if you pay close attention to some data-formatting quirks) to get per-subject predictions from the predict.coxph() function in the survival package. Those seem to be based on predicting for all data rows and then summing all rows associated with a subject, however, so they might not make sense for all types of predictions. I'm not at all sure how well these methods will work with multi-state models involving time-varying covariates, in which intra-subject correlations need to be taken into account.
Finally, be very careful in applying these models to customer churn. A Cox model evaluates covariate values precisely at event times. A covariate associated with the specific time of loss of a customer thus might be like the following reverse-causality situation in clinical survival analysis (Section 3.5 of the vignette):

It is sometimes the case that a covariate measured soon before death is not a predictor of death but rather is simply a marker for an event that is already in progress... A simple example would [be] the time dependent covariate "have called the family for a final visit".

If you are modeling customer churn in an attempt to prevent it in the future, you don't want to be modeling something like the "last straw" that finally pushed the customer to abandon your enterprise. With time-varying covariates, think carefully about what you are modeling, what you are validating, and what you are predicting.


text:
Q: Gibbons-Hawking space is resolution of $\mathbb{C}^2/\mathbb{Z}_k$ I have a question regarding the Gibbons-Hawking construction of Hyperkahler fourfolds. Let ${a_i}\in\mathbb{R}^3, i =1,\dots,k$ be collinear points and construct a Hyperkahler manifold by starting with a circle bundle over $\mathbb{R}^3\setminus\{a_i\}$ and applying the Gibbons-Hawking ansatz. Call the resulting manifold $X$. In a lot of sources I have read it is asserted that $X$ (with a suitable choice of complex structure) is in fact biholomorphic to the minimal resolution of $\mathbb{C}^2/\mathbb{Z}_k$. They usually state that this is shown by plumbing the $(-2)$-curves in a particular way. However, I am not familiar with this argument nor was I able to find any source explaining it thoroughly.
For any further details please see these notes by Andrew Nietzke. In particular, I am interested in the exercise 3.16 (special case of the above question for $k=2$ and $X$ is supposed to be biholomorphic to the cotangent bundle of $\mathbb{CP}^1$) as well as example 3.15.
Any pointer or reference would be very helpful. Thanks.


text:
Q: Filling array with check boxes and sending it to php through http post So I am new to Angular2 and I can't figure this out. I declared an array and fill it up by checking checkbox.  I want to send that array to PHP and use it to fill up a table.
This is my code for filling up the array.
selectedValue:Array<{name:string}>=[];

change(e, type) {
  console.log(e.target.checked);
  console.log(type.users); // users is of type User class that has attribute name

  if(e.target.checked) {
    this.selectedValue.push(type.name);
  } else {
   let updateItem = this.selectedValue.find(this.findIndexToUpdate, type.name);
   let index = this.selectedValue.indexOf(updateItem);
   this.selectedValue.splice(index, 1);
  }
}

findIndexToUpdate(type) {
      return type.name === this;
}

array has a list of names that I check off and now i send it to a method:
 addioassign(){
      this.userService
          .insioassign(this.selectedValue)
          .subscribe();
      }
 }

and in my service class:
insioassign(info){
  return this._http.post("http://localhost/try/api/fill.php", info)
    .pipe(map(() => ""));
}

my php rest api:
<?php

$data1 = json_decode(file_get_contents("php://input"));

include "db.php";

//$report_id = $data1->report_id;
$report_id = '8';

$sql="SELECT Eid FROM employee WHERE name IN ('$data1->name')";
if ($data1->name) {
    $result = $conn->query($sql);
}

if ($result->num_rows > 0) {
    // output data of each row
    $data = array();
    while($row = $result->fetch_assoc()) {
         $data[] = $row;
    }

    echo json_encode($data);
}

$r = count($data);
for($x = 0; $x < $r; $x++) {
    $s = implode('', $data[$x]);
    $sql1 = "INSERT INTO ioassign (report_id, Eid) VALUES($report_id, $s)";
    $result1 = $conn->query($sql1);
}
$conn->close();

PLEASE HELP. I've been on this since the past week and a half. and have found no conclusive answer. I've tried everything I could.