问:
JPA 2, JSF, setting id of OneToOne mapped entity problem
we havent used JPA or any other ORM tools in our web application, now we have been on updating whole stuff to Java EE 6,

my problem about is JPA
,i have been looking for an answer,and learn how people solve that kinda issue,
i have 2 entites,

```
<code>
@Entity Person
{
@Id
private long id;

@JoinColumn(name="CITY_ID")
@OneToOne(fetch=FetchType.LAZY)
private City city;
....
}

</code>
```

and my second entity

```

@Entity City
{
@Id
private long id;
private String name;
.....
}
```

i am querying person entity and i show one on my jsf page

i have 2 input fields for Person.city to show on my jsf page
inputhidden for id and inputtext for name
people are selecting cities from a popup then
i set hidden  component for city id, with new selected new value,
and the same for name,
everthing goes fine till now,
when i merge Person Entity, it tries to merge City also, but with an id already defined on table, so constraint error for Cirty Id.

what are you doing for this kinda problem?

i thought valueChange action for inputHidden,but at jsf Life cycle it happens before update model so even if i replace Person.City entity with new one in action ,
it will updated again (actually with the same values but it will be done twice)
,So what is the best workaround for this situation?

thanx

答:
Seam Faces ,converter as it explains in here u need special id to entity converter,
that was my problem</p>

Body:
we havent used JPA or any other ORM tools in our web application, now we have been on updating whole stuff to Java EE 6,

my problem about is JPA
,i have been looking for an answer,and learn how people solve that kinda issue,
i have 2 entites,

@Entity Person
{
@Id
private long id;

@JoinColumn(name="CITY_ID")
@OneToOne(fetch=FetchType.LAZY)
private City city;
....
}

and my second entity

@Entity City
{
@Id
private long id;
private String name;
.....
}

i am querying person entity and i show one on my jsf page

i have 2 input fields for Person.city to show on my jsf page
inputhidden for id and inputtext for name
people are selecting cities from a popup then
i set hidden  component for city id, with new selected new value,
and the same for name,
everthing goes fine till now,
when i merge Person Entity, it tries to merge City also, but with an id already defined on table, so constraint error for Cirty Id.

what are you doing for this kinda problem?

i thought valueChange action for inputHidden,but at jsf Life cycle it happens before update model so even if i replace Person.City entity with new one in action ,
it will updated again (actually with the same values but it will be done twice)
,So what is the best workaround for this situation?

thanx


来源: stackexchange

问:
PHP desktop how to change the main window icon
I am starting to use PHP desktop to create a desktop application and it works great, just want to know if there's any settings to change the main windows icon, i know to change the pop-up windows icon can be change on settings.json, but i cannot find any settings to change the main windows.

Note: im using Inno Compiler to distribute my application, but the compiler only change the set-up icon not the main application.

答:
I had the same problem, the solution is provided by the creator -

If you would like to change the icon that is embedded in the executable file then do the following steps:

Download Resource Hacker and run it.
From the "File" menu select open, navigate and choose "phpdesktop-msie.exe" (or "phpdesktop-chrome.exe").

On the left side there should be a tree control, expand "/Icon Group/128/1033", right click on the "1033", select "Replace Resource..." and replace that resource with your icon.

That's it, save it and see the changes by running the executable file.
When you change icon embedded in the executable file you do not need to set it anymore in the settings file.

ContentLicense: CC BY-SA 3.0


问:
python -m pip install -U pip Errno 11004
I am trying to update pip but I keep getting the following messages:

```<code>H:\>python -m pip install -U pip
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.con
nection.VerifiedHTTPSConnection object at 0x031AF3B0>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',)': /simple/pip/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.con
nection.VerifiedHTTPSConnection object at 0x031AF3D0>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',)': /simple/pip/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.con
nection.VerifiedHTTPSConnection object at 0x031AF110>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',)': /simple/pip/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.con
nection.VerifiedHTTPSConnection object at 0x031AF0B0>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',)': /simple/pip/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.con
nection.VerifiedHTTPSConnection object at 0x031AF170>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',)': /simple/pip/
Requirement already up-to-date: pip in c:\users\a256886\appdata\local\programs\python\python36-32\lib\site-packages
</code>```

I have python 3.6.1 installed and when I run pip --version I see pip 9.0.1.

Why I can't update it? Or install any package with pip? What is happening? How can I fix it?

答:
You are behind a proxy. As you discovered, you can pass a proxy to pip using the --proxy argument:

```<code>python -m pip install -U pip --proxy http://username:password@proxy_url:port
</code>```

or

```<code>pip install --upgrade pip --proxy http://username:password@proxy_url:port
</code>```

The documentation is confusing here because it does not mention the requirement to pass the protocol as part of the proxy definition.

Body:
I am trying to update pip but I keep getting the following messages:

H:\>python -m pip install -U pip
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.con
nection.VerifiedHTTPSConnection object at 0x031AF3B0>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',)': /simple/pip/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.con
nection.VerifiedHTTPSConnection object at 0x031AF3D0>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',)': /simple/pip/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.con
nection.VerifiedHTTPSConnection object at 0x031AF110>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',)': /simple/pip/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.con
nection.VerifiedHTTPSConnection object at 0x031AF0B0>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',)': /simple/pip/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.con
nection.VerifiedHTTPSConnection object at 0x031AF170>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',)': /simple/pip/
Requirement already up-to-date: pip in c:\users\a256886\appdata\local\programs\python\python36-32\lib\site-packages

I have python 3.6.1 installed and when I run pip --version I see pip 9.0.1.

Why I can't update it? Or install any package with pip? What is happening? How can I fix it?

Body:
You are behind a proxy. As you discovered, you can pass a proxy to pip using the --proxy argument:

python -m pip install -U pip --proxy http://username:password@proxy_url:port

or

pip install --upgrade pip --proxy http://username:password@proxy_url:port

The documentation is confusing here because it does not mention the requirement to pass the protocol as part of the proxy definition.


问:
How to align elements in CSS
I am unable to align the elements in one line. I am using display: inline-block but for some reason it is not taking the affect. I am using DataTables.I want the buttons (images) to be aligned with the box showing the page number.

CSS

```<code>.dataTables_paginate input {
 width: 8%;
 height: 8%;
 padding-bottom: 0.2px;
 display: inline-block;
 font: normal 11px Verdana, Arial, Helvetica, sans-serif;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
 box-sizing: border-box;
 display: inline-block;
 min-width: 1.5em;
 padding: 0.5em 1em;
 margin-left: 2px;
 text-align: center;
 text-decoration: none !important;
 cursor: pointer;
 *cursor: hand;
 color: #333 !important;
 border: 1px solid transparent;
border-radius: 2px;
}
</code>```

My Jquery

```<code>var table = $('#esignTable').DataTable({"sDom": '<"top"flp>rt<"bottom"i><"clear">',
      pagingType: 'input',
      pageLength: 5,
      language: {
        "sEmptyTable": " ",
        oPaginate: {
            "sNext": '<img src="../images/integration/SlowRight.jpg">',
            "sPrevious": '<img src="../images/integration/SlowLeft.jpg">',
            "sFirst": '<img src="../images/integration/FastLeft.jpg">',
            "sLast": '<img src="../images/integration/FastRight.jpg">',
        }
      }
    });
</code>```

答:
change padding-bottom: 0.2px; to padding-bottom: 0.5em; they have different padding at bottom:

.dataTables_paginate input {
  width: 8%;
  height: 8%;
  padding-bottom: 0.5em;
  display: inline-block;
  font: normal 11px Verdana, Arial, Helvetica, sans-serif;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  box-sizing: border-box;
  display: inline-block;
  min-width: 1.5em;
  padding: 0.5em 1em;
  margin-left: 2px;
  text-align: center;
  text-decoration: none !important;
  cursor: pointer;
  *cursor: hand;
  color: #333 !important;
  border: 1px solid transparent;
  border-radius: 2px;
}```

Title: How to align elements in CSS

Body:
I am unable to align the elements in one line. I am using display: inline-block but for some reason it is not taking the affect. I am using DataTables.I want the buttons (images) to be aligned with the box showing the page number.

CSS

.dataTables_paginate input {
 width: 8%;
 height: 8%;
 padding-bottom: 0.2px;
 display: inline-block;
 font: normal 11px Verdana, Arial, Helvetica, sans-serif;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
 box-sizing: border-box;
 display: inline-block;
 min-width: 1.5em;
 padding: 0.5em 1em;
 margin-left: 2px;
 text-align: center;
 text-decoration: none !important;
 cursor: pointer;
 *cursor: hand;
 color: #333 !important;
 border: 1px solid transparent;
border-radius: 2px;
}

My Jquery

var table = $('#esignTable').DataTable({"sDom": '<"top"flp>rt<"bottom"i><"clear">',
      pagingType: 'input',
      pageLength: 5,
      language: {
        "sEmptyTable": " ",
        oPaginate: {
            "sNext": '',
            "sPrevious": '',
            "sFirst": '',
            "sLast": '',
        }
      }
    });


问:
multiple random images in HTML5 canvas
I am trying draw multiple images from array at random on canvas. i cant figure out a way to iterate in array and draw when a function is calling draw() from  for loop.

this is what i have

```<code>// Call Draw particles
      for (var i = 0; i < particles.length; i++) {
        particles[i].draw(i);
      };
</code>```

and the draw ()

```<code>Particle.prototype.draw = function(i) {
        imgs = new Image();
        if (i<20){
            imgs.src = imgArray[1];
            ctx.drawImage(imgs ,this.position.x + this.parallaxOffsetX, this.position.y + this.parallaxOffsetY);
        }else if(i>20 && i<50 ){
            imgs.src = imgArray[2];
            ctx.drawImage(imgs ,this.position.x + this.parallaxOffsetX, this.position.y + this.parallaxOffsetY);
        }else if(i>50 && i<100){
            imgs.src = imgArray[3];
            ctx.drawImage(imgs ,this.position.x + this.parallaxOffsetX, this.position.y + this.parallaxOffsetY);
        }else{
            imgs.src = imgArray[4];
            ctx.drawImage(imgs ,this.position.x + this.parallaxOffsetX, this.position.y + this.parallaxOffsetY);
        }
    };
