text:
Q: Removing the extra space from Top of BottomSheet I added bottomsheet in my application.ii work good but only problem is extra space it cover and I just want to remove those extra spaces on the top of Bottomsheet layout.
I want to remove the highlighted part:

How I can remove those extra spaces?
Here is my XML
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    android:id="@+id/coordinatorLayout"
    tools:context=".MainActivity">

    <include layout="@layout/content_main" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="true"
        android:orientation="horizontal"
        app:behavior_hideable="true"
        app:behavior_peekHeight="0dp"
        android:id="@+id/bottom_sheet"
        android:background="@android:color/white"
        app:layout_behavior="@string/bottom_sheet_behavior">

            <ImageView
                android:layout_weight="1"
                android:layout_margin="@dimen/five"
                android:padding="@dimen/ten"
                android:src="@drawable/ic_photo_camera"
                android:layout_width="@dimen/fifty"
                android:layout_height="@dimen/fifty" />

            <ImageView
                android:layout_weight="1"
                android:layout_margin="@dimen/five"
                android:padding="@dimen/ten"
                android:src="@drawable/ic_image_gallery"
                android:layout_width="@dimen/fifty"
                android:layout_height="@dimen/fifty" />

            <ImageView
                android:layout_weight="1"
                android:layout_margin="@dimen/five"
                android:padding="@dimen/ten"
                android:src="@drawable/ic_video_camera"
                android:layout_width="@dimen/fifty"
                android:layout_height="@dimen/fifty" />

            <ImageView
                android:layout_weight="1"
                android:layout_margin="@dimen/five"
                android:padding="@dimen/ten"
                android:src="@drawable/ic_video"
                android:layout_width="@dimen/fifty"
                android:layout_height="@dimen/fifty" />

    </LinearLayout>

</android.support.design.widget.CoordinatorLayout>

Here is my Java code
public class MainActivity extends AppCompatActivity {

    BottomSheetBehavior behavior;
    View bottomSheet;
    CoordinatorLayout coordinatorLayout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        coordinatorLayout = (CoordinatorLayout) findViewById(R.id.coordinatorLayout);

        bottomSheet = findViewById(R.id.bottom_sheet);
        behavior = BottomSheetBehavior.from(bottomSheet);
        behavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
            @Override
            public void onStateChanged(@NonNull View bottomSheet, int newState) {
                // React to state change
            }

            @Override
            public void onSlide(@NonNull View bottomSheet, float slideOffset) {
                // React to dragging events
            }
        });

        Button button = (Button) findViewById(R.id.button);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
            }
        });
    }

//        Snackbar.make(coordinatorLayout,item + " is selected", Snackbar.LENGTH_LONG).setAction("Action", null).show();
//        behavior.setState(BottomSheetBehavior.STATE_COLLAPSED);

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        if (ev.getAction() == MotionEvent.ACTION_DOWN) {
            if (behavior.getState()==BottomSheetBehavior.STATE_EXPANDED) {

                Rect outRect = new Rect();
                bottomSheet.getGlobalVisibleRect(outRect);

                if(!outRect.contains((int)ev.getRawX(), (int)ev.getRawY()))
                    behavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
            }
        }
        return super.dispatchTouchEvent(ev);
    }
}

A: I think I have got the answer. Just need to remove the android:fitsSystemWindows="true" from bottom_sheet i.e the LinearLayout.
Just in case I am putting the xml code below.
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    android:id="@+id/coordinatorLayout"
    tools:context=".MainActivity">

    <include layout="@layout/content_main" />

    <LinearLayout android:layout_width="match_parent"
        android:layout_height="wrap_content"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:orientation="horizontal"
        app:behavior_hideable="true"
        app:behavior_peekHeight="0dp"
        android:id="@+id/bottom_sheet"
        android:background="@android:color/holo_orange_light"
        app:layout_behavior="@string/bottom_sheet_behavior"
        xmlns:android="http://schemas.android.com/apk/res/android">

        <ImageView
            android:layout_weight="1"
            android:layout_margin="@dimen/five"
            android:padding="@dimen/ten"
            android:src="@drawable/ic_photo_camera"
            android:layout_width="@dimen/fifty"
            android:layout_height="@dimen/fifty" />

        <ImageView
            android:layout_weight="1"
            android:layout_margin="@dimen/five"
            android:padding="@dimen/ten"
            android:src="@drawable/ic_image_gallery"
            android:layout_width="@dimen/fifty"
            android:layout_height="@dimen/fifty" />

        <ImageView
            android:layout_weight="1"
            android:layout_margin="@dimen/five"
            android:padding="@dimen/ten"
            android:src="@drawable/ic_video_camera"
            android:layout_width="@dimen/fifty"
            android:layout_height="@dimen/fifty" />

        <ImageView
            android:layout_weight="1"
            android:layout_margin="@dimen/five"
            android:padding="@dimen/ten"
            android:src="@drawable/ic_video_camera"
            android:layout_width="@dimen/fifty"
            android:layout_height="@dimen/fifty" />

    </LinearLayout>
</android.support.design.widget.CoordinatorLayout>

Just for my use, I have used different drawable you need to change it back to the original one.
Hope it helps!

A:     android:fitsSystemWindows="false"

Will work!

A: I had the same problem. What worked for me was moving android:layout-behaviour from the LinearLayout to the coordinatorLayout. Or just removing it all together.


text:
Q: Is there a way in VHDL to external name reference a generic? A module lower in the hierarchy has integer generics. I want to override the generic inside this automatically generated code from my testbench by using VHDL force command. The problem is that whatever I do the simulator gives error message:
# ELAB2: Fatal Error: ELAB2_0127 W_PROBE_FPGA.vhd (136): Incorrect object class for external name: '<<probe_fpga_inst.SPRINT_PROBE_TOP_LEVEL_0.SYNTHESIZE_ACCELERATION_DAQ>>'.

I tried this code:
alias SYNTHESIZE_ACCELERATION_DAQ is <<signal probe_fpga_inst.SPRINT_PROBE_TOP_LEVEL_0.SYNTHESIZE_ACCELERATION_DAQ : integer>>;

With keywords signal, variable, constant and also empty. But none of them work. What do I do now?

A: You can see from @Tricky's response that external names are not going to get the job done.  However, you can use a configuration declaration to do it.
Configuration declarations can be hierarchical and can set generics as shown below.   Below for entity/component Block1 (whose instance label is Block1_1) the value for generic G1 is changed to NewValue.  Note for generic G2, the mapping done preserves the value.
library LIB_CHIP ;
configuration CfgLower of TbCHIP is
  for StructTb
    for CHIP_1 : CHIP
      use entity LIB_CHIP.CHIP (StructChip) ;
      for Structural
        for Block1_1 : Block1
          use entity work.Block1(RTL)
          generic map (G1 => NewValue, G2 => G2) ;
        end for ;
      end for ;
    end for ;
  end for ;
end CfgLower ;

For synthesis, you would need to "propagate up generics" by putting a lower level generic on a higher level design until you get to the level at which you are using the higher level component.
entity NextHigher is
  generic (G1 : integer ) ;
  port (...) ;
end entity NextHigher ;
architecture RTL of NextHigher is

begin
  Lower_1 : Lower
    generic map (G1 => G1) -- mapping Generic from NextHigher to Lower
    port map (. . . ) ;

  . . .
end architecture RTL ; -- NextHigher

redpajama_set_name: RedPajamaStackExchange


text:
Q: Array Implementation in Delphi xe6 I want to fill the last three Edit's with the elements of r. Somehow the value of i is not changing. Please have a look!
    procedure TForm1.Button1Click(Sender: TObject);
    var
      r: Array of Real;
      cod,h,N,code,i: Integer;
      value: Real;
    begin

      Val(Edit1.Text, cod, code);
      Val(Edit2.Text, h, code);
      Val(Edit3.Text, N, code);

      Edit1.Text := Edit1.Text;
      Edit2.Text := Edit2.Text;
      Edit3.Text := Edit3.Text;
      setlength(r, N);
      i:= 0;
      while i<= N do
         begin

          r[i] := cod/2 + h*i;
          i := i + 1;
        end;

      Edit4.Text := formatfloat('#.0', r[0]);
      Edit5.Text := formatfloat('#.0', r[1]);
      Edit6.Text := formatfloat('#.0', r[2]);
    end;

    end.

A: Your code contains a lot of useless and buggy code. So I will fix it as far I can do from the given informations. I added a prefix L to all local variables
procedure TForm1.Button1Click(Sender: TObject);
var
  Lr : Array[0..2] of Real;
  Lcod, Lh : Integer;
  LIdx : Integer;
begin

  // throws an exception if Edit1.Text cannot converted to an Integer
  Lcod := StrToInt( Edit1.Text );
  // throws an exception if Edit2.Text cannot converted to an Integer
  Lh := StrToInt( Edit2.Text );

  for LIdx := 0 to 2 do
    Lr[LIdx] := Lcod/2 + Lh*LIdx;

  Edit4.Text := FormatFloat( '#.0', Lr[0] );
  Edit5.Text := FormatFloat( '#.0', Lr[1] );
  Edit6.Text := FormatFloat( '#.0', Lr[2] );
end;


text:
Q: Using fixed elements in responsive design with only css if possible This is more a question of logic rather than technical.
I have a design where my header is fixed at the top all the time, so is the footer, but the elements inside have percentage widths so the header will change in size as the window changes.
BUT, as the header is always fixed-positioned the content below is covered by it and as I do not know the height of the header I cannot know how much padding-top I must add to the content so it won't get covered by the header.
What do you say?

A: If height goes automatically, you will need js to control it, taking the height of the fixed div and updating top margin/padding dinamically. Anyway, it would be nice if we could see an example of what you have currently


text:
Q: Hadoop mapper class not found I have developed a map-reduce program using Apache Hadoop 1.2.1.  I did the initial development using the Eclipse IDE to simulate the hadoop distributed computing environment with all the input and output files coming from my local file system.  This program will execute in Eclipse with no issues.  I then create a JAR file using Eclipse and attempt to run this on my cluster-of-one hadoop machine and receive errors:
Here's my code to set up and run the hadoop job:
String outputPath = "/output";
String hadoopInstructionsPath = args[0];

Job job = new Job();
job.setJarByClass(Main.class);  //setJarByClass is here but not found apparently?!?
job.setJobName("KLSH");

FileInputFormat.addInputPath(job, new Path(hadoopInstructionsPath));
FileOutputFormat.setOutputPath(job,new Path(outputPath));

job.setMapperClass(KLSHMapper.class);
job.setReducerClass(KLSHReducer.class);

job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Text.class);

System.exit(job.waitForCompletion(true) ? 0:1);
boolean success = job.waitForCompletion(true);
return success ? 0 : 1;

I then create a jar using eclipse using File -> Export -> Runnable JAR file to create the JAR file to run on the cluster.
The command I use to run the job is as follows  (KLSH.jar is the name of the JAR file, /hadoopInstruction is the args[0] input parameter, and imageFeature.Main/ specifies where the main class is)
./hadoop jar ./KLSH.jar /hadoopInstructions imageFeatures.Main/

