text:
Q: "overapproximate to"? Recently I learned that in English you say things like

*

*The latter was calculated by approximating the surface area to that of a spheroid.

*The only thing approximating to a real dessert was baklava, a particularly mean and thankless example of its kind being dry, almost syrup and nut-free.

(Taken from Oxford's Online Dictionary.)
Note the preposition to.
Now, would you put to into the following sentence (concerning a formal method)?

*

*Our nonrelational program analysis will overapproximate [to] the actual program semantics.

Please don't answer unless you are good at English. (You can move the question to the English community, but to date I have been under the impression that most English teachers are not that aware of the computer science vocabulary. They are typically having a hard time trying to understand the meaning of the above sentence.)

A: In programming languages and computer science, we say "approximate program semantics" or "overapproximate the actual program semantics".  In other words, don't include the "to".
In general, we say "approximate X" (don't include the "to") or "approximation to X" (include the "to").

A: You say "approximate X" when X is the thing that you are approximating. You say "approximate X to Y" when Y is the degree or "destination" of the approximation.
To take a simple example, you might say, "We will approximate the radius of the circle." That is, we won't get a very precise measure of the radius of the circle: we will just get a rough number.
"We will approximate the size of the circle to the nearest the radius of the circle to the nearest inch." We won't get measurements more precise than an integer number of integers. Similarly, "We will approximate the radius to 3 decimal places."
By "destination", I mean that you are using one thing as an approximation of another. For example, you might say, "We will approximate the ellipse to a circle".
We don't always specify X if it's already been identified or is obvious from context. So someone might say, "We will approximate to three decimal places." What are we approximating? Hopefully that is clear from the context.
In your first example, the surface area is not a spheroid. He is approximating to a spheroid. Note that it is not the spheroid that is being approximated, but the surface area.
In your second example, something is being approximated to a dessert. In context, it's clear that the thing that is being approximated is an item of food. This statement is not intended literally. He's saying that none of the food items in question actually IS a dessert, and only one even approximated to being a dessert. Presumably whoever prepared the food would say that of course it is a dessert. The statement here is intended to be an insult. It's not even a bad dessert, it doesn't qualify as a dessert at all.
You would not say that your "analysis will approximate to the actual program semantics", just "analysis will approximate the actual program semantics". The thing being approximated is the semantics. There is not something else that is being compared to the semantics. With the "to", it would sound like you are saying that the analysis is being compared to the semantics, which doesn't make sense to me.


text:
Q: UITextField and keyboard controls checking if field has data I am using BSKeyboard Controls to have a next/previous and done button above the keyboard on login fields for username and password.
What I want to achieve is:
- When one of the fields is blank the done button should say 'Done'
- When both fields have at least one character it should say 'Login'
I understand there are multiple ways to check a textfield contents, hasText isEqualToString !=nil etc. But I am trying to check characters here I guess.
I need to know what would be the best location to put an if statement and which to use.
My fields are
self.usernameField
self.passwordField

My Keyboard control is updated like this:
self.keyboardControls.doneTitle = NSLocalizedString(@"KeyboardControlsDone", @"test");

OR
self.keyboardControls.doneTitle = NSLocalizedString(@"KeyboardControlsLogin", @"test");

Updated Method:
NSString *newText = [textField.text stringByReplacingCharactersInRange:range withString:string];

UITextField *otherTextField;
if (textField == self.passwordField)
{
    otherTextField = self.usernameField;
}
else
{
    otherTextField = self.passwordField;
}

if ([newText length] > 0 && [otherTextField.text length] > 0)
{
    self.keyboardControls.doneTitle = NSLocalizedString(@"KeyboardControlsLogin",@"Button for Keyboard Controls on Login page");
} else {
    self.keyboardControls.doneTitle = NSLocalizedString(@"KeyboardControlsDone", @"test");
}

A: You can implement textField:shouldChangeCharactersInRange:replacementString: of UITextFieldDelegate to execute whatever you want when the user enters a key.
Something like this:
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
    NSString *newText = [textField.text stringByReplacingCharactersInRange:range withString:string];

    UITextField *otherTextField;
    if (textField == self.passwordField)
    {
        otherTextField = self.usernameField;
    }
    else
    {
        otherTextField = self.passwordField;
    }

    if ([newText length] > 0 && [otherTextField.text length] > 0)
    {
//        Your code
    }
    return YES;
}

EDIT
Instead of using that delegate method,use the event editing changed. You have to set the action for that event with IB or by code, and it would look like this:
- (IBAction) textFieldEditingChanged
{
    if ([self.usernameField.text length] > 0 && [self.passwordField.text length] > 0)
    {
        self.keyboardControls.doneTitle = NSLocalizedString(@"KeyboardControlsLogin",@"Button for Keyboard Controls on Login page");
    } else {
        self.keyboardControls.doneTitle = NSLocalizedString(@"KeyboardControlsDone", @"test");
    }
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to get Vi to insert a column of characters? If I have the following code where the dots (.) are spaces,
....def foobar():
........foo = x
........bar = y

how do I get Vim to insert a pound (#) and a single space in the same column on each row like this:
....#.def foobar():
....#.....foo = x
....#.....bar = y

I know I can hit ^v to enter column insert mode and then I can hit the "j" key twice to select the following two rows in that same column, but all the articles I've read on this say you should then hit the "I" key to enter insert mode.  However, when I do that, I only go into insert mode of the first line, not all three lines.  What am I missing?  Incidentally, I don't want to have to count the spaces and do a substitution command.  I know I can do that.  There has to be an easier way.
Thanks.

A: :1-3s/^.../^...#./

From lines 1 to 3 (adjust for your own purposes), replace (s command) three spaces at the start of the line by three spaces, a # and an extra space.

A: Every command you`ll try there will modify the actual line, or a set of line doing a command (like the other answer shows).
The other way might be a substitution, like :
:map z /....ˆM4s...#ˆ[
(ˆM is CTRL-V M to sinalize an Enter, and ˆ[ is CTRL-V Escape, to end substitution)
After mapping 'z' you may press 'z'in each line you want.


text:
Q: Implied Prepositions I am working on documentation for some work stuff.  A reviewer has told me to change this:

Decisions made by the CAB apply to all members of ETG and non-ETG employees that participate in ETG processes.

to this:

Decisions made by the CAB apply to all members of ETG and to non-ETG employees that participate in ETG processes.

Now, in my mind both are correct.  "To" can be implied.
Am I correct?  What do style guides such as APA and MLA say about this?

A: This is not the sort of thing that style guides typically address. It is rather a matter of making it as easy as possible for your reader to understand what you are saying, and as hard as possible to misunderstand it.
Your original version is in no way ungrammatical. But it does lead readers, briefly, down a 'garden path'. As they process the sentence from left to right they are very likely to take the sequence ETG and non-ETG as a conjunct attributive nominal which will be followed by a noun they modify†—perhaps something like:

Decisions made by the CAB apply to all members of ETG and non-ETG organizations ...

The readers are of course quickly disabused of this notion by what actually does follow, and all is well. But this does require them to pause, back up, and re-parse, which is vaguely annoying.
Inserting the to makes your structure unambiguously clear and more easily processed, and it removes a possible source of vexation. It informs readers that you are more concerned with conserving their effort than your own. That's a great gain at the very low cost of typing three more characters.

† If this seems far-fetched to you, it's because you already know what you mean; it's exactly what happened to me reading it cold, and I knew exactly what it wanted before I finished the sentence and got to your reviewer's correction.


text:
Q: Table data is break into new page, even though it still fits
few days ago, it returns normally, the table data doesn't break into new page, but recently it return like this. Is there any cause for this to happen?


text:
Q: Laravel Carbon dates not getting modified in Seeder In a Laravel Seeder, I am trying to take a Faker generated date, convert it to Carbon and then grab two dates that are just a few hours apart to represent a 4 hour session. For example,
Start Date: 03/13/2016 12:00PMEnd Date: 03/13/2016 5:00PM
Below is what I've landed on, but both the $start and $end variable are always the same.
            for ($k = 0; $k < $jobAssignmentCount; $k++) {
                $randomDate = $faker->dateTimeBetween($job->starts_at, '+6 months');
                $dateTime = Carbon::instance($randomDate)->minute(0)->second(0);
                $start = $dateTime;
                $end = $dateTime;
                $end->addHours(4);
                $jobAssignment = JobAssignment::create([
                    'job_id' => $job->id,
                    'starts_at' => $start,
                    'ends_at' => $end,
                    'assignment_notes' => 'Assignment Notes',
                    'is_cancelled' => $faker->boolean(10),
                    'cancelled_at' => $faker->dateTimeBetween('+6 months', '+1 year'),
                    'cancelled_by_profile_id' => $profile->id,
                    'is_billable' => $faker->boolean(75),
                ]);
            }

A: Try to do it like this: $end = $end->addHours(4); or clone it first.

A: I think it is because both $start and $end are referencing the same Carbon object. Try creating two different $dateTime objects - $startDateTime and $endDateTime - seeded a few hours apart and reference those to $start and $end, respectively.

A: You're assigning $start and $end to the same object, $dateTime. Since they're all the same object, when you change one, the other will change as well. The easiest thing will be to clone the object and then addHours() to the clone:
$start = Carbon::instance($randomDate)->minute(0)->second(0);
$end = clone $start;
$end->addHours(4);

Now you should have two different objects, a $start and an $end, with times that are 4 hours apart.


text:
Q: Apply Validation in angular 4.0 textbox control I am having a component named numeric textbox i have to apply a validation of required filed  time of button click
here is my component.
@Component({
    selector: 'numeric',
    templateUrl: './numeric.template.html'
})

and here is my control.
<input type="number" id="{{id}}"  [(ngModel)]="NumericVal" min="{{min}}" max="{{max}}" value="NumericVal" />{{NumericVal}}

validation means when i click on a button then a css is appiled over text box in red color.
So can this done?
I will be very thankful to you.

A: In your case, the simplest is
<input
  type="number"
  [id]="id"
  [(ngModel)]="NumericVal"
  [class.required]="!NumericVal"
  [min]="min" [max]="max" />

But I would advise using reactive forms. Since you don't use them and are not asking for help on it, I will let you read the documentation on that.


text:
Q: How to properly test pcollection length when unit testing Apache Beam I am wondering which is the best way to test check the lenght of the output produced by a beam pipeline.
I have some testcode like this:
test_data = [
    {'kind': 'storage#object', 'name': 'file1.doc', 'contentType': 'application/octet-stream', 'bucket': 'bucket123' },
    {'kind': 'storage#object', 'name': 'file2.pdf', 'contentType': 'application/pdf','bucket': 'bucket234'},
    {'kind': 'storage#object', 'name': 'file3.msg', 'contentType': 'message/rfc822', 'bucket': 'bucket345'}
]

with TestPipeline() as p:
   output = (p
             | beam.Create(test_data)
             | beam.ParDo(DoFn_To_Test()).with_outputs('ok','error')
   )

I want to test sure that all elements in the test_data list go to 'output.ok'.
I think way to do it is to count them like this:
with TestPipeline() as p:
   output = (p
             | beam.Create(testdata)
             | beam.ParDo(DoFn_To_Test()).with_outputs('ok','error')
   )

   okay_count = (output.ok | beam.Map(lambda x: ('dummy_key',x))
                 | beam.GroupByKey()  # This gets ('dumm_key',[element1,element2....])
                 | beam.Map(lambda x: len(x[1]) )  # Drop the key and get the lengh of the list
   )

   # And finally check^H^H^H^H^H^H assert the count is correct:
   assert_that(okay_count, equal_to([len(test_data)])

This works; but I don't feel this is the best way to do it, and I am sure there are more ways to do it.
Best option (by now)
This is the best option suggested up to date: using beam.combiners.Count.Globally()
with TestPipeline() as p:
   output = (p
             | beam.Create(testdata)
             | beam.ParDo(DoFn_To_Test()).with_outputs('ok','error')
   )

   okay_count = output | beam.combiners.Count.Globally()
   assert_that(okay_count, equal_to([len(test_data)])

A: You answered your own question in the the question. Writing it here as an answer:
with TestPipeline() as p:
   output = (p
             | beam.Create(testdata)
             | beam.ParDo(DoFn_To_Test()).with_outputs('ok','error')
   )

   okay_count = output | beam.combiners.Count.Globally()
   assert_that(okay_count, equal_to([len(test_data)])


text:
Q: Columns display as rows on window resize I'm making a responsive web page using bootstrap.  It works as intended when the browser window is >= 50% of the screen size.  I have some column elements nested inside of a column element, which is nested inside a row element.  So, there are 3 children columns of each row, and then 4 children columns for each column.  The problem may be occurring because I have a column nested inside of a column, but if that were the case then wouldn't it display incorrectly when the browser is full screen, too?
When the window shrinks to less than 50% of the screen size, the most nested columns display as rows.  I don't understand why this is happening.

{{foo.name}}

{{foo.type[0].fuzz}}

{{bar.name}}

In simpler terms, the bars aren't being displayed as columns when the window size is < 50% of the screen.

A: The col-md-* bootstrap classes only apply at a media query breakpoint where the window width is greater than or equal to 992px. As others have stated, you will need to use col-xs-* as that is the default class used.
You can read more here: http://getbootstrap.com/css/#grid. As a best practice, you would typically wrap the maximum number of columns that could constitute a row in a div with the class row; however, that may not be your specific problem in this case. In most cases this is the set of elements with the lowest number (n) (col-*-n) that add up to 12 if you are using the default grid settings.
Some examples using your .bar classed elements:
4 columns of .bar elements on all devices:

3 columns of .bar elements on extra small devices up to medium devices (992px in width) at which point 4 columns will display:

2 columns of .bar elements up to medium devices, then 4 columns per row:

And finally 1 .bar element per row up to medium devices, then 4 columns per row:

A: You need to have a div within the larger column with class row.  Then you need to know that if  you are going to subdivide the larger columns, the way bootstrap works is that you would have up to 12 subdivisions, but with a smaller col, something like col-sm-12.  But I am not too sure on all this.  I have read and reread those bootstrap grid descriptions, and I am still trying to make sense of them.

A: You've set the size only for md. You haven't set xs/sm/lg.
The default breakpoints for bootstrap are 768px, 992px and 1200px.
I suppose you have a HD Monitor the md-breakpoint is about half the screensize and the view will swith to sm ignoring col-md-x and using col-sm-x
Note: If nothing else set also set col-xs-12 to prevent weird behavior


text:
Q: why does my audit ban increase despite passing dozens of audits since my last failure? Ask Ubuntu user here.
Recently I was banned for 7 days from reviewing. I know that particular post was audit and I clicked on Edit
( I know it was better to use delete than edit- but I thought I can use  Edit button for such audits to pass )
Previously I was banned for 2 days. After that till today I am sure I passsed dozens of audits and no single audit fail
My question:
Why the ban has increased from 2d to 7d, even I passed  dozens of audits since my last failure ?
Ban for only single audit fail ?


text:
Q: Generate QR code with a TAB key How to generate a QR code with a tab key embedded in it using Excel or Google sheets?
Below I have combined data from 5 cells into one cell by using:
=CONCATENATE(C16, CHAR(9), C17, CHAR(9), C18, CHAR(9), C19, CHAR(9), C20)

How would I generate QR code for this this cell named C25? The cells have text with spaces in them.
This will work for one cell WITHOUT tabs in Google sheets:
=if(isblank(C25),"",
  image("https://chart.googleapis.com/chart?chs=200x200&cht=qr&chl="&
    SUBSTITUTE(C25," ","%20")
  )
)

A: Try changing CHAR(9) to "%09" (with quotes) in CONCATENATE then replace qr&chl="&SUBSTITUTE(C25," ","%20") with qr&chl=C25).


text:
Q: Node.js: initiate pg.Pool() As per example (db.js)
const pg = require('pg');

const client_config = {...};

const pool = new pg.Pool(client_config);

pool.on('error', function(err, client) {
  console.error('idle client error', err.mesae, err.stack);
});

module.exports.query = function(text, values, callback) {
  return pool.query(text, values, callback);
};

module.exports.connect = function(callback) {
  return pool.connect(callback);
};

and within an express (generated) application, do I have to initiate/require the Pool (db.js) in my app.js/on app start-up or do I simply require the db.js within my data models (respectively required in my routes)? Intuitively I would initiate the Pool on start-up rather than on each connection to the routes to avoid multiple initiations, but I am fairly new to Node.js.

A: Scroll a little further -- there are usage examples.
The reason this works is thanks to Node's module caching. The first time db.js is required, all the init code executes immediately. Subsequent require calls return the already-initialized module from the cache so the pool is already connected. In Express, you can avoid requiring db.js all over the place by using app.set('db', db); to attach the module to the Express application. You can then invoke req.app.get('db').query(...) in your route code.
If your data needs are complex enough to involve models, you may want to look into higher-level data access libraries since pg is more of a driver (think JDBC if you've done any Java). There are a lot of options ranging from minimal data mappers (I maintain MassiveJS) to query builders (Knex) to full-scale ORMs (Sequelize).


text:
Q: The expansion of $(1+\frac{1}{n})^n$, explanation needed. Here is the binomial expansion: $$(1+\frac{1}{n})^n=\frac{n\cdot\frac{1}{n}}{1!}+\frac{n(n-1)(\frac{1}{n})^2}{2!} +
     \frac{n(n-1)(n-2)(\frac{1}{n})^3}{3!}+ ... + \frac{n(n-1)(n-2)...(n-(n-1)(\frac{1}{n})^n}{n!}=1+1+\frac{1}{2!}(n^2-n)(\frac{1}{n})^2+\frac{1}{3!}\frac{(n^2-n)}{n^2}\frac{(n-2)}{n}+...+\frac{1}{n!}\frac{(n^2-n)}{n^2}\frac{(n-2)}{n}$$
I don't understand why $(\frac{1}{n})^3$ and $(\frac{1}{n})^n$ has disappeared and instead theeach multiplier is divided by $n^2$ and $n$. Can someone explain?

A: Actually, what you wrote has so many mistakes that it is better to start all over again.
You have\begin{align}\left(1+\frac1n\right)^n&=\binom n0+\binom n1\frac1n+\binom n2\left(\frac1n\right)^2+\binom n3\left(\frac1n\right)^3+\cdots+\binom nn\left(\frac1n\right)^n\\&=1+n\frac1n+\frac{n(n-1)}{2!}\cdot\frac1{n^2}+\frac{n(n-1)(n-2)}{3!}\cdot\frac1{n^3}+\cdots+\frac{n!}{n!}\cdot\frac1{n^n}\\&=1+1+\frac1{2!}\frac{n-1}n+\frac1{3!}\frac{n-1}n\frac{n-2}n
+\cdots+\frac1{n!}\frac{n-1}n\frac{n-2}n\cdots\frac1n.\end{align}


text:
Q: Table columns have incorrect sizes in a popup My aim is to simply implement fixed header on table with my thead and tbody to be scrollable.
My HTML code:

                                A
                                B
                                C
                                Can View Can View Can View
                                Can Insert
                                Can Delete

Script:

In the above code thead and tbody is coming dynamically from other js.
Note : No inline styling is done to any thead and tbody or th or tr or td.
And the scrolling is possible but on pop up when the thead appears at the first time width of thead doesn't come according to t body but when i resize the window using mouse everything works fine. Why?
What I have done is I have given a fixed width to thead  but it doesn't apply. I have also used !important but none works.

A:
SOLUTION

You need to use columns.adjust() API method once table becomes visible to recalculate the column widths.
$('#abc').DataTable().columns.adjust();

From the manual:

This method is provided to have DataTables recalculate the columns sizes, based on the data in the table and the size applied to the columns (in the DOM, CSS or through the columns.width parameter). Call it when the table becomes visible if hidden when initialised (for example in a tab) or when the data changes significantly.
DataTables will automatically call this method on the window resize event to keep the columns in sync with the re-flowed layout.


text:
Q: how to break parent function based on a child outcome in google app script? How can I break the parent function depending from a child function's outcome as a way of checking everything in case something is not ok in a child function? I currently have the following:
function Parent() {
  Step1();
  Step2();
  Step3();
}

and I would like to break the parent function if child function "Step1()" is not completed, for example.
I thought I could create a global variable as a flag, combined with an if statement within the parent function such that if the flag would change from "true" to "false" within the child function, the whole parent function would break, but this didn't work giving an error saying the "break is illegal". This is what I tried:
var flag = "true" // Global variable

function Parent() {
  Step1(); //Within this child function, I have an "if" condition that sets flag "true"/"false" depending on the outcome

     if (flag == "false") { //I was hoping this would read the incoming flag and trigger a break, if the flag was set to "false" in Step1();
     }

  Step2();

  Step3();
}

Right now my script goes through all child functions even if Step1() is incorrect, and without a way to stop this sequence, I'll just keep getting undesirable results from the parent function.
I also thought that if I used "break;" at any point in the whole .gs file it would break the whole thing but it's not the case. If I run Step1() on its own and the "if" conditions activate the "break;"  it breaks succesfully, but when I run the parent function it just keeps going onto the next function.
Thanks,
Nestor

A: apply blow logic
   let flag = true;
    function(){
        if (flag == "false") {
            "false" in child1();
            goto lineContinue
         }

     child2();
     child3();

    }

    lineContinue: child4();

A: To successfully break, add a return

The return statement ends function execution

if (flag == "false") { return; }

Alternatively, you could throw a error or play with try...catch
Live snippet:

let flag = 0;
function main() {
  console.info("main1");
  function step1() {
    console.info('step1');
    flag = 1;
  }
  function step2() {
    console.info('step2');
  }
  step1();
  if (flag) return; //stops execution
  step2();
}

function main2() {
  console.info("main2");
  function step1() {
    console.info('step1');
  }
  function step2() {
    console.info('step2');
    throw new Error('Step 2 fatal error');
  }
  function step3() {
    console.info('step3');
  }
  try {
    step1();
    step2();
    step3();
  } catch (e) {
    console.error(e.message);
  }
}
main();
main2();


text:
Q: Setting a table to display: block I like to get my table behave like a block element. I cannot set it to width:100% because it does have some padding, this is going to result 100% + the paddings PX.
Check out: http://jsfiddle.net/LScqQ
Finally the table does what I want, can you see the box-shadow? But the table children don't like it that way^^
I guess the TH inside the THEAD are the problem.
They do not get the aspected ratio of 66% to 33%.
Help wanted...

A: Your table should be display: table. If you're worried about the sizing, use box-sizing: content-box.
The reason is that display: table creates the table layout mechanism the rows and columns need to be laid out; in certain conditions if the required elements aren't there, they will be implicitly created, but it can cause problems. (You can test that out by making a table layout with divs and setting them to display: table, table-row, table-cell, which are the default user agent styles for table, tr, and td elements. If you play around with unsetting the styles on the divs in different combinations, you'll see that sometimes the browser implicitly makes the table layout incorrectly.)
So, always leave the display: table-* styles intact if you want an actual table layout. Sort out your width issues using the appropriate styles for that. If you describe better what you want, maybe you can get a better answer.

A: Finally I found the answer by myself.
Put your table inside a wrapper container and write a CSS rule similar to this:
//HTML

...

//CSS
.wrapper-table > table
{
    width: 100%;
}

Now the table will no longer overflow your layout and fits perfectly like most elements do.


text:
Q: Nested loop using iterator C++ Stuck in very interesting problem.
You might have done this before in C/C++
map<string, string> dict;
dsz = dict.size();

vector<string> words;
int sz = words.size();

for(int i = 0; i < sz; ++i)
{
   for(int j = i + 1; j < dsz; ++j)
   {
   }
}

How I will achieve the same thing using iterator.
Please suggest.

A: Your final intent is not fully clear, because you start the j loop on i+1 (see comments at the end).  Until you give clarity on this relationship,  I propose you two interim solutions
Approach 1:  easy and elegant:
You use the new C++11 range based for().  It makes use of an iterator starting with begin() and going until end(), without you having to bother with this iterator:
for (auto x : words)  {    // loop on word  (size sz)
    for (auto y : dict) {  // loop on dict (size dsz)
        // do something with x and y, for example:
        if (x==y.first)
            cout << "word " << x << " matches dictionary entry " << y.second << endl;
    }
}

Approach 2:  traditional use of iterators
You cas also specify explicitely iterators to be used.  This is a little bit more wordy as the previous example, but it allows you to choose the best suitable iterator, for example if you want constant iterator like cbegin() instead of begin(), if you want to skip some elements or use an adaptator on the iterator, suc as for example reverse_iterator,  etc.:
for (auto itw = words.begin(); itw != words.end(); itw++) {
    for (auto itd = dict.begin(); itd != dict.end(); itd++) {
        // do simething with *itw and *itd, for example:
        if (*itw == itd->first)
            cout << "word " << *itw << " matches dictionary entry " << itd->second << endl;
    }
}

Remarks:
The starting of intter loop with j=i+1 makes sense only if elements of word vector are related to elements in dict map (ok, they are cerainly words as well), AND if the order of elements you access in the map is related to the order in the vector. As map is ordered according to the key, this would make sense only word would be ordered as well following the same key. Is it the case ?
If you'd still want to skip elements or make calculation based on distance between elements , you'd rather consider the second approach propose above.  It makes it easier to use distance(itw, words.begin()) which would be the equivalent of i.
However, it's best to use containters taking advantage of their design.  So instead of iterating trough a dictionaly map to find a word entry, it's better to do use the map as follows:
for (auto x : words)  {    // loop on word  (size sz)
    if (dict.count(x))    // if x is in dictionary
        cout << "word " << x << " matches dictionary entry " << dict[x] << endl;
}

A: Ok.
I figure it out.
more precisely I wanted both i and j in inner loop.
here i did with iterator, sorry I have to move to multimap instead of map due to change in requirement.
vector<string>::iterator vit;
multimap<string, string>::iterator top = dict.begin();
multimap<string, string>::iterator mit;
for(vit = words.begin(); vit != words.end(); ++vit)
{
  string s = *vit;
  ++top;
  mit = top;
  for(; mit != dict.end(); ++mit)
  {
    /* compare the value with other val in dictionary, if found, print their keys */
    if(dict.find(s)->second == mit->second)
      cout << s <<" = "<< mit->first << endl;
  }
}

Any other efficient way to do this will be grateful.


text:
Q: Выбор системы храненея таблиц, целесообразность и суть использования индексов и внешних ключей MySQL Здравствуйте.
Недавно начал изучать MySQL. И тут же столкнулся с довольно не простыми на мой взгляд вопросами. Например, у меня стоит задание создать базу данных "универ".
Есть таблици:

*

*students (id, name, patronymic, surname, faculty, course, phone_number, m_id(mothers.id), f_id(fathers.id), gr_id(groups.id));

*groups (id, name);

*mothers (id, name, patronymic, surname, job, phone_number);

*fathers (id, name, patronymic, surname, job, phone_number);

*teachers (id, name, surname);

*disciplines (id, name);

*marks (id, st_id(students.id), d_id(disciplines.id), t_id(teachers.id), mark);

Во - первых, если, к примеру, о родителях студента есть информация о маме, а родители в разводе, тогда f_id будет NULL? Вообще если ставить значение поля m_id или f_id, каким их лучше ставить. ведь если INT NOT NULL, выходит при отсутствии информации об одном из родителей поле не может пустовать?
Какую систему хранения лучше выбирать для таблиц. Ведь, если я понял целесообразнее будет выбрать InnoDB, может она и уступит по скорости работы с SELECT, но я смогу использовать для таблиц ON UPDATE CASCADE, ON DELETE CASCADE? Тут возникает новый вопрос, а какая разница между CASCADE и RESTRICT (CASCADE обновляет значения в
дочерних таблицах при изменении или удалении записей в родительских таблицах, а RESTRICT - при изм. или удалении в род., ничего не меняет в дочерней, если значения род. уже используются в дочерней. Смысл использовать RESTRICT, когда CASCADE автоматически обновит или удалит записи в род. и дочерней таблицах)?
Не совсем понятно что такое индексы и нужны ли они мне в данной БД. Насколько я понял, индекси групируют записи по определенным значениям в разных кластерах диска и ускоряют поиск,но это ведь не внешние ключи? Правильно ли я понимаю, что внешние ключи связывают таблици, а индексы групируют записи в таблицах?????
Корректно ли с точки зрения специалистов в области администрирования БД, данная структура и ответьте пожалуйста, стоит ли применять индексы мне и вообще что следует сделать. Информацию читал с разных сайтов.
Просьба не писать, что ТС дурак, голосовать против и говорить, что вопросы надо было разбить на отдельные. Я считаю, что все они связаны и разбивать их не имеет смысла. Заранее спасибо.

A: *

*У человека могут отсутствовать и один и оба родителя. Поэтому ссылка на родителей не может иметь флаг NOT NULL

*InnoDB если нет других требований (например, может понадобиться MEMORY). Если Вы сомневаетесь какой движок использовать - используйте InnoDB

*RESTRICT/CASCADE/SET NULL Рассмотрим Ваш пример с оценками. При удалении студента (выгнали) его оценки никого не интересуют, поэтому их можно удалять каскадно (CASCADE). Нельзя удалить предмет, если студент по нему имеет оценку (RESTRICT). При удалении учителя (уволился) мы можем сбросить на него ссылку при этом сама оценка останется (SET NULL)

*Индексы. Представьте, что перед Вами два шкафа с книгами. В одном книги отсортированы по алфавиту (индексированы), а в другом стоят как попало. В каком шкафу Вы быстрее найдете книгу? При создании внешнего и первичного ключа индексы на эти поля создаются автоматически. Индекс создается на конкретное поле. И одно поле в таблице может быть проиндексировано, а второе нет. Соответственно будет разное выполнения запроса где в условии запроса или сортировке стоит одно поле и другое

*По структуре таблиц у меня одно замечание: т.к. таблицы mothers и fathers ничем не отличаются, то их нужно слить в одну таблицу parents


text:
Q: Null on VideoView I am making a video player that will stream a video from a server. I have checked so the video url is right and works! It is really late and all so I have probably missed something but why is this
VideoView videoView = (VideoView) view.findViewById(R.id.videoView);
    Uri video = Uri.parse("www.xxx.xxx/video.mp4");
    videoView.setVideoURI(video);
    videoView.start();

giving me this error
08-11 02:14:25.217  12390-12390/com.shredacademy.guitarmethodsintroductiontotheory E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.shredacademy.guitarmethodsintroductiontotheory, PID: 12390
    java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.VideoView.setVideoURI(android.net.Uri)' on a null object reference
            at com.shredacademy.guitarmethodsintroductiontotheory.videoC.onViewCreated(videoC.java:56)
            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:973)
            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1138)
            at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:740)
            at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1501)
            at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:490)
            at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:141)
            at android.support.v4.view.ViewPager.populate(ViewPager.java:1105)
            at android.support.v4.view.ViewPager.populate(ViewPager.java:951)
            at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1473)
            at android.view.View.measure(View.java:17562)
            at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:728)
            at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:464)
            at android.view.View.measure(View.java:17562)
            at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5536)
            at android.widget.FrameLayout.onMeasure(FrameLayout.java:436)
            at android.support.v7.internal.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:124)
            at android.view.View.measure(View.java:17562)
            at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5536)
            at android.support.v7.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:444)
            at android.view.View.measure(View.java:17562)
            at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5536)
            at android.widget.FrameLayout.onMeasure(FrameLayout.java:436)
            at android.view.View.measure(View.java:17562)
            at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5536)
            at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436)
            at android.widget.LinearLayout.measureVertical(LinearLayout.java:722)
            at android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
            at android.view.View.measure(View.java:17562)
            at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5536)
            at android.widget.FrameLayout.onMeasure(FrameLayout.java:436)
            at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2871)
            at android.view.View.measure(View.java:17562)
            at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2015)
            at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1173)
            at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1379)
            at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1061)
            at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5891)
            at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
            at android.view.Choreographer.doCallbacks(Choreographer.java:580)
            at android.view.Choreographer.doFrame(Choreographer.java:550)
            at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
            at android.os.Handler.handleCallback(Handler.java:739)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5289)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)

A: videoView is null because your parent view (view) doesn't have a VideoView that matches the resource id in R.id.videoView, so calling view.findViewById(R.id.videoView) returns null.
I noticed in your exception log that you are using ViewPager. Remember that, in order to access the fragment views, you should inflate the layout on the fragment before your findViewById:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    return inflater.inflate(R.layout.fragment_recyclerview, container, false);
}

If you are sure your view is the correct cointainer for the VideoView, find the layout to which your view object is pointing to and add:
<VideoView
    android:id="@+id/videoView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" />

Then VideoView videoView = (VideoView) view.findViewById(R.id.videoView) should now correctly return the declared view and inflate your videoView.
If your VideoView should be located somewhere else, then you have to inflate the videoView from it's correct parent:
VideoView videoView = (VideoView) viewThatContainsVideoView.findViewById(R.id.videoView);
Hope this helps.

A: I am assuming that the view videoView exists in a layout file or it would be throwing a compile error. Where may I ask is the above code? And can you post additional context?
Know that setContentView(R.layout.your_layout_id) needs to be called to set the layout before you can call findViewById(), otherwise that call will return nothing but null.


text:
Q: friend combination A class has 100 students.Let $a_i$,1$\leq$i$\leq100$,denotes the number of friends the i-th student has in the class.For each 0$\leq$j$\leq$99,let $c_j$ denotes the number of students having at least j friends.Show that $\sum_{i=1}^{100}${$a_i$}
=$\sum_{j=0}^{99}${$c_j$}

A: There's an issue with your summation indices. You likely want

 $$ \sum_{i=0}^{100} a_i = \sum_{j=1}^{99} c_j $$

(Fill in the gaps as needed. If you're stuck, write out your working and thought process to demonstrate where you're at.)
Hint: If a person has exactly $k$ friends, then they have at least $1, 2, \ldots k$ friends.


text:
Q: Error PHP CodeIgniter Message: session_start(): Cannot send session cookie Me sale este error en mi sitio de PHP esta montado en CodeIniter
ya cheque los controladores que no falten signos o tengan espacio.
Y no se ya por donde buscar estoy usando PHP 7
A PHP Error was encountered
Severity: Warning
Message: session_start(): Cannot send session cookie - headers already sent by (output started at /home/lckmx/public_html/application/config/autoload.php:1)
Filename: Session/Session.php
Line Number: 140
Backtrace:
File: /home/lckmx/public_html/index.php
Line: 293
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/lckmx/public_html/application/config/autoload.php:1)
Filename: Session/Session.php
Line Number: 140
Backtrace:
File: /home/lckmx/public_html/index.php
Line: 293
Function: require_once

A: en la carpeta application/config/ existe un archivo llamado autoload en el cual puede cargar librerías como la session esto se realiza de esta forma
$autoload['libraries'] = array('session');

cualquier cosa estare al tanto, de todas formas mas informacion no esta demás y ayudaría a resolver el problema de forma mas rapida


text:
Q: How to add an option to specific cvs command used by Eclipse? I'd like to add -q option to cvs update command which is run after I choose Team/Update from the context menu in Eclipse. I don't see any option to do this in Preferences/Team/CVS. How can I do this?
UPDATE
Duncan Krebs is his answer notes that setting such options for standard cvs is possible by using .cvsrc configuration file. However Eclipse uses it's own Java implementation of cvs and it looks like it does not honour settings in .cvsrc file. I asked on Eclipse Forums as well.
I use Eclipse Indigo Service Release 2 (Build id: 20120216-1857) on Windows Vista SP2 x64.

A: I don't think its possible to do that in eclipse with any preference setting. However, you can modify the cvs configuration file to add default options to commands here are some examples:
The `~/.cvsrc' file is a way that you can add default options to cvs_commands within cvs, instead of relying on aliases or other shell scripts.
The format of the `~/.cvsrc' file is simple. The file is searched for a line that begins with the same name as the cvs_command being executed. If a match is found, then the remainder of the line is split up (at whitespace characters) into separate options and added to the command arguments before any options from the command line.
If a command has two names (e.g., checkout and co), the official name, not necessarily the one used on the command line, will be used to match against the file. So if this is the contents of the user's `~/.cvsrc' file:
log -N
diff -u
update -P
checkout -P
the command cvs checkout foo' would have the-P' option added to the arguments, as well as `cvs co foo'.
So I would suggest adding this
update -q
to that file which eclipse should then by default append. Hope that works. - Duncan


text:
Q: Codeigniter how can I make this route work I've looked around in the documentation and a few other places and I am not sure how to achieve the results I want. I have a domain name set up that will only server public profile pages to visitor. When someone comes straight to the site I want it to display a welcome screen telling more about what the website is about. (example.com) When someone visits example.com/my-public-page   I want it to run a default controller that grabs the 'my-public-page from the url, searches the database for a user with that info in a column and displays their info.
I would image that I just set the default_controller to my controller and then check for a second string in the url. If its present search for that in the database. After looking around I am not sure how to make this work and not sure what to search for to get the results I need.
Thanks for your help,

A: After defining an encryption key for sessions in config.php you can use something like this:
   class Wellcome extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this -> load -> library('session');
        if(!$this->session->userdata('visit_time')) {
        $this->session->set_userdata('visit_time', time());
        redirect('first_visit');
        }
    }

}


text:
Q: How to create a new variable that assigns consecutive numbers for cases with same combination of values on other variables I have a dataset with 110 participants who answered the same questionnaire in multiple sessions within three timeframes. The number of sessions per timeframe differs within and between participants.
I need a new variable that assigns consecutive numbers to the sessions a participant X completed the questionnaire within the timeframe Y from 1 to (number of sessions participant X completed the questionnaire within timeframe Y).
Example: I have
participant  timeframe    date
        1     1     2021-04-30 09:12:00
        1     1     2021-04-30 10:03:00
        1     1     2021-05-02 09:20:00
        2     1     2021-04-30 13:00:00
        2     1     2021-05-02 12:13:00
        1     2     2021-05-05 08:34:00
        1     2     2021-05-06 14:15:00
        2     2     2021-05-05 07:12:00
        2     2     2021-05-05 14:13:00
        2     2     2021-05-08 15:22:00

I need:
 participant   timeframe        date                session per timeframe
        1         1      2021-04-30 09:12:00                  1
        1         1      2021-04-30 10:03:00                  2
        1         1      2021-05-02 09:20:00                  3
        2         1      2021-04-30 13:00:00                  1
        2         1      2021-05-02 12:13:00                  2
        1         2      2021-05-05 08:34:00                  1
        1         2      2021-05-06 14:15:00                  2
        2         2      2021-05-05 07:12:00                  1
        2         2      2021-05-05 14:13:00                  2
        2         2      2021-05-08 15:22:00                  3

Hope that somebody can help! Thank you so much in advance.

A: Here is a tidyverse approach using row_number():
library(dplyr)
library(tibble)

dat <- tribble(~participant,  ~timeframe,    ~date,
        1,     1,     "2021-04-30 09:12:00",
        1,     1,     "2021-04-30 10:03:00",
        1,     1,     "2021-05-02 09:20:00",
        2,     1,     "2021-04-30 13:00:00",
        2,     1,     "2021-05-02 12:13:00",
        1,     2,     "2021-05-05 08:34:00",
        1,     2,     "2021-05-06 14:15:00",
        2,     2,     "2021-05-05 07:12:00",
        2,     2,     "2021-05-05 14:13:00",
        2,     2,     "2021-05-08 15:22:00") %>%
  mutate(date = as.POSIXct(date))

dat %>%
  group_by(participant, timeframe) %>%
  mutate(session = row_number())

#> # A tibble: 10 x 4
#> # Groups:   participant, timeframe [4]
#>    participant timeframe date                session
#>          <dbl>     <dbl> <dttm>                <int>
#>  1           1         1 2021-04-30 09:12:00       1
#>  2           1         1 2021-04-30 10:03:00       2
#>  3           1         1 2021-05-02 09:20:00       3
#>  4           2         1 2021-04-30 13:00:00       1
#>  5           2         1 2021-05-02 12:13:00       2
#>  6           1         2 2021-05-05 08:34:00       1
#>  7           1         2 2021-05-06 14:15:00       2
#>  8           2         2 2021-05-05 07:12:00       1
#>  9           2         2 2021-05-05 14:13:00       2
#> 10           2         2 2021-05-08 15:22:00       3

Created on 2021-04-30 by the reprex package (v0.3.0)

A: Alternatively, use rleid:
library(data.table)
df %>%
  group_by(participant, timeframe) %>%
  mutate(session_per_timeframe = rleid(date))
# A tibble: 10 x 4
# Groups:   participant, timeframe [4]
   participant timeframe date                session_per_timeframe
         <dbl>     <dbl> <dttm>                              <int>
 1           1         1 2021-04-30 09:12:00                     1
 2           1         1 2021-04-30 10:03:00                     2
 3           1         1 2021-05-02 09:20:00                     3
 4           2         1 2021-04-30 13:00:00                     1
 5           2         1 2021-05-02 12:13:00                     2
 6           1         2 2021-05-05 08:34:00                     1
 7           1         2 2021-05-06 14:15:00                     2
 8           2         2 2021-05-05 07:12:00                     1
 9           2         2 2021-05-05 14:13:00                     2
10           2         2 2021-05-08 15:22:00                     3

A: My answer
data %>% group_by(grp = data.table::rleid(participant)) %>%
  mutate(session = row_number())

# A tibble: 10 x 5
# Groups:   grp [4]
   participant timeframe date                  grp session
         <int>     <int> <chr>               <int>   <int>
 1           1         1 2021-04-30 09:12:00     1       1
 2           1         1 2021-04-30 10:03:00     1       2
 3           1         1 2021-05-02 09:20:00     1       3
 4           2         1 2021-04-30 13:00:00     2       1
 5           2         1 2021-05-02 12:13:00     2       2
 6           1         2 2021-05-05 08:34:00     3       1
 7           1         2 2021-05-06 14:15:00     3       2
 8           2         2 2021-05-05 07:12:00     4       1
 9           2         2 2021-05-05 14:13:00     4       2
10           2         2 2021-05-08 15:22:00     4       3


text:
Q: Entity mapping is creating unwanted column on the fly I have 2 tables (User and Feed) linked by a foreign key. Following that, I am using Spring Boot and Hibernate to make a query to just print out all the values in Feed table. But when it comes to the foreign key and its value, my Entity seems to be going wrong where it creates a new column on the fly when I already have a column for the foreign key.
Can I please know what I am doing wrong? New to this JPA setup. Confused as to whether I should even create my schema first or let JPA just handle things according to my Entity setups. Clearly I am missing something vital this but just can't place a finger on it. Please assist.
Question is how do I map to the foreign key? As in map Feed table's foreign key 'owner_name' to User table's 'username' on the Entity?
Table structures

Entities
User Entity
@Entity
public class User {
    @Id
    @Column(name = "username")
    public String username;

    @Column(name = "email")
    public String email;

    @Column(name = "password")
    public String password;

    @Basic
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "created_at")
    private Date createdAt;

    @Column(name = "online_status")
    private long onlineStatus;

    @Column(name = "account_status")
    private long accountStatus;

    //updated this based on Gopi's suggestion
    @OneToMany(mappedBy = "ownerName")
    private List<Feed> feeds;
}

Feed Entity
@Entity
public class Feed {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "feed_id")
    private long feedId;

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

    @Basic
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "created_at")
    private Date createdAt;

    @Basic
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "updated_at")
    private Date updatedAt;

    @ManyToOne
    @JoinColumn(name = "username")
//    @Column(name = "owner_name")
    private User ownerName;
}

My query to just get all the Feed data where I do get all data less the value for foreign key which comes out as null. (expecting to get the foreign key value instead).
My controller is calling this method where I get all results less the foreign key value.
public interface FeedRepository extends JpaRepository<Feed, Long> {
    @Query("select f from Feed as f order by f.createdAt desc")
    List<Feed> getCurrentFeeds();
}

Test values inside the tables.
User table data

Feed table data

If I run my current code, I end up with an additional column on the fly as follows which I do not want as mentioned above.

A: Hi this is not surprising, you have specified as a name attribute to the @JoinColumn the column that is actualy referenced. You need to specify the foreign key column in the Feed table which is the "owner_name". The correct complete definition of the @JoinColumn would be:
@JoinColumn(name="owner_name",referencedcolumn = "username")
    private User ownerName;

Where you don't actualy need to define the referencedcolumn, but I have defined it for completion so that you understand what is what.


text:
Q: Azure Devops YAML: Looping Jobs With Different Variables Passed I am struggling to figure out how to execute an API test using a pipeline where the command used can be modified using a loop. For example:
TEMPLATE.yaml
parameters:
    JobName: ''
    TestDirectory: '.\tests\smoke\'
    PositiveTest: ''
    NegativeTest: ''
    - name: environments
      type: object
      values:
      - dev01
      - dev02
      - test01
      - test02

jobs:
- job: ${{ parameters.JobName }}
  pool:
    name: pool
    demands:
      - Cmd
  variables:
    PosTest: ${{ parameters.PositiveTest }}
    NegTest: ${{ parameters.NegativeTest }}
    Directory: ${{ parameters.TestDirectory }}

  - script: |
      call .\venv\Scripts\activate.bat
      cd $(Directory)
      python $(PosTest)
    displayName: 'Executing Positive Test Scenarios'
    condition: and(succeeded(), ne('${{ variables.PosTest }}', ''))

  - script: |
      call .\venv\Scripts\activate.bat
      cd $(Directory)
      python $(NegTest)
    displayName: 'Executing Negative Test Scenarios'
    condition: and(succeeded(), ne('${{ variables.NegTest }}', ''))

TEST_FILE.yaml
...
jobs:
# Get this file: templates\TEMPLATE.yml from the `build` repository (imported above)
- template: templates\api-test-build.yml@build
- ${{ each env in parameters.environments }}:
  parameters:
    TestDirectory: '.\tests\smoke\job_class'
    PositiveTest: 'python_test.py http://apient${{ env }}/arbitrary/api/path/name'
    NegativeTest: ''

This of course doesn't work (the each directive returns an error like "the first property must be template". If I move it up a line it then says "the first property must be a job" and this cycle of errors just continues...).
The idea is just that I have a loop that iterates through environment strings (top of the TEMPLATE.yaml example). The yaml file that references the template passes the command python_test.py http://apient<whatever env string the current iteration is on>/arbitrary/api/path/name for each iterated string (bottom of TEST_FILE.yaml) and the template just executes each of those api tests. At the end of a run there should be 4 environments that have been tested on.
This is just an idea I have and I am still learned all the in's and out's of Azure Devops YAML. If anyone knows how I can get this to work, any improvements I can make to the idea itself or any other workarounds/solutions that would be highly appreciated. Thank you!

A: You can try using Multi-job configuration (matrix) in your pipeline.
When you want to run the same job with multi-configuration in a pipeline, the matrix strategy is a good choose.
For example, in your pipeline, you want to run the jobs that have the same steps and input parameters but different values of the input parameters. You can just set up one job with the matrix strategy in the pipeline.


text:
Q: Multi-Shiny App Directory - RJDBC Connection Issue Currently have a multi Shiny App directory that builds to Docker
One of the apps (app1) is reliant upon a JDBC connection that gives me SQL Access.
The other app (app2) is a dummy app for now that reads a web csv and makes a ggplot.
I can run app1 with JDBC on its own with no issues.
I can run to get to the directory of the 2 app setup with links to app1 and app2. When I click on app2, that app runs fine. When I click on app1, I get an error message- The application failed to start. The application exited during initialization.
Here is the Dockerfile code than runs the shiny server, copies the directory of the apps from my local computer to the docker directory(srv/shiny-server). I then open up port 3838 and run shiny-server. The intended goal here is to open up to the directory of the apps showing links to app1 and app2
RUN rm -rf /srv/shiny-server/
COPY app1 /srv/shiny-server/apps/app1
COPY app2 /srv/shiny-server/apps/app2

EXPOSE 3838

CMD ["usr/bin/shiny-server"]

Here is where what my directory of app1 looks like. Pretty standard with UI/Server, R, Folder. Currently I have a jar file in this directory (which works when I run by itself). I have also copied the jar file to a location in a linux directory and declared $CLASSPATH to get it to work.

*

*ui.R

*server.R

*R (folder; has global.R and other contingencies)

*mssql-jdbc-10.2.0.jre11.jar (jar file for jdbc driver)

Here is where I declared my connection to the rjdbc. This assumes that the classPath is in same directory as my app, which I believe it is (above). I can also get this to work using Sys.getenv('CLASSPATH') if I declare that.
drv <- JDBC(driverClass = "com.microsoft.sqlserver.jdbc.SQLServerDriver",
            classPath = 'mssql-jdbc-10.2.0.jre11.jar')

To sum up, I am looking to get the rjdbc connection to work in multi-Shiny app directory. It works when I have one file loaded but not two. I am assuming that there is some permissions to the jar file, environmental variables, or running the app that I am not declaring correctly. The other possibility is I am misreferencing the location of RJDBC in the JDBC function or the CLASSPATH itself.
Ideally, I would like to have one rjdbc driver that multiple apps can reference.
Any guidance would be helpful


text:
Q: I'm a complete beginner at java and have entangled my methods I'm making a horse-race themed program for my mom that compares the money taken in by her employees and ties it to a horse. I've created two methods which entirely rely on each other and have no idea how to call them into my main method. I, of course, also need to add a graphical element to this at some point, and figuring out how to make the program work with decimal integers would also be ideal. My main issue right now is I need to know how to call print3largest and inputs in my main method, or how to generally make this not a dumpster fire and maybe reduce it to less than 3 methods that aren't entangled like this.
I've searched through repository websites for hours now looking for a solution, but as I have no professional experience in any kind of programming I severely lack the terminology to find an answer, assuming anyone else is stupid enough to run into the same problem I have. I'm extremely limited in my programming knowledge, with java being the only thing I've ever messed with thanks to a course in high school. Sadly, that hardly helps as it was almost entirely through an interface that was essentially just scratch.
import java.util.Scanner;

class HorseComparison
{
    public static void main(String[] args)
    {
        //no clue how to call print3largest or inputs here without ruining everything
    }
    static void print3largest(int arr[], int arr_size, String firsthorse, String secondhorse, String thirdhorse)
    {
        int i, first, second, third;
        if (arr_size < 3)
        {
            System.out.print(" Invalid Input ");
            return;
        }

        third = first = second = Integer.MIN_VALUE;
        for (i = 0; i < arr_size ; i ++)
        {
            if (arr[i] > first)
            {
                third = second;
                second = first;
                first = arr[i];
            }
            else if (arr[i] > second)
            {
                third = second;
                second = arr[i];
            }

            else if (arr[i] > third)
                third = arr[i];
        }
        inputs(first, second, third);
        System.out.println("The horse in the lead is " + firsthorse + " with " +
                       first + " dollars.");
        System.out.println("The runner up is " + secondhorse + " with " +
                second + " dollars.");
        System.out.println("Third place is " + thirdhorse + " with " +
                third + " dollars.");
    }

    static void inputs(int first, int second, int third)
    {
        Scanner sc = new Scanner(System.in);
        int size;
        System.out.println("How many horses are competing?");
        size = sc.nextInt();
        int[] arr = new int[size];
        System.out.println("Enter the amount of money taken in by each horse (rounded to the nearest dollar and separated by spaces)");
        //For reading the element
        for(int i=0;i<size;i++) {
            arr[i] = sc.nextInt();
        int n = arr.length;
        String firsthorse;
        String secondhorse;
        String thirdhorse;
            System.out.println("Which horse has taken in "+ first +"?");
            firsthorse = sc.toString();
            System.out.println("Which horse has taken in "+ second +"?");
            secondhorse = sc.toString();
            System.out.println("Which horse has taken in "+ third +"?");
            thirdhorse = sc.toString();
        print3largest(arr, n, firsthorse, secondhorse, thirdhorse);
    }
  }
}

I want it to display the 3 highest amounts along with the input name of the horse tied to those amounts.

A: you can call static methods directly by the method name
 print3largest()

or you can use the classname before method name example
HorseComparision.print3largest() ```

A: Since both methods are static and so the Main method. Static methods can be called

*

*Directly with method name, if you are calling from inside the class. Eg :  print3largest(.. args), inputs(.. args)

*call using ClassName.Method name. This can be used if you are calling method from outside or inside the class. Eg: HorseComparison.print3largest(.. args), HorseComparison.inputs(.. args)

A: I don't feel like there really is enough information about what the program is intended to do for a clear, direct answer to be provided, but I will do my best.
First, what I would suggest, is you take a good look at this program and determine how you can separate out each responsibility. For example, do you really need to call inputs from print3largest, or could you possibly call this directly from your main?
Once you have established the intent of each function, consider making each function return a result. Generally speaking, you want parameters to be immutable. Learning functional programming habits now will help you down the road.
Here is what I would do:

*

*Copy this file to a backup file.

*Start a new Java project, create your class.

*Write all of your display code. That is, develop the initial user experience. What inputs do you want to ask from the user? Capture those inputs.

*Given those inputs, write your core algorithm, which currently appears to be primarily in print3largest. Return those results back to the caller.

*Display your results back to the end user.

This might result in more functions, but that isn't a bad thing. I would also advise that you consider creating a separate class to hold some of this logic. This will give you an opportunity to learn about objects and separation of concerns.


text:
Q: Is there a way to switch to "su -" after switching users through "su"? Basically what I want to be able to do is to switch to having used "su -" instead of the traditional hyphenless "su" after already using "su" to switch to another account.
My initial thought was to do another "su -" but that sounded a bit silly, is there a better way to do this?

A: You can start a subshell as login shell, e.g. bash -l.

A: You could run the user's shell profile like this:
. ~/.profile

That's a dot, space, tilde, slash, dot, then the word profile
You can read about profile here.

A: you're right, there's nothing that keeps you from just doing su -User2 and ending up with something like User1->root->User2. You can also just type exit to end the "su" session and drop back down to User1 and then type su -User2


text:
Q: Why do the most languages employ double quotes not single for String Literals? Why do the most languages employ double quotes not single for String Literals?
As far as I know, the only language to employ single quotes is JavaScript where this manner works well.
Any historical reason ?
EDIT: Thank you all for various inputs. This really helps me out.

A: In some languages double quotes represent strings, and single quotes represent characters. In other languages double quotes can interpolate variables while single quotes can't. JavaScript is not the only one that allows single quotes for strings, PHP does, and so does Ruby, and many others, but in JavaScript there's no difference at all of using one or the other.

A: because usually when you type text strings, you need the single quote more than the double quote like:

*

*string s1 = "it's a rainy day.."

*string s2 = "this file can't be opened.."

this way you have less escaping to do, and it's more readable.
also, i like the way JavaScript does this, it accepts both single and double quotes for strings.

A: Not to be too obvious, but standard English punctuation uses double quotes for quoting and single quotes for interior quotes, so it makes sense that programming languages would default to double quotes.


text:
Q: How to change ts file based on language using angular localization I have files errors.ts and content.ts with English content same way errorsEs.ts and contentEs.ts with Spanish content.etc. I am doing JIT compiler angular localization to translate the language. I have imported errors.ts and content.ts throughout the app.
As of now, I am replacing the translated language(Spanish, Italian) content into the English content.ts and errors.ts to run it as a different language. Is there any other way to do it without replacement of files?

A: Sure, create translation files with locales in the name (I'll create one for the sake of the example) :
error.en-US.ts
export const errors = {
  http: {
    e404: `Error: resource not found on the server`
  }
};

Next, create an error service. In the constructor, get the user locale, load the file, then use it :
constructor() {
  if (window.navigator.languages) { this.language = window.navigator.languages[0]; }
  else { this.language = window.navigator.userLanguage || window.navigator.language; }

  this.errors = require(`errors.${this.language}`).errors;
}

EDIT

console.log(window.navigator.languages);
console.log(window.navigator.userLanguage);
console.log(window.navigator.language);


text:
Q: Is a Java Class instance singleton? According to the Java 8 Language Spec §15.8.2 (quote):

[...]
A class literal evaluates to the Class object for the named type (or for void) as defined by the defining class loader (§12.2) of the class of the current instance.
[...]

Mainly, 'the Class object' insinuates that this is or should be a singleton. Also §12.2 says:

[...]
Well-behaved class loaders maintain these properties:

*

*Given the same name, a good class loader should always return the same class object.

[...]

In fact, using Java 8*, the following** prints true and true:
class Main {
    public static void main(String[] args) {
        Main main1 = new Main();
        Main main2 = new Main();
        System.out.println(main1.getClass().equals(main2.getClass()));
        System.out.println(main1.getClass() == main2.getClass());
    }
}

Is the class loader always 'well-behaved' and why (not)? In other words: are Class instances singleton? The other way around: can a Class of the same type be a different instance?
Notes: I do not refer to the singleton pattern here. However, if the Class implementation follows that pattern, that would be interesting. As a side-step, but by no means the main question: because the singleton pattern's legitimate uses are point of debate, would Java's Class be a good candidate to apply the singleton pattern to?
*:
$ java -version
openjdk version "1.8.0_262"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_262-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.262-b10, mixed mode)

**: my IDE even warns me that the printed expressions are always true.

A: You are using the term singleton incorrectly.
A singleton implies the existence of only one object of its own class. A Class object is an instance of the class java.lang.Class and there is more than one instance of this class. It's actually impossible to have only one Class object, as the existence of a Class object does already imply the existence of at least two classes, java.lang.Object and java.lang.Class, so there must be at least two Class objects in the runtime.
Your example is not capable of spotting whether the class loader is well behaved or not. You already mentioned JLS §12.2

Well-behaved class loaders maintain these properties:

*

*Given the same name, a good class loader should always return the same class object.

*If a class loader L1 delegates loading of a class C to another loader L2, then for any type T that occurs as the direct superclass or a direct superinterface of C, or as the type of a field in C, or as the type of a formal parameter of a method or constructor in C, or as a return type of a method in C, L1 and L2 should return the same Class object.
A malicious class loader could violate these properties. However, it could not undermine the security of the type system, because the Java Virtual Machine guards against this.

Mind the last sentence. A JVM will guard against violations of these requirements. With the repeated occurrences of the same symbolic references within your example code, there are two possibilities

*

*The JVM remembers the result of the first resolution of this symbolic reference within this context and just reuses it on the next occurrence without asking a class loader again.

*The JVM remembers the result of the first resolution of this symbolic reference within this context and compares it with the result of subsequent resolutions of the same reference and throws an error if they mismatch.
Since both approaches imply remembering the result, the first approach is usually used when it comes to resolving the same reference within the same context, as it is simpler and more efficient. When it comes to different symbolic references that resolve to classes using the same reference, the JVM will indeed throw an error when the class loader constraints are violated.
So expressions like Main.class == Main.class or new Main().getClass() == new Main().getClass() will never evaluate to false. Most likely, the resolution of the symbolic reference to Main will go a short-cut, using the same runtime class regardless of what the class loader would do. But even when it does not take the short-cut and the ClassLoader is misbehaving, returning a different class object for the next query, the JVM would detect it and throw an error, so the expression would not evaluate to a boolean result at all. In neither case could it result in false.

A: In a single classloader, the Class object is the same.

Is the class loader always 'well-behaved' and why (not)?

It really depends on the implementation. If it is done deliberately that always the classloader always returns a new Class-Object, it won't be well-behaved.
At least all classloaders of OpenJDK are well-behaving.

In other words: are Class instances singleton? The other way around: can a Class of the same type be a different instance?

In one single classloader, every Class instance is a singleton. With multiple classloaders, following will evaluate to false:
ClassLoaderA.getInstance().loadClass("foo.Bar")==ClassLoaderB.getInstance().loadClass("foo.Bar");

The other way around: can a Class of the same type be a different instance?

Only if loaded by two different, conforming,well-behaved classloaders.

As a side-step, but by no means the main question: because the singleton pattern's legitimate uses are point of debate, would Java's Class be a good candidate to apply the singleton pattern to?

This is quite opinion-based, but I think, it's no good candidate to apply the singleton pattern, as most singletons are implemented like this:
class Foo{
   public static final Foo INSTANCE=new Foo();
   private Foo(){
      ìf(INSTANCE!=null)
         throw new IllegalAccessException("No Foo instances for you!");
   }
}

So more that it is really ONE object of a Class, many that only differ by some small things like a different Classloader.


text:
Q: Force Entity Framework 5 to use datetime2 data type Is it possible to globally set Entity Framework DbContext to use datetime2 for all properties that are System.DateTime when using Code-First model?
I can do this for each column by using HasColumnType() method, but for an existing codebase I would like a global solution.

A: Not in EF5 but EF6 (currently in alpha version) allow this with custom conventions. For EF5 you would need some custom convention based framework based on reflection which would add HasColumnType calls to model builder through reflection - check for example EF Code First Extras (it claims to have support for pluggable conventions).

A: Since EF6 has been out for quite a while now and this question still shows up in searches, here is the way to use custom conventions to set the SQL type. Within OnModelCreating method in your DbContext class do:
modelBuilder.Properties<DateTime>()
    .Configure(c => c.HasColumnType("datetime2"));


text:
Q: Python - popup message drawn on the screen I'm writing a program and I need to inform the user about some changes with a popup message, but not a popup window. Something like the rectangle informing about new message in Kadu - no window, just a bitmap drawn directly on the screen for a few seconds.
I wonder if there is a simple way to do that with win32 package or Tkinter, and handle the event when the user clicks on the rectangle.
Actually the message would be constant, so the bitmap might be loaded from a file, but I still don't know how to start.
Any ideas, please?
Regards, mopsiok

A: I am using wxPython and looking for a way to have a popup message. Now I am using a popupmenu in which I append each item of the menu with one line of the message.

A: Actually I found the answer to my question. That's my code using Tkinter, hope it will help you.
from Tkinter import Tk, Label
from Image import open as iopen #doesn't needed if you won't display image
from ImageTk import PhotoImage #as before

root = Tk()
img = PhotoImage(iopen("some_path")) #load an image
label = Label(root, image=img)
label.image = img
label.bind("<Button-1>", Click)
label.pack()
root.geometry('-0-40') #place in the right-bottom corner
root.wm_attributes("-topmost", 1) #popup
root.overrideredirect(1)
root.mainloop()

def Click(event): #close the window if image clicked
    root.destroy()
    print 'window closed'


text:
Q: xmpp IQ XML parsing in iOS I received the following XML IQ and want to parse it in iOS. Please help!
     <iq type="result">
        <stories xmlns="success">

            <storyid>1</storyid>
            <title>THE TITLE</title>
            <picture>BASE64EncodedStringOfImage</picture>

            <storyid>2</storyid>
            <title>Love At First Site</title>
            <picture>BASE64EncodedStringOfImage</picture>

        </stories>
     </iq>

I tried the below code but it isn't working. It gets the values in successStoryArray but nothing afterwards. Please help!
    NSXMLElement *stories = [iq elementForName:@"stories"];
    NSArray *successStoryArray = [stories elementsForName:@"storyid"];
    NSLog(@"successStoryArray: %@", successStoryArray);
    for (NSXMLElement *i in successStoryArray)
    {
        NSXMLElement *title = [i elementForName:@"title"];
        NSString *sTitle = [title stringValue];
        NSLog(@"sTitle: %@", sTitle);
        NSXMLElement *picture = [i elementForName:@"picture"];
        NSString *sPicture = [picture stringValue];
        NSLog(@"sPicture: %@", sPicture);

    }

A: You are iterating over the wrong elements. NSArray *successStoryArray = [stories elementsForName:@"storyid"]; will get two elements: storyid with value=1 and storyid with value=2.
Then you iterate over those elements and trying to extract title and picture, but title and picture are not child elements of . Title and picture are at the same level as storyid, they are children of .
There are two ways to fix it:
Extract 3 arrays, each containing the values for storyid, title and picture
NSArray *successStoryArray = [stories elementsForName:@"storyid"];
NSArray *titleArray = [stories elementsForName:@"title"];
NSArray *pictureArray = [stories elementsForName:@"picture"];

Then you can iterate them in order and items will match
Even better in my opinion, change the structure of the XML by wrapping each story in a  element, like this:
     <iq type="result">
        <stories xmlns="success">
          <story>
            <storyid>1</storyid>
            <title>THE TITLE</title>
            <picture>BASE64EncodedStringOfImage</picture>
          </story>
          <story>
            <storyid>2</storyid>
            <title>Love At First Site</title>
            <picture>BASE64EncodedStringOfImage</picture>
          </story>
        </stories>
     </iq>

Then you can do:
    NSXMLElement *stories = [iq elementForName:@"stories"];
    NSArray *successStoryArray = [stories elementsForName:@"story"];
    NSLog(@"successStoryArray: %@", successStoryArray);
    for (NSXMLElement *i in successStoryArray)
    {
        NSXMLElement *storyId = [i elementForName:@"storyId"];
        NSString *sId = [storyId stringValue];
        NSLog(@"sId: %@", sId);
        NSXMLElement *title = [i elementForName:@"title"];
        NSString *sTitle = [title stringValue];
        NSLog(@"sTitle: %@", sTitle);
        NSXMLElement *picture = [i elementForName:@"picture"];
        NSString *sPicture = [picture stringValue];
        NSLog(@"sPicture: %@", sPicture);

    }


text:
Q: Passing in scope to db.collection.group Is it possible to pass a global context db.collection.group's keyf?
{MongoClient} = require 'mongodb'

GLOBAL_VAR = 1

reducer = (obj, prev) -> prev.count += GLOBAL_VAR
initial = {count:0}

MongoClient.connect 'mongodb://localhost:27017/test', (err, db) ->
  throw err if err
  db.collection('orders').group [], {}, initial, reducer, (err, result) ->
    throw err if err
    console.log result

I get the following error
MongoError: exception: ReferenceError: GLOBAL_VAR is not defined at $group reduce setup:2

A: You can pass variables through as the initial state
{MongoClient} = require 'mongodb'

GLOBAL_VAR = 1

reducer = (obj, prev) -> prev.count += prev.GLOBAL_VAR
initial = {count: 0, GLOBAL_VAR}

MongoClient.connect 'mongodb://localhost:27017/test', (err, db) ->
  throw err if err
  db.collection('orders').group [], {}, initial, reducer, (err, result) ->
    throw err if err
    console.log result


text:
Q: Can multiple Team projects point to the same source control in TFS? I'm new to TFS so I'm trying to figure a couple of things out.
1) Are you allowed to reference the same code from multiple Team Projects?
2) How do you change the source control location for an existing team project?

A: The Server-Paths for each checked-in module has a format like $/TeamProject1/foo.cs.On the client-side, those files shall reside somewhere on the local HDD. The mapping between a $/TeamProject1/foo.cs & a local path C:/MyFiles/foo.cs is crafted by a TFS Workspace. Check here for an intro.To your questions:
1) Are you allowed to reference the same code from multiple Team Projects?On the server side: You can have branched, or simply commonly named source files, as in $/TeamProject1/foo.cs & $/TeamProject2/foo.cs, but those are surely different files.On the client side:Each locally mapped source control folder can only be correlated with one local path. In case you try to map both $/TeamProject1/foo.cs & $/TeamProject2/foo.cs into C:/MyFiles/foo.cs you 'll be denied the second time with something like that:In all, I think the answer to this question is a 'No'.2) How do you change the source control location for an existing team project?I suppose that you are trying to change the local mapping, for example from
$/TeamProject1 & C:\Folder\teamProject1 into
$/TeamProject1 & C:\AnotherFolder\TeamProject1
In order to do that navigate in VStudio to "File">"Source Control">"Workspaces.." then select your workspace & hit "Edit". There you can see the existing mappings and edit them.

