text:
Q: java.sql.SQLException: Parameter index out of range (3 > number of parameters, which is 2) @WebMethod(operationName = "SearchOR")
  public  SearchOR getSearchOR (@WebParam(name = "comp")
  String comp, @WebParam(name = "name")
 String name) {
            //TODO write your implementation code here:
     SearchOR ack = null;

    try{
     String simpleProc = "{ call getuser_info_or(?,?)}";
        CallableStatement cs = con.prepareCall(simpleProc);
        cs.setString(1, comp);
        cs.setString(2, name);
        **ResultSet rs = cs.executeQuery();**

      while (rs.next()) {

           ve.add(rs.getString(1));
           ve.add(rs.getString(2));

        }}catch ( Exception e) {
        e.printStackTrace();
        System.out.print(e);
    }
    return ack;
}

I am getting error at portion i have made bold.It is pointing to that location.My Query is
here:
DELIMITER $$
DROP PROCEDURE IF EXISTS .`getuser_info_or$$
# MySQL returned an empty result set (i.e. zero rows).`
CREATE PROCEDURE .getuser_info_or``
(
IN comp VARCHAR(100),
IN name VARCHAR(100),
OUT Login VARCHAR(100),
OUT email VARCHAR(100)
)
BEGIN
SELECT sLogin, sEmail
INTO Login, email
FROM ad_user
WHERE company = comp OR sName=name;
END $$
# MySQL returned an empty result set (i.e. zero rows).
DELIMITER ;

A: I believe your problem is your call does not match the method definition. In your definition you have two parameters: IN comp, IN name, OUT Login, OUT email. So your call should be:
String simpleProc = "{ call getuser_info_or(?, ?, ?, ?)}";

And from the javadocs:

If used, the result parameter must be
  registered as an OUT parameter.

So you would need to add those registrations:
cs.registerOutParameter(3, Types.VARCHAR);
cs.registerOutParameter(4, Types.VARCHAR);

The stored procedure as defined does not create a resultset for the retrieved data, but rather places it in the out parameters. To fetch them you will need to access them via the callable statement:
String login = cs.getString(3);
String email = cs.getString(4);


text:
Q: Declarative Spring cache customization I am using Spring Declarative Annotation based caching in my project .
applicationContext.xml
<cache:annotation-driven />

Currently, everything works perfectly using spring annotation based caching.
We use ehCache and ConcurrentHashMap based underline caching mechanism in development and local environment.
Now there is a requirement in project where I need to update the behavior of Spring cache framework with some specific business requirements.
I wonder if any one help me to figure it out how can I replace
<cache:annotation-driven />

this annotation with any spring class definition where I can customize the behavior?

A: Check out org.springframework.cache.annotation.EnableCaching.
Look at the comments in the source code.
It does the equivalent of the < cache:annotation-driven /> but in spring java config.
You will prolly need to override this class: org.springframework.cache.aspectj.AnnotationCacheAspect
Its responsible for wiring the advise in.

A: This answer lead me in the right direction. The thing that I found about the inner workings of the caching support from spring is that its not Dependency injected outside of the cacheManager and KeyGenerator implementations. I wanted to subclass/extend the CacheAspectSupport and found that this class is first extended by CacheInterceptor but then that class is created using new statements in a class ProxyCachingConfiguration. To be able to replace the one class/method would take replacing a whole list of classes which doesn't sound very spring friendly (admittedly i could be missing something).
What i was expecting from the replacement of the line  was a fully listed out set of spring beans that composed all of the  AOP pointcuts, advice/aspects, etc. that make up the caching support, but it seems like this is alål just statically created classes with tight coupling between each other.

redpajama_set_name: RedPajamaStackExchange


text:
Q: GL_TEXTURE_EXTERNAL_OES texture render in fragment shader Eh .. I am using OpenGL ES on Android .
I want to use a SurfaceTexture and camera.setPreviewTexture get camera preview texture , and use it and render this texture on screen .
Here is my question , I use a samplerExternalOES type to declare a sampler   in fragment shader source . And I googled some articles tell me that the GL_TEXTURE_EXTERNAL_OES usually use to YUV data , and I think the shader didn't convert YUV to RGB . The fragment shader is process all fragment , the function is same . and it can works well , why ?
and How can I convert YUV to RGB format with shader ?
Thanks and please forgive my poor english.
Fragment shader Code :
#extension GL_OES_EGL_image_external : require
 precision mediump float;
 uniform samplerExternalOES uInputTex;
 varying vec2 vTexCoord;
 void main(){
    gl_FragColor = vec4(texture2D(uInputTex,vTexCoord).rgb,1.0f);
 }


text:
Q: It is possible to get a .aar with a Product flavor I work on a big project at work, i have been herited 3 months ago. At the moment the project structure is like this :

*

*Engine : its a library with my entire code (all java classes) with some extern libraries

*App : its a android project but it is just a wrapper for have 2 declinaisons-flavor of the app (different name and icon for commercial purpose). The engine lib is integrated to this app.

Additionnaly, sometimes I do build the engine to .aar for one client who use the library without the app wrapper.
My big problem : the last developepr of this project dont good know gradle and android structure, it is some strange res added twice in Engine and App/ build script / extern lib added twice...
So, before i work on a new major version, i want to refator the build system and simplify it ! In the best world, i want to delete the lib project, add the Engine code to the App, for have just 1 project app and use power of flavors for managing specifics parts.
If i have flavors like this :

*

*one

*two

*lib

It is possible to use flavor "lib" to get a .aar ?
If you have another solution for simplify or resolve my problem, im over. Thanks in advance :)

A: Having, has you described it, a single application module that outputs both .aar and .apk is not possible afaik, your module has to be a library OR an application, not both. (i.e. in your build.gradle : apply plugin: 'com.android.application' or 'com.android.library').
My guess here will be (Android studio 1.5.1) :

*

*A single Android Studio project,

*Two modules, one library module and one application module (File -> new... -> New module... -> one "Android Library" and one "Phone or tablet module")

*In the app module, the 2 flavors for your branding.

*Integrate the library module into your app module as a dependency (in your app build.graddle dependencies section : compile project(path : ':yourlibrarymodule'))

Your ressources can either be stored either in your library (usable in your lib and your app without duplication), in your app in the main flavor (usable in your 2 flavors without duplication) or in your two flavors.
Therefore, you can produce the .aar by building your library module, and the two .apk by building your app module.


text:
Q: SOAP BODY Field in ESQL How to get Content-Transfer-Encoding="CDATA" in my soap body.
I have tried with DECLARE IDOC_BLOB BLOB
        A
SBITSTREAM(InputRoot.BLOB,InputRoot.Properties.Encoding,InputRoot.Properties.CodedCharSetId );
        DECLARE IDOC_CHAR CHAR
        CAST(IDOC_BLOB AS CHAR CCSID InputRoot.Properties.CodedCharSetId);
        SET Environment.Messagecontent = IDOC_CHAR;
        SET BODYoutref.message.(XMLNSC.Attribute)'Content-Transfer-Encoding' = "CDATA";
        SET BODYoutref.message.(XMLNSC.CDataField) = Environment.Messagecontent;

But I am not getting Content-Transfer-Encoding="CDATA" . Suggest some changes
My requirement is
< soap:Body>
    <Message Content-Transfer-Encoding="CDATA"><![CDATA[{message}]]</Message>
</soap:Body>

A: This Is how We should code to get proper result
DECLARE FILE NAMESPACE 'CDATA';
DECLARE IDOC_BLOB BLOB

ASBITSTREAM(InputRoot.BLOB,InputRoot.Properties.Encoding,InputRoot.Properties.CodedCharSetId );
        DECLARE IDOC_CHAR CHAR
        CAST(IDOC_BLOB AS CHAR CCSID InputRoot.Properties.CodedCharSetId);
        SET BODYoutref.(XMLNSC.CDataField)Message = IDOC_CHAR;
        SET BODYoutref.Message.(XMLNSC.NamespaceDecl)"content-Transfer-Encodeing" = FILE;


text:
Q: How to connect IRF 630B N-Channel MOSFET on 220VAC? Here is datasheet: http://pdf.datasheetcatalog.com/datasheet/fairchild/IRF630B.pdf
From my wall is 220 VAC, but from datasheet I think this MOSFET alow just 200VAC (I am not sure please check).
Should I just connect drain and source to the AC wire?

A: You cannot use a MOSFET this way. If you want to switch 220VAC then use a relay.

A: You can use a MOSFET to control an AC load as shown here: http://tahmidmc.blogspot.com/2012/11/controlling-ac-load-with-mosfet.html
With this scheme, you cannot control an inductive load unless you come up with some way to deal with the inductive kickback. You can also get rid of the rectifier by connecting 2 series MOSFETs as such:

Source: http://forum.allaboutcircuits.com/blog/controlling-an-ac-load-with-a-mosfet.518/

A: You don't (normally) switch mains with MOSFET. You use a solid-state relay using a triac internally.

simulate this circuit – Schematic created using CircuitLab
Figure 1. Solid state relay.
SSRs come in two flavours - zero-cross and non zero-cross. For your dimming application you need non zero-cross so that you can switch on at any point in the cycle.

Figure 2. Dimming by phase control.
Your controller circuit will need to detect the zero-crossing point and trigger the triac after the required delay.
Choose a triac to match your line voltage and the required current.
You are working with main voltages. Keep these very separate from your low-voltage circuits. Use good wiring practices.


text:
Q: css - background position (with slight padding?) I am trying to emulate something like
 background-position: left center

With the exception that it is not actually flush with the left side, so like 5-10 px off the left side and center.
My first attempt was like so
 background-position: left 5px center

CSS does not seem to like that though, is something like this possible without messing with margins?
Thanks!

A: It is possible yes, and there are several ways.
and W3C have explained it pretty good over here (http://www.w3schools.com/cssref/pr_background-position.asp)
Scroll to the table of Property Values and read the description of the X and Y values or the Xpos and Ypos values.
in your case, I believe that it will be something like:
background-position: 5px center;

I hope this helps


text:
Q: Can I avoid permission_required decorator on Django testing? I am testing a set of Django applications which make extensive use of the 'permission_required' decorator. This derives in a 302 HTTP response in most of the views that I have.
My question is: there is any way to avoid or deactivate the 'permission_required' in testing, so I can get a 200 response when I call my views, instead of the 302?
Thank you!

A: Just log in with a superuser in your test case setUp method

from django.test import TestCase
from django.contrib.auth.models import User

class TestThatNeedsLogin(TestCase):
    def setUp(self):
        User.objects.create_superuser(
            'user1',
            'user1@example.com',
            'pswd',
        )
        self.client.login(username="user1", password="pswd")

    def tearDown(self):
        self.client.logout()

    def test_something(self):
        response = self.client.get("/")
        self.assertEqual(200, response.status_code)

A: You could monkey patch it:
import django.contrib.auth.decorators

real_permission_required = decorators.permission_required
# return a function that returns the exact function that was decorated, ignoring arguments
decorators.permission_required = lambda *args, **kwargs: lambda func: func

You need to make sure this happens before it's used, which is at the definition time of the object it's decorating. (For example, when that module is included.)
It also has to happen before it's rebound to another scope. After import django.contrib.auth.decorators is fine, but before from django.contrib.auth.decorators import permission_required.

A: Well. The solution I have found is to create a superuser in the setUp method from the TestCase class. I did it in that way:
def setUp(self):
    self.client = Client()
    self.user = User.objects.create_superuser(
        'testuser',
        'test@example.com',
        'easy_password',
    )

Then, when I want to test a URL, I do this:
def test_search_customers(self):
    url = reverse('customer_search')
    response = self.client.get(url)
    # Not logged user. Must return a 302 HTTP code.
    self.assertEquals(response.status_code, 302)
    self.assertEquals(response['Location'], 'http://testserver/unauthorized/?next=/search/customers/')
    # HERE I LOG IN MY SUPERUSER
    self.client.login(username='testuser', password='easy_password')
    response = self.client.get(url, follow=True)
    # Same URL requested with a logged user with permissions. Must return 200 HTTP code.
    self.assertEquals(response.status_code, 200)

This is what it worked for me :)
Thank you all. Cheers,
Jose


