text:
Q: Circuit Charging Sealed Lead-Acid Battery (NP1270M) I have a project (remote gate opener...) I have made good progress but its the first time I have built a charging circuit so I have some questions I need help with.
The battery I am using is a sealed lead acid battery NP1270M datasheet here
The gate will be near a power source and i will supply 18VDC @1.5A as an input to the circuit. The project has a Micro controller so I plan to implement automatic overcharge/undercharge safety. As well as switching I will limit the voltage and current (fixed amount). The battery will never be less than 80% so I was just going to trickle charge at a fixed rate until it reaches a voltage or the voltage no longer increases.
Questions:

*

*What voltage should I use for "Fully charged" can't seem to find
that anywhere i.e. if reached turn off charging.

*What voltage should I use for under-voltage protection (<12v?)

*What voltage and current should I trickle charge at note: 30% in 8 hours will be quick enough.

I don't understand this from the datasheet:

Thank you in advance for your help.

A: That's a nice datasheet. Trying to work out what the curves mean would be educational - but it's not essential for your purpose.
In your application you are essentially "floating" the battery.
The other typical use is deep discharge.
Your application lies somewhere between but closer to floating.
13.5 to 13.8V maximum voltage when charging (float charge) is good enough for your purpose.
Charge at not more than 1.75A and ideally at around 0.7A until this voltage is reached.
Occasional increase to 13.8-14.1 (Equalise or boost) will help maintain capacity, but is not essential.
Do NOT float at 14V plus - that is only for recharge after deep discharge.


text:
Q: What is the difference within the compiler between debugging and running the code? (STM32) somehow when i am running my code, it seems like one GPIO Port isn't being initialized, meanwhile if i am debugging, it is.
I am initializing two sensors:
struct MAX31856_t max31856_temperature_sensor_heater_1 = MAX31856_TPL( SPI_DEV_TPL( IO_PIN_TPL(
        TEMP_SENSOR_0_CS_GPIO_Port, TEMP_SENSOR_0_CS_Pin), &spi1));

struct MAX31856_t max31856_temperature_sensor_heater_2 = MAX31856_TPL( SPI_DEV_TPL( IO_PIN_TPL(
        TEMP_SENSOR_1_CS_GPIO_Port, TEMP_SENSOR_1_CS_Pin), &spi1));

Sensor Heater 1 is not getting any Information, Sensor Heater 2 is getting Informations. Now if i swap the Name of the Heaters:
struct MAX31856_t max31856_temperature_sensor_heater_2 = MAX31856_TPL( SPI_DEV_TPL( IO_PIN_TPL(
        TEMP_SENSOR_0_CS_GPIO_Port, TEMP_SENSOR_0_CS_Pin), &spi1));

struct MAX31856_t max31856_temperature_sensor_heater_1 = MAX31856_TPL( SPI_DEV_TPL( IO_PIN_TPL(TEMP_SENSOR_1_CS_GPIO_Port, TEMP_SENSOR_1_CS_Pin), &spi1));

and run the code in the debugger, Sensor Heater 1 and 2 are getting Informations.
How can this happen? I was thinking about a timing problem, but since it is working in the debugger, i don't really know what to do.

A: Provided that you are debugging and/or running the same binary. Debugging is mostly the same as running except if you halt the processor (es breakpoints).
In that case...

*

*some peripherals could continue to run or be halted togheder with the cpu, the behaviour is some cases can be configured. (timers, watchdog...)

*some interrupts can be lost.

