text:
Q: Adding data to an array in usermeta and displaying it in a loop I have a front end post form where I take a file upload of an image. That image gets stored as a custom field which is easy enough to do. What I need to do though is store each unique image url for each user into an array in their usermeta. I want to do this so I can show them a list of those images they've already uploaded and give them the option of choosing one of those instead of uploading a new one.
So to elaborate I have a basic file upload choice in my form.
<input type="file" name="music_image" id="music_image"/>

Beneath this I need a check box select showing them the images of any others they have uploaded and somehow make it so if they choose a file they can't select an image an vice versa. And then I need to add the uploaded file to an array as usermeta on form submit. Awful explanation but I think it makes sense.
Here is what I use to activate the form.
 <?php if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) &&  $_POST['action'] == "new_post") {
if ( ! function_exists( 'wp_handle_upload' )) {
            require_once(ABSPATH . "wp-admin" . '/includes/image.php');
            require_once(ABSPATH . "wp-admin" . '/includes/file.php');
            require_once(ABSPATH . "wp-admin" . '/includes/media.php');
}
$file=$_FILES;
// Do some minor form validation to make sure there is content
if (isset ($_POST['title'])) {
    $title =  $_POST['title'];
} else {
    echo 'Please enter a game  title';
}
if (isset ($_POST['description'])) {
    $description = $_POST['description'];
} else {
    echo 'Please enter the content';
}
$tags = $_POST['post_tags'];

// Add the content of the form to $post as an array
$new_post = array(
    'post_title'    => $title,
    'post_content'  => $description,
    'post_category' => array(11),
    'tags_input'    => array($tags),
    'post_status'   => 'publish',           // Choose: publish, preview, future, draft, etc.
    'post_type' => fod_music  // Use a custom post type if you want to
);
$overrides = array( 'test_form' => false);
$uploaded_music = wp_handle_upload( $file['music_file'], $overrides );
$uploaded_music_art = wp_handle_upload( $file['music_image'], $overrides );
//save the new post and return its ID
$pid = wp_insert_post($new_post);
update_post_meta($pid,'music_code',$uploaded_music['url']);
update_post_meta($pid,'music_art',$uploaded_music_art['url']);
wp_redirect( get_permalink($pid));
exit();

}
do_action('wp_insert_post', 'wp_insert_post');
?>