</code>```

i know i need to figure out a way to loop in imgArray without using if else but i don't know how?

Thanks in advance..

edit:
here is a codepen demo codepen using @mintychai advice

答:
I'm assuming you want to use a random image from imgArray for each particle whereas right now you're giving particles their images based on their position in the particle array.

Also assuming you have 4 images in your imgArray.

```<code>Particle.prototype.draw = function(i) {
    imgs = new Image();
    var randomNumber = Math.floor((Math.random() * 4) + 1);
    imgs.src = imgArray[randomNumber];
    ctx.drawImage(imgs ,this.position.x + this.parallaxOffsetX, this.position.y + this.parallaxOffsetY);
};
</code>```

Math.random() gets you a random number, and what you're looking for is under the section "Getting a random integer between two values" in this resource.

Title: multiple random images in HTML5 canvas

Body:
I am trying draw multiple images from array at random on canvas. i cant figure out a way to iterate in array and draw when a function is calling draw() from  for loop.

this is what i have

// Call Draw particles
      for (var i = 0; i < particles.length; i++) {
        particles[i].draw(i);
      };

and the draw ()

Particle.prototype.draw = function(i) {
        imgs = new Image();
        if (i<20){
            imgs.src = imgArray[1];
            ctx.drawImage(imgs ,this.position.x + this.parallaxOffsetX, this.position.y + this.parallaxOffsetY);
        }else if(i>20 && i<50 ){
            imgs.src = imgArray[2];
            ctx.drawImage(imgs ,this.position.x + this.parallaxOffsetX, this.position.y + this.parallaxOffsetY);
        }else if(i>50 && i<100){
            imgs.src = imgArray[3];
            ctx.drawImage(imgs ,this.position.x + this.parallaxOffsetX, this.position.y + this.parallaxOffsetY);
        }else{
            imgs.src = imgArray[4];
            ctx.drawImage(imgs ,this.position.x + this.parallaxOffsetX, this.position.y + this.parallaxOffsetY);
        }
    };

i know i need to figure out a way to loop in imgArray without using if else but i don't know how?

Thanks in advance..

edit:
here is a codepen demo codepen using @mintychai advice

Body:
I'm assuming you want to use a random image from imgArray for each particle whereas right now you're giving particles their images based on their position in the particle array.

Also assuming you have 4 images in your imgArray.

Particle.prototype.draw = function(i) {
    imgs = new Image();
    var randomNumber = Math.floor((Math.random() * 4) + 1);
    imgs.src = imgArray[randomNumber];
    ctx.drawImage(imgs ,this.position.x + this.parallaxOffsetX, this.position.y + this.parallaxOffsetY);
};

Math.random() gets you a random number, and what you're looking for is under the section "Getting a random integer between two values" in this resource.


问:
Sequence contains no elements when trying to save the value property of dropdownlist to the database
```<code>    <div class="form-group">
    @Html.LabelFor(m => m.Genres)
    @Html.DropDownListFor(m => m.Genres, new SelectList(Model.Genres, "id", "name"), "", new { @class = "form-control" })
</div>
</code>```

above is my view

```<code>public class GigFormViewModel
{
    public string Venue { get; set; }
    public string Date { get; set; }
    public string Time { get; set; }
    public int Genre { get; set; }
    public IEnumerable<Genre> Genres { get; set; }
}
</code>```

and this is my ViewModel

```<code>    public class Gig
{
    public int id { get; set; }

    [Required]
    public ApplicationUser artisrt { get; set; }

    public DateTime  dateTime { get; set; }

    [Required]
    [StringLength(255)]
    public string venue { get; set; }

    [Required]
    public Genre genre { get; set; }
}
</code>```

model

```<code> public ActionResult Create(GigFormViewModel viewModel)
    {
        var artistId = User.Identity.GetUserId();
        var artist = _context.Users.Single(u => u.Id == artistId);
        var genre = _context.genres.Single(g => g.id == viewModel.Genre);

        var gig = new Gig()
        {
            artisrt = artist,
            dateTime = DateTime.Parse(string.Format("{0}, {1}", viewModel.Date, viewModel.Time)),
            genre = genre,
            venue = viewModel.Venue
        };

        _context.gigs.Add(gig);
        _context.SaveChanges();

        return RedirectToAction("Index", "Home");

    }
</code>```

and above is the controller and the exception is generating from where I am calling the genres.Single()

I have tried using SingleOrDefault() instead of Single() but in that case it is trying to save a null value in the database and the database does not allow nulls.

Edit: value of viewModel.Genre is 0 when I debug it.

答:
You should do like this:

```<code>  @Html.DropDownListFor(m => m.Genre,
                        new SelectList(Model.Genres, "id", "name"), "",
                        new { @class = "form-control" })
</code>```

Where:

```<code>m => m.Genre
</code>```

is the property where the result value will be stored (you are currently using the collection m => m.Genres instead of m.Genre)

Body:
    @Html.LabelFor(m => m.Genres)
    @Html.DropDownListFor(m => m.Genres, new SelectList(Model.Genres, "id", "name"), "", new { @class = "form-control" })

above is my view

public class GigFormViewModel
{
    public string Venue { get; set; }
    public string Date { get; set; }
    public string Time { get; set; }
    public int Genre { get; set; }
    public IEnumerable<Genre> Genres { get; set; }
}

and this is my ViewModel

    public class Gig
{
    public int id { get; set; }

    [Required]
    public ApplicationUser artisrt { get; set; }

    public DateTime  dateTime { get; set; }

    [Required]
    [StringLength(255)]
    public string venue { get; set; }

    [Required]
    public Genre genre { get; set; }
}

model

 public ActionResult Create(GigFormViewModel viewModel)
    {
        var artistId = User.Identity.GetUserId();
        var artist = _context.Users.Single(u => u.Id == artistId);
        var genre = _context.genres.Single(g => g.id == viewModel.Genre);

        var gig = new Gig()
        {
            artisrt = artist,
            dateTime = DateTime.Parse(string.Format("{0}, {1}", viewModel.Date, viewModel.Time)),
            genre = genre,
            venue = viewModel.Venue
        };

        _context.gigs.Add(gig);
        _context.SaveChanges();

        return RedirectToAction("Index", "Home");

    }

and above is the controller and the exception is generating from where I am calling the genres.Single()

I have tried using SingleOrDefault() instead of Single() but in that case it is trying to save a null value in the database and the database does not allow nulls.

Edit: value of viewModel.Genre is 0 when I debug it.

Body:
You should do like this:

  @Html.DropDownListFor(m => m.Genre,
                        new SelectList(Model.Genres, "id", "name"), "",
                        new { @class = "form-control" })

Where:

m => m.Genre

is the property where the result value will be stored (you are currently using the collection m => m.Genres instead of m.Genre)


问:
Is there a tool for converting VB to a scripting language, e.g. Python or Ruby?
I've discovered VB2Py, but it's been silent for almost 5 years. Are there any other tools out there which could be used to convert VB6 projects to Python, Ruby, Tcl, whatever?</p>

答:
Compile the VB code either into a normal DLL or a COM DLL. All Pythons on Windows, including the vanilla ActivePython distribution (IronPython isn't required) can connect to
both types of DLLs.

I think this is your best option. As Gustavo said, finding something that will compile arbitrary VB6 code into Python sounds like an unachievable dream.

OwnerDisplayName: boost

ContentLicense: CC BY-SA 2.5

OwnerDisplayName: eliben


问:
Apache Ignite: How do I fix the "Unknown pair" error when using a StreamReceiver?
How do I fix the following serialization error when using a DataStreamer with a StreamReceiver? I am guessing that it is not able to find the class when deserializing the RowStreamReceiver.

Error: SEVERE: Failure in Java callback class org.apache.ignite.IgniteException: Platform error:Apache.Ignite.Core.Binary.BinaryObjectException: Unknown pair [platformId=1, typeId=113114]

I'm using Apache Ignite 2.0, and I am trying to employ the same kind of code demonstrated in this test:
https://github.com/apache/ignite/blob/master/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTest.cs#L436

I've tried adding the assembly to the configuration, but that didn't seem to help. config.Assemblies.Add(typeof(RowStreamReceiver).Assembly.FullName);

Here's the relevant code:

DataStreamer:

```<code>using (var ds = m_ignite.GetDataStreamer<string, IBinaryObject>(CacheName)) {
    ds.AllowOverwrite = true;
    ds.Receiver = new RowStreamReceiver(); // If I comment this out, the error goes away
    Parallel.ForEach(rows.Select((r, i) => new KeyValuePair<long, string>(i, r)), r => {
        var pair = BuildRow(r.Key, r.Value);
        ds.AddData(pair);
    });
}
</code>```

StreamReceiver:

```<code>[Serializable]
public class RowStreamReceiver : IStreamReceiver<string, IBinaryObject> {
    public void Receive(ICache<string, IBinaryObject> cache, ICollection<ICacheEntry<string, IBinaryObject>> entries) {
        var bin = cache.Ignite.GetBinary();
        cache.PutAll(entries.ToDictionary(x => x.Key, x => {
            var builder = bin.GetBuilder(x.Value);
            SetColumnFields(builder);
            return builder.Build();
        }));
    }

