text:
Q: Can Aquaman's trident cut through Superman's flesh? Zack Snyder sort of intervened in a radio show stating the following:

[...] The cool thing is, with Aquaman his trident (people don't realize this) that could cut the flesh of Superman, if they come in contact. That's a thing that's in the canon. He's super strong. [...]

Is this true? And if so, how come?

A: In Justice League: Throne of Atlantis, Ocean Master is able to hurt Superman with the Trident.

A: It's a magical weapon. Superman has no defence against magic.
http://dc.wikia.com/wiki/Trident_of_Neptune
Here he expresses caution of magic, and then gets cut by magic teeth!

A: The closest Aquaman seems to have gotten to stabbing someone with Superman-like abilities is in Justice League #6 where he uses his adamantine trident (the Trident of Neptune) to poke Darkseid in the eye and chest.
Darkseid is regularly shown to have a similar level of durability to Superman so he's a pretty reasonable analogue in terms of sheer physical resistance.

Superman is known to be especially vulnerable to magic weapons, especially when that magic relates to the "essence" of one of the Gods:

A: I'm not sure if this would actually happen, considering the fact that the only thing that can hurt superman physically is a kryptonite spear. Basically saying, if the trident came in contact with his skin, it would have the same affect as any other metal.


text:
Q: Selecting 10 names based on 10 highest numbers of other column I want to select the top 10 voted restaurants, and plot them together.
So i want to create a plot that shows the restaurant names and their votes.
I used:
topTenVotes <- top_n(dataSet, 10, Votes)

and it showed me data of the columns in dataset based on the top 10 highest votes, however i want just the number of votes and restaurant names.
My Question is how to select only the top 10 highest votes and their restaurant names, and plotting them together?
expected output:
Restaurant Names            Votes
A                            300
B                            250
C                            230
D                            220
E                            210
F                            205
G                            200
H                            194
I                            160
J                            120
K                             34

And then a bar plot that shows these restaurant names and their votes

A: Another simple approach with base functions creating another variable:
df <- data.frame(Names = LETTERS, Votes = sample(40:400, length(LETTERS)))
x <- df$Votes
names(x) <- df$Names # x <- setNames(df$Votes, df$Names) is another approach
barplot(sort(x, decreasing = TRUE)[1:10], xlab = "Restaurant Name", ylab = "Votes")

Or a one-line solution with base functions:
barplot(sort(xtabs(Votes ~ Names, df), decreasing = TRUE)[1:10], xlab = "Restaurant Names")

A: I'm not seeing a data set to use, so here's a minimal example to show how it might work:
library(tidyverse)

df <-
  tibble(
    restaurant = c("res1", "res2", "res3", "res4"),
    votes = c(2, 5, 8, 6)
  )

df %>%
  arrange(-votes) %>%
  head(3) %>%
  ggplot(aes(x = reorder(restaurant, votes), y = votes)) +
  geom_col() +
  coord_flip()

The top_n command also works in this case but is designed for grouped data.

A: Its more efficient, though less readable, to use base functions:
#toy data
d <- data.frame(list(Names = sample(LETTERS, size = 15), value = rnorm(25, 10, n = 15)))
head(d)
  Names     value
1     D 25.592749
2     B 28.362303
3     H  1.576343
4     L 28.718517
5     S 27.648078
6     Y 29.364797
#reorder by, and retain, the top 10
newdata <- data.frame()
for (i in 1:10) {
      newdata <- rbind(newdata,d[which(d$value == sort(d$value, decreasing = T)[1:10][i]),])
}
newdata
   Names    value
8      W 45.11330
13     K 36.50623
14     P 31.33122
15     T 30.28397
6      Y 29.36480
7      Q 29.29337
4      L 28.71852
10     Z 28.62501
2      B 28.36230
5      S 27.64808

redpajama_set_name: RedPajamaStackExchange


text:
Q: Anyone has an alternative to using static methods in a C# interface? I want to implement a collection, whose items need to be tested for emptiness.
In case of a reference type, one would test for being null. For value types, one has to implement empty testing, and probably choose a specific value that represents emptyness.
My generic collection of T should be usable for both value and reference type values (meaning that Coll<MyCalss> and Coll<int> should both be possible). But I have to test reference and value types differently.
Wouldn't it be nice to have an interface that implements an IsEmpty() method, to exclude this logic from my generic type? But of course, this IsEmpty() method cannot be a member function: it could not be called on empty objects.
One workaround I found is to have collection items stored as objects, rather then T-s, but it gives me a headache (around boxing and being strongly typed). In good old C++ it was no problem :-)
The code below demonstrates what I'd like to achieve:
using System;
using System.Collections.Generic;

namespace StaticMethodInInterfaceDemo
{
  public interface IEmpty<T>
  {
    static T GetEmpty();  // or static T Empty;

    static bool IsEmpty(T ItemToTest);
  }

  public class Coll<T> where T : IEmpty<T>
  {
    protected T[] Items;

    protected int Count;

    public Coll(int Capacity)
    {
      this.Items = new T[Capacity];
      this.Count = 0;
    }

    public void Remove(T ItemToRemove)
    {
      int Index = Find(ItemToRemove);

      // Problem spot 1: This throws a compiler error: "Cannot convert null to type parameter 'T'
      // because it could be a non-nullable value type. Consider using 'default(T)' instead."
      this.Items[Index] = null;

      // To overcome, I'd like to write this:
      this.Items[Index] = T.Empty;  // or T.GetEmpty(), whatever.

      this.Count--;
    }

    public T[] ToArray()
    {
      T[] ret = new T[this.Count];

      int TargetIndex = 0;
      for(int Index = 0; Index < this.Items.GetLength(0); Index++)
      {
        T Item = this.Items[Index];

        // Problem spot 2: This test is not correct for value types.
        if (Item != null)
          ret[TargetIndex++] = Item;

        // I'd like to do this:
        if (!T.IsEmpty(Item))
          ret[TargetIndex++] = Item;
      }

      return ret;
    }

    protected int Find(T ItemToFind)
    {
      return 1;  // Not implemented in the sample.
    }
  }
}

A: You can create an extension method for your Interface called IsEmpty. Then you could first test if the 'this' parameter in this extension method is null.
So you could call the IsEmpty method on any reference to a type that is implementing your interface, not regarding if this could be null or not.

A: You can use the 'default' keyword for this, as in:
this.Items[Index] = default(T);

A: There is no such thing as an "empty" int, so supporting int will be tricky unless you store a bit-map of which are defined - but if you simply use a collection of int? (i.e. Nullable<int>) it is done for you. No extra work, and no boxing:
List<int?> list1 = ...; // data
List<string> list2 = ...; // data

Console.WriteLine(list1[3]; == null); // actually maps to `item.HasValue`
Console.WriteLine(list2[3]; == null); // reference test

To get an int from an int?, any of:
int i = (int)value; // throws exception if empty
int i = i.Value; // throws exception if empty
int i = i.GetValueOrDefault(); // returns 0 if empty

And when you don't need to be able to test for empty, just a List<int> (no ?). No extra code. No special collection class. And it works for most anything.

A: Instead of using an array in your class to represent the collection, use a stack or list. Then you don't have empty indexes, they simply aren't there if they where removed.

A: How about just sending in two functions in the constructor?
public Coll(Func<T> createEmpty, Func<T, bool> isEmpty)
{
    this.createEmpty = createEmpty;
    this.isEmpty = isEmpty;
}

You could then use those functions later:
if (!isEmpty(item))

Items[index] = createEmpty();


text:
Q: Disable logging in org.apache.httpcomponents Below is my pom.xml
<dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20201115</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.13</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
    <version>2.4.3</version>
</dependency>

    </dependencies>
  <build>
    <finalName>Demo</finalName>
  </build>

I have a Spring Boot application JAR that uses Rest Template to access few APIs and I am consuming those methods via the JAR in a Standalone Java application.
Client client = new Client();
Map<String, Object> mapObj = new  LinkedHashMap<String, Object>();
//set my mapObj here
client.test(mapObj);