A: Instead of saving the URL of the sideloaded file, save its ID. You can then attach post meta or a tax term to the new attachment indicating its album art.
That way your meta stores the ID of the current cover, and if you want a selection, just show attachments that are images with the associated postmeta indicating they belong to the current post. It will probably be enough to use the parent bit.
This gives you the extra flexibility of using image sizes. I'd advise you do the same for music files.
Use media_handle_sideload to handle your file upload, taken from http://core.trac.wordpress.org/browser/tags/3.4.1/wp-admin/includes/media.php:
258 /**
259  * This handles a sideloaded file in the same way as an uploaded file is handled by {@link media_handle_upload()}
260  *
261  * @since 2.6.0
262  *
263  * @param array $file_array Array similar to a {@link $_FILES} upload array
264  * @param int $post_id The post ID the media is associated with
265  * @param string $desc Description of the sideloaded file
266  * @param array $post_data allows you to overwrite some of the attachment
267  * @return int|object The ID of the attachment or a WP_Error on failure
268  */
269 function media_handle_sideload($file_array, $post_id, $desc = null, $post_data = array()) {

That should give you an attachment from your file upload, and attach it to the specified post. You can then do a selection by showing thumbnails of each cover using a radio selection, with the attachment ID of each cover image as the value.


text:
Q: MySql query optimization suggestions I have a very simple table and a query I would like to know if can be optimized in some way?
Is there something better to use than the EXPLAIN statement when looking for a query optimization?
It only has 1500 rows now, but it's intented to have a lot more (probably above 500,000 or 1,000,000 rows).
Query:
SELECT id, SUM( ABS(weight)) AS sumWeight FROM myTable GROUP BY id ORDER BY sumWeight ASC LIMIT 1

Table structre
Field    Type           Null        Key    Default   Extra
id       mediumint(8)   unsigned    NO     PRI       NULL
otherId  bigint(20)     unsigned    NO     PRI       NULL
weight   smallint(6)    NO          NULL

When I use EXPLAIN to see what's going on it displays:
select_type   table   type  possible_keys   key         key_len ref     rows    Extra
SIMPLE        myTable index NULL            PRIMARY     11      NULL    1573    Using temporary; Using filesort

A: *

*Make sure that you have created indexes on the columns which you are sorting and grouping

*You can use Aqua Data Studio and generate an explain plan from there. It shows more details like CPU time, disk IO usage, etc. That would further help you understanding what is taking how much time and where you should focus to optimize further.

redpajama_set_name: RedPajamaStackExchange


text:
Q: SVN checkout fails with "chunk delimiter was invalid" ERRORS:
When checking out a large project we receive error on a random file in the project:

*

*Could not read response body: SSL error:  decryption failed or bad record mac

Response was to disable SSL and restarted SVNServer.
Retested and got this error:

*

*chunk delimiter was invalid

So examined the SVNserver log:

*

*Error writing base64 data: APR does not understand this error code  [500, #620018]

*Provider encountered an error while streaming a REPORT response.  [500, #0]

*A failure occurred while driving the update report editor  [500, #620018]

We can recreate the above 100% of the time.

TRIED:
From here we tried:
Upgraded OpenSSL to latest version. Resulted in same errors above.
Copied the REPO to a new REPO to ensure no file corruption. Resulted in same errors above.
Installed SVNserver locally and tested taking network our of the equation. Resulted in same error above.
We think this may be isolated to the version of OpenSSL we are using with some other component installed with VisualSVN.
Anyone aware of this issue and how to resolve it ?

COMPONENTS/SETTING:

*

*Windows 2008 Server R2

*Apache Subversion 1.7.6

*Apache HTTP Server 2.2.22

*OpenSSL 0.9.8x

*Neon 0.29.6

*Serf 1.0.0

*SQLite 3070603

*ZLib 1.2.3

*VisualSVN 2.5.6

*SSL enabled

*Windows 7 x64 pro client nodes

A: Do you have Nod32 installed? If yes then disabling protocol filtering can help. Best solution is to add exception for SVN.
Nod32 -> Advanced setup -> Web and email -> Protocol filtering -> Excluded applications -> check you client, mine is TortoiseProc.exe

A: The real error is Too many open files [500, #24]. I assume you're using *nix based Subversion server. In this case increase number of open file descriptor with the ulimit command:

ulimit -n 99999

See also: https://serverfault.com/questions/48717/practical-maximum-open-file-descriptors-ulimit-n-for-a-high-volume-system


text:
Q: Equivalent to ModelState for Non-Errors I really like how the ModelState dictionary works when submitting forms (how you can add errors to it if they happen and then the errors are displayed when the form reloads).
However, what about for non-error messages?  For instance, if I wanted to have the same form load after submission, is there a standard way of displaying a message that the form was submitted successfully?

A: Take a look at TempData. It's a key/value store that is good for the subsequent request and then it is destroyed.
Here is a good article on when to use it vs ViewData and ViewBag.
http://rachelappel.com/when-to-use-viewbag-viewdata-or-tempdata-in-asp.net-mvc-3-applications
However, you should be returning strongly typed ViewModels to your view, and therefore you could have a base ViewModel that could have a message dictionary on it:
public class ViewModelBase
{
    public Dictionary<string,string> Messages { get; set; }
}

And with a little extension method you could have a very easy API to display in the view:
@Model.Messages.DisplayAll()

You would have to implement DisplayAll(), but you get the gist.


text:
Q: Normalisers and connectedness of parabolic subgroups Let $G$ be a connected affine algebraic group over an algebraically closed field. A parabolic subgroup of $G$ is a subgroup $P$ such that $G/P$ is a complete variety. This is equivalent to $P$ containing some Borel subgroup $B$ of $G$. In Humphreys' Linear Algebraic Groups, exercise 21.10, one has to prove the following:
Let $B$ be a Borel subgroup of $G$. Then $B = N_G(B)^{\circ}$ (and similarly for parabolic subgroups).
For a Borel subgroup, I did the following: $B$ is a normal Borel subgroup of $N_G(B)^{\circ}$, so the variety $N_G(B)^{\circ}/B$ is complete, irreducible and affine, i.e. a point. Thus $B = N_G(B)^{\circ}$. However this does not generalise to parabolics without proving that all parabolics are connected. Is there a way to use this property of Borel subgroups to prove that parabolic subgroups are connected?


text:
Q: wpf custom style on textbox, combobox and checkbox i am trying to implement style at Text Box, combo box and check box as like below
http://prntscr.com/7wuiuz
please help me to figure that out.

A: This is not "Text Box, combo box and check box", there are four RadioButtons (two groups of two RadioButtons for clear) and one ComboBox on your screenshot.
You could start from learning Styles and Templates for this elements: RadioButton and ComboBox. There are examples on this pages.


text:
Q: Is $\alpha^{\beta}$ a cardinal? Let $\alpha , \beta$ cardinals. Is $\alpha ^{\beta}$, defined as the set of all functions $f:\beta\to \alpha$, a cardinal?
I do this question because an autor of a text book says that the exponentiation of cardinals $\alpha$ raised to $\beta$ is defined as the cardinal of the set $\alpha ^{\beta}$. Then I ask my question, isn't it always $\alpha ^{\beta}$ a cardinal?

A: Cardinal exponentiation is defined by saying that the cardinal number $\kappa^\lambda$ is the cardinality of the set of functions from $\lambda$ to $\kappa$. If you also denote that set of functions by $\kappa^\lambda$, then of course the symbol $\kappa^\lambda$ is ambiguous: it can be either the set of functions from $\lambda$ to $\kappa$ or the cardinality of that set. These are, however, two different things, even though many people denote them by the same symbol.
That is why some of us prefer to write ${}^XY$ for the set of functions from $X$ to $Y$: in that notation
$$\kappa^\lambda=\left|{}^\lambda\kappa\right|\;,$$
where $\kappa^\lambda$ is unambiguously the cardinal number that is the cardinal exponential $\kappa$ raised to the power $\lambda$, and ${}^\lambda\kappa$ is unambiguously the set of functions from $\lambda$ to $\kappa$.

A: If $\alpha$ and $\beta$ are cardinals, then $\alpha^\beta$ is the cardinality of the set of all functions from a set of cardinality $\beta$ to a set of cardinality $\alpha$.
If $A$ and $B$ are sets, then $A^B$ is the set of all functions from $B$ into $A$.
According to one way of making set theory precise, each cardinal is also a set, and so $\alpha^\beta$ could mean either of two different things.
However, that particular way of being precise is one option, and not necessarily sacred.

A: Consider for example $\alpha\cdot\beta$. That is the cardinal of the set $\alpha\times\beta$. But that set is not a cardinal itself.
In $\sf ZFC$ cardinals are ordinals, and $\alpha\times\beta$ is not an ordinal. You can observe that all its elements are ordered pairs, where as every ordinal includes $\varnothing$, which is not an ordered pair.
Even more so, $\alpha\cdot\beta=\max\{\alpha,\beta\}$. Certainly we have that neither is a set of ordered pairs. It's just the cardinal of one.
Generally we define cardinal arithmetic to be "the cardinal of some resulting set". In particular we take the cardinal $\alpha^\beta$ to be the cardinal of $\{f\subseteq\alpha\times\beta\mid f\text{ is a function}\}$, or generally $\{f\subseteq A\times B\mid f\text{ is a function}\}$, where $|A|=\alpha,|B|=\beta$ (this definition holds for a broader context, where cardinals are not necessarily initial ordinals).
One caveat about notation, $\alpha^\beta$ also denotes ordinal exponentiation sometimes. That's a whole other thing, and they give strangely different results. $2^\omega=\omega$ as ordinal exponentiation, but $2^\omega>\omega$ as cardinal exponentiation.


text:
Q: java.lang.ClassNotFoundException: org.apache.wicket.settings.def.JavaScriptLibrarySettings I have wicket application and it sometimes fails on :
java.lang.NoClassDefFoundError: org/apache/wicket/settings/def/JavaScriptLibrarySettings
java.base/java.lang.ClassLoader.defineClass1(Native Method)
java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
I have this mvn configuration :
[INFO] com.dhl.crdb:crdb:war:1.2.2-SNAPSHOT
[INFO] +- com.dhl.webcommon:dhl-wc:jar:1.2.30.0:compile
[INFO] |  +- org.springframework:spring-tx:jar:5.3.18:compile
[INFO] |  |  \- org.springframework:spring-beans:jar:5.3.18:compile
[INFO] |  +- org.springframework:spring-webmvc:jar:5.3.18:compile
[INFO] |  +- org.springframework:spring-core:jar:5.3.18:compile
[INFO] |  |  \- org.springframework:spring-jcl:jar:5.3.18:compile
[INFO] |  +- org.springframework:spring-orm:jar:5.1.6.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-jdbc:jar:5.1.6.RELEASE:compile
[INFO] |  +- org.springframework:spring-web:jar:5.3.18:compile
[INFO] |  +- org.springframework:spring-expression:jar:5.3.18:compile
[INFO] |  +- org.springframework:spring-aop:jar:5.3.18:compile
[INFO] |  +- org.springframework:spring-aspects:jar:5.3.18:compile
[INFO] |  |  \- org.aspectj:aspectjweaver:jar:1.9.7:compile
[INFO] |  +- org.springframework:spring-jms:jar:5.3.18:compile
[INFO] |  |  \- org.springframework:spring-messaging:jar:5.3.18:compile
[INFO] |  +- org.springframework:spring-context:jar:5.3.18:compile
[INFO] |  +- org.springframework:spring-context-support:jar:5.3.18:compile
[INFO] |  +- org.springframework.security:spring-security-core:jar:3.2.3.RELEASE:compile
[INFO] |  |  \- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  +- org.springframework.security:spring-security-web:jar:3.2.3.RELEASE:compile
[INFO] |  +- org.springframework.security:spring-security-config:jar:3.2.3.RELEASE:compile
[INFO] |  +- org.springframework.batch:spring-batch-core:jar:2.2.1.RELEASE:compile
[INFO] |  |  +- org.springframework.batch:spring-batch-infrastructure:jar:2.2.1.RELEASE:compile
[INFO] |  |  |  \- org.springframework.retry:spring-retry:jar:1.0.2.RELEASE:compile
[INFO] |  |  +- com.thoughtworks.xstream:xstream:jar:1.3:compile
[INFO] |  |  |  \- xpp3:xpp3_min:jar:1.1.4c:compile
[INFO] |  |  \- org.codehaus.jettison:jettison:jar:1.1:compile
[INFO] |  +- org.springframework.ldap:spring-ldap-core:jar:1.3.2.RELEASE:compile
[INFO] |  +- org.apache.wicket:wicket-core:jar:8.14.0:compile
[INFO] |  |  +- com.github.openjson:openjson:jar:1.0.11:compile
[INFO] |  |  +- org.apache.wicket:wicket-request:jar:8.14.0:compile
[INFO] |  |  +- org.apache.wicket:wicket-util:jar:8.14.0:compile
[INFO] |  |  \- org.danekja:jdk-serializable-functional:jar:1.8.6:compile
[INFO] |  +- org.apache.wicket:wicket-spring:jar:8.14.0:compile
[INFO] |  |  \- org.apache.wicket:wicket-ioc:jar:8.14.0:compile
[INFO] |  |     +- cglib:cglib-nodep:jar:3.2.12:compile
[INFO] |  |     +- javax.inject:javax.inject:jar:1:compile
[INFO] |  |     \- org.ow2.asm:asm-util:jar:7.1:compile
[INFO] |  |        +- org.ow2.asm:asm:jar:7.1:compile
[INFO] |  |        +- org.ow2.asm:asm-tree:jar:7.1:compile
[INFO] |  |        \- org.ow2.asm:asm-analysis:jar:7.1:compile
[INFO] |  +- org.wicketstuff:wicketstuff-minis:jar:8.14.0:compile
[INFO] |  +- org.apache.wicket:wicket-bean-validation:jar:8.13.0:compile
[INFO] |  +- com.vaynberg.wicket.select2:wicket-select2:jar:4.1:compile
[INFO] |  +- cas:casclient:jar:2.1.1:compile
[INFO] |  |  \- commons-logging:commons-logging:jar:1.0.4:compile
[INFO] |  +- org.jasig.cas:cas-client-core:jar:3.1.2:compile
[INFO] |  +- joda-time:joda-time-hibernate:jar:1.3:compile
[INFO] |  +- org.jadira.usertype:usertype.jodatime:jar:2.0.1:compile
[INFO] |  |  \- org.jadira.usertype:usertype.spi:jar:2.0.1:compile
[INFO] |  +- org.hibernate:hibernate-core:jar:5.3.6.Final:compile
[INFO] |  |  +- javax.persistence:javax.persistence-api:jar:2.2:compile
[INFO] |  |  +- org.javassist:javassist:jar:3.23.1-GA:compile
[INFO] |  |  +- net.bytebuddy:byte-buddy:jar:1.8.17:compile
[INFO] |  |  +- antlr:antlr:jar:2.7.7:compile
[INFO] |  |  +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.1.1.Final:compile
[INFO] |  |  +- org.jboss:jandex:jar:2.0.5.Final:compile
[INFO] |  |  +- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] |  |  +- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  |  \- org.hibernate.common:hibernate-commons-annotations:jar:5.0.4.Final:compile
[INFO] |  +- commons-dbcp:commons-dbcp:jar:1.4:compile
[INFO] |  |  \- commons-pool:commons-pool:jar:1.5.4:compile
[INFO] |  +- org.hibernate:hibernate-ehcache:jar:5.3.6.Final:compile
[INFO] |  |  \- net.sf.ehcache:ehcache:jar:2.10.3:compile
[INFO] |  +- com.ibm.icu:icu4j:jar:4.0.1:compile
[INFO] |  +- org.apache.xmlbeans:xmlbeans:jar:2.6.0:compile
[INFO] |  |  \- stax:stax-api:jar:1.0.1:compile
[INFO] |  +- com.oracle:ojdbc16:jar:11.2.0.3.0:runtime
[INFO] |  +- commons-lang:commons-lang:jar:2.6:compile
[INFO] |  +- org.aspectj:aspectjrt:jar:1.5.4:compile
[INFO] |  +- log4j:log4j:jar:1.2.17:compile
[INFO] |  +- commons-io:commons-io:jar:2.4:compile
[INFO] |  +- org.hibernate:hibernate-envers:jar:5.3.6.Final:compile
[INFO] |  +- javax.mail:mail:jar:1.4.4:compile
[INFO] |  |  \- javax.activation:activation:jar:1.1:compile
[INFO] |  +- com.code-troopers:wicket-editable-grid:jar:0.1:compile
[INFO] |  +- org.apache.cxf:cxf-rt-databinding-jaxb:jar:2.7.3:compile
[INFO] |  |  +- org.apache.cxf:cxf-api:jar:2.7.3:compile
[INFO] |  |  |  +- org.codehaus.woodstox:woodstox-core-asl:jar:4.1.4:runtime
[INFO] |  |  |  |  \- org.codehaus.woodstox:stax2-api:jar:3.1.1:runtime
[INFO] |  |  |  +- org.apache.ws.xmlschema:xmlschema-core:jar:2.0.3:compile
[INFO] |  |  |  \- wsdl4j:wsdl4j:jar:1.6.2:compile
[INFO] |  |  +- org.apache.cxf:cxf-rt-core:jar:2.7.3:compile
[INFO] |  |  +- com.sun.xml.bind:jaxb-impl:jar:2.1.13:compile
[INFO] |  |  \- com.sun.xml.bind:jaxb-xjc:jar:2.1.13:compile
[INFO] |  +- org.apache.cxf:cxf-rt-frontend-jaxws:jar:2.7.3:compile
[INFO] |  |  +- xml-resolver:xml-resolver:jar:1.2:compile
[INFO] |  |  +- asm:asm:jar:3.3.1:compile
[INFO] |  |  +- org.apache.cxf:cxf-rt-bindings-soap:jar:2.7.3:compile
[INFO] |  |  +- org.apache.cxf:cxf-rt-bindings-xml:jar:2.7.3:compile
[INFO] |  |  +- org.apache.cxf:cxf-rt-frontend-simple:jar:2.7.3:compile
[INFO] |  |  \- org.apache.cxf:cxf-rt-ws-addr:jar:2.7.3:compile
[INFO] |  |     \- org.apache.cxf:cxf-rt-ws-policy:jar:2.7.3:compile
[INFO] |  |        \- org.apache.neethi:neethi:jar:3.0.2:compile
[INFO] |  +- org.apache.cxf:cxf-rt-transports-http:jar:2.7.3:compile
[INFO] |  +- org.apache.httpcomponents:httpclient:jar:4.4:compile
[INFO] |  |  \- org.apache.httpcomponents:httpcore:jar:4.4:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-core:jar:2.9.1:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.1:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.1:compile
[INFO] |  +- com.fasterxml.jackson.datatype:jackson-datatype-joda:jar:2.9.1:compile
[INFO] |  |  \- joda-time:joda-time:jar:2.7:compile
[INFO] |  +- com.googlecode.wicket-jquery-ui:wicket-jquery-ui:jar:8.13.0:compile
[INFO] |  |  \- com.googlecode.wicket-jquery-ui:wicket-jquery-ui-core:jar:8.13.0:compile
[INFO] |  +- com.dhl.webcommon:saml-filter:jar:1.0.10.0:compile
[INFO] |  +- com.dhl.webcommon:dhl-dbc:jar:1.1.82.0:compile
[INFO] |  +- com.dhl.webcommon:dhl-resources:jar:1.1.160.0:compile
[INFO] |  \- org.flywaydb:flyway-core:jar:4.0.3:compile
[INFO] +- org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile
[INFO] +- javax.validation:validation-api:jar:2.0.1.Final:compile
[INFO] +- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] +- javax.xml.ws:jaxws-api:jar:2.2.12:compile
[INFO] |  \- javax.xml.soap:javax.xml.soap-api:jar:1.3.5:compile
[INFO] +- javax.jws:javax.jws-api:jar:1.1:compile
[INFO] +- net.logstash.logback:logstash-logback-encoder:jar:6.3:compile
[INFO] +- org.codehaus.janino:janino:jar:3.0.6:compile
[INFO] |  \- org.codehaus.janino:commons-compiler:jar:3.0.6:compile
[INFO] +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] +- org.springframework.security.oauth:spring-security-oauth2:jar:2.0.12.RELEASE:compile
[INFO] |  +- commons-codec:commons-codec:jar:1.9:compile
[INFO] |  \- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:compile
[INFO] |     \- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:compile
[INFO] +- net.ttddyy:datasource-proxy:jar:1.4.1:compile
[INFO] |  \- org.mockito:mockito-core:jar:1.9.5:compile
[INFO] |     \- org.objenesis:objenesis:jar:1.0:compile
[INFO] +- junit:junit:jar:4.11:test
[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.hsqldb:hsqldb:jar:2.2.8:test
[INFO] +- org.mockito:mockito-all:jar:1.9.5:test
[INFO] +- javax.servlet:javax.servlet-api:jar:3.0.1:test
[INFO] +- com.jayway.jsonpath:json-path:jar:0.8.1:test
[INFO] |  \- net.minidev:json-smart:jar:1.1.1:test
[INFO] +- com.jayway.jsonpath:json-path-assert:jar:0.8.1:test
[INFO] |  \- org.hamcrest:hamcrest-library:jar:1.2.1:test
[INFO] +- org.wicketstuff:wicketstuff-tinymce:jar:6.30.0:compile
[INFO] |  +- org.apache.wicket:wicket-extensions:jar:6.30.0:compile
[INFO] |  +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] |  +- net.sf.jazzy:jazzy:jar:0.5.2-rtext-1.4.1:compile
[INFO] |  +- org.json:json:jar:20090211:compile
[INFO] |  \- org.apache.wicket:wicket:pom:6.30.0:compile
[INFO] +- javax.servlet:servlet-api:jar:2.5:provided
[INFO] +- org.apache.tika:tika-core:jar:1.17:compile
[INFO] +- org.hibernate.validator:hibernate-validator:jar:6.0.12.Final:compile
[INFO] |  +- org.jboss.logging:jboss-logging:jar:3.3.2.Final:compile
[INFO] |  \- com.fasterxml:classmate:jar:1.3.4:compile
[INFO] +- org.hibernate.validator:hibernate-validator-annotation-processor:jar:6.0.12.Final:compile
[INFO] +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.2.Final:compile
[INFO] +- org.apache.poi:poi:jar:3.17:compile
[INFO] +- org.apache.poi:poi-ooxml:jar:3.17:compile
[INFO] |  \- com.github.virtuald:curvesapi:jar:1.04:compile
[INFO] +- org.apache.poi:ooxml-schemas:jar:1.1:compile
[INFO] +- org.apache.poi:poi-ooxml-schemas:jar:3.14:compile
[INFO] +- javax.xml.bind:jaxb-api:jar:2.2.11:compile
[INFO] +- io.springfox:springfox-swagger2:jar:2.9.2:compile
[INFO] |  +- io.swagger:swagger-annotations:jar:1.5.20:compile
[INFO] |  +- io.swagger:swagger-models:jar:1.5.20:compile
[INFO] |  +- io.springfox:springfox-spi:jar:2.9.2:compile
[INFO] |  |  \- io.springfox:springfox-core:jar:2.9.2:compile
[INFO] |  +- io.springfox:springfox-schema:jar:2.9.2:compile
[INFO] |  +- io.springfox:springfox-swagger-common:jar:2.9.2:compile
[INFO] |  +- io.springfox:springfox-spring-web:jar:2.9.2:compile
[INFO] |  +- org.springframework.plugin:spring-plugin-core:jar:1.2.0.RELEASE:compile
[INFO] |  +- org.springframework.plugin:spring-plugin-metadata:jar:1.2.0.RELEASE:compile
[INFO] |  \- org.mapstruct:mapstruct:jar:1.2.0.Final:compile
[INFO] +- io.springfox:springfox-swagger-ui:jar:2.9.2:compile
[INFO] +- com.google.guava:guava:jar:21.0:compile
[INFO] +- io.jsonwebtoken:jjwt:jar:0.7.0:compile
[INFO] +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] +- org.apache.commons:commons-collections4:jar:4.1:compile
[INFO] +- io.swagger:swagger-jaxrs:jar:1.6.0:compile
[INFO] |  +- io.swagger:swagger-core:jar:1.6.0:compile
[INFO] |  |  +- org.apache.commons:commons-lang3:jar:3.2.1:compile
[INFO] |  |  \- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.10.1:compile
[INFO] |  |     \- org.yaml:snakeyaml:jar:1.24:compile
[INFO] |  +- javax.ws.rs:jsr311-api:jar:1.1.1:compile
[INFO] |  \- org.reflections:reflections:jar:0.9.11:compile
[INFO] +- org.owasp.esapi:esapi:jar:2.2.3.1:compile
[INFO] |  +- com.io7m.xom:xom:jar:1.2.10:compile
[INFO] |  +- commons-beanutils:commons-beanutils:jar:1.9.4:compile
[INFO] |  +- commons-configuration:commons-configuration:jar:1.10:compile
[INFO] |  +- commons-fileupload:commons-fileupload:jar:1.3.3:compile
[INFO] |  +- org.apache-extras.beanshell:bsh:jar:2.0b6:compile
[INFO] |  +- org.owasp.antisamy:antisamy:jar:1.6.3:compile
[INFO] |  |  +- net.sourceforge.nekohtml:nekohtml:jar:1.9.22:compile
[INFO] |  |  +- org.apache.xmlgraphics:batik-css:jar:1.14:compile
[INFO] |  |  |  +- org.apache.xmlgraphics:batik-shared-resources:jar:1.14:compile
[INFO] |  |  |  +- org.apache.xmlgraphics:batik-util:jar:1.14:compile
[INFO] |  |  |  |  +- org.apache.xmlgraphics:batik-constants:jar:1.14:compile
[INFO] |  |  |  |  \- org.apache.xmlgraphics:batik-i18n:jar:1.14:compile
[INFO] |  |  |  \- org.apache.xmlgraphics:xmlgraphics-commons:jar:2.6:compile
[INFO] |  |  +- xerces:xercesImpl:jar:2.12.1:compile
[INFO] |  |  \- xml-apis:xml-apis-ext:jar:1.3.04:compile
[INFO] |  \- xml-apis:xml-apis:jar:1.4.01:compile
[INFO] \- org.springframework:spring-test:jar:4.3.1.RELEASE:test

Can someone please give me a point how to solve this issue? Im little stuck with it. In org.apache.wicket.settings there is JavaScriptLibrarySettings in wicket core. I dont know how to solve this issue, maybe there is some obsolate dependency. Thanks for help.

A: Almost all Wicket dependencies are 8.14.0 but few are 8.13.0 (not really a problem but better keep them in sync):

*

*org.apache.wicket:wicket-bean-validation:jar:8.13.0:compile

*com.googlecode.wicket-jquery-ui:wicket-jquery-ui:jar:8.13.0:compile

*com.googlecode.wicket-jquery-ui:wicket-jquery-ui-core:jar:8.13.0:compile

The real problem is:
[INFO] +- org.wicketstuff:wicketstuff-tinymce:jar:6.30.0:compile
[INFO] |  +- org.apache.wicket:wicket-extensions:jar:6.30.0:compile
[INFO] |  +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] |  +- net.sf.jazzy:jazzy:jar:0.5.2-rtext-1.4.1:compile
[INFO] |  +- org.json:json:jar:20090211:compile
[INFO] |  \- org.apache.wicket:wicket:pom:6.30.0:compile