A: Can you give an example of what you're trying to accomplish in question 1?
For question two, I'm assuming you're talking about where the code lives on a development desktop. For this, open visual studio and go to: File -> Source Control -> Workspaces. Then click Edit for your workspace. You can change the location here for each project you have mapped.

A: You can create a workspace that contains code from multiple team projects.
So, if I understand your first question correctly then yes you can do that.  Technically the code will be in one Team Project but you can mix it into other Team Projects on your machine or build server using workspaces.
Are you familiar with workspaces yet?


text:
Q: Controlling IE 'Save Print Output As' dialogue window in VBA I am automating Internet Explorer to print WEB PAGE to PDF and save it on Desktop with VBA. How to control with VBA "Save Print Output As" dialogue box? I would prefer solution without Application.SendKeys.
The task is to catch this dialog programmatically, change the "File name:" (path + file name). Optionally, I would also like to: Change "Save as type:". Click on Save.
I have working solution with "Save As" dialogue but for "Save Print Output As" it seems not working.

A: Option Explicit

Declare PtrSafe Function SendMessageW Lib "User32" (ByVal hWnd As LongPtr, ByVal wMsg As LongPtr, ByVal wParam As LongPtr, ByVal lParam As LongPtr) As LongPtr
Declare PtrSafe Function FindWindowExW Lib "User32" (ByVal hWndParent As LongPtr, Optional ByVal hwndChildAfter As LongPtr, Optional ByVal lpszClass As LongPtr, Optional ByVal lpszWindow As LongPtr) As LongPtr
Public Declare PtrSafe Function FindWindowW Lib "User32" (ByVal lpClassName As LongPtr, Optional ByVal lpWindowName As LongPtr) As LongPtr