This produces the following output:
14/11/12 11:11:48 WARN mapred.JobClient: Use GenericOptionsParser for parsing the arguments. Applications should implement Tool for the same.
14/11/12 11:11:48 WARN mapred.JobClient: No job jar file set.  User classes may not be found. See JobConf(Class) or JobConf#setJar(String).
14/11/12 11:11:48 INFO input.FileInputFormat: Total input paths to process : 1
14/11/12 11:11:48 INFO util.NativeCodeLoader: Loaded the native-hadoop library
14/11/12 11:11:48 WARN snappy.LoadSnappy: Snappy native library not loaded
14/11/12 11:11:49 INFO mapred.JobClient: Running job: job_201411051030_0022
14/11/12 11:11:50 INFO mapred.JobClient:  map 0% reduce 0%
14/11/12 11:11:56 INFO mapred.JobClient: Task Id : attempt_201411051030_0022_m_000000_0, Status : FAILED
java.lang.RuntimeException: java.lang.ClassNotFoundException: imageFeatures.KLSHMapper
...

So it errors out because it fails to find the mapper class.  There is the "No job jar file set" warning, but I feel like I have specified the job.setJarByClass in the first block of code, so I don't know why this error is being thrown...
I also know the KLSHMapper class is in the JAR because if I run the following command:
jar tf KLSH.jar

I get quite a lot of output, but here's a portion of the output:
...
imageFeatures/Main.class
imageFeatures/Feature.class
imageFeatures/FileLoader.class
imageFeatures/KLSHMapper.class
...

So clearly the KLSHMapper class is in there...  I've tried modifying my hadoop classpath to include the KLSH.jar path, I've tried copying the KLSH.jar onto the DFS and trying to use that path instead of the path on my local file system, and I've also tried executing the job with a -libjars specifier.  No matter what I seem to try, hadoop seems to be unable to locate my Mapper class.  Could anyone out there point me towards what I'm doing wrong?  I just can't seem to make the jump from my code working in Eclipse to making it work on an actual Hadoop cluster.  Thanks!

A: Do you have an import statement in your file somewhere:
import imageFeatures.KLSHMapper;

You'll also need to include the jar file that contains imageFeatures.KLSMapper in your CLASSPATH environment variable. This is very strange and foreign code you've got here so maybe I'm way off the mark...

A: After some additional work, I was able to solve my own problem.  Ultimately, it came down to the way I was building the jar file which I was then trying to execute on the hadoop cluster.
Instead of using eclipse to build the JAR file, I used Maven from the command line to build the JAR file.  In the pom.xml file, you can specify the main class by using something along these lines:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
    <configuration>
        <archive>
            <manifest>
                <mainClass>maxTemp.MaxTemperature</mainClass>
            </manifest>
        </archive>
    </configuration>
</plugin>

In my case, maxTemp was the package and MaxTemperature was the class that contained my main method.  This will cause the manifest file which is contained within the JAR that maven builds for you to have the following line added to it:
Main-Class: maxTemp.MaxTemperature

Now when you use hadoop to execute the jar file, you will no longer have to specify the mainClass, as you have already done so in the jar's manifest.  Without this line in the manifest of the JAR, you would need to execute your job on your cluster using this syntax:
./hadoop jarFile [mainClass] args...

With the line in the manifest file, you can just execute the job as follows:
./hadoop jarFile args...

As an aside and somewhat related, I ran into some issues becasue I was using the jeigen java library to do some linear algebra.  My cluster wasn't able to find the dependencies I had used (jeigen.jar), and it was throwing more errors.  I ended up building a fat jar, as was described on this site:
http://hadoopi.wordpress.com/2014/06/05/hadoop-add-third-party-libraries-to-mapreduce-job/
With some additions to my pom.xml file, I was able to generate a maxTemp-jar-with-dependencies, and the cluster was then able to find all my dependencies becasue they were included with the jar file.  I hope this helps save someone some time in the future.  Some of these dependencies were on my local system, and Maven wasn't able to go and get them.  I was able to point maven at them and install them manually by using the following command:
mvn install:install-file -DgroupId=jeigen -DartifactId=jeigen -Dversion=1 -Dpackaging=jar -Dfile=/path/to/the/location/of/Jeigen.jar

Here is my pom.xml file which generates two jars, one with and one without dependencies included:
<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>maxTemp</groupId>
  <artifactId>maxTemp</artifactId>
  <version>0.0.1</version>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>

      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <manifest>
              <mainClass>maxTemp.MaxTemperature</mainClass>
            </manifest>
          </archive>
        </configuration>
      </plugin>

      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
          <configuration>
            <archive>
              <manifest>
                <mainClass>maxTemp.MaxTemperature</mainClass>
              </manifest>
            </archive>
            <descriptorRefs>
              <descriptorRef>
                jar-with-dependencies
              </descriptorRef>
            </descriptorRefs>
          </configuration>
        <executions>
          <execution>
            <id>make-assembly</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

    </plugins>
  </build>
  <dependencies>

    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-client</artifactId>
      <version>1.2.1</version>
    </dependency>

    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-core</artifactId>
      <version>1.2.1</version>
    </dependency>

    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-tools</artifactId>
      <version>1.2.1</version>
    </dependency>

    <dependency>
      <groupId>jeigen</groupId>
      <artifactId>jeigen</artifactId>
      <version>1</version>
    </dependency>

    <dependency>
      <groupId>jna</groupId>
      <artifactId>jna</artifactId>
      <version>4.0.0</version>
    </dependency>

  </dependencies>
</project>


text:
Q: Using VLOOKUP with a union of columns In the dummy table below, I can use the formula below to lookup a value in the third column:
=VLOOKUP(1, Table1[A]:Table1[C],3)

I am wondering if there is any way to define the lookup range as just column-A and column-B using a union operator?
The formula works fine - the motivation for using only two columns is when working with more complex tables that may change, I would always know that the lookup index is 2.

A: The short answer is, no, there is no way to do two disconnect columns.
So we do:
=VLOOKUP(1,Table1[A]:Table1[C],COLUMNS(Table1[A]:Table1[C]),TRUE)

Now it will count the number of column that that range reference encompass.  In your example it would be 3, if another column is added between it would be 4 thus always referring to the correct column.


text:
Q: Is it useful to always return a promise I'm using bluebird to design some nodejs api wrapper around an http service.
Many of the functions in this wrapper are asynchronous and so it makes a lot of sense to return promises from these implementation.
My colleague has been working on the project for a few days now and interesting pattern is emerging, he is also returning promises from synchronously implemented functions.
Example:
function parseArray(someArray){
    var result;
    // synchronous implementation
    return Promise.resolve(result);
}

I can see how this could be useful if later on the implementation needs to be made asynchronous, as you wouldn't have to refactor the call sites.
I guess it's also nice that all methods are consistently "async", but I'm not sure how awesome that exactly is.
Is this considered a bad practice, are there any reasons why we shouldn't do this ?

A: If we can ignore perf it's only bad if the example implementation is used:
function parseArray(someArray) {
    var result;
    // synchronous implementation
    return Promise.resolve(result);
}

This function is a mess because it can throw synchronously but also returns a promise. A function that returns a promise must never throw - otherwise you have lost most benefits of promises because now you have to use both try-catch and .catch().
The correct way to implement is to "annotate" a function with .method:
var parseArray = Promise.method(function() {
    var result;
    //Promise.resolve(result) is unnecessary now
    return result;
});

Now the function is guaranteed to never throw synchronously and can be used in a consistent way.

