text:
Q: symfony2 textfield custom label I had a little but unpleasant problem with symfony2 Field component. For example, I would like to output array of form fields in twig template:
{% for field in form %}
    {{ form_label( field ) }}: {{ form_field( field ) }}
{% endfor %}

And here is text field configuration:
$field = new TextField( 'FieldName', array(
    'label' => 'MyCustomLabel',
) );

But unfortunately when engine renders this output i get 'FieldName' as label instead of 'MyCustomLabel'. I would not have problems if i outputting form fields not in for (in that case i can just add a label in template for each field). But the script doesn't know certain quantity and configuration of form fields before execution. So, I need to implement cycle method for field rendering. And I also want to stay in twig notation...I will be pleased for a good advise :)

A: If you want to change the label, than follow the steps.
1) Create form class.
2) add('fieldName',null,array('label' => 'My New Label:'))
please do not change fieldName, but you can play with Label within an array.
Enjoy!

A: The easiest way to do it in template - pass the second argument to the form_label
<div class="form-group">
    {{ form_label(form.email, 'Email:') }} <- this row
    {{ form_widget(form.email, {'attr': {'class': 'form-control'}}) }}
</div>

A: An answer for the Symfony 2.1 users who stumble onto this hoping for an answer, it's almost there is the @rikinadhyapak answer.
if you have extended the FormType class of some bundle like FOSUserBundle, in your buildForm method:
    $field = $builder->get('username');         // get the field
    $options = $field->getOptions();            // get the options
    $type = $field->getType()->getName();       // get the name of the type
    $options['label'] = "Login Name";           // change the label
    $builder->add('username', $type, $options); // replace the field

A: I would honestly hold off on learning the Symfony Form component for a couple weeks. Symfony devs are doing a major-overhaul on the Form API. From what I understand, most of it is done, and a pull request has been submitted to the main repository.

A: For Symfony 2.3 you can replace the label using the events as the following:
$builder->addEventListener(FormEvents::POST_SET_DATA, function (FormEvent $event)
{
    $form = $event->getForm();
    $object = $event->getData();

    $field = $form->get('fieldname');
    $config = $field->getConfig();
    $options = $config->getOptions();
    $options['label'] = 'New label'; // change the label
    $form->add($field->getName(), $config->getType()->getName(), $options); // replace the field

});

but I would avoid this.

A: It is added in Symfony2 beta2 http://groups.google.com/group/symfony-users/browse_frm/thread/c66165093665809


text:
Q: gdm-password conversation error occurs every 25 minutes without user attempting to login I am running CentOS 6.6 and I trying to figure out what might be causing gdm-password error to show up every 25 minutes in /var/log/messages log eventhough no user has attempted to login. Can someone please help me to understand what might be running every 25 minutes that could cause this error to occur.
Aug 25 00:10:22 TEST pam: gdm-password: pam_succeed_if(gdm-password:auth): error retrieving user name: Conversation error
Aug 25 00:10:22 TEST pam: gdm-password: gkr-pam: couldn't get the user name: Conversation error
Aug 25 00:10:22 TEST pam: gdm-password: pam_succeed_if(gdm-password:auth): error retrieving user name: Conversation error
Aug 25 00:10:22 TEST pam: gdm-password: pam_selinux_permit(gdm-password:auth): Cannot determine the user's name

A: I was able to determine that the below gconf setting was causing the gdm password error to show up every 25 minutes.
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --set /desktop/gnome/session/max_idle_action --type string forced-logout

To Fix this I made sure the gconf setting was set as a regular user and not as root.
sudo -u username gconftool-2 --set /desktop/gnome/session/max_idle_action --type string forced-logout

redpajama_set_name: RedPajamaStackExchange


text:
Q: Displaying data from an Oracle Table through SQL Query I am not able to attach a screenshot because I am a new user here.
By the way, I am trying to view data from a table through SQL.
I have created the table using the following command:-
CREATE TABLE  N2
   (    BOOK_ID VARCHAR2(6) NOT NULL ENABLE,
    BOOK_NAME VARCHAR2(150) NOT NULL ENABLE,
    AUTHOR_ID CHAR(6),
    PUBLICATION_ID CHAR(6),
    MAJOR_SUB_ID CHAR(6),
    MINOR_SUB_ID CHAR(6)
   )

But the problem is that no record is displayed for the query:-
Select * from N2 where book_id='B0001';

though it can be seen that there is a record having book_id=B0001
This problem is removed if I use char type for book_id column or I write
Select * from N2 where book_id like 'B0001%';

One more thing is that this problem doesn't occur with other columns of varchar2 data type.
Please help me.

A: Classic : you probably have a trailing space of hidden character (line feed) at the end of your data...
you could achieve the same result with :
Select * from N2 where trim(book_id)='B0001';

but it would be better to clean up your data as I presume this character shouldn't be in your ID field


text:
Q: Need help to match specific characters with a Java regex I need to match characters that do not belong to the following character set :

a b c d e f g h i j k l m n o p q r s t u v w x y z
  A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
  0 1 2 3 4 5 6 7 8 9
  / - ? : ( ) . , ' + space

To do that, I'm using this regex :
String regex = "[^\\da-zA-Z/\\-\\?:\\(\\)\\.\\,'\\+ ]+";

Unfortunatly, that does not work.
I tried this too (negation):
String regex = "(?![\\da-zA-Z/\\-\\?:\\(\\)\\.\\,'\\+ ]+)";

But it's not ok.
Anyone can help ?

A: I don't think you can use a predefined character class like \d inside another character class. Also, most of the characters you're escaping aren't special within a character class (although the escaping should be harmless). So:
String regex = "[^0-9a-zA-Z/\\-?:().,'+ ]+";

Side note: In your question, you said you wanted to replace ' (a fancy curly apostrophe), but in your regex you have just a normal apostrophe '. So change that if needed.
Here's a test:
public class RegTest {
    public static final void main(String[] args) {
        String regex, test, result;

        // First, test without the negation and make sure it *does* replace the target chars
        regex = "[0-9a-zA-Z/\\-?:().,'+ ]+";
        test = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/-?:().,'+";
        result = test.replaceAll(regex, "%");
        System.out.println(result);
        // Prints %

        // Now, test *with* the negation and make sure it matches other characters (I put
        // a few at the beginning) but not those
        regex = "[^0-9a-zA-Z/\\-?:().,'+ ]+";
        test = "[@!\"~abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/-?:().,'+";
        result = test.replaceAll(regex, "%");
        System.out.println(result);
        // Prints %abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/-?:().,'+
    }
}


text:
Q: Recursively Enumerable Languages and Turing Machines L1 = { M | Turing Machine M terminates for at least 637 inputs}
L2 = { M | Turing Machine M terminates for at most 636 inputs}
One of them is recursively enumerable, which one?

A: A language is said to be recursively enumerable if you can build a Turing machine that accepts all inputs that are in the language (but does not necessarily reject inputs that are not).
The obvious machine you'd want to construct, for both languages, is one that activates $M$ on all possible inputs in a finite time. While this may seem like a too much, it's actually possible, with the following algorithm:

*

*Set an order in which you traverse all inputs, call them $(x_i)_{i=0}^\infty$. (This can be, for instance, the alphabetical order)

*For the $i$th iteration, initialize $M$ and run $i$ steps of it on $\{x_0,\ldots,x_i\}$.

By doing this you guarantee that eventually you'll have run any finite number of steps of $M$ on any input.
Can you use this method to construct a machine that accepts one of $L_1,L_2$?


text:
Q: Error CS0234 The type or namespace name 'Platforms' does not exist in the namespace 'MvvmCross' (are you missing an assembly reference?) Hi I'm newbie in MvvmCross framework and Xamarin.Android development,
I try to follow the TipCalc Android Project tutorial https://www.mvvmcross.com/documentation/tutorials/tipcalc/a-xamarinandroid-ui-project via this link
However, after I created the Core project, and added the "MainApplication.cs" to the Android Project in the solution (Installed both MvvmCross version 7.2). I cannot reference Platforms package inside MvvmCross.
It gives me the error,

Error CS0234 The type or namespace name 'Platforms' does not exist in the namespace 'MvvmCross' (are you missing an assembly reference?)

This should be a simple app tutorial but it has been making me stuck for 2 days. Does anyone have an idea?
MainApplication.cs
using System;
using Android.App;
using Android.Runtime;
// These next 2 aren't found
using MvvmCross.Platforms.Android.Core;
using MvvmCross.Platforms.Android.Views;
using TipCalc.Core;

namespace TipCalc.Droid
{
    [Application]
    // So this MvxAndroid... is also not found
    public class MainApplication : MvxAndroidApplication<MvxAndroidSetup<App>, App>
    {
        public MainApplication(IntPtr javaReference, JniHandleOwnership transfer)
            : base(javaReference, transfer)
        {
        }
    }
}

I added MvvmCross as an assembly reference, but these namespaces aren't showing up. What's going wrong here?

A: Recently the mvvmcross namespaces were changed
it shows that MvvmCross.Platform was changed to MvvmCross
the changelog

A: If you are updating an old solution, make sure you change your Android Application project to target Android 10. Otherwise the NuGet package won't install properly for the Android Application. If you are still using packages.config, you may have to uninstall the packages and install them again after changing target.
You can reference the TipCalc sample here: https://github.com/MvvmCross/MvvmCross-Samples/tree/master/TipCalc

A: Although the reece was correct when there was a codebase change for version 6.0.0 of MvvmCross, the actual solution to my problem, in order to get the tutorial to work is downgrading MvvmCross package in Nuget to 6.2.1. I haven't tested with any other versions but 6.2.1 worked for me.


text:
Q: Error 500 calling from HTML on apache server an ASPX through out JSONP in reference to this link Ajax json post to Controller across domains, "not allowed by" Access-Control-Allow-Headers I am trying to do the same. So I have got on one part my html page(SPA) hosted on a apache server here the code:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>MyMobilePage</title>

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>

<!-- Librerie PhotoSwipe   -->
<link rel="stylesheet" type="text/css" href="../PhotoSwipe/photoswipe.css">
<link rel="stylesheet" type="text/css" href="../PhotoSwipe/styles.css">
<script type="text/javascript" src="../PhotoSwipe/klass.min.js"></script>
<script type="text/javascript" src="../PhotoSwipe/code.photoswipe-3.0.5.min.js"></script>
<!-- End PhotoSwipe   -->

In the same page here my call to my ASPX
<script type="text/javascript">
    $(document).ready(

    function(){
      alert("I am in!")
      $.ajax({
    url: 'http://publicIP:Portn/GetNames.aspx/AddPerson',
    jsonp: 'callback',
    dataType: 'jsonp',
    data: { firstName: 'john', lastName: 'smith' },
    success: function (result) {
        alert(result);
    }
});    }    );
</script>

in my ASPX codebihind page insted:
Imports System.IO
Imports System.Net
Imports System.Text
Imports System.Web.Script.Serialization
Imports System.Web.mvc

Public Class JsonpResult
    Inherits ActionResult
    Private ReadOnly _obj As Object

    Public Sub New(obj As Object)
        _obj = obj
    End Sub

    Public Overrides Sub ExecuteResult(context As ControllerContext)
        Dim serializer = New JavaScriptSerializer()
        Dim callbackname = context.HttpContext.Request("callback")
        Dim jsonp = String.Format("{0}({1})", callbackname, serializer.Serialize(_obj))
        Dim response = context.HttpContext.Response
        response.ContentType = "application/json"
        response.Write(jsonp)
        response.End()
    End Sub

    Public Function AddPerson(person As String) As ActionResult
        Return New JsonpResult(True)

    End Function