*some hardware buffers can overflow and data can be lost (if you don't use any flow control in your IO)

A: How do you run the code in debug mode? Do you have breakpoints somewhere?
You (OP) are right about it being most likely a timing problem, and probably related to physical SPI transmission. Because your line of code to send/receive something over SPI has already executed in the MCU, but physically the bits and bytes are still being transmitted on the line, while MCU is already calling the next SPI function, so one of the transmissions will fail. Try adding some delay after SPI transmission code. If things work after that, then it's the timing of SPI peripheral, and you need to add a check that there is no SPI transmission already in place before you call a functions to send/receive something.
You can do while(transmission) (pseudocode, replace with actual check if SPI transmission is going on) to wait until the previous transmission ends to call the next one.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Ajax and ActiveXObject why when I run this code on local server, req.send(sData) doesn't work?
It runs alert1 but doesn't run alert2;
function initialize() {
    var req;
    try {
        req = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
        try {
            req = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (oc) {
            req = null;
        }
    }
    if (!req && typeof XMLHttpRequest != "undefined") {
        req = new XMLHttpRequest();
    }
    return req;
}

function getData(sUrl, sData) {
    var req = initialize();
    req.open("POST", sUrl, false);
    req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    alert("1");
    req.send(sData);
    alert("2");
    return req.responseText;
}

sUrl and sData are the same as the original website sends.


text:
Q: Why do my bootstrap dropdown elems render badly? I wanted to beautify my frontend with ng-bootstrap (installed via npm install --save ng-bootstrap)

import {NgbModule} from '@ng-bootstrap/ng-bootstrap';

@NgModule({
  ...
  imports: [NgbModule.forRoot(), ...],
  ...
})
export class YourAppModule {
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.5/angular.min.js"></script>
<div ngbDropdown class="d-inline-block">
    <button class="btn btn-outline-primary" id="dropdownBasic1" ngbDropdownToggle>
        Choose your playlist
    </button>
    <div ngbDropdownMenu aria-labelledby="dropdownBasic1">
        <button
            class="dropdown-item"
            *ngFor="let playlist of playlists"
            [class.selected]="playlist === selectedPlaylist"
            (click)="onSelect(playlist)">{{playlist.name}}</button>
    </div>
</div>

but it renders like that :

Any ideas on how to fix that *insert many digusting synonyms* result ? :D

A: Looks like you forgot to add the bootstrap.css.
Just add the link to that in your index.html:
<link
  rel="stylesheet"
  href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" />

Also, you'll import the NgbModule from this path:
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';

Not NOT CALL .forRoot on it.

Here's a Working Sample StackBlitz for your ref.


text:
Q: Set Meteor dynamic template Name in ViewModel binding I have following template which use Tempalte.dynamic helper to render dynamic template.
    <template name="links">
          <div class="panel-body">
            {{> Template.dynamic template=viewTypeTemplate data=links}}
        </div>
   </template>

This works find if i use viewTypeTemplate variable as Template helper as below.
Template.links.helpers({
   viewTypeTemplate: function () {
        return Session.get('isThumbView') ? 'linkThumbList' : 'linkList';
    }
});

But it does not work i user Meteor Viewmodel binding variable instead of Template helper variable.
Template.links.viewmodel({
    isThumbView: false,
    viewTypeTemplate: function(){
      return this.isThumbView()? 'linkThumbList' : 'linkList';
   }
});

A: Template.links.viewmodel({
    isThumbView: false,
    viewTypeTemplate: function(){
      return this.isThumbView()? 'linkThumbList' : 'linkList';
   }
},'viewTypeTemplate');

Expose viewTypeTemplate as helper to use publicly.
for multiple helpers
Template.links.viewmodel({
        isThumbView: false,
        viewTypeTemplate: function(){
          return this.isThumbView()? 'linkThumbList' : 'linkList';
       }
},['viewTypeTemplate','isThumbView']);

explore more at Here


text:
Q: Form.closed event is not firing Whenever I click on form's red cross close button I want to display another form, but despite of having closed event handler, I'm unable to open another form.
This is how I'm trying to open another form:
private void Form1_Closed(object sender, System.EventArgs e)
{
     itemMaster.Show();

}

Could anyone please tell me how can I enable my requirment?

A: First, you should use the FormClosed event instead of Closed:

The Closed event is obsolete in the .NET Framework version 2.0; use the FormClosed event instead. — MSDN page for the Form.Closed event

void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
    // ...
}

Second, make sure that you have actually subscribed to Form1's FormClosed event:
Form1.FormClosed += Form1_FormClosed;

The Windows Forms designer should've automatically added a similar line somewhere in InitializeComponent. If not, that's why your handler method doesn't get called.
If this still doesn't help, try handling the FormClosing event insteaf of FormClosed.

A: If you have started your application with the following statement:
Application.Run(new Form1());

When you close Form1, your application will exit. Even if you open another form, it will be killed when application quits. Can you make sure this is the case by putting a breakpoint in your Form1_Closed method and see that the breakpoint is hit?
If this is the case, what happens is your code does execute but since the application quits, your another form also closes as soon as it opens.
To fix that, Hide() form1 instead of closing it. Handle Form_Closing event and call this.Hide() and set e.Cancel = true.

A: When you're done with your form and you want to close it(by clicking on a close button for example), be sure to use Close(). My form_closing event didn't fired because I used only Dispose() when clicking the close button.
I think the best way to close a form is to use both Close() and Dispose().

*

*Close() => if you need to do something when closing the form...

*Dispose() => to destroy the form (cleanup resources).
private void _btnClose_Click(object sender, EventArgs e)
{
    Close();
    Dispose();
}


text:
Q: overloading cout ostream operator in C++ I have a question about printing template class in c++ programing. Using Point2D class, I want to print out the template class mylist as auto x:mylist, but I keep failing.
Is there any way to solve this problem without touching any classes and using Point2D print function by ostream operator << ? (auto x:mylist is mandatory)
The answer should in the form if you enter two integers, then save it as Point2D, and print is as if Point2D (2,3), lastly, it should print out multiple Point2Ds without (-1,-1).
For example, if I enter 2\n 3\n 5\n 6\n -1\n -1\n, then the answer should be in the form of ((2,3),(5,6)) <-not including (-1,-1)
Please Help me!!
#include <iostream>
#include <string>
#include <vector>
#include <cassert>
#include <conio.h>

//declaration for Node, Iterator class;
template <class T>
class Node;
template <class T>
class Iterator;
class Point2D;

template <class T>
class List{
public:
    //constructor and destructor
    List();
    ~List();
    //list begin & end
    Iterator<T> begin();
    Iterator<T> end();
private:
    Node<T>* first;
    Node<T>* last;
    int size;

   friend class Iterator<T>;
   friend class Point2D;
   friend std::ostream& operator<<(std::ostream& os, const List<T>& list);
};

 template <class T>
 class Iterator{
 public:
    Iterator();
    T operator*() const;
    Iterator<T>& operator++();
    Iterator<T> operator++(int unused);
    Iterator<T>& operator--();
    Iterator<T> operator--(int unused);
    bool operator ==(Iterator<T> b)const;
    bool operator!=(Iterator<T> b)const;
private:
    Node<T>* position;
    List<T>* container;
//declare the List as friend
friend class List<T>;
 };

class Point2D {
public:
     // Constructors
    Point2D();
    Point2D(double a, double b);
    // Print functions
    virtual void print();
private:
    double x;
    double y;
};

template <class T>
List<T>::List(){
     //initialization
     first=NULL;
     last=NULL;
    size=0;
 }

 template <class T>
 List<T>::~List(){
    delete first;
    delete last;
    delete size;
 }

//check begin()
template <class T>
Iterator<T> List<T>::begin(){
    Iterator<T> iter;
    iter.position=first;
    iter.container=this;
    return iter;
 }

//check end()
template <class T>
Iterator<T> List<T>::end(){
    Iterator<T> iter;
    iter.position=NULL;
    iter.container=this;
    return iter;
 }

 //check begin()
 template <class T>
 Iterator<T> List<T>::begin(){
     Iterator<T> iter;
     iter.position=first;
     iter.container=this;
     return iter;
 }
 //check end()
 template <class T>
 Iterator<T> List<T>::end(){
    Iterator<T> iter;
    iter.position=NULL;
    iter.container=this;
    return iter;
 }

 //Iterator operator * -> pointing the position
 template <class T>
 T Iterator<T>::operator*()const
  {
      assert(position !=NULL);
      return position->data;
  }

 //pre increment for operator++
 template <class T>
      Iterator<T>& Iterator<T>::operator++() {
      assert(position!=NULL);
      position=position->next;
      return* this;
 }
 //post increment for operator++
 template <class T>
 Iterator<T> Iterator<T>::operator++(int unused) {
    assert(position != NULL);
    auto clone(*this);
    ++(*this);
    return clone;
 }
 //pre increment for operator--
 template <class T>
 Iterator<T>& Iterator<T>::operator--() {
      assert(position!=container->first);
      if(position==NULL) position =container->last;
      else position=position->previous;
      return* this;
 }
 //post increment for operator--
 template <class T>
 Iterator<T> Iterator<T>::operator --(int unused){
     auto clone(*this);
         --(*this);
         return clone;
 }
 //boolean operator to check ==
 template <class T>
 bool Iterator<T>::operator ==(Iterator<T> b)const{
 return position==b.position;
 }
 //boolean operator to check !=
 template <class T>
 bool Iterator<T>::operator!=(Iterator<T> b)const{
    return position!=b.position;
 }

 Point2D::Point2D() { x = 0; y = 0; return; }
 Point2D::Point2D(double a, double b) { x = a; y = b; return; }

 void Point2D::print() {
    std::cout << "(" << x << "," << y << ")";
    return;
 }

int main(){
 List<Point2D> mylist;
Iterator<Point2D> myiterator = mylist.begin();
std::cout << "Please input a set of nonnegative numbers for a list";
std::cout << " (Enter -1 when you are finished): " << std::endl;

//if select1 &2=-1 stop the loop
while (select1 != -1&&select2 !=-1)
{
    std::cin >> select1;
    std::cin >> select2;
    /*since data is nonnegative set store the data if it is greater than
      using push_back function*/
    if (select1>0||select2>0)
    mylist.push_back(Point2D(select1,select2));
}
//printing the mylist followed by given format;
std::cout << "Your list is"<<std::endl<<"(";
for (auto x:mylist)
std::cout << x << ",";
std::cout <<'\b'<< ")"<<std::endl;
}

A: You can always write an ostream operator outside of all the classes:
ostream& operator<< (ostream& os, Point2D p) {
   p.print();
   return os;
}

You can then call it by doing cout<< p<<endl;
The problem in your case, is that print() is specific to the output stream, whereas << is independent of the ostream.  In consequence, the latter could be used for string streams or file streams, with a wrong implementeation,  so that if one day, you try to output to a file instead of to the console  this code would continue to print on the console leaving the expected output destination  empty.
It would be VERY VERY advisable to change your print(), so to use an ostream:
virtual void print(ostream& os);


text:
Q: sunGrid cluster: qsub error "Unable to run job: hostnames may not be empty string" I'm submitting jobs to sunGrid cluster, and I want my log file to have it's start time as its name. For that I used the next command:
qsub -j y -o job_`date "+%Y_%m_%d_%H:%M"`.log job.sh

But I got the next error message:
Unable to read script file because of error: ERROR! invalid option argument "-f"

I didn't find a "-f" in my script, so I tried to replace the date execution to the current date:
qsub -j y -o job_2014_10_23_16:36.log job.sh

But, then I got the next error:
Unable to run job: hostnames may not be empty string.

What can it be?

A: I finally found that the error was using a colon in the output file name, so it was looking for a hostname:option argument.
Replacing the colon with another character (e.g. underscore) fixed it:
qsub -j y -o job_2014_10_23_16_36.log job.sh

Great!


text:
Q: Looking for a direct proof that all maximal ideals of $\mathbb C[x_1,x_2,...,x_n]$ are generated by $n$ linear polynomials Without using Hilbert's Nullstelensatz , can we directly prove that all maximal ideals of $\mathbb C[x_1,x_2,...,x_n]$ is of the form $\langle x-a_1,x-a_2,...,x-a_n \rangle$ ? It is easy to prove it for $n=1$ . If it cannot even be proved for general $n$ variables , I would really like to know a direct proof (if any ) for two variables i.e. for $\mathbb C[x,y]$ . Please help . Thanks in advance

A: Here is a proof, which works over $\mathbb C$ (due to the complex numbers being not countable):
If $\mathfrak m$ is a maximal ideal in $R=\mathbb C[x_1, \dotsc, x_n]$, then the quotient $R/\mathfrak m$ has countable degree over $\mathbb C$, since $R$ itself is a vector space of countable dimension over $\mathbb C$.
The smallest transcendental extension $\mathbb C(X)$ has uncountable degree over $\mathbb C$, since the elements $\frac{1}{X-c},c \in \mathbb C$ are linear independent.
We deduce that $R/\mathfrak m$ is algebraic over $\mathbb C$, hence $R/\mathfrak m = \mathbb C$. This implies the result by considering the map
$$\varphi: \mathbb C[x_1, \dotsc, x_n] \twoheadrightarrow \mathbb C[x_1, \dotsc, x_n]/\mathfrak m = \mathbb C$$
and noting that $x_i-\varphi(x_i)$ are contained in $\ker(\varphi)=\mathfrak m$, in particular $(x_1-\varphi(x_1), \dotsc, x_n-\varphi(x_n)) \subset \mathfrak m$. Equality follows since both ideals are maximal.


text:
Q: busboy-connect fires on finish before the end of save file (node.js , express) I use busboy connect to get the upload data from my client. I try to save the data and then on.finish to return status ok to the server. The problem is that the on.finish fires before the end of the file saving.
Have I done something wrong or that's the way the module works?
server-side code :
        console.log("upload started dirname ", __dirname);
        var fstream;
        var result = [];
        var number_of_files = 1;
        req.pipe(req.busboy);
        req.busboy.on('field', function(fieldname, val) {
            field_obj = {}
            field_obj[fieldname] = val;
            result.push(field_obj);
            console.log(field_obj)
        });
        req.busboy.on('file', function(fieldname, file, filename) {
            console.log("Uploading: " + filename);
            //Path where image will be uploaded
            if (result.length > 0) {
                var file_type = filename.substr(filename.length - 4);
                filename = result[0].name + '_' + number_of_files + file_type;
                number_of_files++;
            }
            fstream = fs.createWriteStream(__dirname + "/" + filename);
            file.pipe(fstream);
            fstream.on('close', function() {
                console.log("Upload Finished of " + filename);
                result.push(filename);
                console.log("result ",result)
            });
        });
        req.busboy.on('finish', function() {
            console.log("form parsing finished")
            console.log("result finish",result)
            res.sendStatus(200)
        });

I would expect the "result finish" to be the last msg i see , but i get the following on my console:
Uploading: testSwf1.swf
Uploading: testSwf3.swf
form parsing finished
result finish [ { name: '123' }, { clickUrl: '234234' } ]
Upload Finished of 123_1.swf
result  [ { name: '123' }, { clickUrl: '234234' }, '123_1.swf' ]
Upload Finished of 123_2.swf
result  [ { name: '123' },
  { clickUrl: '234234' },
  '123_1.swf',
  '123_2.swf' ]

EDIT
i also tried the on.end but that one didn't fired at all.
req.busboy.on('end', function() {
    console.log("DONE PARSING FORM")
    console.log("NEW result finish", result)
});

A: This is expected behavior. finish is emitted when the last of the data has been read from the request (this includes any/all emitted file streams, which are subsets of the incoming request data).
However if you're writing a file stream to disk, it's possible for the file stream to still have the last chunk(s) of data still buffered in memory. This is why the file may not be completely written to disk by the time finish is emitted.
One common solution for this is to both check a flag that gets set in the busboy finish event handler, and check a counter variable that gets incremented for every fstream close event (comparing it to result.length for example).

A: As mscdex suggested I used a variable to find when the writing is finised:
var fstream;
var result = [];
var number_of_files = 1;
var counter = 0;
req.pipe(req.busboy);
req.busboy.on('field', function(fieldname, val) {
    field_obj = {}
    field_obj[fieldname] = val;
    result.push(field_obj);
    console.log(field_obj)
});
req.busboy.on('file', function(fieldname, file, filename) {
    counter++;
    console.log("Uploading: " + filename);
    //Path where image will be uploaded
    if (result.length > 0) {
        var file_type = filename.substr(filename.length - 4);
        filename = result[0].name + '_' + number_of_files + file_type;
        number_of_files++;
    }
    fstream = fs.createWriteStream(__dirname + "/" + filename);
    file.pipe(fstream);
    fstream.on('close', function() {
        counter--;
        console.log("Upload Finished of " + filename);
        result.push(filename);
        console.log("result ",result)
        if(counter == 0){
            console.log("writing finished");
            res.sendStatus(200);
        }
    });
});


text:
Q: Dynamic memory allocation question when you allocate dynamic memory on the heap using a pointer,
char *buffer_heap = new char[15];

it would be represented in memory as:
 ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍýýýý««««««««þþþ

why doesn't there be a NULL terminating character at the end instead of ýýýý««««««««þþþ?

A: You haven't initialized that memory. You are just seeing whatever was already there...

A: You need to initialize it. Built-in types can be initialized to zero by explicitly calling the default constructor:
char *b = new char[15]();

A: Í is byte 0xCD, which the Windows debug allocator writes into your 15 bytes of memory to indicate that it is uninitialised heap memory. Uninitialized stack would be 0xCC. The idea is that if you ever read memory and unexpectedly get this value, you can think to yourself, "hmm, I've probably forgotten to initialise this". Also, if you read it as a pointer and dereference it, then Windows will crash your process, whereas if an uninitialised buffer were filled with random or arbitrary values then sometimes by fluke you'd get a valid pointer, and your code might cause all kinds of trouble. C++ doesn't say what values uninitialized memory holds, and non-debug allocators won't waste time filling memory with special values for every allocation, so you must never rely on that value being there.
This is followed by 4 bytes of ý (byte 0xFD), which the Windows debug allocator uses to indicate an out-of-bounds region at the end of a buffer. The idea is that if you ever find yourself in the debugger writing to a region that looks like this, you can think "hmm, I've probably overrun my buffer here". Also, if the value has changed when the buffer is freed, the memory allocator can warn you that your code is wrong.
« is byte 0xAB, and þ is 0xFE. Presumably these are also intended as eye-catchers (they aren't plausible pointers or offsets, so they don't form part of the heap structure). I don't know what they signify, possibly more guard data like the 0xFD.
Finally, I guess, you've found a 0 byte, the 16th byte beyond the end of your 15 byte buffer (i.e. the 31st byte counting from the start of it).
Asking the question as "C++" without mentioning that you're on Windows suggests that this is how C++ behaves. It isn't, it's how one implementation of C++ behaves, with particular compiler options and/or linked dlls. C++ does not permit you to read past the end of the buffer, Microsoft is just being nice to you and letting you get away with it not crashing or worse.

A: While every C style string is represented as a sequence of chars, not every sequence of chars is a string.
The \0 usually comes in when you directly assign a string literal, or when you add it there yourself. And it is only meaningful if you treat that array as a string with functions that take the \0 into account.
If you just allocate the memory and don't initialize it, it's full with random stuff. There may be a 0 there or there may not be - you're going to have to put something meaningful there in a subsequent step. It is up to you whether to make that something a string or not.

A: Because char is a native type, it's uninitialized.  That's just how C++ is (it's a legacy of C).
Just accept that and 0 terminate it yourself:
char *buffer_heap = new char[15];
*buffer_heap = '\0';

or if you want the entire buffer initialized:
std::fill(buffer, buffer + 15, 0);

A: It'll only be initialized if you allocate a type that's initialized. Otherwise, if you want some meaningful values there, you'll have to write them in yourself.
On the other hand, the better answer is that you just shouldn't do this in the first place. Forget that new[] exists, and don't look back.

A: In GNU C++ (g++) on Linux, this program exits pretty quickly:
#include <algorithm>
#include <iterator>
#include <vector>
#include <cstddef>
#include <cstdlib>
#include <iostream>

namespace {

class rand_functor {
 public:
   int operator ()() const { return ::std::rand(); }
};

}

int main()
{
   using ::std::cout;
   using ::std::vector;
   using ::std::ostream_iterator;
   using ::std::generate;
   using ::std::equal;
   using ::std::copy;

   char *tmp = new char[1000];
   // This just fills a bunch of memory with random stuff, then deallocates it
   // in the hopes of making a match more likely.
   generate(tmp, tmp+1000, rand_functor());
   delete[] tmp;
   vector<char *> smalls;
   smalls.push_back(new char[15]);
   do {
      smalls.push_back(new char[15]);
   } while (equal(smalls[0], smalls[0]+15, smalls[smalls.size() - 1]));
   cout << "        In one allocation I got: [";
   copy(smalls[0], smalls[0]+15, ostream_iterator<char>(cout));
   cout << "]\nAnd in another allocation I got: [";
   copy(smalls[smalls.size() - 1], smalls[smalls.size() - 1]+15,
        ostream_iterator<char>(cout));
   cout << "]\n";
   cout << "It took " << smalls.size() << " allocations to find a non-matching one.\n";
   return 0;
}


text:
Q: jQuery validation plugin - pass function as parameter I'm writing a jQuery plugin to validate forms. The plugin works great but I want to be able to define what happens after a form validates. So I want to be able to pass a function as a parameter. That function will contain a bunch of stuff to actually submit the form. That parameter needs to be called when the validation is successful.
Plugin called within the HTML file:
<script>
  $(document).ready(function(){
    $('#cForm').shdValidate({
      success : formSubmit()
    });
  });
</script>

jQuery plugin:
(function($) {
  $.fn.shdValidate = function(options) {

    //==== SETTINGS
    var shdValidateSuccess = $.extend(options).success,
        form = this;

    //==== SUBMIT CLICK
    this.children('input[type=submit]').click(function(){
      //variables
      var shdRequired = $(form).children('.required'),
          shdValid = 0;

      //validated fields
      $(shdRequired).each(function(){
        $(this).removeClass('shdValidateAlert');
        if ($(this).val() == '' || $(this).val() == $(this).attr('placeholder')){ $(this).addClass('shdValidateAlert'); }
        else { shdValid += 1; }
      });

      //outcome
      if (shdValid == $(shdRequired).length) {
        //THE SUCCESS PARAMETER NEEDS TO BE CALLED HERE SOMEHOW
      }
      return false;
    });

  }
}(jQuery));

As you can see, I've commented where the parameter needs to be called in the plugin. At the moment I just can't get this working.

A: You need to make two changes
  $(document).ready(function(){
    $('#cForm').shdValidate({
      success : formSubmit
    });
  });

And
(function($) {
  $.fn.shdValidate = function(options) {

    //==== SETTINGS
    var shdValidateSuccess = $.extend(options).success,
        form = this;

    //==== SUBMIT CLICK
    this.children('input[type=submit]').click(function(){
      //variables
      var shdRequired = $(form).children('.required'),
          shdValid = 0;

      //validated fields
      $(shdRequired).each(function(){
        $(this).removeClass('shdValidateAlert');
        if ($(this).val() == '' || $(this).val() == $(this).attr('placeholder')){ $(this).addClass('shdValidateAlert'); }
        else { shdValid += 1; }
      });

      //outcome
      if (shdValid == $(shdRequired).length) {
        //THE SUCCESS PARAMETER NEEDS TO BE CALLED HERE SOMEHOW
        if($.isFunction(shdValidateSuccess)){
            shdValidateSuccess(form);
        }
      }
      return false;
    });

  }
}(jQuery));


text:
Q: yum Proxy connection failed: 407 on redhat 6.5 I keep getting yum proxy connection failed error 407 even though it seems like yum is able to successfully reach the proxy.
I have log from running yum below with highest debug and error to do list packages command:
# yum -d 10 -e 10 --rpmverbosity debug --enablerepo=\* list packages
Not loading "rhnplugin" plugin, as it is disabled
Loading "product-id" plugin
Loading "security" plugin
Loading "subscription-manager" plugin
Running "config" handler for "security" plugin
Running "config" handler for "subscription-manager" plugin
Updating Subscription Management repositories.
Proxy connection failed: 407
Config time: 0.202
Yum Version: 3.2.29
COMMAND: yum -d 10 -e 10 --rpmverbosity debug --enablerepo=* list packages
Installroot: /
Ext Commands:

   packages
Setting up Package Sacks
epel-debuginfo/metalink                                                                                | 2.4 kB     00:00
epel-debuginfo                                                                                | 3.0 kB     00:00
epel-debuginfo/primary_db                                                                                | 675 kB     00:00
epel-source/metalink                                                                                | 2.4 kB     00:00
epel-source                                                                                | 3.5 kB     00:00
epel-source/primary_db                                                                                | 1.8 MB     00:00
epel-testing/metalink                                                                                | 3.0 kB     00:00
Using older repomd.xml
  Latest: Sat May  6 05:04:26 2017
  Using: Fri May  5 22:12:48 2017
epel-testing                                                                                | 4.3 kB     00:00
epel-testing/primary_db                                                                                | 362 kB     00:00
epel-testing-debuginfo/metalink                                                                                | 3.0 kB     00:00
epel-testing-debuginfo                                                                                | 3.0 kB     00:00
epel-testing-debuginfo/primary_db                                                                                |  22 kB     00:00
epel-testing-source/metalink                                                                                | 3.0 kB     00:00
epel-testing-source                                                                                | 3.5 kB     00:00
epel-testing-source/primary_db                                                                                |  90 kB     00:00
rhel-source                                                                                | 2.6 kB     00:00 ...
rhel-source/primary_db                                                                                | 2.0 MB     00:04 ...
rhel-source-beta                                                                                | 1.3 kB     00:00 ...
rhel-source-beta/primary                                                                                |  214 B     00:00 ...
rpmfusion-free-updates-debuginfo                                                                                | 3.0 kB     00:00
rpmfusion-free-updates-debuginfo/primary_db                                                                                |  16 kB     00:00
rpmfusion-free-updates-source                                                                                | 3.0 kB     00:00
rpmfusion-free-updates-source/primary_db                                                                                |  30 kB     00:00
rpmfusion-free-updates-testing                                                                                | 3.6 kB     00:00
rpmfusion-free-updates-testing/primary_db                                                                                | 1.3 kB     00:00
rpmfusion-free-updates-testing-debuginfo                                                                                | 3.0 kB     00:00
rpmfusion-free-updates-testing-debuginfo/primary_db                                                                                | 1.3 kB     00:00
rpmfusion-free-updates-testing-source                                                                                | 2.9 kB     00:00
rpmfusion-free-updates-testing-source/primary_db                                                                                | 1.3 kB     00:00
rpmfusion-nonfree-updates-debuginfo                                                                                | 3.0 kB     00:00
rpmfusion-nonfree-updates-debuginfo/primary_db                                                                                | 4.9 kB     00:00
rpmfusion-nonfree-updates-source                                                                                | 3.0 kB     00:00
rpmfusion-nonfree-updates-source/primary_db                                                                                | 7.3 kB     00:00
rpmfusion-nonfree-updates-testing                                                                                | 3.6 kB     00:00
rpmfusion-nonfree-updates-testing/primary_db                                                                                | 1.3 kB     00:00
rpmfusion-nonfree-updates-testing-debuginfo                                                                                | 3.0 kB     00:00
rpmfusion-nonfree-updates-testing-debuginfo/primary_db                                                                                | 1.3 kB     00:00
rpmfusion-nonfree-updates-testing-source                                                                                | 2.9 kB     00:00
rpmfusion-nonfree-updates-testing-source/primary_db                                                                                | 1.3 kB     00:00
webtatic-archive                                                                                | 2.9 kB     00:00
webtatic-archive/primary_db                                               92% [===========================================================     ] 343 kB/s | 2.3 MB     00:00 ETA

Is it ok ignore this error? Is yum impacted in its functionality somehow, and if so, how should I fix it?
I have already configured the proxy properly via environment variables (http_proxy, ftp_proxy, etc) and also via /etc/yum.conf
I know the proxy configuration is correct because yum is able to do list packages as above. And there is even a progress bar reflecting for the download.

A: Try removing the environmnet variables for proxy / yum.conf proxy entries etc and entering the proxy details in /etc/rhsm/rhsm.conf .


text:
Q: Can't get iframe element passed to Angular controller from directive I have an iframe that has an ng-src attribute on it, and I change it frequently. Each time that the iframe's src changes, I want to execute a function in my controller AFTER the iframe is fully loaded.
Additionaly, I want to have the iframe DOM element passed into the function.
Right now I'm using a directive from this StackOverflow post. The callback fires when the iframe is loaded, and the function in my controller executes; but I can't get the iframe DOM element passed in as a parameter.
Here is a demo Plunkr
THE HTML

My Content Up Here

    <button ng-click="main.setIframeSource()">Load iFrame Src</button>

THE Javascript
(function() {
  angular.module('app', [])
    .controller('home', home)
    .directive('iframeOnload', iframeOnload);

  function home() {
    var vm = this;
    vm.currentIframeSource = '';
    vm.setIframeSource = setIframeSource;
    vm.onIframeLoad = onIframeLoad;

    function onIframeLoad(element) {
      console.log(element);
    }

    function setIframeSource() {
      if (vm.currentIframeSource === '' || vm.currentIframeSource === 'iframe2.html')
        vm.currentIframeSource = 'iframe.html';
      else
        vm.currentIframeSource = 'iframe2.html';
    }

  }

  function iframeOnload() {
    var directive = {
      scope: {
        callBack: '&iframeOnload'
      },
      restrict: 'A',
      link: function(scope, element, attrs) {
        element.on('load', function() {
          return scope.callBack(element);
        });
      }
    };

    return directive;
  }
})();

I've tried using $event and passing in this as a parameter to the onIframeLoad function in my HTML, but I can never get a reference to the iframe DOM element.
Thoughts?

A: When you want to pass data to an expression defined in an isolate scope, you need to pass them via an object with named parameters. See this documentation page.
So theoretically, all you would have to do is change your directive scope.callback(element) to:
return scope.callBack({element:element});

BUT, Angular is trying to enforce separation of concerns between what you can do in directives and what you can do in controllers.  You aren't supposed to do anything with raw elements in your controllers so Angular will prevent you from doing what I just wrote and point you to a page like this: Error: error:isecdom
Referencing a DOM node in Expression
If you want to deliberately break the rules and do a workaround, what you can do is wrap the element in your own object and then it will pass through fine (but remember, this is not recommended)
  link: function(scope, element, attrs) {
    element.on('load', function() {
      console.log('in directive iframe loaded',element);
      // bad bad bad!
      var elemWrapper = {theElem:element};
      return scope.callBack({element:elemWrapper});
    });
  }

I created a plunker showing that this works  (uncomment the bad part to see the element being passed)


text:
Q: How to check how many classes are loaded and how much space they will take? I am planning to migrate to Java 8, before I want to check how many classes are being loaded in my project, and more important how much space they will take, so that I can tune and configure metaspace accordingly.
I know that I can use jstat for this purpose, but not sure what kind of parameters do I need to get the result I want.

A: You should use some java profiler tool. Here are some of them link.
YourKit is really decent but its not free.

A: Use jconsole / jvisualvm from the bin of jdk. Its more intuitive and informative.


text:
Q: accessing global variables in angular scope In http://www.w3schools.com/angular/tryit.asp?filename=try_ng_repeat_object
instead of

Is there a syntax to refer to an external variable declared elsewhere in ng-init (and NOT declared in angularjs controller) as this one doesn't work:

I know it's bad practice but I use another framework also and don't want to duplicate the content of the variable. And it's just for prototyping not code for real app.
Or else if I use ng-init initial declaration, can I refer it from another script variable ?

A: It will not work because of the following reasons

*

*Script tag is for to the html document's javascript. It has no relationship with angular's ng-init directive.

*The angular documentation about ngInit directive warns as shown below.

Best practise is to go with controllers when these kind of situations arises.
Updated as per the discussion in chat

Looping with objects:

{{ x.name + ', ' + x.country }}


text:
Q: Using python opencv to load image from zip I am able to successfully load an image from a zip:
with zipfile.ZipFile('test.zip', 'r') as zfile:
    data = zfile.read('test.jpg')
    # how to open this using imread or imdecode?

The question is: how can I open this using imread or imdecode for further processing in opencv without saving the image first?
Update:
Here the expected errors I get.  I need to convert 'data' into a type that can be consumed by opencv.
data = zfile.read('test.jpg')
buf = StringIO.StringIO(data)
im = cv2.imdecode(buf, cv2.IMREAD_GRAYSCALE)
# results in error: TypeError: buf is not a numpy array, neither a scalar

a = np.asarray(buf)
cv2.imdecode(a, cv2.IMREAD_GRAYSCALE)
# results in error: TypeError: buf data type = 17 is not supported

A: use numpy.frombuffer() to create a uint8 array from the string:
import zipfile
import cv2
import numpy as np

with zipfile.ZipFile('test.zip', 'r') as zfile:
    data = zfile.read('test.jpg')

img = cv2.imdecode(np.frombuffer(data, np.uint8), 1)

A: HYRY's answer does indeed provide the most elegant solution

Reading images in Python doesn't quite comply with "There should be one-- and preferably only one --obvious way to do it."
It is possible that sometimes you'd rather avoid using numpy in some parts of your application. And use Pillow or imread instead. If one day you find yourself in such situation, then hopefully following code snippet will be of some use:
import zipfile

with zipfile.ZipFile('test.zip', 'r') as zfile:
    data = zfile.read('test.jpg')

# Pillow
from PIL import Image
from StringIO import StringIO
import numpy as np
filelike_buffer = StringIO(data)
pil_image = Image.open(filelike_buffer)
np_im_array_from_pil = np.asarray(pil_image)
print type(np_im_array_from_pil), np_im_array_from_pil.shape
# <type 'numpy.ndarray'> (348, 500, 3)

# imread
from imread import imread_from_blob
np_im_array = imread_from_blob(data, "jpg")
print type(np_im_array), np_im_array.shape
# <type 'numpy.ndarray'> (348, 500, 3)

Answer to "How to read raw png from an array in python opencv?" provides similar solution.


text:
Q: React-Native Splash screen fake I have a "animated" Splash screen with Lottie which looks identically to the iOS "native" Splash screen, I created in Xcode. Now I want to first launch the "native" Splash screen and then my "animated" one. The transition has to be seamless, so the user doesn't recognize, that it first was an image.
BUT
the "native" screen fades out and then my "fake screen" opens. So I want to get rid of the "fade out" between the screens. Any ideas or other approaches? Thank you so much!


text:
Q: Delphi 2007 ZeosLib 6.6 Mysql 4.1 Transaction lock table from other client The situation is this. I have two client programs that connect to the same mysql db on a server. When I run an operation on a table in the following way
        ZCon.TransactIsolationlevel := tiSerializable;
        ZCon.AutoCommit := true;
        ZCon.StartTransaction;
        try
          ZQGeneral.Close;
          ZQGeneral.SQL.Clear;

          ZQGeneral.SQL.Add('UPDATE table1 SET field1 = 1 WHERE id = 2');
          ZQGeneral.ExecSQL;
          ZQGeneral.Close;

          ZCon.Commit;
          ZCon.TransactIsolationlevel := tinone;
          ZCon.AutoCommit := False;

        except
          ZCon.Rollback;
          ZCon.TransactIsolationlevel := tinone;
          ZCon.AutoCommit := False;
        end;

the table 1 is blocked and will not unlock until the client disconnect that has completed the transaction. On the client who first started a transaction the table is also writeable but from the other client is read-only.
I gave to msyql account all the privileges for not mistaken, I also tried to send a UNLOCK tables after transaction operation but it did not help.
I double-checked the source of the program to make sure I did not forget some ZQuery open but nothing to scruples.
Why commit do not unlock table1 for other client?
I also tryed tiReadCommited and tiUnreadCommited with the same behavior.
I also tryed to upgrade Zeos to version 7.2 and change mysql with version 5 with then same result. Ah, I use InnoDB.

A: I found a solutions. Set autocommit to true and transactisoltionlevel to tiserializable before connection to mysql and not change it at runtime and then use implicit starttransaction when need.


text:
Q: jQuery conflict between a lightbox function and masonry/endless scroll I wanted to create a lightbox effect for images when clicked, so eventually I found this tutorial and followed all the necessary steps to insert it into my page (with a little modification).
The lightbox functions exactly the way I want it to, but the jQuery library used for the lightbox is conflicting with another script and it's messing up the multi-column layout and endless scroll.
This is a mock page with the lightbox effect. Normally, all the posts should be scattered in a lose multi-column fashion and new posts should load with endless scroll.
I tried deleting a bunch of things to see where the conflict was, and these are the two scripts that conflict.

A: jQuery needs to be the first script you include.
jQuery Masonry extends jQuery so you must reference the jQuery library first.

A: I see multiple IDs on divs containing images

what if you put class instead of id?
And could you provide an example of your masonry implementation?
Thanks


text:
Q: Calc 2 help, volume formed by solid Find the volume of the solid formed when the region bounded by the surface whose coordinates are $y=\sin x$, $y=\cos x$, $x$ varying from $x=0$ to $x= \pi/4$, is rotated around the $x$-axis.
Please help I'm totally lost on what to do thank you!

A: A volume rotated about the x axis using the washer method which conceptually sums the volume of a set of infinite washers from $x = 0$ to $x = \frac{\pi}{4}$ each with thickness dx.
The outer radius of the washers is $\cos(x)$
The inner radius of the washers is $\sin(x)$
The thickness of a washer is $\ dx$
The volume of a single washer is therefore $\pi(\cos(x)^2-\sin(x)^2)\ dx$
The volume of all the washers is: $$\mbox{Volume} =\pi\int_0^{\dfrac{\pi}{4}}\cos (x)^2-\sin (x)^2\ dx$$

A: Well, this is the graph you get when plotting those functions in thah interval:
https://www.desmos.com/calculator/i0hast2qg6

See it like this. You have a ceiling and a floor. The greater function (ceiling) is cosx and the lesser (floor) is senx. Since you already know that and know that the region rotates around x-axis (perpendicular to a rectangle of width dx), use the "washers method":
$$pi\int_1^{pi/4}(cosx)^2-(sinx)^2dx$$
This method is useful when you know that the rotating axis is perpendicular to dx. Now you can use this for a lot other problems. Just pay attention to wheter that $$floor-ceiling$$ relationship changes along the interval, in which case you need to separate the integral in subintervals. This happens if you integrate the same two functions in the interval https://www.desmos.com/calculator/jas6k435df $$[0,5pi/4]$$


text:
Q: Trouble with proof of deviations square I apologize upfront for any spelling mistakes, I'm not used to writing math in english! I tried searching for this question in here already but was not sure I used the best tags while doing so. Anyway, to the question:
It was taken from a brazilian textbook on Basic Statistics (Bussab & Morettin, 2013). It basically justs asks me to show that:
$${\sum\limits_{i = 1}^n {\left( {{x_i} - \overline x } \right)} ^2} = \sum\limits_{i = 1}^n {{x_i}^2 - n{{\overline x }^2} = \sum\limits_{i = 1}^n {{x_i}^2 - {{{{\left( {\Sigma {x_i}} \right)}^2}} \over n}} } $$
Now, I didn't really know where to start or if there's an official recommended approach to such proofs, but I just tried to start it by opening the first term:
$$\eqalign{
  & {\sum\limits_{i = 1}^n {\left( {{x_i} - \overline x } \right)} ^2} = {\left( {{x_1} - \overline x } \right)^2} + {\left( {{x_2} - \overline x } \right)^2} + ... + {\left( {{x_n} - \overline x } \right)^2}  \cr
  & {\sum\limits_{i = 1}^n {\left( {{x_i} - \overline x } \right)} ^2} = \left( {{x_1}^2 - 2{x_1}\overline x  + {{\overline x }^2}} \right) + \left( {{x_2}^2 - 2{x_2}\overline x  + {{\overline x }^2}} \right) + ...\left( {{x_n}^2 - 2{x_n}\overline x  + {{\overline x }^2}} \right) \cr} $$
At which point I felt I was close enough to start regrouping the pieces:
$$\eqalign{
  & {\sum\limits_{i = 1}^n {\left( {{x_i} - \overline x } \right)} ^2} = \left( {{x_1}^2 + {x_2}^2 + ...{x_n}^2} \right) + \left( {{{\overline x }^2} + {{\overline x }^2} + ... + {{\overline x }^2}} \right) - 2\overline x \left( {{x_1} + {x_2} + ... + {x_n}} \right)  \cr
  & {\sum\limits_{i = 1}^n {\left( {{x_i} - \overline x } \right)} ^2} = \sum\limits_{i = 1}^n {{x_i}^2}  + n{\overline x ^2} - 2\overline x \left( {{x_1} + {x_2} + ... + {x_n}} \right) \cr} $$
And that's where I stuck. I can get the $ + n{\overline x ^2}$ to be $ - n{\overline x ^2}$, and I don't know how to "get rid" of the third term.

A: You are almost done. Just write $$
\begin{align}
{\sum\limits_{i = 1}^n {\left( {{x_i} - \overline x } \right)} ^2} &= \sum\limits_{i = 1}^n {{x_i}^2}  + n{\overline x ^2} - 2\overline x \left( {{x_1} + {x_2} + ... + {x_n}} \right)\\&=\sum\limits_{i = 1}^n {{x_i}^2}  + n{\overline x ^2} - 2\overline x \overline xn\\&=\sum\limits_{i = 1}^n {{x_i}^2}  + n{\overline x ^2} - 2n\overline x^2\\&=\sum\limits_{i = 1}^n {{x_i}^2}  - n{\overline x ^2}.
\end{align}$$

A: $${\sum\limits_{i = 1}^n {\left( {{x_i} - \overline x } \right)} ^2} = $$
$$       \sum\limits_{i = 1}^n ({x_i}^2 - 2x_i\bar x+ \bar x^2)=$$
$$\sum\limits_{i = 1}^n ({x_i}^2) -2\bar x\sum\limits_{i = 1}^n x_i+n\bar x^2 = $$
$$\sum\limits_{i = 1}^n ({x_i}^2)-2\bar x(n\bar x)+n\bar x^2=$$
$$\sum\limits_{i = 1}^n ({x_i}^2)-2n\bar x^2+n\bar x^2=$$
$$\sum\limits_{i = 1}^n ({x_i}^2)-n\bar x^2$$

A: When both sides are divided by $n-1,$ the right-hand side is called the 'computational formula' for the sample variance
(as opposed to the 'definition' on the left) because it has various computational
advantages.
Just so there will be a derivation that is easy to follow for
the next visitor, let me give one continued equation with the key relationships. (For simplicity all sums are taken over $i = 1, 2, \dots, n.)$
$$\begin{align}
{\sum (X_i - \bar X)^2} &= {\sum(X_i^2 - 2\bar X X_i + \bar X^2)}
\\&= {\sum X_i^2 - 2\bar X\sum X_i + n\bar X^2}
\\&= \sum X_i^2 - 2\bar X(n\bar X) + n\bar X^2
\\&= \sum X_i^2 - n\bar X^2 = \sum X_i^2 - \frac{(\sum X_i)^2}{n}.
\end{align}$$
Notes on several advantages of the 'computational' form:
(1) The right-hand side has one subtraction and the left-hand side has $n$ subtractions.
(2) Suppose you have a calculator in which observations $X_i$ are entered
sequentially, each entry followed by pressing a key (perhaps "Data" or "$\Sigma^+$"). After each keypress: Memory A increments by $1,$ keeping
track of the number of observations; Memory B increments by $X_i,$ keeping
a running total; Memory C increments by $X_i^2.$ Then, when data entry
is finished, the formula for the numerator of the sample variance is
$C - B^2/A.$ Using the definition, the calculator would have to keep track
of all $n$ observations to get $\bar X$ and then use each observation
again to get $\sum (X_i - \bar X)^2.$
(3) Suppose you have Sample 1 with sample size $n_1,$ sample mean $\bar X_1,$
and sample variance $S_1^2$ known. Similarly, for Sample 2 you know $n_2, \bar X_2,$ and $S_2^2.$  Several uses of the computational formula allow you to
find the sample size, mean, and variance of the combined sample, even if the
original data are not available. [From $S_1^2, \bar X_1, n_1$ you can find $\sum_{[1]} X_i$ and $\sum_{[1]} X_i^2$ for the first sample. Similarly, for the second sample.
Then you can find the corresponding  sums for the combined sample, and finally the mean and variance for the combined sample.]


text:
Q: Dynamic RewriteRule in htaccess I am trying to rewrite dynamic rewrite url I want to change url
www.mysite.com/page.php?title=About Us
with this
www.mysite.com/about-us

I did is manually like this
RewriteRule ^about-us$ page.php?title=About\ Us [NC,L]

But I want it should be dynamic for new coming new pages I dont want to add manually links to htaccess
I tried
RewriteRule ^(.+)$ flights-detail1.php?dest=$1

But its not working for me. Need experts advice please

A: Redirect all your pages:
www.mysite.com/about-us
www.mysite.com/other
www.mysite.com/etc

like this
www.mysite.com/page.php?title=about-us

in your .htaccess:
RewriteEngine on
RewriteCond %{REQUEST_URI} !^page\.php
RewriteRule ^(.+)$ page.php?title=$1 [L,QSA]


text:
Q: Building app from shared folder in Visual Studio Express 2012 I'm trying to build an app from a shared folder in Visual Studio Express 2012.
While building an app from a local folder works just fine, the shared one doesn't. These are the errors thrown when building:
Error   1   Error : DEP0700 : Registration of the app in the layout folder "\VBOXSVR\Repos\App1\App1\bin\Debug\AppX" failed.   App1
Error   2   error 0x80073D55: Recovering DeploymentRequest from file C:\ProgramData\Microsoft\Windows\AppRepository\7b7fb2d4-65eb-45d3-808c-3e42a6eacbb4_S-1-5-21-1933965384-392669828-504697624-1001_1.rslc failed.    App1
Instead of using a shared folder in Virtual Box, I've tried to setup a Samba share, which I've mounted as a network drive. Also, I used caspol to make the drive trusted using this technique: http://blog.kowalczyk.info/article/Network-drives-net-security-and-virtualbox.html
My host OS is Max OSX and my guest OS is Windows 8.
I look forward to hearing your suggestions. Thank you!

A: It's funny how you often find the solution right after you ask the question ;-)
Here's the solution to anyone else interested: http://connect.microsoft.com/VisualStudio/feedback/details/106132/building-fails-when-build-directory-is-on-a-network-drive


text:
Q: Overriding dependencyManagement with local settings by maven build I'm using some java open source project that has a bug which is trivial to fix, however the people responsible for the project aren't willing to accept the fix.
Not going in details, it has to do with non-standard behavior of IE, which those people believe, Microsoft should be forced to change...
However, it is open-source project, so I can clone it, build locally, but I can't find out how can I deploy it to our corporate nexus repository. We have our distribution management, those folks have their own, we are putting our own in parent pom, they too. After cloning their repository, I'm using theirs distribution management, not mine...
So the question arises, how can I specify other distribution management for build process without messing up with project source? I have a very good reason for not messing with project pom - I don't want to have any local changes other than fixing that bug to be able to easily synchronize with the original repository!
According to threads like http://maven.40175.n5.nabble.com/Can-t-specify-distributionManagement-in-settings-xml-td3181781.html you are not allowed to specify distribution management in settings.xml.
Are there any alternatives? I'd like to stay away from hacks like injecting distribution management to pom.xml for build-time by build scripts..


text:
Q: connecting to databases using spring and hibernate - primary and secondary databases Hi this is what I am looking to do -
I have three databases - each exactly the same - one is primary and two and three are back ups.
I am using hibernate and spring to connect to the data base.I have spring application context file configured with 3 session factories, and 3 corresponding data sources.
I was wondering if there is a way using spring where if the application is not able to connect to the database 1  (an exception is thrown) it will connect to database 2 - and in turn is database 3 is down it will connect to 3 and proceed.
What would be the best way to implement this? I have read about AbstractRoutingDataSource ..but not sure how to make use of that in this case..also if there are other ideas.. Would appreciate some directions. Thanks!
this is my config in application context xml -
<bean id="dataSource1" class="com.mchange.v2.c3p0.ComboPooledDataSource"
        destroy-method="close">
        <property name="driverClass" value="$g{jdbc.driverClassName}" />
        <property name="jdbcUrl" value="$g{url1}" />
        <property name="user" value="$l{uid1}" />
        <property name="password" value="$l{pwd1}" />
        <property name="minPoolSize" value="$g{jdbc.minPoolSize}" />
        <property name="maxPoolSize" value="$g{jdbc.maxPoolSize}" />
        <property name="preferredTestQuery" value="$g{jdbc.preferredTestQuery}" />
        <property name="testConnectionOnCheckout" value="$g{jdbc.testConnectionOnCheckout}" />
    </bean>

    <bean id="sessionFactory1"
        class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
        <property name="dataSource" ref="dataSource1" />
        <property name="packagesToScan">
            <list>
                <value>com.model</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.hbm2ddl.auto">validate</prop>
                <prop key="hibernate.dialect">$g{jdbc.dialect}</prop>
                <prop key="hibernate.show_sql">$g{jdbc.show_sql}</prop>
            </props>
        </property>
    </bean>

    <bean id="dataSource2" class="com.mchange.v2.c3p0.ComboPooledDataSource"
        destroy-method="close">
        <property name="driverClass" value="$g{jdbc.driverClassName}" />
        <property name="jdbcUrl" value="$g{url2}" />
        <property name="user" value="$l{uid2}" />
        <property name="password" value="$l{pwd2}" />
        <property name="minPoolSize" value="$g{jdbc.minPoolSize}" />
        <property name="maxPoolSize" value="$g{jdbc.maxPoolSize}" />
        <property name="preferredTestQuery" value="$g{jdbc.preferredTestQuery}" />
        <property name="testConnectionOnCheckout" value="$g{jdbc.testConnectionOnCheckout}" />
    </bean>

    <bean id="sessionFactory2"
        class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
        <property name="dataSource" ref="dataSource2" />
        <property name="packagesToScan">
            <list>
                <value>com.model</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.hbm2ddl.auto">validate</prop>
                <prop key="hibernate.dialect">$g{jdbc.dialect}</prop>
                <prop key="hibernate.show_sql">$g{jdbc.show_sql}</prop>
            </props>
        </property>
    </bean>

    <bean id="dataSource3" class="com.mchange.v2.c3p0.ComboPooledDataSource"
        destroy-method="close">
        <property name="driverClass" value="$g{jdbc.driverClassName}" />
        <property name="jdbcUrl" value="$g{url3}" />
        <property name="user" value="$l{uid3}" />
        <property name="password" value="$l{pwd3}" />
        <property name="minPoolSize" value="$g{jdbc.minPoolSize}" />
        <property name="maxPoolSize" value="$g{jdbc.maxPoolSize}" />
        <property name="preferredTestQuery" value="$g{jdbc.preferredTestQuery}" />
        <property name="testConnectionOnCheckout" value="$g{jdbc.testConnectionOnCheckout}" />
    </bean>

    <bean id="sessionFactory3"
        class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
        <property name="dataSource" ref="dataSource3" />
        <property name="packagesToScan">
            <list>
                <value>com.model</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.hbm2ddl.auto">validate</prop>
                <prop key="hibernate.dialect">$g{jdbc.dialect}</prop>
                <prop key="hibernate.show_sql">$g{jdbc.show_sql}</prop>
            </props>
        </property>
    </bean>

    <bean id="transactionManager1"
        class="org.springframework.orm.hibernate4.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory1" />
    </bean>

    <bean id="transactionManager2"
        class="org.springframework.orm.hibernate4.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory2" />
    </bean>

    <bean id="transactionManager3"
        class="org.springframework.orm.hibernate4.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory3" />
    </bean>

A: There is a way to achieve this by using Spring Abstract Data Source Routing mechanism -
https://spring.io/blog/2007/01/23/dynamic-datasource-routing/


text:
Q: WebSphere Liberty JAX-WS Web Service Generation in Eclipse I have

*

*WebSphere Liberty 17.0.0.1 "BASE_ILAN" x86_64 on Windows Server 2012 R2

*Eclipse Neon.3 on Windows 10 x86_64 (separate server on the same LAN)

*Oracle Java JDK 1.8.0_121 running Liberty

*IBM JDK 8 (from the Eclipse bundle) running Eclipse (need it for the Windows remote server start/stop support)

In the bin directory, productInfo featureInfo returns many things, but among them:

*

*jaxws-2.2 [1.0.0]

*javaee-7.0 [7.0.0] (since this is a convenience feature that brings in tons of other stuff, you can probably infer how many other dozens of things I have also)

In my server.xml, under <featureManager>, I have a <feature>...</feature> for:

*

*javaee-7.0

*localConnector-1.0

*jsf-2.2

*restConnector-2.0

*jaxws-2.2

*jaxrs-2.0

In Eclipse, I right-click on my WAR project, go to New -> Other..., and pick Web Services -> Web Service. Click Next.
Now I have a dialog with the following fields:

*

*Web service type: "Bottom up Java bean Web Service"

*Service implementation: some.package.SomeWebService (from my code; it contains proper @WebService annotations, etc.)

*Slider set to "Start service" for the service, and "No client" on the bottom

*Configuration:

*

*Server runtime: WebSphere Application Server Liberty

*Web service runtime: IBM WebSphere JAX-WS

*Service project: <my WAR project>

*Service EAR project: <my EAR project>

*"Publish the Web service" checkbox is unchecked

*"Monitor the Web service" checkbox is unchecked

*"Overwrite files without warning" checkbox is checked

When I click Next, I get the following warning:

The project is targeted against a server without IBM WebSphere JAX-WS support. Continuing code generation will result in compilation errors.

If I click OK, I get routed to another dialog, "WebSphere JAX-WS Bottom Up Web Service Configuration", with various options. Regardless of what I select here, when clicking Next or Finish, I get the following error:

Tools for the targeted server must be installed in order to generate Web services code.

How can I overcome this problem and use JAX-WS with Liberty? I have the full EE profile so it should work, right?
I have already tried refreshing the cache under Servers -> Runtime Environments -> Edit -> Advanced. I even deleted and recreated my server, as well as wiped the Liberty directory and unpacked it again from scratch, embedding jaxws and Java EE full profile support from the very beginning.

A: Try setting a target runtime.   Right-click the WAR project, then select Properties, then Targeted Runtimes.   Select the checkbox next to the Runtime Environment you created and can see in the Runtime Explorer view.


text:
Q: How to add Select All and Deselect all button to the following code in flutter? I am a beginner and still learning flutter, and unable to add the select all/deselect all button Can anyone help me? I have a list of items and I want to add the Select All/Deselect All button to the following code, and when the Select all button is clicked below "Selected Button" should be visible.

This is my model class
 class ToyCarListModel{

  String toyimages, toyname, toymodel;
  bool isSelected;

  ToyCarListModel(this.toyimages, this.toyname, this.toymodel, this.isSelected);

}

This is main screen code
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:listview_image_text/carlistmodel.dart';

class ListToysUsingModel extends StatefulWidget {

  @override
  _ListToysUsingModelState createState() => _ListToysUsingModelState();
}

class _ListToysUsingModelState extends State<ListToysUsingModel> {

  List<ToyCarListModel> toylist =[
    ToyCarListModel("assets/pikachu.png", "flutter1", "model 1", false),
    ToyCarListModel("assets/pikachu.png", "flutter2", "model 2", false),
    ToyCarListModel("assets/pikachu.png", "flutter3", "model 3", false),
    ToyCarListModel("assets/pikachu.png", "flutter4", "model 4", false),
    ToyCarListModel("assets/pikachu.png", "flutter5", "model 5", false),
    ToyCarListModel("assets/pikachu.png", "flutter6", "model 6", false),
  ];

  List<ToyCarListModel> selectedcars = [];
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('List view with images using model'),
      ),
      body: Container(
        child: Column(
          children: [
            Container(
              child: TextButton(
                onPressed: () {},
                child: Text('All Select'),
              ),
            ),
            Expanded(child: ListView.builder(
              itemCount: toylist.length,
                itemBuilder: (BuildContext context, int index){
                return toysItem(
                  toylist[index].toyimages,
                  toylist[index].toyname,
                  toylist[index].toymodel,
                  toylist[index].isSelected,
                  index,
                );
                }),
            ),
            selectedcars.length > 0 ? Padding(
              padding: EdgeInsets.symmetric(
                horizontal: 25,
                vertical: 10,
              ),
              child: SizedBox(
                width: double.infinity,
                child: RaisedButton(
                  color: Colors.black,
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Text('Selected',style: TextStyle(color: Colors.white),),
                      Icon(Icons.done,color: Colors.white,),
                    ],
                  ),
                  onPressed: () {
                    print("List Lenght: ${selectedcars.length}");
                  },
                ),
              ),
            ): Padding(
              padding: EdgeInsets.symmetric(
                horizontal: 25,
                vertical: 10,
              ),
              child: SizedBox(
                width: double.infinity,
                child: RaisedButton(
                  color: Color(0xFFBFBFC0),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Text('Selected',style: TextStyle(color: Colors.white30),),
                      Icon(Icons.done,color: Colors.white30,),
                    ],
                  ),
                  onPressed: () {
                    print("List Lenght: ${selectedcars.length}");
                  },
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }

  Widget toysItem( String toyimages, toyname, toymodel, bool isSelected, int index){
    return Container(
      child: Column(
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Image.asset(toyimages),
              GestureDetector(
                child: Container(
                  child: isSelected
                      ? Icon(
                    Icons.check_circle,
                    color: Colors.black,
                  )
                      : Icon(
                    Icons.radio_button_unchecked_outlined,
                    color: Colors.grey,
                  ),
                ),
                onTap: (){
                  setState(() {
                    toylist[index].isSelected = !toylist[index].isSelected;
                    if (toylist[index].isSelected == true) {
                      selectedcars.add(ToyCarListModel(toyimages, toyname,toymodel, true));
                    } else if (toylist[index].isSelected == false) {
                      selectedcars
                          .removeWhere((element) => element.toyname == toylist[index].toyname);
                    }
                  });
                },
              ),
            ],
          ),
          Text(toyname),
          Text(toymodel),
          Divider(),
        ],
      ),
    );
  }

}