Do not mix Wicket deps with differences in the major version (8 vs 6)!


text:
Q: Append multiple variables(params) to url for ajax call I am trying to append values from a checked checkbox to a url that later would be used for an ajax call. As mentioned I would only like to have the values appended to the url if checkbox is checked. If a user checks and then unchecks, this would indicate not to add the value to the url. Below I have some basic foundation code. How can I append multiple items to the url ?
<form>
<input type="checkbox" value="1" id="item1" />
<input type="checkbox" value="2" id="item2" />
<input type="checkbox" value="3" id="item3" />
<input type="submit" id="submitForm" value="Submit Form" />
<form>

<script>
$('#submitForm').click(function() {
    $('checkbox').click(function() {
    $.getJSON('www.mysite.com/mypage.php?id='+item1+item2+item3)
    });
});
</script>

A: You can use JQuery method serialize() as follows:
var query = $('form').serialize()

and after:
$.getJSON('www.mysite.com/mypage.php?'+query );

Only necessary to provide the input field attribute "name":
<form>
<input type="checkbox" value="1" id="item1" name="item1"/>
<input type="checkbox" value="2" id="item2" name="item2"/>
<input type="checkbox" value="3" id="item3" name="item3"/>
<input type="submit" id="submitForm" value="Submit Form" />
<form>

and you get:
www.mysite.com/mypage.php?item1=1&item2=2&item3=3

if all checkboxes are selected.

A: First give your checkboxes a specific name like;
<form name="checkbox_form" id="checkbox_form">
    <input type="checkbox" value="1" id="item1" name="val1" />
    <input type="checkbox" value="2" id="item2" name="val2" />
    <input type="checkbox" value="3" id="item3" name="val3" />
    <input type="submit" id="submitForm" value="Submit Form" />
<form>

And your js will be;
$('#submitForm').click(function() {
    var url = "'www.mysite.com/mypage.php";
    if ($("#checkbox_form").serialize().length > 0) {
        url += "?" + $("#checkbox_form").serialize();
    }
    alert("Your ajax url will be: " + url);
    $.getJSON(url)
});

Here is a working fiddle: http://jsfiddle.net/cubuzoa/UKV3r/2/


text:
Q: How to copy the postgresql's xlog files safely I mean how to safely copy xlog files when postgresql is running? Any reply will be appreciated.

A: The best (and recommended) way to do it is to configure the database server to copy them via the archive_command configuration variable. See also the chapter Setting up WAL Archiving.
If you are hell bent on copying them manually then another way might be to look at the contents of the archive_status subdirectory. When you see a file in this directory with the suffix .ready it means that the corresponding WAL file is completed and should be safe to copy. However I don't think this would happen unless WAL archiving was turned on in the first place - if it is not turned on then postgres will just delete the WAL files soon after they are written (which will not give you much chance to copy them!)


text:
Q: Sorting of IEnumerable in MVC 2 My Service layer returns a IEnumerable<ResortsView> to my Controller and I have to provide an option to SORT the results on UI by following criteria: Price (Excluding ZERO Price Items), SupplierName & Rating. Here is the code snippet of my objects/classes:
[Serializable]
public class ResortsView : SupplierView
{
    public IList<ProductView> ResortProducts { get; set; }
    public string CheckInTime { get; set; }
    public string CheckOutTime { get; set; }
    public virtual IList<ImageView> Images { get; set; }
}

[Serializable]
public class SupplierView
{
    public string SupplierID { get; set; }
    public string SupplierName { get; set; }
    public string Description { get; set; }
    public string Rating { get; set; }
    public string URL { get; set; }
}

[Serializable]
public class ProductView
{
    public string Code { get; set; }
    public string Description { get; set; }
    public decimal? Price { get; set; }
    public ErrorView PricingError { get; set; }
}

What is the best way to handle sorting of results inside IEnumerable<ResortsView>?

A: Use the OrderBy method of the LINQ stack:
IEnumerable<ResortsView> source = GetResorts();
var model = source.OrderBy(rv => rv.CheckInTime);

To order by the lowest, non-zero price in ResortProducts:
var model = source.OrderBy(rv => rv.ResortProducts.Where(p => p.Price > 0).Min(p => p.Price));

A: Most likely if you'll want to use the Dynamic LINQ library, here are some instructions and a download link.
You'll need to have your action accept some sorting parameters:
public ActionResult MyAction(string sortField)
{
    return View(myService.MyData().OrderBy(sortField));
}


text:
Q: DevOps Separate Output Files Based On Project So in my DevOps I have multiple projects, and I am choosing to build two of the projects, so I'm passing the path to those two projects like so:

But the issue is that the pipeline is placing all the files for both projects under the drop folder. Instead I want it to be something like drop/Project1. How do I do that?
I already tried using $(ProjectName) for my build argument like so:

But it doesn't work, even though I have set the <ProjectName> attribute inside both my .csproj, it becomes like this:

Is there any other way to do it? Or any idea why my $(ProjectName) isn't working?

A: To achieve that you can build each project in a separate task with its own output path.
It is a limitation of dotnet itself, dotnet build command does not support dynamic/multiple output paths https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-build


text:
Q: Create a font file using svg's I'm trying to create a C# application which takes a selection of SVG's, and turns them into an Icon font. So first things first I need to create a font made out of the selected SVG's.
The only thing I can find is on how to create new font families e.g.
FontFamily fontFamily = new FontFamily("Arial");

Not actually generating a new font file. Is it possible to create a .tff, just like you can create a .txt file?


text:
Q: Allow selection in Explorer-style list view to start in the first column In Windows 7's Windows Explorer list view (what allegedly is not list view at all) in the Details view, you can start selection marquee in the first (Name) column. You just need to start outside the actual name.

The same is true for default-style list view control in Details view.
But if you set the list view control to the Explorer style (using the SetWindowTheme), what should mimic the Windows Explorer, this does not work anymore. You can start selection in the second and later columns only.
SetWindowTheme(listView1.Handle, "explorer", null);