Public Const WM_SETTEXT = &HC
Public Const BM_CLICK = &HF5

Public Sub GetInfo()
        Const MAX_WAIT_SEC As Long = 5
        Dim t As Date
        Dim ptrSaveButton As LongPtr
        Dim msg As String
        Dim str1 As String, cls As String, name As String
        Dim ptrSaveWindow As LongPtr
        Dim duiViewWND As LongPtr, directUIHWND As LongPtr
        Dim floatNotifySinkHWND As LongPtr, comboBoxHWND As LongPtr, editHWND As LongPtr

        str1 = "#32770" & vbNullChar

        t = Timer
        Do
            DoEvents
            ptrSaveWindow = FindWindowW(StrPtr(str1))
            If Timer - t > MAX_WAIT_SEC Then Exit Do
        Loop While ptrSaveWindow = 0

        If Not ptrSaveWindow > 0 Then Exit Sub
        duiViewWND = FindWindowExW(ptrSaveWindow, 0&)
        If Not duiViewWND > 0 Then Exit Sub
        directUIHWND = FindWindowExW(duiViewWND, 0&)
        If Not directUIHWND > 0 Then Exit Sub
        floatNotifySinkHWND = FindWindowExW(directUIHWND, 0&)
        If Not floatNotifySinkHWND > 0 Then Exit Sub
        comboBoxHWND = FindWindowExW(floatNotifySinkHWND, 0&)
        If Not comboBoxHWND > 0 Then Exit Sub
        editHWND = FindWindowExW(comboBoxHWND, 0&)
        If Not editHWND > 0 Then Exit Sub

        msg = "C:\Users\ID\Desktop\myTest.pdf" & vbNullChar
        SendMessageW editHWND, WM_SETTEXT, 0, StrPtr(msg)

        cls = "Button" & vbNullChar
        name = "&Save" & vbNullChar
        ptrSaveButton = FindWindowExW(ptrSaveWindow, 0, StrPtr(cls), StrPtr(name))

        SendMessageW ptrSaveButton, BM_CLICK, 0, 0

        Application.Wait Now + TimeSerial(0, 0, 4)