A: Here code for select
child: TextButton(
                onPressed: () {
                  setState (() {
                     for (var i = 0; i<toylist.length ; i++)
                         toylist[i]. isSelected = true;
                     selectedcars.addAll(toylist);
                     });
                 },
                child: Text('All Select'),
              ),

Here code for Deselect all
child: TextButton(
                onPressed: () {
                  setState (() {
                     for (var i = 0; i<toylist.length  ; i++)
                         toylist[i]. isSelected = false;
                     });
                 },
                child: Text('Deselect All'),
              ),

A: Duplication can be avoided using HashSet instead of List. You can use below code,
HashSet selectedcars = HashSet();

Using HashSet, you will have lesser code in selection & deselection logic. You can just check if the value present in hashset then show selection otherwise deselect the item.
To know more details on how to implement select and delete all using HashSet & single button, you can refer this link.


text:
Q: Python script to access a host with ssh and run commands in the host I am trying to write a python script that will allow me to ssh into a host, run a curl command, and then parse the output of the command.
I am trying something like
os.system('ssh HOST')
os.system('curl ...')

However, the curl command does not execute on the server. I get into the server but have no connection to it from the python script anymore. I need to be able to execute the curl command and access the output so I can parse it. Any ideas how I can accomplish this? Thanks.

A: To access the output of any command that you run , use the subprocess module. It gives a lot of control over the os commands that you run. Here is a code snippet.
import subprocess
process_object = subprocess.Popen(['cat','myfile.txt'],stdout=subprocess.PIPE , stderr = subprocess.STDOUT) ;
output = process_object.stdout.read()

