text:
Q: Analyzing Memory dump for High CPU usage shows calls to Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Storage.ConfigurationChangeWatcher I am analyzing memory dumps for high CPU usage but all I see is most of the runaway threads show a constant time of  0 days 0:05:48.921 the second and millisecond change offcourse and mostly all call the Microsoft Practices EnterpriseLibrary ConfigurationChangeWatcher. We are using MS Ent Lib 6 for logging. I do not understand how would that all be related to High CPU usage can anyone help me analyze the dumps and throw some light.
Child SP               IP Call Site
000000581c2ddeb0 00007ffb58790b2a [GCFrame: 000000581c2ddeb0]
000000581c2ddf80 00007ffb58790b2a [GCFrame: 000000581c2ddf80]
000000581c2ddfb8 00007ffb58790b2a [HelperMethodFrame: 000000581c2ddfb8] System.Threading.Monitor.Enter(System.Object)
000000581c2de0b0 00007ffaf0046f8a System.Threading.TimerQueueTimer.Change(UInt32, UInt32)
000000581c2de120 00007ffaf0ab0047 System.Timers.Timer.set_Enabled(Boolean)
000000581c2de180 00007ffaf1bf3edb Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Storage.ConfigurationChangeWatcher.pollTimer_Elapsed(System.Object, System.Timers.ElapsedEventArgs)
000000581c2de1d0 00007ffaf1bf3ea1 Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Storage.ConfigurationChangeWatcher.pollTimer_Elapsed(System.Object, System.Timers.ElapsedEventArgs)
000000581c2de220 00007ffaf1bf395f System.Timers.Timer.MyTimerCallback(System.Object)
000000581c2de2a0 00007ffaf049e7b2 System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
000000581c2de370 00007ffaf049cb67 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
000000581c2de3a0 00007ffaf0a13c69 System.Threading.TimerQueueTimer.CallCallback()
000000581c2de400 00007ffaf0a1390a System.Threading.TimerQueueTimer.Fire()
000000581c2de450 00007ffaf0a1c079 System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
000000581c2de4b0 00007ffaf0a19c48 System.Threading.ThreadPoolWorkQueue.Dispatch()
000000581c2de928 00007ffb4f3f4073 [DebuggerU2MCatchHandlerFrame: 000000581c2de928]
000000581c2deab8 00007ffb4f3f4073 [ContextTransitionFrame: 000000581c2deab8]
000000581c2decd8 00007ffb4f3f4073 [DebuggerU2MCatchHandlerFrame: 000000581c2decd8]
Child SP               IP Call Site
000000581b73e1e8 00007ffb5879195a [InlinedCallFrame: 000000581b73e1e8] Microsoft.Win32.Win32Native.GetFileAttributesEx(System.String, Int32, WIN32_FILE_ATTRIBUTE_DATA ByRef)
000000581b73e1e8 00007ffaefe84a3a [InlinedCallFrame: 000000581b73e1e8] Microsoft.Win32.Win32Native.GetFileAttributesEx(System.String, Int32, WIN32_FILE_ATTRIBUTE_DATA ByRef)
000000581b73e1c0 00007ffaefe84a3a DomainNeutralILStubClass.IL_STUB_PInvoke(System.String, Int32, WIN32_FILE_ATTRIBUTE_DATA ByRef)
000000581b73e280 00007ffaefe83d92 System.IO.File.FillAttributeInfo(System.String, WIN32_FILE_ATTRIBUTE_DATA ByRef, Boolean, Boolean)
000000581b73e2f0 00007ffaefe83bc7 System.IO.File.InternalExists(System.String)
000000581b73e350 00007ffaefe81544 System.IO.File.InternalExistsHelper(System.String, Boolean)
000000581b73e390 00007ffaf0aafe51 Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Storage.ConfigurationChangeFileWatcher.GetCurrentLastWriteTime()
000000581b73e3c0 00007ffaf1bf3e18 Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Storage.ConfigurationChangeWatcher.pollTimer_Elapsed(System.Object, System.Timers.ElapsedEventArgs)
000000581b73e410 00007ffaf1bf395f System.Timers.Timer.MyTimerCallback(System.Object)
000000581b73e490 00007ffaf049e7b2 System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
000000581b73e560 00007ffaf049cb67 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
000000581b73e590 00007ffaf0a13c69 System.Threading.TimerQueueTimer.CallCallback()
000000581b73e5f0 00007ffaf0a1390a System.Threading.TimerQueueTimer.Fire()
000000581b73e640 00007ffaf0a1c079 System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
000000581b73e6a0 00007ffaf0a19c48 System.Threading.ThreadPoolWorkQueue.Dispatch()
000000581b73eb18 00007ffb4f3f4073 [DebuggerU2MCatchHandlerFrame: 000000581b73eb18]
000000581b73eca8 00007ffb4f3f4073 [ContextTransitionFrame: 000000581b73eca8]
000000581b73eec8 00007ffb4f3f4073 [DebuggerU2MCatchHandlerFrame: 000000581b73eec8]
I see this pattern through out the call stack.


text:
Q: C++ serialize multiple objects to one file and deserialize limited number of them Before I start, consider this code:
One data transfer object ObjectDTO
class ObjectDTO {

public:
    int id;
    string string1;
    string string2;
    string string3;
    int code1;
    vector<string> stringList1;

private:
    friend class boost::serialization::access;

    template<class Archive>
    void serialize(Archive &archive, const unsigned int version) {
        archive & id;
        archive & string1;
        archive & string2;
        archive & string3;
        archive & code1;
        archive & stringList1;
    }

Serialization
void OutputStreamService::writeReportsToFile(vector<ObjectDTO> objects, int filename){
    ofstream outputFileStream(to_string(filename));
    boost::archive::binary_oarchive outputArchive(outputFileStream);
    outputArchive << objects;
}

Deserialization
vector<ObjectDTO> InputStreamService::readObjects() {
    ifstream inputFileStream(to_string(fileNumber++));
    boost::archive::binary_iarchive inputArchive(inputFileStream);
    vector<ObjectDTO> objects;
    inputArchive >> objects;
    return objects;
}

I am using Boost Serialization C++ librarys to serialize a vector of ObjectDTOs and read it back later.
Supose i generated 30GB of random ObjectDTOs and saved it to the same file
How can i read only some of them to avoid reaching memory limit?
I am using Boost Serialization because it was the simples way i found  to solve the first problem but i can change to any other approach if necessary!

A: Use Google Protocol buffers instead, there are CodedOutputStream class for serialization and CodedInputStream for deserialization.
One of CodedOutputStream methods is WriteVarint32, which allows to write a number which could be used as an index in the stream.
In CodeInputStream there is corresponding ReadVarint32 method, eg.
Serialization:
char text[[]] = "Hello world!";
coded_output->WriteVarint32(strlen(text));
coded_output->WriteRaw(text, strlen(text));

Deserialization:
uint32 size;
coded_input->ReadVarint32(&size);

char* text = new char[size + 1];
coded_input->ReadRaw(buffer, size);

The last line allows you to read the content of serialized stream starting from given index.
Here are my two methods to serialize/deserialize streams with given length at the start.
template < class T>
void TProtoBufSerializer::SerializeImplementation(const T& protoBuf, std::vector<char>& buffer )
{
    int bufLength = protoBuf.ByteSize() + google::protobuf::io::CodedOutputStream::VarintSize32(protoBuf.ByteSize());
    buffer.resize(bufLength);

    google::protobuf::io::ArrayOutputStream arrayOutput(&buffer[0], bufLength);
    google::protobuf::io::CodedOutputStream codedOutput(&arrayOutput);

    codedOutput.WriteVarint32(protoBuf.ByteSize());
    protoBuf.SerializeToCodedStream(&codedOutput);
}

template < class T>
bool TProtoBufSerializer::DeSerializeImplementation(std::vector<char>& buffer, T& protoBuf )
{
   bool deserialized = false;

   google::protobuf::io::ArrayInputStream arrayInput(&buffer[0],buffer.size());
   google::protobuf::io::CodedInputStream codedInput(&arrayInput);

   unsigned int object_size;
   bool header_readed = codedInput.ReadVarint32(&object_size);

   if(header_readed && object_size > 0)
   {
       if( buffer.size() >= codedInput.CurrentPosition() + object_size )
       {
           google::protobuf::io::CodedInputStream::Limit limit = codedInput.PushLimit(object_size);

           if(protoBuf.ParseFromCodedStream(&codedInput))
           {
               std::vector<char>::iterator it = buffer.begin();
               std::advance(it,codedInput.CurrentPosition());
               std::move(it,buffer.end(),buffer.begin() );
               buffer.resize(buffer.size() - codedInput.CurrentPosition());
               deserialized = true;
           }
           else
           {
              throw TProtoBufSerializerPayloadException();
           }
           codedInput.PopLimit(limit);
       }
   }
   else
   {
       //varint32 which is used in header is at the most 5 bytes long,
       //if given buffer is 5 bytes or more long and header still cannot be decoded - raise exception
       if(buffer.size() >= 5)
       {
          throw TProtoBufSerializerHeaderException();
       }
   }
   return deserialized;
}

A: I solved the problem discarding Boost Serialization and vectors in favor of arrays with plain old C++ write and read on ofstream and ifstream respectively.
My OutputStreamService writeObjectsToFile ended like this:
void OutputStreamService::writeObjectssToFile(ObjectDTO * objects, int filename){
        ofstream outputFileStream(to_string(filename), std::ios::binary);
        outputFileStream.write((char *)&objects, sizeof(objects));
}

And InputStreamService with readObjects:
ObjectDTO * InputStreamService::readObjects() {
    ifstream inputFileStream(to_string(fileNumber++), std::ios::binary);
    ObjectDTO objects[10];
    inputFileStream.read((char *)&objects, sizeof(objects));
    return objects;
}

This way i can define 10 or any other integer as the number of objects i want to read in.
To solve the mais problem, i can now calculate the aprox number of objects my memory can handle and then limit the number of reads!
Ty!

redpajama_set_name: RedPajamaStackExchange


text:
Q: JavaScript : passing javascript arrayof object to external javascript in my page1.html i have a an array of
var responder = {
     "id" : [],
     "name" : []
};
details(responder);

responder contains id = 1, name = "josh"
and i want to get the responder data in a external js "pop-up.js"
<script>
   details(responder){
      for (var i = 0; i < responder.length; i++){
        alert(responder['id']);
       }
 }

but the result is undefined or sometimes NaN
how can i pass correctly the data of responder?

A: Ensure that in page1.html, you have a script tag
<script>
var responder = {
     "id" : [],
     "name" : []
};
details(responder);
</script>

If the script tag to import pop-up.js is placed above this one then it will not have access to responder.
Another way to do it would be if you use window.onload (or document.onload) event in pop.js, so that your DOM is ready (i.e. all scripts has been loaded)
   window.onload = function(){
      function details(responder){
         for (var key in responder ){
           alert(responder[key ]);
          }
       }
   };


text: Q: Array is empty but showing as non-empty , javascript, angular6 I am checking an Object in console, it is showing as having Array with 2 elements, but on expanding that object the array is shown as empty. How can this happen? Please see the screenshot


text:
Q: Jquery sorting div (descending order) based on attribute value I have a ajax function which actually pull this message_count data from server every 3 mins and update the attribute of each player accordingly... now i want to get the divs automatically gets sorted after this ajax call based on message_count attribute value in descending order... so the player who got more messages will come as first div.

var sortedDivs = jQuery(".players").find(".player").toArray().reverse(sorter);
jQuery.each(sortedDivs, function(index, value) {
  jQuery(".players").append(value);
});

function sorter(a, b) {
  return a.getAttribute('message_count') - b.getAttribute('message_count');
};

8

2

0

1

A: Using jquery .sort will do it easily

var players = $(".players div");
var temp = players.sort(function(a,b){
  return parseInt($(b).attr("message_count")) - parseInt($(a).attr("message_count"));
});
$(".players").html(temp);

Div 8

Div 2

Div 0

Div 1

A:    $('div').sort(function (a, b) {

      var contentA =parseInt( $(a).attr('message_count'));
      var contentB =parseInt( $(b).attr('message_count'));
      return (contentA < contentB) ? -1 : (contentA > contentB) ? 1 : 0;
   })

A: You can use the javascript sort() method and just reverse the query.
.sort(function(a, b){return b.getAttribute('message_count') - a.getAttribute('message_count'))

var sortedDivs = jQuery(".players").find(".player").toArray().sort(function(a, b){return parseInt(b.getAttribute('message_count')) - parseInt(a.getAttribute('message_count'))});

jQuery.each(sortedDivs, function(index, value) {
  jQuery(".players").append(value);
});

8

2

0

1


text:
Q: FileUpload without transferring files I need to provide a way for the user to specify a path to a file on his machine on my intranet web application, and the ASP:FileUpload control provides a nice dialog to do that, however it also transfers the contents of the file over. Since I only need the file path and not the contents, is there another way to achieve this?

A: You could add a FileUpload control. Then before your form is submited you could copy the file path to some hidden input and remove FileUpload control with JavaScript.
I've never tried that but it should work. Don't know the purpose though.

A: UPDATE : The code below will return the full file path in IE, but for security reasons, firefox and chrome only give you the file name. This might be a bit of a problem :)

I took the liberty of implementing the solution given by RaYell. Here's the code:
Default.aspx (markup):
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="SO._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
    <script type="text/javascript">
        function submitFormWithoutFile() {
            var fileUpload = document.getElementById('<%= this.FileUpload1.ClientID %>');
            var filePath = document.getElementById('<%= this.FilePath.ClientID %>');
            filePath.value = fileUpload.value;
            fileUpload.parentNode.removeChild(fileUpload);
        }
    </script>
</head>
<body>