I get the following DEBUG logs of org.apache.http and org.springframework.web in my console:
19:20:59.954 [main] DEBUG org.springframework.web.client.RestTemplate - HTTP POST
19:21:00.033 [main] DEBUG org.springframework.web.client.RestTemplate - Accept=[application/json, application/*+json]
19:21:00.040 [main] DEBUG org.springframework.web.client.RestTemplate - Writing [{}] as "application/x-www-form-urlencoded"
19:21:00.057 [main] DEBUG org.apache.http.client.protocol.RequestAddCookies - CookieSpec selected: default
19:21:00.069 [main] DEBUG org.apache.http.client.protocol.RequestAuthCache - Auth cache not set in the context
19:21:00.070 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection request: [route: {s}->][total available: 0; route allocated: 0 of 2; total allocated: 0 of 20]
19:21:00.082 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection leased: [id: 0][route: {s}->][total available: 0; route allocated: 1 of 2; total allocated: 1 of 20]
19:21:00.084 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Opening connection {s}->
19:21:00.273 [main] DEBUG org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connecting to
19:21:00.273 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Connecting socket to with timeout 0
19:21:00.578 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Enabled protocols: [TLSv1, TLSv1.1, TLSv1.2]
19:21:00.578 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Enabled cipher suites:[TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384]
19:21:00.578 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Starting handshake
19:21:01.192 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Secure session established
19:21:01.193 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory -  negotiated protocol: TLSv1.2
19:21:01.194 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory -  negotiated cipher suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
19:21:01.196 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory -  peer principal:
19:21:01.198 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory -  issuer principal:
19:21:01.202 [main] DEBUG org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connection established IPOne<->IPTwo
19:21:01.203 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Executing request POST  HTTP/1.1
19:21:01.204 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Target auth state: UNCHALLENGED
19:21:01.206 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Proxy auth state: UNCHALLENGED
19:21:01.216 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> POST  HTTP/1.1
19:21:01.216 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Accept: application/json, application/*+json
19:21:01.216 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Content-Type: application/x-www-form-urlencoded;charset=UTF-8
19:21:01.217 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Content-Length: 170
19:21:01.217 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Host:
19:21:01.217 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Connection: Keep-Alive
19:21:01.217 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_241)
19:21:01.218 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Accept-Encoding: gzip,deflate

How can I disable them?

A: You can try 2 things. Either put this into your application.yml to only log warnings and errors for the mentioned packages
logging:
  level:
    org.apache.http: WARN
    org.springframework.web: WARN

or define your own resources/logback.xml like with the loggers for the packages set:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <include resource="org/springframework/boot/logging/logback/defaults.xml"/>

    <property name="CONSOLE_LOG_PATTERN" value="[%date{YYYY-MM-dd HH:mm:ss.SSS}] %-5level [%.15thread] %logger{1} %msg%n"/>

    <include resource="org/springframework/boot/logging/logback/console-appender.xml"/>

    <logger name="org.apache.http" level="WARN" />
    <logger name="org.springframework.web" level="WARN" />

    <root level="${GLOBAL_LOGGING_LEVEL:-INFO}">
        <appender-ref ref="CONSOLE"/>
    </root>

</configuration>


text:
Q: PHP fputs not working I have the following code to create a LOG file.
It is implemented inside "download.php", a script to force download which I call from download links such as:
Filename to download

Download links are at any other page, index.php, or whatever. Works fine at my local server, doesn't work at my hosting (GoDaddy)...
$fname = "filename";

// log file name
define('LOG_FILE','logs/downloads.log');

$f = fopen(LOG_FILE, "a+");
if ($f) {
  fputs($f, date("Y.m.d | H:i:s")." | ".$_SERVER['REMOTE_ADDR']." | ".$fname."\r\n");
  fclose($f);
}

The same code inside a different file, also works perfectly.
I suppose that something inside the download.php script interferes with it, I could put it here if necessary, but its long...
Thanks!!
The full code for download.php:
<?php

###############################################################
# File Download 1.31
###############################################################
# Visit http://www.zubrag.com/scripts/ for updates
###############################################################
# Sample call:
#    download.php?f=phptutorial.zip
#
# Sample call (browser will try to save with new file name):
#    download.php?f=phptutorial.zip&fc=php123tutorial.zip
###############################################################

// Allow direct file download (hotlinking)?
// Empty - allow hotlinking
// If set to nonempty value (Example: example.com) will only allow downloads when referrer contains this text
define('ALLOWED_REFERRER', '');

// Download folder, i.e. folder where you keep all files for download.
// MUST end with slash (i.e. "/" )
define('BASE_DIR','mp3');

// log downloads?  true/false
define('LOG_DOWNLOADS',true);

// log file name
define('LOG_FILE','logs/downloads.log');

// Allowed extensions list in format 'extension' => 'mime type'
// If myme type is set to empty string then script will try to detect mime type
// itself, which would only work if you have Mimetype or Fileinfo extensions
// installed on server.
$allowed_ext = array (

  // archives
  'zip' => 'application/zip',

  // documents
  'pdf' => 'application/pdf',
  'doc' => 'application/msword',
  'xls' => 'application/vnd.ms-excel',
  'ppt' => 'application/vnd.ms-powerpoint',

  // executables
  'exe' => 'application/octet-stream',

  // images
  'gif' => 'image/gif',
  'png' => 'image/png',
  'jpg' => 'image/jpeg',
  'jpeg' => 'image/jpeg',

  // audio
  'mp3' => 'audio/mpeg',
  'wav' => 'audio/x-wav',

  // video
  'mpeg' => 'video/mpeg',
  'mpg' => 'video/mpeg',
  'mpe' => 'video/mpeg',
  'mov' => 'video/quicktime',
  'avi' => 'video/x-msvideo'
);

####################################################################
###  DO NOT CHANGE BELOW
####################################################################

// If hotlinking not allowed then make hackers think there are some server problems
if (ALLOWED_REFERRER !== ''
&& (!isset($_SERVER['HTTP_REFERER']) || strpos(strtoupper($_SERVER['HTTP_REFERER']),strtoupper(ALLOWED_REFERRER)) === false)
) {
  die("Internal server error. Please contact system administrator.");
}

// Make sure program execution doesn't time out
// Set maximum script execution time in seconds (0 means no limit)
set_time_limit(0);

if (!isset($_GET['f']) || empty($_GET['f'])) {
  die("Please specify file name for download.");
}

// Nullbyte hack fix
if (strpos($_GET['f'], "\0") !== FALSE) die('');

// Get real file name.
// Remove any path info to avoid hacking by adding relative path, etc.
$fname = basename($_GET['f']);

// Check if the file exists
// Check in subfolders too
function find_file ($dirname, $fname, &$file_path) {

  $dir = opendir($dirname);

  while ($file = readdir($dir)) {
    if (empty($file_path) && $file != '.' && $file != '..') {
      if (is_dir($dirname.'/'.$file)) {
        find_file($dirname.'/'.$file, $fname, $file_path);
      }
      else {
        if (file_exists($dirname.'/'.$fname)) {
          $file_path = $dirname.'/'.$fname;
          return;
        }
      }
    }
  }

} // find_file

// get full file path (including subfolders)
$file_path = '';
find_file(BASE_DIR, $fname, $file_path);

if (!is_file($file_path)) {
  die("File does not exist. Make sure you specified correct file name.");
}

// file size in bytes
$fsize = filesize($file_path);

// file extension
$fext = strtolower(substr(strrchr($fname,"."),1));

// check if allowed extension
if (!array_key_exists($fext, $allowed_ext)) {
  die("Not allowed file type.");
}

// get mime type
if ($allowed_ext[$fext] == '') {
  $mtype = '';
  // mime type is not set, get from server settings
  if (function_exists('mime_content_type')) {
    $mtype = mime_content_type($file_path);
  }
  else if (function_exists('finfo_file')) {
    $finfo = finfo_open(FILEINFO_MIME); // return mime type
    $mtype = finfo_file($finfo, $file_path);
    finfo_close($finfo);
  }
  if ($mtype == '') {
    $mtype = "application/force-download";
  }
}
else {
  // get mime type defined by admin
  $mtype = $allowed_ext[$fext];
}

// Browser will try to save file with this filename, regardless original filename.
// You can override it if needed.

if (!isset($_GET['fc']) || empty($_GET['fc'])) {
  $asfname = $fname;
}
else {
  // remove some bad chars
  $asfname = str_replace(array('"',"'",'\\','/'), '', $_GET['fc']);
  if ($asfname === '') $asfname = 'NoName';
}

// set headers
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Type: $mtype");
header("Content-Disposition: attachment; filename=\"$asfname\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . $fsize);

// download
// readfile($file_path);
$file = fopen($file_path,"rb");
if ($file) {
  while(!feof($file)) {
    print(fread($file, 1024*8));
    flush();
    if (connection_status()!=0) {
      fclose($file);
      die();
    }
  }
  fclose($file);
}

// log downloads
if (!LOG_DOWNLOADS) die("Not logging downloads");

$f = fopen(LOG_FILE, "a+");
if ($f) {
  fputs($f, date("Y.m.d | H:i:s")." | ".$_SERVER['REMOTE_ADDR']." | ".$fname."\r\n");
  fclose($f);
}

?>

A: There could be several things which are wrong:

*

*Do you have permissions for the file? - Make sure your chmod settings on that file allow the server to have read/write permissions. Generally, it's 755 or 777 or similar.

*Do the folder/file exist? - Should be rather straightforward, check if the folder actually exist in the location you think it does. It should be on the same folder as the PHP script accessing it.

*Have your host disabled file related operations? - check with GoDaddy's manual and documentation, or contact their support regarding this if all else fails.

Things to help you determine the problem:

*

*Enable error reporting. - Calling error_reporting(E_ALL); at the top of the PHP page will reveal any errors/warnings/notices you may have from the script. Hosts like GoDaddy usually disable them by default.

A: Do you have a 'logs' folder in your web server? If you do, check its permissions. If it's not 755, set it to 755. If you don't have the logs folder, then just create one.
I've encountered similar problems before and usually the reason is the directory does not exist in the server.
Edit:
Can you try:
file_put_contents('logs/test.log','nothing is wrong');

If the file appeared and it was successfully written, then I suggest that you update your code to use that function instead.

A: You might need to chmod the file to 755 or something similar.


text:
Q: Unable to Send email to external domains using C# Code from SharePoint I am sending an email from Share Point server, i am using C# to send an email.
For internal email addresses  i can send an email but when i use any other domain such as gmail ID , i am getting the below error.
 "Mailbox unavailable. The server response was: 5.7.1 Unable to relay"
I am using exchange as relay , so i try to send an email using powershell with a same settings (Port , mail server, username and password) to external and internal users , email is working fine .
but using C# code from the same server i am getting error
"Mailbox unavailable. The server response was: 5.7.1 Unable to relay"

var mailserver = "mail.xyz.com";
        int port = "25";
        var senderemail = "abc@xyz.com";
        var senderpassword = "password";

        var client = new SmtpClient(mailserver.ToString(), port)
        {
            Credentials = new NetworkCredential(senderemail.ToString(), senderpassword.ToString()),
            EnableSsl = false
        };
        client.Send(senderemail.ToString(), txtEmail.Text.Trim(), "Feed Back ", txtDesc.Text.Trim());


text:
Q: Word Files are opening in Readonly mode I have program which get the word file from server and after editing it saved back to server . It was working and i was able to save files back to server but suddenly files are opening in Readonly mode . I have searched alot on google and have tried all options but it seems not working.Any ideas clues ??

A: If the file displays as read only in Word that means word thinks the file is readonly, which means its seen something to make it think that. Since word does not integrate with access control methods over webdav, that means it can only be that word has determined that the server does not support required operations for writing. This can be:

*

*does not support uploading (ie PUT). Webdav reports this in the OPTIONS request, so please check for that

*does not support locking (ie LOCK)

*does support locking, and the file is locked. But this usually gives the user a specific warning

Locking comes into play in different ways depending on how you're connecting to the server (on windows you can either use a mapped drive or a network location), and the means of opening (either clicking a link in a web page which uses the sharepoint dll, or opening directly from a mapped drive, or opening from the file open dialog in MS office), and of course the application doing the opening (ie MS Office, Open Office, etc)
Depending on what combination of the above you're using locking might or might not be required to edit.
Webdav indicates locking support in the following ways
 - the supported levels header
 - MS-Author-VIA header, which should return "webdav"
 - the presence of LOCK in the OPTIONS response.
So you might need to check for the presense of those, probably by using wireshark or similar.


text:
Q: How to get rid of the error Process 'command' finished with non-zero exit value 1 when starting a project with gradle? I'm trying to make the first spring boot and gradle project.I downloaded a gradle project from the spring initialize io.
build.gradle
plugins {
    id 'org.springframework.boot' version '2.5.5'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'
    id 'war'

}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-security'
    implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5'
    runtimeOnly 'org.postgresql:postgresql'
    providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'org.springframework.security:spring-security-test'
}

test {
    useJUnitPlatform()
}

settings.gradle
rootProject.name = 'TestForMVC'

Then I try to execute the resulting main:
package com.example.TestForMVC;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class TestForMvcApplication {

    public static void main(String[] args) {
        SpringApplication.run(TestForMvcApplication.class, args);
    }

}

But I get a strange error:
 Process 'command 'C:/Users/Loken/.jdks/corretto-1.8.0_302/bin/java.exe'' finished with non-zero exit value 1

Run with --stacktrace
Caused by: org.gradle.process.internal.ExecException: Process 'command 'C:/Users/Loken/.jdks/corretto-1.8.0_302/bin/java.exe'' finished with non-zero exit value 1
    at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:414)
    at org.gradle.process.internal.DefaultJavaExecAction.execute(DefaultJavaExecAction.java:52)
    at org.gradle.api.tasks.JavaExec.exec(JavaExec.java:158)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:58)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:51)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:29)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$2.run(ExecuteActionsTaskExecuter.java:502)
    at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
    at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
    at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
    at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
    at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
    at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
    at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$run$1(DefaultBuildOperationExecutor.java:74)
    at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.runWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:45)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:74)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:487)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:470)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$300(ExecuteActionsTaskExecuter.java:106)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.executeWithPreviousOutputFiles(ExecuteActionsTaskExecuter.java:271)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:249)
    at org.gradle.internal.execution.steps.ExecuteStep.executeInternal(ExecuteStep.java:89)
    at org.gradle.internal.execution.steps.ExecuteStep.access$000(ExecuteStep.java:40)
    at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:53)
    at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:50)
    at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
    at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
    at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
    at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
    at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
    at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
    at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:79)
    at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:79)
    at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:50)
    at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:40)
    at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:68)
    at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:38)
    at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:50)
    at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:36)
    at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:41)
    at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:74)
    at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:55)
    at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:51)
    at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:29)
    at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:58)
    at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:39)
    at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:60)
    at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:27)
    at org.gradle.internal.execution.steps.BuildCacheStep.executeWithoutCache(BuildCacheStep.java:180)
    at org.gradle.internal.execution.steps.BuildCacheStep.execute(BuildCacheStep.java:75)
    at org.gradle.internal.execution.steps.BuildCacheStep.execute(BuildCacheStep.java:46)
    at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:40)
    at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:29)
    at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:36)
    at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:22)
    at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:105)
    at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:98)
    at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:53)
    at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:37)
    at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:85)
    at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:42)
    at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:37)
    at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:27)
    at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:92)
    at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:50)
    at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:114)
    at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:57)
    at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:73)
    at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:47)
    at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:92)
    at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:92)
    at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:33)
    at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:38)
    at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:43)
    at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:31)
    at org.gradle.internal.execution.steps.AssignWorkspaceStep.lambda$execute$0(AssignWorkspaceStep.java:40)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution$2.withWorkspace(ExecuteActionsTaskExecuter.java:284)
    at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:40)
    at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:30)
    at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:37)
    at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:27)
    at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:44)
    at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:33)
    at org.gradle.internal.execution.impl.DefaultExecutionEngine$1.execute(DefaultExecutionEngine.java:76)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:185)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:174)
    at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:109)
    at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
    at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
    at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
    at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
    at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
    at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
    at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
    at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:79)
    at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:79)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
    at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:74)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:402)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:389)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:382)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:368)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:61)

Maybe someone has encountered or understands what the problems are? I tried Googling, but I didn't find any solutions, I would be glad to help

A: Most probably a problem with your Java Installation because the error point towards your java.exe process. Remove java installations and install the latest supported version.


text:
Q: Model doesn't update the database For some reason the method dbase.SaveChanges() can't update the database because roomid should be null.
But the debugger does say that room1.id is set to 2?
Can somebody please help me with this ?
private void button1_Click(object sender, EventArgs e)
{
    Room room1 = new Room();
    room1.Id = 2;
    dbase.AddToRoom(room1);
    dbase.SaveChanges();
}

A: i'm not sure this is actually ADO.NET, it seems more like entity framework or linq to SQL.
It's also not quite clear what you're trying to do.
If you are trying to add a new Room to the database, i would advise setting some properties, otherwise you are just inserting an empty room.
var room1 = new Room();
room1.RoomNumber = 4;
room1.Available = true;
//...
dbase.AddToRoom(room1);
dbase.SaveChanges();

If this is what you are trying to do, then you do not need to specify the ID for the room (if the ID column is set to auto-increment that is.)
if you are trying to update a room instead of inserting a new one you can do something like this:
var roomToUpdate = dbase.Rooms.Where(x => x.id == id).FirstOrDefault();
roomToUpdate.Property ="something";
//...
dbase.Update(roomToUpdate)
dbase.SaveChanges();

Again, its not entirely clear what exactly you are trying to do so if i'm wrong, please elaborate a little more.


text:
Q: Loading JSON response file into caching database in TOSCA I have a JSON response file that is coming from an API and contains multiple data sets. Now, I want to load that file into a caching database in TOSCA and create a table that I can query using SQLite DB. I was able to achieve this when the file only contained one data set. However, when I tried it with a file containing multiple data sets, it showed the error message 'Sql logic error: Duplicate column name'.
Note: I should not modify the JSON response file.
I have tried loading the response file using "JSON/XML FILE LOAD INTO CACHING DATABASE" Module.


text:
Q: Wordpress query from usermeta? Let's say I want to display a user's billing address with this SQL:
SELECT um.meta_value
FROM wp_usermeta um
INNER JOIN wp_users u ON u.ID = um.user_id
WHERE um.meta_key = 'billing_address_1' AND u.user_login='1234'

I know I can use $wpdb->get_results($myqueryhere), but is there a built-in Wordpress function (which I can't seem to web search) to get stuff from the wp_usermeta table that will look much cleaner?

A: Yes you can use the get_user_meta() function to get user meta data
Try like
get_user_meta($user_id, 'billing_address_1');

A: if you want to get data using wordpress built in function then,
use

*

*get_user_meta()

*get_usermeta()


text:
Q: Print specified value from an JS object I have a ldap_search function in my php script. I get some user information from the logged in user. I encoded it to json and set a cookie for these information. In my js, i used the jquery function parseJSON to create a js object from the cookie. Now i want to print the name of the user in a field. How can i get it worked?
Edit: I want to handle the output from the js.

A: simple,
console.log(object[0].givename[0]);


text:
Q: Problem with installing dropbox I am trying to install "Dropbox" on my laptop and it keeps throwing the following error at me all the time.
laptop@laptop:~$ dropbox start -i

Starting Dropbox...
Dropbox is the easiest way to share and store your files online. Want to learn more?

Error: Trouble connecting to Dropbox servers. Maybe your internet connection is down, or you need to set your http_proxy environment variable
The installation of Dropbox failed.

I have tried
cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -

which results in
--2013-01-17 17:53:28--  Resolving proxy.hs-karlsruhe.de (proxy.hs-karlsruhe.de)... 193.196.64.2
Connecting to proxy.hs-karlsruhe.de (proxy.hs-karlsruhe.de)|193.196.64.2|:8888... connected.
Proxy tunneling failed: Proxy Authentication RequiredUnable to establish SSL connection.

gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now

Then I've tried
https_proxy=http://proxy.hs-karlsruhe.de:8888 dropbox start -i

and that gives an error message too. Please help!

A:
Proxy tunneling failed: Proxy Authentication Required

You have to provide username and password to authenticate with the proxy. Try the following:
export http_proxy="http://<username>:<password>@proxy.hs-karlsruhe.de:8888"
export https_proxy="http://<username>:<password>@proxy.hs-karlsruhe.de:8888"

then run dropbox start -i.


text:
Q: Python installation i have a machine with two users accounts.
i installed python in the first account without any problem but when am gone to install into the second account it cause the following error
checking for C compiler default output file name... configure: error: C compiler cannot create executables

caused when execute the following command:
./configure --prefix="/home/df/python5"

i don't why ? could anyone help me
Thanks in Advance

A: When you execute ./configure in what folder you are (absolute path) ?
Check if this folder and sub-folders are read-writable for your "second" user account.
Seems you have no write access ...
Anyway, why do you want to install the same python two times ?

A: Take a look at the contents of config.log, it lists what commands the configure script is trying to execute in order to find out where your C compiler is and what parameters it supports. Search for the error message in the log file, scroll a few lines up and you should see what commands were executed that led to this error message. Maybe it helps you figure out why the script is not able to find a suitable C compiler.
For instance, this is the line I see in a config.log file on my computer corresponding to the test that failed for you:
configure:2827: checking for C compiler default output file name
configure:2854: gcc    conftest.c  >&5
configure:2857: $? = 0
configure:2895: result: a.out

For the record, $? = 0 means that the command was executed successfully.


text:
Q: JQuery not working in Jade I was making a simple cart for my site.But JQuery is not working
Here's the code:
  head
    meta(charset="utf-8")
    link(href = "/bootstrap/dist/css/bootstrap.min.css", rel = "stylesheet")
    script(src = "/jquery/dist/jquery.min.js")
    script(src = "/bootstrap/dist/js/bootstrap.min.js")
    script(src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js")
    script(src='./cart.js')
    style
        include style.css
                .cart-body
                    ul
                        -for(var i in Cart)
                            if(!Cart[i].cId)
                                continue
                            li
                                .li-checkbox
                                    input(data-id= '#{Cart[i].cId}', data-index= '{#i}', data-price='{#Carts[i].cPrice}', class="li-checkbox input" ,type= 'checkbox')
                                .li-img
                                    img(src="#{Cart[i].cImgSrc}")
                                .li-content
                                    a(herf= '/shop/#{item_id}') #{Cart[i].cName}
                                .li-price
                                    span #{Cart[i].cPrice}
                                .li-quantity
                                    a(data-type='add', herf= 'javascript:void(0);', class='btn btn-default btn-xs') +
                                    input(id= 'Q#{i}', style= 'width: 40px;', type= 'text', value= '#{Cart[i].cQuantity}')
                                    a(data-type='subtr' herf= 'javascript:void(0);', class='btn btn-default btn-xs') -
                                .li-del
                                    a(herf= '/delFromCart/#{Cart[i]._id}', class= 'btn btn-primary btn-xs') deleted

//this is the part of JQuery
$(function() {
      $('.li-quantity').click(function() {
        var self = $(this);
        var type = self.attr('data-type'),
          num = parseFloat(self.siblings('input').val());
        if (type == 'add') {
          num += 1;
        } else if (type == 'subtr') {
          if (num > 1) {
            num -= 1;
          } else {
            return false;
          }
        }
        self.siblings('input').val(num);
        tamount();
      });

RUN in Node with Express ! They told me my question is mostly code,so I paste some important code in the text

A: You are selecting a div tag with your $('.li-quantity') command, and then reading its data-type attribute. But you added your data-type attribute to an internal hyperlink.
Change your code like so:
$('.li-quantity').click(function() {
  var self = $(this);
  var type = $('a[data-type]', self).attr('data-type'),
       num = parseFloat(self.siblings('input').val());


text:
Q: BigQuery wildcard schema inference clears valid STRUCT Given tables, table_1 and table_2below.
CREATE TABLE dataset.table_1(
  timestamp_ TIMESTAMP,
  dimension1 STRUCT< dimension2 STRUCT< field1>>>
)

CREATE TABLE dataset.table_2(
  timestamp_ TIMESTAMP,
  dimension1 STRUCT< dimension2 STRUCT< dimension3 STRUCT<field1>>>
)

When I perform following wildcard search below, returned schema completely replaces schema from table_1 with table_2 for all structs. If fields are not structs, all new fields are appended. Is this an expected behavior? Should't schema inference happen within matched tables via suffix as well rather than just *?
SELECT *
FROM `project.dataset.table_*`
WHERE _TABLE_SUFFIX = '1'

A: From the documentation:

BigQuery uses the schema for the most recently created table that matches the wildcard as the schema for the wildcard table.

Said differently, the reference schema comes from the most recent table that matches the wildcard, and the filter on the _TABLE_SUFFIX pseudo column is irrelevant in determining the schema.


text:
Q: QuickFill/flood fill algorithm I need a flood fill algorithm to fill existing raster shapes with various colors and fill patterns. From what I know, the QuickFill algorithm is the best way to do a flood fill. I've found a number of implementations, but they are all in C++ and use Windows SDK functions. The problem is that I need a .NET implementation.
If worse comes to worse I can write a new implementation, but I would rather use an existing implementation (that hopefully doesn't have bugs). Is anyone aware of an existing flood fill implementation in C#/VB.NET?

A: I like a lot to work with the Aforge Library that has two good FlodFill implementations, but both are 4 directional only.
If you need other implementations there exist two code project articles Flood Fill Algorithms in C# and GDI+ and Queue-Linear Flood Fill: A Fast Flood Fill Algorithm.
And if you like to dig in the code and learn, there is the Paint .Net project that has an excelent flood fill implementation.


text:
Q: Differential clock input on ZedBoard Working with the FPGA section of the Zynq chip of the Zedboard. I want to use an external signal as clock  (in any case, the tool infers that it is a clock since I have @(posedge sclk_loopback) in the HDL).
From the forums, I see that I need to use "clock capable pins", and the JA4 and JA10 are the two available "clock capable" pins in the PMOD connectors.  However, I get this error:
[Place 30-876] Port 'sclk_loopback'  is assigned to
PACKAGE_PIN 'AA8'  which can only be used as the N
side of a differential clock input.
I can't seem to find the necessary information to follow through.  It looks like JA4 would be the positive input and JA10 the negative --- if so, do they have to be complementary signals?  or would it work if I tie JA10 to GND and then feed a clock signal through JA4?
Any pointers will be much appreciated.
Note:  the circuit does work if I override the DRC check as suggested at the end of the error message  (set_property CLOCK_DEDICATED_ROUTE FALSE...).
But it does not work reliably at the speed that I need it to work, so I suspect my next step is to fix this external clock issue.
Thanks!

A: I don't know that particular board, but there is more then you ever want to know about the clocking on the 7 series parts here:
http://www.xilinx.com/support/documentation/user_guides/ug472_7Series_Clocking.pdf
Basically you can run a single ended clock into the thing (Subject to picking an appropriate IO standard), but there are constraints to watch out for if you wish to clock multiple regions from one input.
Single ended clocks (Not usually a good idea at high speed!) must go in on the positive half of the pair (You can use the negative pin as a general IO pin if using a single ended IO standard).
For a global clock you want a pin with MRCC (Multi region clock capable) in the name Vivado pin planner is useful here for figuring out what can do what.
73


text:
Q: How to create an object of any class that is available in the solution I have a serious question for you guys. I am working on a project that has hundreds of classes. Why cant i access all classes if i want to create an object of that class.
For example: I have Class A, B and C.
In Page 1, i can create an object of A and B but not C. When i try to type in Class C, the intellisense does not work. I need to access class C to get some of the functions used in it.
What can i do to get access to create objects of class C??

A: Chances are you're missing either:

*

*An assembly reference (to the project containing class C)

*A using directive for the namespace containing class C

For example, to use the NetworkStream class, you'd need a reference to the System.dll assembly, and you'd usually have a using directive like this:
using System.Net.Sockets;

in the class that needed to use it. You don't have to have a using directive - you can specify the full name explicitly - but it's usually a good idea.
Now it's also possible that class C is internal to the project it's part of, and you're in a different project - which means that you don't have access to it (and you're not meant to). Or perhaps you're trying to call a constructor and there aren't any publicly available ones, for example.

A: This sounds like a namespace issue.  You can put classes into unique namespaces to avoid naming conflicts between classes and also to help organize your code.  Take a look at each class and determine what namespace it resides in.  If they reside in different namespaces you will have to put a using statement at the top of the class your trying to access them from.  Also if some of the class reside in physical different projects you will have to reference them as well.  Hope this helps.
Enjoy!

A: Most likely class C doesn't exist within the same assembly or namespace as the other classes. Double check your references and using statements and you will likely find class C will become available to you.


text:
Q: insert and return document in a single AQL query When I insert a document into a collection with AQL it returns an empty list.
arangosh [test]> db._query('INSERT @document INTO vertices', {document: {name: "bar"}}).toArray()
[ ]

Is there a way to insert a document and get the complete document back in a single AQL query?
What I am hoping to get back is:
{
  "_id": "vertices/641272433780",
  "_key": "641272433780",
  "_rev": "641272433780",
  "name": "bar"
}

A: This is possible since ArangoDB 2.4. To return the created document, the original query
INSERT @document INTO vertices

has to be changed into
INSERT @document INTO vertices LET result = NEW RETURN result

This will also work for multi-document INSERTs and also for UPDATE/REPLACE and REMOVE. The following quotes from the 2.4 documentation describe the syntax:

To return documents from a data-modification query, the INSERT, REMOVE, UPDATE or REPLACE statement must be immediately followed by a LET statement that assigns either the pseudo-value NEW or OLD to a user-defined variable. The LET statement must be followed by a RETURN statement that returns the variable introduced by LET.
NEW refers to the inserted or modified document revision, and OLD refers to the document revision before update or removal. INSERT statements can only refer to the NEW pseudo-value, and REMOVE operations only to OLD. UPDATE and REPLACE can refer to either.

A: Once the feature is implemented, its going to look like that:
INSERT expression IN|INTO collection [ OPTIONS expression ] WITH NEW INTO variable RETURN variable;

REMOVE expression IN|INTO collection [ OPTIONS expression ] WITH OLD INTO variable RETURN variable;

UPDATE expression IN|INTO collection [ OPTIONS expression ] WITH OLD|NEW INTO variable RETURN variable
UPDATE expression WITH expression IN|INTO collection [ OPTIONS expression ] WITH OLD|NEW INTO variable RETURN variable

`


text:
Q: python difference between imported and defined class I would like to create dependence between some parameters of instances (not necessarily of the same class as in example). I came up with folowing code, which worked until I decided to move it into module and use it by importing.
class objectD(object):
  def __init__(self,val1,val2,val3):
    self.val1 = val1
    self.val2 = val2
    self.val3 = val3

  def __str__(self):
    return str(str(self.val1)+","+str(self.val2)+","+str(self.val3))

  def dependence(self,dependent):
    print "values val1 and val2 of "+str(self)+" now depend on "+dependent
    self.val1 = eval(dependent).val1
    self.val2 = eval(dependent).val2
    self.dependent = dependent

  def update(self):
    self.val1 = eval(self.dependent).val1
    self.val2 = eval(self.dependent).val2

#test
obj1 = objectD(350,4,500)
print obj1
obj2 = objectD(230,1,1000)
print obj2
obj2.dependence("obj1")#problem with imported class occurs there
print obj2
obj1.val1 = 1315
obj1.val2 = 6464
print obj1
obj2.update()
print obj2

Problem seems to be in assigning dependence to instance which by using imported version of the class simply does not exist according to python. It seems to me, that calling method dependence() on instance goes on in module and not in my script.
Is there a way to fix the import somehow, or perhaps some different approach to creating dependencies?

A: There should be no need for eval. Why not simply do this instead?
class objectD(object):
  def __init__(self,val1,val2,val3):
    self.val1 = val1
    self.val2 = val2
    self.val3 = val3

  def __str__(self):
    return str(str(self.val1)+","+str(self.val2)+","+str(self.val3))

  def dependence(self,dependent):
    print "values val1 and val2 of "+str(self)+" now depend on "+dependent
    self.val1 = dependent.val1
    self.val2 = dependent.val2
    self.dependent = dependent

  def update(self):
    self.val1 = self.dependent.val1
    self.val2 = self.dependent.val2

#test
obj1 = objectD(350,4,500)
print obj1
obj2 = objectD(230,1,1000)
print obj2
obj2.dependence(obj1)#problem with imported class no longer occurs there
print obj2
obj1.val1 = 1315
obj1.val2 = 6464
print obj1
obj2.update()
print obj2

This will work as expected, because dependent merely stores a reference to obj1, not the state of the object itself. So the call to update() will actually pull the new values.


text:
Q: Where are all the Debian ISOs? I am downloading ISOs for the "wheezy" distribution of Debian Linux for an old AMD box without any Internet. However, the index at http://cdimage.debian.org/debian-cd/7.1.0/i386/iso-cd/ only lists the first 8 CDs while the MD5SUMS file has hashes for over 70 ISO images. So where are the rest of the ISOs? Is there an alternative site to FTP these?

A: From the Debian CD FAQ:

Some Images are missing! Only the first n images are available! Where is the rest?
We don't store/serve the full set of ISO images for all architectures, to reduce the amount of space taken up on the mirrors. You can use the jigdo tool to recreate the missing ISO images instead.

Don't feel bad about not finding the FAQ. I had to hop on IRC and ask the dpkg bot.

A: If you go to this URL on the Debian website, http://www.debian.org/CD/http-ftp/, you'll find what you're looking for. The links to the various architectures are available towards the bottom of the page.
Here' are the main 2 you're probably looking for:

*

*i386 Debian 7.1.0 DVD ISO

*amd64 Debian 7.1.0 DVD ISO
The above page is also available from the Debian page. In general it's best to use bittorrent or jigdo to download these large ISOs.

A: You can find all .iso images for all architectures here.


text:
Q: when diff'ing between master and branch-n, how can I see a graphical view of differences? with GIT:
when diff'ing between master and branch-n, how can I see a graphical view of differences?
i.e. I want to see a list of all files that are different, and a graphical view that let's me manually merge files if I want to (if I don't want to auto-merge).
Say after I manually view each file that was changed, I want to merge all, can I do that in a single command?

A: gitk is an excellent tool but it requires X-Server. So, if you are in Mac you need to launch X11 before running gitk. In windows you can install cygwin with X11 and of course in Linux (with x) it just works.

A: Try "git difftool" instead of "git diff".  There are several options for the visual differencer that will be used.

A: You can configure the difftool of your choice.  I know a couple devs who have wired up p4merge for both mergetool and difftool.  Check out the git config man page for particulars.
Also, if you are on OS X, gitx is quite nice for visually display of commit history and changes made.


text:
Q: plasma popup in Ubuntu I am looking for the source code for a plasma kind of popup and edit it to display my own messages.

This is the type of the popup i have been looking for. Can anyone suggest me some links. Thank you.

A: The package you're looking for is notify-osd.
Installation:

*

*Open a terminal (Ctrl+Alt+T).

*Run the following command:

sudo apt-get install notify-osd

Usage:
You can run it using notify-send.
For example, to make a notification:
notify-send <message>

where <message> is the message you'd like in the notification.
So, if you write notify-send "Hello World", the output would be something like

There are plenty of other options which you can read on the man page.

-u,  --urgency=LEVEL  Specifies  the  urgency   level   (low, normal, critical).
-t, --expire-time=TIME
                Specifies  the  timeout  in  milliseconds at which to expire the
                notification.
-i --icon=ICON[,ICON...]
                Specifies an icon filename or stock icon to display.

P.S.: If you'd like to modify the notifications, here is an answer that does just that.


text:
Q: Calculate $\int_{-\infty}^{\infty}\frac{e^{-i x}}{x^2+1}dx$ using residue theorem I need to calculate $\int_{-\infty}^{\infty}\frac{e^{-i x}}{x^2+1}dx$ using the Residue theorem.
I know that I should choose an upper semicircle so that for
$\gamma=\left \{ z\in\mathbb{C}: z=Re^{it}, t\in[0,\pi] \right \}$
$\left | \int_{\gamma}^{ }\frac{e^{-i z}}{z^2+1}dz \right |\overset{R\rightarrow \infty}{\rightarrow}0$
Then I'm left with the original integral which now equals to
$2\pi i Res(\frac{e^{-i z}}{z^2+1},i)=2\pi i (-\frac{i e}{2})=\pi e$
But if I choose a lower semicircle the answer is
$2\pi i (-Res(\frac{e^{-i z}}{z^2+1},-i))=2\pi i (-\frac{i}{2e})=\frac{\pi}{e}$
Why do I get 2 different answers for the same integral? Where is my mistake?
Thanks

A: It's not as if you had an option here. The integral along the top half of the semicircle centered at $0$ with radius $R$ goes to $\infty$ as $R\to\infty$. This does not occur with the bottom half; in that case, it goes to $0$.
If the numerator was $e^{ix}$, then you would have to choose the top half and not the bottom half.

A: If you let $x=a+bi$, then $\exp(-ix)=\exp(-i(a+bi))=\exp(-ai)\exp(b)$, so it will only go to $0$ if you choose the bottom half (Where $b=\Im(x) <0$).


text:
Q: How to I use multiple selector

How can i select "div" and "a" at same time?

A: CSS
div, a {

}

JS
document.querySelectorAll("div, a");

const select = document.querySelectorAll("div, a");
console.log(select);

A: You can select both div and a with
div,
a{..style goes here..}

But this will be applied to all the div and a tags in the page so you have to include a div element or a section.
    section{
    div,a{
        style here
    }
}

So it will be apllied to a specific section

A: YOU CAN SELECT 2 DIFFERENT HTML ELEMENTS by putting both elements in same selector seperated by a ,
div,a {
   background-color: yellow;
}


text:
Q: Get RadListBox ID Value in C# to Change Textbox.Text I have a RadListBox which has an itemTemplate that displays the display_text. I am using a SQLDataSource which grabs all of the data from a table. I would like to know how I can get the ID from the C# side to change the TextBox.Text after I click on an listBox item and SelectedIndexChanged is fired.
My SQL datasource has a column named ID and I wanted to grab that ID and set it in the _carID. Something like int _carID = LBcarDetail.FindControl("ID").Value; //(this is not correct, just an example of something similar that may be used but I am not sure of the exact syntax.)
<telerik:RadListBox ID="LBcarDetail" runat="server" DataSourceID="SqlDataSource1" AllowTransfer="true" AutoPostBackOnTransfer="true" OnSelectedIndexChanged="LBcarDetail_SelectedIndexChanged"
    Height="700px" SelectionMode="Multiple" Width="615px" Skin="Outlook" EnableDragAndDrop="true" AllowReorder="true" AppendDataBoundItems="true" AutoPostBack="true">
    <ButtonSettings VerticalAlign="Top" ShowTransferAll="false" ShowTransfer="false" ShowDelete="true"></ButtonSettings>
    <ItemTemplate>

                        display_text:

                        <%# Eval("display_text") %>

    </ItemTemplate>
</telerik:RadListBox>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:iConnectionString %>"
    SelectCommand="SELECT * FROM [intranet].[dbo].[TableItems] ORDER BY sort_order"></asp:SqlDataSource>

I am trying to change the display text using the following:
    protected void LBcarDetail_SelectedIndexChanged(object sender, EventArgs e)
        {
    //int _carID = 2; //hardcoded 2 will change display text to the correct value for item with ID of 2
    int _carID; //here is where I am trying to grab the ID of the listBox item that was selected
    string _displayText;

        using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["iConnectionString"].ToString()))
        using (SqlCommand comm = new SqlCommand("sp_car_detail_get", conn))
        using (SqlDataAdapter adapter = new SqlDataAdapter(comm))
        {
            comm.CommandType = CommandType.StoredProcedure;
            comm.Parameters.Add(new SqlParameter("@id", id));

            DataSet ds = new DataSet();
            adapter.Fill(ds);
            foreach (DataRow r in ds.Tables[0].Rows)
            {
                _displayText = r["display_text"].ToString();

                tbDisplayText.Text = _displayText;
            }
        }
}

A: I added DataValueField="id" to the RadListBox and used this to get the value:
int id = Convert.ToInt32(LBcarouselDetail.SelectedItem.Value);


text:
Q: Variable that holds "list of all open buffers" in Vim? :vimgrep looks like a really useful thing.
Here's how to use it:
:vim[grep][!] /{pattern}/[g][j] {file} ...

:help says that you can essentially glob {file} to name, say, *.c for the current directory. I may have started Vim with a list of files that is complicated enough that I don't want to manually type it in for {file}, and besides Vim already knows what those files are.
What I would like to do is vimgrep over any of:

*

*:args

*:files

*:buffers
What variable(s) would I use in place of {file} to name, respectively, any of those lists in a vimgrep command?

A: You can do this:
:bufdo vimgrep /pattern/ %

% substitutes the buffer name.

A: To [vim]grep the list of files in the argument list, you may use ## (see :help cmdline-special).
:vimgrep /re/ ##

I am unaware of a similar shorthand for the buffer list, but you may be able to do something like:
:argdelete ##
:bufdo argadd %

... and then use ##.  Or use :n to open new files (which will be added to the arg list) instead of :e.

A: Here is a slightly refined version of one of the answers. The following command searches for the pattern in all opened tabs and remembers results in quickfix list:
:cex [] | tabdo vimgrepa /pattern/ %

cex [] sets contents of quickfix list to empty list. You need to call it first because vimgrepa accumulates search results from all the tabs. Also, you can replace tabdo with argdo, bufdo and windo.
To view search results execute:
:cope

This method, however, has limitation: it can only search in tabs which already have file names assigned to them (% would not expand in a new tab).
EDIT:
You can also shortcut the command into function in your ~/.vimrc like this:
function TS(text)
    exe "cex [] | tabdo vimgrepa /" . a:text . "/ %"
endfunction
command -nargs=1 TS call TS(<q-args>)
cnoreabbrev ts TS

With last line you can call your function like this:
:ts from game import

where words after ts is a search pattern. Without last line you have to type function name in upper case.

A: Can't you catch the result in these commands into a register (:h :redir), and insert it back into :vimgrep call (with a :exe).
Something like:
:exe "vimgrep/pattern/ " . lh#askvim#Exe(':args')

Notes:

*

*lh#askvim#Exe is just a wrapper around :redir ; nothing really complex

*some of these results may need some processing (see :args that adds square brackets)

*Sometimes there is a function that returns exactly what you are looking for, see join(argv(), ' ') in :args case

*Regarding :buffers, may be something like:

.
function BuffersList()
  let all = range(0, bufnr('$'))
  let res = []
  for b in all
    if buflisted(b)
      call add(res, bufname(b))
    endif
  endfor
  return res
endfunction
:exe 'vimgrep/pattern/ '.join(BuffersList(),' ')

A: Very helpful script !
A minor fix: The search finds one of the buffers twice - first time as the numbered buffer, second as buffer #0 => alternate buffer.
Hence, we shall change the line to "range(1, bufnr('$'))" to skip the alternate buffer and show the search results once.


text:
Q: how to parse JsonArray and set value on Textview in Android Below is my Json response from getting when Hit on Url with parsing parameter strlogid=101
[

  {

    "earnpoints": 411,
    "type": "C"
  },

  {

    "earnpoints": 1600,
    "type": "G"
  },

  {

    "earnpoints": 13540,
    "type": "I"
  }

]

Below is my code-To show Points on 3 different textview
private class PointTask extends AsyncTask<String, Void, Boolean> {

        protected Boolean doInBackground(final String... args) {

            JSONParse jParser = new JSONParse();

            HashMap<String, String> hMap = new HashMap<>();
            hMap.put("strlogid", "101");
            JSONArray jsonarray = jParser.getJSONFromUrl(url,hMap);

            // get JSON data from URL
            for (int i = 0; i < jsonarray.length(); i++) {
                try {
                    JSONObject c = (JSONObject) jsonarray.get(i);
                     c_point=c.getString("points");
                     g_point=c.getString("points");
                    i_point=c.getString("points");
                    t_point = cpoint+gpoint+ipoint;
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
            return null;
            }
        @Override
        protected void onPostExecute(final Boolean success) {
            txtTotalPoints.setText(t_point);
            txtOwnPoints.setText(g_point);
            txtClubPoints.setText(c_point);
            txtVoucherPoints.setText(i_point);

        }
    }

TotalPoints,OwnPoints,ClubPoints,VoucherPoints are show on Textview respectively

A: Dont use async task for json parsing. I would reccomend you to use volley.
Here is the link\
http://www.androidhive.info/2014/05/android-working-with-volley-library-1/

A: Try this
protected Boolean doInBackground(final String... args) {

        JSONParse jParser = new JSONParse();

        HashMap<String, String> hMap = new HashMap<>();
        hMap.put("strlogid", "101");
        JSONArray jsonarray = jParser.getJSONFromUrl(url,hMap);

        // get JSON data from URL
        for (int i = 0; i < jsonarray.length(); i++) {
                JSONObject c = (JSONObject) jsonarray.get(i);
                if (c.getString("type").toString().equalsIgnoreCase("C")) {
                    c_point = c.getInt("earnpoints");
                } else if (c.getString("type").toString().equalsIgnoreCase("G")) {
                    g_point = c.getInt("earnpoints");
                } else if (c.getString("type").toString().equalsIgnoreCase("I")) {
                    i_point = c.getInt("earnpoints");
                }
            }
            t_point = cpoint + gpoint + ipoint;
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return null;
        }
    @Override
    protected void onPostExecute(final Boolean success) {
        txtTotalPoints.setText(t_point);
        txtOwnPoints.setText(g_point);
        txtClubPoints.setText(c_point);
        txtVoucherPoints.setText(i_point);

    }
}

A: @Override
public void onPostSuccess(String result, int id, boolean isSucess) {
    // Log.e("re<><><><>", result);
    try {
        JSONArray ja = new JSONArray(result);
        for (int arr = 0; arr < ja.length(); arr++) {
            JSONObject json1 = ja.getJSONObject(arr);

            Log.e("length", "" + ja.length());
            // Getting JSON Array node
            String earnpoints= json1.getString("earnpoints");
            String type = json1.getString("type");
        }
     catch (JSONException e) {
        e.printStackTrace();
        Toast.makeText(LoginPage.this, "Please try again later", Toast.LENGTH_SHORT).show();
    }
}


text:
Q: Using Switch in RecyclerView srcoll I have use the Switch in the RecyclerView. It have facing the issue of recycling behaviour. When I switch on the 1st position ,it automatically on the switch at 10 postion ... I think it due to reuse of the view. How to fix it. find the screenshot:
 https://www.dropbox.com/s/4ms2jf9e28fyc7u/error.png?dl=0
    private void setAdapter(ArrayList data) {

            ManageCategoryAdapter adapter = new ManageCategoryAdapter(data);
            adapter.SetOnItemClickListener(listClick);
            mRecyclerView.setAdapter(adapter);
        }
     public class ManageCategoryAdapter extends RecyclerView.Adapter<ManageCategoryAdapter.ViewHolder> {

    private ArrayList<String> catData=new ArrayList<>();
    private OnItemClickListener mItemClickListener;

    public ManageCategoryAdapter(ArrayList<String> listadap) {
        catData=listadap;
        System.out.println("$$$$$$$$$"+"adapterclass");

    }

    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.fragment_manage_list, parent, false);
        return new ViewHolder(v);
    }

    public void onBindViewHolder(ViewHolder holder, int position) {

        holder.category.setText(catData.get(position));

    }

    public int getItemCount() {

        return catData.size();
    }

    public void onClick(View view) {

    }

    public  class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {

        public TextView category;
        public Switch switchClick;

        public ViewHolder(View itemView) {
            super(itemView);
            category=(TextView)itemView.findViewById(R.id.cat_text);
            switchClick=(Switch)itemView.findViewById(R.id.switch_btn);
            switchClick.setOnClickListener(this);

        }

        @Override
        public void onClick(View v) {
            if (mItemClickListener != null) {
                mItemClickListener.onItemClick(v, getPosition());
            }

        }
    }
    public void myNotifyDataSetChanged(ArrayList list)
    {
        System.out.println("$$$notify");
        catData.addAll(list);
        this.notifyDataSetChanged();
    }

    public interface OnItemClickListener {
        public void onItemClick(View view, int position);
    }

    public void SetOnItemClickListener(final OnItemClickListener mItemClickListener) {
        this.mItemClickListener = mItemClickListener;
    }
}

This how I set the adapter class

A: You need to use this in the adapter:
@Override
    public int getItemViewType(int position) {
        return position;
    }

A: This is a very common problem with RecyclerView and there are lots of answers there in Stackoverflow.
You already have understood your problem i.e. reusing the views. So you might take a look at these answers to get a better idea about how you can overcome it.

*

*Put an else condition everywhere you need to update a view of a list
item dynamically.

*Using another list to keep track of the list items in which the
Switch is enabled or disabled. You can see this answer here.

These will do the trick for you I hope.


text:
Q: What does kernel entry in Grub configuration file mean I have looked at the GNU GRUB Manual 1.99 at (http://www.gnu.org/software/grub/manual/grub.html) but I cannot find an explanation of what the kernel entry / command in the grub.conf file means. I get what's the meaning of that entry but where is described what it actually is and what are proper.
I suppose this entry / command was actual in GRUB Legacy, but I cannot find where it is described...

A: See if this helps at all:
kernel
 - Specifies path of the kernel file.
 - The root partition is specified as a argument along with kernel directive.
 - This is is specified in conventional Linux format since this information is interpreted by Linux kernel.
 - ro tells the kernel to mount root file system as read-only.


text:
Q: How do I find out what triggers induced GCs in ASP.NET MVC application hosted on IIS? We observe that most of Gen2 (full) garbage collections in our app are induced, but struggle to find what actually triggers them. In particular, setting a breakpoint on GC.Collect doesn't help.
Moreover, we know that the app is far from consuming most of available memory before triggering Gen2 GCs -- typically it uses just about 8 GB out of ~ 14 or 30 GB available.
So there are actually two questions:

*

*What are some good ways to find out what code triggers induced GCs?

*Is there any way to somehow completely suppress induced GCs?

We use IIS 8 and .NET Framework 4.6.2.


text:
Q: Angular.js Form POST Returns Error 405 Method Not Allowed I keep getting a 405 error when trying to submit my form. Here's my controller:
'use strict';
angular.
    module('myApp').
    component('zipPopup', {
        templateUrl: 'zip-popup/zip-popup.template.html',
        controller: function ZipPopupController($scope, $http) {
            $scope.show = true;
            $scope.hide = function(){
                $scope.show = false;
            };
            $scope.user = {};
            $scope.regex = '\\d{5}';

            $scope.submitForm = function(isValid) {
                if(isValid) {
                    $http({
                        method  : 'POST',
                        url     : '/leads',
                        data    : $scope.user,
                        headers : {'Content-Type': 'application/x-www-form-urlencoded'}
                    })
                    .success(function(response) {
                        $scope.show = false;
                    })
                    .error(function(response) {
                        console.log(response);
                    });
                }
            };
        }
    });

Heres my view:

        <form name="zipForm" class="zip-form" ng-submit="submitForm(zipForm.$valid)" novalidate>
            <input ng-model="user.zipCode" ng-pattern="regex" name="zipCode" class="form-control text-center" placeholder="Your Zip" required />

A 5 digit zip code is required.

            <button type="submit" class="btn btn-block" ng-disabled="zipForm.$invalid">Submit</button>
        </form>

Is there a different file or something that I need to modify to allow this to happen? What am I missing?

A: The server is telling you that the particular method (GET, POST, PUT, PATCH, DELETE, etc.) can't be accepted by the server. This is most likely due to the fact that your API route/endpoint doesn't have a POST method configured.
For example, in ExpressJS you'd need to configure a route that accepts POST by doing the following:
app.post('/leads', function (req, res) {
  res.send('POST request to the homepage');
});

For more information on the 405 Method Not Allowed error, click here.

A: I had a similar issue a couple of weeks ago. It turns out that the server was only accepting 'Content-Type' of a particular type in the headers.
However changing the Content-Type to application/json solved the issue:
$http({
    method  : 'POST',
    url     : '/leads',
    data    : $scope.user,
    headers : {'Content-Type': 'application/json'}
})
.success(function(response) {
    $scope.show = false;
})
.error(function(response) {
    console.log(response);
});

P.S. I'm not saying this will necessarily solve your issue, but this is a solution related to this type of problem. Just find out what kind of input your server is expecting.

EDIT
I'm not saying to send 'application/json' as the Content-Type. All I'm saying is that Find what type of content is acceptable and send that type of header.

A: you try to let the back-end engineer to implement the OPTIONS method.
https://en.wikipedia.org/wiki/Cross-origin_resource_sharing#Preflight_example


text:
Q: ElementTree write method I am trying to write some XML to disk:
import xml.etree.ElementTree as ET

root = ET.Element("root")
doc = ET.SubElement(root, "doc")

ET.SubElement(doc, "field1", name="blah").text = "some value1"
ET.SubElement(doc, "field2", name="asdfasd").text = "some vlaue2"

ET.dump(root)
ET.write("filename.xml")

However I get the error AttributeError: 'module' object has no attribute 'write'
I can't figure out what module has the write attribute. All the examples I've seen online show the attribute as belonging to tree, but I don't know how to define tree. One source does this:
from xml.etree.ElementTree import ElementTree
tree = ElementTree()
tree.parse("index.xhtml")
tree.write("output.xhtml")

But I am not reading and parsing a file. Would appreciate some help, thanks.

A: You need
tree = ET.ElementTree(root)
tree.write("filename.xml")

You can also use
open('filename.xml', 'w').write(ET.dump(root))


text:
Q: Using Zipcode to get the city,state and country Google Map API I used Google Map API to get the city name, state, and country using the Postal zip code on my site. Google Address Autocomplete is working fine. But I don't need the autocomplete. Just I give the zip code and click the button, and it provides the address.
I faced the issue is TypeError: Cannot read properties of undefined (reading 'activeElement')
My code is very simple
<input type = "text" id="deliverTo" name="deliverTo" value = ""/>
<input type ="button" value ="Get Address" name ="Submit" onclick = "getcoastalzip()" />

<input type = "text" id = "ship_city"  name ="ship_city" Placeholder="City" />
<input type = "text" id = "ship_state"  name ="ship_state" Placeholder="State" />
<input type = "text" id = "ship_country"  name ="ship_country" Placeholder="Country" />
<input type = "text" id = "ship_postal_code"  name ="ship_postal_code" Placeholder="Postal Code" />
<script src="https://maps.google.com/maps/api/js?key=APIKEY=places" type="text/javascript"></script>

<script>
function getcoastalzip() {
    var input = document.getElementById('deliverTo').value;

    alert(input);

    var autocomplete = new google.maps.places.Autocomplete(input);
    console.log(autocomplete);
        autocomplete.addListener('place_changed', function() {

       var place = autocomplete.getPlace();

   console.log(place);

    console.log(place['address_components'][0]['long_name']);
    console.log(place['address_components'][1]['long_name']);
    document.getElementById('ship_city').value = place['address_components'][1]['long_name'];
    document.getElementById('ship_state').value = place['address_components'][2]['long_name'];
    document.getElementById('ship_postal_code').value = place['address_components'][0]['long_name'];
     document.getElementById('ship_country').value = place['address_components'][3]['long_name'];

});
 }
</script>

A: No, You can not use code to get the desired details as they are not unique. Each country has its own system of post codes, and they sometimes do overlap.


text:
Q: How to make linear css transition to SVG path? Am creating a guitar string like path SVG and I'm trying to integrate courses on the said path. So its kinda like a road path thing where there are few stages or modules in it.
What I wanted to achieve is to add a linear animation on the path whenever the current step is active. By linear animation I mean its kinda like a draw on svg but the only difference is that it fills the path itself. I can't find any resources how to do it and mostly the results are more on the Draw animation.
Currently I used transition:.5s all ease; to have simple animation but I want the linear animation to make it cooler.
Here's my pen for the svg https://codepen.io/leonardpbdigital/pen/eYpvNVL I added a simple script just for this demo.

A: As Paulie_D said in the comments, the key is animating the SVG stroke-dash-offset. Here's a little more detail about how that works.
Basically, it's creating a dashed stroke on the line (use an open path to make this work the best) where each "dash" is 100% the length of the line and each space between dashes is the same size. Then it moves the first "dash" from off the end of the path to fill the path up.
The key here is that the path definition in the CSS must include pathlength set to 1 (same as 100%).
Now you can animate the stroke properties in CSS. This includes stroke-width, stroke (color), stroke-width, etc.

.container {
 margin: 30px;
}

#path {
 stroke: #dadada;
 stroke-dasharray: 1;
 stroke-dashoffset: 0;
 fill: none;
 stroke-width: 10;
 stroke-linecap: round;
 stroke-linejoin: round;
 animation: reveal 3s linear infinite;
}

@keyframes reveal {
  from {
 stroke: #111111;
    stroke-dashoffset: 1;
  }
  to {
    stroke-dashoffset: 0;
 stroke: skyblue;
  }
}
<div class="container">
 <svg width="553px" height="239px" viewBox="0 0 553 239" x="0px" y="0px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <g fill-rule="evenodd">
        <path id="path"
  pathLength="1"
  d="M10,11 L114.530616,11 C122.360858,11 126.275979,15.9504251 126.27598,25.8512759 C126.27598,35.7521268 126.27598,98.9884467 126.27598,215.560235 C126.27598,223.186745 129.049387,227 134.596203,227 C140.143019,227 190.952571,227 287.02486,227 C295.080229,227 299.107914,223.186745 299.107914,215.560235 C299.107914,207.933725 299.107914,190.752337 299.107914,164.016069 C299.461684,117.430837 317.3583,94.1382206 352.797762,94.1382206 C388.237223,94.1382206 439.637969,94.1382206 507,94.1382206"></path>
    </g>
 </svg>
</div>

But, simply using the stroked path alone means you don't have as much control. If you make the path an SVG mask there's so much more opportunity. For example, you can use a gradient background to color "sections" of the line. You can even reveal a picture. Here's an example of how you can use different colors and step to each section.


text:
Q: Cual es la forma correcta de inicializar un propiedad en MVVM Tengo una pregunta, ¿es correcto inicializar una propiedad full en el ViewModel de la siguiente manera?
public class MainViewModel : ViewModelBase
{
    private ObservableCollection<Driver> _drivers = new ObservableCollection<Driver>();
    public ObservableCollection<Driver> Drivers
    {
        get { return _drivers; }
        set { _drivers = value;
            RaisePropertyChanged();
        }
    }

}
¿Es correcto?, ¿es una mala práctica? o ¿se debe realizar de otra manera?. Mi pregunta surge ya que estaba tratando de llenar esa colección con un método que inicializaba el campo pero los cambios no se me reflejaban en el XAML que esta enlazado a la propiedad Drivers, Solo instanciando el campo _drivers de esta manera logre que funcionara.
Gracias.

A: No lo veo incorrecto, pero recomendaria inicializar en el constructor del ViewModel
public class MainViewModel : ViewModelBase
{
    public MainViewModel()
    {
        _drivers = new ObservableCollection<Driver>();
    }

    private ObservableCollection<Driver> _drivers = null;
    public ObservableCollection<Driver> Drivers
    {
        get { return _drivers; }
        set
        {
            _drivers = value;
            RaisePropertyChanged();
        }
    }

}

A: Cuidado, al parecer estas implementando INotifyPropertyChanged, si te bindeas a una propiedad antes de instanciarla, y la instancías asi:
_drivers = new ObservableCollection<Driver>();

No vas a llamar al Setter de la propiedad y por lo tanto, el XAML (GUI) no va a reaccionar ante el cambio.
Es decir tienes:
<DataGrid ItemsSource={Binding Drivers}> ... </DataGrid>

Y estas creando una instancia del campo privado _drivers, sin pasar por la propiedad observable Drivers, el XAML (GUI) no se va a dar cuenta del cambio
Crea la instancia usando la propiedad observable para "avisarle" al GUI que hay una nueva instancia:
Drivers = new ObservableCollection<Driver>();

Independientemente de esto y respondiendo a tu pregunta original, te recomiendo instanciar tus propiedades y variables en el constructor, o inclusive en un metodo separado por ejemplo "Inicializar()" y manda a llamar este metodo desde el constructor, asi tienes mas control sobre donde estas creando tus intancias, pero esto depende de las preferencias de cada quien
Inclusive puedes tener tus propiedades en una clase estatica y tenerlas de manera global accesibles a toda la aplicacion (parecido al patron "singleton")


text:
Q: How is this geometrical invariant called in English? I am studying affine and projective geometry and I have encountered some invariant: the cross ratio, which in Italia is called "birapporto" and another one which I do not know the name of in English. We referred to as "rapporto semplice"; if we are working on the real line as an affine space, and we  have three points $x,y,z$ it is the ratio $\frac{x-z}{y-z}$. This quantity is invariant under affine trasformazionee of the line. Could you help me? I have tried to find out how it is called din English, but I didn't find anything...
Thanks

A: In German, the cross ratio is called "Doppelverhältnis" which literally translates to "double ratio". The origin of that is because it's a ratio of ratios:
$$(a,b;c,d)=\frac{(a-c)(b-d)}{(a-d)(b-c)}=
\frac{\;\frac{a-c}{b-c}\;}{\;\frac{a-d}{b-d}\;}$$
The rightern expression is a ratio of two distance ratios: in the numerator the distance of $a$ and $b$ relative to $c$, in the denominator relative to $d$. Each of these fractions would be called a "Verhältnis", a ratio. If you wanted to distinguish it more clearly from the double ratio, you might call it a simple ratio, or perhaps a single ratio.
I would guess that your Italian prefix "bi" denotes something "double", that "rapporto" means "ratio", and that "semplice" means "simple". I would think "simple ratio" would be an appropriate term to use in this context. But I would not expect it to be understood without definition.
You could go for "ratio of distances", "ratio of oriented lengths" or something like that to provide a bit more detail of what you mean. But $\frac{a-b}{c-d}$ would be a ratio of distances, too. And invariant under affine transformations as long as all four are collinear. If you want your exact definition, for three points with $z$ occurring in both numerator and denominator, then I know no universally understood term for it, so I'd pick any of those suggested above and combine it with a short definition at first use.


text:
Q: How to get the translated fields of a doctrine table I'm  using I18n-behaviour to store translated values.
$i18n = new Doctrine_Template_I18n(array('fields' => array('title', 'text')));
$this->actAs($i18n);

With $tableFields = Doctrine_Core::getTable($componentName)->getFieldNames();  I can get a array with all the fieldnames of the doctrine component. However the fields that are being translated through the I18N-behaviour are not present in this array.
My question: how can i get the names of translated fields?

A: $table = Doctrine_Core::getTable('Page');
$template = $table->getTemplate('I18n');
$options = $template->getOptions();
$translated_fields = $options['fields'];
var_dump($translated_fields);


text:
Q: How do I do async inference on OpenVino I wrote a python server that uses an OpenVino network to run inference on incoming requests. In order to speed things up, I receive requests in multiple threads, and I would like to run the inferences concurrently.
It seems that whatever I do, the times I get are the same as non-concurrent solutions - which makes me think I've missed something.
I'm writing it in Python, using openvino 2019.1.144. I'm using multiple requests to the same plugin and network in order to try to make the inferences run concurrently.
def __init__(self, num_of_requests: int = 4):
   self._plugin = IEPlugin("CPU", plugin_dirs=None)
   model_path = './Det/'
   model_xml = os.path.join(model_path, "ssh_graph.xml")
   model_bin = os.path.join(model_path, "ssh_graph.bin")
   net = IENetwork(model=model_xml, weights=model_bin)
   self._input_blob = next(iter(net.inputs))

   # Load network to the plugin
   self._exec_net = self._plugin.load(network=net, num_requests=num_of_requests)
   del net

def _async_runner(detect, images_subset, idx):
    for img in images_subset:
        request_handle = self._exec_net.start_async(request_id=idx, inputs={self._input_blob: img})
        request_handle.wait()

def run_async(images):  # These are the images to infer
    det = Detector(num_of_requests=4)
    multiplier = int(len(images)/4)
    with ThreadPoolExecutor(4) as pool:
        futures = []
        for idx in range(0,3):
            images_subset = images[idx*multiplier:(idx+1)*multiplier-1]
            futures.append(pool.submit(_async_runner, det.detect, images_subset, idx))

When I run 800 inferences in sync mode, I get an avg. run time of 290ms
When I run in async mode I get avg run time of 280ms.
These are not substantial improvements. What am I doing wrong?

A: If you use wait(), the execution thread blocks until the result is available. If you want to use a truly async mode, you will need wait(0) which does not block the execution. Just launch the inference whenever you need and store the request_id. Then, you can check if the results are available checking if the returned value of wait(0) is 0. Be careful not to use the same request_id while the IE is doing the inference, that will cause a collision and it'll raise an exception.
However, in the code you provided, you cannot do this, because you are creating a thread pool in wich each thread executes inference of the image subset into a unique request_id. In fact, this is a parallel execution wich will give you a pretty fine performance, but it isn't "async" mode.
A truly async mode would be something like this:
while still_items_to_infer():
    get_item_to_infer()
    get_unused_request_id()
    launch_infer()
    do_someting()
    if results_available():
        get_inference_results()
        free_request_id()
        #This may be in a new thread
        process_inference_results()

This way, you are dispatching continuous inferences while waiting for them to finish.

A: You can refer to a sample code from C:\Program Files (x86)\IntelSWTools\openvino_2019.1.144\inference_engine\samples\python_samples\object_detection_demo_ssd_async\object_detection_demo_ssd_async.py or similar samples from the python_samples directory to check the way async mode is addressed.