Is there any way to make list view mimic the Explorer selection style?
I suppose there's no settings to enable such behavior and this would have to be coded. Like handling the mouse down and triggering selection. But I have no idea how to do that.
Thanks.
Ntb, I'm using C++Builder, but this should be purely Win32 issue. I've tested this with WinForms too (hence the C# sample above).

A:
Is there any way to make list view it mimic the Explorer selection style?

No, SysListView32 in explorer theme does not behave that way. The control used by the modern Explorer is actually DirectUIHwnd. And you are not able to use one of them.
The only way to get the behaviour of DirectUIHwnd is to code it yourself. I expect that's possible to do but I'd also expect it to be very difficult to achieve.

A: Actually there is a way to mimic Explorer selection behavior. It requires a lot of additional declarative work, but it is possible.
You need to get undocumented IListView interface via undocumented LVM_QUERYINTERFACE message (note that interface declaration and GUIDs are different for Windows Vista and Windows 7+). Details about constants and declarations can be found here:

*

*IListView at Geoff Chappell - Software Analyst or

*Undocumented List View Features at Code Project.

After acquiring the interface all you need is simply a call to SetSelectionFlags(1, 1) method. Voila you are done.


text:
Q: Using Boost strong typedef with unordered_map I am using a Boost strong typedef to strong-type uint64_t:
BOOST_STRONG_TYPEDEF(uint64_t, MyInt)

and an std::unordered_map using this:
std::unordered_map<MyInt, int> umap;

Unfortunately I get a lot of compiler errors (can't paste here as they're on another machine):
error: static assertion failed: hash function must be invocable with an argument of key type
.static_assert(__is_invocable<const _H1&, const _Key&>)

error: use of deleted function 'std::__detail::_Hashtable_ebo_helper

_Hashtable() = default;

(+ a lot more I cannot type)
Using a Boost strong type as the key definitely causes the problem because if I remove the unordered_map I get no compiler errors.

A: From the boost documentation about BOOST_STRONG_TYPEDEF, it is clearly mentioned that it defines a new type wrapping the target inner type (it is not a simple alias).
Knowing that, there is no defined std::hash<MyInt> specialization available (required by std::unordered_map<MyInt, int>) since MyInt is now a distinct type from uint64_t.
You just need to provide one and it should work as expected.
For instance:
namespace std
{
    template <>
    struct hash<MyInt>
    {
        size_t operator()(const MyInt & m) const
        {
            return hash<uint64_t>{}(m);
        }
    };
}

Edit:
As pointed out in comments, you could also directly pass the proper std::hash<> specialization to use from the std::unordered_map<> instantiation as the third template parameter since MyInt is implicitly convertible to uint64_t (as mentioned in the boost documentation as well).
It would then become:
std::unordered_map<MyInt, int, std::hash<uint64_t>> umap;

No need to define your own std::hash<MyInt> specialization anymore.


text:
Q: Show that $\{ v : \langle v, v\rangle > 0$ is a subspace of $V$
Suppose $V$ is a finite dimensional vector space equipped with a symmetric bilinear form $\langle \cdot ,\cdot \rangle$. Then prove the subset $V^+$ is a subset, where $V^+$ is the set of all $v$ such that if $v$ is nonzero, then $\langle v,v\rangle > 0$.

I showed that $0$ is vacuously in the set, and that $$v\in V^+ \implies cv\in V^+, \quad c\in K.$$ I don't know where to start to show that $$v,w\in V^+ \implies v+w\in V^+.$$

A: An inner product (scalar product) is always positive definite, so we have $\langle v,v\rangle > 0$ for any $v\neq 0$ and $\langle 0,0\rangle = 0$. Hence what you describe as $V^+$ is in fact all of $V$ and of course $V^+=V$ is a subspace of itself.
Please comment if I misunderstood your question, it seems a bit trivial.

For an arbitrary symmetric bilinear form, the statement is false: Consider the symmetric bilinear form $b(v,w)=v_1w_1-v_2w_2$ on $\mathbb R^2$. This yields
$$
V^+ = \{(0,0)\}\cup\{\, (v_1,v_2) \in\mathbb R^2 \,:\, |v_1|>|v_2|\,\},
$$
which is not a subspace. For example, $(2,1)$ and $(-2,1)$ are in $V^+$ but their sum $(0,2)$ isn't.


text:
Q: Cannot remove duplicate values from a mysql table I have a table ship_details which is not having any constraints. The data is coming from a data source & original designer of the table thought the incoming data not to have duplication.Now I have to remove the duplicate entries. Now the table has 9,94,184 entries.
The table definition is
CREATE TABLE `ship_details` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `order_number` varchar(150) DEFAULT NULL,
  `delivery_id` varchar(150) DEFAULT NULL,
  `transaction_type` varchar(150) DEFAULT NULL,
  `pick_date` varchar(150) DEFAULT NULL,
  `pn_note_number` varchar(150) DEFAULT NULL,
  `item_id` varchar(150) DEFAULT NULL,
  `item_code` varchar(150) DEFAULT NULL,
  `picked_quantity` varchar(150) DEFAULT NULL,
  `lot_number` varchar(150) DEFAULT NULL,
  `lot_expiry` varchar(150) DEFAULT NULL,
  `name` varchar(150) DEFAULT NULL,
  `delivered_date` varchar(150) DEFAULT NULL,
  `extra_attrib1` varchar(150) DEFAULT NULL,
  `extra_attrib2` varchar(150) DEFAULT NULL,
  `extra_attrib3` varchar(150) DEFAULT NULL,
  `extra_attrib4` varchar(150) DEFAULT NULL,
  `extra_attrib5` varchar(150) DEFAULT NULL,
  `extra_attrib6` varchar(150) DEFAULT NULL,
  `extra_attrib7` varchar(150) DEFAULT NULL,
  `extra_attrib8` varchar(150) DEFAULT NULL,
  `extra_attrib9` varchar(150) DEFAULT NULL,
  `extra_attrib10` varchar(150) DEFAULT NULL,
  `last_updated` varchar(100) DEFAULT NULL,
  `outbound_id` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=994222 DEFAULT CHARSET=latin1;

I tried to delete the duplicate entries by using following script:
delete s1
from ship_details s1
inner join ship_details s2
where  s1.id < s2.id
and s2.order_number = s1.order_number
and s2.delivery_id = s1.delivery_id
and s2.item_code = s1.item_code
and s2.lot_number = s1.lot_number
and s2.picked_quantity = s1.picked_quantity;

but that gave lock wait timeout. Even if I use a particular order no still it times out.
So I went for the approach of replicating the table with unique constraint of order_number, delivery_id, item_code and picked_quantity.
So tried to export the data from the original table after running following command:
SELECT distinct order_number, delivery_id, transaction_type, pick_date, pn_note_number,
item_id, item_code, picked_quantity, lot_number, lot_expiry, name, delivered_date,
extra_attrib10,last_updated, outbound_id
FROM ship_details;

But this command did not give me unique result. This results in 1,54,948 rows. Pl. see this:
INSERT INTO clean_ship_details (order_number,delivery_id,transaction_type,pick_date,pn_note_number,item_id,item_code,picked_quantity,lot_number,lot_expiry,name,delivered_date,extra_attrib10,last_updated,outbound_id) VALUES
     ('181020373','10068965','Shipped','2018-11-11T15:50:48.000+04:00','PN176348','516169','VCH128','73','C34142','2021-02-28T00:00:00.000+04:00','DVT-6410','2019-06-18T15:48:12.000+04:00','','2019-06-18T15:54:40.000+04:00','51616973_73_'),
     ('181020373','10068965','Shipped','2018-11-11T15:50:48.000+04:00','PN176348','516169','VCH128','73','C34142','2021-02-28T00:00:00.000+04:00','DVT-6410','2019-06-18T15:48:12.000+04:00','','2019-06-18T15:54:40.000+04:00','58719373_73_'),
     ('181020373','10068965','Shipped','2018-11-11T15:50:48.000+04:00','PN176348','516170','VCH120','12','K33471/A','2020-10-31T00:00:00.000+04:00','DVT-6410','2019-06-18T15:48:12.000+04:00','','2019-06-18T15:54:40.000+04:00','51617012_12_'),
     ('181020373','10068965','Shipped','2019-06-19T12:22:39.000+04:00','PN239867','587193','VCH128','2','E34284','2021-04-30T00:00:00.000+04:00','DVT-6410','2019-06-18T15:48:12.000+04:00','','2019-06-18T15:54:40.000+04:00','5161692_2_'),
     ('181020373','10068965','Shipped','2019-06-19T12:22:39.000+04:00','PN239867','587193','VCH128','2','E34284','2021-04-30T00:00:00.000+04:00','DVT-6410','2019-06-18T15:48:12.000+04:00','','2019-06-18T15:54:40.000+04:00','5871932_2_'),
     ('191002479','10091039','Shipped','2019-02-12T07:50:55.000+04:00','PN186154','544495','VTP048','170','205809','2020-07-31T00:00:00.000+04:00','DVT-6479','2019-07-11T07:30:38.000+04:00','','2019-07-11T09:31:22.000+04:00','544495170_170_'),
     ('191002479','10091039','Shipped','2019-02-12T07:50:55.000+04:00','PN186154','544495','VTP048','170','205809','2020-07-31T00:00:00.000+04:00','DVT-6479','2019-07-11T07:30:38.000+04:00','','2019-07-11T09:31:22.000+04:00','594447170_170_'),
     ('191002479','10091039','Shipped','2019-07-18T07:45:49.000+04:00','PN249274','594447','VTP048','11','208744','2021-01-31T00:00:00.000+04:00','DVT-6479','2019-07-11T07:30:38.000+04:00','','2019-07-11T09:31:22.000+04:00','54449511_11_'),
     ('191002479','10091039','Shipped','2019-07-18T07:45:49.000+04:00','PN249274','594447','VTP048','11','208744','2021-01-31T00:00:00.000+04:00','DVT-6479','2019-07-11T07:30:38.000+04:00','','2019-07-11T09:31:22.000+04:00','59444711_11_'),
     ('191006312','10188037','Shipped','2019-03-31T12:17:39.000+04:00','PN201490','560373','VTP048','26','207783','2020-12-31T00:00:00.000+04:00','DVT-6694','2019-10-08T07:08:45.000+04:00','','2019-10-08T07:11:44.000+04:00','56037326_26_');

I cannot insert this to the new table.
Update I tried to insert using a script without success as I get lock wait time exceeded even with a limit of just 1 record:
INSERT IGNORE INTO clean_ship_details (order_number,delivery_id,transaction_type,pick_date,pn_note_number,item_id,item_code,picked_quantity,lot_number,lot_expiry,name,delivered_date,last_updated,outbound_id) SELECT order_number,delivery_id,transaction_type,pick_date,pn_note_number,item_id,item_code,picked_quantity,lot_number,lot_expiry,name,delivered_date,last_updated,outbound_id FROM ship_details order by order_number,delivery_id,item_id limit 10;

A: Your second approach does dedupe if as you say  unique constraint of order_number, delivery_id, item_code and picked_quantity also you don't need distinct because unique key will detect the duplicates and you can INSERT IGNORE the error
Using your sample data
enter link description here


text:
Q: symfony2 twig template load checkboxes from many to many entity relationship New Symfony2 User here. I have 2 entities that are related, one to many that is unidirectional. I'm doing it as ManyToMany as the doctrine documentation suggests, Article(one) and Tags(many). I'd like to have checkboxes show up that show the tag names on the article.new page and the article.edit page. On form submission the id of the tag entity is stored in the article_tags side table that the entity generator created for me.
Posting only relevant code.
Tag Entity AppBundle/Entity/Tag.php
/**
 * @ORM\Column(name="id", type="integer")
 * @ORM\Id
 * @ORM\GeneratedValue(strategy="AUTO")
 */
private $id;

/**
* @var string
*
* @ORM\Column(name="name", type="string", length=20)
*/
public $name;

Article Entity AppBundle/Entity/Article.php
/**
 * @ORM\ManyToMany(targetEntity="Tag")
 * @ORM\JoinTable(
 *      name="article_tags",
 *      joinColumns={@ORM\JoinColumn(name="article_id", referencedColumnName="id")},
 *      inverseJoinColumns={@ORM\JoinColumn(name="tag_id", referencedColumnName="id", unique=true)}
 * )
 */
protected $tags;

/**
 * Add tag
 *
 * @param \AppBundle\Entity\Tag $tag
 *
 * @return Article
 */
public function addTag(\AppBundle\Entity\Tag $tag)
{
    $this->tags[] = $tag;

    return $this;
}

/**
 * Remove tag
 *
 * @param \AppBundle\Entity\Tag $tag
 */
public function removeTag(\AppBundle\Entity\Tag $tag)
{
    $this->tags->removeElement($tag);
}

/**
 * Get tags
 *
 * @return \Doctrine\Common\Collections\Collection
 */
public function getTags()
{
    return $this->tags;
}

Article Form Type AppBundle/Form/ArticleType
$builder->add('title')
        ->add('body')
        ->add('author')
        ->add('tags', 'entity', array(
            'class' => 'AppBundle\Entity\Tag',
            'property' => 'name',
            'expanded' => 'true', ));

ArticleController  AppBundle/Controller/ArticleController.php
* @Template()
 */
public function newAction()
{
    $entity = new Article();
    $tags = new Tag();
    $entity->addTag($tags);
    $form   = $this->createCreateForm($entity);
    return array('entity' => $entity,'form' => $form->createView(), );
}

As of now the error I receive is...

Entities passed to the choice field must be managed. Maybe persist
  them in the entity manager?

I'm not entirely sure I'm on the right track. I just want to attach tags to articles!
Thanks

A: In the controller, you create a blank Tag and add it to the new Article before creating the form. That doesn't make sense to me, and I suspect that's where the error is coming from.
If there are any tags in the database, Symfony will automatically get them and display them with a checkbox in the form. If the user checks a checkbox, this Tag will be added to the Article.
Just delete these two lines and you should be fine:
$tags = new Tag();
$entity->addTag($tags);


text:
Q: Непонятно работает атрибут Remote Доброго времени суток!:)
столкнулся с такой проблемой. В модели БД  есть полу Mony на него навешен атрибут [Remote (условие)].Все работает на проверку норм, но....если при заполнении формы не снимать фокус с поля куда вводятся данные Mony и нажать на кнопку отправки и отправка происходит только при повторном нажатии на кнопку отправить. Если же фокус снять и перевести на другое поле то все отлично...Где чего надо подправить?:(
За ранее спасибо:)
A: Если я правильно всё понял и имеется ввиду jQuery remote validation  (я правда не знаю что такое Mony), то следующий трюк может вам помочь:
$("input[type='text'"]).keypress(function() {
  $(this).valid()
});