text:
Q: Creating xml file in asp.net?
in my asp.net page i have register page. i want to create a xml file with parent and child nodes of xml  like :
 <Personal Details>
    <First Name> ... </First Name>
    <Last Name> ... </Last Name>
 </Personal Details>
 <Bank Details>
    <Bank Name> ... </Bank Name>
    <Account No> ... </Account NO>
 <Bank Details>

and store the xml file in datbase widht parent and child nodes.

A: There are plenty of way to generate XML. you can try something like
        XElement element =
            new XElement("SomeRoot",
                new XElement("PersonalDetails",
                    new XElement("FirstName","FirstNameValue"),
                    new XElement("LastName"),"LastNameValue"),
                new XElement("BankDetails",
                    new XElement("BankName","BankNameValue"),
                    new XElement("AccountNo","AccountNoValue")));

and
element.ToString()

will give you xml string with a root element.

A: You can use the XmlWriter class.
Here you can find a sample code: http://www.dotnetperls.com/xmlwriter

A: I personally don't recommend using XML for membership (as I stated in my comment, SQL is better, and can still be free).
That being said, to semi answer your question I'd recommend using an XML Membership Provider to deal with your authentication. It's pre-built, easy to implement, and you're not re-inventing the wheel.

A: I don't use .net but I do from time to time use asp.  When I do I'll sometime use ASP XMLMaker for what you're looking to do.  There's an ASP.NET XMLMaker too, take a look, it may help in what you need.  enter link description here


text:
Q: AXI IIC BUS:No data waveform on SDA I use AXI IIC BUS IP Core on vivado.Even if I write the corresponding data to the register, there is no change on the sda data line.
Here is the registers of the ip core.
Register of AXI IIC
And the Programming Sequence are as below.
The sequence
It seems that I only need to complete the first and the second steps and I can see the wavefrom changes on SDA
Here is a top.v (it's not my original,reference from Bad s_axi_bvalid, s_axi_wready, and s_axi_awready signals using Vivado IIC IP Flow)
module i2c_channel #(
    parameter                               CHANNEL_OUTPUT_WIDTH    =   16
)(
    input                                   clk,
    input                                   reset,
    //the address of the slave;
    input   [6:0]                           slave_address,

    //The width of the message expected from the slave at the specified address;
    input   [127:0]                         slave_message_width,
    inout                                   sda,
    inout                                   scl,
    output  [CHANNEL_OUTPUT_WIDTH - 1:0]    channel_output
);
    wire                                       iic2intc_irpt  ;

    //AXI Global System Signals
    wire s_axi_aclk;
   assign        s_axi_aclk      =   clk;
    reg                                       s_axi_aresetn     ;

    //AXI Write Address Channel Signals
    reg       [31:0]                          s_axi_awaddr    ;
    reg                                       s_axi_awvalid   ;
    wire                                       s_axi_awready;

    //AXI Write Data Channel Signals
    reg       [31:0]                          s_axi_wdata     ;
    reg       [3:0]                           s_axi_wstrb     ;
    reg                                       s_axi_wvalid    ;
   wire                                       s_axi_wready;

    //AXI Write Response Channel Signals
    wire       [1:0]                           s_axi_bresp;
    wire                                      s_axi_bvalid;
    reg                                       s_axi_bready    ;

    //AXI Read Address Channel Signals
    reg       [31:0]                          s_axi_araddr       ;
    reg                                       s_axi_arvalid  ;
    wire                                       s_axi_arready;

    //AXI Read Data Channel Signals
    wire       [31:0]                          s_axi_rdata;
    wire       [1:0]                           s_axi_rresp;
    wire                                       s_axi_rvalid;
    reg                                       s_axi_rready  ;

    //IIC signals
    reg                                    sda_i          ;
    wire                                       sda_o;
    wire                                     sda_t;
    reg                                       scl_i           ;
    wire                                       scl_o;
    wire                                       scl_t;
    reg                                       gpo           ;

    reg                                       state_done;
    //i2C state
    `define  SET_TX_FIFO 4'b0000
       `define  SET_RX_FIFO_PIRQ 4'b0001
        `define SET_CR_MSMS_TX 4'b0010
        `define  SET_CR_TXAK 4'b0011
   reg[3:0]state;
   initial begin
   state<=4'b0000;

   end

    //tri-state open-collector buffers to convert the iic signals to bi-directional inouts.
    assign sda = sda_t ? sda_o : sda_i;
    assign sda = scl_t ? scl_o : scl_i;

axi_iic_1 iic (
    .iic2intc_irpt(),
    .s_axi_aclk(s_axi_aclk),
    .s_axi_aresetn(s_axi_aresetn),
    .s_axi_awaddr(s_axi_awaddr[8:0]),
    .s_axi_awvalid(s_axi_awvalid),
    .s_axi_awready(s_axi_awready),
    .s_axi_wdata(s_axi_wdata),
    .s_axi_wstrb(s_axi_wstrb),
    .s_axi_wvalid(s_axi_wvalid),
    .s_axi_wready(s_axi_wready),
    .s_axi_bresp(s_axi_bresp),
    .s_axi_bready(s_axi_bready),
    .s_axi_bvalid(s_axi_bvalid),
    .s_axi_araddr(s_axi_araddr),
    .s_axi_arvalid(s_axi_arvalid),
    .s_axi_arready(s_axi_arready),
    .s_axi_rdata(s_axi_rdata),
    .s_axi_rvalid(s_axi_rvalid),
    .s_axi_rresp(s_axi_rresp),
    .sda_i(sda_i),
    .sda_o(sda_o),
    .sda_t(sda_t),
    .scl_i(scl_i),
    .scl_o(scl_o),
    .scl_t(scl_t)
);

always @(clk)  begin
    s_axi_aresetn   <=  ~reset;
end

//Sets an axi data write operation.
task set_a_axi_w ;
input [31:0] awaddr;
input [31:0] wdata;
begin
    s_axi_awaddr   =  awaddr;
    s_axi_wdata     =  wdata;
    s_axi_awvalid   =  1'b1;
    s_axi_bready    =  1'b1;
    s_axi_wvalid    =  1'b1;
    end
endtask

//set the state of the operation.
task set_state ;

input[3:0] new_state;
    if(s_axi_awready) begin
        state           =  new_state;
    end
endtask

//when the module is initialized, write the i2c address of the target slave to the TX_FIFO register.
//Write the IIC peripheral device addresses for the first slave device to the TX_FIFO.
always @(posedge clk)  begin

    case (state)
        `SET_TX_FIFO : begin
            set_a_axi_w(32'h108, slave_address);
            set_state(`SET_RX_FIFO_PIRQ);
        end
        `SET_RX_FIFO_PIRQ : begin
            set_a_axi_w(32'h120, slave_message_width - 2);
            set_state(`SET_CR_MSMS_TX);
        end
        `SET_CR_MSMS_TX : begin
            set_a_axi_w(32'h100, 8'b00000101);
            set_state(`SET_CR_TXAK);
        end
    endcase

    if(s_axi_awready) begin
        //s_axi_awaddr    <=  '0;
        s_axi_awvalid   <=  1'b0;
    end

    if(s_axi_wready)  begin
        //s_axi_wdata    <=  '0;
        s_axi_wvalid   <=  1'b0;
    end

    if (s_axi_bvalid)  begin
        s_axi_bready   <=  1'b0;
    end/**
    else begin
        s_axi_bready <=1'b0;
    end**/
end

endmodule

Here is the simulation file:
    module i2c_channel_tb();

//Parameters
parameter CLK_PERIOD = 10;

reg           clk      =   1'b1;
reg          reset           =   1'b1;
reg   [6:0]   slave_address   =   6'b0;

wire           sda;
wire           scl;