A: There is no point in returning a promise in synchronous methods.
Promises provide an abstraction over concurrency. When there is no concurrency involved such as when providing an array. Returning a promise makes for worse flow control and is considerably slower.
This is also conveying the wrong message.  In fact, promisifying things with no reason is quite a common anti pattern.
One case where it is useful is when a method might be asynchronous - for example: fetching something from cache or making a request for it if it's not there:
function getData(id){
     if(cache.has(id) return Promise.cast(cache.get(id));
     return AsyncService.fetch(id).tap(cache.put);
}


text:
Q: Matlab fmincon inital guess trouble I am trying to calculate the minimum of a function with multiple variables, the only constraints I have are the upper and lower bounds of the variables. The problem I am having is that fmincon does not change the input value from the initial guess value I give it.
This is the output I get:
initGuess = 0.6159
x = 0.6159

Initial point is a local minimum that satisfies the constraints.
Optimization completed because at the initial point, the objective function is non-decreasing
in feasible directions to within the selected value of the function tolerance, and
constraints are satisfied to within the selected value of the constraint tolerance.
<stopping criteria details>

This is my call to fmincon:
A = [];
b = [];
Aeq = [];
beq = [];
lb = 0;
ub = 1;
initGuess = 0.6159;
options = optimset('TolX',1e-12,'TolCon',1e-12,'TolFun',1e-12,'Algorithm','interior-point');
[optAM,optBC] = fmincon(@(x) cmpBC(x,epochDate,epochDate2,root,rvfm),[initGuess],A,b,Aeq,beq,lb,ub,nonlcon,options);

I tried multiple initial guesses and the same thing happens, please help not sure how fix this.
EDIT****
cmpBC:
function output = cmpBC(x,epochDate,epochDate2,root,rvfm)

cmdParamString = ['HPOP */Satellite/COMDEV_Sat Drag On 2.2 ' num2str(x(1)) ' "NRLMSISE 2000" File "C:\Program Files (x86)\AGI\STK 10\Data\sw20100101.txt"'];

root.ExecuteCommand(cmdParamString);

cmd = horzcat('Propagate */Satellite/COMDEV_Sat', ' "', epochDate, '" "', epochDate2,'"');
root.ExecuteCommand(cmd);
cmd = 'Report_RM */Satellite/COMDEV_Sat Style "J2000 Position Velocity"';
variableB = root.ExecuteCommand(cmd);
theSize = variableB.count;
posArray2=variableB.Item(theSize-2);

C = strread(posArray2,'%s','delimiter',',');

output = norm([str2num(C{2})-rvfm(1) str2num(C{3})-rvfm(2) str2num(C{4})-rvfm(3)]);
%rvfm is the known position of the satellite
end


text:
Q: Oracle extractValue Function not working I am trying to extract values from an XML Column in oracle. My Query is below:
select extractValue(COLUMN_NAME, '/parent/element1/')
from   TABLE_NAME where id = 111111;

However, I get the below error in my SQL Developer:

ORA-00932: inconsistent datatypes: expected - got -
  00932. 00000 -  "inconsistent datatypes: expected %s got %s"

Additional info:

*

*The columnn type I am trying to query is: VARCHAR2(2000 BYTE)

*The XML Contents in the column are very simple, a snippet is below:

<parent>
   <element1>value</element1>
   <element2>value</element2>
   <element3>value</element3>
</parent>

A: The ExtractValue function can only be called on an XML data type. Try using the XMLTYPE function to convert your VARCHAR2 to an XML type:
select extractValue(XMLTYPE(COLUMN_NAME), '/parent/element1/')
from   TABLE_NAME where id = 111111;


text:
Q: background-cover is broken in Android Chrome, in this web page (only?) While I have css rules with background-cover that work well in Chrome for Android, somehow the very same rules fail in this particular website
The weird thing is that if I paste the same background-image: url(backgrounds/landing-two.jpg); rule on the Dev Tools, it doesn't work, but if I uncheck it (leaving the original one) then I can see the original rule working
The site is https://kuworking-theme-landing-two.netlify.com/
What can be happening?
    background-blend-mode: var(--theme-ui-colors-backgroundimg__mode,unset);
    transition: all 0.5s ease 0s;
    background-size: cover;
    display: grid;
    -webkit-box-align: center;
    align-items: center;
    justify-items: center;
    height: 100%;
    width: 100%;
    background-image: url(backgrounds/landing-two.jpg);
    background-position: center center;
    transition: opacity 0.5s ease-in 0s;
    background-repeat: no-repeat;

A: It has esoterically been solved by removing a transition: all 0.5s ease; rule (this is set in a styled-components context)


text:
Q: Odd behavior with Java socket on Android and IPv6 I have some code that uses sockets. Simple stuff like:
Socket socket = new Socket();
InetSocketAddress endpoint = new InetSocketAddress(host, port);
socket.connect(endpoint, 120000);

For some web addresses it will freeze until it times out but only for some of my users. I finally tracked it down by having the users send me logs and the issue happens when endpoint is an IPv6 address. So just to clarify, if a web address has no IPv6 records, then it will just work for those users with the issue. But if the web address has an IPv6 record then it will timeout for those users. All other users (including myself) have no issue with it.
What is strange is that this issue does not happen if I use OkHttp. Also if the user just loads the page using Chrome on the phone then the issue doesn't happen. I know newer Android versions use OkHttp for the HttpUrlConnection so that might be why.
I have fixed it for some users by using:
java.lang.System.setProperty("java.net.preferIPv4Stack", "true");
java.lang.System.setProperty("java.net.preferIPv6Addresses", "false");

But for other users not even that helps.
I am trying to understand why this is even an issue and why only for a few users? And why on some phones the system properties fix it and on others it just gets ignored.
EDIT: I have found a confirmed solution for the users for whom the system properties don't fix the issue.
Basically my code was:
Socket socket = new Socket();
InetSocketAddress endpoint = new InetSocketAddress(host, port);
try{
    socket.connect(endpoint, 120000);
    ....

Now it is:
    Socket socket = new Socket();
    InetAddress address = InetAddress.getByName(host);
    if (address instanceof Inet6Address) {
        Log.w(TAG, "Found ipv6 address, looking for ipv4 " + address);
        InetAddress[] inetAddressArray = InetAddress.getAllByName(host);
        for (int i = 0; i < inetAddressArray.length; i++) {
            if (inetAddressArray[i] instanceof Inet4Address) {
                address = inetAddressArray[i];
                Log.w(TAG, "Found ipv4 " + address);
                break;
            }
        }
    }
    InetSocketAddress endpoint = new InetSocketAddress(address, port);
    //InetSocketAddress endpoint = new InetSocketAddress(host, port);
    try {
        socket.connect(endpoint, 120000);
        ......

Essentially I am forcing the socket to use an IPv4 address if InetAddress.getByName(host) returned an IPv6 address and an IPv4 is available. I'm a little nervous about doing this so I would still prefer if someone has a better solution.


text:
Q: Keras 'Model' object has no attribute 'name' I'm trying to read the output of an intermediate layer in Keras :
input_dim = 30
encoding_dim = 14

input_layer = Input(shape=(input_dim, ))

encoder = Dense(encoding_dim, activation="tanh",
                activity_regularizer=regularizers.l1(10e-5))(input_layer)
encoder = Dense(int(encoding_dim / 2), activation="relu")(encoder)

decoder = Dense(int(encoding_dim / 2), activation='tanh',name='decoder_input')(encoder)
decoder = Dense(input_dim, activation='relu',name='decoder_output')(decoder)

autoencoder = Model(inputs=input_layer, outputs=decoder)

#evaluate decoder...
layer_output_dec =  Model(inputs=autoencoder.layers[3].input,
                             outputs=autoencoder.layers[4].output)

However I got the error:
/usr/local/lib/python2.7/site-packages/keras/engine/network.pyc in __init__(self, *args, **kwargs)
     89                 'inputs' in kwargs and 'outputs' in kwargs):
     90             # Graph network
---> 91             self._init_graph_network(*args, **kwargs)
     92         else:
     93             # Subclassed network

/usr/local/lib/python2.7/site-packages/keras/engine/network.pyc in _init_graph_network(self, inputs, outputs, name)
    181                           'instantiated via '
    182                           '`tensor = tf.layers.Input(shape)`.\n'
--> 183                           'The tensor that caused the issue was: ' +
    184                           str(x.name))
    185         for x in self.outputs:

AttributeError: 'Model' object has no attribute 'name'

I thought the error was on the missing name of the layers but it didn't help. Any help appreciated.

A: This is taking an input that is already connected to something coming before it. It's not possible to have this model working well.
#evaluate decoder...
layer_output_dec =  Model(inputs=autoencoder.layers[3].input,
                         outputs=autoencoder.layers[4].output)

You need proper encoder and decoder models:
#encoder
input_tensor = Input(shape=(input_dim, ))

encoderOut = Dense(encoding_dim, activation="tanh",
                activity_regularizer=regularizers.l1(10e-5))(input_tensor)
encoderOut = Dense(int(encoding_dim / 2), activation="relu")(encoderOut)

encoder = Model(input_tensor, encoderOut)

#decoder
decoder_input = Input(shape=(int(encoding_dim / 2),))
decoderOut = Dense(int(encoding_dim / 2), activation='tanh',name='decoder_input')(decoder_input)
decoderOut = Dense(input_dim, activation='relu',name='decoder_output')(decoderOut)

decoder = Model(decoder_input, decoderOut)

#autoencoder
autoInput = Input(shape=(input_dim, ))
encoderOut = encoder(autoInput)
decoderOut = decoder(encoderOut)
autoencoder = Model(inputs=autoInput, outputs=decoderOut)

Use the three models according to your needs.
For your question, use decoder as a model.


text:
Q: GridLayout Help in Java I have a JPanel with the following code:
JPanel pane = new JPanel();
pane.setLayout(new GridLayout(3, 2, 10, 30));
final JTextField fileName = new JTextField();
pane.add(fileName);
JButton creater = new JButton("Create File");
pane.add(creater);
JButton deleter = new JButton("Delete File");
pane.add(deleter);

I was wondering, how do I make it so that the JTextField takes up two spaces on the GridLayout, while having the two buttons share a row by taking up one space each on the same line?

A: It is a hard to do with GridLyout. You have create wider cells (e.g. new GridLayout(2, 2, 10, 30), then add TextField to the fist cell. Then you have to create yet another panel with GridLayout(2, 1), put it into the cell in second line and add your button into 1 st cell of this nested grid layout.
Shortly you need GridLayout into other GridLayout.
There are better tools to implement this. First take a look on GridBagLayout. It is just to be sure that life is not always pick-nick :). Then take a look on alternative solutions like MigLayout. It is not a part of JDK but it really powerful tool that makes your life easier.

A: You cannot do column spans with GridLayout. I recomend you try GridBagLayout and GridBagConstraints

A: After trashing the suggestion of 3rd party layouts, and since I possess a malevolent hatred of GBL, I thought it was about to time to 'put my code where my mouth is' for public scrutiny (and trashing).
This SSCCE uses a nested layout.
import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;

class SimpleLayoutTest {

    public static void main(String[] args) {
        Runnable r = new Runnable() {
            public void run() {
                JPanel ui = new JPanel( new BorderLayout(20,20) );
                // I would go for an EmptyBorder here, but the filled
                // border is just to demonstrate where the border starts/ends
                ui.setBorder( new LineBorder(Color.RED,15) );

                // this should be a button that pops a JFileChooser, or perhaps
                // a JTree of the existing file system structure with a JButton
                // to prompt for the name of a new File.
                final JTextField fileName = new JTextField();
                ui.add(fileName, BorderLayout.NORTH);

                JPanel buttonPanel = new JPanel(new GridLayout(1, 0, 10, 30));
                ui.add(buttonPanel, BorderLayout.CENTER);

                JButton creater = new JButton("Create File");
                buttonPanel.add(creater);
                JButton deleter = new JButton("Delete File");
                buttonPanel.add(deleter);

                JOptionPane.showMessageDialog(null, ui);
            }
        };
        SwingUtilities.invokeLater(r);
    }
}

A: Take a look at the tutorial on How to Use GridBagLayout.
Sample code:
    JPanel pane = new JPanel();
    GridBagLayout gridbag  = new GridBagLayout();
    pane.setLayout(gridbag);
    GridBagConstraints c = new GridBagConstraints();

    final JTextField fileName = new JTextField();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridwidth = 2;
    c.gridx = 0;
    c.gridy = 0;
    pane.add(fileName, c);

    JButton creater = new JButton("Create File");
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridwidth = 1;
    c.gridx = 0;
    c.gridy = 1;
    pane.add(creater, c);

    JButton deleter = new JButton("Delete File");
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 1;
    pane.add(deleter, c);


text:
Q: Switching to SpringMVC from PlayFramework I am migrating from PlayFramework 1.* (java) to SpringMVC (but not using SpringBoot). I have some questions about the transition:
1) In Play framework there is an opportunity to show an error in a browser, when you deploy an app in dev mode. As I understood in Spring there is nothing like that, but I always see error pages with 500 http code when errors occur. That is no good for users to see those exception logs. In Play it is easy to stop showing those messages to users by switching to prod mode, but how to do that in Spring? (I deploy the webapp to tomcat7).
2) Is there any way in SpringMVC to get a path to any controller as it can be done in Play's template engine with @{Controller.action} tag? In Spring I use JSP for rendering web pages.
3) In examples of Play projects I saw before, properties like URLs of external resources or some texts are stored in .conf files that are divided into development.conf, production.conf etc. Play loads them (not automatically hough) depending on which server is running the application. Is there a way to create and load such kinds of property files in Spring and make it easier to switch between those configurations on different servers?

A: If you are new to web programming and Spring MVC and Play I wouldn't start learning with the combination of Play and Spring. I recommend start either with Spring or with Play. Nearly everything you can do with Spring MVC you can do with Play itself too and if it is dependency injection you are after then Play comes with Guice out of the box.
For Spring I'd recommend starting with Spring Boot (and MVC of course). There is a good tutorial on their site.
For Play I'd recommend their official documentation. You could also look at Lightbend's templates and filter for Java, e.g. this one seems to be a good starting point for a simple web app.


text:
Q: Convert DECIMAL hours to Hours:Minutes SQL SELECT (without Functions and Declare) I have decimal field with for example value 0.17 (it is 0 hours and 10 minutes not 17 because 17*60/100=10,2 minutes)
I would like to convert to solely to hours and minutes in this format: 0:10
I tried select with SUBSTR but I am loosing 0 value in that case.
I would like only pure SELECT without declare and functions!!! Please I cannot use those!
I saw some examples also with TO_DATE functions but this is not what I need because it just converts but without calculation.
Thanks in advance for help.