    private static void SetColumnFields(IBinaryObjectBuilder builder) {
        /* logic to set fields */
    }
}
</code>```

Stack Trace:

```<code>Jul 07, 2017 11:25:22 AM java.util.logging.LogManager$RootLogger log
SEVERE: Failure in Java callback class org.apache.ignite.IgniteException: Platform error:Apache.Ignite.Core.Binary.BinaryObjectException: Unknown pair [platformId=1, typeId=113114] ---> Apache.Ignite.Core.Common.JavaException: class org.apache.ignite.binary.BinaryObjectException: Unknown pair [platformId=1, typeId=113114]
        at org.apache.ignite.internal.processors.platform.binary.PlatformBinaryProcessor.processInStreamOutStream(PlatformBinaryProcessor.java:119)
        at org.apache.ignite.internal.processors.platform.PlatformTargetProxyImpl.inStreamOutStream(PlatformTargetProxyImpl.java:155)
        at org.apache.ignite.internal.processors.platform.callback.PlatformCallbackUtils.inLongLongLongObjectOutLong(Native Method)
        at org.apache.ignite.internal.processors.platform.callback.PlatformCallbackGateway.dataStreamerStreamReceiverInvoke(PlatformCallbackGateway.java:464)
        at org.apache.ignite.internal.processors.platform.datastreamer.PlatformStreamReceiverImpl.receive(PlatformStreamReceiverImpl.java:100)
        at org.apache.ignite.internal.processors.datastreamer.DataStreamerUpdateJob.call(DataStreamerUpdateJob.java:137)
        at org.apache.ignite.internal.processors.datastreamer.DataStreamProcessor.localUpdate(DataStreamProcessor.java:382)
        at org.apache.ignite.internal.processors.datastreamer.DataStreamProcessor.processRequest(DataStreamProcessor.java:301)
        at org.apache.ignite.internal.processors.datastreamer.DataStreamProcessor.access$000(DataStreamProcessor.java:58)
        at org.apache.ignite.internal.processors.datastreamer.DataStreamProcessor$1.onMessage(DataStreamProcessor.java:88)
        at org.apache.ignite.internal.managers.communication.GridIoManager.invokeListener(GridIoManager.java:1257)
        at org.apache.ignite.internal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:885)
        at org.apache.ignite.internal.managers.communication.GridIoManager.access$2100(GridIoManager.java:114)
        at org.apache.ignite.internal.managers.communication.GridIoManager$7.run(GridIoManager.java:802)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.ClassNotFoundException: Unknown pair [platformId=1, typeId=113114]
        at org.apache.ignite.internal.MarshallerContextImpl.getClassName(MarshallerContextImpl.java:385)
        at org.apache.ignite.internal.processors.platform.binary.PlatformBinaryProcessor.processInStreamOutStream(PlatformBinaryProcessor.java:113)
        ... 16 more

   --- End of inner exception stack trace ---    at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, SByte* stackTraceChars, Int32 stackTraceCharsLen, Void* errData, Int32 errDataLen)    at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.TargetInStreamOutStream(Void* ctx, Void* target, Int32 opType, Int64 inMemPtr, Int64 outMemPtr)    at Apache.Ignite.Core.Impl.PlatformTarget.DoOutInOp[TR](Int32 type, Action`1 outAction, Func`2 inAction)    at Apache.Ignite.Core.Impl.Binary.BinaryProcessor.GetType(Int32 id)    at Apache.Ignite.Core.Impl.Binary.Marshaller.GetDescriptor(Boolean userType, Int32 typeId, Boolean requiresType)    at Apache.Ignite.Core.Impl.Binary.BinaryReader.ReadFullObject[T](Int32 pos)    at Apache.Ignite.Core.Impl.Binary.BinaryReader.TryDeserialize[T](T& res)  at Apache.Ignite.Core.Impl.Binary.BinaryReader.Deserialize[T]()    at Apache.Ignite.Core.Impl.Binary.BinaryReader.ReadBinaryObject[T](Boolean do Detach)    at Apache.Ignite.Core.Impl.Binary.BinaryReader.TryDeserialize[T](T& res)  at Apache.Ignite.Core.Impl.Binary.BinaryReader.Deserialize[T]()    at Apache.Ignite.Core.Impl.Datastream.StreamReceiverHolder.InvokeReceiver[TK, TV](IStreamReceiver`2 receiver, Ignite grid, IUnmanagedTarget cache, IBinaryStream stream, Boolean keepBinary)    at Apache.Ignite.Core.Impl.Datastream.StreamReceiverHolder.Receive(Ignite grid, IUnmanagedTarget cache, IBinaryStream stream, Boolean keepBinary)    at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.DataStreamerStreamReceiverInvoke(Int64 memPtr, Int64 unused, Int64 unused1, Void* cache)    at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.InLongLongLongObjectOutLong(Void* target, Int32 type, Int64 val1, Int64 val2, Int64 val3, Void* arg)
        at org.apache.ignite.internal.processors.platform.PlatformProcessorImpl.loggerLog(PlatformProcessorImpl.java:497)
        at org.apache.ignite.internal.processors.platform.callback.PlatformCallbackUtils.inLongLongLongObjectOutLong(Native Method)
        at org.apache.ignite.internal.processors.platform.callback.PlatformCallbackGateway.dataStreamerStreamReceiverInvoke(PlatformCallbackGateway.java:464)
        at org.apache.ignite.internal.processors.platform.datastreamer.PlatformStreamReceiverImpl.receive(PlatformStreamReceiverImpl.java:100)
        at org.apache.ignite.internal.processors.datastreamer.DataStreamerUpdateJob.call(DataStreamerUpdateJob.java:137)
        at org.apache.ignite.internal.processors.datastreamer.DataStreamProcessor.localUpdate(DataStreamProcessor.java:382)
        at org.apache.ignite.internal.processors.datastreamer.DataStreamProcessor.processRequest(DataStreamProcessor.java:301)
        at org.apache.ignite.internal.processors.datastreamer.DataStreamProcessor.access$000(DataStreamProcessor.java:58)
        at org.apache.ignite.internal.processors.datastreamer.DataStreamProcessor$1.onMessage(DataStreamProcessor.java:88)
        at org.apache.ignite.internal.managers.communication.GridIoManager.invokeListener(GridIoManager.java:1257)
        at org.apache.ignite.internal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:885)
        at org.apache.ignite.internal.managers.communication.GridIoManager.access$2100(GridIoManager.java:114)
        at org.apache.ignite.internal.managers.communication.GridIoManager$7.run(GridIoManager.java:802)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:748)
</code>```

答:
The "Unknown pair" issue is caused by not using GetDataStreamer correctly. My cache was originally created like this:

```<code>ignite.GetOrCreateCache<string, object>(cacheConfig)
</code>```

so when getting the DataStreamer, I needed to use the same types, and then use KeepWithBinary

```<code>var ds = m_ignite.GetDataStreamer<string, object>(CacheName).KeepWithBinary<string, IBinaryObject>()
</code>```

Body:
How do I fix the following serialization error when using a DataStreamer with a StreamReceiver? I am guessing that it is not able to find the class when deserializing the RowStreamReceiver.

Error: SEVERE: Failure in Java callback class org.apache.ignite.IgniteException: Platform error:Apache.Ignite.Core.Binary.BinaryObjectException: Unknown pair [platformId=1, typeId=113114]

I'm using Apache Ignite 2.0, and I am trying to employ the same kind of code demonstrated in this test:
https://github.com/apache/ignite/blob/master/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTest.cs#L436

I've tried adding the assembly to the configuration, but that didn't seem to help. config.Assemblies.Add(typeof(RowStreamReceiver).Assembly.FullName);

Here's the relevant code:

DataStreamer:

using (var ds = m_ignite.GetDataStreamer<string, IBinaryObject>(CacheName)) {
    ds.AllowOverwrite = true;
    ds.Receiver = new RowStreamReceiver(); // If I comment this out, the error goes away
    Parallel.ForEach(rows.Select((r, i) => new KeyValuePair<long, string>(i, r)), r => {
        var pair = BuildRow(r.Key, r.Value);
        ds.AddData(pair);
    });
}

StreamReceiver:

[Serializable]
public class RowStreamReceiver : IStreamReceiver<string, IBinaryObject> {
    public void Receive(ICache<string, IBinaryObject> cache, ICollection<ICacheEntry<string, IBinaryObject>> entries) {
        var bin = cache.Ignite.GetBinary();
        cache.PutAll(entries.ToDictionary(x => x.Key, x => {
            var builder = bin.GetBuilder(x.Value);
            SetColumnFields(builder);
            return builder.Build();
        }));
    }

    private static void SetColumnFields(IBinaryObjectBuilder builder) {
        /* logic to set fields */
    }
}

Stack Trace:

Jul 07, 2017 11:25:22 AM java.util.logging.LogManager$RootLogger log
SEVERE: Failure in Java callback class org.apache.ignite.IgniteException: Platform error:Apache.Ignite.Core.Binary.BinaryObjectException: Unknown pair [platformId=1, typeId=113114] ---> Apache.Ignite.Core.Common.JavaException: class org.apache.ignite.binary.BinaryObjectException: Unknown pair [platformId=1, typeId=113114]
        at org.apache.ignite.internal.processors.platform.binary.PlatformBinaryProcessor.processInStreamOutStream(PlatformBinaryProcessor.java:119)
        at org.apache.ignite.internal.processors.platform.PlatformTargetProxyImpl.inStreamOutStream(PlatformTargetProxyImpl.java:155)
        at org.apache.ignite.internal.processors.platform.callback.PlatformCallbackUtils.inLongLongLongObjectOutLong(Native Method)
        at org.apache.ignite.internal.processors.platform.callback.PlatformCallbackGateway.dataStreamerStreamReceiverInvoke(PlatformCallbackGateway.java:464)
        at org.apache.ignite.internal.processors.platform.datastreamer.PlatformStreamReceiverImpl.receive(PlatformStreamReceiverImpl.java:100)
        at org.apache.ignite.internal.processors.datastreamer.DataStreamerUpdateJob.call(DataStreamerUpdateJob.java:137)
        at org.apache.ignite.internal.processors.datastreamer.DataStreamProcessor.localUpdate(DataStreamProcessor.java:382)
        at org.apache.ignite.internal.processors.datastreamer.DataStreamProcessor.processRequest(DataStreamProcessor.java:301)
        at org.apache.ignite.internal.processors.datastreamer.DataStreamProcessor.access$000(DataStreamProcessor.java:58)
        at org.apache.ignite.internal.processors.datastreamer.DataStreamProcessor$1.onMessage(DataStreamProcessor.java:88)
        at org.apache.ignite.internal.managers.communication.GridIoManager.invokeListener(GridIoManager.java:1257)
        at org.apache.ignite.internal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:885)
        at org.apache.ignite.internal.managers.communication.GridIoManager.access$2100(GridIoManager.java:114)
        at org.apache.ignite.internal.managers.communication.GridIoManager$7.run(GridIoManager.java:802)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.ClassNotFoundException: Unknown pair [platformId=1, typeId=113114]
        at org.apache.ignite.internal.MarshallerContextImpl.getClassName(MarshallerContextImpl.java:385)
        at org.apache.ignite.internal.processors.platform.binary.PlatformBinaryProcessor.processInStreamOutStream(PlatformBinaryProcessor.java:113)
        ... 16 more

   --- End of inner exception stack trace ---    at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, SByte* stackTraceChars, Int32 stackTraceCharsLen, Void* errData, Int32 errDataLen)    at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.TargetInStreamOutStream(Void* ctx, Void* target, Int32 opType, Int64 inMemPtr, Int64 outMemPtr)    at Apache.Ignite.Core.Impl.PlatformTarget.DoOutInOp[TR](Int32 type, Action`1 outAction, Func`2 inAction)    at Apache.Ignite.Core.Impl.Binary.BinaryProcessor.GetType(Int32 id)    at Apache.Ignite.Core.Impl.Binary.Marshaller.GetDescriptor(Boolean userType, Int32 typeId, Boolean requiresType)    at Apache.Ignite.Core.Impl.Binary.BinaryReader.ReadFullObject[T](Int32 pos)    at Apache.Ignite.Core.Impl.Binary.BinaryReader.TryDeserialize[T](T& res)  at Apache.Ignite.Core.Impl.Binary.BinaryReader.Deserialize[T]()    at Apache.Ignite.Core.Impl.Binary.BinaryReader.ReadBinaryObject[T](Boolean do Detach)    at Apache.Ignite.Core.Impl.Binary.BinaryReader.TryDeserialize[T](T& res)  at Apache.Ignite.Core.Impl.Binary.BinaryReader.Deserialize[T]()    at Apache.Ignite.Core.Impl.Datastream.StreamReceiverHolder.InvokeReceiver[TK, TV](IStreamReceiver`2 receiver, Ignite grid, IUnmanagedTarget cache, IBinaryStream stream, Boolean keepBinary)    at Apache.Ignite.Core.Impl.Datastream.StreamReceiverHolder.Receive(Ignite grid, IUnmanagedTarget cache, IBinaryStream stream, Boolean keepBinary)    at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.DataStreamerStreamReceiverInvoke(Int64 memPtr, Int64 unused, Int64 unused1, Void* cache)    at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.InLongLongLongObjectOutLong(Void* target, Int32 type, Int64 val1, Int64 val2, Int64 val3, Void* arg)
        at org.apache.ignite.internal.processors.platform.PlatformProcessorImpl.loggerLog(PlatformProcessorImpl.java:497)
        at org.apache.ignite.internal.processors.platform.callback.PlatformCallbackUtils.inLongLongLongObjectOutLong(Native Method)
        at org.apache.ignite.internal.processors.platform.callback.PlatformCallbackGateway.dataStreamerStreamReceiverInvoke(PlatformCallbackGateway.java:464)
        at org.apache.ignite.internal.processors.platform.datastreamer.PlatformStreamReceiverImpl.receive(PlatformStreamReceiverImpl.java:100)
        at org.apache.ignite.internal.processors.datastreamer.DataStreamerUpdateJob.call(DataStreamerUpdateJob.java:137)
        at org.apache.ignite.internal.processors.datastreamer.DataStreamProcessor.localUpdate(DataStreamProcessor.java:382)
        at org.apache.ignite.internal.processors.datastreamer.DataStreamProcessor.processRequest(DataStreamProcessor.java:301)
        at org.apache.ignite.internal.processors.datastreamer.DataStreamProcessor.access$000(DataStreamProcessor.java:58)
        at org.apache.ignite.internal.processors.datastreamer.DataStreamProcessor$1.onMessage(DataStreamProcessor.java:88)
        at org.apache.ignite.internal.managers.communication.GridIoManager.invokeListener(GridIoManager.java:1257)
        at org.apache.ignite.internal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:885)
        at org.apache.ignite.internal.managers.communication.GridIoManager.access$2100(GridIoManager.java:114)
        at org.apache.ignite.internal.managers.communication.GridIoManager$7.run(GridIoManager.java:802)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:748)

Body:
The "Unknown pair" issue is caused by not using GetDataStreamer correctly. My cache was originally created like this:

ignite.GetOrCreateCache<string, object>(cacheConfig)

so when getting the DataStreamer, I needed to use the same types, and then use KeepWithBinary

var ds = m_ignite.GetDataStreamer<string, object>(CacheName).KeepWithBinary<string, IBinaryObject>()


问:
incompatible type erros in android studio
I received an error that says:

Incompatible Types.

Required: android.support.v4.app.Fragment

Found: com.ortegapatriciaa.enventer._7_ViewClient_UpcomingEvents"

Here is my code:

PageAdapter.java

```<code>public class PagerAdapter extends FragmentStatePagerAdapter {
    int mNumOfTabs;

    public PagerAdapter(FragmentManager fm, int NumOfTabs) {
        super(fm);
        this.mNumOfTabs = NumOfTabs;
    }

    @Override
    public Fragment getItem(int position) {

        switch (position) {
            case 0:
                _7_ViewClient_UpcomingEvents tab1 = new _7_ViewClient_UpcomingEvents();
                return tab1;
            case 1:
                _7_ViewClient_MyEvents tab2 = new _7_ViewClient_MyEvents();
                return tab2;
            default:
                return null;
        }
    }

    @Override
    public int getCount() {
        return mNumOfTabs;
    }
}
</code>```

_7_ViewClient_UpcomingEvents.java

```<code>public class _7_ViewClient_UpcomingEvents {

    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return inflater.inflate(R.layout.activity_7_view_client_upcoming_events, container, false);
    }
}
</code>```

答:
This is how your classes should look like :

public class _7_ViewClient_UpcomingEvents extends android.support.v4.app.Fragment

_7_ViewClient_MyEvents extends android.support.v4.app.Fragment

Both the classes should be subclasses Fragment

Also, I would recommend to follow a better naming convention.

Body:
I received an error that says:

Incompatible Types.

Required: android.support.v4.app.Fragment

Found: com.ortegapatriciaa.enventer._7_ViewClient_UpcomingEvents"

Here is my code:

PageAdapter.java

public class PagerAdapter extends FragmentStatePagerAdapter {
    int mNumOfTabs;

    public PagerAdapter(FragmentManager fm, int NumOfTabs) {
        super(fm);
        this.mNumOfTabs = NumOfTabs;
    }

    @Override
    public Fragment getItem(int position) {

        switch (position) {
            case 0:
                _7_ViewClient_UpcomingEvents tab1 = new _7_ViewClient_UpcomingEvents();
                return tab1;
            case 1:
                _7_ViewClient_MyEvents tab2 = new _7_ViewClient_MyEvents();
                return tab2;
            default:
                return null;
        }
    }

    @Override
    public int getCount() {
        return mNumOfTabs;
    }
}

_7_ViewClient_UpcomingEvents.java

public class _7_ViewClient_UpcomingEvents {

    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return inflater.inflate(R.layout.activity_7_view_client_upcoming_events, container, false);
    }
}


问:
How to run USSD code in android
i am using dual sim phone. Now i want to run USSD code by one particular network without selecting the operator to call.

my code:

```<code> String ussdCode = "*" + "123" + Uri.encode("#");
        startActivity(new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + ussdCode)));