Likewise your use ['ssh','HOST','argument2','argument3'] for your implementation. I'm not sure if this fixes your curl not executing problem. But it helps to get the output .

A: Supply the call to curl(1) in your ssh(1) command like ssh user@host curl somehost/somefile -o -.  Use the python subprocess module to get the result.


text:
Q: TVP stored procedure taking too long to load than usual Our table valued stored procedures are taking a longer time to load data than usual. Please find the below details:
Number of rows: 1.3M

*

*Time taken to load (old): 3 min

*Time taken to load (new): 25-40 min.

Nothing has changed in the server. Can you please give me pointers as to what needs to be looked into?
Application: we have deployed a SSIS package in SQL Server, which extracts data from different teradata sources in a loop and creates a datatable and executes a stored procedure using script component
Regards,
Swathi S
Have tried putting the insert within a transaction
Insert into (col1, col2....)
    select col1, col2
    from @tvpvariable


text:
Q: Explanation of the explosion principle The wikipedia page about the principle of explosion "from falsehood, anything" goes like this:
$P$ - assumption
$ \neg P$ - assumption
$ P \vee Q $ - Disjunction
$ Q $ - syllogism
Why would we need the $ \neg P$ then? isn't the "from falsehood, anything".
Isn't saying that "all humans need to breath $\vee$ god exists" says that we can use "god exists" as an argument?
I don't really get this, I would appreciate your help! Thank you!