или
//Так можно проверить всю форму
$("input[type='text'"]).keypress(function() {
  $(this).closest('form').valid()
});


text:
Q: how to determine length of time based on dates in R? I am looking to find the difference in years, days, hours, minutes, seconds between 2 dates and times. Each of these 5 would be a new column. The start and end date are in dd/mm/yyyy format. The start and end times are in hh:mm:ss format.

*

*column 1 should be full years passed between start and end.

*column 2 should be days (after years) passed. (under 364)

*column 3 should be hours after days passed. (under 24)

*column 4 should be minutes after hours passed. (under 60)

*column 5 should be second after minutes passed.

I am unsure how to code this in R. Any help to get started would be greatly appreciated. Thanks!

A: as.numeric(date) gives date in a format of "number of seconds passed since a specific date". So you can turn your dates to seconds and run calculations with that.
Dummy data:
date = lubridate::as_datetime(c("2020-08-05 12:00:00","2021-09-30 17:30:25"))

Code:
date = as.numeric(date)

denominators = c(60*60*24*365, 60*60*24, 60*60, 60, 1) #How many seconds in year, day, hour, minute and second
cols = numeric() #Empty vector to store results
remain = date[2]-date[1] #Starting point for the remainder

for(i in 1:length(denominators)){
  cols[i] = trunc((remain)/denominators[i])
  remain = remain - cols[i]*denominators[i]}

You can also name the vector by doing:
names(cols) = c("Years","Days","Hours","Minutes","Seconds")

Output:
> cols
  Years    Days   Hours Minutes Seconds
      1      56       5      30      25

A: Using the following toy data:
dat <- structure(list(x = structure(c(1325646906.47215, 1325939193.94239,
1326393311.43146, 1326893111.72323, 1329160425.66278, 1329941092.98845,
1331676913.11139, 1336534476.92816, 1336854219.76095, 1340508976.95104,
1341988397.40445, 1342874148.29895, 1343922899.76848, 1345423246.12892,
1347031958.69809, 1350439597.85911, 1351877928.41993, 1351944648.77309,
1352526175.56524, 1350683308, 1582930108), tzone = "UTC", class = c("POSIXct",
"POSIXt")), y = structure(c(1367717543.47215, 1332749998.94239,
1343939119.43146, 1368686228.72323, 1337866340.66278, 1357626373.98845,
1340861455.11139, 1343305871.92816, 1378155928.76095, 1358484266.95104,
1359392859.40445, 1355157621.29895, 1372962968.76848, 1364088903.12892,
1354590155.69809, 1354355821.85911, 1371121585.41993, 1379051036.77309,
1370987918.56524, 1395436350, 1614552508), tzone = "UTC", class = c("POSIXct",
"POSIXt"))), row.names = c(NA, 21L), class = "data.frame")

we can make good use of lubridates date functions. It looks a bit ugly, but does the trick. I didn't check the correct calcualtion for every single date, but it seems to get the difficult ones right (like the last date with a leap year where it correctly calculates 1 year, 0 days).
library(tidyverse)
library(lubridate)
dat %>%
  mutate(years   = trunc(time_length(interval(x, y), unit = "years")),
         days    = trunc(time_length(interval(x %m+% years(years), y), unit = "days")),
         hours   = trunc(time_length(interval(x %m+% years(years) %m+% days(days), y), unit = "hours")),
         minutes = trunc(time_length(interval(x %m+% years(years) %m+% days(days) %m+% hours(hours), y), unit = "minutes")),
         seconds = trunc(time_length(interval(x %m+% years(years) %m+% days(days) %m+% hours(hours)  %m+% minutes(minutes), y), unit = "seconds")))

which gives:
                     x                   y years days hours minutes seconds
1  2012-01-04 03:15:06 2013-05-05 01:32:23     1  120    22      17      17
2  2012-01-07 12:26:33 2012-03-26 08:19:58     0   78    19      53      25
3  2012-01-12 18:35:11 2012-08-02 20:25:19     0  203     1      50       8
4  2012-01-18 13:25:11 2013-05-16 06:37:08     1  117    17      11      57
5  2012-02-13 19:13:45 2012-05-24 13:32:20     0  100    18      18      35
6  2012-02-22 20:04:52 2013-01-08 06:26:13     0  320    10      21      21
7  2012-03-13 22:15:13 2012-06-28 05:30:55     0  106     7      15      42
8  2012-05-09 03:34:36 2012-07-26 12:31:11     0   78     8      56      35
9  2012-05-12 20:23:39 2013-09-02 21:05:28     1  113     0      41      49
10 2012-06-24 03:36:16 2013-01-18 04:44:26     0  208     1       8      10
11 2012-07-11 06:33:17 2013-01-28 17:07:39     0  201    10      34      22
12 2012-07-21 12:35:48 2012-12-10 16:40:21     0  142     4       4      33
13 2012-08-02 15:54:59 2013-07-04 18:36:08     0  336     2      41       9
14 2012-08-20 00:40:46 2013-03-24 01:35:03     0  216     0      54      17
15 2012-09-07 15:32:38 2012-12-04 03:02:35     0   87    11      29      57
16 2012-10-17 02:06:37 2012-12-01 09:57:01     0   45     7      50      24
17 2012-11-02 17:38:48 2013-06-13 11:06:25     0  222    17      27      37
18 2012-11-03 12:10:48 2013-09-13 05:43:56     0  313    17      33       8
19 2012-11-10 05:42:55 2013-06-11 21:58:38     0  213    16      15      43
20 2012-10-19 21:48:28 2014-03-21 21:12:30     1  152    23      24       2
21 2020-02-28 22:48:28 2021-02-28 22:48:28     1    0     0       0       0


text:
Q: Probability and permutations I performed an experiment in which an individual had to order 5 items (i.e. his "response" was something like $(3,2,1,4,5)$ or some other permutation). The correct ordering was $(1,2,3,4,5)$ and I want to know the probability of getting 1, 2, 3 or 5 of the numbers right by chance alone.
I know that the probability of getting all right by chance alone is $1/5!$, and I think that probability of getting 3 right is:
$$
\frac{5 \choose 2}{5!}
$$
Because if you get 3 right you are just "swapping" two items from $(1,2,3,4,5)$. I am having difficulty to deduce the rest of the probabilities. I have written an R code that simulates the process, so I have an approximate answer. I just wanted to know how to do it by hand.
Thank you in advance!

A: You calculated the probability of getting exactly $3$ right correctly, and of course the probability of getting all $5$ right. The probability of getting exactly $4$ right is clearly $0$. So we need only deal with the probabilities of $2$ right, $1$ right, and $0$ right.
A small comment about the number of permutations that have exactly $3$ right. Your analysis was good. I would, however, prefer to count as follows. There are $\binom{5}{3}$ ways to pick which three will be right. For each of these ways, we need to swap the other two, so the number is $\binom{5}{3}$.  You chose instead the two items that would be swapped. Same count.
For exactly $2$ right, let us count the permutations that have exactly $2$ right. Which $2$ are right can be chosen is $\binom{5}{2}$ ways. For any such choice, that leaves three entries, say $a$, $b$, and $c$, that should be all wrong. Thus $a$ should be in one of positions $b$ or $c$. If $a$ is in position $b$, then $b$ must be in position $c$ (it cannot be in position $a$, for then $c$ would be forced into position $c$, which would make more than $2$ right). It follows that there are $\binom{5}{2}(2)$ permutations in which exactly $2$ are right.
For exactly $1$ right, the one that is right can be chosen in $\binom{5}{1}$ ways. That leaves $4$ items, which should all be in the wrong position. Where does $a$ go? There are $3$ possibilities, $b$, $c$, and $d$.  The situation is symmetrical in $b$, $c$, and $d$, so we count the permutations that take $a$ to $b$, and multiply the result by $3$.
So suppose $a$ goes to position $b$. Maybe $b$ goes to $a$, in which case $c$ and $d$ must also get interchanged. This gives $1$ permutation. Or maybe $b$ goes to $c$ or $d$. We count the permutations that take $b$ to $c$, and multiply by $2$.
So $a$ goes to $b$, and $b$ goes to $c$. Then $c$ must go to $d$, and $d$ must go to $a$. We conclude that there are $1+2$ allowed permutations such that $a$ goes to $b$. The total is therefore $\binom{5}{1}(3)(3)$.
For exactly $0$ right, we can use the same idea. However, it is easier to subtract the sum of the answers for $5$, $4$, $3$, $2$, and $1$ from $5!$.
Remark: We did crude counting, with essentially no theory. For numbers bigger than $5$, this could become very difficult. There is general theory that gives an answer. For details, look for example at the discussion of derangements in Wikipedia.
For any $m$, let $D_m$ be the number of derangements of a set $S_m$ of $m$ elements, that is, permutations of $S_m$ that leave no element fixed. (Wikipedia uses the notation $!m$ for $D_m$.) There are explicit expressions, and also nice recurrences, for $D_m$.  The number of permutations of a set of $n$ elements that leave exactly $k$ elements fixed is then $\binom{n}{k}D_{n-k}$.

A: I just wanted to make the simple observation that since you are only looking at permuting a sequence of 5, the total number of permutations is 5!=120 which is small enough for complete enumeration.  I am sure that most of you being mathematicians find doing this by brute force distasteful.  But it does work as long as you systematically enumerate all 120.  You can then inspect each one to see how many numbers are in their right place and then sum all cases with 1 and divide it by 120 to get the probability of one match. Do the same for 2,3 and 5. Aside from the obvious logic that if you match 4 the last one can only be in its right place you can also see this by noting that no case had exactly 4 matching their positions. I did not notice that this was mentioned in the answer above. I did the full enumeration and got 46/120 for 0 46/120 for 1 20/120 for 2 7/120 for 3 0/120 for 4 and 1/120 for 5.


text:
Q: FreeTextTable - Query as a set operation vs. having to cursor Does anyone know if it is possible to join to a free text table to query for many search terms in one operation vs. having to cursor over?
For example if I have a function that gets the top 1 closest match using FreeTextTable:
create function FN_GET_CLOSEST_CLASS_CODE_DESCRIPTION_ID_TBL (
     @classCodeDescription  varchar(4000)
    ,@state                 varchar(10)
    ,@classCode             int
    ,@effectiveOn           datetime2)
returns table as
return

select KEY_TBL.RANK, cd.CLASS_CODE_DESCRIPTION_ID
from CLASS_CODE_DESCRIPTION cd
  join CLASS_CODE cc on cc.CLASS_CODE_ID = cd.CLASS_CODE_ID
  inner join freetexttable (
      CLASS_CODE_DESCRIPTION, DESCRIPTION, @classCodeDescription, 1) as KEY_TBL
      on cd.CLASS_CODE_DESCRIPTION_ID = KEY_TBL.[KEY]