A: Being hours, I prefer 00:10.  You can do this using LPAD():
concat(concat(lpad( floor( (value - floor(value))*60), 2, '0'), ':'),
       lpad(mod(floor(value), 2, '0'))
      )

Of course, you can just pad to one character for the hours, if you only want one "0".


text:
Q: Packer creation of Ubuntu VirtualBox fails to shutdown I am trying to create an Ubuntu VirtualBox using Packer.
The VirtualBox is created fine, but Packer cannot shut it down and complains
==> virtualbox: Gracefully halting virtual machine...
    virtualbox: bash:  sudo: command not found
==> virtualbox: Timeout while waiting for machine to shut down.

If I manually log into the VirtualBox under construction at the time the above message appears, I can use sudo and shutdown with no problems.
A minimal Packer configuration to reproduce the problem is
{
    "variables": {
        "ssh_name": "ubuntu",
        "ssh_pass": "ubuntu",
        "host_name": "tahr"
    },
    "builders": [{
        "name": "virtualbox",
        "type": "virtualbox-iso",
        "guest_os_type": "Ubuntu_64",
        "vboxmanage": [
            ["modifyvm","{{.Name}}","--vram","32"]
        ],
        "disk_size": 10000,
        "iso_url": "http://releases.ubuntu.com/trusty/ubuntu-14.04.3-server-amd64.iso",
        "iso_checksum": "0501c446929f713eb162ae2088d8dc8b6426224a",
        "iso_checksum_type": "sha1",
        "http_directory": "virtualbox",
        "http_port_min": "9001",
        "http_port_max": "9001",
        "ssh_username": "{{user `ssh_name`}}",
        "ssh_password": "{{user `ssh_pass`}}",
        "ssh_pty" : "true",
        "ssh_wait_timeout": "15m",
        "shutdown_command": "echo {{user `ssh_pass`}} | sudo -S shutdown -P now",
        "boot_command": [
            "<esc><esc><enter><wait>",
            "/install/vmlinuz noapic ",
            "preseed/url=http://{{.HTTPIP}}:{{.HTTPPort}}/preseed.cfg ",
            "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
            "hostname={{user `host_name`}} ",
            "fb=false debconf/frontend=noninteractive ",
            "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
            "keyboard-configuration/variant=USA console-setup/ask_detect=false ",
            "initrd=/install/initrd.gz -- <enter>"
        ]
    }]
}

with the virtualbox/preseed.cfg containing
d-i debian-installer/language string en
d-i debian-installer/locale string en_US.UTF-8
d-i localechooser/preferred-locale string en_US.UTF-8
d-i localechooser/supported-locales en_US.UTF-8
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/layout select USA
d-i keyboard-configuration/variant select USA
d-i keyboard-configuration/modelcode string pc105
d-i netcfg/get_hostname string this-host
d-i netcfg/get_domain string this-host
d-i time/zone string UTC
d-i clock-setup/utc-auto boolean true
d-i clock-setup/utc boolean true
d-i debconf debconf/frontend select Noninteractive
d-i pkgsel/install-language-support boolean false
tasksel tasksel/first multiselect standard, ubuntu-server
d-i partman-auto/method string lvm
d-i partman-lvm/confirm boolean true
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-auto/choose_recipe select atomic
d-i partman/confirm_write_new_label boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-auto-lvm/guided_size string max
d-i mirror/http/proxy string
d-i passwd/user-fullname string ubuntu
d-i passwd/username string ubuntu
d-i passwd/user-password password ubuntu
d-i passwd/user-password-again password ubuntu
d-i user-setup/encrypt-home boolean false
d-i user-setup/allow-password-weak boolean true
d-i pkgsel/install-language-support boolean false
d-i pkgsel/include string build-essential ssh
d-i pkgsel/update-policy select none
d-i pkgsel/upgrade select safe-upgrade
d-i grub-installer/only_debian boolean true
d-i finish-install/reboot_in_progress note

The above Packer setup is intentionally minimised for clarification.  The final goal is to have the Packer setup also create AWS instances (which actually works fine) for production.
If I replace
"shutdown_command": "echo {{user `ssh_pass`}} | sudo -S shutdown -P now"

with
"shutdown_command": "env"

then I get the output
virtualbox: XDG_SESSION_ID=1
virtualbox: TERM=xterm
virtualbox: SHELL=/bin/bash
virtualbox: SSH_CLIENT=10.0.2.2 63390 22
virtualbox: SSH_TTY=/dev/pts/0
virtualbox: USER=ubuntu
virtualbox: SSH_AUTH_SOCK=/tmp/ssh-xO4Ad2K13w/agent.825
virtualbox: MAIL=/var/mail/ubuntu
virtualbox: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
virtualbox: PWD=/home/ubuntu
virtualbox: LANG=en_US.UTF-8
virtualbox: SHLVL=1
virtualbox: HOME=/home/ubuntu
virtualbox: LOGNAME=ubuntu
virtualbox: SSH_CONNECTION=10.0.2.2 63390 10.0.2.15 22
virtualbox: XDG_RUNTIME_DIR=/run/user/1000
virtualbox: _=/usr/bin/env

A: It turns out there was non-breaking space instead of a regular blank in the shutdown_command.  For OSX, it is possible to disable non-breaking spaces, and for Sublime Text there is a Unicode highlighter.


text:
Q: Odoo - How to create custom global configuration file I am using Odoo 10-e. I came from .net what i want to do is that i need to create my custom setting configuration file in Odoo like we have AppSettings file in asp.net where we set some static key values to use them in project. How to create that kind of file and how can i access that file in python code or xml files ?

A: *

*Create a class that inherits from res.config.settings (so you can edit the record):

class farmacia_pedido_config_settings(models.TransientModel):
   _inherit = 'res.config.settings'
   _name = 'farmacia.config.settings'

   lista_precios_defecto = fields.Many2one(
    'product.pricelist',
    string='Lista de precios por defecto')

*Associate with the view:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
    <record id="view_farmacia_configuration" model="ir.ui.view">
        <field name="name">farmacia config settings</field>
        <field name="model">farmacia.config.settings</field>
        <field name="arch" type="xml">
            <form string="Farmacia" class="oe_form_configuration">
                <header>
                    <button string="Aplicar" type="object" name="execute" class="oe_highlight"/>
                    <button string="Cancelar" type="object" name="cancel" class="oe_link"/>
                </header>

                <field name="lista_precios_defecto" class="oe_inline"/>

                </group>
                </form>
        </field>
    </record>

    <record id="action_farmacia_configuration" model="ir.actions.act_window">
        <field name="name">Farmacia</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">farmacia.config.settings</field>
        <field name="view_mode">form</field>
        <field name="target">inline</field>
    </record>

    <menuitem id="menu_farmacia_config" name="Farmacia" parent="base.menu_config"
        sequence="3" action="action_farmacia_configuration"/>

</data>
</openerp>

*Save in a file accessing via python (this is uglier)

config = ConfigParser()
your_file = os.getenv("HOME")+os.path.sep+"your_file.conf"
if os.path.isfile(your_file):
    config.read(your_file)
else:
    raise models.except_orm(
        'Error',
        "File not found " + os.getcwd())


text:
Q: Почему не передается данная строка на мейл? Не могу понять почему не передается поле артикул на почту? Вот код html:

Отследить груз по артикулу

Оставьте ваши контакты и мы свяжемся с вами.

<input class="name" name="name" type="text" placeholder="Ваше имя" />

<input class="phone" name="phone" type="text" placeholder="Ваш телефон" />

<input class="art" name="art" type="text" placeholder="Ваш артикул" />

Отправить сообщение