    <form id="form1" runat="server">
        <asp:HiddenField ID="FilePath" runat="server" />
        <asp:FileUpload ID="FileUpload1" runat="server" />

        <asp:Button ID="Button1" runat="server" Text="Do it!" OnClientClick="submitFormWithoutFile();" />
    </form>
</body>
</html>

Default.aspx.cs (code-behind)
namespace SO
{
    using System;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack)
            {
                // we have our file name but not the file
                this.form1.Controls.Add(new Literal() { Text = this.FilePath.Value });
                System.Diagnostics.Debug.Assert(this.FileUpload1.PostedFile == null);
            }
        }
    }
}


text:
Q: SSLError while requesting my API with Flask I developped an API (endpoint : https://helloworld.mycompanyname that I need to request with a parameter 'key' ). I want to access this API from my front so I'm trying this method :
@app.route('/test/', methods=("POST","GET"))
def test():
   payload = {'key':'****'}
   r = requests.get('https://helloworld.mycompanyname/', params=payload)
   return r.text

And I have this SSLerror :

requests.exceptions.SSLError: HTTPSConnectionPool(host='helloworld.mycompanyname', port=443): Max retries exceeded with url: /?key=*** (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])")))

How can I fix that ?

A: Which version of python are you using ? If you are using the older version then you end up getting SSL Error try to upgrade to 3.4 or latest. It should resolve your issue.


text:
Q: Is composition of covering maps covering map? In Munkres book, composition of covering maps is covering map when $r^{-1}(z)$ is finite for each $z$ in $Z$ where $q : X\to Y$ , $r:Y\to Z$ are the covering maps.
I tried hard to find an example that composition of covering maps is not covering maps but I couldn't find it.
Is there such an example?

A: Yes there is. The following is a classical example (I think it is in Hatcher for example).
Take $H$ to be the hawaiian earings space, that the subspace of $\mathbb C$ which is the union of the circle $C_n\, (n\geq 1)$ of center $\frac 1 {2n}$ and radius $\frac 1 {2n}$.
Then you can get a composition of covering maps which is not a covering map as follow :

*

*For any $n\geq 1$, find a covering map $p_n \colon E_n \to H$ such that the restriction $p^{-1}(C_n) \to C_n$ is not a trivial covering map.

*Define $E = \coprod_{n\geq 1} E_n$ and $p \colon E \to H$ the map induced by all the $p_n$'s. Show that $p$ is not a covering map.

*Show that there is a trivial covering map $t \colon T \to H$ and a (non trivial) covering map $q \colon E \to T$ such that $p = t \circ q$.

I let you fill the details, but the idea is the following : $p \colon E \to H$ should be a map such that for any open neighbourhood $U$ of $0$, $p^{-1}(U)$ is almost a (countable) disjoint union of copy of $U$ except one of the summand screws things up.

A: Here is a simple visualization of the example that Pece is talking about. The top map is a 2-fold covering but the bottom map has infinite fibers. The composition isn't locally trivial and is therefore not a covering map. However, it is still a semicovering map in the sense that it is a local homeomorphism which has the unique path lifting property.


text:
Q: How to export to AAC audio from Audacity? Exporting to MP3 audio from Audacity works fine, but exporting to "M4A (AAC)" results in nothing. No file is created or whatsoever.
I can see that it depends on "ffmpeg" library to work, but the application WinFF (which also makes use of this library) is working fine to me. Do I need to install anything else?

A: This seems to be a known issue between ffmpeg and Audacity 1.3.x
Read more about it here.
My guess is that the Ubuntu packagers decided not to compile Audacity with support for the ffmpeg libraries because of these issues. I don't know what versions are in the official repo, as I'm using the Getdeb.net ones. I can confirm that what you said does not work for me either, but it applies to all ffmpeg exports.


text:
Q: can't call onactivity result function after child activity is finished i am using following codes.
 addNewReceipt.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                Intent myIntent = new Intent(v.getContext(), AddReceipt.class);
                myIntent.putExtra("receiptList", receipts);
                startActivityForResult(myIntent, RECEIPT_ADD);
            }
        });
    }

    @SuppressWarnings("unchecked")
    public synchronized void onActivityResult(final int requestCode, int resultCode, final Intent data)
    {
    if (resultCode == Activity.RESULT_OK)
    {
     if (requestCode == RECEIPT_ADD)
     {
        receipts = (ArrayList<Receipt>) data.getSerializableExtra("receiptList");
        addReceiptsInListView();
     }
    }
    }

The code for AddReceipt class is as follow,
@Override
    public void finish() {
        Intent data = new Intent();
        data.putExtra("receiptList", receipts);
        setResult(RESULT_OK, data);
        super.finish();
    }

    @SuppressWarnings("unchecked")
    public void onCreateCall()
    {

          done.setOnClickListener(new OnClickListener()
          {  //receiptAddBtn
                @Override
                public void onClick(View v)
                {
                    String error = "";
                    Receipt receipt = new Receipt();
                    receipt.comments = comments.getText().toString();
                    receipt.referenceNo = receiptNo.getText().toString();
                    receipt.image = imageSelected;
                    if (receipt.image == null || receipt.referenceNo == "" )
                    {
                        error = "Please input Receipt No. and attach Image";
                        displayAlert(error);
                    }
                    else
                    {
                        receipts.add(receiptCounter,receipt);
                                              finish();
                    }
                }
            });
    }

The problem is, when the activity is finished... and i pass this receipt, in my previous class from which i call this activity public synchronized void onActivityResult Never works.
The back button is not ending activity either.
Please tell me where i am wrong,.
Best Regards

A: Here is the solution to your problem
@Override
    public void finish() {
        Intent data = new Intent();
        data.putExtra("receiptList", receipts);
        setResult(Activity.RESULT_OK, data);
        super.finish();
    }


text:
Q: Change Model Values using JQuery in MVC I want to change the model data with jquery. I make 2 hiddenfor elements and change their value inide the jquery (i chekch their values using alert and all seems to be working) but when i use ajax to call function the values are default (nothing). Is this the wrong sollution?
This is my view code:
@Html.HiddenFor(Function(x) x.ElementNameSelected, New With {.id = "ElementSelected"})
@Html.HiddenFor(Function(x) x.Remove, New With {.id = "Remove"})

this is my JQuery:
<script type="text/javascript">
$('.RemoveNode').click(function () {
    if ($(".event_result").html() == "")
        alert("Nie Wyprales elementu z drzewa!")
    else {
        $("#ElementSelected").val($(".event_result").html());
        $("#Remove").val(true);

        alert($("#ElementSelected").val());
        alert($("#Remove").val());

        $.ajax({
            type: 'POST',
            url: "/TreeTest/AddNewTree",
            data: '@Model'
        });
    }
});
</script>

setting the model values would look something like that?
$.ajax({
            type: 'POST',
            url: "/TreeTest/AddNewTree",
            data: {
                '@Model' : {
                    Remove: true,
                    NameToAdd : "wololo"
                }
            }
        });

A: I have done it the easiest way possible (well i think :P )
I made
Html.BeginForm

and i have added
"onclick='submitRemove()'

inside thesubmit and in jQuery function submitRemove i set values for hiddenfor :)
Thanks for all help!


text:
Q: How to make histogram using image? [ImageJ + Netbeans] I beg You. Please tell me how to create a histogram from B&W image pixels in ImageJ with use of Java (Netbeans)? What code should I use or anything...
I have to do a project on Grade. I have only a few hours.

A: I have tried do it with example code found somewhere on the internet. It's for RGB but anyway, it looks like this:
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import javax.swing.JFrame;