A:
$P$ - assumption
$ \neg P$ - assumption
$ P \vee Q $ - Disjunction
$ Q $ - syllogism

Since $P$ is true (by assumption 1), then at least one of $P$ and $Q$ is true (line 3).
Since $P$ is false (by assumption 2), by line 3, $Q$ must be true.

Why would we need the $ \neg P$ then? isn't the "from falsehood, anything".

The conjunction of the two assumptions $P$ and $\neg P$ is a logical falsity (called a contradiction).

A: I'll do a couple of proofs and then we'll talk about them.
Syntactic Proof
$\begin{array}{}
\{1\}&1.&P&\text{Premise}\\
\{2\}&2.&\lnot P&\text{Premise}\\
\{2\}&3.&\lnot P\lor Q&\text{2, $\lor$I}\\
\{2\}&4.&P\to Q&\text{3, $\to$ Def$^1$}\\
\{1,2\}&5.&Q&\text{1, 4, MP}\\
\end{array}$
Semantic Proof
$P$ is a premise, so $v(P)=1$ and thus, for an arbitrary wff $Q$, $v(P\lor Q)=1$. $\lnot P$ is a premise, so $v(P)=0$, which means, as $v(P\lor Q)=1$, that $v(Q)=1$. As $Q$ was arbitrary, all wffs are true.
Discussion
What's happening in both proofs is we're using Disjunction Introduction to introduce an arbitrary formula, which we're then able to immediately detach. In other words, we're able to prove that an arbitrary formula is a logical consequence of contradictory premises. As the formula is arbitrary, we can generalise the result to all applicable formulas, which, in this case, means all formulas. More succinctly, from falsehood, anything - ex falso quodlibet.
1: $\to$ Definition