И код php:
{
  if($_POST['ajax'] == "backphone")
  { ////////////////  ЗАКАЗ ОБРАТНОГО ЗВОНКА  /////////////////////////////////////////////

    $jsonData = json_decode(stripslashes($_POST['jsonData']));

    $errors = "";
    $error1 = "";
    $error2 = "";
    $gooddata = array();

    foreach($jsonData as $k => $v) {

      $v = strip_tags(htmlspecialchars(trim($v)));
      switch ($k)
      {
        case "name":
        case "phone":
          if (empty($v))
          {
            $error1 = "Вы заполнили не все поля обязательные для заполнения";
          }
          break;
        case "art":
        case "email":
          if (empty($v))
          {
            $error1 = "Вы заполнили не все поля обязательные для заполнения";
          }

          if (!empty($v) && strpos($v, '@') === false)
          {
            $error2 = "Email адрес не корректный";
          }
          break;
        case "message":
      }

      $gooddata[$k] = $v;
    }

    if ($error1 != '' || $error2 != '')
    {
      if($error1 != '')
      {
        $errors .= $error1.'
';
      }

      if($error2 != '')
      {
        $errors .= $error2;
      }

      echo $errors;
    }
    else
    {
      $to      = get_settings('admin_mail');
      $subject = "Заказ обратного звонка";
      $message = '

                  Имя:
                  '.$gooddata['name'].'

                  Телефон:
                  '.$gooddata['phone'].'

                  Email:
                  '.$gooddata['email'].'

                  Артикул:
                  '.$gooddata['art'].'

                  Примечание:
                  '.$gooddata['message'].'

              ';

      if (feedback_send_mail($to, $subject, $message))
      {
        echo 'ok';
        $feed_result = true;
      }
      else
      {
        echo 'При отправке заявки возникли проблемы, попробуйте повторить позже';
      }
    }
    exit;
  }
  else
  {
    echo 'Ошибка, попробуйте повторить отправку заказа позже';
    exit;
  }


text:
Q: How do I configured postfix and to use SES, and still be able to forward email from unverified external addresses? We are using postfix for email group lists (eg "members@domain.com" will go to all members) from Amazon EC2 systems.  For a variety of reasons (scalability and reliability) we would like to use SES for all outgoing emails.
I was able to configure postfix to use SES as the SMTP for outgoing emails.  This works fine for all verified emails.  But of course, when an outsider emails me at "jeff@domain.com", it chokes.  Postfix is configured to forward to my gmail account (via the virtual table), the SES rejects it because the outside user is not verified.
So none of our mailing groups configured through postfix will work this way.
I would be happy to rewrite all "From" addresses before sending (and simply leave the Reply To as the original sender), but I cannot seem to find a working configuration.
No matter what I set in canonical or generic regexps, SES seems to reject all forwarded emails.
Surely somebody must have configured postfix with SES to handle virtual addresses?  How does this work?

A: Verified emails? Have you turned on "prod mode" for your SES? Out of the box, SES nly lets you send to verified emails. Look for the button for production access. You fill out a form, and they remove that restriction.


text:
Q: inf2cat 22.9.10 error I'm trying to sign old Hitachi driver that makes USB flash drive appear as fixed disk
(Quite useful when you have fast, large thumb drives)
Driver itself works fine but I constantly get same error when try to get it signed:
Errors:
22.9.10: cfadisk.sys in [cfadisk_copyfiles] is missing from [SourceDisksFiles] section in
\cfadisk.inf; driver may not sign correctly until this is resolved.

22.9.10: disk.sys in [gendisk_copyfiles] is missing from [SourceDisksFiles] section in
cfadisk.inf; driver may not sign correctly until this is resolved.

This is my .inf file:
[Version]
Signature="$Windows NT$"
Class=DiskDrive
ClassGuid={4D36E967-E325-11CE-BFC1-08002BE10318}
Provider=%HGST%
DriverVer=10/14/2012,9.9.9.9
CatalogFile=cfadisk.cat

[Manufacturer]
%HGST% = cfadisk_device,ntAMD64

[DestinationDirs]
cfadisk_copyfiles=12    ; %SystemRoot%\system32\drivers
gendisk_copyfiles=12    ; %SystemRoot%\system32\drivers

[cfadisk_copyfiles]
cfadisk.sys

[gendisk_copyfiles]
disk.sys

[cfadisk_device]
%Microdrive_devdesc% = cfadisk_install,USBSTOR\Disk&Ven_SanDisk&Prod_Extreme&Rev_0001

[cfadisk_device.NTamd64]
%Microdrive_devdesc% = cfadisk_install,USBSTOR\Disk&Ven_SanDisk&Prod_Extreme&Rev_0001

[cfadisk_addreg]
HKR,,"LowerFilters",0x00010008,"cfadisk"

[cfadisk_install]
CopyFiles=cfadisk_copyfiles,gendisk_copyfiles

[cfadisk_install.HW]
AddReg=cfadisk_addreg

[cfadisk_install.Services]
AddService=disk,2,gendisk_ServiceInstallSection
AddService=cfadisk,,cfadisk_ServiceInstallSection

[gendisk_ServiceInstallSection]
DisplayName    = "Disk Driver"
ServiceType    = 1
StartType      = 0
ErrorControl   = 1
ServiceBinary  = %12%\disk.sys
LoadOrderGroup = SCSI Class

[cfadisk_ServiceInstallSection]
DisplayName    = "CompactFlash Filter Driver"
ServiceType    = 1
StartType      = 3
ErrorControl   = 1
ServiceBinary  = %12%\cfadisk.sys
LoadOrderGroup = Pnp Filter

; -----------------------

[Strings]
HGST = "Hitachi"
Microdrive_devdesc = "SanDisk Extreme"

I was using this tutorial as reference point:
http://www.deploymentresearch.com/Blog/tabid/62/EntryId/63/Sign-your-unsigned-drivers-Damn-It.aspx
cfadisk.inf and sys can be downloaded here:
link is at the beginning of first post
http://hardforum.com/showthread.php?t=1655684
Any help would be greatly appreciated
EDIT:
I just used chkinf utility on this .inf file
Here is the output:
C:\DriversCert\SanDisk\cfadisk.inf: FAILED
NTLOG REPORT--------------
Total Lines:         62  |
Total Errors:         1  |
Total Warnings:       4  |
--------------------------
Line 0: ERROR: (E22.1.1003) Section [SourceDisksNames] not defined.
Line 0: WARNING: (W22.1.2212) No Copyright information found.
Line 0: WARNING: (W22.1.2111) [SourceDisksFiles] section not defined - full CopyFiles checking not done.
Line 17: WARNING: (W22.1.2112) File "cfadisk.sys" is not listed in the [SourceDisksFiles].
Line 20: WARNING: (W22.1.2112) File "disk.sys" is not listed in the [SourceDisksFiles].

I'm really no programer so I really don't understand what does all this mean.
Strange thing is that driver does work, I just can't get i signed.
Thank you!
Best regards,
Walter

A: It means that some sections are missed. In your case they are [SourceDisksFiles] and [SourceDisksNames]
In this specific situation you just should add:
[SourceDisksFiles]
cfadisk.sys = 1
disk.sys = 1
[SourceDisksNames]
1 = %DiskName%, ,
and also add a record to [String] section in the bottom:
DiskName="Disk Drive"


text:
Q: how to access data from an array placed inside an other array in php (codeigniter)? array (size=2)     //top array containg an other arrays
   0 =>
   array (size=2)   //array containing 2 index
     'content' => string '            The Lion King        ' (length=33)
     'slide_style' => string '' (length=0)
  1 =>
  array (size=2)
    'content' => string '      Current fruit : mana bhanya the =
    'slide_style' => string '' (length=0)
   2 =>
   array (size=2)
     'content' => string '      Current fruit : mana bhanya the king
     'slide_style' => string '' (length=0)

i have that structure of array please tell me how i can access data in my view file

A: Let's say that your top array is $array.
You could loop through the array to access each inner array and its items:
foreach($array as $inner_array) {
    echo $inner_array['content'];
    echo $inner_array['slide_style'];
}

Or to access certain values of inner arrays directly without looping through the top array, you could do this:
echo $array[0]['content'];
echo $array[0]['slide_style'];

Within this second method, you can swap out the 0 for whichever inner array you want to access (0 being the first, 1 being the second and so on).
Hope this helps.

A: You pass that array as a second argument to $this->load->view().
For example, you have a view page called posts.php and you pass data to it via controller like the following:
$data['posts'] = $this->post_model->getPosts();

$this->load->view('posts.php', $data);

and you access it in the view page posts.php like:
foreach($posts as $post) {
    // Here the other code goes ...
}

Like you mentioned in the comment, if you want to loop through the array, this is the code you might be looking for:
foreach($posts as $post) {
   echo "
{$post['title']}
";
   echo "
{$post['description']}
";
}

This is how you access multi-dimensional array.
Hope you got it.


text:
Q: import one module (e.g. numpy) in package modules Is there a pythonic way to be sure all the submodules in a package have the same imports?
for example, suppose I have directories
/mypackage
    __init__.py
    module_a.py
    module_b.py

and both module_a and module_b need another package, say datetime. that is, I have code like this in the two modules:
#in module_a
datetime.now()

and
#in module_b
datetime.now()

Where do I put the import datetime?
Can/should I put it in __init__.py?
Is there any reason not to put it in both module_a and module_b?


text:
Q: linux bash and grep bug? Doing the following:
First console
touch /tmp/test

Second console
tail -f /tmp/test |grep propo |grep -v miles

Third console
echo propo >> /tmp/test

Second console must show "propo" but it doesn't shows anything, if you run in second console instead:
tail -f /tmp/test |grep propo

And do echo propo >> /tmp/test it will show propo, but the grep -v is for miles not for propo
Why?
Test into your own environment if you want, it's pretty obvious but not working.

A:
Why?

Most probably because the output of a command when piped to another command is fully buffered, not line buffered. The output could be buffered in the first pipe or by grep.
Use stdbuf -oL to force line buffering and grep --line-buffered for line buffered grep.

A: the problem is that grep does not use line buffering by default; so the output will be  buffered. You could use grep --line-buffered:
tail -f /tmp/test | grep --line-buffered propo | grep -v miles


text:
Q: how to draw image pixel by piexel in swing I recently created a program to explore Mandelbrot's fractal and after calculated the image I drew it but in a weird way. How can I paint it in clean way? The only way I found is to override the paint method and fill rectangle of 1 pixel (I know the function to get the color is horrible but it's to make a compact code even if it's useless).
import java.awt.Color;
import javax.swing.JFrame;
public class Mandelbrot{
    public static void main(String[] args) {
        var panel = new javax.swing.JComponent() {
            public void paint(java.awt.Graphics g) {
                for (int i = 0; i < 1000000; i++) {
                    g.setColor(function(((i % 1000) / 500.0)/zoom + x, (i / 500000.0) / zoom + y, 1));
                    g.fillRect(i % 1000, i / 1000, 1, 1);
                }
            }
        };
        panel.addMouseListener(new java.awt.event.MouseAdapter() {
            @Override
            public void mouseClicked(java.awt.event.MouseEvent e) {
                x += (e.getX() / 1000.0) / zoom;
                y += (e.getY() / 1000.0) / zoom;
                zoom = e.getButton() == 1 ? zoom * 2 : (zoom == 1 ? 1 : zoom / 2);
                panel.repaint();
                System.out.println("zoom : X" + zoom);
            }
        });
        panel.setBounds(0, 0, 1024, 1024);
        var frame = new JFrame("FRACTAL");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(1000, 1000);
        frame.add(panel);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    }
    private static double a, b, temp, x = -1.5, y = -1;
    private static int zoom = 1;
    public static Color function(double real, double imag, int accuracy) {
        a = 0; b = 0;
        int max= 1024 * accuracy;
        while(max > 0 && a*a + b*b < 4){
            temp = a;
            a = a*a - b*b + real;
            b = 2*temp*b + imag;
            max--;
        }
        max = (1024*accuracy - max) / accuracy;
        return max == 1024 ? Color.BLACK : new Color(max < 256 ? 255:(max < 512 ? 511 - max : 0), max < 256 ? max : (max < 768 ? 255 : 1023 - max), max < 512 ? 0 : (max < 768 ? max - 512 : 255));
    }
}

A: You can create a BufferedImage, edit it, and than add it to you frame inside a JLable, like this:
JLabel lable = new JLabel(new ImageIcon(yourBufferedImage));
frame.addLabel();

This will prevent you from re-calculating your image every time you repaint it.
To update the image, you should edit your BufferedImage and than update your label icon, like this:
label.setIcon(new ImageIcon(yourBufferedImage));
label.repaint();


text:
Q: RStudio Python Version Change on Mac My question is:
How can I change the python version to anaconda 3.5 and can use modules that have installed in anaconda in RStudio.
I'm using RStudio Version 0.99.891
R version 3.2.3 (2015-12-10)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.3 (El Capitan)
and I have installed Anaconda3, set python 3.5 as default python version.
$ python
Python 3.5.1 |Anaconda custom (x86_64)| (default, Dec  7 2015, 11:24:55)
However, in RStudio,

system("python --version")
  Python 2.7.10

I tried to change it by following method:

Sys.setenv(PATH = paste("/Users/UserName/anaconda3/bin",   Sys.getenv("PATH"), sep=":"))
  system("python --version")
  Python 3.5.1 :: Anaconda custom (x86_64)

It seems good, but actually it is not.

python.exec("import os")
  python.exec("import inspect")
  python.exec("inspect.getfile(os)")
  python.exec("print(inspect.getfile(os))")
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.pyc
python.exec("import pandas as pd")
  Error in python.exec("import pandas") : No module named pandas

Thanks.

A: Put the following line in your .Rprofile:
Sys.setenv(PATH = paste("/home/your_user_name/anaconda3/bin", Sys.getenv("PATH"), sep=":"))

Proof:
> system("python --version")
Python 3.6.1 :: Anaconda custom (64-bit)

A: Just to complete @Sergey answer and for anyone who needs it, you can edit .Rprofile directly from R with the following command:
library(devtools)
usethis::edit_r_profile()


text:
Q: Parse XML to Table in SQL (Only nodes that have values) I am trying to find a way to parse a rather large XML file into a table that simply shows the name of the node, and it's value. There are no attributes to worry about in the XML, but there are several nested nodes.
Because there the XML is generated dynamically, there is no way of knowing the exact depth of that nesting. But it is safe to assume only the LAST CHILD NODE of any branch will contain data.
This is my attempt at a solution, but the problem is that when accessing a parent node, the data from every child within gets concatenated as the value.
DECLARE @ProjectXML XML
SET @ProjectXML = '
<Project>

  <ProjectId>1</ProjectId>
  <OrganizationId>1</OrganizationId>
  <Title>This is a Test Title</Title>
  <Description>This is a Test Description</Description>
  <ProjectType>
    <Id>1</Id>
    <Name>Test Name</Name>
    <Outer>
        <Inner1>Hi</Inner1>
        <Inner2>There</Inner2>
    </Outer>
  </ProjectType>
</Project>
'
SELECT
n.value('local-name(.)','VARCHAR(100)') AS Name,
n.value('.','VARCHAR(MAX)') AS Value

FROM @ProjectXML.nodes('//*') AS ProjectXML(n)

Which results in:
Project           11This is a Test TitleThis is a Test Description1Test NameHiThere
ProjectId         1
OrganizationId    1
Title             This is a Test Title
Description       This is a Test Description
ProjectType       1Test NameHiThere
Id                1
Name              Test Name
Outer             HiThere
Inner1            Hi
Inner2            There

Is there a way (using xquery perhaps?) to ignore the parent nodes which contain no data, and only return values for the child nodes which do?
**Bonus points if it is possible to return the Name of each result as a formatted list of it's parent nodes , such as:
Project - ProjectId                         1
Project - OrganizationId                    1
Project - Title                             This is a Test Title
Project - Description                       This is a Test Description
Project - Project Type - Id                 1
Project - Project Type - Name               Test Name
Project - Project Type - Outer - Inner1     Hi
Project - Project Type - Outer - Inner2     There

A: Take a peek at http://beyondrelational.com/modules/2/blogs/28/posts/10495/xquery-lab-58-select-from-xml.aspx
Select * from XMLTable(@ProjectXML) where value is not null

Returns more than you may want, but you can tailor to your needs

A: This could be done much easier...
It is a bit tricky to get the /text() of a node if there is no /text(). But there is the empty()-function and the not()-function:
SELECT
n.value('local-name(.)','VARCHAR(100)') AS Name,
n.value('.','VARCHAR(MAX)') AS Value
FROM @ProjectXML.nodes('//*[not(empty(text()))]') AS ProjectXML(n)

And you might read this
The old FROM OPENXML with WHERE text IS NOT NULL would deliver the same plus more details about the position within the XML.
But the linked function by John Capelletti is great. Just stick with this...


text:
Q: Retrieving SendGrid Transactional Templates List I have been trying to retrieve list of SendGrid transactional templates using API. I'm using correct API key and getting an empty array while there are about 5 transactional templates existing in my SendGrid account. Here is the response:
{
  "templates": []
}

Any guesses what could be wrong?

A:
Any guesses what could be wrong?

Yep, their documentation could be!
I also stuck with the problem and finally managed to solve it once I opened the devtools and saw how they request their own API from the UI. Long story short - one has to pass additional generations=dynamic query parameter. Here is the C# code I use:
            var client = new SendGridClient("key");
            var response = await client.RequestAsync(
                SendGridClient.Method.GET,
                urlPath: "/templates",
                queryParams: "{\"generations\": \"dynamic\"}");

A: Using Api 7.3.0 PHP
require("../../sendgrid-php.php");
$apiKey = getenv('SENDGRID_API_KEY');
$sg = new \SendGrid($apiKey);

#Comma-delimited list specifying which generations of templates to return. Options are legacy, dynamic or legacy,dynamic
    $query_params = json_decode('{"generations": "legacy,dynamic"}');
    try {
        #$response = $sg->client->templates()->get();
        $response = $sg->client->templates()->get(null, $query_params);

        echo $response->body();
        exit;
    } catch (Exception $e) {
        echo '{"error":"Caught exception: '. $e->getMessage().'"}';

    }

A: I had the same problem using the python wrapper provided by Sendgrid.
My code was similar to this:
response = SendGridAPIClient(<your api key>).client.templates.get({'generations': 'legacy,dynamic'})

This returned an empty array.
To fix you have to name the param or to pass None before the dict:
response = SendGridAPIClient(<your api key>).client.templates.get(None, {'generations': 'legacy,dynamic'})

or
response = SendGridAPIClient(<your api key>).client.templates.get(query_params={'generations': 'legacy,dynamic'})


text:
Q: Is there any question about the route code in my flutter code? I want to make a new route in the flutter , but I failed,
my VS Code give me this:

The following assertion was thrown while handling a gesture:
  I/flutter (32582): Navigator operation requested with a context that does not include a Navigator.
  I/flutter (32582): The context used to push or pop routes from the Navigator must be that of a widget that is a
  I/flutter (32582): descendant of a Navigator widget

import 'package:flutter/material.dart';

void main()=>runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Lake',
      routes: {
        'sss': (context)=>new NewRoute()
      },
      home: new Scaffold(
        appBar: AppBar(
          title: Text('Lake'),
        ),
        body: Text('BBB'),
        floatingActionButton: new FloatingActionButton(
          child: Icon(Icons.import_contacts),
          onPressed: (){
            Navigator.pushNamed(context, 'sss');
          },
        ),
      ),

    );
  }
}