public class HistogramRGB extends JFrame {

public HistogramRGB (BufferedImage newimg){

   setSize(500,500);
   setTitle("HistogramRGB");
   hist=newimg;
   setVisible(true);
}
public void paint(Graphics g) {
    super.paint(g);
    Graphics2D g2D=(Graphics2D)g;
    Rfreq=new int[256];
    Gfreq=new int[256];
    Bfreq=new int[256];
    int width = hist.getWidth();
    int height = hist.getHeight();
    for(int i=0;i<width;i++) {
        for(int j=0;j<height;j++) {

            rgb =hist.getRGB(i,j);
            rcolor = (rgb >> 16) & 0xff;
            gcolor = (rgb >> 8) & 0xff;
            bcolor = (rgb >> 0) & 0xff;
            Rfreq[rcolor]++;
            Gfreq[gcolor]++;
            Bfreq[bcolor]++;
        }
    }

    int iw=w/2;
    int ih=h/2;

   for(int i=0;i<256;i++) {

        g2D.setColor(Color.RED);
g2D.drawLine(20+i,h-20,20+i,h-(Rfreq[i]/10)-20 );

         g2D.setColor(Color.GREEN);
        g2D.drawLine(20+i,h-20,20+i,h-(Gfreq[i]/10)-20);
        g2D.setColor(Color.BLUE);
        g2D.drawLine(20+i,h-20,20+i,h-(Bfreq[i]/10)-20);

        sumR+=Rfreq[i]*i;
        sumG+=Gfreq[i]*i;
        sumB+=Bfreq[i]*i;

    }
     g.setColor(Color.BLACK);
    g2D.drawLine(10,h-10,10,h-256);
    g2D.drawLine(10,h-10,256,h-10);
    g2D.drawString("0-->255",260,h-10);
    g2D.setFont(new Font("Aril",Font.BOLD,12));

    g2D.drawString("RGB Histogram",300,100);
    g2D.drawString("Red Mean :",300,120);
    g2D.drawString(Long.toString( sumR/(height*width)),400,120);
    g2D.drawString("Green Mean :",300,140);
    g2D.drawString(Long.toString(( sumG/(height*width))),400,140);
    g2D.drawString("Blue Mean :",300,160);
    g2D.drawString(Long.toString(( sumB/(height*width))),400,160);

}

BufferedImage hist ;
int w=500;
int h=500;
int[] Rfreq;
int[] Gfreq;
int[] Bfreq;
int rcolor;
int gcolor;
int bcolor;
int rgb;
long sumR;
long sumB;
long sumG;
}


text:
Q: Extract uploaded email metadata into SPO columns: feasible with SPFx? I am attempting to develop a solution to provide the following functionality:

*

*When an email file (.msg) is uploaded to a SharePoint Online folder
configured for emails, the email metadata (to, from, subject, etc.)
is automatically extracted and saved into corresponding columns.

There are third-party products for this, but if possible my client wants to avoid the ongoing costs and implement their own solution.
My question is: would it be feasible to do this with a client-side Javascript add-in created with the SharePoint Framework?
The theory is if the script included an email parser* to extract metadata from the email header, then this could be saved into columns via a CRUD operation provided by SPFx. This would be fired via an eventlistener or Workflow attached to the folder that the emails are uploaded to.
Before I go too far down the SPFx road, could someone please confirm if this is a realistic approach?
(*such as this one: https://github.com/ykarpovich/msg.reader)

A: This is an interesting situation :)
I reckon you can use a combination of Microsoft Flow (triggered when a new item is uploaded) + Azure Function (A call from Flow to execute an azure function that would call a powershell script) + Powershell script (Run a powershell script to extract the msg file details) => update back the SP site with the extracted details.
The Azure function is the stapler here, since I am not aware of a direct possibility to execute a PS script.


text:
Q: c++ multiple definitions of operator<< I am attempting to override the << operator for a class.  The purpose is basically to implement a toString() like behavior for my class, so that sending it to cout will produce useful output.  Using a dummy example, I have the code below.  When I attempt to compile, I get the foollowing error:
$ g++ main.cpp Rectangle.cpp
/tmp/ccWs2n6V.o: In function `operator<<(std::basic_ostream<char, std::char_traits<char> >&, CRectangle const&)':
Rectangle.cpp:(.text+0x0): multiple definition of `operator<<(std::basic_ostream<char, std::char_traits<char> >&, CRectangle const&)'
/tmp/ccLU2LLE.o:main.cpp:(.text+0x0): first defined here

I can't figure out why this is happening.  my code is below:
Rectangle.h:
#include <iostream>
using namespace std;

class CRectangle {
    private:
        int x, y;
        friend ostream& operator<<(ostream& out, const CRectangle& r);
    public:
        void set_values (int,int);
        int area ();
};

ostream& operator<<(ostream& out, const CRectangle& r){
    return out << "Rectangle: " << r.x << ", " << r.y;
}

Rectangle.cpp:
#include "Rectangle.h"

using namespace std;

int CRectangle::area (){
    return x*y;
}

void CRectangle::set_values (int a, int b) {
    x = a;
    y = b;
}

main.cpp:
#include <iostream>
#include "Rectangle.h"

using namespace std;

int main () {
    CRectangle rect;
    rect.set_values (3,4);
    cout << "area: " << rect.area();
    return 0;
}

A: You're breaking the one definition rule. A quick-fix is:
inline ostream& operator<<(ostream& out, const CRectangle& r){
    return out << "Rectangle: " << r.x << ", " << r.y;
}

Others are:

*

*declaring the operator in the header file and moving the implementation to Rectangle.cpp file.

*define the operator inside the class definition.

.
class CRectangle {
    private:
        int x, y;
    public:
        void set_values (int,int);
        int area ();
        friend ostream& operator<<(ostream& out, const CRectangle& r){
          return out << "Rectangle: " << r.x << ", " << r.y;
        }
};

Bonus:

*

*use include guards

*remove the using namespace std; from the header.