End Class

First question do I have to write something in the HTML of this ASPX?
Here my IIS configuration to allow HttpResponse (Web.config)
- I guess I put too many stuff in it, could you tell me which onese I can remove, my aim is to run this example but than I want to return an HTML code I don't know how I guess with JSONP but this is next step for me now I want to make this example working.
 <system.webServer>
         <httpProtocol>
                <customHeaders>
                <add name="Access-Control-Allow-Origin" value="*" />
                <add name="Access-Control-Allow-Headers" value="SOAPAction, application/json, Origin, X-Requested-With, Content-Type, Accept, Authorization" />
                <add name="Access-Control-Allow-Methods" value="POST, PUT, DELETE, GET, OPTIONS" />
        </customHeaders>
      </httpProtocol>

So when I run from my browser chrome Version 31.0.1650.63 m
I got this debugging the "Network" with chrome
Request URL:http://publicIP:Portn/GetNames.aspx/AddPerson?callback=jQuery1910335388598497957_1387526286364&firstName=john&lastName=smith&_=1387526286365
Request Method:GET
Status Code:500 Internal Server Error
Request Headersview source
Accept:*/*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8,it;q=0.6
Cache-Control:max-age=0
Connection:keep-alive
Cookie:__utma=155182590.733648325.1387385626.1387385626.1387406760.2; __utmz=155182590.1387385626.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
Host:publicIP:Portn
Referer:http://www.mywebsite.com/Test/Test.html
User-Agent:Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36
Query String Parametersview sourceview URL encoded
callback:jQuery1910335388598497957_1387526286364
firstName:john
lastName:smith
_:1387526286365
Response Headersview source
Access-Control-Allow-Headers:SOAPAction, application/json, Origin, X-Requested-With, Content-Type, Accept, Authorization
Access-Control-Allow-Methods:POST, PUT, DELETE, GET, OPTIONS
Access-Control-Allow-Origin:*
Cache-Control:private
Content-Length:3420
Content-Type:text/html; charset=utf-8
Date:Fri, 20 Dec 2013 07:58:19 GMT
Server:Microsoft-IIS/8.5
X-AspNet-Version:4.0.30319
X-Powered-By:ASP.NET

I get the error message 500 Internal server error, what can be, did I forget something to config.
Thank you in advance.


text:
Q: Ubuntu 14.04 CUDA 8.0 unmet dependency I am trying to upgrade my cuda libraries the newest Cuda 8.0.61.
I started of with removing cuda 7.5.
Later on I have downloaded the deb file of cuda 8.0.61 and run the following commands:

*

*sudo dpkg -i cuda-repo-ubuntu1404-8-0-local-ga2_8.0.61-1_amd64.deb

*sudo apt-get update

*sudo apt-get install cuda
During the installation I received an error and when I try to run sudo apt-get install -f, I get the following dependency error:
The following packages have unmet dependencies:
 cuda-cublas-dev-8-0 : Depends: cuda-cublas-8-0 (>= 8.0.61) but 8.0.34-1 is installed
 cuda-cudart-dev-8-0 : Depends: cuda-cudart-8-0 (>= 8.0.61) but 8.0.34-1 is installed
 cuda-cufft-dev-8-0 : Depends: cuda-cufft-8-0 (>= 8.0.61) but 8.0.34-1 is installed
 cuda-curand-dev-8-0 : Depends: cuda-curand-8-0 (>= 8.0.61) but 8.0.34-1 is installed
 cuda-cusolver-dev-8-0 : Depends: cuda-cusolver-8-0 (>= 8.0.61) but 8.0.34-1 is installed
 cuda-cusparse-dev-8-0 : Depends: cuda-cusparse-8-0 (>= 8.0.61) but 8.0.34-1 is installed
 cuda-npp-dev-8-0 : Depends: cuda-npp-8-0 (>= 8.0.61) but 8.0.34-1 is installed
 cuda-nvgraph-dev-8-0 : Depends: cuda-nvgraph-8-0 (>= 8.0.61) but 8.0.34-1 is installed
 cuda-nvrtc-dev-8-0 : Depends: cuda-nvrtc-8-0 (>= 8.0.61) but 8.0.34-1 is installed
 cuda-runtime-8-0 : Depends: cuda-nvrtc-8-0 (>= 8.0.61) but 8.0.34-1 is installed
                    Depends: cuda-nvgraph-8-0 (>= 8.0.61) but 8.0.34-1 is installed
                    Depends: cuda-cusolver-8-0 (>= 8.0.61) but 8.0.34-1 is installed
                    Depends: cuda-cublas-8-0 (>= 8.0.61) but 8.0.34-1 is installed
                    Depends: cuda-cufft-8-0 (>= 8.0.61) but 8.0.34-1 is installed
                    Depends: cuda-curand-8-0 (>= 8.0.61) but 8.0.34-1 is installed
                    Depends: cuda-cusparse-8-0 (>= 8.0.61) but 8.0.34-1 is installed
                    Depends: cuda-npp-8-0 (>= 8.0.61) but 8.0.34-1 is installed
                    Depends: cuda-cudart-8-0 (>= 8.0.61) but 8.0.34-1 is installed
 cuda-toolkit-8-0 : Depends: cuda-nvml-dev-8-0 (>= 8.0.61) but 8.0.34-1 is installed
                    Depends: cuda-driver-dev-8-0 (>= 8.0.61) but 8.0.34-1 is installed
E: Unmet dependencies. Try using -f.

I'm not sure where the 8.0.34 came from, but now I can't install anything (and I mean anything!!!) and I can't remove Cuda?
Any suggestion?
Thanks,

A: First, you need to remove the old instalation of CUDA:
sudo rm -r /usr/local/cuda*

Then, go to the NVIDIA website and download the .run file.
Install it with:
sh cuda_8.0.27_linux.run --override

You should probably get the CudNN files aswell, if you're planning to do some deep learning:
If this is the case, as optional step, you can install CudNN by going in the extracted folder and do:
sudo cp lib64/* /usr/local/cuda/lib64/
sudo cp include/* /usr/local/cuda/include/

Next, set Environment path variables in .bashrc:
export PATH=/usr/local/cuda-8.0/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64:$LD_LIBRARY_PATH


text:
Q: Distributed querying in Virtuoso I'd like to test how good Virtuoso is to process distributed querying.
For example, I have a large RDF graph (more than 100GB) and I want to use clusters to query this graph.
Can Virtuoso split the graph on small graphs for using them on clusters or should I split the graph and congregate query results manually? In other words, is it possible to use Virtuoso for distributed querying? If it is possible, where can I find a guide for this?
Thank in advance.

A: Someone asked an ominously similar question on the OpenLink Support forums a few days ago are you the same person ?
What is the reason for wanting to split this large RDF graph (more than 100GB), how much does that equate to in terms of triples ?
There is a Virtuoso Clustered Edition available in commercial form only enabling multiple Virtuoso instances spread across multiple physical instances and/or machines to pool there resources for processing large volumes of data RDF or other ie SQL etc. That way you don't have to physically split graphs you simply  load the data into the clustered instance and it will be automatically partitioned for you and you query as if a single Virtuos instance, with  good locality which is the key to performance.
Virtuoso also supports the standard SPARQL-FED syntax for distributed query execution as detailed on the W3C web site, using the "service" clause to perform the remote execution and return the result via your local Virtuoso instance. Thus a sample query query executing a remote query against the DBpedia SPARQL endpoint from a local Virtuoso instance would be:

SELECT *
  WHERE
  {
    SERVICE http://dbpedia.org/sparql {
      SELECT *
      WHERE
      {
         ?s ?p ?o .
         FILTER (?s = http://dbpedia.org/resource/Nevis )
      } LIMIT 100
    }
  }

Thus the data could be split across multiple single server instance (open source or commercial or other with sparql-fed support) and queried, but you would have to split the graph yourself manually and the performance of SPARQL-FED generally it not very good as you loose locality and the internal optimisations of a "true" clustered server solution ...


text:
Q: Realm iOS Swift Terminating app due to uncaught exception 'RLMException', reason: 'Keychain returned unexpected status code: -25299' i This Happen in this part of the code
let credentials = SyncCredentials.usernamePassword(username: "Manoj", password: "123456")
SyncUser.logIn( with: credentials,
                server: Constants.AUTHURL,
                onCompletion: { [weak self] (user, err) in
    if let error = err {
        // Auth error: user already exists? Try logging in as that user.
        debugPrint("Login failed: \(error)");
        return;
    }
    guard let self = self else { return }
    if self.checkUserAllReadyExists() {
        self.notificationRegister()
        return
    }
})

is the constant auth is the server instance URL
1. Realm version of the 5.0.1
2. Xcode 11.5
3. Real Device - iPhone XR 13.5
Note:- issue found only with the device


text:
Q: Angularjs - does ng-switch have a content loaded event? I have a ng-switch with different contents, one of them is a Gallery and I have to set the JQuery event to all images after switch ng-switch-when=gallery content is ready, but not lucky because it's firing the event before the content is loaded.
the gallery is the third ng-switch-when so I can't set the events with a ng-init.
So,  does ng-switch have a content loaded event or directive?
GALERÍA

Controller
$scope.loadLibraryGallery = function(){
//I have to set this event to childrens after ng-switch-when=gallery is loaded
        $('.popup-gallery').magnificPopup();

    };

Any idea. Please
Thank you.

A: You may also use function data-ng-init, it initialize specified data before switching.
It looks like:
<ANY ng-switch="expression">
    <ANY ng-switch-when="matchValue1" data-ng-init="loadLibraryGallery()">...</ANY>
    <ANY ng-switch-when="matchValue2">...</ANY>
    <ANY ng-switch-default>...</ANY>
</ANY>

Official documentation
https://docs.angularjs.org/api/ng/directive/ngInit

A: You can view the ngSwitch directive's source on github
It never calls any $broadcast nor $emit functions so no, it doesn't have such event.
You could try creating your own directive, which is really simple. This directive is going to be linked after the html code has been inserted.
Let's say this is your code:
html:
<ANY ng-switch="expression">
    <ANY ng-switch-when="matchValue1" data-gallery>...</ANY>
    <ANY ng-switch-when="matchValue2">...</ANY>
    <ANY ng-switch-default>...</ANY>
</ANY>

js:
angular.module('app').directive('gallery', function(){
     return function ($scope, $element, attrs) {
         $element.find('.popup-gallery').magnificPopup();
     }
});

Remember, that you should never modify DOM or call code that modifies DOM from the controller. This is directives job.


text:
Q: About homogeneous dimensions of a Lie group I am looking for a clear and simplified definition of the homogeneous dimension of a vector space or a Lie group. If anyone has the patience to explain me clearly his definition and if possible an example, I would be very grateful.
Thank you in advance


text:
Q: Как вставить заголовок popup окна в скрытое поле Contact Form 7? Наверное, начну с того, что в программировании я понимаю чуть-чуть больше, чем ничего, поэтому прошу отнестись с пониманием и по возможности отвечать попроще)
В общем, делаю сайт на Wordpress + Elementor + Elementor Addon Elements, в котором использую элемент EAE – Modal Popup, с помощью которого создаю много popup окон с уникальными заголовками, а внутри использую предварительно сохраненный шаблон блока Elementor, вместе с контактной формой Contact Form 7.
Грубо говоря, на странице есть много кнопок, по клику по которым открываются popup окна с различными заголовками, но одним и тем же содержимым (с одной и той же контактной формой).
Задача в том, чтобы при открытии popup окна его заголовок копировался в скрытое поле, например [dynamichidden dynamichidden-popupTitle id:hiddenFieldWithPopupTitle] Contact Form 7.
Методом проб и ошибок удалось написать код:
<script type="text/javascript">
function funonload(){
document.getElementById('hiddenFieldWithPopupTitle').innerText = document.querySelector("div > div.eae-modal-title.mfp-title").innerText;
}
window.onload = funonload;
</script>

Этот код я пытался вставлять как в шаблоне под контактной формой в элементе «простой HTML код», так и в самом редакторе Contact Form 7, но к сожалению, он вставляет оглавления только одного popup окна, которое открывается по первой кнопке на сайте и то только в поле типа textarea ([textarea your_message2 id:hiddenFieldWithPopupTitle]), а с полями типа dynamichidden не работает.
Собственно, сам вопрос: как сделать чтобы этот код работал корректно?
Открывается popup окно --> запускается скрипт, который копирует заголовок окна в поле типа dynamichidden или хотя бы в textarea (которое будет скрыто через CSS), и если пользователь откроет другое popup окно, чтобы скрипт повторился.
Пример selector-а заголовка:
#\39 6808861 > div > div.eae-modal-title.mfp-title
Питался гуглить в сторону «как переинициализировать js скрипт» но так ничего и не удалось сделать.
Буду рад любым подсказкам. Большое спасибо!
UPD:
Возможно, проблема в том, что все popup окна загружаются вместе со страницей и код исполняется только один раз еще до открытия popup окна пользователем.
Подскажите, что нужно найти и изменить в коде плагина, чтобы popup окна, загружались исключительно после нажатия кнопки, а не во время загрузки страницы, так как в настройках подобных параметров я не нашел.
Может кому пригодиться идея:
Как вариант можно попробовать использовать другой плагин для popup окон (например Popup Maker), в котором создать много окон с различными заголовками, которые будут открываться после клика по кнопках с определенными CSS классами, но в моем случаи это плохой вариант, так как страница будет регулярно обновляться и нужно, чтобы менеджера могли самостоятельно вписать нужный заголовок прямо во время редактирования страницы в Elementor.
UPD2:
Пытался использовать другие аддоны для Elementor в которых есть popup окна, но везде одна и та же проблема: в первом popup окне на странице заголовок копируется в Contact Form 7, а в остальных – нет.


text:
Q: Dereference Field Name in Java to Validate it In PHP, which is, of course, an interpreted language, I can dereference field names at runtime, e.g. 'source' and 'value' below, and use the values of those two fields pointed to by source and value.
{$key['source']}[LANGUAGE_NONE][0]['value'];

Is there a similar facility in Java to do so?  I have some properties of a bean that I need to validate and perform various checks against.  Rather than hardcoding the logic, I'd like to loop through a SQL table of fieldnames and perform the indicated validation on the field.  E.g. if I have the value "email" in the database, I would pick the property below and validate it based on the rules in the database column:
String email;

I will have many beans and many fields, which is why I was thinking of this approach.  I don't have a say in the design  :(
Another option I was thinking was using Spring validation, but there does not appear to be a way to trigger it until a Spring Form Bean is submitted.  Maybe there's an alternate way to trigger it?

A: I think you are saying that you wish to store the names of properties in a data store, and access that data store at runtime to query the properties. The construct you have described is closest to a Map in Java - a key/value pair, and there is nothing to stop you accessing data stored that way, e.g. myMap.get("myproperty");. The problem is modelling all your Objects as Maps isn't very OO.
Another option is to use reflection and convention. So a property in your database named 'source' would be accessed by a method called 'getSource()'. This is similar to JavaBeans
Is that what you meant?


text:
Q: Replacing numbers in numpy array with the ones in the list I have a 2D numpy array, and I'm looking to replace its contents with the numbers of a list by index.
Here's a code snippet to describe it more clearly:
import numpy as np
x = np.array([
              [2, 'something'],
              [2, 'more'],
              [6, 'and more'],
              [11, 'and so on'],
              [11, 'etc..']
             ])

y = [1, 2, 3]

I tried to do it by the following code, got an error and couldn't figure why is it occurring.
k = x[:, 0]
z = [2, 6, 11]
j = 0
for i in range(z[0], z[-1] + 1):
    k = np.where(i in k, y[j])
    j+=1

Error while running the above code:
Traceback (most recent call last):

  File "<ipython-input-10-c48814c42718>", line 4, in <module>
    k = np.where(i in k, y[j])

ValueError: either both or neither of x and y should be given

Output array I want to have:
# The output array which I intend to get
output = [
          [1, 'something'],
          [1, 'more'],
          [2, 'and more'],
          [3, 'and so on'],
          [3, 'etc..']
         ]

A: If I understand correctly, this is one way you can do that:
import numpy as np

x = np.array([
              [2, 'something'],
              [2, 'more'],
              [6, 'and more'],
              [11, 'and so on'],
              [11, 'etc..']
             ])
y = np.array([1, 2, 3])
# Find places where value changes, do cumsum and add a 0 at the beginning, then index y
x[:, 0] = y[np.r_[0, np.cumsum(np.diff(x[:, 0].astype(np.int32)) != 0)]]
# [['1' 'something']
#  ['1' 'more']
#  ['2' 'and more']
#  ['3' 'and so on']
#  ['3' 'etc..']]

Note here the result is strings because that is the type of the input array (NumPy will coerce to string unless dtype=object is specified). In any case, if you want to have mixed-type arrays, you should consider using a structured array.

A: numpy.unique + return_inverse=True
You can create a mapping from differing elements in your column, and use basic numpy indexing to map those values to your input list.

y = np.array([1, 2, 3])

_, inv = np.unique(x[:, 0], return_inverse=True)

x[:, 0] = y[inv]

array([['1', 'something'],
       ['1', 'more'],
       ['2', 'and more'],
       ['3', 'and so on'],
       ['3', 'etc..']], dtype='<U11')

The one caveat to this answer is that if another 2 appears later in the array, it will replace it with 1, not with a new value, but you will need to clarify your question if that is an issue.
Based on the size of your replacement list, this seems to be the desired behavior.

A: You can do this by getting unique values, ordering them in a brute force manner, and using a for loop to map. You would need to make sure your mapping list (y) is also ordered least to greatest.
ind = list(x[i][0] for i in range(len(x)))

lookup = set()
ind = [x for x in ind if x not in lookup and lookup.add(x) is None]

for i in range(len(x)):
           c = ind.index(x[i][0])
           x[i][0] = y[c]

print(x)

Output:
array([['1', 'something'],
       ['1', 'more'],
       ['2', 'and more'],
       ['3', 'and so on'],
       ['3', 'etc..']], dtype='<U11')

A: If you want to continue using a for loop like you currently have and make use of the y list you could do something like this:
import numpy as np

x = np.array([[2, 'something'], [2, 'more'], [6, 'and more'],
              [11, 'and so on'], [11, 'etc..']])
y = [1, 2, 3]

y_index = 0
for i in range(0, x.shape[0] - 1):
  if x[i+1][0] != x[i][0]:
    x[i][0] = y[y_index]
    y_index += 1
  else:
    x[i][0] = y[y_index]
x[-1][0] = y[y_index] # Set last index

print(x)

Output:
[['1' 'something']
 ['1' 'more']
 ['2' 'and more']
 ['3' 'and so on']
 ['3' 'etc..']]


text:
Q: Examples of applications of the Borel-Weil-Bott theorem? In "Quantum field theory and the Jones polynomial" (Comm. Math. Phys. 1989 vol. 121 (3) pp. 351-399), Witten writes:

A representation Ri of a group G should be seen as a quantum object.  This representation should be obtained by quantizing a classical theory.  The Borel-Weil-Bott theorem gives a canonical way to exhibit for every representation R of a compact group G a problem in classical physics, with G symmetry, such that the quantization of this classical problem gives back R as the quantum Hilbert space.  One introduces the "flag manifold" G/T, with T being a maximal torus in G, and for each representation R one introduces a symplectic structure ωR on G/T, such that the quantization of the classical phase space G/T, with the symplectic structure ωR, gives back the representation R.  Many aspects of representation theory find natural explanations by thus regarding representations of groups as quantum objects that are obtained by quantization of classical physics. [page 372; emphasis added]

I'm fascinated by this idea — I haven't seen it before, but it seems natural, in that classical objects should not be linear, whereas quantum objects should be.  I'm most interested in the last sentence: what examples can y'all come up with of representation-theoretic facts that can be "explained" by "physics" on G/T?  (Besides, of course, Witten's application in the paper I quoted from.)
More generally, I've read the Wikipedia discussion of the Borel-Weil-Bott theorem, and done some random googling, but I haven't found an elementary description of the symplectic structure Witten refers to.  Anyone want to pedantically spell out Witten's comment, please?

A: The most concrete example of this is just SU(2)/S^1 = S^2. Depending on which point in su(2)* this S^1 is stabilising, the S^2 has various different volumes. When that volume is an integer k, there's an associated line bundle O(k), sections of which are the k+1 dimensional representation of SU(2).

A: I'll just elaborate for you the example mentioned by Scott:
In the stereographic projection coordinates of S2, the symplectic 2-form is given by:
ω = dz^dz̄/(1+zz̄)2
Classically, one can construct three hamiltonian functions representing the generators of the Lie algebra su(2) which constitute of a subalgebra of the Poisson algebra corresponding to ω
TX = (z+z̄)/(1+zz̄)
TY = -i(z-z̄)/(1+zz̄)
TZ = (1-zz̄)/(1+zz̄)
Quantum mechanically, the representation of spin j of SU(2) is realized on a (reproducing kernel) Hilbert space generated by holomorphic sections of a line bundle whose expressions in the stereographic coordinates are 1, z, . . . , z2j. The su(2) Lie algebra can be realized on this space by means of the differential operators:
sX = -(1-z2)∂/∂z + 2jz
sY = -i(1+z2)∂/∂z - 2ijz
sZ = -2z∂/∂z -2j
Theories of geometric quantization offer systematic methods to make these constructions for a general compact Lie group for a concrete realization of the Bore-Weil-Bott theorem.
I would like to mention that many representation theoretical computations can be made using this realization of the representation theory of compact Lie groups. Also, this realization is connected to Perelomov's generalized coherent states.
There are some generalizations to representations on non-compact Lie groups. Also, the Borel-Weil-Bott theorem can be connected in many ways to supersymmetry.
The "linearization' of the classical mechanics is achievd through the realization of the quantum Hilbert space by sections of a "line" bundle. These sections also relates this realization to projective geometry via Kodaira's embedding thorem.

A: For actual applications, there are some;  for example, the moment map image of G/B for the torus action is the convex hull of the weight diagram, and the weight multiplicities are approximated by the volume of fibers.
There's a similar business with tensor product multiplicities, where you look at the moment map image for G acting on the product of two coadjoint orbits.  This one way of thinking about convexity of the support of tensor product multiplicities.
Also, if you look at the dimensions of the representations $V_{n\lambda}$ for some fixed lambda, you get a polynomial of order the dimension of the corresponding coadjoint orbit, and leading term its symplectic volume.

A: McGovern applies Borel-Weil-Bott to obtain a branching rule from G=Spin(7,C) to H=G2.  The main point here is that there are parabolics P \subset G and Q \subset H such that G\P=H\Q.  Then, via Borel-Weil-Bott, he reduces the branching problem to one between the Levi factors of these parabolics.  The same idea applies to branching from SL(2n,C) to Sp(2n,C).  The relevant paper is "McGovern, William M. A branching law for Spin(7,C)→G2 and its applications to unipotent representations. J. Algebra 130 (1990), no. 1, 166--175."

A: A belated response, but appropriate nevertheless, I think: the locus classicus for this general theme about the deep connection between quantum particles and representation theory is given by E Wigner, "On unitary representations of the inhomogeneous Lorentz group," Annals of Mathematics 40 (1): 149–204. Wigner is the one who gave us Wigner's classification -- viz., the classification of most nonnegative energy irreducible unitary representations of the Poincare group. Since Wigner, it has become quite standard simply to define elementary particles as these irreducible representations.

A: Look at the orbits of G on g* the dual of the Lie algebra. These 'coadjoint orbits' have a canonical symplectic structure. Each of these orbits intersects the positive Weyl chamber exactly once; consider those intersecting it at a 'positive weight'  (i.e. the the elements of g* that lift to characters on T, the maximal torus). The positive weights exactly classify the irreducible representations. At the same time, we can build a line bundle over the corresponding coadjoint orbit so that the symplectic form realises the Chern class. Sections of this bundle are automatically a representation of G, and the Borel-Weil-Bott theorem, in one of its friendlier guises, says that this is the representation you expect -- the one with the highest weight we started with.
Generically, a coadjoint orbit is just G/T. When it isn't, it's a deeper quotient, but you can pull back the canonical symplectic structure to G/T, and still do everything there. This is the symplectic structure ωR Witten is referring to.


text:
Q: File not renaming itself after uploading successfully to FTP (via easy-ftp npm package) What is working
I am using the easy-ftp npm package with express-fileuploadto upload files onto an FTP server using node.js and react.js. The files are always uploaded successfully onto my local ftp into the path /test.
What's the issue
The issue is, that when files are saved in a temp directory before being uploaded onto the ftp server, they get renamed to the temp file name.
So a file called:
test.pdf

is renamed to:
tmp-1-1656368064718

on upload.
I have tried using the ftp.mv function according to the documentation everywhere within the app.post("/upload") route function. It simply just won't change the name. I don't understand what I am doing wrong.
I have been at it for days now, I really hope someone out there has an idea.
I am very grateful!
app.use(
  fileUpload({
    useTempFiles: true,
    tempFileDir: "/tmp/",
    preserveExtension: true,
  })
);

app.post("/upload", (req, res) => {
  console.log(req.files);
  if (req.files === null) {
    return res.status(400).json({ msg: "No file was uploaded" }); //error message if no file was uploaded
  }

  const file = req.files.file;
  const tempFileName = file.tempFilePath.split("/").at(-1);

  ftp.upload(file.tempFilePath, "/test", function (err) {
    if (err) {
      console.log(err);
      return res.status(500).send(err);
    } else {
      console.log("finished:", res);
      res.json({ fileName: file.name, filePath: `/test/${file.name}` });
    }
    ftp.mv(`/test/${tempFileName}`, "abc.pdf", function (error, newPath) {
     console.log(error);
     console.log(newPath);
    });
    ftp.close();
  });
});

const PORT = process.env.PORT || 5000;
app.listen(PORT, () => console.log(`server started on port ${PORT}`));


text:
Q: Traffic Management recommendations What's your strategy towards traffic prioritization/management.
I am not really to just get a list of packet shaping solutions. Instead, I would like to get recommendations about traffic management strategies that include:

*

*What software/hardware products you use, or have used

*How this solution is/was implemented

*Why would you recommend (or not) this solution/strategy

Here are some solutions I've heard of, but haven't had much (if at all) experience with them:

*

*Linux Advanced Routing Traffic Contro (http://lartc.org/)

*Packeteer (http://www.bluecoat.com/products/packetshaper/specifications)

*NetEqualizer (http://www.netequalizer.com/nda.htm)

*Network Composer (http://www.cymphonix.com/Products.html)

*NetEnforcer (http://www.allot.com/index.php?option=com_content&task=view&id=45&Itemid=88888966)

Some notes:

*

*I'm debating myself whether or not to include pricing information

*This is assuming you have the NEED for traffic management

A: I like using squid with the delay pools option as a really simple starting point.  The weakness of this solution is that it will only help with types of traffic that can be forced through the proxy.
To set it up you just put squid on your edge device configure as needed.  The configure the clients for protocols that cannot be transparently intercepted.

A: There's a wonderful HowTo for Linux on advanced routing and traffic control. It includes a very nice section on bandwidth management by classifying traffic.

A: Netequalizer has put together a page that lists what users have been saying on independent blogs, forums and listservs. So, it's a good way to get some feedback from people who are actually using it -- http://netequalizernews.com/about-the-netequalizer/what-netequalizer-users-are-saying/

A: I have done quite a bit of work with Packeteer devices. They are the defacto corporate standard product for managing bandwidth I think.
They are hardware devices that sit inline, you can then limit traffic by machine or by application. You can setup both priorities and hard limits.
So for example, you can setup your WAN link to put email as a low priority, using say 256k only. You could setup RDP traffic to be top priority and have as much nadwidth as you think it would need. In fact you can set a limit for a protocol over all and per connection in that protocol.
Packetter devices are pretty simple to get right, but there is a lot of advanced features to play with. I'd recommend them. Of course they are not cheap... sorry.


text:
Q: How to create or filter an object array with defined key and value from an object array in typescript How can I get or filter an object array from an old or input object array with only defined keys and values. that is a little bit abstract. I can show an example:
the old object array looks like this:
[{
  op:AND
  id:0
  level: 0
  predicates: [{
    op: EQ
    field: abc,
    id:1.1
    level: 1
  }, {
    op "OR"
    id:1.2
    level: 1
    predicates: [{
      op: NEQ
      id:2.1
      level: 2
      field: 12312
    },
    {
      op: AND
      id: 2.2
      level:2
      predicates: [
        {
          op: EQ
          field: abc,
          id:3.1
          level: 3
        }
      ]
    }]
  }]
}]

what I want is:
[{
  op:AND

  predicates: [{
    op: EQ
    field: abc,

  }, {
    op "OR"

    predicates: [{
      op: NEQ

      field: 12312
    },
    {
      op: AND

      predicates: [
        {
          op: EQ
          field: abc,

        }
      ]
    }]
  }]
}]

compared with the old (input) object array, we can see that all key and value wiht "id" and "level" are filtered
Why do I need this?
because the old (input) object is a dynamic object array, it is not alway the same structure as the example. so that is also difficult to write a recursion method.
so I wannt to need a better solution in typescript

A: Hey question is not clear by below statement

it is not alway the same structure as the example. so that is also
  difficult to write a recursion method.

what's your exact use case? and what you are trying to achieve here?
if you just want to utilize your collection of data than, you can convert it to Modal class using library like class-transformer, and than you can iterate threw collection of your class as per your requirement.
 import { plainToClass } from 'class-transformer';
 const data = plainToClass(Person, parsedData as Object[]); // parsed data is json or API response and Person is your Modal class

than you can perform any sets of list, filter and display operation on collection of modal class, where you can ignore unwanted property based on your use case.


text:
Q: SQL Statement using Between I am attempting to write a query to get ename as "Employee Name" with the first letter capitalized and deptno as "Department No", limiting to employees whose second character of their name is between A and M.
This is the query I have so far which isn't working:
select initcap(ename) "Employee Name", deptno "Department No"
from emp
where ename between '_A%' and '_M%';

Result: no rows selected.

A: I'm not an Oracle admin, so I'm not very familiar with its BETWEEN conditionals, but in general SQL BETWEEN is used for single values such as integers.
For example BETWEEN 1 AND 100 will match an integer value of 50, but not 150.
I suspect that your query is doing the same thing, looking for string values that are in the sequence between the two strings you provided.
The strings you provided seem to be the type used with LIKE, and I would not expect them to work here.
I would instead use a regular expression to match for a range of values like this. The REGEXP_LIKE condition will allow you to do that:
WHERE REGEXP_LIKE(ename, '^.[a-m]', 'i')

This is a fairly simple regular expression, matching only from the beginning of the string (^), allowing any character in the first position (.), followed by a character in the range ([a-m]). The 'i' parameter makes the expression case-insensitive.


text:
Q: Can't capture Label_Mouse event in Winform C# I have 2 Label; I want to capture Label to change Text of this Label.
You can see this gif to imagine easy.

This gif image creates 2 Label, but I only change the text of first Label. Can't change the text of second Label.
I think the problem is SelectedControl can't detect control is selected.
My code in all event MouseDown, MouseMove,....
private void control_MouseDown(object sender, MouseEventArgs e)
{
    if (e.Button == MouseButtons.Left)
    {
        panel2.Invalidate(); //unselect other control
        SelectedControl = (Control) sender;
        Control control = (Control) sender;
        mouseX = -e.X;
        mouseY = -e.Y;
        control.Invalidate();
        DrawControlBorder(sender);
        propertyGrid1.SelectedObject = SelectedControl;
        control.TextChanged += new System.EventHandler(this.txtIDImg_TextChanged);
    }
}

This will create new Label when click button to add new Label (btnAddCharacter).
private Label SelectedLabel;
List<Label> activeLabels = new List<Label>();
public bool btnAddCharacterClick = false;
public List<String> lstLabelName = new List<string>();
public void btnAddCharacter_Click(object sender, EventArgs e)
{
    txtIDImg.Focus();
    SelectedLabel = new Label();
    Random rnd = new Random();
    int randNumber = rnd.Next(1, 1000);
    String LableName = "Lbl_" + activeLabels.Count();
    panel2.Invalidate(); //unselect other control
    SelectedControl = SelectedLabel;
    SelectedLabel.Invalidate();
    DrawControlBorder(SelectedLabel);
    SelectedLabel.Name = LableName;
    SelectedLabel.AutoSize = true;
    SelectedLabel.Text = txtIDImg.Text;
    SelectedLabel.BackColor = Color.Transparent;
    SelectedLabel.MouseEnter += new EventHandler(control_MouseEnter);
    SelectedLabel.MouseLeave += new EventHandler(control_MouseLeave);
    SelectedLabel.MouseDown += new MouseEventHandler(control_MouseDown);
    SelectedLabel.MouseMove += new MouseEventHandler(control_MouseMove);
    SelectedLabel.MouseUp += new MouseEventHandler(control_MouseUp);
    panel2.Controls.Add(SelectedLabel);
    activeLabels.Add(SelectedLabel);
    lstLabelName.Add(SelectedLabel.ToString());
    btnSave.Enabled = true;
    btnDelete.Enabled = true;
    btnDeleteAll.Enabled = true;
    btnAddCharacterClick = true;
    txtIDImg.Text = "";
}

Point postPoint;
private void control_MouseMove(object sender, MouseEventArgs e)
{
    if (e.Button == MouseButtons.Left)
    {
        postPoint = new Point();
        Control control = (Control) sender;
        Point nextPosition = new Point();
        nextPosition = panel2.PointToClient(MousePosition);
        nextPosition.Offset(mouseX, mouseY);
        control.Location = nextPosition;
        postPoint = nextPosition;
        Invalidate();
    }
}

private void DrawControlBorder(object sender)
{
    Control control = (Control) sender;
    Rectangle Border = new Rectangle(
        new Point(control.Location.X - DRAG_HANDLE_SIZE/2,
            control.Location.Y - DRAG_HANDLE_SIZE/2),
        new Size(control.Size.Width + DRAG_HANDLE_SIZE,
            control.Size.Height + DRAG_HANDLE_SIZE));
    Rectangle NW = new Rectangle(
        new Point(control.Location.X - DRAG_HANDLE_SIZE,
            control.Location.Y - DRAG_HANDLE_SIZE),
        new Size(DRAG_HANDLE_SIZE, DRAG_HANDLE_SIZE));
    Rectangle N = new Rectangle(
        new Point(control.Location.X + control.Width/2 - DRAG_HANDLE_SIZE/2,
            control.Location.Y - DRAG_HANDLE_SIZE),
        new Size(DRAG_HANDLE_SIZE, DRAG_HANDLE_SIZE));
    Rectangle NE = new Rectangle(
        new Point(control.Location.X + control.Width,
            control.Location.Y - DRAG_HANDLE_SIZE),
        new Size(DRAG_HANDLE_SIZE, DRAG_HANDLE_SIZE));
    Rectangle W = new Rectangle(
        new Point(control.Location.X - DRAG_HANDLE_SIZE,
            control.Location.Y + control.Height/2 - DRAG_HANDLE_SIZE/2),
        new Size(DRAG_HANDLE_SIZE, DRAG_HANDLE_SIZE));
    Rectangle E = new Rectangle(
        new Point(control.Location.X + control.Width,
            control.Location.Y + control.Height/2 - DRAG_HANDLE_SIZE/2),
        new Size(DRAG_HANDLE_SIZE, DRAG_HANDLE_SIZE));
    Rectangle SW = new Rectangle(
        new Point(control.Location.X - DRAG_HANDLE_SIZE,
            control.Location.Y + control.Height),
        new Size(DRAG_HANDLE_SIZE, DRAG_HANDLE_SIZE));
    Rectangle S = new Rectangle(
        new Point(control.Location.X + control.Width/2 - DRAG_HANDLE_SIZE/2,
            control.Location.Y + control.Height),
        new Size(DRAG_HANDLE_SIZE, DRAG_HANDLE_SIZE));
    Rectangle SE = new Rectangle(
        new Point(control.Location.X + control.Width,
            control.Location.Y + control.Height),
        new Size(DRAG_HANDLE_SIZE, DRAG_HANDLE_SIZE));

    Graphics g = panel2.CreateGraphics();
    ControlPaint.DrawBorder(g, Border, Color.Gray, ButtonBorderStyle.Dotted);
    ControlPaint.DrawGrabHandle(g, NW, true, true);
    ControlPaint.DrawGrabHandle(g, N, true, true);
    ControlPaint.DrawGrabHandle(g, NE, true, true);
    ControlPaint.DrawGrabHandle(g, W, true, true);
    ControlPaint.DrawGrabHandle(g, E, true, true);
    ControlPaint.DrawGrabHandle(g, SW, true, true);
    ControlPaint.DrawGrabHandle(g, S, true, true);
    ControlPaint.DrawGrabHandle(g, SE, true, true);
    g.Dispose();
}

And here is TextBox_TextChanged event:
private void txtIDImg_TextChanged(object sender, EventArgs e)
{
    if (SelectedLabel == null) return;
    SelectedLabel.Text = txtIDImg.Text;
}

A: In Your control_MouseDown You are changing the SelectedControl and maybe the propertyGrid1.SelectedObject properties, but in the txtIDImg_TextChanged You set the SelectedLabel.Text. SelectedLabel is not set in the control_MouseDown.


text:
Q: Deactivating 'animations' in phpmyadmin 4.x? I've just upgraded to phpmyadmin 4.x (coming from 3.x). Starting with this version phpmyadmin becomes really slow in UI related things (I use Firefox on linux).
As I want to have a quick and usable admin tool and no award winning UI, I just want to disable all the neat ui things like automated scrolling and such. Is there a way to just have a clean and fast ui with 4.x like I had in 3.x without downgrading?
Btw: I already using the 'original' theme.
Thanks and regards
Martin

A: If you are talking about the sliders, try this:
cfg['InitialSlidersState'] = 'disabled';
About the rest, please give more details about what you want to disable.
Also, the latest stable version is 4.0.5, with 4.0.6 being released soon.


text:
Q: timed events to loop forever I have this code which is executed on page load:
<script type="text/javascript">
function timedEvent1()
{
  setTimeout("ShowObjectWithEffect('wb_TextArt2', 1, 'dropup', 500)",0);
  setTimeout("ShowObjectWithEffect('wb_TextArt2', 0, 'dropdown', 500)",3000);
  setTimeout("ShowObjectWithEffect('wb_TextArt3', 1, 'dropup', 500)",3000);
  setTimeout("ShowObjectWithEffect('wb_TextArt3', 0, 'dropdown', 500)",6000);
  setTimeout("ShowObjectWithEffect('wb_TextArt4', 1, 'dropup', 500)",6000);
  setTimeout("ShowObjectWithEffect('wb_TextArt4', 0, 'dropdown', 500)",9000);
  setTimeout("ShowObjectWithEffect('wb_TextArt5', 1, 'dropup', 500)",9000);
  setTimeout("ShowObjectWithEffect('wb_TextArt5', 0, 'dropdown', 500)",12000);
  setTimeout("ShowObjectWithEffect('wb_TextArt6', 1, 'dropup', 500)",12000);
  setTimeout("ShowObjectWithEffect('wb_TextArt6', 0, 'dropdown', 500)",15000);
}
</script>

How can I loop this set of events forever? I read about the "setInterval" function but I cannot seem to implement it correctly in the above code.
Thanks.

A: Put whatever it is you would like to do in a function, and then call the function with setInterval:
$(document).ready (
    timing = setInterval ( yourFunction , 900 ) ;
) ;

Oh, and to use that jquery function make sure you're loading jquery in your document
<script src="http://code.jquery.com/jquery-latest.js"></script>

A: Have you tried this?
function timedEvent1() {
    setTimeout("ShowObjectWithEffect('wb_TextArt2', 1, 'dropup', 500)", 0);
    setTimeout("ShowObjectWithEffect('wb_TextArt2', 0, 'dropdown', 500)", 3000);
    setTimeout("ShowObjectWithEffect('wb_TextArt3', 1, 'dropup', 500)", 3000);
    setTimeout("ShowObjectWithEffect('wb_TextArt3', 0, 'dropdown', 500)", 6000);
    setTimeout("ShowObjectWithEffect('wb_TextArt4', 1, 'dropup', 500)", 6000);
    setTimeout("ShowObjectWithEffect('wb_TextArt4', 0, 'dropdown', 500)", 9000);
    setTimeout("ShowObjectWithEffect('wb_TextArt5', 1, 'dropup', 500)", 9000);
    setTimeout("ShowObjectWithEffect('wb_TextArt5', 0, 'dropdown', 500)", 12000);
    setTimeout("ShowObjectWithEffect('wb_TextArt6', 1, 'dropup', 500)", 12000);
    setTimeout("ShowObjectWithEffect('wb_TextArt6', 0, 'dropdown', 500)", 15000);
    setTimeout(timedEvent1, 18000);
}

A: Under the assumption that the third argument to the 'ShowObjectWithEffect' function is animation time in milliseconds, you could call timeEvent1 every 15500 seconds.
setInterval(function(){ timedEvent1(); }, 15500);


text:
Q: Visualizing recursion for binary tree Write a recursive function that displays all the binary (base 2) numbers represented by a string of xs, 0s, and 1s. The xs represent digits that can be either 0 or 1.
For example, the string xx represents the numbers 00,01,10,11.
The code works, but I just have a hard time visualizing the intermediate steps. Could someone help me walkthrough?
void get_first_x(char *line,char *line2,char *line3);
void display(char *line);
int main(int argc, const char * argv[]) {

    char line[256];
    printf("Binary number: ");
    scanf("%s",line);
    display(line);
    return 0;
}

void display(char *line){

    char line2[80];
    char line3[80];

    if(strchr(line,'x') == NULL)
    {
        printf("%s\n",line);
        return;
    }

   get_first_x(line,line2,line3);

    display(line2);

    display(line3);

  }

   void get_first_x(char* line,char* line2,char *line3) {

    char* check;

    check = strchr(line,'x');
    *check = '0';

    strcpy(line2,line);

    *check = '1';
    strcpy(line3,line);

}//replacement of x with 0 and 1. One argument produces 2 strings

Here's my take

1st call     display(xx)
2nd call       display(0x)
3rd call          display(00) { print statement/ return}
                     display(1x)
                        display(01) { print statement/return}
                          display(10) { print statement/return}
                           recursion exits
 Input: xx
 output: 00,01,10,11
 I'm not understanding something...here

A: What you implemented is this (in pseudo code):
display(line) {
  if no_x_in(line) {
     print(line)  // instance output and recursion stop
  }
  display(replace_first_x_with_0(line))  // recursive call
  display(replace_first_x_with_1(line))  // recursive call
}

*

*If the string in line contains no x symbols anymore you can output the string and your recursive descent can stop.

*If not, the problem instance is reduced from a line with n times many x symbols into two smaller instances, each with n - 1 many x symbols,

*

*one with the x replaced by a 0 symbol and

*one with the x replaced by a 1 symbol.

which result into a recursive call each. As there are only finite many x symbols in the finite input string, the recursive calls will stop at some point, and the resulting call tree is finite as well.
For your example the call tree is like this:
display('xx') -> issues calls to display('0x') and display('1x')
|
+-> display('0x') -> issues calls to display('00') and display('01')
|   |
|   +-> display('00') -> output, stop
|   +-> display('01') -> output, stop
|
+-> display('1x') -> issues calls to display('10') and display('11')
    |
    +-> display('10') -> output, stop
    +-> display('11') -> output, stop


text:
Q: Google Compute Engine not acceping password set I am using google compute engine to create a VM instance. When I login using SSH or gcloud, it asks me to set a password. When I try to login using that password, it says authentication not successful and terminates. I have looked all around the internet but couldn't find the solution. I have tried this numerous times now but still the same result. Is anyone else facing this problem? Does anyone has a solution for this?
I am using Ubuntu 14.04 LTS instance.

A: ssh login to you instance through google cloud console
sudo nano /etc/ssh/sshd_config

there is a configuration called
PasswordAuthentication no

change to
PasswordAuthentication yes

restarat ssh service


text:
Q: Backbone subview events I have a site developed with backbone. I have create an app and inside it I create some subview.
In this subview I can have a div (with id close) and if I click on it I have to trigger an event. But the event doesn't fire I don't know why. Can you explain me what I'm wrong with the event?
The problem is in Search.Views.Product, the subview with an event.
This is my app (I have cut something to read well the app):
//main app
Search.Views.App = Backbone.View.extend({
    initialize:function () {
        var this_app = this;
        this.subView = {
            Product : new Search.Views.Product({
                base_url:this_app.base_url || '',
                collection : new Search.Collections.Products()
            })
        }
    },
    render:function (options) {
        var defaults = {
            products:{
                wrap:"ul",
                id:"product-results",
                class:""
            }
        }
        var settings = $.extend(true, defaults, options);
        this.renderProducts(settings);
    },
    renderProducts:function (settings) {
             $(this.id).html(this.wrap(this.subView.Product.getTemplate(settings.products.view), settings.products));
    }
});

//collection
Search.Collections.Products = Backbone.Collection.extend({
    model: Search.Models.Product,
    initialize:function () {

    }
});

Search.Models.Product = Backbone.Model.extend({
    defaults: search.product.defaults || {},
    initialize:function () {

    }
});

Search.Views.Product = Backbone.View.extend({
    //doesn't fire this event!!!--------------------------------------
    events: {
        'click #close':  'closeResults',
         'click':  'closeResults'
    },
    closeResults:function (event) {
        console.log('Close results');
        $('#close').html('test');
    },

    getTemplate:function (view) {
        var data = this.collection.toJSON() || this.model.toJSON();

        data = this.normalize(data);
        var template = Handlebars.compile($(this.template).html());
        return template({view:view, results:data});
    },
    render:function () {
        // non utilizzato per ora
        return this;
    }
});

A: Try passing the parent view element into the subview. Change this
        Product : new Search.Views.Product({
            base_url:this_app.base_url || '',
            collection : new Search.Collections.Products()
        })

to
        Product : new Search.Views.Product({
            el: this.$('.some-selector'),
            base_url:this_app.base_url || '',
            collection : new Search.Collections.Products()
        })

And in your subview replace the html of this.$el with the contents of the rendered template.

A: Issue #1
ID's need to be unique.
Use a class instead. Change #close to .close in your markup and event bindings.
Issue #2
You are not setting the views $el in your render.  A Backbone view delegates all of its internal selector work to it's own el.
From Backbones source
$: function(selector) {
  return this.$el.find(selector);
},

You need to call render and it needs to set the el for event bindings to work.
 this.$el.html(...);


text:
Q: what's the poetry equivalent of pip install 'python-lsp-server[all]'? In the page about the python lsp server there are examples about how to install it in an env based on pip; like
pip install 'python-lsp-server[all]'

or
pip install 'python-lsp-server[yapf]'

How do I get the same with Poetry ?

A: Use --extras argument:
poetry install python-lsp-server --extras "yapf", "flake8"

As an alternative use -E argument:
poetry install python-lsp-server -E yapf -E flake8

Source


text:
Q: express-socket.io-session session variables are not available I am using express-socket.io-session module https://github.com/oskosk/express-socket.io-session
I can see the session data on socket.handshake
{
  headers: {
    host: 'xxxxxxx:8000',
    connection: 'Upgrade',
    pragma: 'no-cache',
    'cache-control': 'no-cache',
    upgrade: 'websocket',
    origin: 'http://localhost:8000',
    'sec-websocket-version': '13',
    'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTM L, like Gecko) Chrome/43.0.2357.65 Safari/537.36',
    'accept-encoding': 'gzip, deflate, sdch',
    'accept-language': 'en-US,en;q=0.8,hi;q=0.6,id;q=0.4,ms;q=0.2'
  },
  time: 'Thu May 21 2015 17:06:25 GMT+0530 (India Standard Time)',
  address: '::ffff:xxxxxxx',
  secret: undefined,
  cookies: {

  },
  signedCookies: {

  },
  sessionStore: {
    sessions: {
      'KK--EcvwVZieofM9NwG_Asee9VKPW8fn': '{"cookie":{"originalMaxAge ":null,"expires":null,"httpOnly":true,"path":"/"},"_csrfSecret":"2Tr7DSbOEeXVOw= =","localeCountry":"US","experimentation":{"version":"1.0","treatments":[],"guid ":"764290c314d0a397ab134c29fe9bfc15"},"experimentationTimeStamp":1432208183650}'
    },
    generate: [
      Function
    ],
    _events: {
      disconnect: [
        Function
      ],
      connect: [
        Function
      ]
    }
  },
  sessionID: '6ZS-AMnOsha0FT_ALGrNp_-dp2Ji90yY',
  session: {
    cookie: {
      path: '/',
      _expires: null,
      originalMaxAge: null,
      httpOnly: true
    }
  }
}

The socket.handshake.session doesn't have the session data.  I am unclear on how to extract the session data from socket.handshake.sessionStore

A: As far as the session data is concerned, its JSON represented as a string. You can iterate over the keys in the root object and parse each key's value.
var keys = Object.keys(socket.handshake.sessionStore.sessions);
keys.forEach(function(key) {

    // extract string into a json object
    var sessionObject = JSON.parse(socket.handshake.sessionStore.sessions[key]);

});


text:
Q: Arch Linux on laptop - No audio from speakers, headphones work fine I recently clean reinstalled Arch Linux on my laptop, and I am not getting any output from the laptop speakers. I am able to use earphones and Bluetooth headphones just fine. I have dual-booted Arch with Windows and my speakers work on Windows. My speakers used to work on my previous Arch installation.
I am using pulseaudio as a sound server. I do have pulseaudio-alsa installed.
Here is the output from pacmd list-cards:
2 card(s) available.
    index: 0
    name: <alsa_card.pci-0000_01_00.1>
    driver: <module-alsa-card.c>
    owner module: 6
    properties:
        alsa.card = "1"
        alsa.card_name = "HDA NVidia"
        alsa.long_card_name = "HDA NVidia at 0x84080000 irq 17"
        alsa.driver_name = "snd_hda_intel"
        device.bus_path = "pci-0000:01:00.1"
        sysfs.path = "/devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card1"
        device.bus = "pci"
        device.vendor.id = "10de"
        device.vendor.name = "NVIDIA Corporation"
        device.product.id = "0fb9"
        device.product.name = "GP107GL High Definition Audio Controller"
        device.string = "1"
        device.description = "GP107GL High Definition Audio Controller"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card-pci"
    profiles:
        output:hdmi-stereo: Digital Stereo (HDMI) Output (priority 5900, available: no)
        output:hdmi-surround: Digital Surround 5.1 (HDMI) Output (priority 800, available: no)
        output:hdmi-surround71: Digital Surround 7.1 (HDMI) Output (priority 800, available: no)
        output:hdmi-stereo-extra1: Digital Stereo (HDMI 2) Output (priority 5700, available: no)
        output:hdmi-surround-extra1: Digital Surround 5.1 (HDMI 2) Output (priority 600, available: no)
        output:hdmi-surround71-extra1: Digital Surround 7.1 (HDMI 2) Output (priority 600, available: no)
        output:hdmi-stereo-extra2: Digital Stereo (HDMI 3) Output (priority 5700, available: no)
        output:hdmi-surround-extra2: Digital Surround 5.1 (HDMI 3) Output (priority 600, available: no)
        output:hdmi-surround71-extra2: Digital Surround 7.1 (HDMI 3) Output (priority 600, available: no)
        output:hdmi-stereo-extra3: Digital Stereo (HDMI 4) Output (priority 5700, available: no)
        output:hdmi-surround-extra3: Digital Surround 5.1 (HDMI 4) Output (priority 600, available: no)
        output:hdmi-surround71-extra3: Digital Surround 7.1 (HDMI 4) Output (priority 600, available: no)
        off: Off (priority 0, available: unknown)
    active profile: <off>
    ports:
        hdmi-output-0: HDMI / DisplayPort (priority 5900, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "video-display"
        hdmi-output-1: HDMI / DisplayPort 2 (priority 5800, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "video-display"
        hdmi-output-2: HDMI / DisplayPort 3 (priority 5700, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "video-display"
        hdmi-output-3: HDMI / DisplayPort 4 (priority 5600, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "video-display"
    index: 1
    name: <alsa_card.pci-0000_00_1f.3>
    driver: <module-alsa-card.c>
    owner module: 7
    properties:
        alsa.card = "0"
        alsa.card_name = "HDA Intel PCH"
        alsa.long_card_name = "HDA Intel PCH at 0x84618000 irq 142"
        alsa.driver_name = "snd_hda_intel"
        device.bus_path = "pci-0000:00:1f.3"
        sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"
        device.bus = "pci"
        device.vendor.id = "8086"
        device.vendor.name = "Intel Corporation"
        device.product.id = "a348"
        device.product.name = "Cannon Lake PCH cAVS"
        device.form_factor = "internal"
        device.string = "0"
        device.description = "Built-in Audio"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card-pci"
    profiles:
        input:analog-stereo: Analog Stereo Input (priority 32833, available: unknown)
        output:analog-stereo: Analog Stereo Output (priority 39268, available: unknown)
        output:analog-stereo+input:analog-stereo: Analog Stereo Duplex (priority 39333, available: unknown)
        output:hdmi-stereo: Digital Stereo (HDMI) Output (priority 5900, available: no)
        output:hdmi-stereo+input:analog-stereo: Digital Stereo (HDMI) Output + Analog Stereo Input (priority 5965, available: unknown)
        output:hdmi-surround: Digital Surround 5.1 (HDMI) Output (priority 800, available: no)
        output:hdmi-surround+input:analog-stereo: Digital Surround 5.1 (HDMI) Output + Analog Stereo Input (priority 865, available: unknown)
        output:hdmi-surround71: Digital Surround 7.1 (HDMI) Output (priority 800, available: no)
        output:hdmi-surround71+input:analog-stereo: Digital Surround 7.1 (HDMI) Output + Analog Stereo Input (priority 865, available: unknown)
        output:hdmi-stereo-extra1: Digital Stereo (HDMI 2) Output (priority 5700, available: no)
        output:hdmi-stereo-extra1+input:analog-stereo: Digital Stereo (HDMI 2) Output + Analog Stereo Input (priority 5765, available: unknown)
        output:hdmi-surround-extra1: Digital Surround 5.1 (HDMI 2) Output (priority 600, available: no)
        output:hdmi-surround-extra1+input:analog-stereo: Digital Surround 5.1 (HDMI 2) Output + Analog Stereo Input (priority 665, available: unknown)
        output:hdmi-surround71-extra1: Digital Surround 7.1 (HDMI 2) Output (priority 600, available: no)
        output:hdmi-surround71-extra1+input:analog-stereo: Digital Surround 7.1 (HDMI 2) Output + Analog Stereo Input (priority 665, available: unknown)
        output:hdmi-stereo-extra2: Digital Stereo (HDMI 3) Output (priority 5700, available: no)
        output:hdmi-stereo-extra2+input:analog-stereo: Digital Stereo (HDMI 3) Output + Analog Stereo Input (priority 5765, available: unknown)
        output:hdmi-surround-extra2: Digital Surround 5.1 (HDMI 3) Output (priority 600, available: no)
        output:hdmi-surround-extra2+input:analog-stereo: Digital Surround 5.1 (HDMI 3) Output + Analog Stereo Input (priority 665, available: unknown)
        output:hdmi-surround71-extra2: Digital Surround 7.1 (HDMI 3) Output (priority 600, available: no)
        output:hdmi-surround71-extra2+input:analog-stereo: Digital Surround 7.1 (HDMI 3) Output + Analog Stereo Input (priority 665, available: unknown)
        output:hdmi-stereo-extra3: Digital Stereo (HDMI 4) Output (priority 5700, available: no)
        output:hdmi-stereo-extra3+input:analog-stereo: Digital Stereo (HDMI 4) Output + Analog Stereo Input (priority 5765, available: unknown)
        output:hdmi-surround-extra3: Digital Surround 5.1 (HDMI 4) Output (priority 600, available: no)
        output:hdmi-surround-extra3+input:analog-stereo: Digital Surround 5.1 (HDMI 4) Output + Analog Stereo Input (priority 665, available: unknown)
        output:hdmi-surround71-extra3: Digital Surround 7.1 (HDMI 4) Output (priority 600, available: no)
        output:hdmi-surround71-extra3+input:analog-stereo: Digital Surround 7.1 (HDMI 4) Output + Analog Stereo Input (priority 665, available: unknown)
        output:hdmi-stereo-extra4: Digital Stereo (HDMI 5) Output (priority 5700, available: no)
        output:hdmi-stereo-extra4+input:analog-stereo: Digital Stereo (HDMI 5) Output + Analog Stereo Input (priority 5765, available: unknown)
        output:hdmi-surround-extra4: Digital Surround 5.1 (HDMI 5) Output (priority 600, available: no)
        output:hdmi-surround-extra4+input:analog-stereo: Digital Surround 5.1 (HDMI 5) Output + Analog Stereo Input (priority 665, available: unknown)
        output:hdmi-surround71-extra4: Digital Surround 7.1 (HDMI 5) Output (priority 600, available: no)
        output:hdmi-surround71-extra4+input:analog-stereo: Digital Surround 7.1 (HDMI 5) Output + Analog Stereo Input (priority 665, available: unknown)
        off: Off (priority 0, available: unknown)
    active profile: <output:analog-stereo+input:analog-stereo>
    sinks:
        alsa_output.pci-0000_00_1f.3.analog-stereo/#0: Built-in Audio Analog Stereo
    sources:
        alsa_output.pci-0000_00_1f.3.analog-stereo.monitor/#0: Monitor of Built-in Audio Analog Stereo
        alsa_input.pci-0000_00_1f.3.analog-stereo/#1: Built-in Audio Analog Stereo
    ports:
        analog-input-internal-mic: Internal Microphone (priority 8900, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "audio-input-microphone"
        analog-input-mic: Microphone (priority 8700, latency offset 0 usec, available: yes)
            properties:
                device.icon_name = "audio-input-microphone"
        analog-output-speaker: Speakers (priority 10000, latency offset 0 usec, available: unknown)
            properties:
                device.icon_name = "audio-speakers"
        analog-output-headphones: Headphones (priority 9900, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "audio-headphones"
        hdmi-output-0: HDMI / DisplayPort (priority 5900, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "video-display"
        hdmi-output-1: HDMI / DisplayPort 2 (priority 5800, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "video-display"
        hdmi-output-2: HDMI / DisplayPort 3 (priority 5700, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "video-display"
        hdmi-output-3: HDMI / DisplayPort 4 (priority 5600, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "video-display"
        hdmi-output-4: HDMI / DisplayPort 5 (priority 5500, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "video-display"

Here is the output from pacmd list-sinks:
1 sink(s) available.
  * index: 0
    name: <alsa_output.pci-0000_00_1f.3.analog-stereo>
    driver: <module-alsa-card.c>
    flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
    state: RUNNING
    suspend cause: (none)
    priority: 9039
    volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
            balance 0.00
    base volume: 65536 / 100% / 0.00 dB
    volume steps: 65537
    muted: no
    current latency: 23.73 ms
    max request: 4 KiB
    max rewind: 4 KiB
    monitor source: 0
    sample spec: s16le 2ch 44100Hz
    channel map: front-left,front-right
                 Stereo
    used by: 1
    linked by: 3
    configured latency: 23.22 ms; range is 0.50 .. 2000.00 ms
    card: 1 <alsa_card.pci-0000_00_1f.3>
    module: 7
    properties:
        alsa.resolution_bits = "16"
        device.api = "alsa"
        device.class = "sound"
        alsa.class = "generic"
        alsa.subclass = "generic-mix"
        alsa.name = "ALC295 Analog"
        alsa.id = "ALC295 Analog"
        alsa.subdevice = "0"
        alsa.subdevice_name = "subdevice #0"
        alsa.device = "0"
        alsa.card = "0"
        alsa.card_name = "HDA Intel PCH"
        alsa.long_card_name = "HDA Intel PCH at 0x84618000 irq 142"
        alsa.driver_name = "snd_hda_intel"
        device.bus_path = "pci-0000:00:1f.3"
        sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"
        device.bus = "pci"
        device.vendor.id = "8086"
        device.vendor.name = "Intel Corporation"
        device.product.id = "a348"
        device.product.name = "Cannon Lake PCH cAVS"
        device.form_factor = "internal"
        device.string = "front:0"
        device.buffering.buffer_size = "352800"
        device.buffering.fragment_size = "176400"
        device.access_mode = "mmap+timer"
        device.profile.name = "analog-stereo"
        device.profile.description = "Analog Stereo"
        device.description = "Built-in Audio Analog Stereo"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card-pci"
    ports:
        analog-output-speaker: Speakers (priority 10000, latency offset 0 usec, available: unknown)
            properties:
                device.icon_name = "audio-speakers"
        analog-output-headphones: Headphones (priority 9900, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "audio-headphones"
    active port: <analog-output-speaker>

I have the audio channel unmuted

Upon selecting, HDA Intel PCH device, this is the output:

In pavucontrol, I have the output port selected as speakers and it is unmuted. I am getting the audio detection but still no sound from speakers.

Any help would be greatly appreciated.

A: i know this is maybe fixed but for everyone else in the same situation.
I had the same issue, exactly same and i just fix it :)
sudo dmesg | grep audio

If some messages like sof-firmware error or download sof-firmware, go
sudo pacman -S sof-firmware

Reboot system, and pray to fix (Normaly yes it works for me)
Why this issue happens ? :
Kernel doesn't hook correctly sound cards that's why 'lspci' show sound card up & why cat 'proc/aplay/cards' show 'no soundcards' because Kernel can't hook soundcards because of missing some firmware.
Hope it will helps somebuddies ;P


text:
Q: Xaomi killing foreground service I want to take the location of the users. I did the foreground service and works on every phone. But xaomi phones, if the application is not in the background is turning off the foreground service. I tried everything I turned on the auto launcher. I've allowed everything to be allowed through the settings, but it won't. I've been trying for a month, please help.

A: I recommend you using alarms.
You can use services to continue executing code in background and wakelocks but I had the same problem you described with several specific smartphones and also found out that services can be killed at any moment if the android system requires free memory.
The solution I found was to use alarms (an alarm that executes the foreground service). If you schedule alarms this alarms will go off whether your app is still executing or not. That way the app can get the device position even though the system had killed the service due to lack of resources. It's the only solution I found that worked in this scenario.
The idea came to me in some google i/o when they said that if you really need your app to continue no matter what you should use alarms instead of services.
Use exact amarms as inexact ones sometimes take, at least, 5 minutes in some devices until the alarm goes off.
This worked for me but I did it 2-3 years ago. I hope it still works.


text:
Q: Sharepoint 2013 Navigation show pages is greyed out I have encountered the following problem in Sharepoint 2013: when I go to Site Settings -> Look And Feel -> Navigation the Show pages option below Structural Navigation: Display the navigation items below the current site is greyed out and cannot be selected.
I have enabled the SharePoint Server Publishing Infrastructure feature and I am working with the top-level site.
I tried to check Sow pages from within a subsite but it's also greyed out.
Can you help me solve the problem?
Thank you in advance.
LATER EDIT
I've also enabled Sharepoint Server Publishing from Site Settings->Site Actions->Manage site features and now it's working


text:
Q: JCheckBox List error? I'm coding an enigma machine in java, and when the program launches, I have a JOptionPane appear with 5 JCheckBoxes for the user to select which rotors to use, and in which order.
My problem is, they get added to the popup, but they aren't actually displayed.
Instead I get a massive readout of all 5 checkboxes as if I called their toString method.
I have a few JLabels on the popup that display correctly, along with the OK button at the bottom.
My list is initialized like so:
private final List<JCheckBox> rotorCheckBox = Arrays.asList(new JCheckBox(
        "Rotor 1"), new JCheckBox("Rotor 2"), new JCheckBox("Rotor 3"),
        new JCheckBox("Rotor 4"), new JCheckBox("Rotor 5"));

I'm not sure why it does this, it worked as an array before, and I've been trying to convert it so I don't have to constantly call Arrays.asList() on it.
I've checked every use of it in my code, nothing is being called toString or creating errors relating to it being in a list.
How can I make it display correctly?

A: You're adding the List to the JOptionPane, you should add the JCheckBox's to a JPanel and use that instead
So, instead of something like...
JOptionPane.showMessageDialog(null, rotorCheckBox);

You should use something more like...
JPanel panel = new JPanel();
for (JCheckBox cb : rotorCheckBox) {
    panel.add(cb);
}
JOptionPane.showMessageDialog(null, panel);

as an example


text:
Q: Form submit by ajax after javascript validation is done It is possible to call a ajax after form validation is done.I have a form that validation with javascript onsubmit. I want to form submit when javascript validation is done before not allowed to submit the form.
Here is my form
<form method="post" id="register-form" class="sky-form" onsubmit="return register_validate()">

Create your Account

      <fieldset>

              <input type="text" name="fname" id="fname" placeholder="First Name">

           Please Enter First Name.

              <input type="text" name="lname" id="lname" placeholder="Last Name">

            Please Enter Last Name.

              <input type="email" name="user_email" id="user_email" placeholder="Email">

             Please Enter Email.

              <input type="text" name="user_phone" id="user_phone" placeholder="Phone">

            Please Enter Phone No.

            Type:
              <input type="radio" name="package_type" id="package_type" value="2" checked> Individual
              <input type="radio" name="package_type" id="package_type" value="3"> Company

            <input type="hidden" name="package_id" id="package_id" value="1">

        <input type="checkbox" name="checkbox-inline" >Agree with Terms & Conditions

      </fieldset>

       <input  type="submit" name="register" class="login loginmodal-submit navigator_button" value="Register" data-navigate_to="code_form" data-navigate_from="code">

                Already have account? login here

    </form>

Here is my javascript code


text:
Q: How to fetch matching values from a dictionary object in Typescript? I have a dictionary object which is populated as follows:
const myDictionaryElement = this.myDictionary["abc"];

Here, myDictionaryElement has the values:
ACheckStatus: "PASS"
QVVStatus: "READY"
VVQStatus: "READY"
QTTStatus: "READY"
QBCTTStatus: "READY"
CStatus: "FAIL"

I want to create a object such that all key-value pairs for which the key has matching VV in the middle should be stored in object valuesVV as following:
const valuesVV = { QVVStatus: "READY" };

Similary all key-value pairs for which the key has matching TT in the middle should be stored in object valuesTT as following:
const valuesTT = { QTTStatus: "READY", QBCTTStatus: "READY" } ;

And all key-value pairs for which the key doesn't have matching VV and TT in the middle should be stored in object valuesOther as following:
const valuesOther = { ACheckStatus: "PASS", VVQStatus: "READY", CStatus: "FAIL"  } ;

To achieve the about output, I am using hasOwnProperty for dictionary but it is not working
const valuesVV = myDictionaryElement.hasOwnProperty('*VV*');  // It is returning boolean false. The desired output is { QVVStatus: "READY" }

A: You should filter the object keys and select only the ones you need, then use reduce to create a new object:
 const vvItems = Object.keys(dictElement)
  .filter(key => key.indexOf('VV')>= 1)
  .reduce((o, key) => { o[key] = dictElement[key]; return o; }, {})

A: You can generalize it by creating a function that takes the dict and a matches array like the following:
const dict = {
  ACheckStatus: "PASS",
  QVVStatus: "READY",
  VVQStatus: "READY",
  QTTStatus: "READY",
  QBCTTStatus: "READY",
  CStatus: "FAIL"
};

const matching = ['VV', 'TT', 'SS'];

function matchInput(input, matches) {
  // will have matched object in the index of the match and those without a match
  // at the end
  const res = [];

  Object.keys(input).forEach(key => {
    // flag if the key wasn't matched to add it to no matches object
    let matched = false;

    matches.forEach((match, i) => {
      if (key.indexOf(match) > 0) {
        matched = true;
        if (!res[i]) res[i] = {};
        res[i][key] = input[key];
      }
    });

    if (!matched) {
      if (!res[matches.length]) res[matches.length] = {};
      res[matches.length][key] = input[key];
    }
  });

  return res;
}

The idea is to go over each key and insert it in the right bucket (object)


text:
Q: Joining a table based on @@servername How do I use a conditional statement (or any other solution) to determine whether to reference a database that might or might not exist?
I've created a multi-server query that correctly returns data from the same database on two different servers. However, Server2 includes a secondary database that doesn't exist on Server1. I need to return a value from that database as well, if it exists.
The following Case statement works as a column for Server1 because the referenced database exists on that server. When run against Server2, I would have expected the 2nd When clause to not even be evaluated, but  I receive an "Invalid Object Name" error referencing the non-existent database.
CASE
   WHEN @@SERVERNAME = 'Server2'
      THEN 'N/A'
   WHEN @@SERVERNAME = 'Server1'
      THEN (SELECT Column1 FROM databasename.Table1
            WHERE Column1 = a.column1)
END AS 'AliasName'

Note to Self: It seems that a when clause is evaluated even though it fails the logical test portion.
[In case it isn't apparent, the a.column1 reference points to the main (outer) query]
Does anyone have a creative solution to this obstacle?

A: Here's the answer to my own question, based on the feedback I got:

*

*SQL is a compiled language. I knew that, but didn't think of its implications. All objects in a query must actually exist, even though that part of the query might not actually run.

*Best solution is to create a view or stored procedure on each server specific to that database. They should return the same number of columns. For example: If Server 1 returns data that does not exist on Server 2, the SP from Server 2 should include a blank or null column for the data. Then call each from a multi-server connection to return and join the information from each database.


text:
Q: how to replace & to and in php I want to replace special characters like &,%,$ to string.
I have a string s1= Trinidad & Tobago, i want to replace '&' to 'and'
eg: s1 = Trinidad & Tobago should get replaced to s1= Trinidad and Tobago.

A: echo str_replace( "&", "and", 'Trinidad & Tobago');
//"Triniad and Tobago"

A: Use str_replace:
$s1 = str_replace('&', 'and', $s1);

If you need to replace multiple characters, str_replace accepts an array as input (both for search and replace):
$s1 = str_replace(array('&', '%', '$'), array('and', 'percent', 'dollar'), $s1);


text:
Q: How nginx lost installed module? Some days ago i had installed nginx with rtmp module.
When i did nginx -V i got:
nginx version: nginx/1.10.3
built with OpenSSL 1.1.0f  25 May 2017
TLS SNI support enabled
configure arguments: <alot of text> --add-module=/home/administrator/nginx/nginx-rtmp-module-master

And after i add rtmp block in nginx.conf i got no errors.
Today i tried to continue my work. Restart serveice and got en error:
unknown derective "rtmp" in /etc/nginx/nginx.conf:6

I check modules nginx -V and not found rtmp module i mean this string:
--add-module=/home/administrator/nginx/nginx-rtmp-module-master

Whats heppens? How module can dissapiered?


text:
Q: QListView horizontal scrollbars not showing I noticed that after populating a QListView's sourceModel with data, the horizontal scrollbars do not appear? How do i fix this?
Even if i set them to always show, they do not correctly expanded when content exceeds the width of the widget.
I'm guessing the issues is because I'm setting the size hint to the icon size. The reason i do this is so i can control the size of the icon.

import os, sys
import tempfile
from PySide import QtGui, QtCore

class MyModel(QtCore.QAbstractTableModel):

    def __init__(self, *args, **kwargs):
        QtCore.QAbstractTableModel.__init__(self, *args, **kwargs)
        self._items = []
        self._iconSize = QtCore.QSize(18, 18)

    def rowCount(self, index=QtCore.QModelIndex()):
        return len(self._items)

    def columnCount(self, index=QtCore.QModelIndex()):
        return 1

    def addItem(self, obj):
        self.beginInsertRows(QtCore.QModelIndex(), self.rowCount(), self.rowCount())
        self._items.append(obj)
        self.endInsertRows()

    def data(self, index, role=QtCore.Qt.DisplayRole):
        if not index.isValid():
            return None
        if 0 <= index.row() < self.rowCount():
            item = self._items[index.row()]
            if role == QtCore.Qt.DisplayRole:
                return item
            elif role == QtCore.Qt.SizeHintRole:
                return self._iconSize

class MainWindow(QtGui.QMainWindow):
    def __init__(self, parent=None,):
        super(MainWindow, self).__init__(parent)
        self.resize(300, 300)

        # controls
        model = QtGui.QSortFilterProxyModel()
        model.setSortCaseSensitivity(QtCore.Qt.CaseInsensitive)
        model.setSourceModel(MyModel())

        self.ui_list = QtGui.QListView()
        self.ui_list.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
        self.ui_list.setModel(model)
        self.ui_list.setWordWrap(False)
        self._populate_model()

        # layout
        self.setCentralWidget(self.ui_list)

    def _populate_model(self):
        root = tempfile.gettempdir()
        for f in os.listdir(root):
            self.ui_list.model().sourceModel().addItem(os.path.join(root,f))

def main():
    app = QtGui.QApplication(sys.argv)
    ex = MainWindow()
    ex.show()
    sys.exit(app.exec_())

if __name__ == '__main__':
    main()

A: By default we use the textElideMode property enabled in the QAbstractItemView(QListView), in order to solve this we can establish a delegate and overwrite the sizeHint() method, to calculate the width we use QFontMetrics:
class Delegate(QtGui.QStyledItemDelegate):
    def sizeHint(self, option, index):
        h = QtGui.QStyledItemDelegate.sizeHint(self, option, index).height()
        text = index.data()
        fm = QtGui.QFontMetrics(option.font)
        w = fm.width(text)
        return QtCore.QSize(w, h)

Then the delegate is established:
    self.ui_list = QtGui.QListView()
    self.ui_list.setItemDelegate(Delegate(self))


text:
Q: Uninstalling user install of Apache on Mac Mini I got a MacMini at work for development, and was asked to follow this article to install SVN on it: http://developer.apple.com/tools/subversionxcode.html  The article assumes that only Apache 1.3 was installed and asks the reader to install Apache 2.  I've since learned that the MacMini has Apache 2 already installed.  So basically I've installed two versions of Apache 2.  The preinstalled one has access to PHP, so I wanted to remove my version, but I'm unsure of how.
My version has httpd.conf stored at:
/usr/local/apache2/conf/httpd.conf
And the preinstalled version has it stored at:
/etc/apache2/httpd.conf, which I believe is an alias for /private/etc/apache2/httpd.conf
Thanks for your help

A: Delete the Apache2 folder from the location you specified, /Library/StartupItems/Apache2, and /Library/Receipts/Apache2.pkg according to:
http://www.glinder.com/bulkfiles/UNIXInfo/Apache2_Install_Guide.pdf


text:
Q: What does OpenSSL use OPENSSLDIR for? I'm using a library that uses OpenSSL, which I haven't used before.
When building OpenSSL 1.1.0, you can supply the configure script with the absolute path the OpenSSL folder. (The default for a 32-bit Windows build is C:\Program Files (x86)\Common Files\SSL.)
This absolute folder name then ends up in the libcrypto library. (There seem to be two main uses of this: some stuff in the X509 code, and in the "engines" system.)
My code is itself a library, to be provided as a DLL for use by 3rd party software, so the idea of having absolute paths baked into it seems a bit unappealing.
But I downloaded some guy's binary build of OpenSSL and that had references to D:\opensource\openssl-dist-1.1.0b-vs2015\openssl-x64-shared-debug-vs2015\lib\engines-1_1... even though I doubt many computers have that folder.
So should I just be ignoring this?
Should I be doing something to stop OpenSSL accessing these paths at runtime?
Should I be configuring them at runtime somehow?
(I imagine something similar with apply to OS X. For Linux I will probably just have my library link with the system version of OpenSSL.)


text:
Q: java.lang.NoClassDefFoundError POI Workbook when i try to launch JAR file im getting this exception, I've changed poi version about 4 times to try different versions but still JAR doesn't want to launch.
It's a test program because in other I couldn't launch JAR and I don't want to break anything in there.
I'm using JDK 17 and also tested it with JDK 13.
App:
package com;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

public class Main {

    public static void main(String[] args) {

        int x = 7;
        System.out.println(x);

        XSSFWorkbook workbook = new XSSFWorkbook();

    }

}

pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.JAR</groupId>
    <artifactId>probaJar</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
    </properties>

    <dependencies>

        <!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.17</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.17</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml-schemas -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml-schemas</artifactId>
            <version>3.17</version>
        </dependency>

    </dependencies>

    <build>
    <plugins>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>3.3.0</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                    <configuration>
                        <archive>
                            <manifest>
                                <mainClass>
                                    com.Main
                                </mainClass>
                            </manifest>
                        </archive>
                        <descriptorRefs>
                            <descriptorRef>jar-with-dependencies</descriptorRef>
                        </descriptorRefs>
                    </configuration>
                </execution>
            </executions>
        </plugin>

        <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.4</version>
        <configuration>
            <archive>
                <!-- Configures the content of the created manifest -->
                <manifest>
                    <!-- Adds the classpath to the created manifest -->
                    <addClasspath>true</addClasspath>
                    <!-- Specifies that all dependencies of our application are found -->
                    <!-- Configures the main class of the application -->
                    <mainClass>com.Main</mainClass>
                </manifest>
            </archive>
        </configuration>
        </plugin>

    </plugins>

    </build>

</project>

A: Reason why error like this occurs on stack overfrow
Maybe you're trying to launch wrong jar file.
There are two jar files created after compilation and packaging (full names omitted):

*

**.jar

**-jar-with-dependencies.jar

You must launch second one, because first one does not contain needed dependency classes.


text:
Q: What is the location argument of GCP workload identity pools According to the documentation:
an example of creating an identity pool would be

gcloud iam workload-identity-pools create my-workload-identity-pool --location="global" --display-name="My workload pool" --description="My workload pool description" --disabled

What does the location global mean? What is the purpose of this argument? It is apparently not a location like us-central1 but a logical location.
Which values are available? I don't find any good documentation on this so i am asking.

A: The gcloud iam workload-identity-pools create command you mentioned ultimately calls the API method projects.locations.workloadIdentityPools.create which states that the only supported location is global. This makes sense since workload-identity-pools is a feature of the IAM (Identity and Access Management) service, which is a global product replicated across regions.
Now as per why this argument is required in the gcloud command while it isn't even asked in the corresponding Cloud Console form, this seems to be a design decision but in any case the only option is indeed global.