class NewRoute extends StatelessWidget{
  @override
  Widget build(BuildContext context){
    return new Scaffold(
      appBar: AppBar(
        title: Text('BBB'),
      ),
      body: Center(
        child: Text('wahaha'),
      ),
    );
  }
}

A: Plea use this code
home: Builder(
        builder: (context) => Scaffold(
        appBar: AppBar(
          title: Text('Lake'),
        ),
        body: Text('BBB'),
        floatingActionButton: new FloatingActionButton(
          child: Icon(Icons.import_contacts),
          onPressed: (){
            Navigator.pushNamed(context, 'sss');
          },
        ),
      ),)

Builder let you build a new context from direct parent like described there https://docs.flutter.io/flutter/widgets/Builder-class.html

A: You are using routes incorrectly. when you  use home in MaterialApp it will bypass the Routes. insted of that you can use initialRoute to define Home Screen
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Lake',
      routes: {
        'sss': (context) => const NewRoute(),
        'home': (context) => const HomeScreen(),
      },
      initialRoute: 'home',
    );
  }
}

class HomeScreen extends StatelessWidget {
  const HomeScreen({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Lake'),
      ),
      body: const Text('BBB'),
      floatingActionButton: FloatingActionButton(
        child: const Icon(Icons.import_contacts),
        onPressed: () {
          Navigator.pushNamed(context, 'sss');
        },
      ),
    );
  }
}

class NewRoute extends StatelessWidget {
  const NewRoute({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('BBB'),
      ),
      body: const Center(
        child: Text('wahaha'),
      ),
    );
  }
}

also avoid using new keyword.
you can also try with onGenarated Routes in flutter.
more information


text:
Q: Effects in jQuery In jQuery, when we have more than one effect, such that the effect has to go simultaneously or
first complete the first effect and then proceed to next one, how do we do that?
If I use 2 effects, the first effect is not seen and the second one is seen.
Here is what I'm trying to do.  I'm using a roundabout function move over the images, and when you click on any one of the images I am scrolling the page using the scrollTo() method.
The problem is that the roundabout function is not seen.  Only the scrolling effect is seen.

A: Edit: I am not sure if this is what you want.. So Try and let me know how it goes.
$(function(){
        $('ul').roundabout(function() {
            $('img').click(function(){
                $('#outermost').scrollTo($(this).attr('id'),800);
                return false;
            });
        });
});

You can queue using . and call the function after completing the first effect. Something like below,
$("div").click(function () {
  $(this).hide("slide", { direction: "down" }, 1000)
      .show("slide", {direction: "down"}, 1000);
 });

DEMO here


text:
Q: Arrow function vs Class methods memory footprint I was reading about arrow functions (in typescript context). And I came across this line.

arrow function is created per object of type Handler. Methods, on the other hand, are only created once and attached to Handler's prototype. They are shared between all objects of type Handler.

Source : https://www.typescriptlang.org/docs/handbook/functions.html
I am unable to understand. Please answer if anyone can explain.

A: When you have this:
class Example {
    method() {
    }
}

const e1 = new Example();
const e2 = new Example();

You have one copy of the method function, not two. It's on the object that both e1 and e2 use as their prototype, like this:

        +−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−+
        |                                             |
        \   +−−−−−−−−−−−−+                            |
Example−−+−>| (function) |                            |
            +−−−−−−−−−−−−+           +−−−−−−−−−−−−−+  |
            | prototype  |−−−−−−+−+−>|  (object)   |  |
            +−−−−−−−−−−−−+     /  /  +−−−−−−−−−−−−−+  |
                               | |   | constructor |−−+  +−−−−−−−−−−−−−−−−+
                               | |   | method      |−−−−>|   (function)   |
                               | |   +−−−−−−−−−−−−−+     +−−−−−−−−−−−−−−−−+
                               | |                       | name: "method" |
            +−−−−−−−−−−−−−−−+  | |                       +−−−−−−−−−−−−−−−−+
e1−−−−−−−−−>|   (object)    |  | |
            +−−−−−−−−−−−−−−−+  | |
            | [[Prototype]] |−−+ |
            +−−−−−−−−−−−−−−−+    |
                                 |
            +−−−−−−−−−−−−−−−+    |
e2−−−−−−−−−>|   (object)    |    |
            +−−−−−−−−−−−−−−−+    |
            | [[Prototype]] |−−−−+
            +−−−−−−−−−−−−−−−+

But when you do this:
class Example {
    constructor() {
        this.method = () => { };
    }
}

const e1 = new Example();
const e2 = new Example();

or this:
class Example {
    method = () => { };
}

const e1 = new Example();
const e2 = new Example();

You have two copies of the method function, one for e1 and one for e2, like this:

        +−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−+
        |                                                                      |
        \   +−−−−−−−−−−−−+                                                     |
Example−−+−>| (function) |                                                     |
            +−−−−−−−−−−−−+                                    +−−−−−−−−−−−−−+  |
            | prototype  |−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−+−+−>|  (object)   |  |
            +−−−−−−−−−−−−+                              /  /  +−−−−−−−−−−−−−+  |
                                                        | |   | constructor |−−+
            +−−−−−−−−−−−−−−−+                           | |   +−−−−−−−−−−−−−+
e1−−−−−−−−−>|   (object)    |                           | |
            +−−−−−−−−−−−−−−−+                           | |
            | [[Prototype]] |−−−−−−−−−−−−−−−−−−−−−−−−−−−+ |
            | method        |−−+                          |
            +−−−−−−−−−−−−−−−+  |     +−−−−−−−−−−−−−−−−+   |
                               +−−−−>|   (function)   |   |
                                     +−−−−−−−−−−−−−−−−+   |
            +−−−−−−−−−−−−−−−+        | name: "method" |   |