</code>```

Response: now it was asking me to select the operator to call the ussd code. I want to run that USSD Code by that particular operator  without asking.

Thank you in advance.

答:
With Samsung devices use the below

```<code>callIntent.putExtra("simSlot", simSlot);
</code>```

where simSlot is integer as 0,1

Title: How to run USSD code in android

Body:
i am using dual sim phone. Now i want to run USSD code by one particular network without selecting the operator to call.

my code:

 String ussdCode = "*" + "123" + Uri.encode("#");
        startActivity(new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + ussdCode)));

Response: now it was asking me to select the operator to call the ussd code. I want to run that USSD Code by that particular operator  without asking.

Thank you in advance.

Body:
With Samsung devices use the below

callIntent.putExtra("simSlot", simSlot);

where simSlot is integer as 0,1


问:
Filter on google sheets minimum across columns
Hi I am trying to do get some data displayed using FILTER function in google sheets.

What i want is the minimum value across 3 columns on 1 row.

Is this possible?

For example:

```<code>A   1   6   10
B   3   5   9
C   4   4   8
D   5   3   7
A   2   1   6
</code>```

Filter on A should give:

```<code>A 1
A 1
</code>```

Filter on B should give:

```<code>B 3
</code>```

I would really like to use filter function but =filter({A:A,min(B:D)},A:A="A") doesn't work.

答:
Maybe, if your three (labelled) columns are A, B and C:

```<code>=filter(A2:C2,A2:C2=min(A2:C2))
</code>```

but in that case filter would be overkill.

Body:
Hi I am trying to do get some data displayed using FILTER function in google sheets.

What i want is the minimum value across 3 columns on 1 row.

Is this possible?

For example:

A   1   6   10
B   3   5   9
C   4   4   8
D   5   3   7
A   2   1   6

Filter on A should give:

A 1
A 1

Filter on B should give:

B 3

I would really like to use filter function but =filter({A:A,min(B:D)},A:A="A") doesn't work.

Body:
Maybe, if your three (labelled) columns are A, B and C:

=filter(A2:C2,A2:C2=min(A2:C2))

but in that case filter would be overkill.


问:
I can't see my texture on maya
I have UV mapped the object, And added a texture material, But i can't see the texture.

Error image

答: If you press the hotkey 6 ( or 5), it will activate the "Show Texture Mode" in Maya. This will enable the textures in the view port. </p>

Title: I can't see my texture on maya


问:
cant run my spider trough scrapy cloud with php curl
i can't get it to connect my php to my spiders

```<code>$url = 'https://app.scrapinghub.com/api/jobs/list.json';
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_FOLLOWLOCATION => 1,
CURLOPT_HEADER => 1,
CURLOPT_URL => $url,

CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => array(
    'project' => 'projecid',
    'spider' => 'spiderid',
),

CURLOPT_USERPWD => "apikey")

);
$response = curl_exec($ch);
curl_close($ch);

echo '```';
print $response;
echo '```';
</code>```

it returns:

```<code>HTTP/1.1 100 Continue

HTTP/1.1 400 method not allowed
Server: nginx/1.10.1
Date: Fri, 07 Jul 2017 07:24:02 GMT
Content-Type: application/json
Content-Length: 57
Connection: keep-alive
Vary: Cookie
Set-Cookie: csrftoken2=67xgaAQB9ytsIYNxseDFAIUzkCivPZMda74Hvg7UNMp6iD3zALRDWP6zhknxiEIP; Domain=.scrapinghub.com; expires=Fri, 06-Jul-2018 07:24:02 GMT; Max-Age=31449600; Path=/; Secure
X-Upstream: dash-master_apiv1

{"status": "badrequest", "message": "method not allowed"}
</code>```

it says bad request means i am wrong with my url  but in the docs it said it should be like these or i am wrong on sending my apikey.

please help me here thanks.

答:
You are sending a POST request to scrapinghub which is the message of your badrequest status as method not allowed. instead you can try sending a GET request through PHP curl like so

```<code>$url = 'https://app.scrapinghub.com/api/jobs/list.json';
$ch = curl_init();
$curl_opts = array(
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_FOLLOWLOCATION => 1,
    CURLOPT_HEADER => 1,
    CURLOPT_URL => $url."?project=projectid&spider=spiderid",
    CURLOPT_USERPWD => "apikey"
);
curl_setopt_array($ch, $curl_opts);
$response = curl_exec($ch);
curl_close($ch);