End Sub


text:
Q: tcsh 'ls_colors' not working I am using tcsh as my default shell. However, the LS_COLORS env doesn't seem to work. Here is my related env for ls:
setenv CLICOLOR "true"
setenv LS_COLORS "di=37:fi=00"

Directories are suposed to be coloured white, but the result is they are coloured blue/cyan. Any idea?

A: I was having the same problem. I am required to use tcsh and xterm. I also didn't have luck with setenv CLICOLOR.
try:
alias ls ls --color=always

source: ls man page

A: This thread on the web might help on the syntax of LS_COLORS in general.
In your particular case it looks ok. Did you set color in your shell?


text:
Q: Displaying custom field description on VF page I have a requirement where the names of the custom fields far exceed the 40 characters limit. So instead I thought I would put a keyword in the field name and the whole name in the description of the field. Is there possibly a way, to print the description of a field on the VF page? I could have done it manually too but the number of fields is close to 100 and making so many manual entries on the VF page isn't the best approach.
Someone please help!

A: You can fetch the Description but it will require quite some digging into the metadata API.
I'd suggest using the HelpText for this and replacing the label for a field by the helptext, which is available directly in VisualForce. E.g.:
<apex:pageBlockSectionItem >
    <apex:outputLabel value="{!$ObjectType.Account.fields.Street__c.InlineHelpText}"/>
    <apex:outputField value="{!a.Street__c}"/>