text:
Q: Is there a function similar to get_queried_object() that only gets the current archive taxonomy term but IGNORES url query parameters? Currently I have a taxonomy page using a custom php archive template. I am using ACF fields and needed to use the get_queried_object() to get the current taxonomy term/ID so that I could use taxonomy related custom fields.
My issue is I also have a search set up on the page that uses some url query parameters. And when I use the query parameters it interferes with the get_queried_object(), and takes the first url query parameter value. So my get_queried_object() is querying the url parameter and not the taxonomy's archive page that it is on.
I don't want to put my whole code in here, as a lot of it is unrelated, so I'll just put one small part of it.
<?php
$taxterm = get_queried_object();
$background_image = get_field('background_banner_image', $taxterm);
?>

<div class="page-header page-header_align_center" style="background-image:url(<?php echo $background_image['url'];  ?>)">

<?php the_field('heading', $taxterm); ?>

  <?php the_field('intro_text', $taxterm); ?>

I've potentially overlooked something obvious, but is there a different WP function that gets the current archive's taxonomy term/id?
EDIT:
My var_dump($taxterm) results with no url parameter:
  public 'term_id' => int 50
  public 'name' => string 'All Home Designs' (length=16)
  public 'slug' => string 'all' (length=3)
  public 'term_group' => int 0
  public 'term_taxonomy_id' => int 50
  public 'taxonomy' => string 'level-type' (length=10)
  public 'description' => string '' (length=0)
  public 'parent' => int 0
  public 'count' => int 2
  public 'filter' => string 'raw' (length=3)