echo '```';
print $response;
echo '```';
</code>```

Body:
i can't get it to connect my php to my spiders

$url = 'https://app.scrapinghub.com/api/jobs/list.json';
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_FOLLOWLOCATION => 1,
CURLOPT_HEADER => 1,
CURLOPT_URL => $url,

CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => array(
    'project' => 'projecid',
    'spider' => 'spiderid',
),

CURLOPT_USERPWD => "apikey")

);
$response = curl_exec($ch);
curl_close($ch);

echo '
';
print $response;
echo '
';

it returns:

HTTP/1.1 100 Continue

HTTP/1.1 400 method not allowed
Server: nginx/1.10.1
Date: Fri, 07 Jul 2017 07:24:02 GMT
Content-Type: application/json
Content-Length: 57
Connection: keep-alive
Vary: Cookie
Set-Cookie: csrftoken2=67xgaAQB9ytsIYNxseDFAIUzkCivPZMda74Hvg7UNMp6iD3zALRDWP6zhknxiEIP; Domain=.scrapinghub.com; expires=Fri, 06-Jul-2018 07:24:02 GMT; Max-Age=31449600; Path=/; Secure
X-Upstream: dash-master_apiv1

{"status": "badrequest", "message": "method not allowed"}

it says bad request means i am wrong with my url  but in the docs it said it should be like these or i am wrong on sending my apikey.

please help me here thanks.

Body:
You are sending a POST request to scrapinghub which is the message of your badrequest status as method not allowed. instead you can try sending a GET request through PHP curl like so

$url = 'https://app.scrapinghub.com/api/jobs/list.json';
$ch = curl_init();
$curl_opts = array(
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_FOLLOWLOCATION => 1,
    CURLOPT_HEADER => 1,
    CURLOPT_URL => $url."?project=projectid&spider=spiderid",
    CURLOPT_USERPWD => "apikey"
);
curl_setopt_array($ch, $curl_opts);
$response = curl_exec($ch);
curl_close($ch);

echo '<pre>';
print $response;
echo '</pre>';


问:
indexes Message.getFrom () and its function
I am looking for the indexes of the
Javax. Message.getFrom () and its function

that is to say

GetFrom [0] = return address

GetFrom [1] = .....

And others or something that tells me how to work with the returning array

Regards

答:
Finaly I found a answer.

The headers doesn't come in the same order or qantity.
In facts in one mail, can come more then one Received header, for example.

This is a kind of dificult thing


答:
Add vertical-align:middle to .dataTables_wrapper .dataTables_paginate .paginate_button

or use flexbox for paginate

```<code>.dataTables_wrapper .dataTables_paginate {
  display:flex;
  flex-direction:row;
  align-items:center;
}
</code>```

Title: How to align elements in CSS

Body:
Add vertical-align:middle to .dataTables_wrapper .dataTables_paginate .paginate_button

or use flexbox for paginate

.dataTables_wrapper .dataTables_paginate {
  display:flex;
  flex-direction:row;
  align-items:center;
}


问:
Understanding map in Scala
Please help me understand what map(_(0)) means here:</p>

```<code>scala> a.collect
res97: Array[org.apache.spark.sql.Row] = Array([1039], [1010], [1002], [926])

scala> a.collect.map(_(0))
res98: Array[Any] = Array(1039, 1010, 1002, 926)
</code>```

答:
You are accessing the zeroth element of the items in the collection a. _ is a common placeholder in Scala when working with the items in a collection.

More concretely, your code is equivalent to

```<code>a.collect.map(item => item(0))
</code>```

Title: Understanding map in Scala

Body:
Please help me understand what map(_(0)) means here:

scala> a.collect
res97: Array[org.apache.spark.sql.Row] = Array([1039], [1010], [1002], [926])

scala> a.collect.map(_(0))
res98: Array[Any] = Array(1039, 1010, 1002, 926)

Body:
You are accessing the zeroth element of the items in the collection a. _ is a common placeholder in Scala when working with the items in a collection.

More concretely, your code is equivalent to

a.collect.map(item => item(0))


问:
WP Bootstrap Navwalker collapse not working
I can't seem to make the collapse work on my menu using WP Bootstrap Navwalker.

Below is my code :

```<code><div class="blog-masthead">
  <div class="container">
    <nav class="blog-nav" role="navigation">
      <div class="container-fluid">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
        </div>
      </div>
      <?php
       wp_nav_menu( array(
           'menu'              => 'primary',
           'theme_location'    => 'primary',
           'depth'             => 2,
           'container'         => 'div',
           'container_class'   => 'collapse navbar-collapse',
           'container_id'      => 'bs-example-navbar-collapse-1',
           'menu_class'        => 'nav navbar-nav',
           'fallback_cb'       => 'wp_bootstrap_navwalker::fallback',
           'walker'            => new WP_Bootstrap_Navwalker())
       );
      ?>
    </nav>
  </div>
</div>
</code>```

And below is what I defined in my functions.php :

```<code>require_once('WP_Bootstrap_Navwalker.php');

function wpb_theme_setup(){
// Nav Menus
register_nav_menus(array(
'primary' => __( 'Primary Menu' )
));
}
</code>```

And my bootstrap.min.js :

```<code><script src="<?php bloginfo('template_url'); ?>/js/bootstrap.min.js"></script>
</code>```

Can anybody point out where I got it wrong? Thank you so much in advance!

Best regards,
Peter

答: I was able to solve this issue when I changed WP_Bootstrap_Navwalker ()) and WP_Bootstrap_Navwalker.php to all lower case letters.</p>

Body:
I can't seem to make the collapse work on my menu using WP Bootstrap Navwalker.

Below is my code :

          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
            Toggle navigation

          </button>

      <?php
       wp_nav_menu( array(
           'menu'              => 'primary',
           'theme_location'    => 'primary',
           'depth'             => 2,
           'container'         => 'div',
           'container_class'   => 'collapse navbar-collapse',
           'container_id'      => 'bs-example-navbar-collapse-1',
           'menu_class'        => 'nav navbar-nav',
           'fallback_cb'       => 'wp_bootstrap_navwalker::fallback',
           'walker'            => new WP_Bootstrap_Navwalker())
       );
      ?>

And below is what I defined in my functions.php :

require_once('WP_Bootstrap_Navwalker.php');

function wpb_theme_setup(){
// Nav Menus
register_nav_menus(array(
'primary' => __( 'Primary Menu' )
));
}

And my bootstrap.min.js :

Can anybody point out where I got it wrong? Thank you so much in advance!

Best regards,
Peter

ContentLicense: CC BY-SA 4.0


问:
Switch line placements in bash
is it possible to switch the placement of lines in bash given some string in the lines with sed?

For example:

I have the lines

```<code>2. diskusage1: 27.0572519084
3. partition1:
</code>```

which are both output as part of a bash command to a text file.

Is there a way to reverse the order of these lines? To have them switch places to look like:

```<code>3. partition1:
2. diskusage1: 27.0572519084
</code>```

Thanks

答:
Continuing from the comments, yes, you can easily reverse the lines of output using either tac (cat in reverse order) or sed. In both cases you simply pipe the output of whatever command you are running to tac or sed. If you need to write the reversed contents to a file, then simply add a redirection to the end (e.g. > file.txt)

Using tac it is simply

```<code>some_command | tac > file.txt
</code>```

Using sed it would be:

```<code>some_command | sed -n '1!G;h;$p' > file.txt
</code>```

Example

Your output:

```<code>$ printf "2. diskusage1: 27.0572519084\n3. partition1:\n"
2. diskusage1: 27.0572519084
3. partition1:
</code>```

Reversed output

```<code>$ printf "2. diskusage1: 27.0572519084\n3. partition1:\n" | tac
3. partition1:
2. diskusage1: 27.0572519084
</code>```

or

```<code>$ printf "2. diskusage1: 27.0572519084\n3. partition1:\n" | sed -n '1!G;h;$p'
3. partition1:
2. diskusage1: 27.0572519084
</code>```

Give them a try and let me know if you have further questions.

Title: Switch line placements in bash

Body:
is it possible to switch the placement of lines in bash given some string in the lines with sed?

For example:

I have the lines

2. diskusage1: 27.0572519084
3. partition1:

which are both output as part of a bash command to a text file.

Is there a way to reverse the order of these lines? To have them switch places to look like:

3. partition1:
2. diskusage1: 27.0572519084

Thanks

Body:
Continuing from the comments, yes, you can easily reverse the lines of output using either tac (cat in reverse order) or sed. In both cases you simply pipe the output of whatever command you are running to tac or sed. If you need to write the reversed contents to a file, then simply add a redirection to the end (e.g. > file.txt)

Using tac it is simply

some_command | tac > file.txt

Using sed it would be:

some_command | sed -n '1!G;h;$p' > file.txt

Example

Your output:

$ printf "2. diskusage1: 27.0572519084\n3. partition1:\n"
2. diskusage1: 27.0572519084
3. partition1:

Reversed output

$ printf "2. diskusage1: 27.0572519084\n3. partition1:\n" | tac
3. partition1:
2. diskusage1: 27.0572519084

or

$ printf "2. diskusage1: 27.0572519084\n3. partition1:\n" | sed -n '1!G;h;$p'
3. partition1:
2. diskusage1: 27.0572519084

Give them a try and let me know if you have further questions.


问:
DatePicker setEditable to false still allows for clicking of Calendar
I am currently trying to setEditable for a DatePicker to false so the value cannot be changed. Using the following only disables the text field, but still allows the changing of the date by clicking on the calendar button (the setEditable is for permissions, so I can enable/disable depending on the login):

```<code>exampleDatePicker.setEditable(user.getGroup().equals(admin));
</code>```

Is there a way to disable the Calendar button on the DatePicker? I don't want to use setDisable, as I still want the field to be readable, and I can't change the CSS for disabled because I have other DatePickers that get disabled that I want greyed out.

答:
```<code>datePicker.setEditable(false);

datePicker.setOnMouseClicked(e -> {
        if(!datePicker.isEditable())
            datePicker.hide();
    });