</apex:pageBlockSectionItem>


text:
Q: How can I find all repositories that have a push mirror setup in Gitea? I have a personal Gitea instance (1.16.9) that has over 130 repos, spread across multiple owners (user and organizations).
For some number of them I have push mirroring setup to GitHub, but have recently needed to change my personal access token. Pull mirror failures show in the admin System Notices, but push mirror failures do not appear to be listed.
Without going into the settings of each repo manually, can I find out which repos have a mirror setup to push to GitHub? Can I view which push mirror syncs have failed?
I have full access to Gitea, the server, and the database (PostgreSQL).

A: With access to the server and with Gitea setup as a systemd service (called gitea.service below) you can check the service logs.
sudo journalctl -fu gitea.service --since "1 day ago" > gitea-log
Then search these for the message logged when Gitea fails to authenticate when pushing a mirror:
grep 'Authentication failed' gitea-log
The default sync is 8 hours, so you can tweak the first command, depending upon if you use the default or something else.


text:
Q: How can I remove clone HTML JQuery I'm just a beginner I want to create button for remove clone but I can't.
This is my code but it isn't work. Please help me to know where did I wrong.
PS. Sorry for my poor English
HTML

                    <select name="tell" id="tell" class="btn btn-default dropdown-toggle">
                        <option value="0"></option>
                        <option value="1"></option>
                        <option value="2"></option>
                        <option value="3"></option>
                    </select>

      <input type="text" class="form-control" aria-label="..." placeholder="...">