i2c_channel i2c_channel_1 (
    .clk(clk),
    .reset(reset),
    .slave_address(slave_address),
    .slave_message_width(128'd16),
    .sda(sda),
    .scl(scl)
);
/*
i2c_channel_slave_model i2c_channel_slave_model_1 (
    .sda(sda),
    .scl(scl)
);**/

initial begin
    clk                 <=  1'b0;
    reset               <=  1'b0;
    slave_address       <=  7'b100_1011;
end

//psuedo-clock
always #10 begin
    clk <= ~clk;
end
endmodule

the waveform result is below:
Result waveform
As shown in the figure,the data is written to the register,but no changes occur on the sda_o and scl_o.
Could anybody tell me why?
Thanks!

A: One obvious mistake is that your SDA and SCL should be pulled up in their initial state.
Your waveform shows that sda_o, sda_i, scl_o, and scl_i are not pulled up at any given time. So perhaps you need to check that. (Either it is some hardware schematic to check, or some IO constraint to set.)


text:
Q: Capturing the original window with a closure I've been reading that some versions of IE have issues with window.opener. Instead I have a closure over the old window in my newWindow.onbeforeunload method, like so:
var newWindow = window.open("../someFolder/somepage.php");
var self = window;
newWindow.onbeforeunload(function() {
    self.alert("Closing the other window.");
}

An alert is not what I'm actually going to use this for. (I'm going to use it to figure out when data has been submitted on the other page so that I don't have to continually poll.)
But my question is (1) Is this well-defined behavior? and (2) Are there any versions of IE (6+) that would have trouble with it?
I will try to also run it on IE and test for myself, but I don't have that capability yet. It does work in Firefox (v31).


text:
Q: Tex Live 2015, KOMA-script pagesize=automedia yields Undefined Control Sequence The following LaTeX file compiles fine on Tex Live 2014, but fails on Tex Live 2015:
\documentclass[pagesize=automedia]{scrartcl}
\usepackage{lipsum}
\begin{document}
\lipsum
\end{document}

Compilation with Tex Live 2015 (either pdflatex or lualatex) gives:
$ /usr/local/texlive/2015/bin/x86_64-linux/pdflatex mini
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./mini.tex
LaTeX2e <2015/01/01> patch level 2
Babel <3.9m> and hyphenation patterns for 79 languages loaded.
(/usr/local/texlive/2015/texmf-dist/tex/latex/koma-script/scrartcl.cls
Document Class: scrartcl 2015/07/02 v3.18 KOMA-Script document class (article)
(/usr/local/texlive/2015/texmf-dist/tex/latex/koma-script/scrkbase.sty
(/usr/local/texlive/2015/texmf-dist/tex/latex/koma-script/scrbase.sty
(/usr/local/texlive/2015/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2015/texmf-dist/tex/latex/koma-script/scrlfile.sty
Package scrlfile, 2015/07/02 v3.18 KOMA-Script package (loading files)
                  Copyright (C) Markus Kohm

))) (/usr/local/texlive/2015/texmf-dist/tex/latex/koma-script/tocbasic.sty)
(/usr/local/texlive/2015/texmf-dist/tex/latex/koma-script/scrsize11pt.clo)
(/usr/local/texlive/2015/texmf-dist/tex/latex/koma-script/typearea.sty
Package typearea, 2015/07/02 v3.18 KOMA-Script package (type area)
                  Copyright (C) Frank Neukam, 1992-1994
                  Copyright (C) Markus Kohm, 1994-

)) (/usr/local/texlive/2015/texmf-dist/tex/latex/lipsum/lipsum.sty) (./mini.aux
)
! Undefined control sequence.
\@tempc ...ia}\if@atdocument \set@pdftextpagesize
                                                  \set@vtexpagesize \set@dvi...
l.3 \begin{document}

?
[1{/usr/local/texlive/2015/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
[2] (./mini.aux) )</usr/local/texlive/2015/texmf-dist/fonts/type1/public/amsfon
ts/cm/cmr10.pfb>
Output written on mini.pdf (2 pages, 22135 bytes).
Transcript written on mini.log.

The resulting PDF looks fine, although I did not estimate if the size of the textarea is correct.
Why is this happening and how can I circumvent this problem?

A: This is a bug that is reported in the KOMA-script 3.18 release notes on the KOMA-script website, It can be found via the (obvious?) path:
Startseite › Dokumentation > KOMA-Script Dokumentations-Buch › Was ich schon immer fragen wollte ... › Fragen zur KOMA-Script-Anleitung und der KOMA-Script Verteilung › Welches ist die aktuelle KOMA-Script-Release und wo finde ich sie? > Bekannte Probleme und Änderungen in KOMA-Script 3.18:

typearea
Bei Verwendung von Option pagesize=automedia kann u. U. eine Fehlermeldung wegen nicht definiertem \set@pdftextpagesize auftreten.
  Workaround: \makeatletter\def\set@pdftextpagesize{\set@pdftexpagesize}\makeatother in der Dokumentpräambel einfügen. Dieser Workaround stört auch nicht, wenn der Fehler in der nächsten Release behoben sein wird.
  Hinweis: Der Fehler ist in der aktuellen Bugfix-Release bereits behoben.

Translation in English by me:

typearea
When using the option pagesize=automedia, under circumstances an error message due to an undefined \set@pdftextpagesize can occur.  Workaround: add \makeatletter\def\set@pdftextpagesize{\set@pdftexpagesize}\makeatother to the document preamble.  This workaround is not harmful when the bug will be fixed in the next release.  Hint: the bug is already fixed in the current bugfix-release.


text:
Q: Link library in Visual Studio, why two different ways? I need to link library from one project into another, and it looks there are 2 ways, can you tell what is the difference and what is the consequence of having "true" in one setting and "false" in another (the same) setting?:

and another one:

What is the difference, and do I need both setting set to "yes" or just one and if so which one?

A: A one-line explanation would probably be that the second option specifies something about how the first one works.

*

*Link Library Dependencies set to Yes: if the solution is set up so that the current project has a dependency on another project that produces a .lib file, then that file will be linked in automatically.

*Use Library Dependency Inputs set to Yes: useful mostly in Debug builds, when Incremental Linking is enabled. Normally, if a .lib generated by another project changes, and the current project depends on it, the linker can no longer link the current project incrementally (it's difficult for it to know how exactly the .lib changed). If you set this option to Yes, then the linker doesn't use the .lib file generated for the other project, but rather the individual .obj files that were used by the librarian to generate that .lib (as if the .lib didn't exist, and every object file from the other project were given to the linker individually, alongside the .obj files from the current project). This enables it to continue linking incrementally.

As far as I can tell, Use Library Dependency Inputs only makes sense if Link Library Dependencies and Enable Incremental Linking are both also set to Yes, and the current project depends on another project that generates a .lib file that changes often during development.
Additional information here and reference docs here.

UPDATE based on the comment from the OP:
As far as I can tell, the property entry under Project Reference Properties specifies the setting individually for each referenced project (whether to use the .lib from that specific project or not), while the one under Linker - General is the default setting for referenced projects.
For example, if you set the one under Linker - General to No and add a new referenced project, then, for that project, the setting under Project Reference Properties will default to False. However, the settings for referenced projects that were added before keep their individual setting.
I expect the individual setting under Project Reference Properties to override the default from Linker - General, but I haven't actually tested this bit.


text:
Q: Proper jQuery image load()? <script type="text/javascript">
jQuery(document).ready(function(){
setTimeout(function(){
    jQuery('.my-image').each(function(){
        jQuery(this).greyScale({
            fadeTime: 200,
            reverse: false
        });
        $(this).animate({ 'opacity' : 1 }, 1000);
        $(this).load(function(){
            jQuery(this).greyScale({
                fadeTime: 200,
                reverse: false
            });
            $(this).animate({ 'opacity' : 1 }, 1000);
        });
    });
}, 200);
});
</script>

In the above example I use greyScale() function that duplicates image into canvas and keeps both versions (grey = default, color = hover).
It works fine 99% of the time BUT when browser first runs it sometimes fails to load 1 image, 2 images or something like that. It's like both "load" and "normal event" failed to work.
Can someone confirm if I'm doing it right? I attempt to load that event if image is already there or if it's not there then there's alternative "load()" to ensure it will execute once it's loads. Logically it seems like good solution.

A: A good way to test whether an image has loaded or not is to try and access its dimensions, if you can get the height or width of an image, you can assume it has loaded and greyscale it. Therefore you could modify your code to do this:
jQuery('.my-image').each(function()
{
    var greyscale = function(image)
    {
        jQuery(image).greyScale({
            fadeTime: 200,
            reverse: false
        });
    }

    if ( jQuery(this).width() )
    {
        // it's loaded, greyscale its ass
        greyscale( this );
    }
    else
    {
        // wait for the load
        $(this).load(greyscale);
    }
});

In this situation, since you want the image to be greyscale first I'd recommend inserting images programmatically:
Where your <img> tags would be, replace them with <div> tags where you add a data-src attribute, this will contain the image's URL.
When you're document has loaded, use a script that goes through all the <div> tags and insert the <img> tags within the <div> tags, for example:
jQuery('div.my-image').each(function()
{
    var el = jQuery( this );

    // get the src for the image
    var src = el.data( 'src' );

    // start loading the image
    var img = new Image();

    img.onload = function()
    {
        // greyscale it
        jQuery(img).greyScale({
            fadeTime: 200,
            reverse: false
        });

        // append it
        el.append( img );
    }

    // load the image by setting the src
    img.src = src;
});

A: .load() can be a tricky one, but something like this should work (notice the this.complete check):
jQuery('.my-image').each(function(){
    $(this).load(function(){
        jQuery(this).greyScale({
            fadeTime: 200,
            reverse: false
        });
        $(this).animate({ 'opacity' : 1 }, 1000);
    });

    if (this.complete) {
      $(this).trigger('load');
    }
});

Try to avoid duplicating code, it's not the best of practice.

A: Dont rely on .load() function for images.
Even jQuery says so .

Caveats of the load event when used with images
A common challenge developers attempt to solve using the .load()
  shortcut is to execute a function when an image (or collection of
  images) have completely loaded. There are several known caveats with
  this that should be noted. These are:
It doesn't work consistently nor reliably cross-browser It doesn't
  fire correctly in WebKit if the image src is set to the same src as
  before It doesn't correctly bubble up the DOM tree Can cease to fire
  for images that already live in the browser's cache

Read here
If you can , use this,
$(window).load(function(){
    // Images are now loaded for sure
})

Edit:
or use Paulirish's very lite jQuery plugin
imageLoaded


text:
Q: Non-exhaustive patterns in function haskell I think I am missing the case where there's a one element list but I can't find a way to write it can someone help me?
getBoard :: [String] -> [String]
getBoard (h:t) | isLOL h = h: getBoard (t)
               | otherwise = []

isLOL :: String -> Bool
isLOL [ ] = True
isLOL (h:t) | h>='a' && h<='z' || h >='A' && h<='Z' = isLOL t
            | otherwise = False

A: getBoard [] = []

is the line you want. Like this:
getBoard :: [String] -> [String]
getBoard [] = []
getBoard (h:t) | isLOL h = h: getBoard (t)
               | otherwise = []

isLOL :: String -> Bool
isLOL [] = True
isLOL (h:t) | h>='a' && h<='z' || h >='A' && h<='Z' = isLOL t
            | otherwise = False

A: First of all, in your definition of getBoard, the problem is that the guards (the stuff after the |) are checked after the pattern (h:t in your case) are matched. So if the argument to getBoard doesn't match h:t (i.e. is []), then the two branches (including the otherwise branch) are not checked. The solution to this is to add a match on []:
getBoard (h:t) | isLOL h = h : getBoard t
               | otherwise = []
getBoard [] = []

However, matches with failing guards fall through, so you can write that as
getBoard (h:t) | isLOL h = h : getBoard t
getBoard _               = []

Now, as for how to write this function in a better way, using recursion schemes from the Prelude:
isLOL can be rewritten as
isLOL = all $ \h -> 'a' <= h && h <= 'z' || 'A' <= h && h<= 'Z'

and getBoard can be rewritten similarly, noting that it will always return the original list if every character isLOL, and the empty list otherwise:
getBoard cs | all isLOL cs = cs
            | otherwise = []


text:
Q: Sequence of functions $\sin^{n} (\pi x)$ cauchy in C[0,1] Equipping C[0,1] with its usual (supremum) norm, for each $n \in \mathbb{N}$, let $g_n(x)=\sin^{n} (\pi x)$ for $x \in [0,1]$. I'm trying to prove (or disprove) this sequence is cauchy.
Intuitively, I would think it is cauchy.
From the definition, I'm trying to show that for any $\epsilon >0$, sup$|\sin^{n} (\pi x)-\sin^{m} (\pi x)| < \epsilon$ whenever m,n>N.
I'm looking for a hint on how to go about showing this.

A: A "trick" I use is to bound the supremum of a function using it's derivative. You can look at $f_{nm}(x)=\sin ^n (\pi x) - \sin ^m (\pi x) $ and search for its maxima in $[0,1]$.
Edited: Another way is to recall (or prove) that a sequence of functions convergeces uniformally iff it is uniformally cauchy sequence (or that $C_\sup[0,1]$ is a Banach space).

A: Each $g_m$ is continuous with $g_m(0)=0$ and $g_m(\frac{1}{2})=1$  so let $x_m\in (0,\frac {1}{2})$ with $g_m(x_m)=\frac {1}{2}.$ We have $$\sup_{n>0}\|g_m-g_{m+n}\|\geq \sup_{n>0}|g_m(x_m)-g_{m+n}(x_m)|= \lim_{n\to \infty}\frac {1}{2}-g_{m+n}(x_m)=\frac {1}{2}.$$ So the Cauchy criterion is not satisfied.


text:
Q: Next JS + Image optimization I've got this ticket thats asking me to "frond-end optimize image size, dimension, quality from code"
the images are user uploaded in binary format? and I retrieve them + load them on the page using the API link they give me for that page.
Image size, dimension and quality -> I can set dimensions easily, change the images from jpeg to png where needed like such
        <img
          src={`data:image/jpeg;base64,${
            data.images ? data.images[0].imageData : ""
          }`}
          className={styles.headerImage}
        />

But what else can I do for images?
Is it possible to crop images on the front end before setting it as say - a mobile or tablet bg picture?


text:
Q: Failed to parse webhook JSON response: Cannot find field: responseId in message google.cloud.dialogflow.v2.WebhookResponse I am creating a simple web chatbot with DialogFlow API V2.0 and ASP.NET WebAPI (.NET 4.5).
Questions:

*

*the enclosed screenshot looks weird, can anyone show me the actual Fulfillment respons and JSON response looks like.

*I am writing my own response, do i have to install any SDK for this ?

Error Message:
Webhook call failed. Error: Failed to parse webhook JSON response: Cannot find field: responseId in message google.cloud.dialogflow.v2.WebhookResponse.

A: Just add MediaTypeHeaderValue "application/json" to your Headers Content of your HttpResponseMessage
HttpResponseMessage response = new HttpResponseMessage();
response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");


text:
Q: NuxtLink & GraphQL mutations I am trying to create Nuxt application with GraphQL + Apollo Server connection. I'm just starting my Nuxt practice and I have a problem. When the page is reloaded, the date is retrieved at the start via useMutation:
const { mutate: postPublish, loading } = useMutation(PUBLISH_POST, {
  variables: {
    postId: props.id,
  },
  refetchQueries: [
    {
      query: GET_PROFILE,
      variables: {
        userId: params.id,
      },
    },
  ],
});

When switching between pages, I use the recommended <NuxtLink></NuxtLink>;
but when switching pages in this way, useMutation does not trigger on startup.
Everything works when I'm using  tag.
Can someone explain to me why it works like this and how to remedy it by staying with <NuxtLink></NuxtLink>


text:
Q: I uploaded snap on snapcraft now how can i delete this? Hello Guys I had created a useless app to test distributions of the app on different platforms.
now I want to remove that from the snap store how can I?
i published it by uding snapcraft upload --release=stable updatelearning_xxx_amd64.snap
How to delete this?

A: You can only delete your snap if it has not be download by anyone. If this is the case a trash can icon will appear by the title. If it has been download you will need to file a issue here to have it deleted.
Information from this forum.snapcraft.io thread.
If you just want to pause a snaps distribution until a later time, you can close all channels, effectively making in unavailable.
To make it so that the snap is not found by searches on the snap store, change its status to anything but public.


text:
Q: Can you display the difference between two dates in months even if there's more than 12 in PHP? I'm trying to find the difference between two dates and display it in months.
$currentDate = date_create(date('Y-m-d'));
$expiryDate = date_create('2022-12-10');
$dateDiff = date_diff($currentDate, $expiryDate);
$formattedDateDiff = $dateDiff->format('%m');

When I var_dump($formattedDateDiff) it just returns 0. Changing the $expiryDate reveals that it seems to be giving the leftover months after the years, i.e. if the expiry date was '2022-01-10', it would give 1, as there's 3 years and 1 month between now and then, whereas I want the full 37 months.
When I var_dump($dateDiff) to see what it is that I'm actually formatting, it returns the following:
object(DateInterval)#830 (16) {
  ["y"]=>
  int(3)
  ["m"]=>
  int(0)
  ["d"]=>
  int(0)
  ["h"]=>
  int(0)
  ["i"]=>
  int(0)
  ["s"]=>
  int(0)
  ["f"]=>
  float(0)
  ["weekday"]=>
  int(0)
  ["weekday_behavior"]=>
  int(0)
  ["first_last_day_of"]=>
  int(0)
  ["invert"]=>
  int(0)
  ["days"]=>
  int(1096)
  ["special_type"]=>
  int(0)
  ["special_amount"]=>
  int(0)
  ["have_weekday_relative"]=>
  int(0)
  ["have_special_relative"]=>
  int(0)
}

So it's obviously expecting every relevant unit to be displayed, rather than just one. Is there a way to return the total number of months in the $dateDiff object, rather than just the leftover months? I could just divide the days by 30, but that seems like such a naff way around it, and wouldn't exactly be the most accurate what with differing lengths of months and such.

A: Cant' you just multiply the years in difference for 12?
return $dateDiff->m + ($datediff->y * 12);


text:
Q: Rails form populated from one table and saving to another Title kinda says it all, Basically i have this form
<% provide(:title, "Edit user") %>

Editing event:
  <%= @newevent.id %>

    <%= simple_form_for @newevent do |f| %>

      <%= f.label :eventname %>

          <%= f.text_field :eventname, :autofocus => true, class: "form-control" %>

          <%= f.input :event_type, :collection => ['Concert','Festival','Sports','Theatre'] %>

      <%= f.label :eventdesc %>

          <%= f.text_field :eventdesc, :autofocus => true, class: "form-control" %>

      <%= f.label :eventshortdesc %>

          <%= f.text_field :eventshortdesc, :autofocus => true, class: "form-control" %>

      <%= f.label :pagetitle %>

          <%= f.text_field :pagetitle, :autofocus => true, class: "form-control" %>

      <%= f.label :metatag %>

          <%= f.text_field :metatag, :autofocus => true, class: "form-control" %>

      <%= f.label :eventvenuename %>

          <%= f.text_field :eventvenuename, :autofocus => true, class: "form-control" %>

          <%= f.input :time, type: "time", :autofocus => true, class: "form-control" %>

          <%= f.input :date, type: "date", :autofocus => true, class: "form-control" %>

      <%= f.label :eventimage %>

          <%= f.text_field :eventimage, :autofocus => true, class: "form-control" %>

    <%= f.submit "Save changes", class: "btn btn-info" %>
<%= link_to "Delete", event_path(@newevent), :method => :delete, class: "btn btn-danger" %>
    <% end %>

Here is what it loads from.
  def edit
    @newevent = Event.find(params[:id])
  end

However its different now. I am wanting the stuff to load form the Master table (so the fields are populated from Master) However i have an update method that looks like this
  def update
    @newevent = Event.find(params[:id])
    if @newevent.update_attributes(event_params.merge createdby: current_user.id)
      flash[:success] = "Profile updated"
      redirect_to "/events"
    else
      flash.now[:alert] = 'Error updating event'
    end
  end

Do i need to change something in the eventparams to get this to work (and make change from Event to Master) The fields are different in both tables, So would i need to make the value of the fields be something like this?
value: "<%=Master.name%>"

Thanks
Sam

A: If you're trying to load "defaults", you'd be better doing it in the model layer:
#app/models/event.rb
class Event < ActiveRecord::Base
   before_create :set_defaults

   private

   def set_defaults
     default = Master.first
     self.attributes.except("id", "created_at", "updated_at").each do |field|
       self[field] ||= default.send(field)
     end
   end
end

The above will pull a record from the Master model, populate any of the attributes in your Event model which have not been populated.

However, I believe your pattern to be inefficient.
The idea you are pulling "default" data from another model/table directly contradicts the DRY and modular principles of software development.
Not to say that if you wanted to create "dynamic" defaults for a model, your pattern might work. If you're trying to store exactly the same data in different models, you've got a problem.
I would do the following:
#app/models/event.rb
class Event < ActiveRecord::Base
   @@defaults: {
     x: "y",
     y: "z",
     z: "0"
   }

   before_create :set_defaults

   private

   def set_defaults
     self.attributes.except("id", "created_at", "updated_at").each do |field|
       self[field] ||= @@defaults[field]
     end
   end
end

Update
After a discussion, it became apparent that there was more context required to understand the issue/solution fully.
The app works by importing a series of CSV data into the Master table. Whilst I don't know what data this is, the OP said that each Event would be built around the data in Master.
He mentioned he needed 3 fields definitely from Master whilst the others could be inputted by the user into Event.
This means that you could tie the two together with a has_many / belongs_to relationship:
#app/models/master.rb
class Master < ActiveRecord::Base
   has_many :events
end

#app/models/event.rb
class Event < ActiveRecord::Base
   belongs_to :master
end

This is a standard ActiveRecord association, which means you'll be able to call @master.events & @event.master -- accessing values from each table:
#app/controllers/events_controller.rb
class EventsController < ApplicationController
   def new
      @event = Event.new
   end

   def create
      @event = Event.new event_params
      @event.save
   end

   private

   def event_params
      params.require(:event).permit(:master_id, ...)
   end
end

#app/views/events/new.html.erb
<%= form_for @event do |f| %>
  <%= f.collection_select :master_id, Master.all, :id, :name %>
  <%= f.submit %>
<% end %>

--
The reason why this will be much better than your current pattern is that each time you create a new event, you'll be able to access the master attributes:
@event.master.url #-> "url" from master record

A: In Rails in general you create bound form inputs by using a model and passing it to form_for (or simple_form_for).
In this case if you really need to have dynamic user editable default the most obvious solution would be to use Master to seed the new Event.
In most cases however defaults should be a developer concern which are handled on the model layer as suggested by Rich Peck.
Also setting defaults only really makes sense for a new record - why would you want to override the users choices when updating?
def new
  @master = Master.last
  @event = Event.new(@master.attributes.except("id", "created_at", "updated_at"))
end

<%= simple_form_for @newevent do |f| %>
  <%= f.input :eventname %>
<% end %>


text:
Q: R How to tell a (t-test) function the needed column in an indirect way? This is the data with the two columns 'weight' and 'group':
genderweight <- structure(list(weight = c(95.0626365041014, 65.9189881179415,
64.1289176345525, 66.1688823533661, 81.6245374434498, 85.1845386418439,
81.0348729928744, 92.161156464954, 86.3842380662202, 64.8582493776221,
62.3256566394621, 85.0980797936812, 80.0399859200671, 83.3698935236987,
62.8710960018134, 77.0097819307823, 62.9067362884316, 62.8505200797307,
62.2199243419118, 86.2430806667288, 83.8522826935738, 59.3086045947413,
82.578094058482, 62.9779809883867), group = structure(c(2L, 1L,
1L, 1L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 2L, 2L, 2L, 1L, 2L, 1L, 1L,
1L, 2L, 2L, 1L, 2L, 1L), levels = c("F", "M"), class = "factor")), row.names = c(NA,
-24L), class = c("tbl_df", "tbl", "data.frame"))

Package and library needed:
install.packages("rstatix")
library(rstatix)

I would like to use a placeholder in the following function:
t_test(genderweight, weight ~ group, detailed = TRUE)

My placeholder could be named i, for example, and afterwards I would like to run:
i <- "weight"

t_test(genderweight, i ~ group, detailed = TRUE)

Or alternatively, i could be a number, e.g. i = 1 and then I would like to run:
t_test(genderweight,genderweight[,i] ~ group, detailed = TRUE)

For both ways, I get an error message of the following type:
Error in `vec_as_location2_result()`:
! Can't extract columns that don't exist.
✖ Column `genderweight[, 1]` doesn't exist.
Run `rlang::last_error()` to see where the error occurred.

Is there a way to tell the function in an indirect way which column you want for the t-test?


text:
Q: How to debug SSL/TLS in server side I have an application which connects to the server using ssl/tls protocol, what I want to know is in which cipher does it choses to do the handshake, my application server is on IIS win2008r2 , thou I can tell it to connect to which ever address.
I know such solution exists to check what types of ciphers the server is allowing (like sslscan, or the ssllabs website) but I need it the other way around.
Any ideas ?

A: You can use wireshark to look at request stream in order to see which cipher the client and server negotiated. I don't think that the handshake is encrypted at this point so you shouldn't even need to configure wireshark with the private key of the web server to decrypt the request stream.


text:
Q: Making SFTP outbound gate way pollable for mput operation I am using spring integration for SFTP operation. I need to poll the files with directory structure from a certain location of SFTP and also put files with directory structure from local directory to certain SFTP location. I have added faking inbound channel adapter fro mget & mput opeation. While running Junit , some junk message files are generated in target SFTP location of mput operation. And ,after war is deployed no file is getting transferred to mget local directory. The mput and mget operation will started once war is deployed in server Please advice the configuration. This queston is in refrence to
SFTP inbound adapter configuration for multiple remote directory using single adapter and single channel
Sftp-outboundgatewaycontext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int-sftp="http://www.springframework.org/schema/integration/sftp"
    xmlns:int="http://www.springframework.org/schema/integration"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/integration/sftp
     http://www.springframework.org/schema/integration/sftp/spring-integration-sftp-4.1.xsd
        http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-4.1.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
         http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context-4.1.xsd">

    <context:property-placeholder order="0"
        location="classpath:/sftpuser.properties" ignore-unresolvable="true" />
    <context:property-placeholder order="1"
        location="classpath:/sftpfile.properties" ignore-unresolvable="true" />
    <bean id="sftpServerConfig" class="com.iux.ieg.sftp.SftpConfigurator" />

    <bean id="sftpSessionFactory"
        class="org.springframework.integration.file.remote.session.CachingSessionFactory">
        <constructor-arg ref="defaultSftpSessionFactory" />
    </bean>

    <bean id="defaultSftpSessionFactory"
        class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
        <property name="host" value="${sftp.host}" />
        <property name="port" value="${sftp.port}" />
        <property name="user" value="${sftp.username}" />
        <property name="privateKey" value="${private.keyfile}" />
        <property name="privateKeyPassphrase" value="${passphrase}" />
    </bean>

    <int:channel id="outputmget">
        <int:queue />

    </int:channel>

    <int:channel id="outputmput">
        <int:queue />

    </int:channel>

<int:inbound-channel-adapter channel="inboundMGetRecursive"
    expression="''">
    <int:poller fixed-rate="1000" max-messages-per-poll="10" />
</int:inbound-channel-adapter>

<int:inbound-channel-adapter channel="inboundMPutRecursive" expression="''">
    <int:poller fixed-rate="1000" max-messages-per-poll="10" />
</int:inbound-channel-adapter>

    <int:channel id="inboundMGetRecursive" />

    <int-sftp:outbound-gateway session-factory="sftpSessionFactory"
        request-channel="inboundMGetRecursive" command="mget" expression="payload"
        mode="REPLACE" command-options="-R"

        local-directory-expression="@sftpServerConfig.targetLocalDirectory+ #remoteDirectory"

        reply-channel="outputmget">
<!-- local-filename-generator-expression="#remoteFileName.replaceFirst('sftpSource', 'localTarget')" -->

    </int-sftp:outbound-gateway>

    <int:channel id="inboundMPutRecursive" />

    <int-sftp:outbound-gateway session-factory="sftpSessionFactory"
        request-channel="inboundMPutRecursive" command="mput" command-options="-R"
        auto-create-directory="true" filename-pattern="*.txt" expression="payload"
        local-directory="@SftpServerConfig.mPutLocalDir+'/'"
        remote-directory="sftpTarget" reply-channel="outputmput">

    </int-sftp:outbound-gateway>

</beans>

**Javafile:SftpConfigurator.java**

package com.iux.ieg.sftp;

import java.io.File;

/**

 */
public class SftpConfigurator  {

    private volatile File targetSftpDirectory;

    private volatile File sourceLocalDirectory;

    private volatile File targetLocalDirectory;
    private volatile File mPutLocalDir;

    public File getmPutLocalDir() {
        return mPutLocalDir;
    }

    public void setmPutLocalDir(File mPutLocalDir) {
        this.mPutLocalDir = mPutLocalDir;
    }

    public File getTargetLocalDirectory() {
        return targetLocalDirectory;
    }

    public void setTargetLocalDirectory(File targetLocalDirectory) {
        this.targetLocalDirectory = targetLocalDirectory;
    }

    public File getTargetSftpDirectory() {
        return targetSftpDirectory;
    }

    public void setTargetSftpDirectory(File targetSftpDirectory) {
        this.targetSftpDirectory = targetSftpDirectory;
    }

    public File getSourceLocalDirectory() {
        return sourceLocalDirectory;
    }

    public void setSourceLocalDirectory(File sourceLocalDirectory) {
        this.sourceLocalDirectory = sourceLocalDirectory;
    }

    public SftpConfigurator() {
        this.targetSftpDirectory = new File("/u01/IIP/iipuser/Java/test1") ;
        this.sourceLocalDirectory = new File("D:\\sourceforsftp");
        this.targetLocalDirectory = new File("D:\\sftplocalfolder");
        this.mPutLocalDir=new File("D:\\sourceforsftp");
    }

}

A: It is not at all clear what you are asking. Phrases like "some junk" are useless. You should be able to debug this application by turning on DEBUG logging and track the messages through the flow.

A: MPUT is end-user operation. What is the reason of inbound-channel-adapter for such an operation? You should send local directory as a message payload to PUT all files to the SFTP. Right now your config does not make sence.


text:
Q: Java Socket request handling I'm attempting to write a simple file transfer program using the Java Socket and ServerSocket libraries.  I've used these libraries successfully once before, but in this case I seem to have a problem getting the server side to slow down long enough once the connection is made in order for the client side to make a request.  The problem appears to be happening as the main method on the server side enters the second while loop, calls handleRequest(), and once in handleRequest(), throws a SocketExeption error when it tries to read in the client's request. The program does not pause long enough to allow the user on the client side to send a request. I've tried moving code around within the main's second while loop to no avail.  Any help in getting the server side to slow down and listen would be greatly appreciated.  Thanks!
Edit:
Here's the exceptions thrown:
Exception in thread "main" java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(Unknown Source)
    at java.net.SocketInputStream.read(Unknown Source)
    at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
    at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
    at sun.nio.cs.StreamDecoder.read(Unknown Source)
    at java.io.InputStreamReader.read(Unknown Source)
    at java.io.BufferedReader.fill(Unknown Source)
    at java.io.BufferedReader.readLine(Unknown Source)
    at java.io.BufferedReader.readLine(Unknown Source)
    at FTServe.handleRequest(FTServe.java:92)
    at FTServe.main(FTServe.java:218)

End Edit
Here's my code:
Server side
import java.net.*;
import java.io.*;

public class FTServe {
    BufferedReader stdIn;
    static BufferedReader in = null;
    static PrintWriter out = null;
    static ServerSocket serverSocket;

    FTServe() {
    }

    /**********************************************************
     * Desc: starts on host A, validates the parameter, and waits on port
     * 30021 for client request
     * Parameters:
     * Returns:
     * @param portNum
     **********************************************************
     */
    private Socket startUp(int portNum) throws IOException {
        serverSocket = null;
        Socket clientSocket = null;

        //server to listen on port 30021
        //ftserve starts on host A, and validates the command-line parameters.

        try {
            serverSocket = new ServerSocket(portNum);
            System.out.println("Waiting for client....");
        } catch (IOException e) {
            System.err.println("Could not listen on port: " + portNum);
            System.exit(1);
        }

        //waits for client message and accepts connection (client IP address and port)
        try {
            clientSocket = serverSocket.accept();
        } catch (IOException e) {
            System.err.println("Accept failed.");
            System.exit(1);
        }
        return clientSocket;
    }

    /**********************************************************
     * Desc: accepts, interprets and handles client requests
     * Parameters:
     * Returns:
     * @param server
     * @param server
     * @throws IOException
     **********************************************************
     */
    public static void handleRequest(FTServe server) throws IOException {

        Socket dataSocket = null;
        String message = in.readLine();
        if (message != null) {
            if (message.equalsIgnoreCase("list")) {
                int portNum = 30020;
                dataSocket = server.startUp(portNum);
                sendDirectory();
            }
            else if (message.contains("get <")) {
                int j = 0;
                String requestedFile = null;
                char letter;
                String prefix = "get <";
                requestedFile = message.substring(message.indexOf(prefix + prefix.length(), message.length()-2));
                //open port 30020 to send data to client
                dataSocket = server.startUp(30020);
                sendFile(dataSocket, requestedFile);
            }
            else {
                out.println("Invalid command. Please enter 'list' or 'get <filename>:  ");
            }

            dataSocket.close();
        }
    }

    /**********************************************************
     * Desc: sends list of files in directory to client
     * Parameter: String requestedFile, Socket dataSocket
     * Returns:
     * @param dataSocket
     * @param requestedFile
     * @throws IOException
     **********************************************************
     */
    private static void sendDirectory() {
        String path = new File(".").getAbsolutePath();
        File dir = new File(path);
        File[] listFiles = dir.listFiles();

        for (int i = 0; i < listFiles.length; i++) {
            if (listFiles[i].isFile()) {
                String fileName = listFiles[i].getName();
                out.print(fileName + "     ");
            }
        }
    }

    /**********************************************************
     * Desc: sends file to client on port 30020
     * Parameter: String requestedFile, Socket dataSocket
     * Returns:
     * @param dataSocket
     * @param requestedFile
     * @throws IOException
     **********************************************************
     */
    private static void sendFile(Socket dataSocket, String requestedFile) throws IOException {
        File sendFile = new File(requestedFile);
        if (sendFile.isFile()){
            byte[] fileByteArray = new byte[(int) requestedFile.length()];

            FileInputStream fis = new FileInputStream(requestedFile);
            BufferedInputStream bis = new BufferedInputStream(fis);

            DataInputStream dis = new DataInputStream(bis);
            dis.readFully(fileByteArray, 0, fileByteArray.length);

            //opens output stream and sends file info and file to the client
            OutputStream os = dataSocket.getOutputStream();
            DataOutputStream dos = new DataOutputStream(os);
            dos.writeUTF(sendFile.getName());
            dos.writeLong(fileByteArray.length);
            dos.write(fileByteArray, 0, fileByteArray.length);
            dos.flush();
        }
        else out.println("That is not a valid filename.");
    }

    /***********************************************************
     * Desc: closes server socket
     * Parameter: serverSocket
     **********************************************************
     */
    private void closeSocket(ServerSocket serverSocket) throws IOException {
        serverSocket.close();
    }

    /***********************************************************
     * Desc: Main method
     **********************************************************
     */
    public static void main(String[] args) throws IOException {
        int goodbye = 0; //if goodbye == 1, close client connection; if goodbye == -1, close server socket

        while (goodbye != -1) {
            goodbye = 0;
            FTServe server = new FTServe();
            Socket socket = null;
            int portNum = 30021;

            socket = server.startUp(portNum);

            String message;

            System.out.println("When you wish to disconnect from client, simply enter 'bye'. \nTo close socket, enter 'exit'.");
            BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));

            System.out.println("Connection from " + socket.getLocalAddress().getHostName() + " successful.  \n\nWaiting on client...");

            //gets inputs and outputs from client
            out = new PrintWriter(socket.getOutputStream(), true);
            in = new BufferedReader(new InputStreamReader(socket.getInputStream()));

            while (goodbye == 0) {

                server.handleRequest(server);

                //close connection to client if goodbye == 1 because server entered bye
                if (goodbye == 1) {
                    System.out.println("Connection to client closing...");
                    out.println("Connection to client closing...Goodbye");
                    in.close();
                    out.close();
                    socket.close();
                    server.closeSocket(serverSocket);
                }
            }

            //server.startUp();
            System.out.println("Enter 'exit' to close, else enter 'go' to continue listening for client. When server is listening, Ctrl-C will end program");
            System.out.print("Server> ");
            if (stdIn.readLine().equals("exit")) {
                server.closeSocket(serverSocket);
                goodbye = -1;
            }
        }

        System.out.println("The program is closing. Goodbye!");
    }
}

Client side
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;

public class FTClient {

    static BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
    static PrintWriter out = null;
    static BufferedReader in = null;
    FTClient() {
    }

    /**********************************************************
     * Desc: initiates contact with server
     * Parameter: iPadd == server IP address, portNum == server port
     * Returns: Client socket
     **********************************************************
     */
    private Socket initiateContact (String iPadd, int portNum) throws IOException {
        Socket clientSocket = null;
        //ftclient starts on host B, and validates the command-line parameters.
        try {
            //create connection between client and server
            clientSocket = new Socket(iPadd, portNum);
        } catch (UnknownHostException e) {
            System.err.println("Don't know about host: " + iPadd + ".");
            System.exit(1);
        } catch (IOException e) {
            System.err.println("Couldn't get I/O for the connection to: " + iPadd + ".");
            System.exit(1);
        }
        return clientSocket;
    }

    /**********************************************************
     *Desc: sends client message to server
     *Parameter: String msg
     *Returns: Boolean true if client message == bye, else false
     **********************************************************
     */
    private boolean sendMessage(String fromUser) throws IOException {

        if (fromUser.equals("bye")) {
            out.println("Client> " + fromUser);
            return true;
        }
        else if (fromUser != null) out.println("Client> " + fromUser);
        return false;
    }

    /**********************************************************
     * Desc: sends client command: 'list or get <filename>'
     * Parameters:
     * Returns:
     * @param request
     * @return
     * @throws IOException
     **********************************************************
     */
    private boolean makeRequest(String request) throws IOException {
        //ftclient sends a command (list  or get <filename>) on connection to port 30020.
        if (request.equals("bye")) {
            out.println(request);
            return true;
        }
        else if (request != null) out.println(request);
        return false;
    }

    /**********************************************************
     * Desc: saves the file in the current default directory (handling "duplicate file name" error if necessary),
     * and displays a "transfer complete" message on-screen or sends an appropriate error message
     * ("File not found", etc.) to ftclient on connection P, and ftclient displays the message on-screen.
     * Parameters:
     * Returns:
     * @return
     * @throws IOException
     **********************************************************
     */
    private void receiveFile()
    {
        //code remains to be written
    }

    /**
     * @param args
     * @throws IOException
     */
    public static void main(String[] args) throws IOException {
        FTClient client = new FTClient();
        boolean goodbye = false;
        Socket socket, datasocket;
        String iPadd = args[0];
        String port = args[1];
        int portNum = Integer.parseInt(port);

        //initate contact with server
        socket = client.initiateContact(iPadd, portNum);

        System.out.println("When you wish to exit, simply enter 'bye'.");

        out = new PrintWriter(socket.getOutputStream(), true);
        in = new BufferedReader(new InputStreamReader(socket.getInputStream()));

        //client sends request, then initiates contact with data socket to receive data
        while (!goodbye) {
            System.out.println("Server> Enter 'list' to display a directory of files. \nEnter 'get <filename>' to retrieve a file.  " +
                    "\nPlease enter a command: ");
            String request = stdIn.readLine();
            goodbye = client.makeRequest(request);
            int dataPort = 30020;
            Socket dataSocket = client.initiateContact(iPadd, dataPort);
            client.receiveFile();

        }

    }

}

A: You are trying to create a serversocket everytime.
What you should be doing is on start up create a thread to handle socket acceptances.
The thread that handles acceptances should then hand off any client to another thread.
something like
public ServerSocketProcessor implements Runnable{

    private boolean execute;
    private int commandPortNumber;
    private int dataPortNumber;

    public ServerSocketProcessor(int commandPortNumber, int dataPortNumber, SocketHandler socketHandler){
        this.commandPortNumber= commandPortNumber;
        this.dataPortNumber= dataPortNumber;
        this.socketHandler = socketHandler;
    }

    public void run(){
        this.execute = true;
        try{
           // only ever want one server socket and keep it running for lifetime
           // of your program
           ServerSocket commandServerSocket = new ServerSocket(this.commandPortNumber);
           ServerSocket dataServerSocket = new ServerSocket(this.dataPortNumber);
           try {
               // keep running until another process says to stop
               while(this.execute){
                   // accept will cause the server socket to wait until
                   // a connection is made
                   Socket commandSocket = commandServerSocket .accept();
                   // handle new connection then go back to waiting for a new
                   // connection.
                   Socket dataSocket = dataServerSocket.accept();
                   socketHandler.handle(commandSocket, dataSocket);
               }
           } finally{
               serverSocket.close();
           }
        } catch (exception e){
            // do something
        }
    }

}

SocketHandler just creates threads to handle the incoming connection
public class SocketHandler{

    public void handle(Socket commandSocket, Socket dataSocket){
         // create thread to handle socket
    }

}

client side
public static void main(String[] args) throws IOException {
    FTClient client = new FTClient();
    boolean goodbye = false;
    Socket socket, datasocket;
    String iPadd = "127.0.0.1";
    String port = "30021";
    int portNum = Integer.parseInt(port);

    //initate contact with server
    socket = client.initiateContact(iPadd, portNum);

    System.out.println("When you wish to exit, simply enter 'bye'.");

    out = new PrintWriter(socket.getOutputStream(), true);
    in = new BufferedReader(new InputStreamReader(socket.getInputStream()));

    //client sends request, then initiates contact with data socket to receive data
    while (!goodbye) {
      System.out.println("Server> Enter 'list' to display a directory of files. \nEnter 'get <filename>' to retrieve a file.  " +
              "\nPlease enter a command: ");
      String request = stdIn.readLine();
      goodbye = client.makeRequest(request);
    }
    client.cleanUp(); // in this you should close any datastreams and close the socket

  }


text:
Q: How to manage and reference multiple artifact repositories in argo workflow I have multiple artifact repositories and have them configured in the configMap, like:
apiVersion: v1
kind: ConfigMap
metadata:
  name: artifact-repositories
data:
  bucket1: |
    s3:
      endpoint: ...
      bucket: bucket1
      accessKeySecret:
        ...
      secretKeySecret:
        ...

  bucket2: |
    s3:
      endpoint: ...
      bucket: bucket2
      accessKeySecret:
        ...
      secretKeySecret:
        ...

Then, I want to reference them in a key-only way in the same workflow :
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: artifact-
spec:
  entrypoint: main

  artifactRepositoryRef:
    configMap: artifact-repositories
    key: bucket1

  templates:
  - name: main
    steps:
    - - name: step1
        template: step1
    - - name: step2
        template: step2

  - name: step1
    container:
      ...
    outputs:
      artifacts:
        - name: art-output
          path: /tmp/s1.txt
          s3:   # use bucket1 through artifactRepositoryRef
            key: argo/s1.txt

  - name: step2
    container:
      ...
    outputs:
      artifacts:
        - name: art-output
          path: /tmp/s2.txt
          s3:
            # how to use bucket2 in a key-only way
            key: argo/s2.txt

artifactRepositoryRef can only reference one artifact repository,  how to reference another artifact repository in a concise way ?


text:
Q: Как совместить 2 блока в один Как совместить 2 блока в один по содержанию, как показано в примере, в блоках с классом index есть первые div-ы с одинаковой информацией, нужно сделать так, чтобы все такие одинаковые по первому диву блоки совмещались в 1

cont

information1.0

information1.2

cont

information2.0

information2.2

payment

information3.0

information3.2

итог:

cont

information1.0

information1.2

information2.0

information2.2

payment

information3.0

information3.2

  </div

A: Добавил для наглядности пару блоков:

function FusionBySameCaption(selector) {
  let children = document.querySelector(selector).parentElement.children;
  let index = 0;
  while (index < children.length) {
    let child = children[index];
    let text = child.querySelector('div:first-of-type > p').textContent;
    let i = index++;
    while (children[++i]) {
      let sibling = children[i];
      if (text == sibling.querySelector('div:first-of-type > p').textContent) {
        sibling.firstElementChild.remove();
        child.insertAdjacentHTML('beforeEnd', sibling.innerHTML);
        sibling.remove();
        i--;
      }
    }
  }
}

FusionBySameCaption('[class^="index"]');
/* For example only --> */ [class^="index"]{margin:8px 0;padding:1px;box-shadow:0 0 2px 2px #f00}[class^="index"] p{margin:1px;box-shadow:inset 0 0 2px 2px #00f}

test

information 5.0

information 5.2

cont

information 1.0

information 1.2

payment

information 3.0

information 3.2

cont

information 2.0

information 2.2

payment

information 4.0

information 4.2

test

information 6.0

information 6.2

test

information 7.0

information 7.2

test

information 8.0

information 8.2

test

information 9.0

information 9.2

payment

information 10.0

information 10.2

payment

information 11.0

information 11.2

cont

information 12.0

information 12.2


text:
Q: how can I solve "TypeError ufunc 'isfinite'" in jupyter notebook I have a error about type. it comes from the stocker. I dont't know where the code error
the environment:
python 3.7
numpy and others libray are latest
TypeError                                 Traceback (most recent call last)
<ipython-input-6-00eba8b188be> in <module>
----> 3 amazon.changepoint_prior_analysis(changepoint_priors=[0.001, 0.01, 0.06, 0.2])

~\Desktop\master\stocker.py in changepoint_prior_analysis(self, changepoint_priors, colors)
    427             ax.fill_between(predictions['ds'].dt.to_pydatetime(), predictions['%.3f_yhat_upper' % prior],
    428                             predictions['%.3f_yhat_lower' % prior], facecolor = color_dict[prior],
--> 429                             alpha = 0.3, edgecolor = 'k', linewidth = 0.6)
    430
    431         # Plot labels

~\AppData\Roaming\Python\Python37\site-packages\matplotlib\__init__.py in inner(ax, data, *args, **kwargs)
   1599     def inner(ax, *args, data=None, **kwargs):
   1600         if data is None:
-> 1601             return func(ax, *map(sanitize_sequence, args), **kwargs)
   1602
   1603         bound = new_sig.bind(ax, *args, **kwargs)

~\AppData\Roaming\Python\Python37\site-packages\matplotlib\axes\_axes.py in fill_between(self, x, y1, y2, where, interpolate, step, **kwargs)
   5222
   5223         # Convert the arrays so we can work with them
-> 5224         x = ma.masked_invalid(self.convert_xunits(x))
   5225         y1 = ma.masked_invalid(self.convert_yunits(y1))
   5226         y2 = ma.masked_invalid(self.convert_yunits(y2))

~\AppData\Roaming\Python\Python37\site-packages\numpy\ma\core.py in masked_invalid(a, copy)
   2364         cls = type(a)
   2365     else:
-> 2366         condition = ~(np.isfinite(a))
   2367         cls = MaskedArray
   2368     result = a.view(cls)

TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

I expect to show the complete chart,but now the actual lack some events.

A: A similar problem I encountered long back. I'm sharing the links. Hope so it would be helpful for you.Link1
link2


text:
Q: How to add a line in a text file without overwriting it (JAVA)? My data is stored in an ArrayList whose size increases during program execution.
I managed to save all the data whenever the size increases, but this brings me to overwrite the data already stored.
The solution is to go directly to the bottom line and insert the contents of the last cell of ArrayList. Unfortunately I do not know how to implement it.
Thank you for helping me to do this.
Below is the method I used.
private void SaveLocationData(){
    try {

        FileOutputStream output = openFileOutput("latlngpoints.txt",Context.MODE_PRIVATE);
        DataOutputStream dout = new DataOutputStream(output);
        dout.writeInt(LocationList.size());
        for (Location location : LocationList) {
            dout.writeUTF(location.getLatitude() + "," + location.getLongitude());
        }
        dout.flush(); // Flush stream ...
        dout.close(); // ... and close.
    } catch (IOException exc) {
        exc.printStackTrace();
    }
}

A: Use MODE_APPEND:
 FileOutputStream output = openFileOutput("latlngpoints.txt",Context.MODE_APPEND);

From the doc:

File creation mode: for use with openFileOutput(String, int), if the
  file already exists then write data to the end of the existing file
  instead of erasing it.

A: You can try this too
        FileWriter fstream = new FileWriter("x.txt",true); //this will allow to append
        BufferedWriter fbw = new BufferedWriter(fstream);
        fbw.write("append txt...");
        fbw.newLine();
        fbw.close();


text:
Q: Keycloak Infinispan cache replication is not working Infinispan isn't replicating caches across the cluster; the user is asked to login again when Keycloak on any node in the cluster isn't healthy. Can you please help point out what we are doing wrong?
We followed the documentation for Keycloak Infinispan setup (https://www.keycloak.org/docs/latest/server_installation/#sticky-sessions) and set the owners for all caches to 3. Below is an example excerpt of our cache owner setup (domain/configuration/domain.xml)
<subsystem xmlns="urn:jboss:domain:infinispan:11.0">
   <cache-container name="keycloak">
       <distributed-cache name="sessions" owners="3"/>
...

Details about our Keycloak setup

*

*Domain clustered mode

*1 primary, 2 secondary

*Hosted on AWS and ALB has sticky session enabled.

Any help is appreciated.


text:
Q: How to Revit export PDF by DesignAutomationV3 (Forge API) I try your code to export DWGs in blog Autodesk Forge. It is work very well, I get a zip with files dwgs. Now i try to export PDF but it not work, i just get a zip with no things. I think it problem maybe from Print Settings of Revit Sandbox. Please help me

A: Do you mean you reference this blog?
After you successfully got the zip package of dwgs by calling Revit Design Automation Activity, you need to unzip the package, and then iterate each of the DWG file to call another AutoCAD Design Automation Activity which will convert the DWG file to PDF. You have to define the AutoCAD Design Automation Activity to convert DWG to PDF.

A: Design Automation For Revit doesn't support PDF export currently. It is not a problem from Print Settings of Revit Sandbox.
You can use the way mentioned by @Zhong Wu above to generate PDF.


text:
Q: I have to shorten my dropdown length of spinner Here is code.
public class QuotesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

private static final int PRICE_PICKER_MAX_VALUE = 1000000;
private static final int PRICE_PICKER_MIN_VALUE = 500;
private static final int PRICE_PICKER_INTERVAL_VALUE = 500;
private List<Quote> mQuotes;
private String[] mPickerValues;
private String mSelectedQuotePrice;
private OnQuoteActionListener mListener;
private Context mContext;

/**
 * @param context      a context
 * @param quotes the data for this adapter
 */
public QuotesAdapter(Context context, List<Quote> quotes) {
    mContext = context;
    mQuotes = quotes;
}

private String[] getArrayWithSteps (int iMaxValue, int iMinValue, int iStep) {
    int iStepsArray = (iMaxValue-iMinValue)/iStep+1; //get the lenght array that will return

    String[] arrayValues= new String[iStepsArray]; //Create array with length of iStepsArray

    for(int i = 0; i < iStepsArray; i++) {
        arrayValues[i] = String.valueOf(iMinValue + (i*iStep));
    }

    return arrayValues;
}

private void setPricePickerSelection (String valueToSet, Spinner numPicker) {
    for (int i = 0; i < mPickerValues.length; i++)
        if (mPickerValues[i].equals(valueToSet)) {
            numPicker.setSelection(i, true);
        }
}

@Override
public int getItemCount() {
    return mQuotes.size();
}

@Override
public void onBindViewHolder(final RecyclerView.ViewHolder viewHolder, final int rawPosition) {

    final ItemViewHolder itemViewHolder = (ItemViewHolder) viewHolder;
    final Quote item = mQuotes.get(rawPosition);
    //Update from / to city information
    String fromCity = item.getFromCity();
    String toCity = item.getToCity();
    Typeface myFont=Typeface.createFromAsset(mContext.getAssets(), "fonts/Rajdhani-Bold.ttf");
    if (StringUtils.isNotBlank(fromCity) && StringUtils.isNotBlank(toCity)) {
        StringBuffer sb = new StringBuffer(" ").append(fromCity).append(" ");
        itemViewHolder.mFromCityView.setText(sb.toString());
        itemViewHolder.mToCityView.setText(" " + toCity);

        myFont= Typeface.createFromAsset(mContext.getAssets(), "fonts/Rajdhani-SemiBold.ttf");
        itemViewHolder.mFromCityView.setTypeface(myFont);
        itemViewHolder.mToCityView.setTypeface(myFont);
        myFont=Typeface.createFromAsset(mContext.getAssets(), "fonts/Rajdhani-Medium.ttf");
        itemViewHolder.mToCityTitleView.setTypeface(myFont);
        itemViewHolder.mFromCityTitleView.setTypeface(myFont);

        ViewUtils.setMultipleToVisible(itemViewHolder.mFromCityView, itemViewHolder.mToCityView, itemViewHolder.mFromCityTitleView, itemViewHolder.mToCityTitleView);

    } else {
        ViewUtils.setMultipleToGone(itemViewHolder.mFromCityView, itemViewHolder.mToCityView, itemViewHolder.mFromCityTitleView, itemViewHolder.mToCityTitleView);
    }
    //Update the Logistics Company name
    itemViewHolder.mCompanyView.setText(item.getLogisticsCompanyName());
    myFont=Typeface.createFromAsset(mContext.getAssets(), "fonts/Rajdhani-Bold.ttf");
    itemViewHolder.mCompanyView.setTypeface(myFont);

    myFont=Typeface.createFromAsset(mContext.getAssets(), "fonts/Rajdhani-Medium.ttf");
     itemViewHolder.mRequestDateView.setText(item.getRequestDate());
    itemViewHolder.mCloesByView.setText(item.getRequestEndDate());
    itemViewHolder.mTruckType.setText(item.getTruckType());
    itemViewHolder.mCapacity.setText(item.getCapacity() + "");
    itemViewHolder.mRequestDateView.setTypeface(myFont);
    itemViewHolder.mCloesByView.setTypeface(myFont);
    itemViewHolder.mTruckType.setTypeface(myFont);
    itemViewHolder.mCapacity.setTypeface(myFont);

    int price = item.getMoney();
    //Load the picker values in defined intervals
    mPickerValues = getArrayWithSteps(PRICE_PICKER_MAX_VALUE, PRICE_PICKER_MIN_VALUE, PRICE_PICKER_INTERVAL_VALUE);
    // Creating adapter for truck options spinner
    ArrayAdapter<String> quotePriceOptionsAdapter = new ArrayAdapter<String>(mContext,
            android.R.layout.simple_spinner_dropdown_item, mPickerValues);
    // attaching data adapter to spinner
    itemViewHolder.mPricePicker.setAdapter(quotePriceOptionsAdapter);
    setPricePickerSelection(String.valueOf(price), itemViewHolder.mPricePicker);

    itemViewHolder.mPricePicker.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            int selectedQuotePricePosition = parent.getSelectedItemPosition();
            mSelectedQuotePrice = mPickerValues[selectedQuotePricePosition];
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {

        }
    });

    itemViewHolder.mIgnoreQuoteView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mListener != null) {
                mListener.onIgnore(item.getRequestID());
            }
        }
    });

    itemViewHolder.mQuoteButtonView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mListener != null) {
                item.setMoney(Integer.parseInt(mSelectedQuotePrice));
                mListener.onQuote(item);
            }
        }
    });
}