</code>```

Body:
I am currently trying to setEditable for a DatePicker to false so the value cannot be changed. Using the following only disables the text field, but still allows the changing of the date by clicking on the calendar button (the setEditable is for permissions, so I can enable/disable depending on the login):

exampleDatePicker.setEditable(user.getGroup().equals(admin));

Is there a way to disable the Calendar button on the DatePicker? I don't want to use setDisable, as I still want the field to be readable, and I can't change the CSS for disabled because I have other DatePickers that get disabled that I want greyed out.


答:
Just give your dataTables block such styles:</p>

```<code>    .dataTable-block {`dispaly: flex;align-items: center;}
</code>```

Title: How to align elements in CSS

Body:
I am unable to align the elements in one line. I am using display: inline-block but for some reason it is not taking the affect. I am using DataTables.I want the buttons (images) to be aligned with the box showing the page number.

CSS

.dataTables_paginate input {
 width: 8%;
 height: 8%;
 padding-bottom: 0.2px;
 display: inline-block;
 font: normal 11px Verdana, Arial, Helvetica, sans-serif;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
 box-sizing: border-box;
 display: inline-block;
 min-width: 1.5em;
 padding: 0.5em 1em;
 margin-left: 2px;
 text-align: center;
 text-decoration: none !important;
 cursor: pointer;
 *cursor: hand;
 color: #333 !important;
 border: 1px solid transparent;
border-radius: 2px;
}

My Jquery

var table = $('#esignTable').DataTable({"sDom": '<"top"flp>rt<"bottom"i><"clear">',
      pagingType: 'input',
      pageLength: 5,
      language: {
        "sEmptyTable": " ",
        oPaginate: {
            "sNext": '',
            "sPrevious": '',
            "sFirst": '',
            "sLast": '',
        }
      }
    });

Body:
Just give your dataTables block such styles:

    .dataTable-block {`dispaly: flex;align-items: center;}


问:
Modify React Element From React Class
Live Preview: https://www.webpackbin.com/bins/-KoSqF5OB0IRtbBEi822

Im trying to Clone and Modify a React Element Object.

I'm removing the inline styles of react element by cloning and adding css rules to stylesheet

Im using this function

I want to know how can i access the React Render function return value from the Element's Class ?

```<code>const Div = () => (<div></div>); // not working
const Div = (<div></div>); // working

const NewDiv = noInline(Div); // calling function
</code>```

答:
I believe to do it you need to get a reference to the element in the render function, and that element should be one of the component child elements — so traverse this.props.children and find the element you are looking for. Something like this:

```<code>render () {
  let children = React.Children.toArray(this.props.children);
  children.forEach((child) => doSomething(child))
}
</code>```

Title: Modify React Element From React Class

Body:
Live Preview: https://www.webpackbin.com/bins/-KoSqF5OB0IRtbBEi822

Im trying to Clone and Modify a React Element Object.

I'm removing the inline styles of react element by cloning and adding css rules to stylesheet

Im using this function

I want to know how can i access the React Render function return value from the Element's Class ?

const Div = () => (

); // not working
const Div = (

); // working

const NewDiv = noInline(Div); // calling function

Body:
I believe to do it you need to get a reference to the element in the render function, and that element should be one of the component child elements — so traverse this.props.children and find the element you are looking for. Something like this:

render () {
  let children = React.Children.toArray(this.props.children);
  children.forEach((child) => doSomething(child))
}


问:
Does the new Microsoft Lync 2010 Client API work in non-IE browsers?
I'm writing a Silverlight app that uses the Lync 2010 Client API to communicate with the Lync 2010 Client. Works fine in Internet Explorer, but in Chrome/Firefox i get this:

Microsoft.Lync.Model.UnsupportedBrowserException:
  Browser doesn't support ActiveX
         at Microsoft.Lync.Model.LyncClient.HandleJavascriptException(String
  error)
         at Microsoft.Lync.Model.LyncClient.EnsureOfficeIntegration()
         at Microsoft.Lync.Model.LyncClient.GetClient()
         at LyncSilverlightApplication2.Page.button1_Click(Object
  sender, RoutedEventArgs a)

The documentation hints that the API might only work in IE: "Internet Explorer 7 and Internet Explorer 8 currently support Lync Controls." This statement doesn't really exclude other browsers and the API could be independent from the controls. But still.

So; Does the new Microsoft Lync 2010 Client API work in non-IE browsers?

答:
Unfortunately, no - the Lync API will only work in ActiveX enabled browsers - the Silverlight controls use ActiveX under the hood to talk to Lync.

The recommended way to achieve cross-broswer functionality is to create a back-end service using UCMA 3.0, and expose this to your web pages over e.g. WCF.

See mine and George Durzi's answers to this question for a bit more info.


问:
Why doesn't the additive constant in Big-O notation matter?
In definition of Big-O notation we care only about C coefficient:

```<code>f(n) ≤ Cg(n) for all n ≥ k
</code>```

Why don't we care about A as well:

```<code>f(n) ≤ Cg(n) + A for all n ≥ k
</code>```

答:
Big-O notation is about what happens as the data gets larger. In other words, it is a limit as n --> infinity.

As n gets large, A remains the same. So it gets smaller and smaller in comparison. On the other hand, g(n) (presumably) gets bigger and bigger, so its contribution increases more and more.

Body:
In definition of Big-O notation we care only about C coefficient:

f(n) ≤ Cg(n) for all n ≥ k

Why don't we care about A as well:

f(n) ≤ Cg(n) + A for all n ≥ k


问:
PL SQL - Convert timestamp to datetime/date
```<code>select
to_timestamp(SCHEDULED_TIME,'YYYY-MM-DD HH24:MI:SS.FF') as SCHEDULED_TIME,
TRUNC(to_date(to_timestamp(SCHEDULED_TIME,'YYYY-MM-DD HH24:MI:SS.FF'),'YYYY-MM-DD HH24:MI:SS'))
from S_TIDAL_STATUS
</code>```

The error was:
ORA-01830: date format picture ends before converting entire input string
01830. 00000 -  "date format picture ends before converting entire input string"

The goal is to return something like

2017-07-91 23:14:00
(without the content after the dot).

Here's what the SCHEDULED_TIME (timestamp) looked like:

答:
This should do the trick:

```<code>select
to_char(SCHEDULED_TIME,'YYYY-MM-DD HH24:MI:SS.FF') as time_to_csecs,
to_char(SCHEDULED_TIME,'YYYY-MM-DD HH24:MI:SS') as time_to_secs,
TRUNC(to_date(to_char(SCHEDULED_TIME,'YYYY-MM-DD HH24:MI:SS'),'YYYY-MM-DD HH24:MI:SS')) as time_to_day
from S_TIDAL_STATUS
</code>```

Please review the docs to see the difference between to_timestamp and to_char.

Body:
select
to_timestamp(SCHEDULED_TIME,'YYYY-MM-DD HH24:MI:SS.FF') as SCHEDULED_TIME,
TRUNC(to_date(to_timestamp(SCHEDULED_TIME,'YYYY-MM-DD HH24:MI:SS.FF'),'YYYY-MM-DD HH24:MI:SS'))
from S_TIDAL_STATUS

The error was:
ORA-01830: date format picture ends before converting entire input string
01830. 00000 -  "date format picture ends before converting entire input string"

The goal is to return something like

2017-07-91 23:14:00
(without the content after the dot).

Here's what the SCHEDULED_TIME (timestamp) looked like:

Body:
This should do the trick:

select
to_char(SCHEDULED_TIME,'YYYY-MM-DD HH24:MI:SS.FF') as time_to_csecs,
to_char(SCHEDULED_TIME,'YYYY-MM-DD HH24:MI:SS') as time_to_secs,
TRUNC(to_date(to_char(SCHEDULED_TIME,'YYYY-MM-DD HH24:MI:SS'),'YYYY-MM-DD HH24:MI:SS')) as time_to_day
from S_TIDAL_STATUS

Please review the docs to see the difference between to_timestamp and to_char.


问:
Spark dataframe from String to UUID
While trying to move data from S3 to Mongo via spark-mongo connector and using SparkSQL for transformations, I'm getting stuck with having to transform a column from string to UUID. The column is stored as string in S3 and Im looking for the appropriate transformation function to call out to store it as UUID while saving to Mongo.

Tried using udf but not able to read the specific column from data frame and convert a string value into uuid. Any advice on how to write a spark udf ?

Sample Input from S3 file : key1 string, key2 string, key2_type int

Expected output into Mongo : key1 UUID, key2 string, key2_type int

Currently we use SparkSQL transformation reading from S3 saving into Mongo

sourceMap = sourceMap ++ jsonObjectPropertiesToMap(List("s3path", "fileformat", "awsaccesskeyid", "awssecretaccesskey"), source)
            sparkSession.sparkContext.hadoopConfiguration.set("mapreduce.input.fileinputformat.input.dir.recursive" , "true")
            setAWSCredentials (sparkSession, sourceMap);
            df = s3ToDataFrame(sourceMap("s3path"), sourceMap("fileformat"), sparkSession)

val dft = sparkSession.sql(mappingsToTransformedSQL(mappings))

destinationMap = destinationMap ++ jsonObjectPropertiesToMap(List("cluster", "database", "authenticationdatabase","collection", "login", "password"), destination)
            dataFrameToMongodb(destinationMap("cluster"), destinationMap("database"), destinationMap("authenticationdatabase"),destinationMap("collection"),destinationMap("login"),destinationMap("password"), dft)```
</div>
</div>
</p>

<p>Here is the function as recommended below for stringtoUUID</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>def stringToUUID(uuid : String):String = {
          java.util.UUID.fromString(
            uuid
              .replaceFirst(
                "(\\p{XDigit}{8})(\\p{XDigit}{4})(\\p{XDigit}{4})(\\p{XDigit}{4})(\\p{XDigit}+)", "$1-$2-$3-$4-$5"
              )
          ).toString
        }

        val stringToUUIDUdf = udf((uuid: String) => stringToUUID(uuid))

        dft.withColumn("key1", stringToUUIDUdf(df("key1")))</code>```

Here is the error we get

17/07/01 17:51:05 INFO SparkSqlParser: Parsing command: Select key1 AS key1,key1_type_id AS key1_type_id,key2 AS key2,key2_type_id AS key2_type_id,site AS site,updated AS updated FROM tmp
org.apache.spark.sql.AnalysisException: resolved attribute(s) key1#1 missing from key2#19,updated#22,site#21,key1#17,key1_type_id#18,key2_type_id#20 in operator !Project [UDF(key1#1) AS key1#30, key1_type_id#18, key2#19, key2_type_id#20, site#21, updated#22];;
!Project [UDF(key1#1) AS key1#30, key1_type_id#18, key2#19, key2_type_id#20, site#21, updated#22]
+- Project [key1#1 AS key1#17, key1_type_id#2 AS key1_type_id#18, key2#3 AS key2#19, key2_type_id#4 AS key2_type_id#20, site#5 AS site#21, updated#6 AS updated#22]
   +- SubqueryAlias tmp, `tmp`
      +- Relation[key1#1,key1_type_id#2,key2#3,key2_type_id#4,site#5,updated#6,pdateid#7] parquet```

答:
Use the below logic to get it working.

Dependency :

```<code>   <dependency>
        <groupId>org.mongodb</groupId>
        <artifactId>bson</artifactId>
        <version>3.4.2</version>
    </dependency>
</code>```

Function:

```<code>def test(uuids : String): Binary ={
val uuid = UUID.fromString(uuids)
val holder = new BsonDocument
val writer = new BsonDocumentWriter(holder)
writer.writeStartDocument()
writer.writeName("uuid")
new UuidCodec(UuidRepresentation.STANDARD).encode(writer, uuid,
EncoderContext.builder().build())
writer.writeEndDocument()
val bsonBinary = holder.getBinary("uuid");
val test2=  new Binary(bsonBinary.getType(), bsonBinary.getData());
return test2
</code>```

}

Title: Spark dataframe from String to UUID

Body:
While trying to move data from S3 to Mongo via spark-mongo connector and using SparkSQL for transformations, I'm getting stuck with having to transform a column from string to UUID. The column is stored as string in S3 and Im looking for the appropriate transformation function to call out to store it as UUID while saving to Mongo.

Tried using udf but not able to read the specific column from data frame and convert a string value into uuid. Any advice on how to write a spark udf ?

Sample Input from S3 file : key1 string, key2 string, key2_type int

Expected output into Mongo : key1 UUID, key2 string, key2_type int

Currently we use SparkSQL transformation reading from S3 saving into Mongo

sourceMap = sourceMap ++ jsonObjectPropertiesToMap(List("s3path", "fileformat", "awsaccesskeyid", "awssecretaccesskey"), source)
            sparkSession.sparkContext.hadoopConfiguration.set("mapreduce.input.fileinputformat.input.dir.recursive" , "true")
            setAWSCredentials (sparkSession, sourceMap);
            df = s3ToDataFrame(sourceMap("s3path"), sourceMap("fileformat"), sparkSession)

val dft = sparkSession.sql(mappingsToTransformedSQL(mappings))

destinationMap = destinationMap ++ jsonObjectPropertiesToMap(List("cluster", "database", "authenticationdatabase","collection", "login", "password"), destination)
            dataFrameToMongodb(destinationMap("cluster"), destinationMap("database"), destinationMap("authenticationdatabase"),destinationMap("collection"),destinationMap("login"),destinationMap("password"), dft)

Here is the function as recommended below for stringtoUUID

def stringToUUID(uuid : String):String = {
          java.util.UUID.fromString(
            uuid
              .replaceFirst(
                "(\\p{XDigit}{8})(\\p{XDigit}{4})(\\p{XDigit}{4})(\\p{XDigit}{4})(\\p{XDigit}+)", "$1-$2-$3-$4-$5"
              )
          ).toString
        }

        val stringToUUIDUdf = udf((uuid: String) => stringToUUID(uuid))

        dft.withColumn("key1", stringToUUIDUdf(df("key1")))

Here is the error we get

17/07/01 17:51:05 INFO SparkSqlParser: Parsing command: Select key1 AS key1,key1_type_id AS key1_type_id,key2 AS key2,key2_type_id AS key2_type_id,site AS site,updated AS updated FROM tmp
org.apache.spark.sql.AnalysisException: resolved attribute(s) key1#1 missing from key2#19,updated#22,site#21,key1#17,key1_type_id#18,key2_type_id#20 in operator !Project [UDF(key1#1) AS key1#30, key1_type_id#18, key2#19, key2_type_id#20, site#21, updated#22];;
!Project [UDF(key1#1) AS key1#30, key1_type_id#18, key2#19, key2_type_id#20, site#21, updated#22]
+- Project [key1#1 AS key1#17, key1_type_id#2 AS key1_type_id#18, key2#3 AS key2#19, key2_type_id#4 AS key2_type_id#20, site#5 AS site#21, updated#6 AS updated#22]
   +- SubqueryAlias tmp, `tmp`
      +- Relation[key1#1,key1_type_id#2,key2#3,key2_type_id#4,site#5,updated#6,pdateid#7] parquet

Body:
Use the below logic to get it working.

Dependency :

   <dependency>
        <groupId>org.mongodb</groupId>
        <artifactId>bson</artifactId>
        <version>3.4.2</version>
    </dependency>

Function:

def test(uuids : String): Binary ={
val uuid = UUID.fromString(uuids)
val holder = new BsonDocument
val writer = new BsonDocumentWriter(holder)
writer.writeStartDocument()
writer.writeName("uuid")
new UuidCodec(UuidRepresentation.STANDARD).encode(writer, uuid,
EncoderContext.builder().build())
writer.writeEndDocument()
val bsonBinary = holder.getBinary("uuid");
val test2=  new Binary(bsonBinary.getType(), bsonBinary.getData());
return test2

}


问:
How do I fix certificate errors when running wget on an HTTPS URL on Windows?
I'm trying to use Wget for Windows to download a document from a specific URL.

When I do this, for many (but not all) websites, I get a certificate error.  For example:

```<code>C:\temp> wget https://stackoverflow.com/
</code>```

Produces:

```<code>--2017-07-07 15:54:40--  https://stackoverflow.com/
Resolving stackoverflow.com (stackoverflow.com)... 151.101.193.69, 151.101.129.69, 151.101.1.69, ...
Connecting to stackoverflow.com (stackoverflow.com)|151.101.193.69|:443... connected.
ERROR: cannot verify stackoverflow.com's certificate, issued by 'CN=DigiCert SHA2 High Assurance Server CA,OU=www.digicert.com,O=DigiCert Inc,C=US':
  Unable to locally verify the issuer's authority.
To connect to stackoverflow.com insecurely, use `--no-check-certificate'.
</code>```

As the error message suggests, I can work around the problem by including the --no-check-certificate parameter with my command.  However, I'd like to avoid that because it is (1) insecure, and (2) a hassle.

As you might expect, I can connect to https://stackoverflow.com/ (and other affected URLs) with no problems using any of the web browsers I have on this PC (Firefox, Chrome, Edge, IE, Vivaldi).

I'm not running Cygwin (so answers to this similar question don't apply).

Is there a way I can configure Wget for Windows to use the same set of root certificates that my OS and/or browsers use, such that it doesn't produce the "Unable to locally verify the issuer's authority" error?

答:
The version of Wget for Windows (wget.exe) that I had been using was from http://gnuwin32.sourceforge.net/packages/wget.htm, with version number 1.11.4 and dated 2008-12-31.

I just replaced that with a newer version from https://eternallybored.org/misc/wget/, with version number 1.19.1, and which mentions "Windows certificate store support."

Using that newer version, I no longer get the Unable to locally verify the issuer's authority error, and downloads appear to work securely and fine.

Body:
I'm trying to use Wget for Windows to download a document from a specific URL.

When I do this, for many (but not all) websites, I get a certificate error.  For example:

C:\temp> wget https://stackoverflow.com/

Produces:

--2017-07-07 15:54:40--  https://stackoverflow.com/
Resolving stackoverflow.com (stackoverflow.com)... 151.101.193.69, 151.101.129.69, 151.101.1.69, ...
Connecting to stackoverflow.com (stackoverflow.com)|151.101.193.69|:443... connected.
ERROR: cannot verify stackoverflow.com's certificate, issued by 'CN=DigiCert SHA2 High Assurance Server CA,OU=www.digicert.com,O=DigiCert Inc,C=US':
  Unable to locally verify the issuer's authority.
To connect to stackoverflow.com insecurely, use `--no-check-certificate'.

As the error message suggests, I can work around the problem by including the --no-check-certificate parameter with my command.  However, I'd like to avoid that because it is (1) insecure, and (2) a hassle.

As you might expect, I can connect to https://stackoverflow.com/ (and other affected URLs) with no problems using any of the web browsers I have on this PC (Firefox, Chrome, Edge, IE, Vivaldi).

I'm not running Cygwin (so answers to this similar question don't apply).

Is there a way I can configure Wget for Windows to use the same set of root certificates that my OS and/or browsers use, such that it doesn't produce the "Unable to locally verify the issuer's authority" error?


问:
How do I remove a Vagrant box from global-status, after deleting that box from the filesystem?
I deleted a folder containing a running Vagrant box before realising it was still running.

How can I delete it from Vagrant (global-status) now?

I already removed the Virtualbox VM.

答:
First you use vagrant global-status to list all the vagrant machines and their status and ids.

then you can use:

```<code> vagrant destroy -f the_id_of_the_machine
</code>```

after that if you run vagrant global-status again you will find that the id you have specified in the vagrant destroy -f command has been removed from the list.

and then you might need to restart your machine However these commands will not affect your boxes.

Body:
First you use vagrant global-status to list all the vagrant machines and their status and ids.

then you can use:

 vagrant destroy -f the_id_of_the_machine

after that if you run vagrant global-status again you will find that the id you have specified in the vagrant destroy -f command has been removed from the list.

and then you might need to restart your machine However these commands will not affect your boxes.


问:
min and max in multidimensional-array
hi i am trying to find min and max values of x and y how can i find this min and max functions is not working correctly</p>

```<code>$dataPoints = array(
 array('x' => 2343, 'y' => 4322),
  array('x' => 103, 'y' => 303 ),
  array('x' => 2345,'y' => 2321 ),
  array('x' => 310, 'y' => 2044 ),
  array('x' => 173, 'y' => 793 ),
  array('x' => 456, 'y' => 2675),
  array('x' => 24, 'y' => 819 ));
</code>```

答:
Sample code to built your required answer

```<code>foreach($dataPoints[0]['x'] as $x_val)
{
//write max min func for x values
}

foreach($dataPoints[0]['y'] as $y_val)
{
//write max min func for y values
}
</code>```

Title: min and max in multidimensional-array

Body:
hi i am trying to find min and max values of x and y how can i find this min and max functions is not working correctly

$dataPoints = array(
 array('x' => 2343, 'y' => 4322),
  array('x' => 103, 'y' => 303 ),
  array('x' => 2345,'y' => 2321 ),
  array('x' => 310, 'y' => 2044 ),
  array('x' => 173, 'y' => 793 ),
  array('x' => 456, 'y' => 2675),
  array('x' => 24, 'y' => 819 ));

Body:
Sample code to built your required answer

foreach($dataPoints[0]['x'] as $x_val)
{
//write max min func for x values
}

foreach($dataPoints[0]['y'] as $y_val)
{
//write max min func for y values
}


问:
Error in javascript KeyListener
I have the error: index.html:12 Uncaught TypeError: Cannot read property 'addEventListener' of null
Not sure what went wrong? The code is suppose to store the result of the radio button selected into an array. But the function does not even run because it is null.

```<code><!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Video Test</title>
    <script>
      var arr = [];
      document.getElementById("continue").addEventListener("click", function() {
          var cbChecked = document.querySelectorAll('[name="white"]:checked')
          if (cbChecked != null) {
            arr.push(cbChecked.value)
          }
          console.log(arr)
      })
    </script>
  </head>
  <body>
    <div id="container">
      <div id="overlay">
        <form action="">
          <input type="radio" name="white" value="1" id="radio1"/>
          <input type="radio" name="white" value="2" id="radio2"/>
          <input type="radio" name="white" value="3" id="radio3"/>
          <input type="radio" name="white" value="4" id="radio4"/>
          <input type="button" id="continue" value="Continue"/>
        </form>
      </div>
      <div id="base">
        <video controls>
          <source src="videos/event_0_Junli_Standing_20150322_181647_00_0.6.mp4" type="video/mp4">
          Your browser does not support the video tag.
        </video>
      </div>
    </div>
  </body>
</html>
</code>```

答:
querySelectorAll returns an array of objects, not a single object.

var arr = [];
      document.getElementById("continue").addEventListener("click", function() {
          var radios = document.querySelectorAll('input:checked')
          if (radios.length > 0) {
            arr.push(radios[0].value)
          }
          console.log(arr)
      })```
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Video Test</title>
    <script>

    </script>
  </head>
  <body>
    <div id="container">
      <div id="overlay">
        <form action="">
          <input type="radio" name="white" value="1" id="radio1"/>
          <input type="radio" name="white" value="2" id="radio2"/>
          <input type="radio" name="white" value="3" id="radio3"/>
          <input type="radio" name="white" value="4" id="radio4"/>
          <input type="button" id="continue" value="Continue"/>
        </form>
      </div>
      <div id="base">
        <video controls>
          <source src="videos/event_0_Junli_Standing_20150322_181647_00_0.6.mp4" type="video/mp4">
          Your browser does not support the video tag.
        </video>
      </div>
    </div>
  </body>
</html></code>```

Title: Error in javascript KeyListener

Body:
I have the error: index.html:12 Uncaught TypeError: Cannot read property 'addEventListener' of null
Not sure what went wrong? The code is suppose to store the result of the radio button selected into an array. But the function does not even run because it is null.

<!DOCTYPE html>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Video Test</title>

        <form action="">
          <input type="radio" name="white" value="1" id="radio1"/>
          <input type="radio" name="white" value="2" id="radio2"/>
          <input type="radio" name="white" value="3" id="radio3"/>
          <input type="radio" name="white" value="4" id="radio4"/>
          <input type="button" id="continue" value="Continue"/>
        </form>

        <video controls>
          <source src="videos/event_0_Junli_Standing_20150322_181647_00_0.6.mp4" type="video/mp4">
          Your browser does not support the video tag.
        </video>

Body:
querySelectorAll returns an array of objects, not a single object.

var arr = [];
      document.getElementById("continue").addEventListener("click", function() {
          var radios = document.querySelectorAll('input:checked')
          if (radios.length > 0) {
            arr.push(radios[0].value)
          }
          console.log(arr)
      })

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Video Test</title>
    <script>

    </script>
  </head>
  <body>
    <div id="container">
      <div id="overlay">
        <form action="">
          <input type="radio" name="white" value="1" id="radio1"/>
          <input type="radio" name="white" value="2" id="radio2"/>
          <input type="radio" name="white" value="3" id="radio3"/>
          <input type="radio" name="white" value="4" id="radio4"/>
          <input type="button" id="continue" value="Continue"/>
        </form>
      </div>
      <div id="base">
        <video controls>
          <source src="videos/event_0_Junli_Standing_20150322_181647_00_0.6.mp4" type="video/mp4">
          Your browser does not support the video tag.
        </video>
      </div>
    </div>
  </body>
</html>


问:
How to blend CMMI and Scrum?
I work in a shop that is certified at CMMI level 5.  This certification is important because it gives us access to certain customers and contracts.  I'm looking at how to blend Scrum with CMMI.  I've found some info on mixing Scrum with CMMI-3, but quite a bit of it is "hand wavy" and wouldn't hold up to intense scrutiny.  Specifically, the organizational KPAs seem challenging.

What experiences have you had (good and bad) mixing the two processes?

答: In addition to the previously mentioned documents, I found another one: Agile Methods and CMMI: Compatibility or Conflict? The emphasis of this paper is on Extreme Programming (XP) and how its methods can be applied within an organization attempting to remain compliant with the CMMI framework. Although it isn't Scrum, it might be an interesting read.</p>

OwnerDisplayName: Mike Post

Title: How to blend CMMI and Scrum?


问:
When I update an attribute programatically, it doesn't reflect on admin. Why?
I have an attribute post_to_amazon that can be set to Yes or No on the product.

This is my code:

```<code>require_once('../app/Mage.php');
Mage::app();

$_product   = Mage::getModel('catalog/product')->load("83061");
echo $_product->getPostToAmazon();
$_product->setData("post_to_amazon", "11063");
$_product->save();
</code>```

The echo prints 11063 which is the value for Yes but i'm not seeing Yes selected for the dropdown on admin.

Why isn't the dropdown showing Yes when the echo is showing 11063?

Here are the settings for my attibute. I'm using Magento 1.9.

答:
Try with this code hope this might useful to you.    </p>

```<code>require_once('../app/Mage.php');
Mage::app();

$_product   = Mage::getModel('catalog/product')->load("83061");
echo $_product->getPostToAmazon();
$attrCode = 'post_to_amazon';
$valueText = ('Yes');
$valueId = Mage::getModel('catalog/product')->getResource()->getAttribute($attrCode)->getSource()->getOptionId($valueText);
$_product->setData($attrCode, $valueId);
$_product->save();
</code>```

Body:
I have an attribute post_to_amazon that can be set to Yes or No on the product.

This is my code:

require_once('../app/Mage.php');
Mage::app();

$_product   = Mage::getModel('catalog/product')->load("83061");
echo $_product->getPostToAmazon();
$_product->setData("post_to_amazon", "11063");
$_product->save();

The echo prints 11063 which is the value for Yes but i'm not seeing Yes selected for the dropdown on admin.

Why isn't the dropdown showing Yes when the echo is showing 11063?

Here are the settings for my attibute. I'm using Magento 1.9.

Body:
Try with this code hope this might useful to you.

require_once('../app/Mage.php');
Mage::app();

$_product   = Mage::getModel('catalog/product')->load("83061");
echo $_product->getPostToAmazon();
$attrCode = 'post_to_amazon';
$valueText = ('Yes');
$valueId = Mage::getModel('catalog/product')->getResource()->getAttribute($attrCode)->getSource()->getOptionId($valueText);
$_product->setData($attrCode, $valueId);
$_product->save();


问:
ExcelDataReader 2.1.0 : Read Special Character like '%'
I am using nuget Package named ExcelDataReader in MVC application to read Excel sheet and convert it to HTML.All sounds goof but i am not able to read special character from excel sheet.For example is cell value is "59%" but its reading 0.59.So how can i get exact same string value from excel.I am using following code in Controller to read and display excel to html.

```<code>public ActionResult ViewExcelFileData(long? id, int sheetindex)
 {
 var excelfile = db.ExcelUpload.FirstOrDefault(x => x.FileID == id);
string filePath=        string.Format(Server.MapPath("~/App_Data/ExcelUploads/Labor_Excel/") + excelfile.FileName);
System.IO.File.GetAccessControl(filePath);
FileStream stream = System.IO.File.Open(filePath, FileMode.Open, FileAccess.Read);
IExcelDataReader reader = null;
if (excelfile.FileName.EndsWith(".xls"))
{
 reader = ExcelReaderFactory.CreateBinaryReader(stream);
}
else if (excelfile.FileName.EndsWith(".xlsx"))
{
 reader = ExcelReaderFactory.CreateOpenXmlReader(stream);
}
reader.IsFirstRowAsColumnNames = true;

DataSet result = reader.AsDataSet();
reader.Close();
return View(result.Tables[sheetindex]);
 }
</code>```

By returning datatable in View side I am using Following Code in Cshtml.

```<code><table class="gridtable" id="table-1">
                <thead class="fixed_headers">
                    <tr>
                        @foreach (DataColumn col in Model.Columns)
                        {
                            <th>@col.ColumnName</th>
                        }
                    </tr>
                </thead>
                <tbody>
                    @foreach (DataRow row in Model.Rows)
                    {
                        <tr>
                            @foreach (DataColumn col in Model.Columns)
                            {
                                    <td>@row[col.ColumnName]</td>
                            }
                        </tr>
                    }
                </tbody>
            </table>
</code>```

So is it possible in controller side or View side I can get 59% instead of 0.59?

Here is Two images in which one is belongs to excel and second is HTML.

IMAGE :1

IMAGE 2 :

答:
ExcelDataReader currently does not expose any formatting information, it provides you with the raw values except for dates that are converted to DateTime.

There's an open issue about extending it to provide formatting information, https://github.com/ExcelDataReader/ExcelDataReader/issues/215.

Body:
I am using nuget Package named ExcelDataReader in MVC application to read Excel sheet and convert it to HTML.All sounds goof but i am not able to read special character from excel sheet.For example is cell value is "59%" but its reading 0.59.So how can i get exact same string value from excel.I am using following code in Controller to read and display excel to html.

public ActionResult ViewExcelFileData(long? id, int sheetindex)
 {
 var excelfile = db.ExcelUpload.FirstOrDefault(x => x.FileID == id);
string filePath=        string.Format(Server.MapPath("~/App_Data/ExcelUploads/Labor_Excel/") + excelfile.FileName);
System.IO.File.GetAccessControl(filePath);
FileStream stream = System.IO.File.Open(filePath, FileMode.Open, FileAccess.Read);
IExcelDataReader reader = null;
if (excelfile.FileName.EndsWith(".xls"))
{
 reader = ExcelReaderFactory.CreateBinaryReader(stream);
}
else if (excelfile.FileName.EndsWith(".xlsx"))
{
 reader = ExcelReaderFactory.CreateOpenXmlReader(stream);
}
reader.IsFirstRowAsColumnNames = true;

DataSet result = reader.AsDataSet();
reader.Close();
return View(result.Tables[sheetindex]);
 }

By returning datatable in View side I am using Following Code in Cshtml.

                        @foreach (DataColumn col in Model.Columns)
                        {
                            @col.ColumnName
                        }

                    @foreach (DataRow row in Model.Rows)
                    {

                            @foreach (DataColumn col in Model.Columns)
                            {
                                    @row[col.ColumnName]
                            }

                    }

So is it possible in controller side or View side I can get 59% instead of 0.59?

Here is Two images in which one is belongs to excel and second is HTML.

IMAGE :1

IMAGE 2 :