<button type="submit" id="btnClonereport"></button>
<button type="submit" id="btnDelreport"></button>

JS This is my script I can clone but I can't remove clone.

A: So you want to remove all form clones? Try this for your delete button action:
EDIT: If you want to remove the last occurance, that makes things much simpler.
    $("#btnDelreport").bind("click", function(){
        $('#container4').children('.col-lg-7').last().remove();
    });


text:
Q: Angular Datatable with dynamic columns I found this very cool Angular Datatable library which adds pagination, search and stuff to the table. I works well with predefined table headers but I need to paginate a table who's headers ain't predefined.
I tried following this example on their official documentation, with a few changes of my own, but it gave me this error:
DataTables warning: table id=DataTables_Table_0 - Ajax error. For more information about this error, please see http://datatables.net/tn/7

This is how I tried it:
in my html file

in my controller
angular.module("app").controller("uploadDataController", ['$scope',
   'DTOptionsBuilder', 'DTColumnBuilder',
   function($scope, DTOptionsBuilder, DTColumnBuilder) {

          SetupScreen();

          function SetupScreen() {
                $scope.dtOptions = DTOptionsBuilder.fromSource('data.json')
        .withPaginationType('full_numbers');
        $scope.dtColumns =  [
                             DTColumnBuilder.newColumn('id').withTitle('ID'),
                             DTColumnBuilder.newColumn('firstName').withTitle('First name'),
                             DTColumnBuilder.newColumn('lastName').withTitle('Last name').notVisible()
                         ];
          }
   }

I'm receiving data from server that can contain any kind of headers so I cannot define the columns.
any ideas?

A: I think you can use the ng-repeat both for headers and rows data to populate the table .
I Will explain for the data which comes from the server . Change the header also depending on your requirement
By defining The controller this way
angular.module('showcase.angularWay.dataChange', ['datatables', 'ngResource'])
.controller('AngularWayChangeDataCtrl', AngularWayChangeDataCtrl);

By defining the Datatable in this way
$scope.dtOptions = DTOptionsBuilder.newOptions().withPaginationType('full_numbers').withOption('info', false).withOption('bFilter', false).withOption('paging', false);

By defining the columns the following way . This can be as many as columns you need
$scope.dtColumnDefs = [
        DTColumnDefBuilder.newColumnDef(0),
        DTColumnDefBuilder.newColumnDef(1)
      ];

And the HTML code as follows change the data based on your requirement

                            Form ID
                            Form Description
                            Edit

                            {{ form_elements.form_id }}
                            {{ form_elements.description }}
                            Edit


text:
Q: Prevent cursor from moving to end of the input box when user makes edits, in IE browser In my anuglar 7 application, in all text input fields, I am including a method that changes the value of whatever text the user types, to uppercase.  In IE browsers, when the user makes an edit to the text they enter, the cursor automatically moves to the end of the input box instead of staying in place.
I suspect the method that is causing the issue is this:
oninput="this.value = this.value.toUpperCase()"

I do not have this issue in chrome browsers.  What can I do to prevent this from happening in IE browsers?
My html code for the input field:
          <input
            type="text"
            class="form-control col-lg-7"
            id="primary-email"
            formControlName="primaryEmail"
            pattern="[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?"
            placeholder="example@domain.com"
            required
            [ngClass]="{ 'is-invalid': submitted && f['primaryEmail'].errors }"
            [(ngModel)]="primaryEmail"
            oninput="this.value = this.value.toUpperCase()"
          />

A: As suspected, the issue was coming from
oninput="this.value = this.value.toUpperCase()"

The change I made to resolve this (after some googling) was to create a method in my TS file:
makeUpperCase(e) {
  const cursorStart = e.target.selectionStart;
  const cursorEnd = e.target.selectionEnd;
  e.target.value = e.target.value.toUpperCase();
  e.target.setSelectionRange(cursorStart, cursorEnd);
}

Then in the HTML file, replace the problematic line with this:
(input)="makeUpperCase($event)"

Hopefully this helps anyone else running into a similar issue with IE.


text:
Q: Android Studio 6.0 merger fail Just updated to the latest version of Android Studio and i get this error in the AndroidManifest file

Manifest merger failed : Attribute application@icon value=(@drawable/project_launcher_icon) from AndroidManifest.xml:48:9
      is also present at com.github.anupcowkur:reservoir:1.1.1:6:45 value=(@drawable/ic_launcher)
      Suggestion: add 'tools:replace="icon"' to  element at AndroidManifest.xml:44:5 to override

I tried adding tools:replace="@drawable/ic_drawer" in my manifest  but i get this error:
Error:(44, 5) tools:replace specified at line:44 for attribute tools:drawable/ic_drawer, but no new value specified

Any ideas?

A: You should add tools:replace="icon", just like the error message says.
Additional attributes can be replaced using the syntax tools:replace="icon,name,theme"

A: look here:
All markers belong to the Android tools namespace, therefore you must declare the namespace in any AndroidManifest.xml containing at least one marker :
xmlns:tools="http://schemas.android.com/tools"
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.tests.flavorlib.app"
**xmlns:tools="http://schemas.android.com/tools"**>

<application
    android:icon="@drawable/icon"
    android:label="@string/app_name"
   **tools:replace="icon, label"**/>
</manifest>

you should add xlms:tools and tools:replace those two lines in manifest file.

A: Following Android Studio's suggestion and adding the following attribute tools:replace="icon" should allow it to build your app successfully, without resorting to using the old manifest merger (which isn't a very forward-looking solution indeed).
Of course, you'll first have to declare the namespace "tools" in order to use it:
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:tools="http://schemas.android.com/tools"
              package="com.sample.app" >

A: Android Studio 0.6 use the new manifest merger tool. This new merger was introduced in version 0.10 of the plugin. As of 0.11, this tool is used by default by the gradle plugin.
In order to revert to the old manifest merger, please add to your build.gradle the following configuration :

android {
  useOldManifestMerger true
}

A: For me this worked. Try adding the code in the main module(project) manifest file:
add
xmlns:tools="http://schemas.android.com/tools" in your manifest tag
add
tools:replace="android:icon,android:label,android:theme" in your application tag
These will let Android Studio know that the icon, label and theme to be used are from that manifest and not from other projects included.


text:
Q: Scrolling in UIWebView I want to know if it's possible to scroll to a given id in a UIWebView.
I know that I can scroll to a given (x,y) point using:
 [self.myWebView.scrollView setContentOffset:CGPointMake(x, y) animated:YES];

I'm loading html files locally so I found that elements in html files can be "labeled" as follows:
 <element id="myID">

Instead of using a (x,y) coordinate to scroll, I want to scroll to a given id, I tried using this:
 NSString *yCoordinate = [self.myWebView stringByEvaluatingJavaScriptFromString:@"document.getElementById('myID').value"];
 [self.myWebView.scrollView setContentOffset:CGPointMake(0, [yCoordinate intValue]) animated:YES];

But it's not working. What am I doing wrong?
Thanks in advance.

A: Just navigate to the id like this :
[self.myWebView stringByEvaluatingJavaScriptFromString: @"window.location.hash='#myID'"];


text:
Q: Is there a way to cleanly store turnips? When I'm buying turnips and don't want to keep them several days in my pockets, I go to my home to store them. However, it's not possible to put them in the storage space, while there's plenty of room left. So, I ended up putting them on the floor. Is there another way to store them?
I have a fridge but when opening it, it asks me if I want to change my clothes... So this is not an option.

A:
So, I ended up putting them on the floor. Is there another way to store them?

Sadly no. We can only hope for an update to add another way.

A: You can also just drop turnips on the ground outside to store them.  They won't spoil, but they can be picked up by visitors or anyone who shares your island.  Putting a fence around them protects them from visitors, but not best friend visitors or shared island players, so you'd have to trust them.


text:
Q: how to loop in semantic ui react? I am learning react. For css I am using semantic-ui-react. I am trying to create a tab using the documentation:https://react.semantic-ui.com/modules/tab. I understand how it works now I want to generate dynamic tabs according to user requirements. Suppose that I have an object like this:
[{name: "10jan", key: "10jan"},
 {name: "12jan", key: "12jan"},
 {name: "14jan", key: "14jan"}]

I want to generate dynamic tabs based on this. My code is this
const panes = [
    { dates.map((date) => (
        return (
          menuItem:{date.name},
          render(){

Test

          }
        )
      ) }
    ]

Where I am doing wrong?

A: As per documentation you can do the following. see the demo:
import 'semantic-ui-css/semantic.min.css';
import React, { Component } from 'react';
import { render } from 'react-dom';
import { Tab } from 'semantic-ui-react';

const data = [
  { name: "10jan", key: "10jan" },
  { name: "12jan", key: "12jan" },
  { name: "14jan", key: "14jan" },
 ];

const panes = data.map(d => ({
  menuItem: d.name,
  render: () => <Tab.Pane> { d.key }</Tab.Pane>
}));

const App = () => (

    <Tab panes={ panes } />

);

A: state = {
  dataArray:[{name: "10jan", key: "10jan"},
 {name: "12jan", key: "12jan"},
 {name: "14jan", key: "14jan"}]
}

renderItems() {
  const {dataArray} = this.state
  return dataArray.map((item,i) =>
{item.name}
)
}

render() {
  return (

       {this.renderItems()}

  )
}

we don't user render method again and again.
this is a way you can render dynamic views