e2−−−−−−−−−>|   (object)    |        +−−−−−−−−−−−−−−−−+   |
            +−−−−−−−−−−−−−−−+                             |
            | [[Prototype]] |−−−−−−−−−−−−−−−−−−−−−−−−−−−−−+
            | method        |−−+
            +−−−−−−−−−−−−−−−+  |     +−−−−−−−−−−−−−−−−+
                               +−−−−>|   (function)   |
                                     +−−−−−−−−−−−−−−−−+
                                     | name: "method" |
                                     +−−−−−−−−−−−−−−−−+

Any decent JavaScript engine will share the code amongst those function instances, but the function instances themselves must be distinct, because they close over different contexts (the context of the call to the constructor where they're created). (The function objects themselves don't need to be very big, particularly in a thoroughly-optimized engine. If you look at the internal slots a function must have [in effect; engines can optimized provided they behave as described by the spec], only [[Environment]] varies between them.)
The advantage to the arrow functions created per-instance is you don't have to worry about what this they're called with, because they ignore it; instead, they use the this they close over (which will refer to the instance created when they were created), which can be handy for callbacks.
The advantage to the method is that it's shared, and (in highly-dynamic environments) if it's replaced on the prototype with a different implementation, e1 and e2 will use that updated implementation. (That's a rare edge case.)


text:
Q: Embedding a google map directly from a search term? Basically I want to embed a map for some terms I have on my site (e.g. "New York") but I don't want to have to manually enter the lat/long coordinates for all these terms. These terms are anyway common/standard enough that Google Map's search essentially always gets it right on the first try, anyway.
Ideally I would just have a little bit of javascript e.g.
generateMap("New York");

and that would give me the iframe for an embedded google map for the search term "New York".
Is this possible?

A: Yes it's possible. If you just want a static map picture, simply use a url like this will get you what you want:
http://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=14&size=512x512&maptype=roadmap&markers=color:blue%7Clabel:S%7C40.702147,-74.015794&markers=color:green%7Clabel:G%7C40.711614,-74.012318&markers=color:red%7Ccolor:red%7Clabel:C%7C40.718217,-73.998284&sensor=false
You can see that you can use address like "Brooklyn Bridge, New York" in the "center" parameter directly. For more information please refer to http://code.google.com/apis/maps/documentation/staticmaps/

A: If you want a fully functional google map, it's a little bit more complicated, basically what you should do is first use what is called "Geocoding Service"(which is a part of google map javascript api v3: http://code.google.com/apis/maps/documentation/javascript/geocoding.html) to search for the place and get its lag and lng, and then redirect your google map object to center that lag and lng.
You can refer to the source code of this example here: http://code.google.com/apis/maps/documentation/javascript/examples/geocoding-simple.html
It contains all the parts that you need, just put them together :)

A: function generateMap(term) {
    var url = "http://maps.google.com/maps?=q=".encodeURIComponent(term)."&output=embed&t=m&z=7";
    var iframe = document.getElementById("mapframe");
    iframe.style.display = '';
    iframe.src = url;
}

...

<iframe src="about:blank" width="400" height="300" id="mapframe" style="display:none"></iframe>


text:
Q: How to use dependency-injection with SpringBootTest I have an application that uses SpringBoot for dependency injection and the app works fine, but testing fails because @Autowired fields aren't being injected during tests.
@SpringBootApplication
public class ProcessorInterface {
    protected final static Logger logger = Logger.getLogger( ProcessorInterface.class );

    public static void main(String[] args) {
        try {
            SpringApplication.run(ProcessorInterfaceRunner.class, args);
        } catch (Exception ex) {
            logger.error("Error running  ProcessorInterface", ex);
        }
    }
}

@Component
@Configuration
@ComponentScan
public class ProcessorInterfaceRunner implements CommandLineRunner {
    protected final static Logger logger = Logger.getLogger( ProcessorInterface.class );

    @Autowired
    private RequestService requestService = null;
    @Autowired
    private ValidatorService validatorService = null;

    @Override
    public void run(String... args) throws Exception {

        ESPOutTransaction outTransaction = null;
        outTransaction = new ESPOutTransaction();
        // initialize outTransaction fields
        ...
        // done initializing outTransaction fields

        if (validatorService.isValid(outTransaction)) {
            System.out.println(requestService.getRequest(outTransaction));
        } else {
            System.out.println("Bad Data");
        }
    }
}

@Service
public class ESPRequestService implements RequestService<ESPOutTransaction> {

    @Autowired
    ValidatorService validatorService = null;

    @Override
    public String getRequest(ESPOutTransaction outTransaction) throws IllegalArgumentException {
        if (!validatorService.isValid(outTransaction)) {
            throw new IllegalArgumentException("Invalid parameters in transaction object. " + outTransaction.toString());
        }

        StringBuffer buff = new StringBuffer("create request XML");
        buff.append("more XML");
        return buff.toString();
    }
}

@Service
public class ESPValidatorService implements ValidatorService {
    private static org.apache.log4j.Logger logger = Logger.getLogger(ESPValidatorService.class);

    // declare some constants for rules
    private static final int MAX_LENGTH_XYZ = 3;

    @Override
    public boolean isValid(OutTransaction outTransaction) {
        ESPOutTransaction espOutTransaction = (ESPOutTransaction)outTransaction;
        boolean isValid = true;

        if (espOutTransaction == null) {
            logger.warn("espOutTransaction is NULL");
            isValid = false;
        } else {
            // XYZ is required
            if (espOutTransaction.getXYZ() == null) {
                logger.warn("XYZis NULL\r\n" + espOutTransaction.toString());
                isValid = false;
            }
            // XYZ max length = MAX_LENGTH_XYZ
            if (espOutTransaction.getXYZ() != null && espOutTransaction.getPubCode().trim().length() > MAX_LENGTH_XYZ) {
                logger.warn("XYZis too long (max length " + MAX_LENGTH_XYZ + ")\r\n" + espOutTransaction.toString());
                isValid = false;
            }
        }
        return isValid;
    }
}

These all work and I get good output when I run the app. When I try to test it though, it fails because it can't find ESPValidatorService to inject into ESPRequestService
@RunWith(Suite.class)
@SuiteClasses({ ESPOutTransactionValidatorTest.class, ESPRequestTest.class })
public class AllTests {}

@RunWith(SpringRunner.class)
@SpringBootTest(classes = {ESPRequestService.class})
public class ESPRequestTest {

    @Test
    public void testGetRequest() {
        ESPRequestService requestService = new ESPRequestService();

        String XYZ = "XYZ";

        ESPOutTransaction outTransaction = null;
        outTransaction = new ESPOutTransaction();
        outTransaction.setXYZ(XYZ);

        String strRequest = "some expected request XML";
        String request = requestService.getRequest(outTransaction);
        assertEquals(request, strRequest);
    }
}

@RunWith(SpringRunner.class)
@SpringBootTest(classes = ESPValidatorService.class)
public class ESPOutTransactionValidatorTest {

    @Test
    public void testIsValid() {
        ESPValidatorService validatorService = new ESPValidatorService();

        ESPOutTransaction outTransaction = null;
        // test request = null
        assertFalse(validatorService.isValid(outTransaction));

        String XYZ = "XYZ";

        outTransaction = new ESPOutTransaction();
        outTransaction.setXYZ(XYZ);

        // test all good
        assertTrue(validatorService.isValid(outTransaction));

        // test XYZ
        outTransaction.setXYZ(null);
        assertFalse(validatorService.isValid(outTransaction));
        outTransaction.setXYZ("ABCD"); // too long
        assertFalse(validatorService.isValid(outTransaction));
        outTransaction.setXYZ(XYZ);
    }
}

How can I get the unit tests to auto wire?

A: I see two problems :
1) you don't rely on Spring beans but you create instances with the new operator.
Instead of writing :
ESPRequestService requestService = new ESPRequestService();

you should let Spring inject the instance :
@Bean
ESPRequestService requestService;