With url parameter of ?series=classic
  public 'term_id' => int 51
  public 'name' => string 'Classic Series' (length=14)
  public 'slug' => string 'classic' (length=7)
  public 'term_group' => int 0
  public 'term_taxonomy_id' => int 51
  public 'taxonomy' => string 'series' (length=6)
  public 'description' => string '' (length=0)
  public 'parent' => int 0
  public 'count' => int 1
  public 'filter' => string 'raw' (length=3)

A: While you on you term archive page, queried object should represent term object. if not - probalby you doing something wrong.
If you using ?s parameter in you search form, just change it, coz it reserved by wordpress and recognizing as search.
Anyway, instead of using get_queried_object or get_queried_object_id you can check global query, there is should be what you looking for
global $wp_query;
var_dump($wp_query->query_vars);

A: I haven't fully explored the ins and outs of why this is happening, but had a similar issue when using taxonomy.php combined with query vars relating to taxonomies in the URL, and solved it by checking the request against the query:
global $wp;
global $wp_query;

$queried_object = get_queried_object();

// Grab what should be the term slug from the request
$req_path_last = basename($wp->request);

// If the term doesn't match the slug from the request, and the request slug exists as a term, attempt to use the right one
if (isset($queried_object->slug)
    && $queried_object->slug !== $req_path_last
    && term_exists($req_path_last)
    && is_array($wp_query->query)) {

    // If the term slug has been queried, either as a string or string in an array, let's grab the tax slug (should be the key)
    foreach ($wp_query->query as $slug => $value) {
        if ($value === $req_path_last || (is_array($value) && in_array($req_path_last, $value))) {
            $tax_slug = $slug;
            break;
        }
    }

    // If we have a taxonomy slug, use it, otherwise grab all potential terms based on the URL slug and use the first one
    if (!empty($tax_slug)) {
        $new_queried_object = get_term_by('slug', $req_path_last, $tax_slug);
    } else {
        $potential_terms = get_terms([
            'slug' => $req_path_last,
        ]);

        $new_queried_object = count($potential_terms) > 0 ? $potential_terms[0] : null;
    }

    $queried_object = $new_queried_object instanceof WP_Term ? $new_queried_object : $queried_object;
}


text:
Q: How to properly darken and show text on mouseover in a box using jquery? I am trying to make image gallery using css and jquery. I am having the following problems:-

*

*when I hover over the box h4 and p of all the boxes appears along with the box on which I hover. I want text to appear on those boxes only on which I hover.

*I am going to use background images in boxes instead of boxes. My code is not working whenever I hover on the box background - image does not darken.

$(document).ready(function(){
 $(".grid").mouseover(function(){
  $(this).addClass("darkbackground");
  $(".grid h4,.grid p").css("display","block");
 });

 $(".grid").mouseout(function(){
  $(".grid h4,.grid p").css("display","none");
  $(this).removeClass("darkbackground");
 });

});
.image-grids{
 width: 100%;
 display: table;
}

.image-grids-row{
 display: table-row;
 width: 100%;
}

.grid{
 width: 25%;  /**********In responsive design make it 50%;**********/
 height: 300px;
 display: table-cell;
 border: 1px solid black;
}
.grid h4,.grid p{
 display: none;
 padding: 10px;
}

.darkbackground{
 background: rgba(0,0,0,0.5);
 opacity: 0.5;
}

Ibiza

Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia

New Zealand

Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia

Goa

Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia

Maldives

Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia

A: Use $(this) to target the hovered element. Then you can use find() to get the element you want.
Background-color:  The background color property did not get applied beacuse it was ovewritten by the inline style you are giving.
You can use !important in your CSS, but you could better use id's at each .grid element in order to apply background colors from the CSS (not inline)
For example:
Instead of:

you can use:

and in CSS:
#grid_red { background-color:red }

Background-image:  The idea is to put a div with class .image-cover inside each .grid div and give them a position:absolute. Also, give a position:relative to each .grid element. Then, on .grid:hover, apply a background color of rgba(0,0,0,0.3). Check the first div and continue on your own

$(document).ready(function(){
 $(".grid").mouseover(function(){
  $(this).addClass("darkbackground");
  $(this).find("h4").css("display","block");
        $(this).find("p").css("display","block");
 });

 $(".grid").mouseout(function(){
  $(".grid h4,.grid p").css("display","none");
  $(this).removeClass("darkbackground");
 });

});
.image-grids{
 width: 100%;
 display: table;
}

.image-grids-row{
 display: table-row;
 width: 100%;
}

.image-cover {
    position: absolute;
    width: 100%;
    left: 0;
    top: 0;
    bottom: 0;
}

.darkbackground .image-cover {
    background-color: rgba(0,0,0,0.3)!important;
}

#grid-one {
    background-image: url('http://www.techinsights.com/uploadedImages/Public_Website/Content_-_Primary/Teardowncom/Sample_Reports/sample-icon.png');
}

.grid{
 width: 25%;  /**********In responsive design make it 50%;**********/
 height: 300px;
 display: table-cell;
 border: 1px solid black;
    position: relative;
}
.grid h4,.grid p{
 display: none;
 padding: 10px;
}

.darkbackground{
 background-color: rgba(0,0,0,0.5)!important;
 opacity: 0.5;
}

Ibiza

Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia

New Zealand

Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia

Goa

Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia

Maldives

Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia


text:
Q: composer.json cannot created, to run heroku I have Heroku login in my device, and try to deploy a folder of php codes in Heroku.
However when I tried to create composer.json, it got error:
enter image description here
what should I do?


text:
Q: Swift scrollview adding from XIB not scrollable at all I'm trying to import from Xib full screen ScrollView into my ViewController.
Following that guide i've made many working examples of it, but when importing it from Xib, ScrollView not responding on scroll (not even bouncing)
My Xib View class:
class TestScroll: UIView {

override init(frame: CGRect) {
    super.init(frame: frame)
}

required init?(coder aDecoder: NSCoder) {
    super.init(coder: aDecoder)
}

override func awakeFromNib() {
    super.awakeFromNib()

    self.translatesAutoresizingMaskIntoConstraints = false
}

public static func getViewFromNib() -> TestScroll {
    return UINib(nibName: "TestScroll", bundle: .main).instantiate(withOwner: nil, options: nil).first as! TestScroll
    }
}

And this is how i adding it in ViewController:
override func viewDidLoad() {
    super.viewDidLoad()

    let testScroll = TestScroll.getViewFromNib()
    self.view.addSubview(testScroll)
}

Please help, i've checked many guides already, but not found working example with Xib.

A: You need to set a frame / constraints
let testScroll = TestScroll.getViewFromNib()
testScroll.frame = self.view.bounds
self.view.addSubview(testScroll)

leave this
self.translatesAutoresizingMaskIntoConstraints = false

only if you'll set constraints


text:
Q: Wacom gets stuck in Ubuntu 20.04 I have a Wacom Bamboo small that worked well in Ubuntu 18.04. I recently installed Ubuntu 20.04 and drivers were installed automatically. Wacom tablet works and is detected until I click anything. From that point, the tablet does not work until I reconnect the usb. The mouse works properly during all events.
Has anyone else faced this? Could you please let me know if there is a fix?

A: Tried out various options.
What worked:
lsmod | grep wacom
sudo rmmod wacom
sudo modprobe wacom

And reboot


text:
Q: DataGridView for a list of classes without accessors I have a list of objects (List<MyClass>) whose members I would like to have visible in a DataGridView on a selective basis.
Here is my class:
class MyClass
{
   public int X;
   public int Y;
   public int Z;
}

Is it possible to have just the X and Y members visible in the grid without the use of accessors? I tried adding columns to the DataGridView but the data wasn't being filled (but I could have been doing this wrong. I just created a column with the same name as the field).
I am binding the list to the control with the following code:
datagrid.DataSource = list;

Any help on this would be amazing.