where cc.CLASS_CODE = @classCode
  and cc.STATE = @state
  and cc.EFFECTIVE_DATE <= @effectiveOn
  and cc.EXPIRATION_DATE > @effectiveOn
  and cd.EFFECTIVE_DATE <= @effectiveOn
  and cd.EXPIRATION_DATE > @effectiveOn

I then have a table that I would like to join against, to avoid having to do a painfully slow cursor through (there can be thousands upon thousands of rows)
declare @tbl table (
 classCode      int not null
,description    varchar(255) not null
,state          varchar(10) not null default 'FL'
,effectiveOn    datetime2 not null default '1999-01-01 00:00:00')

insert into @tbl (classCode, description)
values (9410, 'Municipal Employees'), (6, 'Farm: Fish Hatchery & Drivers')

I then do the query:
select *
from @tbl t
  cross apply dbo.FN_GET_CLOSEST_CLASS_CODE_DESCRIPTION_ID_TBL
  (t.description, t.state, t.classCode, t.effectiveOn)

But receive the error:

Msg 4129, Level 16, State 1, Line 13 The inline function
  "dbo.FN_GET_CLOSEST_CLASS_CODE_DESCRIPTION_ID_TBL" cannot take
  correlated parameters or subqueries because it uses a full-text
  operator.

I have tried it several different ways, but ultimately I am unable to trick out the engine because they all really boil down to the same thing under the covers.
Is there a way to run FreeTextTable in a set operation vs. having to cursor through it?

A: Hmm... try this "trick" for your function FN_GET_CLOSEST_CLASS_CODE_DESCRIPTION_ID_TBL to correlate with a SQL table variable rather than the freetext query:
create function FN_GET_CLOSEST_CLASS_CODE_DESCRIPTION_ID_TBL (
     @classCodeDescription  varchar(4000)
    ,@state                 varchar(10)
    ,@classCode             int
    ,@effectiveOn           datetime2)
RETURNS @ClosestClassCodeDesc TABLE
(
     TBLRANK INT,
     CLASS_CODE_DESCRIPTION_ID  varchar(4000)
)
as
begin
    insert into @ClosestClassCodeDesc (TBLRANK, CLASSname)
    select KEY_TBL.RANK, cd.CLASS_CODE_DESCRIPTION_ID from CLASS_CODE_DESCRIPTION cd
  join CLASS_CODE cc on cc.CLASS_CODE_ID = cd.CLASS_CODE_ID
  inner join freetexttable (CLASS_CODE_DESCRIPTION, DESCRIPTION, @classCodeDescription, 1) as KEY_TBL on cd.CLASS_CODE_DESCRIPTION_ID = KEY_TBL.[KEY]
where cc.CLASS_CODE = @classCode
  and cc.STATE = @state
  and cc.EFFECTIVE_DATE <= @effectiveOn
  and cc.EXPIRATION_DATE > @effectiveOn
  and cd.EFFECTIVE_DATE <= @effectiveOn
  and cd.EXPIRATION_DATE > @effectiveOn
return
end


text:
Q: React router v4 nested route relative path I have component with a react router v4 to anohter component, i want to add another routes in the second component.
this is the main route:
const Dashboard = () => {
  return (

      <Router>

          <Route path="/" exact component={Wall} />
          <Route path="/challenge/:id" component={Challenge} />

      </Router>

  )
}

and this is the Challenge component:
class Challenge extends Component {
  ...

  render() {
    return (
      ...
        <Router>

            <Route path="/overview" exact component={Overview} />
            <Route path="/discussions" exact component={Discussions} />

        </Router>
      ...
    )
  }
}

and this is not working for me..
The only option that works is to include the /challenge/:id inside the challenge component:
<Route path="/challenge/:id/overview" exact component={Overview} />
<Route path="/challenge/:id/discussions" exact component={Discussions} />

in the end i want to make the route look like this for example:
www.site.com/challenge/1/overview
www.site.com/challenge/1/discussions
But without containing the full route within each nested route.

A: Try this in your Challenge component:
class Challenge extends Component {
  ...

  render() {
    const { match } = this.props;
    return (
      ...

        <Route path={`${match.url}/overview`} exact component={Overview} />
        <Route path={`${match.url}/discussions`} exact component={Discussions} />

      ...
    )
  }
}

Note that you shouldn't need to add a new Router instance as your Challenge component is a descendant of the Router instance you defined in your top-level Dashboard component.


text:
Q: Trying to open an Integration Services Package and getting Error I have installed Visual Studio 2008 and SQL Server 2008 on my machine. When I try to open an existing .dtsx file using BIDS I get the following error. I know this file is not corrupt because I can remote into a different machine and open it there with no problems. Any help or suggestions would be greatly appreciated.

An error prevented the view from loading. (Microsoft Visual Studio)
The specified module could not be found. (Exception from HRESULT: 0x8007007E)
  (System.Windows.Forms)
Program Location:
at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)
  at System.Windows.Forms.AxHost.CreateWithoutLicense(Guid clsid)
  at System.Windows.Forms.AxHost.CreateWithLicense(String license, Guid clsid)
  at System.Windows.Forms.AxHost.CreateInstanceCore(Guid clsid)
  at System.Windows.Forms.AxHost.CreateInstance()
  at System.Windows.Forms.AxHost.GetOcxCreate()
  at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
  at System.Windows.Forms.AxHost.CreateHandle()
  at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
  at System.Windows.Forms.Control.CreateControl()
  at Microsoft.DataWarehouse.Design.ComponentDiagram.CreateDdsView(Control parentControl)
  at Microsoft.DataTransformationServices.Design.DtsComponentDiagram.CreateDdsView(Control parentControl)
  at Microsoft.DataWarehouse.Controls.DdsDiagramHostControl.set_ComponentDiagram(ComponentDiagram value)
  at Microsoft.DataTransformationServices.Design.ControlFlowControl.set_ComponentDiagram(ComponentDiagram value)
  at Microsoft.DataTransformationServices.Design.DtsPackageView.CreateControlFlowEditor(VsStyleToolBar pageViewToolBar)
  at Microsoft.DataWarehouse.Design.EditorWindow.EnsureViewIsLoaded(EditorView view)

A: Removing the folder C:\Program Files (x86)\Common Files\microsoft shared\MSDesigners8 and repairing VS2008 resolved my issue.
FYI, I had SQL Server 2014 installed and unistalled earlier, and all those DLLs still exist and caused this issue.

A: I had not installed VS11 but what I had done several months ago was install VS2012 and that is what ultimately caused this issue. When I uninstalled VS2012 all the dll's did not get removed so the install of VS2008 tried using those. That was the issue that needed resolved. I removed the folder (C:\Program Files (x86)\Common Files\microsoft shared\MSDesigners8)that contained all those dll's and then repaired my installation of VS2008. Tested the fix and it worked.


text:
Q: Toggling "favorites" on the network profile On your personal profile on each StackExchange site, it is possible to uncheck questions marked as favorites.
That is not possible on the network profile.
I guess this is because it would be updating data across StackExchange sites, but that favorite button is just so tempting to click.
Is it possible to make it clickable?


text:
Q: Multiple Db Connection Sql and Postgresq I'm trying to find a generic way for multiple db connection support.
        private void ExecuteCommand(string connStr, Action<NpgsqlConnection> task)
    {

            using (var conn = new NpgsqlConnection(connStr))
            {
                conn.Open();

                task(conn);
            }
      }

I have 2 Databases which are sql and postgresql. I dont want to duplicate my function 2 of them.
So I need something like that:
if (db == sql)
    new sqlConnection()
else
    new NpsqlConnection()
How can i do that in simple way?

A: There are a common set of base classes and interfaces for ADO.NET.  EG
 private void ExecuteCommand(string sql, DbConnection con)
 {
    var cmd = con.CreateCommand();
    cmd.CommandText = sql;
    cmd.ExecuteNonQuery();
 }


text:
Q: How to show Kotlin coroutine flow data in jetpack compose Preview? I passed a list of data to a composable function (data object of type Flow<List<Device>>). I used flow method collectAsState inside composable to use this data as state, and I can see the list in the emulator after building the application. Mind you, compose preview panel does not show the fake data that I passed to the composable.
@Preview
@Composable
PreviewHomeScreen() {
  val devices = flow { emit(
    listOf(Device(1, "Device Name 1"), Device(2, "Device Name 2"))
  )}
  HomeScreen(devices)
}

Is there any work that the preview window can show the data of type Flow?

A: I can't explain why it doesn't work. That's probably not the purpose of the preview.
You should think about separation of concern. It could be not your Composable responsibility to manage the flow.
So just preview the part that don't manage the flow :
@Composable
HomeScreen() {
  val devicesFlow = flow { emit(
    listOf(Device(1, "Device Name 1"), Device(2, "Device Name 2"))
  )}

  val devicesState = devicesFlow.collectAsState(initial = emptyList())

  // HomeScreen recomposed each time flow emit a new list of devices
  HomeScreen(devicesState.value)
}

@Composable
HomeScreen(devices: List<Device>) {
  // Your code here
}

@Preview
@Composable
PreviewHomeScreen() {
  val devices = listOf(Device(1, "Device Name 1"), Device(2, "Device Name 2"))
  HomeScreen(devices)
}