2) The @SpringBootTest configuration is not correct.
In each test, you specified a very specific bean class in the classes attribute of @SpringBootTest  :
@SpringBootTest(classes = ESPValidatorService.class)
public class ESPOutTransactionValidatorTest {

and
@SpringBootTest(classes = {ESPRequestService.class})
public class ESPRequestTest {

But classes attributes of @SpringBootTest serves to specify the annotated classes to use for loading an ApplicationContext.

The annotated classes to use for loading an ApplicationContext. Can
  also be specified using @ContextConfiguration(classes=...). If no
  explicit classes are defined the test will look for nested
  @Configuration classes, before falling back to a
  SpringBootConfiguration search.

So all configuration classes and beans of your application may not be discovered and loaded in the Spring container .
To be able to load all application beans during your tests, the most simple way is not specifying the classes attribute  in the  @SpringBootTest annotation :
@SpringBootTest
public class ESPRequestTest { ...}

It will look for a Spring bean that holds the @SpringBootConfiguration.
Ideally, it will found the @SpringBootApplication bean of your application.
If the package of the test class is located inside the package (or at a lower level) of the @SpringBootApplication class, it should be automatically discovered.
Otherwise the other way is specifying a configuration that will allow to load all required beans :
@SpringBootTest(classes = MySpringBootApplication.class)
public class ESPRequestTest { ...}


text:
Q: PHP Api Json array? How do you retrieve keys from a array such as this?
Im very confused.
<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "http://completion.amazon.com/search/complete?search-alias=aps&client=amazon-search-ui&mkt=1&q=facebook");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
curl_close($curl);
print_r(json_decode($result));//return amazone autocomplete suggestion

RESULT:
Array ( [0] => facebook [1] => Array ( [0] => facebook [1] => facebook messenger [2] => facebook app [3] => facebook.com [4] => facebook login welcome to facebook [5] => facebook gift card [6] => facebook log in [7] => facebook for dummies [8] => facebook marketing [9] => facebook messenger for blackberry 10 ) [2] => Array ( [0] => stdClass Object ( [nodes] => Array ( [0] => stdClass Object ( [name] => Apps & Games [alias] => mobile-apps ) [1] => stdClass Object ( [name] => Gift Cards [alias] => gift-cards ) [2] => stdClass Object ( [name] => Books [alias] => stripbooks ) ) ) [1] => stdClass Object ( ) [2] => stdClass Object ( ) [3] => stdClass Object ( ) [4] => stdClass Object ( ) [5] => stdClass Object ( ) [6] => stdClass Object ( ) [7] => stdClass Object ( ) [8] => stdClass Object ( ) [9] => stdClass Object ( ) ) [3] => Array ( ) )

A: use for each statment :
foreach ($result as $key => $value)
      foreach ($result[$key] as $k => $va)
           echo $key, $k, $val;

A: It looks like you're trying to get the search suggestions based on "facebook". After you json_decode the response, These will be in $result[1] as you can see in your print_r output. They are in an array, which you can iterate over like this:
$result = json_decode($result);

foreach ($result[1] as $suggestion) {
    echo "$suggestion<br>";  // or whatever you want to do with it
}


text:
Q: Need collision and trigger on same prefab I need a trigger on each prefab when the player hits a certain key while close to the object. I also need collision between each instance of the prefab and player. I can only seem to get one to work when "is trigger" is selected on the prefab. What's the correct way to handle this ?

A: You could use an interface on the objects for when the player is close and hits a certain key. Collision can be handled by the objects collider, is there a specific reason it needs to be a trigger? Check this out, may clear up some isTrigger issues.

A: Instead of using a trigger on the objects, use Physics.OverlapSphere to find all objects in range when the player presses the key and then execute a function in the script on the objects.
Trigger Event:
void Update() {
    if (Input.GetKeyDown("space"))
    {
        ApplyEffect(transform.position, RADIUS);
    }
}

RADIUS is the desired proximity to the player
Method 1:
void ApplyEffect(Vector3 center, float radius)
{
    Collider[] hitColliders = Physics.OverlapSphere(center, radius);
    int i = 0;
    while (i < hitColliders.Length)
    {
        hitColliders[i].gameObject.GetComponent<SCRIPT_NAME>().EFFECT_FUNCTION();
        i++;
    }
}

SCRIPT_NAME is the name of the script on the target objects.
EFFECT_FUNCTION is the name of the function in the script.
Method 2:
Use a messaging system to execute functionality on the objects similar to the function shown in the documentation example:
https://docs.unity3d.com/ScriptReference/Physics.OverlapSphere.html


text:
Q: **.h: No such file or directory when compile C in dec c++ I encounter [Error] interp1_pos2013b.h: No such file or directory when I compile c programs in windows10 dev c++.
File Directory is as follows:
project1: C:\Users\18843\Desktop\新建文件夹
interp1_pos2013b.h:C:\Users\18843\Desktop\新建文件夹\project1\inter1pos
I have added interp1_pos2013b in folder inter1pos and add the folder under project1, As shown in the picture:
enter image description here
I don't know how to solve the problem. Thanks

A: When you include only a file name, it means, that the file is located near your source file.
In your project, the interp1_pos2013b.h is not in the same folder as velocity_optimize.c.
Write:
#include "inter1pos/interp1_pos2013b.h"

instead
#include "interp1_pos2013b.h"

With this, you tell the compiler the relative path of the header file.


text:
Q: box file action does not work in ie We developed new file action for our web-app, it works fine when using chrome or Firefox but on IE we have problems, when trying to understand the issues we noticed that when the message goes to our web-app it doesn't send any cookies including the session cookie although the web-app sends set-cookie header.
why is it happens?

A: OK, we found the problem, apparently when using iframes in IE cookies are blocked as IE refers to Iframes as third party app, to unblock cookies we should to add privacy policy to the headers using P3P header.
good place to read about is - Cookie blocked/not saved in IFRAME in Internet Explorer.

A: This sounds like a possible bug on our end. Can you email us at API AT box.com with specific information about the request that's being sent as well as which version of IE you're using?


text:
Q: Delay React Hook useLayoutEffect until useEffect is done? I have a component in which I use the hook useEffect to retrieve data from an API. I want to display the data in a chart using AMCharts. My problem is that I need to use the hook useLayoutEffect to create the chart and the chart is based on the data retrieved with useEffect... When my chart is rendered, I don't have the data yet and my chart is empty. How can I delay the useLayoutEffect until the data is retrieved ?
I use useEffect a lot in my app to retrieve data and display the info I need. I tried to do both (retrieve data and create the chart) in the hook useEffect or in the useLayoutEffect but it does not work. I cannot use a condition before using useLayoutEffect, tried it too...
const AmChart = (props) => {
    const chartRef = useRef(null);

    const [data,setData] = useState([]);
    const [startDate,setStartDate] = useState(new Date());
    const [endDate,setEndDate] = useState(new Date());

    useEffect(() => {
        let from = startDate.getFullYear().toString() + ('0' + (startDate.getMonth() + 1)).slice(-2) + ('0' + startDate.getDate()).slice(-2);
        let to = endDate.getFullYear().toString() + ('0' + (endDate.getMonth() + 1)).slice(-2) + ('0' + endDate.getDate()).slice(-2);
        dataService.getData(from,to)
            .then(response => {
                setData(response.data);
            });
    },[]);

    useLayoutEffect(() => {
        let x = am4core.create("chartdiv", am4charts.XYChart);
        // ... creation of the chart
        chart.data = data;
        // ... creation of the chart
        chart.current = x;

        return () => {
          x.dispose();
        };
    }, []);

    return (

    );
}

A: If you need your hook does the work when data is changed, add data state into an array of dependencies.
useLayoutEffect(()=>{}, [data])

A: You should add 'data' to the list of dependencies for useEffect. For more info please read this article: Docs on useEffect conditional firing


text:
Q: Is this correct? Calling ListView from another form I'm wondering if I'm doing this correctly, calling a listview1 from another form. So I can use a query involving listView1 of the Transactions form.
private void button2_Click(object sender, EventArgs e)
{
    ///transactions goback = new transactions();
    //goback.button6.Enabled = true;
    //this.Hide();
    transactions reba = new transactions();
    reba.listView1 = new ListView();
}

A: You can not access the listview1 from another form because it is a private field. But you can access it if you create a property for it:
Fist go to the Designer file of the transactions form (transactions.Designer.cs) and add the following property to it:
public ListView ListView1
{
    get { return listView1; }
    set { listView1 = value; }
}

Then you can access to it from another form:
transactions reba = new transactions();
reba.ListView1...


text:
Q: How can I convert images of pdf files to text? I am looking for a way to convert images of a PDF to a real text file.
I have tried using Okular, GSCAN2PDF, GIMP, ImageMagick and XPDF but I am having problems with all of them, maybe because I don't have much experience with them and I'm struggling to understand the instructions I've found. I would appreciate a beginner-level explanation.

A: First install poppler-utils which contains Pdfimages. Pdfimages is a tool command line, which allows to extract all images from a PDF file and save them as JPEG files.
Open a terminal, by pressing Ctrl+Alt+T
Install the software:
sudo apt-get update
sudo apt-get install poppler-utils

The syntax of this tool is:
pdfimages -j file.pdf output_directory

Where file.pdf is the file you want to extract images and output_directory is the directory where you want to save the images.
Images are saved in the following format:
output_directory/output_directory-nnn.jpg

It's funny, but they are named with the same name of the directory where you extracted, a consecutive number and extension.
Second, just install an application for ocr, for example ocrfeeder:
sudo apt-get update
sudo apt-get install tesseract-ocr ocrfeeder tesseract-ocr-eng gocr cuneiform ocropusocrad

Once the program opens, select the search engine you want to use. Select the Edit menu and select Preferences from the dropdown menu.
In the dialog that opens select the Tools tab. Here you will see an option that puts favorite engine. In this option, select Tesseract and then press the OK button.
After completing the settings we can start with the action
To do this we press the + symbol:
Then select the image file you want to open.
If necessary retouch the image, only you have to access the Tools menu. Once inside the Tools menu select the option unpaper. The display will find various options and filters to retouch the image.


text:
Q: What is the format for the new options json object server.register hapijs method Anyone could show me what is the new format for options json object that must be passed to server.register() method in hapijs?

this is how I wrote my server.register() call.

server.register({
    register: require('good'),
    options: {
        opsInterval: 5000,
        reporters: [
            {
                reporter: require('good-file'),
                events: { ops: '*'},
                config: {
                    path: './logs',
                    prefix: 'hapi-process',
                    rotate: 'daily'
                }
            },
            {
                reporter: require('good-file'),
                events: { response: '*' },
                config: {
                    path: './logs',
                    prefix: 'hapi-requests',
                    rotate: 'daily'
                }
            },
            {
                reporter: require('good-file'),
                events: { error: '*' },
                config: {
                    path: './logs',
                    prefix: 'hapi-proccess',
                    rotate: 'daily'
                }
            }
        ]
    }
}, function(err) {
    console.log(err);
});

this is the error I am getting:
Error: Invalid monitorOptions options child "reporters" fails because ["reporters" must be an object]
at Object.exports.assert (/home/rodrigo/Projetos/estudos/api/greetings-hapi/node_modules/hoek/lib/index.js:736:11)
at Object.exports.register (/home/rodrigo/Projetos/estudos/api/greetings-hapi/node_modules/good/lib/index.js:31:10)
at Object.target [as register] (/home/rodrigo/Projetos/estudos/api/greetings-hapi/node_modules/hapi/node_modules/joi/lib/object.js:77:34)
at each (/home/rodrigo/Projetos/estudos/api/greetings-hapi/node_modules/hapi/lib/plugin.js:318:14)
at iterate (/home/rodrigo/Projetos/estudos/api/greetings-hapi/node_modules/hapi/node_modules/items/lib/index.js:36:13)
at Object.exports.serial (/home/rodrigo/Projetos/estudos/api/greetings-hapi/node_modules/hapi/node_modules/items/lib/index.js:39:9)
at internals.Plugin.register (/home/rodrigo/Projetos/estudos/api/greetings-hapi/node_modules/hapi/lib/plugin.js:321:11)
at Object.<anonymous> (/home/rodrigo/Projetos/estudos/api/greetings-hapi/server.js:26:8)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)

Reporters seems to be an object not an array but how do I should write and what are your properties?

A: If you go to https://github.com/hapijs/good you will see the reporters is an object with the keys being name of reporter and the value an array of objects with the keys module, name and args.  Read the docs here https://github.com/hapijs/good/blob/master/API.md for further info.


text:
Q: jQuery modal will not display when I click button I am trying to create a modal window that pops up when you click the sign in button in the nav bar. I've made it so both the modal and it's page overlay are set with 'display: none' in css. I've tried every method I could to get it to display on click and I just can't get it to work. I've tried fadeIn(). I've tried .css() to change it. I even tried making a special class with only 'display: none' and using .removeClass(). Nothing works!
This is a school assignment so I can't use jQuery UI. I'm not asking for it to be done for me. I just want a nudge in the right direction. Can someone help me? This is the code I've got right now.
$(document).ready(function() {
    $('#login').click(function(event) {
        event.preventDefault();
        $('.overlay').removeClass('.displaynone');
        $('.modal').removeClass('.displaynone');
    });
});

Here is a JS Fiddle with the whole situation out there. The Log In button is supposed to bring up the overlay and the modal on top of it. I'd like for it to fade in, preferably with the modal having a second delay.
Fiddle: https://jsfiddle.net/duagdn8m/1/

A: You are adding . in the class names too. This is not needed. You don't need . notation here:
$('.overlay').removeClass('displaynone');
$('.modal').removeClass('displaynone');

Fiddle: https://jsfiddle.net/cnye843k/
I would suggest giving an absolute as positioning for the login screen, to make it a modal. Or if you have not included the CSS, then fine.

A: https://jsfiddle.net/duagdn8m/5/
Just remove the . on the classname that you want to remove.
$('.overlay').removeClass('displaynone');
$('.modal').removeClass('displaynone');

A: you need to remove the . in removeClass('.displaynone'); and the overlay and modal are classes, not ids. so you need to update your css to .overlay and .modal.
also, its easier to set the overlay and modal to display:none; and then fadeIn the both like so:-
$(document).ready(function() {
    $('#login').click(function(event) {
        event.preventDefault();
        $('.overlay, .modal').fadeIn(1000)
    });
});

This will give you the 1 second fade in.
Fiddle