A: You are putting the definition of a function in a .h file, which means that it will appear in every translation unit, violating the One Definition Rule (=> you defined operator<< in every object module, so the linker doesn't know which is "the right one").
You can either:

*

*write just the declaration of your operator (i.e. its prototype) in the .h file and move its definition to rectangle.cpp

*make operator<< inline - inline functions are allowed to be defined more than once, as long as all the definitions are identical.

(Also, you should use header guards in your includes.)


text:
Q: Mine's a gin and tonic I encountered a sentence that's full of British culture:

I have found a pair of my father's old tan driving gloves, the sort that say 'Mine's a gin and tonic' and that my mother would have accessorized with her horsey headscarf from Country Casuals.

I found out that Country Casuals is a brand of clothing, but I don't understand what the phrase 'Mine's a gin and tonic' means... I only know that gin and tonic is a popular drink in the UK, but what does the phrase mean here?
Also, I'm not a hundred percent sure of the meaning of 'horsey' too. The closest definition I believe is 'large and clumsy' but it feels a bit odd in this sentence.

A: To add an answer about the gin:
Gin has a long history and so it is not surprising they its social status had varied considerably. In British culture the biggest change was when what had previously been cheap alcohol for working-class Londoners became fashionable amongst British Army officers in India. They had been encouraged to consume quinine as an anti-malarial drug and this was made more palatable by making it into tonic water. It was found that gin made this even more palatable and soon replaced whisky and brandy.
I see from Wikipedia that G&T (as it is often referred to in the UK) is a cocktail. However no one thinks of it like this in the UK. It is just the normal way to serve gin.
All the references in the quote in the question plant us firmly in the 60s-70s-80s. At the time a particular sort of person would have had a particular sort of drink. Since then there had been a gradual trend against stereotypical drinking towards people simply drinking what they like so a drink choice says much less about someone then it used to.

A: Some of the other answers have made headway, as regards the definition of 'mine's a G&T', but the entire point of the quote is really to define this couple in a single sentence.
They are both middle-class, from a time when that was 'more important' to be recognised as such than it is today.
He has gloves which suggest he drove a sports car or Jaguar*, which would define his drink as G&T rather than beer. Her mode of dress would be appropriate to that & a weekend at the horse trials.
It defines an entire class & culture from (probably) the 50s/60s in one sentence.
Below is a comment on the outmoded class-structure in the UK at the time, not my personal opinion...
*This would make him one of the class defined by those not belonging to it as 'The Gin & Jag Brigade'. It was a derogatory description, usually used by those who would prefer beer, even if they could afford the car.
'Horsey' describes the type of person who would attend gymkhanas & horse trials & describes the kind of attire one would wear to those... but (if it were not the author talking about her own mother, but a general perception of those times) could be a double 'attack/criticism' on not only the social class of the woman, but also her (alluded to) visual appearance. Large-framed, broad-hipped, long-faced; similar appearance to the horse she is accustomed to riding, or did in her youth.
Note that even in these times, the description 'horsey' wouldn't ordinarily be applied to someone with merely the physical appearance mentioned above - it would have to go hand-in-hand with the social definition.
Refs for 'the Gin & Jag Brigade'.
I can't find a dictionary definition as yet, but a couple of newspaper reports using it in such a way that it's obvious they fully expect their readership to already be well-aware of the term.
The Telegraph - They can't mean us
The Guardian - Town bristles at 'gin and Jag' slur
Urban Dictionary has a non-authoritive definition
Also... Ask Andy About Clothes but please take your social-responsibility-for-the-easily-offended hard-hat with you to this one, which is full of 'colourful' explanations - though technically just about SFW (safe for work).

A: chasly from UK's answer is correct, I think what the author is really trying to get across is that they're posh, or at least dress that way. A gin and tonic is a popular enough drink with all classes of England now, but if you look like your drink of choice is a G&T then you are definitely not working class.
The picture included in the discussion of the word horsey is of the Queen, I think that's a great choice of picture. It can also mean is interested in horses generally, but I don't think it does in this context.

A:
"Mine's a [name of alcoholic beverage]" is said in a pub when someone
  is buying a round of drinks.

Example
John: It's my turn to buy a round. What's yours Susan?
Susan: Mine's a gin and tonic, thanks.
John: What about you Bill?
Bill: Mine's a pint of lager.
Etc.
So:
What's yours? = What drink do you wish to have?
Mine's a ... = I'd like a ...

'Horsey' refers to a certain type of upper-class person who owns and
  rides horses

They spend a lot of time outdoors with their horses and the women often wear a headscarf as a protection against the weather.
Below is a photograph of a young H.M. Queen Elizabeth looking at horses whilst wearing a headscarf and gloves.  (Edited to add 'gloves')

A: To add an answer about the gloves:
Back in the 1950s/60s, gloves with (especially tan-coloured) leather palms were a fashionable accessory for drivers of sports cars and similar vehicles (and those aspiring to them).
(Practical too, providing warmth and grip, in the days before effective heating and padded leather steering wheels.)
Thus they would be an indicator of a similar class of person to the G&T drinker - affluent middle-class, or ostentatiously pretending to be such.

A: Literal answer
In a social setting, it is common to ask people what they are drinking.  If there is a group of people, a conversation may go:
"What are you drinking?"
"Beer, and yourself?"
"Mine's a gin and tonic."
Where "mine's" is short for "my drink is".
Why is this in your book
Richard Boston was a politically comedic journalist (akin to Mark Twain or Gary Trudue) who was born in London in 1938.  He wrote a beer column which highlighted local/small breweries rather than the big names.  This made him popular with the brewers, but he had a secret, he didn't like beer.  When they would ask him what beer he was drinking, his reply was "mine's a pink gin."  Wikipedia
Pink gin is simply another type of gin, which can be mixed with tonic.
I do not know why the phrase has been changed from the quote.  There is another article that quotes him as saying "mine's a gin and tonic" directly:  click
I do believe this meaning gives a more nuanced description of the character.
Horsey
As said in other answers, "horsey" is a description of someone who enjoys the less labor intensive aspects of owning a horse.

A: To be instructive to the non-native English speaker (Olivia Lo), English sentences or utterances are classified as one of four types: declarative, interrogative, imperative, or exclamative. "Mine's a gin and tonic" would be exclamative with the usual context being a prior interrogative (What would you like?) by someone else. By the way, exclamatives usually end with an exclamation mark (!), which is not present here.
The reference to "horsey scarf" is simply a reference to the person's scarf that would usually be worn, for whatever reason (it had pictures of horses or was warm or was rough weaved ...), when going to an event that involved horses.
It is the tone of the whole conversation that would betray it as being middle class.

A: I don't fully agree with chasly from UK. Obviously, horsey is an adjective here, and has nothing to do with 'upper-class' according to wiktionary.


text:
Q: How to configure active admin to show the users password without encryption in admin screens? I have a User model in my rails application this is a devise Model which contains password field. i have activeadmin gem. How can we configure active admin ,So that it shows the password without encryption. Currently the application is showing the encrypted password in active admin screens.

A: It's not possible. You'd need to disable password hashing in Devise but it's - for good reason - an integral part of DatabaseAuthenticable.


text:
Q: Analysis in Division Rings In the question here, the subject of "Analysis in Positive Characteristic" is mentioned. Looking at Wikipedia's local field, this is the final type of analysis in local fields to be developed following on from real, complex and p-adic analysis. ( Is there a snappy name for this? Charpos analysis ? ff/Fq analysis ? Carlitz analysis ?)
Question: What is the situation with regard to division rings - Is there a classification of local division rings? and for which ones has analysis been developed ?

A: The classification of locally compact (non necessarily commutative) fields is done in chapter 1 of André Weil's Basic Number Theory. His method is very nice, based on the existence of a Haar measure on a locally compact group.


text:
Q: Fill empty cell in pipe-separated-value file with default text I have a PSV file with empty cells. I want to fill the empty cells with the valule 00000000000
Example input
0000000001|00346743139|201901|07
0000000002||201901|00

Desired output
0000000001|003467431|201901|07
0000000002|00000000000|201901|00

I have tried by using
sed -i "s/||/|00000000000|/g" filename

A: Your sed command looks ok, and it works if I try it with your input example.
As a general alternative for parsing pipe-separated files, or in general table-formatted values, I would recommend awk, however. It seems you want to replace "empty" columns with 00000000000. To do that, you can use
awk 'BEGIN{FS=OFS="|"} {for (i=1;i<=NF;i++) {if ($i=="") $i="00000000000"}} 1' filename

*

*This will first instruct awk to consider | the field separator for input and output (FS is the input field separator, OFS is the output field separator.

*It will then iterate over all fields (=columns) of a line, and if it finds an empty field, set its value to 00000000000 instead ($i referring to "field nr. i of the current line", and NF being an auto-generated variable containing the number of fields).

*In the end, it will print all lines including the possible modifications (the seemingly stray 1 at the end)

You can also restrict this easily to only apply to field nr. 2, in case you want to handle other empty columns differently:
awk 'BEGIN{FS=OFS="|"} {if ($2=="") $2="00000000000"} 1' filename

A: Your sed command appears to be replacing all non-overlapping occurrences of the string || with |00000000000|.  It is unclear how this does not solve your issue, at least for the data supplied:
% sed 's/||/|00000000000|/g' file.csv
0000000001|00346743139|201901|07
0000000002|00000000000|201901|00

Note that your expected output seems to truncate 00346743139 into 003467431 (the last two integers are removed).  It is  unclear whether this is intentional.
If there is an issue in using the non-standard -i option with the sed implementation on your Unix, then please see the post How can I achieve portability with sed -i (in-place editing)?
For example, on macOS, your command would give you
$ sed -i "s/||/|00000000000|/g" filename
sed: 1: "filename": invalid command code f

due to the way the -i option is used differently on that system.  Use -i '' instead on macOS (and read man sed on your system about this option).

For more robust CSV parsing, you may want to use an actual CSV parser.
Using the csvkit tools to do the CSV parsing, and jq to do the actual processing:
% csvjson -I -H file.csv | jq -r '.[] | map(select(. == null) |= "00000000000") | @csv' | csvformat -D '|'
0000000001|00346743139|201901|07
0000000002|00000000000|201901|00

This first converts your CSV file to JSON using csvjson.  The options we use here turns off type inference (so that the numbers are interpreted as strings), and tells the utility that there is no header line in the CSV data. The csvjson tool will automatically detect that | is the correct delimiter used in the data, but you may also explicitly tell it to use | as the delimiter using -d '|'.
The jq code then replaces all empty values with the string 00000000000 and formats the processed data into CSV again.
Since you want to have pipe-delimited output, csvformat is used to change the delimiters outputted by @csv in jq into |-characters.
Redirect the output to a new filename, and then optionally replace the original data with that new file.
Both csvkit and jq are available for macOS via the Homebrew package manager.


text:
Q: How to set columns 100% height within body using css i'm trying to have ornamented border all along the right and left side of the document, but for some reason I have not managed to get the elements with those border ornaments reach 100% height.
What i have right now is:
html {
  height: 100%;
}

body {
  min-height: 100%;
  background-image: url("../img/bgtile.png");
  background-repeat: repeat;
  background-color: transparent;
  font-size: 18px;
}
body:before {
  content: "";
  background: transparent url("../img/frame-ornament-left.png") repeat-y 11px 0px;
  height: 100%;
  width: 30px;
  display: block;
  left: 0;
  position: absolute;
  top: 0;
  z-index: 0;
}
body:after {
  content: "";
  background: transparent url("../img/frame-ornament-right.png") repeat-y;
  height: 100%;
  width: 30px;
  display: block;
  right: 0;
  position: absolute;
  top: 0;
  z-index: 0;
}

And no matther what i try, those before and after elements always stay as high as viewport is. I've tried setting min-height to 100% on HTML element too, that indeed made html element as long as body, but those elements with ornaments in them still remain as high as viewport...

A: Set the body to position: relative, so it will be the context for the pseudo elements, instead of the html, and set bottom: 0 to both pseudo elements:

body {
  position: relative;
  background-image: url('../img/bgtile.png');
  background-repeat: repeat;
  background-color: transparent;
}

.content-demo {
  height: 800px;
}

body:before {
  content: "";
  background: red;
  width: 30px;
  display: block;
  left: 0;
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 0;
}
body:after {
  content: "";
  background: blue;
  width: 30px;
  display: block;
  right: 0;
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 0;
}


text:
Q: What's the syntax for selecting a range of lines in Vim? What's the syntax for selecting a range of lines?
I want to run a command over lines 1405 until 1700.
And one from 1405 until the end of file, without wanting to look up that number.
Update: Is it possible to select a range from the current line to Nth line?

A: *

*Go to line 1405 by typing: 1405G.

*Press V to switch to VISUAL LINE mode and then go to line 1701 by typing: 1701G.

*Now your lines are selected, you can run a command on them. For example, to replace foo with bar type: :s/foo/bar/.

A: For your update: use .,N where N is the line you want.
(and in case you have further updates, check out :he range).

A: You can do this (replace d with your command)
:1405,1700d

and
:1405,$d


text:
Q: What is the best approach to encapsulate business logic on rest application? I'm working in a project that is using Resteasy, Spring, JPA and Hibernate.
all business logic is located on the controller (Rest Service) and i think to separate this business logic on another layer.
What is the best approach to separate and reuse business logics? In this business logic, there is a lot of validation rules too...
Thanks !

A: You think about a Multitier Application, ok. If you are using it as a web-server, its advantageous to keep the input-validation in the view(javascript) and controller layer.
Its a good idea to have a clean interface design, respecting ACID (Atomicity+Consistency+Isolation+Durability), between the controller and the business layer.
This way, nothing can go wrong.


text:
Q: Android Studio: new plugin: cannot resolve symbol After Android Studio 2.0 update I started to use new Gradle plugin according to this article.
apply plugin: "com.android.model.application"

The project build successful and everything is fine, but all lines in build.gradle is marked as cannot resolve symbol xxx.

Android Studio 2.1 no changes.

What is the problem?


text:
Q: How to draw line X=1? I know how to draw a line with scatter plot options where X is the independent and Y the dependent variable.
In the scatter plot of that data I need to add another line: X=2. I have the following data:

But how to draw a line X=1 ?

A: Maybe you want something like this:

I hear that charting is more different than many other aspects of Excel between versions and that perhaps my version (Excel 2007) is one of the least 'friendly' hence some of the reason for "not very easy" but the principle is as @Bill the Lizard has described. In view of some weird behaviour with (my?) Excel 2007 however I recommend being careful about the sequence in which the lines are drawn.
First I suggest getting your chart right for all aspects but the green line. Then add another series with X values of 1 and 1 and Y=2 values of 10 and -2 (or whatever the limits are of your chosen y-axis as displayed). Select and copy that array (four cells) select your chart and Paste Special…, and Add cells as New Series, Columns, Categories (X Values) in First Column, OK.
This should add a vertical line of the same chart type as the existing (ie XY (Scatter) Scatter with Straight Lines and Markers). The colour can be changed, by selecting that series (click on it and Format Data Series…, Line Color etc) and presumably you would want the markers removed. It was these that for me at first refused to disappear to order – but persistence paid off. Click on either of the data points, and under Marker Options choose none for Marker Type. If necessary, repeat for the other data point – and keep repeating if required!
Also, I selected what was showing as Series3 (text) in the legend and deleted that.
Forgot to mention that for anything to do with Excel charts Jon Peltier is the ultimate authority (eg) and that an alternative approach is to use an error bar and a secondary vertical axis.


text:
Q: Setting a From Address while sending Email How do we set From Address while sending email using messaging.SingleEmailMessage. I have got a solution which uses setOrgWideEmailAddressId to set from address,
    OrgWideEmailAddress[] owea = [select Id from OrgWideEmailAddress where Address = 'doNotReply@blahblah.com'];
 Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
 if ( owea.size() > 0 ) {
mail.setOrgWideEmailAddressId(owea.get(0).Id);
}

But I want to query the record ( say the contact who logged in ) and set that as From Address.
Can Anyone help me out with this?

A: *

*When you don't set any address in setOrgWideEmailAddressId method
SingleEmailMessage will automatically send email from logged in
users email id.

*Alternatively you can add any org wide email from
setOrgWideEmailAddressId method.

You cannot use any other email apart from these two, because by that way you will be able to set anyone's email in from address.


text:
Q: Why does the content in my div not remain the same when resizing window? I have this page: http://bit.ly/1In9YCe
It looks as intended on big screens (desktop) but the issue is that when the window is resized down to small screen widths, the "Agree" and "Disagree" labels start to take up their own line instead of being nicely placed before and after the slider on the same line as the slider. I can't for the life of me figure out why they do this, since the available width should be sufficient. Will a kind soul please help?

A: This is because in the CSS there is a display:block defined:
@media screen and (max-width: 800px)
.ui.form .choice-text {
  padding: 0;
  display: block;
}

If you remove the display:block it should work.

A: Use width: 100% rather than width:500px for example on the divs in column 1.


text:
Q: Copy media gallery to another product I want to copy the images of a product to another product.
I wrote the following script:
$mediaGallery = $anotherProduct->getMediaGallery();
$p->setMediaGallery(null);

Mage::app()->getStore()->setId(Mage_Core_Model_App::ADMIN_STORE_ID);

foreach($mediaGallery["images"] as $image) {
    $filePath = $importDir.$image["file"];
    if(file_exists($filePath) && !file_exists(Mage::getBaseDir('media').DS.'import'.DS.'catalog'.DS.'product'.$image["file"])) {

        $p->setStoreId(Mage_Core_Model_App::ADMIN_STORE_ID)->addImageToMediaGallery($filePath, array('small_image','thumbnail','image'), false, false)->save();

        $attributes = $p->getTypeInstance(true)->getSetAttributes($p);
            $attributes['media_gallery']->getBackend()->updateImage($p, $image["file"], array('postion'=>$image['postion'],'postion_default'=>$image['postion_default'],'label'=>$image['label'],'label_default'=>$image['label_default'],'disabled'=>$image['disabled'],'disabled_default'=>$image['disabled_default']));
    }
}

There is exact one image in $mediaGallery.
The Script imports two entries (one is empty). The other entry is correct but the labels (for each store) are missing.
Any idea?

A: I think better get images by $product->getMediaGalleryImages();
And then foreach loop:
   $images = $product->getMediaGalleryImages();
   foreach ($images as $image) {
       // Check if the file path exists
       if( $path = $image->getPath() ) {
           $anotherProduct->addImageToMediaGallery($path, array('image','thumbnail','small_image'), false, false);
       }
   }


text:
Q: Ionic3/Angular4 iOS double tap I can't seem to get passed the double tap issue on iOS.  I want my app to respond to single click only.
I've added "tappable" to virtually all elements and I've removed and re-added the iOS platform.  I have been building production releases using the Ionic Cloud.  On Android all works perfectly.
I see this consistently happening on the popovers (i.e. hitting an ion-list element), the OK/Cancel buttons do not work with a single click, but the elements within the popover are selectable with a single click.
I feel like I'm not doing something right, since I've researched this for weeks and implemented all suggestions.
Is there anyone who successfully fixed this issue?
What would be the advice at this point, as I need to fix this for my production build?

A: Try this code in your html template :
(dblclick)="myFunction()"

and then in your .ts file :
myFunction(){
   //do things
}

A: What I discovered was that there was a jQuery or jQuery UI conflict.  Because my app had a custom design, I copied the  contents from the responsive web version and plugged it into the /src/index.html file.
I left my style link references, but I pulled out all JavaScript reference files (i.e. jquery, jqueryui) that are not required in an Ionic app.
The app no longer requires a double-tap on iOS for ion-select items.


text:
Q: my zf tools is creating the product controller in the wrong directory - is there a command list available anywhere I am new to Zend Framework and also to Zend tools.
I have two questions regarding Zend tools.
Does anyone have any links for a detailed list of all the commands in Zend tools? I cannot seem to find anything?
For example: if I want to use the tool to create a controller in my modules directory as opposed to the controllers directory - how do I use the tool to do that? I tried to do the following but it did not work:
in my 'command prompt' I navigate to the site I am working in, I then navigated to the directory for modules; from there, I tried to create a controller for that directory i.e:
c:\theproject\application\modules\forms\controllers>zf create controller enquiry  action products  module  forms

ZF gave the following error message: unknown argument left on the command line: module
However, when I tried to create the controller without the argument n the left, the ZF created the controller in the controllers directory.
SECONDLY
I want to use the Zend tool to delete pages that have already been created. I cannot seem to find the Zend tool command for that.
THIRDLY
I want to just create a normal page view. i.e page.phtml
I cannot seem to find the command for how to creating a normal page and to also specify what directory it will go in.

A: Module

*

*zf create module name

Form

*

*zf enable form module

*zf create form name module

Layout

*

*zf enable layout

*zf disable layout

DbAdapter

*

*zf configure db-adapter dsn section-name[=production]

DbTable

*

*zf create db-table name actual-table-name module force-overwrite

Note: There are specialties, use zf create db-table.? to get specifi
 them.
ProjectProvider

*

*zf create project-provider name actions
:\xampp\htdocs\ZendFramework\rac>

A: From the root of your project type zf
You will get the list of commands it is having. Something like
Zend Framework Command Line Console Tool v1.11.11
Usage:
    zf [--global-opts] action-name [--action-opts] provider-name [--provider-opts] [provider parameters ...]
    Note: You may use "?" in any place of the above usage string to ask for more specific help information.
    Example: "zf ? version" will list all available actions for the version provider.

Providers and their actions:
  Version
    zf show version mode[=mini] name-included[=1]
    Note: There are specialties, use zf show version.? to get specific help on them.

  Config
    zf create config
    zf show config
    zf enable config
    Note: There are specialties, use zf enable config.? to get specific help on them.
    zf disable config
    Note: There are specialties, use zf disable config.? to get specific help on them.

  Phpinfo
    zf show phpinfo

  Manifest
    zf show manifest

  Profile
    zf show profile

  Project
    zf create project path name-of-profile file-of-profile
    zf show project
    Note: There are specialties, use zf show project.? to get specific help on them.

  Application
    zf change application.class-name-prefix class-name-prefix

  Model
    zf create model name module

  View
    zf create view controller-name action-name-or-simple-name module

  Controller
    zf create controller name index-action-included[=1] module

  Action
    zf create action name controller-name[=Index] view-included[=1] module

  Module
    zf create module name

  Form
    zf enable form module
    zf create form name module

  Layout
    zf enable layout
    zf disable layout

  DbAdapter
    zf configure db-adapter dsn section-name[=production]

  DbTable
    zf create db-table name actual-table-name module force-overwrite
    Note: There are specialties, use zf create db-table.? to get specific help on them.

  ProjectProvider
    zf create project-provider name actions

Then try zf --help command for more help on the command
The command to create a controller in modules directory is
zf create controller <Controllername> 1 <module-name>

and for more try it on a sample project.


text:
Q: Symfony sonata admin bundle without entity Is there the way to use sonata admin bundle without entity - so without doctrine?
I need to list files on some directory, this list is not stored in database.
The first approach I tried was to declare my own Model manager, but there are some places which require doctrine queries etc.
I know, that there is document manager for mongo and sonata mongo admin, but in my case it's not so helpful.
Any ideas?

A: In the documentation found here: http://sonata-project.org/bundles/admin/master/doc/reference/getting_started.html
It looks like in the create an admin section that #2 requires a model:

*

*The Admin service's code (defaults to the service's name)

*The model which this Admin class maps (required)

*The controller that will handle the administration actions (defaults to SonataAdminBundle:CRUDController)

The sample shows the service setup with manager_type as an ORM:
# Acme/DemoBundle/Resources/config/admin.yml
services:
    sonata.admin.post:
        class: Acme\DemoBundle\Admin\PostAdmin
        tags:
            - { name: sonata.admin, manager_type: orm, group: "Content", label: "Post" }
        arguments:
            - ~
            - Acme\DemoBundle\Entity\Post
            - ~
        calls:
            - [ setTranslationDomain, [AcmeDemoBundle]]

Now in general symfony doesn't set hard requirements on what a model is. It can be doctrine or something custom you build. In the case of services it is just an object. I don't see anywhere in the documentation says that you need a database.


text:
Q: Brand New Monitor Won't Get Input From Computer I have an old Dell 2350. I found a HD a few months ago and plugged it in and it booted up. So I just purchased a monitor and plugged it in, and put the HD inside and connected the two connections (Bus, and a four pronged connector) and no signal is being sent to monitor.
is this a monitor issue or the HD is just dead? HD is spinning. CPU is turned on :) Yet no signal.. any thoughts?