A: The problem is with your class; you are having public members but not public properties. Bindable controls such as DataGridView bind with public properties with get; set;
In short you need to change your class
class MyClass
{
    public int X
    {
        get;
        set;
    }
    public int Y
    {
        get;
        set;
    }
    public int Z
    {
        get;
        set;
    }
}

And then in designer specify column's DataPropertyName to respectively
DataPropertyName = X
DataPropertyName = Y
DataPropertyName = Z


text:
Q: Correct plural of FAQ FAQ stands for 'Frequently asked questions', with the plural being implicit in the acronym FAQ. But it is common to see the word 'FAQs' being used, which treat the word FAQ as an object in itself, and an s being added to its end in order to pluralize it.
Which one is the correct usage for FAQ ?

A: While the acronym does indeed stand for Frequently Asked Questions, in many cases, there is an implied list of (or perhaps document containing) in the acronym's usage, which is why it's treated as a singular object.  For example, I could have a FAQ that covers home buying and a separate one that has questions regarding home purchasing.  In this case, I might suggest that you check out the FAQs, meaning The lists of frequently asked questions.
In this case, I see nothing wrong with adding an s to pluralize the implied list (making it clear there there are multiple sets).
However, I would suggest that if you have a single list, and the s merely refers to the fact that multiple questions exist, the s is not needed.

A: I disagree that FAQ always stands for Frequently Asked Questions; a single question that is frequently asked is also a frequently asked question, or FAQ. Thus, a list of such questions is a list of FAQs.

A: A FAQ is a collection of Frequently Asked Question(s) for a specific topic.
FAQs are a collection of multiple lists of FAQ.
"I looked up a Fallout4 FAQ on GameFAQs"

A: IMHO "FAQs" is more natural. Consider if a page referred you to their FAQ. You (I) might think "What? Only one FAQ?". So adding the "s" makes sense to me.
Also, being pedantic, FAQ is not an acronym: It is an initialism. Acronyms are pronounceable words comprised of a set of initial letters, such as the word "laser".
G


text:
Q: Website Image Formats: Choosing the right format for the right task When designing a website, what do you consider the best image format to use for a particular task?
I always find myself in a dilemma when trying to figure out what format to use for a specific task...like for example, should I use .jpg all round?  or, when and why should I use a .png?
For example, taking Amazon's website, they use .jpg for product images (Example), .gif for this transparent pixel (Example) and .png for their CSS Sprites (Example)
On the other hand, Play.com use a .gif for their website logo (Example), but use .jpg for their website products (like Amazon) (Example) and as far as their main page goes, they dont have any .pngs on it.
So what formats should I use for my websites? and why should I use them?
[UPDATE]
Thanks CruellO for this link for explaining the differences, and also Dustin for giving reasons on what to use.

A: You should be aware of a few key factors...
First, there are two types of compression: Lossless and Lossy.
Lossless means that the image is made smaller, but at no detriment to the quality. Lossy means the image is made (even) smaller, but at a detriment to the quality. If you saved an image in a Lossy format over and over, the image quality would get progressively worse and worse.
There are also different colour depths (palettes): Indexed color and Direct color.
With Indexed it means that the image can only store a limited number of colours (usually 256) that are chosen by the image author, with Direct it means that you can store many thousands of colours that have not been chosen by the author.

BMP - Lossless / Indexed and Direct
This is an old format. It is Lossless (no image data is lost on save) but there's also little to no compression at all, meaning saving as BMP results in VERY large file sizes. It can have palettes of both Indexed and Direct, but that's a small consolation. The file sizes are so unnecessarily large that nobody ever really uses this format.
Good for: Nothing really. There isn't anything BMP excels at, or isn't done better by other formats.

GIF - Lossless / Indexed only
GIF uses lossless compression, meaning that you can save the image over and over and never lose any data. The file sizes are much smaller than BMP, because good compression is actually used, but it can only store an Indexed palette. This means that there can only be a maximum of 256 different colours in the file. That sounds like quite a small amount, and it is.
GIF images can also be animated and have transparency.
Good for: Logos, line drawings, and other simple images that need to be small. Only really used for websites.

JPEG - Lossy / Direct
JPEGs images were designed to make detailed photographic images as small as possible by removing information that the human eye won't notice. As a result it's a Lossy format, and saving the same file over and over will result in more data being lost over time. It has a palette of thousands of colours and so is great for photographs, but the lossy compression means it's bad for logos and line drawings: Not only will they look fuzzy, but such images will also have a larger file-size compared to GIFs!
Good for: Photographs. Also, gradients.

PNG-8 - Lossless / Indexed
PNG is a newer format, and PNG-8 (the indexed version of PNG) is really a good replacement for GIFs. Sadly, however, it has a few drawbacks: Firstly it cannot support animation like GIF can (well it can, but only Firefox seems to support it, unlike GIF animation which is supported by every browser). Secondly it has some support issues with older browsers like IE6. Thirdly, important software like Photoshop have very poor implementation of the format. (Damn you, Adobe!) PNG-8 can only store 256 colours, like GIFs.
Good for: The main thing that PNG-8 does better than GIFs is having support for Alpha Transparency.

Important Note: Photoshop does not support Alpha Transparency for PNG-8 files. (Damn you, Photoshop!) There are ways to convert Photoshop PNG-24 to PNG-8 files while retaining their transparency, though. One method is PNGQuant, another is to save your files with Fireworks.

PNG-24 - Lossless / Direct
PNG-24 is a great format that combines Lossless encoding with Direct color (thousands of colours, just like JPEG). It's very much like BMP in that regard, except that PNG actually compresses images, so it results in much smaller files. Unfortunately PNG-24 files will still be much bigger than JPEGs, GIFs and PNG-8s, so you still need to consider if you really want to use one.
Even though PNG-24s allow thousands of colours while having compression, they are not intended to replace JPEG images. A photograph saved as a PNG-24 will likely be at least 5 times larger than the equivalent JPEG image, with very little improvement in visible quality. (Of course, this may be a desirable outcome if you're not concerned about file size, and want to get the best quality image you can.)
Just like PNG-8, PNG-24 supports alpha-transparency, too.

A: JPEGs are for photos. I see JPEGs with text in them occasionally and they just look awful. Text is best for text, otherwise use PNG.
If it's not a photo, but you want a graphic of it, use a PNG. A PNG is almost always smaller than the equivalent gif and will not lose quality like a JPEG file.  A PNG equivalent of a JPEG will typically be a lot larger (assuming it's photorealistic). There may be times where this is still desirable.
PNG does allow for 8-bits of transparency, but if you have to support IE, you'll find that they continually refuse to support that correctly. They do support a single bit of transparency in an 8-bit image (essentially the same as gif) as far as I know. There are also numerous hacks to get 8-bit transparency to work in IE.  I've never bothered, myself.
In summary:

*

*Photos → jpg

*!Photos → png

A: PNG can be used when:

*

*You need transparency (either 1-bit or alpha transparency)

*Lossless compression will work well (such as a flat-style icon or logo)

JPEG can be used when:

*

*Lossless compression will not work well (such as a photograph)

GIF can be used when:

*

*Animation is necessary, and video is not possible (though you should really try and use video; animated GIFs are poor quality and very inefficient)

Despite myths to the contrary, PNG outperforms GIF in all like for like comparisons.  PNG is capable of every image mode of GIF apart from animation, and when using the same image mode, PNG will have better compression due to its superior DEFLATE algorithm compared to LZW.  PNG is also capable of additional modes that GIF cannot do, such as 24 bit color, and multi-bit transparency (alpha transparency).  Note that multi-bit transparency used to be a problem back when people used IE6.
PNG modes include (this is just a small subset)

*

*Palette colour of 2 to 256 colors (like GIF)

*Palette colour of 2 to 256 colors, with transparent color (like GIF)

*True color (24 bit color)

*True color with alpha channel (24 bit color + 8 bit transparency)

For best compression in PNG for the web, always use a palette mode.  If you find PNG files are larger than the equivalent GIF files, then chances are you're saving the PNG in 24 bit color and the GIF in palette mode (because saving a full color GIF always requires translation to palette mode).  Try converting the image to palette mode before saving in both cases.
PNG also has other modes such as palette color with alpha transparency in the palette.  Modes such as this work in browsers but software like Photoshop have (or once had) problems with creating or working with them due to not supporting those image modes.

A: If you are storing or presenting a large number of images the new Google WebP format might be worth considering as it is 25% smaller than PNG/JPG.
Note this is not supported by all browsers at the moment.
NB. This came out in 2010 after this question was posted.

A: JPEG FILE FORMAT

*

*Great for images when you need to keep the size small

*Good option for photographs

*Bad for logos, line art, and wide areas of flat color

GIF FILE FORMAT

*

*Great for animated effects

*Nice option for clip art, flat graphics, and images that use minimal colors and precise lines

*Good option for simple logos with blocks of colors

PNG FILE FORMAT

*

*Lossless

*Excellent choice when transparency is a must

*Good option for logos and line art

*Not supported everywhere

You can see this infographics for more detailed information, Image File Types: When to use JPEG, GIF & PNG


text:
Q: Reconciling compiled prepared statement with execs thereafter in a SQL Server profiling session We are using SQL Server and GORM (Grails / Hibernate).
Recently our DBA asked me if we could use stored procedures instead of normal Hibernate prepared statements on a certain critical path table in our database. He is not concerned about performance or anything like that, rather he explained that it is very difficult for him to profile Hibernate prepared statements because, loosely quoted, "Somewhere in the session you get a prepared statement that has the SQL text...thereafter you just get execs of the prepared statement. Reconciling the two in a production system is near impossible".
Of course I would prefer to use domain classes with normal insert / update /delete behavior in our application rather than manually building / executing prepared statements. So two questions come to my mind:

*

*Can SQL Server Profiler be configured in some way, or is there some technique, to make it easier to profile Hibernate prepared statements? If not...

*Is there some non-intrusive customization I can do in my Hibernate / Grails app to use the domain classes as I normally would but change the backend code generation (I don't know, perhaps using Hibernate Intercepts... perhaps I can specify an SP to use instead of prepared statements for specific insert / update / delete operations... or perhaps I can indicate that the prepared statement should have a fixed "name" that might help make it identifiable to the DBA in a profiling session...).

Update
Example grabbed from SQL Server Profiler session:
--sp_prepare on first execute
declare @p1 int
set @p1=8
exec sp_prepare @p1 output,N'@P0 int',N'select <columns> from <table> where <primary key> = @P0 ',1
select @p1
go

--sp_execute thereafter
exec sp_execute 8,1
go

A: If it's sp_prepare, there's an article on SQL Server Central that says you can turn that off in the Hibernate configuration like:
<property name='prepare_sql'>false</property>

It looks like Hibernate will send parameterized queries with this setting turned off.  Which would allow SQL Server to cache the plan exactly like a prepared query.
However, some articles suggest that without prepare_sql, Hibernate will vary the parameter size for strings.  That would make SQL Server's plan caching useless.  You might want to investigate further.