text:
Q: Fastest way to check if substring is at specific position of another string I have string (length 50-2000) and potential substring (length 2-8) which can only start at specific position (it may occur elsewhere but I don't care). I need to test large number of strings so speed is the key here. Is there faster way then:
var q = baseString.indexOf(searchString, assumedIndex) === assumedIndex;

or
var q = baseString.substr(assumedIndex, searchString.length) === searchString;

A: Keeping in mind what Amit said in the comments, I thought I might as well add an alternative that will (probably) be faster than at least the substr method:
var q = baseString.startsWith(searchString, assumedIndex);

From MDN:

The startsWith() method determines whether a string begins with the
  characters of another string, returning true or false as appropriate.

Small example:
> "Hello world!".startsWith("world!",6)
< true

The reason I argue it may be faster is because the polyfill (shown below) is directly what you implemented with substr, except that browser implementations will be implemented natively and probably without string copying. So it should be at least as fast as what you already suggested.
Polyfill:
if (!String.prototype.startsWith) {
    String.prototype.startsWith = function(searchString, position){
      position = position || 0;
      return this.substr(position, searchString.length) === searchString;
  };
}


text:
Q: Pulumi GCP and GraphQL getting error: NotSupportedTSVersion.d.ts is not a module I'm trying to build a graphql service running on Google Cloud Platform
I'm using:     "apollo-server-cloud-functions": "^3.11.1",
When I run:
pulumi up
I get:
NotSupportedTSVersion.d.ts is not a module
This is a file in node_modules/graphql
Here is my package.json:
{
  "name": "myawesomeapp",
  "license": "MIT",
  "scripts": {
    "dev": "ts-node-dev --no-notify --respawn --transpile-only src/server",
    "start": "node dist/server",
    "clean": "rm -rf dist",
    "build": "npm -s run clean && npm -s run generate && tsc && npm run build:schema",
    "build:schema": "ts-node src/schema/index.ts",
    "generate": "npm -s run generate:prisma",
    "generate:prisma": "prisma generate",
    "deploy": "pulumi up --yes -v 14",
    "test": "jest"
  },
  "prettier": {
    "semi": false,
    "singleQuote": true,
    "trailingComma": "all"
  },
  "dependencies": {
    "@pothos/core": "^3.23.1",
    "@pothos/plugin-prisma": "^3.37.0",
    "@prisma/client": "4.8.0",
    "@pulumi/gcp": "^6.39.0",
    "@pulumi/pulumi": "^3.50.2",
    "apollo-server-cloud-functions": "^3.11.1",
    "graphql": "16.6.0",
    "graphql-scalars": "1.20.1"
  },
  "devDependencies": {
    "@types/graphql": "^14.5.0",
    "@types/node": "18.11.18",
    "prettier": "^2.8.1",
    "prisma": "4.8.0",
    "ts-node": "10.9.1",
    "ts-node-dev": "2.0.0",
    "typescript": "4.9.4"
  },
  "prisma": {
    "seed": "ts-node --transpile-only prisma/seed.ts"
  }
}

Here is my tsconfig.ts:
{
  "compilerOptions": {
    "strict": true,
    "outDir": "dist",
    "rootDir": "src",
    "target": "es2018",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "esModuleInterop": true
  },
  "include": ["src/**/*"]
}

What I want to happen is that the endpoint is deployed and that I can send graphql queries to it.

A: Solution seems to be not using typescript in pulumi but compiling before the pulumi deploy
Moved index.ts to src subfolder
Added to package.json:
"main": "dist/index.js"
run:
npm run build
npm run deploy


text:
Q: How Can I write Gherkin script writing as I am a beginner and I dont know where to start Can someone save my life? How can I create two simple test cases written in the descriptive language Gherkin (maximum 10 lines)? Based on the popular messenger app WhatsApp (example: "send message button" functionality) or the www.google.com (example: "search" functionality).
I am not quite familiar with Cucumber Gherkin Script writing. I am just getting started and I dont know where to start

A: There are a lot of tutorial videos online, and the documentation is also very informative, so you may start there.  Anyway, here's an example:
Feature: Whatsapp

  Scenario: Succesful Log in
    Given a user opens Whatsapp on their device
    When the user enters valid credentials to login
    Then the the log in is successful

  Scenario: Unsuccesful Log in
    Given a user opens Whatsapp on their device
    When the user enters invalid credentials to login
    Then the log in is unsuccessful


text:
Q: MongoDB fails to connect when multiple hosts are specified in the connection string and one is down I'm using the C# driver to connect to a mongodb replicaset.
The connection string specifies all the hosts that are part of the replicaset:
mongodb://host1:2702,host2:2702,host3:2702,host4:2702,host5:2702/myDb

I thought that the idea of a replicaset is to stay connective even when a host goes down.. Not just for speed purposes.
Why is the C# driver tries to connect to every one of the hosts specified in the connection string? I'm ok with it checking which of them is the nearest (because I specified Nearest for the ReadConcern) but when it times out, I want it to ignore that host.
Am I missing anything?

A: Your are not specifying the replicaSet for these servers, you can specify it like this:
mongodb://host1:2702,host2:2702,host3:2702,host4:2702,host5:2702/myDb?replicaSet=MySet


text:
Q: Azure CDN update for WebApp I have a setup a azure cdn that point to my webapp. while i am changing in my style sheet and deploying webapp, the styles are updating immediately. so is there no any rquiremtn for purge in this case? does in this case cdn automatically update styles from webapp?
I am working according to this article
https://azure.microsoft.com/en-in/documentation/articles/cdn-websites-with-cdn/

A: If the URL of the resource remains the same, the CDN servers (and the browsers) are free to cache them. So, if you are using CDN, you need to force a URL change every time the file content changes (commonly done by adding a version string).
Since, it is working for you, either your files are not getting served from the CDN at all or somehow the URL is getting updated.
Look at the URL from where your style sheet is getting fetched (network tab in the browser's debugger). Make sure the URL path is actually from the CDN and not your website directly.
If you have a MVC.net app and you are using System.Web.Optimization.BundleCollection for style bundle, it add a query parameter to the URL embedded in the HTML and changes it if the file contents change. This ensures that the stale cached copies of the resources are not used.
See CDN and bundle caching sections at http://www.asp.net/mvc/overview/performance/bundling-and-minification

A: No, CDN does not automatically update the CSS for webapp.
To be safe, you should always purge.
CDN is a global service, you saw the CSS update doesn't mean everyone else all see the CSS update. Another IP address might still have the old CSS cached.
Besides, cache control header also plays a role here.


text:
Q: Get the universal app (windows phone) information Is there a way to extract the same information displayed in the Settings|About in a Windows Phone 8.1 (WINRT) Universal App?
I've been googling for a while but to no avail, well I'm wondering if it's because I'm running this in the emulator.
I'm interested in checking what information I can extract from the device simply from a curiosity point of view, but I really would like to be able to extract the Name (as displayed as the first line below the "Phone Information" title).
I've tried the following:
Windows.System.UserProfile.UserInformation.GetFirstNameAsync();
Windows.System.UserProfile.UserInformation.GetFirstNameAsync();
Windows.System.UserProfile.UserInformation.GetDisplayNameAsync();
...

I've also tried the following:
Windows.Devices.Enumeration.DeviceInformation.

and loop through all the returned items (i.e. 113) but it didn't provide anything really related to the About|Setting|User Information.
I ran the above in my emulator and directly on my phone but all the UserInformation functions are returning me blank values.
Any ideas?
Thanks.

A: You can't really get these (esp. on the phone). If you check the related MSDN pages you can see:
https://msdn.microsoft.com/en-us/library/windows/apps/windows.system.userprofile.userinformation.aspx - for example the GetLastName method remarks contain: "Access to the user's last name can be blocked by privacy settings (for example, if the UserInformation::NameAccessAllowed property is false). If access is blocked, this method returns an empty string."
Also the DeviceInformation class is more for finding attached devices to the PC (eg.: like printer helper apps): https://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.enumeration.deviceinformation


text:
Q: CAtlRegExp expression issue w/ begin/end anchors I have some code that uses the CAtlRegExp to perform some validation. In the particular case, a zip-code (5 or 5-4 format). In addition, I want the data to be exactly that, so I'm using anchors (^ and $). When I use the anchor-less expression the Match call succeeds. When I add the anchors, the Match call fails with the exact same data.
The code below is what I'm doing, with the values supplied in code for the failing case. I'll admit to not being a regular expression wizard, but RegEx Buddy is happy w/ the format expression as it is in code.
Any help would be appreciated. And if I'm missing anything, please let me know.
Thanks.
sData = "12345-1234";
m_FormatExpression = "^(\\d{5})(-(\\d{4}))?$";

CAtlRegExp<>   regex;
REParseError   status = regex.Parse( m_FormatExpression );

if( REPARSE_ERROR_OK == status )
{
   CAtlREMatchContext<> match;
   if( regex.Match( sData, &match ) )
   {
      result = true;
   }
}

A: Edit: Completely changed my answer when I figured out the problem.
The CAtlRegExp class does not support the repeat count in curly braces {}; it uses those for returning match objects.  The 5 and 4 in your expression were literal characters that it had to match. It's just a coincidence that the string you were testing with had a 5 in it, while the part with the 4 was optional. This expression works perfectly:
m_FormatExpression = "^\\d\\d\\d\\d\\d(-\\d\\d\\d\\d)?$";


text:
Q: SQL Query duplicating values even using Distinct My query seems to be duplicating the values that are being displayed.
I don't understand why, I have 5 tables
products with an id and category (4 of them), then each category is related to another table where the product_name, price is, then each one of these tables is related to the table called stock, stock is the one where price is.

`

      Product Name
      Quantity
      Price
      Action

    <?php
      $conn = mysqli_connect("localhost:3307", "root", "", "db_login");

if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

    $sql = "SELECT products.id, products.category, hygiene.product_name, hygiene.price, stock.quantity
FROM products
LEFT JOIN hygiene ON products.id = hygiene.product_id
LEFT JOIN stock ON hygiene.product_id = stock.item_id
WHERE products.category = 'Hygiene'

UNION

SELECT products.id, products.category, food.product_name, food.price, stock.quantity
FROM products
LEFT JOIN food ON products.id = food.product_id
LEFT JOIN stock ON food.product_id = stock.item_id
WHERE products.category = 'Food'

UNION

SELECT products.id, products.category, toys.product_name, toys.price, stock.quantity
FROM products
LEFT JOIN toys ON products.id = toys.product_id
LEFT JOIN stock ON toys.product_id = stock.item_id
WHERE products.category = 'Toys'

UNION

SELECT products.id, products.category, clothes.product_name, clothes.price, stock.quantity
FROM products
LEFT JOIN clothes ON products.id = clothes.product_id
LEFT JOIN stock ON clothes.product_id = stock.item_id
WHERE products.category = 'Clothes'";

$result = $conn->query($sql);

while ($row = mysqli_fetch_array($result)) {

    $product_name = isset($row['product_name']) ? $row['product_name'] : '';
    $quantity = isset($row['quantity']) ? $row['quantity'] : '';
    $price = isset($row['price']) ? $row['price'] : '';

    echo "
";
    echo "<form name='update' action='update_stock.php' method='post'>";
    echo "<input type='text' name='product_name' value='".$row ['product_name']."'>	";
    echo "<input type='text' class='stock--update--num' name='quantity' value='".$row['quantity']."'>	";
    echo "<input type='text' class='stock--update--num' name='price' value='".$row['price']. "€"."'>	";
    echo "<input type='submit' name='update' value='Update'>	";
    echo "</form>";
    echo "
";
}

    ?>

`

I wanted for it to display each item only once with the correct quantity and price.
Other code I tried:
`$conn = mysqli_connect("localhost:3307", "root", "", "db_login");

if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

$sql = "SELECT DISTINCT products.*, hygiene.product_id, hygiene.product_name, hygiene.price, hygiene.image_path, stock.quantity
FROM products
LEFT JOIN hygiene ON products.id = hygiene.product_id
LEFT JOIN stock ON hygiene.product_id = stock.item_id
WHERE products.category = 'Hygiene'
UNION
SELECT DISTINCT products.*, food.product_id, food.product_name, food.price, food.image_path, stock.quantity
FROM products
LEFT JOIN food ON products.id = food.product_id
LEFT JOIN stock ON food.product_id = stock.item_id
WHERE products.category = 'Food'
UNION
SELECT DISTINCT products.*, toys.product_id, toys.product_name, toys.price, toys.image_path, stock.quantity
FROM products
LEFT JOIN toys ON products.id = toys.product_id
LEFT JOIN stock ON toys.product_id = stock.item_id
WHERE products.category = 'Toys'
UNION
SELECT DISTINCT products.*, clothes.product_id, clothes.product_name, clothes.price, clothes.image_path, stock.quantity
FROM products
LEFT JOIN clothes ON products.id = clothes.product_id
LEFT JOIN stock ON clothes.product_id = stock.item_id
WHERE products.category = 'Clothes'";

$result = $conn->query($sql);
while ($row = mysqli_fetch_array($result)) {
    echo "
";
    echo "<form name='update' action='update_stock.php' method='post'>";

    $product_name = isset($row['product_name']) ? $row['product_name'] : '';
    $quantity = isset($row['quantity']) ? $row['quantity'] : '';
    $price = isset($row['price']) ? $row['price'] : '';

    echo "<input type='text' name='product_name' value='".$product_name."'>	";
    echo "<input type='text' class='stock--update--num' name='quantity' value='".$quantity."'>	";
    echo "<input type='text' class='stock--update--num' name='price' value='".$price. "€"."'>	";
    echo "<input type='submit' name='update' value='Update'>	";
    echo "</form>";
    echo "
";
}`

A: Wrap all your UNION queries in one single DISTINCT query:
SELECT DISTINCT * FROM(
SELECT...
UNION
SELECT....
UNION
SELECT...
)

But looking at your query closely, you are querying for more columns than you are fetching - I don't think product_ids would make a unique result.


text:
Q: Disable / enable кнопки в ROW_ACTION ORACLE APEX У меня есть IG в Апексе, куда я добавил 3 кнопки в ROW_ACTION.
Вопрос: Как можно задизейблить эти кнопки в зависимости от значения элемента строки?

$(function() {
  let arr = [];
  $("#PORUCH_LIST").on("interactivegridviewchange", function(event, data) {
      if (data.view === "grid" && data.created) {
        var view = apex.region("PORUCH_LIST").widget().interactiveGrid("getViews", "grid"),
          menu$ = view.rowActionMenu$;
        menu$.menu("option").items.push({
            type: "action",
            label: "Посмотреть подзадачи",
            action: function(menu, element) {
              var record = view.getContextRecord(element)[0];
              $("#P1_WHERE_SUBTUSK").val('*/ and kod_rod = ' + view.model.getValue(record, "KOD") + '/*');
              arr.push(view.model.getValue(record, "KOD_ROD"));
            });
        });
    }
  })
})


text:
Q: How to return an XML string after authentication in SimpleSamlPhp I am new to SimpleSamlPhp, I already setup a working environment, it is able to redirect to an URL @ metadata\saml20-sp-remote.php
Example:
$metadata['http://www.example.com'] = array(
    'AssertionConsumerService' => 'http://www.example.com/acceptsaml.php',
    'SingleLogoutService' => 'http://www.example.com/saml2-logout.php',
);

How to pass extra custom fields (I added new custom fields, example: EmployeeID, in auth_user table) as XML/Json after authentication redirect?
Thanks.

A: You can use authProc filters to add new attributes to the XML asserted by your IdP. The auth source you use may also have additional options for adding/naming attributes.
$metadata['myEntityId'] = array(
        'host' => 'my-hostname',
        'privatekey' => 'key.pem',
        'certificate' => 'pub.crt',
        'auth' => 'auth-source',
        'signature.algorithm' => 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256',
        'attributes.NameFormat' => 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri',
        'authproc' => array(
            50 => array(
               'class' => 'core:AttributeAdd',
               'myAttribute' => array('some-value'),
            ),
         ),
);


text:
Q: SCOM 2012 DNS Forwarder Availability Monitor Background:
I have an environment with two different AD domains, each in its own forest, each with two Windows Server 2008 R2 domain controllers acting as DNS servers. There is no trust between the domains.
Each DNS server manages the main DNS zone for its AD domain, and then some other zones, including the reverse lookup zone for its IP subnets; all zones are AD-integrated; all DNS servers which manages a zone are correctly listed as authoritative name servers for that zone.
So, the situation is like this (using fake names and IP addresses):
Domain A:
DNS domain: domainA.dom
IP subnet: 192.168.1
DCs/DNS Servers: serverA1.domainA.dom (192.168.1.1), serverA2.domainA.dom (192.168.1.2)
Authoritative zones: domainA.dom, 1.168.192.in-addr.arpa, somezone.local
Domain B:
DNS domain: domainB.dom
IP subnet: 10.0.0
DCs/DNS Servers: serverB1.domainB.dom (10.0.0.1), serverB2.domainB.dom (10.0.0.2)
Authoritative zones: domainB.dom, 0.0.10.in-addr.arpa, someotherzone.local
DNS servers in domain A have conditional forwarders defined for each zone managed by DNS servers in domain B, forwarding to both domain B's DNS servers; DNS servers in domain B have the opposite configuration. All forwarders are stored in Active Directory.
All is working perfectly, and computers in each domain can resolve forward and reverse DNS queries for both domains, using their domain's DNS servers.

The problem:
I have SCOM 2012 deployed in domain A, with the SCOM agent installed on both DCs; the management packs for Active Directory and DNS Server are installed and up-to-date.
I have a series of alerts like the following ones on both domain controllers; each alert is generated for each forwarded zone and for each forwarded server:
Forwarder someotherzone.local (10.0.0.1) cannot resolve the host name 192.168.1.1,someotherzone.local for serverA1.domainA.dom
Forwarder someotherzone.local (10.0.0.2) cannot resolve the host name 192.168.1.1,someotherzone.local for serverA1.domainA.dom
Forwarder someotherzone.local (10.0.0.1) cannot resolve the host name 192.168.1.2,someotherzone.local for serverA2.domainA.dom
Forwarder someotherzone.local (10.0.0.2) cannot resolve the host name 192.168.1.2,someotherzone.local for serverA2.domainA.dom
Forwarder 0.0.10.in-addr.arpa (10.0.0.1) cannot resolve the host name 192.168.1.1,0.0.10.in-addr.arpa for serverA1.domainA.dom
Forwarder 0.0.10.in-addr.arpa (10.0.0.2) cannot resolve the host name 192.168.1.1,0.0.10.in-addr.arpa for serverA1.domainA.dom
Forwarder 0.0.10.in-addr.arpa (10.0.0.1) cannot resolve the host name 192.168.1.2,0.0.10.in-addr.arpa for serverA2.domainA.dom
Forwarder 0.0.10.in-addr.arpa (10.0.0.2) cannot resolve the host name 192.168.1.2,0.0.10.in-addr.arpa for serverA2.domainA.dom

The only exception is the main AD DNS zone managed by domain B's DNS servers ("domainB.dom"): for that conditional forwarder, no alert is generated and the forwarder availability monitor is green.
Ok, what does this mean?
What are those monitors trying to tell me?
What are they checking?
What's actually wrong?
And why there is no error for the "domainB.dom" zone, which is configured in the exact same way as the other ones, both as a zone in domain B's DNS servers and as a forwarder in domain A's DNS servers?

A: Answer found, and it's a bit unpleasant (at least if you were expecting the people creating management packs to actually know what they are doing).
Extracted from the monitor's description:

This monitor verifies forwarder availability by performing an
  NSLOOKUP on the targeted forwarder.
The script executes nslookup -timeout=<value> -querytype=<type> <name> <server>
<type> is A, NS, SOA.
<name> is target DNS name to resolve. If unconditional forwarder, the
  override value is used else the forwarder domain name is used.
<server> is the name of the server where the NSLOOKUP query occurs.
  The value is $Target/Property[Type="DNS!Microsoft.Windows.DNSServer.Library.Server"]/ListeningIP$
  which provides a listing of all IP addresses that the current DNS
  server is listening on.
<value> is timeout seconds/3 because timeout seconds is used to set
  the maximum time the script can run.
Unconditional Forwarder Example: NSLOOKUP -timeout=30 -querytype=a www.microsoft.com 10.0.0.5 would query server 10.0.0.5 for the DNS
  name for www.microsoft.com. In this case, you would set the actual
  timeout seconds to 90 monitor override.
Conditional Forwarder Example: NSLOOKUP -timeout=30 -querytype=a www.msn.com 10.0.0.5 would query server 10.0.0.5 for the actual name
  of the conditional forwarder targeted by this monitor.

What this means is that the SCOM agent will try to perform queries like these ones:
nslookup -timeout=30 -querytype=a domainB.dom <server>
nslookup -timeout=30 -querytype=a someotherzone.local <server>
nslookup -timeout=30 -querytype=a 0.0.10.in-addr.arpa <server>

This would work for the main AD domain's DNS zone (because DCs automatically register themselves as empty A records for that zone), but would fail for "someotherzone.local", which didn't have any empty A record (I can confirm that, after manually creating one, the alert disappeared and the monitor returned to green).
The third query, of course, would always fail, because it just doesn't make any sense at all to look for an A record in a reverse lookup zone.
Resolution: override the DNS Forwarder Availability Monitor to perform a NS or SOA query for the forwarded zone instead of an A query.
Which is what it should have been doing from the very beginning.


text:
Q: Prevent window on scroll function occurring on mobile I have a function that runs on window scroll, I only want it to work however on screensizes of 768 and above. This is working fine if i loaded it on mobile size, but if the initial page load is on a widescreen of 768px + and then i shrink the viewport down it doesn't prevent the function?
(function($) {

    var s,
    clippy = {
    settings: {
      heading: $('.js-clippy'),
    },
    init: function() {
      s = this.settings;
      this.bindEvents();
    },
    bindEvents: function(){
        if ($(window).width() > 768) {
            $(window).on("load resize scroll", $.proxy(this.getClippy, this));
        }
    },

    getClippy: function(){
      s.heading.each(function() {
        var layerOffset = $(this).closest('a').offset(),
          containerOffset = layerOffset.top - $(window).scrollTop(),
          clippy = containerOffset - $(this).css("top").replace(/[^-\d\.]/g, '') - $(this).css("margin-top").replace(/[^-\d\.]/g, '');
        $(this).css('clip', 'rect('+ clippy +'px, auto, auto, auto)');
      });
    },
    };
    clippy.init();

  })(jQuery);

I've tried adding a conditional statement to my binded event with no luck...
bindEvents: function(){
        if ($(window).width() > 768) {
            $(window).on("load resize scroll", $.proxy(this.getClippy, this));
        }
});