A: Found the solution.
RAM was not in all the way.


text:
Q: CSS or JS - change background color of input when input is focused out? Is there any way to set a background-color on input text when it looses focus?
I'm trying in js but i would like to know if it's possible in css pure.
this seems not working
input{
 background-color:#fff !important;
}
input:focus{
background-color:#333 !important;
}
//input:unfocused and has value{ ??? :) }

 $('input,textarea').on('focusout',function(e){
      if($(this).val().length){
       $(this).css('background-color','#fff');
      }
      });

thank you

A: The CSS3 method would be, for example:
input[type=text]:focus{
    color:red;
}

See THIS FIDDLE. Its a bit backward, you'd style the active, not the blurred selector.
To simulate blur, you can use :not(:focus), see here

A: textarea and input are different selectors:
Do this with jquery:
<script type="text/javascript">
$(document).ready(function(){
      $('textarea').on('focusout',function(){ // When losing focus
            $(this).css('background','#FFF');
      });
      $('textarea').on('focus',function(){ // When focus
            $(this).css('background','#333');
      });
});
</script>

Or CSS:
textarea { background-color:#fff !important; }
textarea:focus { background-color:#333 !important; }


text:
Q: How to use webpack, content security policy and fetch/ajax calls to own server and external sites? I added a fetch call in my entry.js file:
fetch('https://ipinfo.io/json')
  .then(response => response.json())
  .then(data => console.log(data));

My webpack build was fine until I added that, then i started getting errors regarding Content Security Policy.
Previously, I didn't have any content security policy defined.
I've tried several approaches to resolve errors (see end of post), the latest was adding this to head section of index.html file:
<meta http-equiv="Content-Security-Policy" content="script-src 'self'; connect-src https://ipinfo.io/json">

Now I am getting these errors in Chrome developer tools console, which seem to contradict themselves:
Error #1 - relating to jquery ajax get request to my own api
bundle.js:25 Refused to connect to 'http://localhost:3000/api/v1/resource?parameter=false&_=1598715905517' because it violates the following Content Security Policy directive: "connect-src https://ipinfo.io/json".

Error #2 - relating to fetch call to external website
bundle.js:1 Refused to connect to 'https://ipinfo.io/json' because it violates the following Content Security Policy directive: "default-src 'self'". Note that 'connect-src' was not explicitly set, so 'default-src' is used as a fallback.

Note:  This second error says that connect-src is not explicitly set, however the first error occurs because it is explicitly set.
Error #3 - relating to fetch call to external website
bundle.js:1 Refused to connect to 'https://ipinfo.io/json' because it violates the document's Content Security Policy.

Error #4 - relating to fetch call to external website
bundle.js:1
Uncaught (in promise) TypeError: Failed to fetch
    at HTMLDocument.<anonymous> (bundle.js:1)
    at u (bundle.js:25)
    at l (bundle.js:25)

Other approaches
For reference, here is one of the other approaches I tried using a nonce:
I added this to entry.js:
__webpack_nonce__ = 'something-tricky';

And this to the <head> section of the index file:
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'nonce-something-tricky';

The result was that it wouldn't load bundle.js:
Refused to load the script 'http://localhost:3000/js/bundle.js' because it violates the following Content Security Policy directive: "script-src 'nonce-something-tricky'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.

This approach was based on:
https://webpack.js.org/guides/csp
https://stackoverflow.com/a/42924000
Further context
As i started trying all sorts of CSP combinations in the <head> section, I noticed it started breaking lots of things like:

*

*script tag links in index.html to google fonts etc

*css styles generated and included in bundle.js

So i'm aware of the need to get CSP completely right, or it won't work at all.
Edit
My last attempt was this:
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' https://ipinfo.io; style-src 'self' fonts.googleapis.com 'unsafe-inline'; font-src 'self' fonts.gstatic.com">

And I am getting this error:
bundle.js:25 Refused to load the script 'https://ipinfo.io/json?callback=jQuery35106635073412967416_1598793439782&_=1598793439783' because it violates the following Content Security Policy directive: "script-src 'self'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.

When this code is in the entry.js file:
$.get("https://ipinfo.io/json", function(response) {
  console.log(response);
}, "jsonp");

That last error is weird, because it seems to be ignoring the domain that I specifically 'whitelisted' in the srcipt-src directive.

A: Ok, well i looked at the Network tab in Chrome developer tools for other requests and saw a rather rich set of CSP directives were being applied in the Response Headers tab, but i hadn't set them, so I wondered where they were coming from.
I came across this answer, which mentioned that they could be set using helmet in node
So in my node app, I replaced:
app.use(helmet());

which at the time of this edit is equivalent to this:
app.use(helmet.contentSecurityPolicy());
app.use(helmet.dnsPrefetchControl());
app.use(helmet.expectCt());
app.use(helmet.frameguard());
app.use(helmet.hidePoweredBy());
app.use(helmet.hsts());
app.use(helmet.ieNoOpen());
app.use(helmet.noSniff());
app.use(helmet.permittedCrossDomainPolicies());
app.use(helmet.referrerPolicy());
app.use(helmet.xssFilter());

where helmet.contentSecurityPolicy() defaults to:
default-src 'self';
base-uri 'self';
block-all-mixed-content;
font-src 'self' https: data:;
frame-ancestors 'self';
img-src 'self' data:;
object-src 'none';
script-src 'self';
script-src-attr 'none';
style-src 'self' https: 'unsafe-inline';
upgrade-insecure-requests

with:
app.use(
    helmet({
        contentSecurityPolicy: {
            directives: {
                defaultSrc: ["'self'"],
                scriptSrc: ["'self'", "https://ipinfo.io"],
                styleSrc: ["'self'", "fonts.googleapis.com", "'unsafe-inline'"],
                fontSrc: ["'self'", "fonts.gstatic.com"]
            }
        },
    })
);

and now this request from entry.js is working:
$.get("https://ipinfo.io/json", function(response) {
  console.log(response);
}, "jsonp");

Note, I had to add unsafe-inline to the StyleSrc or else the CSS that was imported and bundled into bundle.js using webpack wouldn't work.


text:
Q: MySql order by problem I want to list messages that received specific user from other users group by ID's and ordered by last message received.
If I use this query:
SELECT MAX(id), fromid, toid, message
  FROM pro_messages
 WHERE toid=00003
GROUP BY fromid

I do not get last message sent from user "fromid" to user "toid" but the first message sent. Can I do that in some other way or I need to do it with two queries or join tables?
id - message id
fromid - id of user who sent message
toid - id of user who receive message (in this case user 00003)

A: First, you'll want to be careful with your toid value there. The zero-padding could cause trouble  if it's interpreted as an octal number: 00010 is 9 decimal, and toid=9 is most likely not what you're intending.
As for your message trouble, you're getting normal behavior for the GROUP operator in MySQL. Consider the following simplified table:
mysql> select * from messages;
+------+--------+------+---------+
| id   | fromid | toid | message |
+------+--------+------+---------+
|    1 |    100 |    3 | hi      |
|    2 |    100 |    3 | there   |
|    3 |    100 |    3 | how     |
|    4 |    101 |    3 | did     |
|    5 |    100 |    3 | are you |  <--the message you want, right?
+------+--------+------+---------+

When you group on fromid, the database collapses all the rows matching the grouping conditions into a single row. In this case, your query will get the following results
mysql> select max(id), fromid, toid, message from messages where toid=3 group by fromid;
+---------+--------+------+---------+
| max(id) | fromid | toid | message |
+---------+--------+------+---------+
|       5 |    100 |    3 | hi      |
|       4 |    101 |    3 | did     |
+---------+--------+------+---------+

Notice now the '100' row has the max(id) of 5, but the message from id=1. This is how the GROUP BY operations work. You can't work around this with a simple query, but if you switch to a sub-select as follows, you'll get the proper results:
mysql> select id, fromid, toid, message from messages where id in (select max(id) from messages where toid=3 group by fromid);
+------+--------+------+---------+
| id   | fromid | toid | message |
+------+--------+------+---------+
|    4 |    101 |    3 | did     |
|    5 |    100 |    3 | are you |
+------+--------+------+---------+


text:
Q: How do I set profile image as first letters of first and last name? Basically, i'm working on user registration system. which i'm doing front-end using ReactJS. for registered users there is an option to add images for their profiles. when there is no images for the profiles, profile image should be contain the first letter from the first and second name for the profile picture like google plus do.
please find the sample image below.

Looking forward a way to do this.. better if there are inbuilt plugin or library to do this.

A: I have assumed that you have access to the first name and last name. Using that, I have written this code which will take the first letter from First name and last name and apply to your profile image.

$(document).ready(function(){
  var firstName = $('#firstName').text();
  var lastName = $('#lastName').text();
  var intials = $('#firstName').text().charAt(0) + $('#lastName').text().charAt(0);
  var profileImage = $('#profileImage').text(intials);
});
#profileImage {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: #512DA8;
  font-size: 35px;
  color: #fff;
  text-align: center;
  line-height: 150px;
  margin: 20px 0;
}

Kalpesh
Singh

A: UI Avatars has a simple-to-use API with no limiting or login. No usage tracking and no information is stored. The final images are cached, but nothing else. Just write name or surname, or both.
Generate a avatar with default settings, for user "John Doe".
https://ui-avatars.com/api/?name=John+Doe
Generate a blue avatar
https://ui-avatars.com/api/?background=0D8ABC&color=fff
Generate a random background avatar.
https://ui-avatars.com/api/?background=random

A: The css option added in JsFiddle

*

*You just create a div inside div.

*Put the inner one in the complete center with line-height the same
as container's size and text-align: center.

You can also have the text set by Javascript if needed.
HTML

CSS
#container {
  width: 100px;
  height: 100px;
  border-radius: 100px;
  background: #333;
}
#name {
  width: 100%;
  text-align: center;
  color: white;
  font-size: 36px;
  line-height: 100px;
}