@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.row_quote_item,
            parent, false);
    return new ItemViewHolder(view);
}

public void setQuoteActionListener(OnQuoteActionListener listener) {
    mListener = listener;
}

public interface OnQuoteActionListener {

    public void onQuote(Quote quote);
    public void onIgnore(int requestID);
}

public static class ItemViewHolder extends RecyclerView.ViewHolder {
    public TextView mFromCityTitleView ;
    public TextView mFromCityView;
    public TextView mToCityView;
    public TextView mToCityTitleView;
    public TextView mCompanyView ;
    public TextView mRequestDateView;
    public TextView mCloesByView;
    public TextView mTruckType;
    public TextView mCapacity;
    public Button mQuoteButtonView;
    public Button mIgnoreQuoteView;
    public Spinner mPricePicker;

    public ItemViewHolder(View v) {
        super(v);
        mFromCityTitleView = (TextView) v.findViewById(R.id.quote_item_from);
        mFromCityView = (TextView) v.findViewById(R.id.quote_item_fromcity);
        mToCityTitleView = (TextView) v.findViewById(R.id.quote_item_to);
        mToCityView = (TextView) v.findViewById(R.id.quote_item_tocity);
        mCompanyView = (TextView) v.findViewById(R.id.quote_company);
        mRequestDateView = (TextView) v.findViewById(R.id.quote_item_requestedDate);
        mCloesByView = (TextView) v.findViewById(R.id.quote_item_closesby);
        mTruckType = (TextView)  v.findViewById(R.id.quote_item_truck_type);
        mCapacity  =  (TextView) v.findViewById(R.id.quote_item_capacity);
        mQuoteButtonView = (Button) v.findViewById(R.id.button_quote);
        mIgnoreQuoteView = (Button) v.findViewById(R.id.button_ignore);
        mPricePicker = (Spinner) v.findViewById(R.id.quote_pricePicker);
    }
}
}`

Screenshot
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:layout_gravity="center"
    android:background="@color/back_white"
    android:orientation="horizontal">
    <Spinner
        android:id="@+id/quote_pricePicker"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:gravity="left"/>
    </LinearLayout>

A: While Creating Adapter for your Spinner give custom layout instead of predefined one
Create xml named spinner_row.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
 android:id="@+id/cust_view"
    android:layout_width="match_parent"
    android:textColor="@color/black"
    android:textSize="12sp"
    android:layout_height="36dp"
    android:gravity="left|center_vertical"/>

Here you can change the color Text size and width and height of the Elements in the spinner by modifying this textview
Use it like this while creating Adapter
ArrayAdapter<String> adapter=new ArrayAdapter<String>(context, R.layout.spinner_row,yourlist);

The Last task is routine
spinner.setAdapter(adapter);

I hope this will help you.


text:
Q: DC unregulated power supply I want to make a 70 VDC power supply, output unregulated with +/- 10V variation allowed.
I also want 50 A current from it.
My input can be 3-phase 380 V mains supply.
I cannot think of a 3-phase transformer for this power supply that can give me 70 VAC at the output. How is it possible to wind this type of transformer?

A: For a 70 V DC supply with a capacitor filter, the AC RMS voltage should be about 52 volts. If you use a 48 volt transformer, that would provide about 65 volts allowing for voltage drop in the 3-phase bridge. It is certainly possible to wind a transformer for the voltage that you need.
Rather than power factor correction, you might want to consider harmonic current reduction. Harmonic currents cause reduction in power factor, but the correction method is different.


text:
Q: How can a JSON_VALUE be converted to a DateTime with EF Core 2.2? I am mapping JSON_VALUE using the technique from How to write DbFunction's translation. Since not all values in the JSON are strings, conversion is sometimes necessary.
When converting to int, everything is fine:
var results = context.Set<SampleTable>()
    .Where(t1 => Convert.ToInt32(
        JsonExtensions.JsonValue(t1.SampleJson, "$.samplePath.sampleInt")) > 1);
    .ToList();

The resulting SQL is:
SELECT *
FROM [SampleTable] AS [t1]
WHERE (CONVERT(int, JSON_VALUE([t1].[SampleJson], N'$.samplePath.sampleInt')) > 1)

However, when converting to DateTime, it doesn't work:
DateTime date = new DateTime(2019, 6, 1);
var results = context.Set<SampleTable>()
    .Where(t1 => Convert.ToDateTime(
        JsonExtensions.JsonValue(t1.SampleJson, "$.samplePath.sampleDate")) >= date);
    .ToList();

Instead of being mapped, JsonValue is called directly, which leads to the following exception:

System.NotSupportedException
    HResult=0x80131515
    Message=Specified method is not supported.
    StackTrace:
     at JsonExtensions.JsonValue(String column, String path)
     at System.Linq.Enumerable.WhereEnumerableIterator1.MoveNext()
     at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.<_TrackEntities>d__172.MoveNext()
     at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext()

Why is DateTime behaving differently than int? What can I do to make DateTime work correctly?

A: The problem is that not all Convert method are supported.
In fact none of them are standardly supported - EF Core allows database providers to add CLR method and member translators for whatever they like. For instance SqlServer provider currently supports ToByte, ToDecimal, ToDouble, ToInt16, ToInt32, ToInt64 and ToString.
This means there is no database agnostic way of performing server side conversions.
Since you seem to be using SqlServer, as workaround I could suggest utilizing the implicit data conversions (currently supported by SqlServer provider) by using the "double cast" technique from my answer to a similar post, e.g.
.Where(t1 => (DateTime)(object)JsonExtensions.JsonValue(t1.SampleJson, "$.samplePath.sampleDate") >= date);

(object) cast is used to avoid the C# compiler error. During the query translation, both casts will be removed and the SQL Server implicit data conversion will eventually do the job.


text:
Q: How do I use Emacs character classes in a regular expression? The Emacs documentation has a section on character classes. According to the manual, [:digit:] should match any digit character. I've tried that using re-builder but they never match, even though [0-9] matches.
How do I use character classes in an Emacs regex?

A: I figured it out. The documentation is actually explicit:

Here is a table of the classes you can use in a character alternative

So [[:digit:]] is the right way to use character classes.


text:
Q: Event examples? I do not understand fully when Events should be used and therefore I believe there is a big gap in my toolkit.  I started with a company three years ago and not a single .NET declares a single event.
I have read plenty of literature on the subject e.g. here: http://bytes.com/topic/visual-basic-net/answers/381790-why-use-events and here When to use events? and I am able to use them.  However, I don't understand when I should use them.
I realise events follow the Observer pattern and the Observer pattern helps with loosely coupled code.  I am looking for a commercial example of an event.  I am looking for explanations rather than code.
I notice that the following Observer example does not use events: http://www.dofactory.com/Patterns/Patterns.aspx.

A: A good example of when events are useful is if you have a user control that is hosted inside of an .aspx page.
Let's pretend that I have a user control that displays the details of a person. The user control has the fields relevant to a person, such as name, age, gender, etc. This user control could be hosted in several pages (i.e. Page1.aspx, Page2.aspx, etc.). At the bottom of the user control is a save button, when that button is clicked, I want a message displayed at the top of my .aspx page that says something along the lines of "Person successfully updated.".
Without events, the user control would need to know which page was hosting it so it could tell the page that it needs to update the text of a label to display at the top of the page. This works fine if you just want to use the user control with this one page, this is called tight coupling. Now what if I want to use the user control on another .aspx page; uh oh the "Person successfully updated" message is hard-wired to the "old" page and does not work.
Enter events. Within the user control I can define an event that can be raised by the user control at the appropriate time, in this example's case when the save button is clicked.
Meanwhile back in the .aspx page, it needs a way to say I want to be informed of events raised by the user control, so it subscribes to the user control's event via the reference it has to the user control itself. Now when the event is raised by the user control, the page reacts and does whatever it needs. Any page that uses this user control can choose to subscribe or ignore the events raised by the user control and can perform different logic based upon the event being raised. For instance, another page could display a message and also log the successful update of the information.
In short, events provide a conduit for information to pass through from one component (user control) to another (page) without both sides needing to know of each other's existence. This allows for the user control to be independent of the .aspx page, but still be able to provide information to it, if it (the page) chooses to care about that information.


text:
Q: Generate Picking from invoice openerp I want to make a order picking_out of the invoice  in the openerp
I found this https://www.odoo.com/apps/modules/7.0/picking_from_invoice/
But they do create every item in a delivery order
Is there a solution of his own
this the code for fonction
class picking_from_invoice(osv.TransientModel):

_name = 'picking.from.invoice'
_columns = {
    'invoice_ids': fields.many2many('account.invoice', 'invoice_rel',
        'invoice1', 'invoice2', 'Invoices',
        help="Select the invoices to account move cancel"),

}

def generate_picking(self, cr, uid, ids, context=None):
    if context is None:
        context = {}
    warehouse_obj = self.pool.get('stock.warehouse')
    company_id = self.pool.get('res.company')._company_default_get(
        cr, uid, 'picking.from.invoice', context=context)
    ware_ids = warehouse_obj.search(cr, uid, [(
        'company_id', '=', company_id)], context=context)
    if not ware_ids:
        raise osv.except_osv(_('Invalid action !'), _(
            'You cannot  create picking because you not\
            have a warehouse!'))
    ware_brw = ware_ids and warehouse_obj.browse(
        cr, uid, ware_ids[0], context=context) or False
    wzr_brw = self.browse(cr, uid, ids, context=context)[0]
    for invoice in wzr_brw.invoice_ids:
        for line in invoice.invoice_line:
            if invoice.type in ('in_invoice', 'out_invoice'):
                pick_name = self.pool.get('ir.sequence').get(cr,
                            uid, 'stock.picking.%s' % (invoice and
                                  invoice.type == 'in_invoice' and
                                  'in' or invoice.type == 'out_invoice' and
                                  'out'))
                picking_id = self.pool.get('stock.picking').create(cr, uid, {
                    'name': pick_name,
                    'origin': invoice.name,
                    'type': invoice and
                    invoice.type == 'in_invoice' and
                                    'in' or invoice.type == 'out_invoice'
                                    and 'out',
                    'state': 'auto',
                    'move_type': 'direct',
                    'note': invoice.comment,
                    'invoice_state': 'invoiced',
                    'company_id': invoice.company_id.id,
                })
                move_id = self.pool.get('stock.move').create(cr, uid, {
                    'name': line.name[:64],
                    'picking_id': picking_id,
                    'product_id': line.product_id.id,
                    'date': invoice.date_invoice,
                    'date_expected': invoice.date_invoice,
                    'product_uom': line.uos_id.id,
                    'product_qty': line.quantity,
                    'product_uos': line.uos_id and line.uos_id.id,
                    'address_id': invoice.partner_id and
                    invoice.partner_id.street and
                    invoice.partner_id.street[0].id,
                    'location_id': ware_brw and ware_brw.lot_stock_id and
                    ware_brw.lot_stock_id.id,
                    'location_dest_id': ware_brw and
                    ware_brw.lot_output_id and
                    ware_brw.lot_output_id.id,
                    'tracking_id': False,
                    'state': 'draft',
                    'note': invoice.comment,
                    'partner_id': invoice.partner_id.id,
                    'company_id': invoice.company_id.id,
                })

    return {'type': 'ir.actions.act_window_close'}

A: Actually you only need to let the for loop for the invoice lines run later, like:
for invoice in wzr_brw.invoice_ids:
    if invoice.type in ('in_invoice', 'out_invoice'):
        # name...
        picking_id = self.pool.get('stock.picking').create(cr, uid, {#...
        })
        for line in invoice.invoice_line:
            move_id = self.pool.get('stock.move').create(cr, uid, {#...
            })