to the event only it doesn't seem to work?

A: You should consider checking the width inside the getClippy function. That will work if you load the page with a large viewport and shrink it and vice versa.
    (function($) {

    var s,
    clippy = {
    settings: {
      heading: $('.js-clippy'),
    },
    init: function() {
      s = this.settings;
      this.bindEvents();
    },
    bindEvents: function(){
        $(window).on("load resize scroll", $.proxy(this.getClippy, this));
    },

    getClippy: function(){
        if ($(window).width() > 768) {
            s.heading.each(function() {
                var layerOffset = $(this).closest('a').offset(),
                containerOffset = layerOffset.top - $(window).scrollTop(),
                clippy = containerOffset - $(this).css("top").replace(/[^-\d\.]/g, '') - $(this).css("margin-top").replace(/[^-\d\.]/g, '');
                $(this).css('clip', 'rect('+ clippy +'px, auto, auto, auto)');
            });
        }
    },
    };
    clippy.init();

  })(jQuery);


text:
Q: Updating software during windows restart I need a way to update my software before(not after) windows restart time.
Scenario:

*

*User push shutdown/restart button

*OS shuting down.

*Then my installer starts and user can sees message "Updating software" while installer works. So behavior must be similar to windows updates.

*Windows restarting

Is it possible?
Thanks.


text:
Q: Specify the Number of Times that Test Explorer will Run a Test Background
I have a project that I am currently unit testing. This project includes code that talks to a piece of hardware asynchronously. The objective for the software library is to control the hardware and provide workarounds for any bugs that the device has. I have unit tests in place that test out the functionality of the software (where the functionality includes controlling aforementioned hardware device). As I tweak my software, I fail the unit tests less and less (eventually I will not fail them because I will have written all necessary workarounds for the hardware). So, I need to run these tests as many times as possible and gather the results.
Question
In Visual Studio 2015 (within test-explorer), is there a way to specify the number of times that a unit-test should run?


text: Q: Whole hardisk showing to install ubuntu I made a live cd and then booted from it to install ubuntu when I got to the "something else" option it was only showing "/dev/sda" my partitions were not showing please help me I want to install it on a specific partition.


text:
Q: Cannot add keyservers in seahorse I cannot add keyservers in seahorse... When I try to add any keyserver the "ok" button is deactivated...

I'm using Ubuntu 16.04 lts

A: use dconf-editor:
/desktop/gnome/crypto/pgp/keyservers > custom value (see Default)


text:
Q: escape Shell string node.js So i am trying to run a shell command from my node.js script:
var child = exec('mysqldump -u "'+dbConfig.user+'" --password="' + dbConfig.password + '" --single-transaction ' + dbConfig.database + ' > ' + dumpFilePath)

Now this is all well and fine however the password can contain special characters that would break the command.
I have been looking into this node module: https://www.npmjs.com/package/shell-escape
However one of its issue is that it cant parse = sign. which makes the package useless to the above statement.
So my question is how can i safely escape the password field?

A: You can escape the password safely with single quotes:
var child = exec('mysqldump -u ' + dbConfig.user + ' --password=\'' + dbConfig.password + '\' --single-transaction ' + dbConfig.database + ' > ' + dumpFilePath)


text:
Q: How do I validate this select option if not selected? im trying to validate this select option but it never worked . I've added the class = 'required' and added the rule too in jquery validation , but it did not work either.
I need a solution to this problem
mycode :

Jenis Kelamin

<select class="form-control required" name="jk" id="gender" required/>
<option>Pilih</option>
<option value="Laki-Laki">Laki - Laki</option>
<option value="Perempuan">Perempuan</option>
</select>

// add the rule here
 $.validator.addMethod("valueNotEquals", function(value, element, arg){
  return arg !== value;
 }, "Value must not equal arg.");

 // configure your validation
 $("gender").validate({
  rules: {
   jk: { valueNotEquals: "default" }
  },
  messages: {
   jk: { valueNotEquals: "Please select an item!" }
  }
 });

A: You could add a disabled and selected option to your select for the required to work properly, forcing the user to explicitly select one option first:

<form>
  <select class="form-control required" name="jk" id="gender" required>
    <option disabled selected></option>
    <option>Pilih</option>
    <option value="Laki-Laki">Laki - Laki</option>
    <option value="Perempuan">Perempuan</option>
  </select>
  <input type="submit">
</form>

A: Change from
<option>Pilih</option>

To:
<option value="">Pilih</option>

A: <form>
<select class="form-control required" name="jk" id="gender" required >
<option disabled selected></option>
<option value="Pilih">Pilih</option>
<option value="Laki-Laki">Laki - Laki</option>
<option value="Perempuan">Perempuan</option>
</select>
<button type="submit">
</form>