Optional Javascript
  var name = "Adam";
  var lastname = "Sandler";
  var initials = name.charAt(0)+""+lastname.charAt(0);
  document.getElementById("name").innerHTML = initials;

A: It could be written in one-liner.
fullName.split(' ').map(name => name[0]).join('').toUpperCase()

Runnable snippet:

const fullName = document.getElementById('fullName').textContent;
const intials = fullName.split(' ').map(name => name[0]).join('').toUpperCase();
document.getElementById('profileImage').innerHTML = intials;
#profileImage {
  font-family: Arial, Helvetica, sans-serif;
  width: 10rem;
  height: 10rem;
  border-radius: 50%;
  background: #004D3C;
  font-size: 3.5rem;
  color: #fff;
  text-align: center;
  line-height: 10rem;
  margin: 2rem 0;
}

Penny Liu

A: My solution takes care of user names with names having more than 2 words. I used regex to extract first letters of space separated name components.
    var matches = str.match(/\b(\w)/g);
    var acronym = matches.join('');
    document.getElementById("name_acronym").innerHTML = acronym;

Call this function containing this from your HTML code and "name_acronym" is the id for the profile picture text.

A: Simple way of getting first character of a string.
And even some times you might get $ as undefined when your using
var firstName = $('#firstName').text();

try this ...
var firstName = "Jhon";
var initial = firstName.charAt(0);
console.log('--------', initial);

by this you should get "J" as output

A: outside of return:
 var intials;
 var fullName = "Mahendren Manoharan"
 intials = fullName.split(' ').map(name =>name[0]).join('').toUpperCase();
 console.log('intials',intials); - check here your output

My output - MM
first make a one condition based on your response. Im using based on my response
inside of return:
{profileLogo != undefined || profileLogo != "" ? (
                <View
                // source={require("../../assets/images/Johnwick.jpg")}
                style={styles.profileImage}
              >
                <Text style={{alignItems:'center',justifyContent:'center',color:'white'}}>{intials}</Text>

                </View>

              ) : (
                <Image
                  source={require("../../assets/images/Johnwick.jpg")}
                  style={styles.profileImage}
                />
              )}

that's all... enjoy your coding...


text:
Q: Azure Function CosmosDBTrigger unscaleable I have a Azure Function with a CosmosDBTrigger working on a consumption play monitored with Application Insights.  The collection being monitored has 500,000 inserts in the change feed. The consumption plan scales up the number of instances to 15 within a few minutes but only the first instance is able to process any changes.
I assume this is because of the lease is kept by the first instance.  I am essentially paying for 14 instances to do nothing.
I noticed you are supposed to be able to set a property on CosmosDBTrigger called LeaseOptions but I currently get an error whenever I try: "Error  CS0655  'LeaseOptions' is not a valid named attribute argument because it is not a valid attribute parameter type"
Is there a way to scale a CosmosDBTrigger Azure Function so it can be processed by 10, 20 or even 200 instances at a time?

A: Yeah, they do expose those LeaseOptions on the attribute as you noticed, but basic .NET 101 rules prohibit a custom complex type like ChangeFeedHostOptions being stored on an attribute at compile time, hence the compile time error you get. If you were using a WebJob you could configure those settings manually as you start up the job host, but it's just not addressable under the Azure Function model.
That said, when you don't configure it, it gets created with the defaults behind the scenes which are as follows:
CheckpointFrequency      null
FeedPollDelay            00:00:05
LeaseAcquireInterval     00:00:13
LeaseExpirationInterval  00:01:00
LeasePrefix              null
LeaseRenewInterval       00:00:17

So, given that, I would expect that the longest you should see a single function instance hold onto the entire partition is 17s since every 13s the client is supposed to check the number of hosts (in this case function instances) petitioning for work and rebalance the partitioning amongst them. The fact that you're not seeing this is... perplexing.
Disclaimer: I have not personally worked with the CosmosDbChangeTrigger in this capacity; I'm simply looking at the code tagged 3.0.0-beta4 in the GitHub repo to figure out how they connect all this up in the function extension's implementation.

A: As Drew mentioned, the LeaseOptions are not configurable, but it's something that is coming soon.
As for the scaling, the Trigger will start sharing leases following the Change Feed Processor Library's design among the instances to balance the load. This happens within a couple of seconds that the instances appear and there is a limit on how many instances will be distributed based on the amount of leases. Since each lease represents a Partition Key Range, at maximum, they will be distributed 1 lease per instance. Adding more instances over the amount of Partition Key Ranges will not add more parallel processing.
It could be that the instances are being created / destroyed sooner than the algorithm can share the leases.
Are the 500,000 inserts spread among several partitions or are all in the same partition? Is the Function lagging behind the changes or is it processing them at good speed? Do you have other Functions (either running locally or in Azure) monitoring the same collection using the same lease collection?
As a side note, you are not paying for the amount of instances, but the amount of executions.


text:
Q: Shapefile to KML not rendering in Google Earth I have this shapefile which does not open in Google Earth when converted to kml.
GCS: WGS1984
PCS: UTM, zone 41N
I have been trying it with GCS only but it still does not work. I have been using the define projection and Feature--> project tools but it did not work either... other kml files, on my system, are working.
Can someone indicate where I'm getting it all wrong. I have seen and tried solutions given in similar questions:
How to convert coordinates from meters to decimal degrees?
but they don't help, but, rather, I lost the file and see an empty canvas. Google Earth positions it somewhere in the Arctic but the polygon etc are not visible.
The coordinate system is in meters which I normally have in decimal degrees.


text:
Q: ARKit application shows line between lips color. How can we get rid of that? As I have mentioned my app shows a line between two lips for the application of virtual lipstick color change with ARFaceTracking. Following is my code used for lip color, I have attached an image with the issue marked.
    let faceGeometry = ARSCNFaceGeometry(device: device)
    let faceNode = SCNNode(geometry: faceGeometry)
    faceNode.geometry?.firstMaterial?.transparency = 0
    guard let faceAnchor = anchor as? ARFaceAnchor else { return nil }
    faceAnchors.insert(faceAnchor)
    let material = faceGeometry?.firstMaterial!
    //        Shape of lips
    material?.diffuse.contents =  imageLiteral(resourceName: "lipShape_old")
   // Lipstick color
    material?.normal.contents = lipstickColor
    material?.multiply.contents = lipstickColor
            // More realistic
    material?.lightingModel = .physicallyBased
    material?.transparency = 0.82
    masks.insert(faceNode)
    return faceNode

Please check this.
Any help will be appreciated.
Thanks


text:
Q: How to request Domain-wide Delegation through a consent screen, on G Suite I need to have access to Calendar information from a company's G Suite accounts, to synchronize data with the company system through  a API.
When I need to provide access to my own data, there is a fairly simple way to do it. Using Oauth2, through a login window the user allows the API to access the requested data.
But in the G Suite documentation, the path indicated when involving the administrator and company data, involves the administrator accessing admin.google.com, go to the security-related session, and manually register my API, listing the scopes that he wants to grant me access.
To make a parallel, in Microsoft Graph there is a way to request consent from the domain administrator, where only a user consent / admin consent screen is displayed using Oauth2.
I wonder if there is a way to get this type of access in G Suite without requiring the end user to take such complicated steps to make my API work properly.

UPDATE:
This question was originally posted in 2019, does anyone aware if something was changes since then?

A: You should use the Marketplace SDK for this. This allows you to publish an application to the Google Workspace Marketplace where company admins can choose to install it for their domain.
There are a couple things to keep in mind:

*

*There's an expectation that your application will have some sort of user facing presence (e.g. add-on, link to web app, etc).

*Google will review your app before publishing. Since you're not using Gmail or Drive scopes (for these, Google requires a 3rd party security review), this process should not be too difficult. But plan for it to take some time, and follow the best practices so it's done right the first time.

You also mentioned synchronizing calendars. If that means mainly reading, no problem, but if you're writing (a lot at once), be mindful of calendar use limits. These are per user and for all activity by that user (not just your app).


text:
Q: Cannot return to portrait mode after pressing fullscreen icon in YoutubePlayerFragment I'm learning to add a youtube video on my fragment, everything is fine until I press fullscreen. After exiting fullscreen, the screen is in landscape mode.
FragmentTwo.java code:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    // Inflate the layout for this fragment
    View view =  inflater.inflate(R.layout.fragment_fragment_two, container, false);
    textView = view.findViewById(R.id.textView_title);
    YouTubePlayerSupportFragment youTubePlayerFragment = new YouTubePlayerSupportFragment();
    youTubePlayerFragment.initialize(getString(R.string.youtube_api_key), this);
    FragmentManager fragmentManager = getFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    fragmentTransaction.replace(R.id.frame_video, youTubePlayerFragment);
    fragmentTransaction.commit();

    //Get the title of the video
    textView.setText(getArguments().getString("1"));
    return view;
}

@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) {
    if(!b) {
        youTubePlayer.cueVideo(getArguments().getString("8"));
    }
}

@Override
public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {
    Toast.makeText(getContext(), "Fail", Toast.LENGTH_SHORT).show();
}

And my .xml file:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/youtube_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.gameapp.FragmentTwo">

<!-- TODO: Update blank fragment layout -->

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <FrameLayout
        android:id="@+id/frame_video"
        android:layout_width="match_parent"
        android:layout_height="250sp"
        android:layout_alignParentLeft="true"></FrameLayout>

    <TextView
        android:id="@+id/textView_title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/frame_video"
        android:paddingBottom="5dp"
        android:paddingRight="5dp"
        android:textColor="@android:color/black"
        android:textSize="15sp" />
</RelativeLayout>

I tried setting all the layouts' orientation to "vertical" but nothing happens. I have to press back button to get rid of it, which is too much inconvient. Can someone show me how to solve this? Thanks in advance!


text:
Q: How to get the values of Sent and Received LAN data? Is there any command that shows me the amount of data sent and received, same as Sent and Received data for my LAN connection (picture bellow)?
I need to pipe this info into a file for further use.

A: You can try:
netsh interface ip show ipstats

this will give you a table with information about received, sent, dropped packets and more.

A: You should have specified which version of Windows but the following command should work:
net statistics Workstation

Gives output like:
Workstation Statistics for \\NETBIOSNAME

Statistics since 18/04/2013 6:37:30 PM

  Bytes received                               438062
  Server Message Blocks (SMBs) received        4351
  Bytes transmitted                            537108
  Server Message Blocks (SMBs) transmitted     4346
  Read operations                              0
  Write operations                             0
  Raw reads denied                             0
  Raw writes denied                            0

  Network errors                               0
  Connections made                             312
  Reconnections made                           0
  Server disconnects                           0

  Sessions started                             1
  Hung sessions                                0
  Failed sessions                              0
  Failed operations                            0
  Use count                                    467
  Failed use count                             0


text:
Q: R error.bars get all x-axis labels I am trying to plot means with standard deviations using the error.bars and it works quite good.
I know I could also use the ggplot approach but I could not implement that for my data...
So far so good, the problem that I ran into now, is that not all variables on the x-axis are printed, in fact only every second or so.
In boxplot, I could fix this with the command, names, las=2. Is there something similar for the error.bars function? I could not find anything in the manual.
Here's the code I am using:
psych:::error.bars(orderedcols,sd=TRUE,add=TRUE,arrow.len=0.05,bars=TRUE, xlab="Adjectives", ylab="Mean Intensity", main="Mean Intensities and Standard Deviations")

EDIT:

dput(orderedcols)
  structure(list(brilliant = c(50, 82, 80, 12, 80, 80, 85, 72,
  80, 85, 65, 100, 90, 97, 85, 95, 100, 100), ingenious = c(75,
  70, 50, 79, 85, 80, 100, 50, 95, 90, 50, 100, 100, 1, 80, 83,
  83, 100), intelligent = c(40, 70, 45, 87, 75, 60, 80, 42, 86,
  80, 29, 100, 50, 45, 61, 77, 40, 90), bright = c(20, 60, 40,
  58, 65, 50, 75, 40, 77, 55, 50, 58, 50, 56, 76, 83, 30, 75),
      smart = c(30, 62, 25, 47, 45, 50, 50, 32, 54, 75, 27, 81,
      70, 69, 40, 85, 29, 80), brainy = c(60, 66, 20, 52, 70, 60,
      50, 20, 66, 35, 31, -9, -10, 44, 78, 91, 50, 70), foolish = c(-15,
      -35, -20, -44, -30, -10, -20, -10, -32, -25, -27, -23, -10,
      -15, -25, 43, -36, -10), daft = c(-10, -60, -30, -14, -20,
      -10, -77, 0, -90, -20, -36, -61, 10, 0, -33, -100, -21, -50
      ), dim = c(-35, -62, -20, 8, -80, -30, -35, -24, -60, -35,
      -34, -9, -100, -34, -83, -71, -27, -20), dumb = c(-25, -50,
      -60, -37, -40, -30, -25, -29, -76, -75, -78, -37, 0, -30,
      -39, -91, -38, -10), mindless = c(-50, -55, -60, -12, -30,
      -50, -25, 0, -62, -50, -100, -100, 0, -6, -39, -52, -59,
      -25), inane = c(-20, -80, -30, -6, -35, -30, -90, -25, -50,
      -50, -38, -100, -75, -25, -12, -100, -22, -10), stupid = c(-25,
      -80, -30, -75, -50, -40, -80, -28, -37, -75, -41, -50, -11,
      -100, -51, -91, -36, -15), dimwitted = c(-50, -77, -20, -59,
      -40, -60, -66, -77, -45, -25, -32, -77, -100, -46, -74, -89,
      -39, -30), idiotic = c(-60, -91, -50, -26, -60, -50, -83,
      -41, -58, -80, 30, -86, -100, -46, -91, -89, -60, -40), moronic = c(-90,
      -87, -40, -19, -65, -60, -90, -85, -78, -75, -59, -100, -80,
      -22, -71, -95, -65, -15), brainless = c(-75, -85, -80, -55,
      -20, -100, -90, -35, -85, -90, -31, -100, -90, -73, -31,
      -63, -100, -95), imbecilic = c(-100, -95, -75, 31, -50, -75,
      -90, -100, -72, -85, -63, -98, -100, -33, -92, -90, -74,
      -100)), .Names = c("brilliant", "ingenious", "intelligent",
  "bright", "smart", "brainy", "foolish", "daft", "dim", "dumb",
  "mindless", "inane", "stupid", "dimwitted", "idiotic", "moronic",
  "brainless", "imbecilic"), class = "data.frame", row.names = c(2L,
  4L, 5L, 6L, 7L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L,
  19L, 20L, 21L))
      11        72        50          42     40    32     20     -10    0  -24  -29        0   -25    -28       -77     -41     -85       -35      -100
      12        80        95          86     77    54     66     -32  -90  -60  -76      -62   -50    -37       -45     -58     -78       -85       -72
      13        85        90          80     55    75     35     -25  -20  -35  -75      -50   -50    -75       -25     -80     -75       -90       -85
      14        65        50          29     50    27     31     -27  -36  -34  -78     -100   -38    -41       -32      30     -59       -31       -63
      15       100       100         100     58    81     -9     -23  -61   -9  -37     -100  -100    -50       -77     -86    -100      -100       -98
      16        90       100          50     50    70    -10     -10   10 -100    0        0   -75    -11      -100    -100     -80       -90      -100
      17        97         1          45     56    69     44     -15    0  -34  -30       -6   -25   -100       -46     -46     -22       -73       -33
      18        85        80          61     76    40     78     -25  -33  -83  -39      -39   -12    -51       -74     -91     -71       -31       -92
      19        95        83          77     83    85     91      43 -100  -71  -91      -52  -100    -91       -89     -89     -95       -63       -90
      20       100        83          40     30    29     50     -36  -21  -27  -38      -59   -22    -36       -39     -60     -65      -100       -74
      21       100       100          90     75    80     70     -10  -50  -20  -10      -25   -10    -15       -30     -40     -15       -95      -100

P.S. can't add a photo, have too little reputation..

A: It's actually pretty easy, I think: all you have to do is set the las graphical parameter before you run the error.bars command:
par(las=2)
error.bars(orderedcols,sd=TRUE,add=TRUE,arrow.len=0.05,bars=TRUE,
           xlab="Adjectives", ylab="Mean Intensity",
           main="Mean Intensities and Standard Deviations")

A ggplot2 solution (you could rotate the labels for this one too -- search on StackOverflow for how to do it -- but I chose to rotate the whole plot instead)
library("reshape2")
library("ggplot2")
theme_set(theme_bw())
ggplot(melt(orderedcols),aes(x=variable,y=value))+
    stat_summary(geom="bar",fun.y=mean,position="identity",fill="gray")+
    stat_summary(geom="errorbar",width=0.2,
                 fun.data=function(x) { data.frame(y=mean(x),
                     ymin=mean(x)-sd(x),ymax=mean(x)+sd(x)) })+
    coord_flip()


text:
Q: How do I restart a python script with a command So, I've been having troubles with restarting a script within itself. I'm making a simple program and I want to have a choice for example:
print ('would you like to make another calculation')

choice3 = input(' Choose: [Y], [N]')

if choice3.lower() == 'y':
    print ('OK!')
    time.sleep(3)

and I want to have it restart right there. If anyone could help me out, thanks... I really appreciate it

A: You can do this using loop:
while True:
    print ('would you like to make another calculation')
    choice3 = input(' Choose: [Y], [N]')
    if choice3.lower() == 'y':
        print ('OK!')
        time.sleep(3)
    else:
        break


text:
Q: what are the references that support string operation in vba Dim msg_Id As String
msg_Id = .Cells(rcount, 3).Value
msg_Id = Mid(msg_Id, 0, 3)

It throws error like invalid procedue call or argument
As I am new to Vb.net I don't know hoe to rectify this error, do I need to include any reference to support this operation
Thanks in advance

A: Look at this: http://msdn.microsoft.com/en-us/library/05e63829(v=vs.90).aspx
It is not about a reference. This error rise when:

Start <= 0 or Length < 0.

You should change your code having in mind that first char is in position 1, not 0
Dim msg_Id As String
msg_Id = .Cells(rcount, 3).Value
msg_Id = Mid(msg_Id, 1, 3)


text:
Q: Oxygen 14.1 with newest DITA-OT I am not able find any related information regarding to my current situation. Is it possible to use the Oxygen 14.1 xml author with DITA-OT 2.5.2? We plan to upgrade our sofware too, but before that the leaders of my company are interested in the possible benefits of the new DITA-OT version.

A: For testing purposes you can try using an oXygen 19.0 trial (https://www.oxygenxml.com/xml_author/register.html). I don't think oXygen 14.1 will work too well with the newest DITA-OT. Maybe yes, maybe not... But if you plan to upgrade to 19.0, there's no need to try 14.1 with DITA-OT 2.5.2. Just try the oXygen + DITA-OT pair that you are planning to use.

A: You could try using the new OT with oXygen 14.1. I believe that you'd have to create versions of the transforms to point to the new OT. However, you won't be able to use any DITA 1.3 features unless you extend the oXygen framework to pick up the newer DTDs. Probably more work than using a trial version of 19.


text:
Q: How can get adjacent divs to match the height of the highest div in the row? As you can see the product description column value is  two lines and hence the row takes it's height. The problem is the adjacent divs are not taking up the same height and hence the border is not complete as you can see from the image below. It is all divs. To table, td or tr.
Table

.row:before,
.row:after {
  content: "";
  display: table;
  clear: both;
}

.row:after {
  clear: both;
}

.row {
  zoom: 1;
}

.row.table {
  border-right: none;
}

div.table {
  border: 1pt solid black;
  border-bottom: 0;
}

div.table>[class*='col-'],
.colcell {
  border: 0;
  border-right: 1pt solid black;
  padding-left: 5pt;
  padding-top: 1pt;
  line-height: 9pt;
}

[class*='col-'] {
  float: left;
  height: 11pt;
  vertical-align: top;
  padding-right: 5px;
  height: 100%;
}

[class*='col-']:last-of-type,
.last {
  padding-right: 0;
}

.col-10-2 {
  width: 20%;
  float: left;
  padding-right: 1%;
}

.col-10 {
  width: 10%;
  float: left;
  padding-right: 1%;
}

.col-2 {
  width: 50%;
  float: left;
  padding-right: 1%;
}

Qty

SKU

Product Description

Unit Price

Ext Price

1

020145

Pokémon Folio Wallet iPhone 6 Case - JLRQ-PK-PB Pokémon Magnetic Folio Wallet

$ 99.99

$ 99.99

A: The issue here is using floats within a display:table element. Here is some correct code to show you how to create a table with css display table, table-row & table-cell. No floats required. Here's the codepen: https://codepen.io/anon/pen/JrRrbg

.table {
  display: table;
  border-collapse: collapse;
}
.row {
    display: table-row;
}
.row.header {
    font-weight:bold;
}
.colcell {
    display: table-cell;
    border: 1px solid black;
    padding-left: 5px;
}
.col-10-2 {
    width: 20%;
}
.col-10 {
    width: 10%;
    padding-right: 1%;
}
.col-2 {
    width: 50%;
    padding-right: 1%;
}

Qty

SKU

Product Description

Unit Price

Ext Price

1

020145

Pokémon Folio Wallet iPhone 6 Case - JLRQ-PK-PB Pokémon Magnetic Folio Wallet

$ 99.99

$ 99.99


text:
Q: Wrong frame adding ViewController View as subview I'm working on a custom scrollView that display different views of different types with pagination.
for view in views {
            view.frame = frame
            frame.origin.x += width
        }
contentViewWidth.constant = width * CGFloat(pages.count)
self.setNeedsUpdateConstraints()

works very well for any kind of custom view subclass.
Now I have to add a ViewController as "page", but doing:
parentViewController?.addChildViewController(containedViewController)
        let width = scrollView.frame.size.width
        let height = scrollView.frame.size.height
        var frame = CGRect(x: 0, y: 0, width: width, height: height)
        containedViewController.view.frame = frame
        pages.append(containedViewController.view)
        contentView.addSubview(containedViewController.view)
        containedViewController.didMove(toParentViewController: parentViewController)

I get the right frame when setting it, bug inspecting the complete scrollview I get a totally random frame size.
I'm using the scrollview full screen on a 7plus, su 414 width, but i always get as a result a view with width > 500 px.
What i'm missing?

A: Always better to add a UIView as a container view and set the frame of the viewController.view to that. viewController.view.frame tends to get messy for some reason, especially on rotation / dynamic layout... so try
parentViewController?.addChildViewController(containedViewController)

let width = scrollView.frame.size.width
let height = scrollView.frame.size.height
let frame = CGRect(x: 0, y: 0, width: width, height: height)

let containerView = UIView(frame:frame)

//potentially add flexible width and height
containedViewController.view.autoresizingMask = [.flexibleWidth,.flexibleHeight]

containedViewController.view.frame = containerView.frame

pages.append(containerView) // assuming this is an array of the views inside the scrollview I'd change that to containerView as well.. bit of a guess though.

containerView.addSubview(containedViewController.view)
contentView.addSubview(containerView)
containedViewController.didMove(toParentViewController: parentViewController)


text:
Q: How can I write Apache Ignite cache entry to Apache Avro file? I am now working on a task which requires me to write Apache Ignite cache-stored data to Avro.
Unfortunately I do not have an access to initial Java classes used for cache-stored objects creation.
The only source I have is Apache Ignite (it's Java API). Cache Itself is presented as IgniteCache<Object, Object>. Actually each cache entry is a key-value pair where key is realized as an AffinityKey and value contains a project-related object.
Cache entry looks as follows when converting it to JSON:
{
    "AffinityKey [key=1, affKey=1f1a11b-ba1e-1cd1-1c11-c11111ab1111]": {
        "version": null,
        "name": "Name 1",
        "description": "Description 1",
        "interests": [
            "int1",
            "int2",
            "int3",
            "int4"
        ],
        "hobbies": [
            "hobby1",
            "hobby2",
            "hobby3"
        ],
        "classId": 11111,
        "creator": "5b90fb41e0eb212c4736d186",
        "editorId": null,
        "logoConfigurationId": 85,
        "editTimeout": null,
        "active": false,
        "lastActionTime": {
            "year": 2020,
            "month": "MAY",
            "nano": 143000000,
            "monthValue": 5,
            "dayOfMonth": 18,
            "hour": 14,
            "minute": 1,
            "second": 4,
            "dayOfYear": 139,
            "dayOfWeek": "MONDAY",
            "chronology": {
                "id": "ISO",
                "calendarType": "iso8601"
            }
        },
        "status": "Attention required",
        "lastJobId": null
    }
}

Can somebody please advise on how can I serialize my Ignite cache entries to Avro?
As I know Avro-schema is required for avro-serialization. For this I will need to know both name and type for each field captured in my cache entry. The only way I see for schema creation is to get both entry-key and entry-value represented as BinaryObject and then collect all field names and types. Having all the name-type pairs for object's fields it may be possible to manually construct some kind of json for further storing it in .asvc file.
Perhaps somebody can advise on a bit more 'elegant' solution?

A: Having an Ignite Cache Entry represented as a Map<BinaryObject, BinaryObject> (.withKeepBinary() should be used when requesting cache from Ignite) it is possible to extract the definition for each BinaryObject's field (field name + field type). Avro SchemaBuilder can be used further for avro schema generation.