text:
Q: Set the height of a table in percentage from remaining page height I have a web page which I have designed already. In this the header part is taking up 161px in height. The remaining space I've got is calc(100vh - 161px). In this space I have two tables. I want to also have a scrollbar for this table. For that I need to set the height for this tbody and overflow-y: auto.
I want the height to be 30% for the first table and 70% to the second table so that it will work on all the devices which are more than 768px.
How can I set the height of this tables ?

A: I assume this is what you are asking for. Get remaining height and multiply it with the % you need.
.my-first-table {
    height: calc((100vh - 161px) * 0.3);
}
.my-second-table {
    height: calc((100vh - 161px) * 0.7);
}


text:
Q: Minicart and account nav block_html cache is not updating as needed I have full page cache disabled as I troubleshoot this issue.
My minicart and account nav lives within my header (header.phtml). As I add items to cart, log in, and log out the navigation and minicart remain cached -- the content does not update.
I've tried setting cache lifetime, manipulating the cache key, yet the block is always cached.
Here is my local.xml
    <reference name="header">

        <block type="page/switch" name="store_language" as="store_language" template="page/switch/languages.phtml"/>
        <block type="page/switch" name="store_switcher" as="store_switcher" template="page/switch/stores.phtml"/>
        <block type="core/template" template="page/html/accountmenu.phtml" name="account_menu"/>
        <block type="core/template" template="page/html/customergreeting.phtml" name="customer_greeting">
            <action method="setCacheLifetime"><s>0</s></action>
        </block>
        <block type="checkout/cart_minicart" name="minicart_head" template="checkout/cart/minicart.phtml" before="-">
            <block type="checkout/cart_sidebar" name="minicart_content" template="checkout/cart/minicart/items.phtml">
                <action method="addItemRender">
                    <type>default</type>
                    <block>checkout/cart_item_renderer</block>
                    <template>checkout/cart/minicart/default.phtml</template>
                </action>
                <action method="addItemRender">
                    <type>simple</type>
                    <block>checkout/cart_item_renderer</block>
                    <template>checkout/cart/minicart/default.phtml</template>
                </action>
                <action method="addItemRender">
                    <type>grouped</type>
                    <block>checkout/cart_item_renderer_grouped</block>
                    <template>checkout/cart/minicart/default.phtml</template>
                </action>
                <action method="addItemRender">
                    <type>configurable</type>
                    <block>checkout/cart_item_renderer_configurable</block>
                    <template>checkout/cart/minicart/default.phtml</template>
                </action>
                <block type="core/text_list" name="cart_sidebar.cart_promotion" as="cart_promotion" translate="label" module="checkout">
                    Mini-cart promotion block
                </block>
                <block type="core/text_list" name="cart_sidebar.extra_actions" as="extra_actions" translate="label" module="checkout">
                    Shopping Cart Sidebar Extra Actions
                </block>
            </block>
        </block>
        <block type="core/text_list" name="top.menu" as="topMenu" translate="label">
            Navigation Bar
            <block type="page/html_topmenu" name="catalog.topnav" template="page/html/topmenu.phtml">
                <block type="contentmanager/menu" name="main-menu" alias="americas.menu"/>
                <block type="contentmanager/menu" name="main-menu-fr_ca"  alias="americas.french.menu"/>
                <block type="page/html_topmenu_renderer" name="catalog.topnav.renderer" template="page/html/topmenu/renderer.phtml">
                    <block type="themecustom/menu_image" name="menu.image.container" as="image_container" template="page/html/topmenu/image.phtml"/>
                </block>
            </block>
        </block>
        <block type="searchresults/form_mini" name="mobile.search" as="topSearchMobile" template="catalogsearch/form.mobile.phtml"/>
    </reference>

redpajama_set_name: RedPajamaStackExchange


text:
Q: Lifting submerged straw above 10m Suppose a long rigid pipe (e.g., 30m) open at both ends is completely submerged into some deep body of water. The pipe gets completely filled with water. Then, one end gets closed and the pipe is slowly vertically lifted out of the water, with the closed end on top.
At some point, the open end stays submerged below but the pipe will start poking out beyond 10m in height above the water, which is the theoretical maximum height of such a water column at atmospheric pressure.
So, what happens as the pipe keeps getting lifted out? Does water start seeping out of the bottom of the tube, and thereby forming and extending a perfect vacuum at the closed end? There doesn't seem to be anything at the top to be taking the place of the water column escaping the pipe, so would actually happen?
Note: I'm ignoring vaporization and material constraints for the purposes of this question ; )

A: You will "pull a vacuum" which will fill with water vapor (at whatever the saturated vapor pressure is at the temperature of the water).
If you chose to ignore evaporation, you would consider the void above the water to be a perfect vacuum. But you would be wrong to make that assumption. Even at 0 C, liquid water has a saturated vapor pressure of 611 Pa. The column of water that can be supported will be a little bit less than "10 m" (if that is your column corresponding to the prevailing atmospheric pressure, local gravitational acceleration, and the density of the water). In fact 611 Pa will cause the column to be about 6 mm shorter than you expect. At 20 C the error would be about 23 mm.
Note - if you pull the pipe out suddenly, it may take a short while for the vapor to reach equilibrium. The column will "sag" over time.
Because the vapor pressure of mercury is lower, and the density higher, it makes a much better material for a barometer.

A: You have described a barometer with water instead of mercury as the working fluid.
Amongst the reasons that mercury is used rather than water is that it is denser and so the barometer tube is much shorter (less than one metre as compared to 10 metres) and the saturated vapour pressure of mercury (0.002 mmHg) at room temperature is much less than that of water (24 mmHg).
So the space above the water in your tube will be occupied by saturated vapour and as you lift the tube up water liquid will change to water vapour to maintain the vapour pressure at a constant value.
So you cannot ignore the vaporisation of water in the context of your question.


text:
Q: How to integrate unity application in a web application? I have a Unity application, where user can enter some parameters in text-boxes.
There is also an "export" button. When user clicks on it, based on the entered parameters, some calculations are made and a ".txt" file is generated and it's downloaded in the local computer (with "Save As" box).
I need to integrate this "Unity" project to be web-based. So I need to have a web-application and this same project to be accessible via in my web-application (not to be downloaded, instead to be directly integrated in the web-browser).
Considering that I do not have any experience with Unity, I was wondering, is this possible to be done? And if does, is it straight-forward process, or it's complicated to implement?
NOTE: The "Unity" software has an ability to export a file with "Save As..." dialog, but when integrating in the web, instead of saving us locally, I would want this ".txt" file in the very same time to saved on the server (where my web-app is hosted) as well. I guess that this will require some modifications in the "Unity" code, but my question is:
Does Unity has this support?


text:
Q: Учебник по CSS Подскажите, пожалуйста, учебник по CSS для новичков.
A: Вот вполне читабельный ресурс
A: Мне однажды была полезной тема на одном форуме FAQ по дизайну в CSS
сам css довольной простой и в основном его суть заключается в том что html вы создаете

MyDiv

а в css его позиционируете и разукрашиваете.
#mydiv
{
  style properties
}

А вот бог html и css это javascript)
A: Лучший учебник по CSS - "CSS - каскадные таблицы стилей" Эрика Мейера. В books.ru можно купить электронную версию за 250 руб.


text:
Q: Where [how ?] is the path for lib/Cake/Error/ErrorHandler.php defined? Downloading the proj. from online server & trying to run it in my localhost, but I am getting the path problems. I do not see where the path is defined, yet, I am getting the error :
[Mon Aug 22 14:12:10.681539 2016] [:error] [pid 1186] [client 127.0.0.1:47932] PHP Warning:  include(/home3/username/public_html/lib/Cake/Error/ErrorHandler.php): failed to open stream: No such file or directory in /var/www/proj/lib/Cake/Core/App.php on line 547

The online server had its path in /home3/username, but I have /var/www in my localhost.
I do not see where home3, or username is mentioned in my local ( doing ctrl+shift+f ).
I am using Cakephp v2.5.3
------ Update -----
Besides the path, I see Cakephp 2 will not work with php7, so installing php5 managed to get the project working.
https://askubuntu.com/questions/756879/cant-install-php5-on-ubuntu-16-04

A: Go to app/webroot and open index.php file, find  define function CAKE_CORE_INCLUDE_PATH, and change value to your path.
/**
 * The absolute path to the "cake" directory, WITHOUT a trailing DS.
 *
 * Un-comment this line to specify a fixed path to CakePHP.
 * This should point at the directory containing `Cake`.
 *
 * For ease of development CakePHP uses PHP's include_path. If you
 * cannot modify your include_path set this value.
 *
 * Leaving this constant undefined will result in it being defined in Cake/bootstrap.php
 *
 * The following line differs from its sibling
 * /app/webroot/index.php
 */
define('CAKE_CORE_INCLUDE_PATH', 'C:' . DS . 'xampp' . DS . 'htdocs' . DS . 'cakephp' . DS . 'lib');

A: If you have downloaded the project from the online server and running it on your localhost then, please Clear the files in app/tmp/ . After that it will be working fine.


text:
Q: How do you change the background color on the active state of a Bootstrap custom checkbox? Bootstrap 4 custom forms docs
If you inspect the custom checkbox and click the 'active' element state, you notice a blue background appears in the checkbox. This can also be reproduced by holding your mouse down inside of the custom checkbox without releasing.
I am trying to remove the blue background/shadow by using the :active selector but it is not applying the style.
Here is my code:
.custom-control-input:active {
  background-color: none !important;
  box-shadow: none !important
}

A: What you need to do is to open bootstrap CSS and find the exact classes you need to override. Here you have an example of custom colors.
NOTE: !important was only required here in this snippet, otherwise it wouldn't work on Stackoverflow. You don't need to use it in your project.

.custom-control-input:checked ~ .custom-control-label::before {
  color: #fff;
  border-color: red !important;
  background-color: red !important;
}

.custom-control-input:focus ~ .custom-control-label::before {
  box-shadow: 0 0 0 0.2rem rgba(255,0,0,.25) !important;
}

.custom-control-input:focus:not(:checked) ~ .custom-control-label::before {
  border-color: green !important;
}

.custom-control-input:not(:disabled):active ~ .custom-control-label::before {
  color: #fff;
  background-color: yellow !important;
  border-color: yellow !important;
}

.custom-control-input:disabled ~ .custom-control-label {
  color: blue !important;
}

.custom-control-input:disabled ~ .custom-control-label::before {
  background-color: pink !important;
}

.custom-checkbox .custom-control-input:indeterminate ~ .custom-control-label::before {
  border-color: red !important;
  background-color: red !important;
}

.custom-checkbox .custom-control-input:disabled:checked ~ .custom-control-label::before {
  background-color: rgba(0, 123, 255, 0.5) !important;
}

.custom-checkbox .custom-control-input:disabled:indeterminate ~ .custom-control-label::before {
  background-color: rgba(0, 123, 255, 0.5) !important;
}

.custom-control-input:focus:not(:checked) ~ .custom-control-label::before {
  border-color: red !important;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">

  <input type="checkbox" class="custom-control-input" id="customCheck1">
  Check this custom checkbox


text:
Q: How to select code from database I hava a database with this codes
indirect customer
                 Cust-code
    Nursing home NH000001
    Dentist      DN000001
    Other        OT000001
and direct customer
                 Cust-code
    Nursing home NH050001
    Dentist      DN050001
    Other        OT050001
Note after NH there 00 for indirect customer and 05 for direct customers
I need to write a query to get list of direct and indirect customer
SELECT * FROM bmwregistration ,corporation_data_entity,category_data_entity,ward_data_entity
                Where occu_corp_id='$corpo'
                AND occu_division = '$divi'
                AND bmwregistration.occu_corp_id = corporation_data_entity.corp_id

                AND bmwregistration.occu_ward = ward_data_entity.ward_id
                AND (cust_code LIKE '%BB00%'
                OR cust_code LIKE '%DP00%'
                OR cust_code LIKE '%NH00%'
                OR cust_code LIKE '%PL00%'
                OR cust_code LIKE '%DN00%'
                OR cust_code LIKE '%OT00%'
                OR cust_code LIKE '%PD00%'
                OR cust_code LIKE '%PN00%' )

When executing above query it shows one row 8 times for same cust-code. Can I use group by clause? What is wrong with query?
It select rows with same customer code in eight consecutive lines
cust-code
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
3( 8 times same row with cust_id 3)

A: try this with group by
   SELECT * FROM bmwregistration ,corporation_data_entity,category_data_entity,ward_data_entity
            Where occu_corp_id='$corpo'
            AND occu_division = '$divi'
            AND bmwregistration.occu_corp_id = corporation_data_entity.corp_id

            AND bmwregistration.occu_ward = ward_data_entity.ward_id
            AND (cust_code LIKE '%BB00%'
            OR cust_code LIKE '%DP00%'
            OR cust_code LIKE '%NH00%'
            OR cust_code LIKE '%PL00%'
            OR cust_code LIKE '%DN00%'
            OR cust_code LIKE '%OT00%'
            OR cust_code LIKE '%PD00%'
            OR cust_code LIKE '%PN00%' )
      GROUP BY  bmwregistration


text:
Q: How to Create JAPE Grammars Automatically? I am having great troubles with JAPE grammars.  I have a small token dictionary  for the words that needs to be matched with  5 types of  document.
One dictionary for  one type: For example Job, the dictionary of the person would contain  { "Engineer" , "Doctor", "Manager"}.  I need to read this dictionary a create JAPE rules for that.  This is my first try
Phase: Jobtitle
Input: Lookup
Options: control = appelt debug = true
Rule: Jobs
(
 {Lookup.majorType == "Doctor"}
 (
  {Lookup.majorType ==  "Engineer"}
 )?
)
:jobs
-->
 :jobs.JobTitle = {rule = "Jobs"}

Is there any way to  automatically create  JAPE rules that only for searching tokens in a dictionary to documents?

A: Why not to use a standard gazetteer where the last parameter in .def file could have a custom type like "Doctor" or "Engineer"?
Something like: keywords.lst:Doctor:Doctor::Doctor


text:
Q: Gradle does not copy test resources to build I have a multi project gradle project (spring web), with the following layout:
springweb
 |    build.gradle
 |    settings.gradle
 |_____ services
 |         build.gradle
 |         src/main/java
 |         src/main/resources
 |         src/test/java
 |         src/test/resources
 |             create-data.sql
 |_____ web
 |         build.gradle
 |         src/main/java
 |         src/main/resources
 |         src/main/webapp
 |         src/test/java
 |         src/test/resources

When I try to execute the contents under src/test/resources (init.sql)
commandLine 'psql', '-h', 'localhost', '-d', 'junit', '--username', 'junit', '-f' , sourceSets['test'].output.resourcesDir.toString() + '/create-data.sql'

it failse because the resource is not available in the build directory:
/Users/me/dev/springweb/services/build/resources/test/create-data.sql: No such file or directory

below my root build.gradle:
ext {
    springSecurityGroup = 'org.springframework.security'
    springSecurityVersion = '3.1.4.RELEASE'
    springGroup = 'org.springframework'
    springVersion = '3.2.5.RELEASE'
    hibernateGroup = 'org.hibernate'
    hibernateVersion = '4.2.7.SP1'
}

subprojects {
    apply plugin: 'java'
    apply plugin: 'eclipse'
    sourceSets.all{
        println output.classesDir
    }

    repositories {
        mavenCentral()
    }
}

and the 'services' build.gradle:
task createDb (type:Exec) {
     println sourceSets['test'].output.resourcesDir.toString()
     commandLine 'psql', '-h', 'localhost', '-d', 'junit', '--username', 'junit', '-f' ,'/Users/me/dev/sip/sip/sip04/src/main/resources/create-table.sql'
}
task fillDb (type:Exec, dependsOn: 'createDb') {
     commandLine 'psql', '-h', 'localhost', '-d', 'junit', '--username', 'junit', '-f' , sourceSets['test'].output.resourcesDir.toString() + '/create-data.sql'
}
test.dependsOn fillDb

dependencies {
    /* zipped */
}

/* Change context path (base url). otherwise defaults to name of project */

I execute it with gradle build:
gradle build
/Users/me/dev/springweb/services/build/classes/main
/Users/me/dev/springweb/services/build/classes/test
/Users/me/dev/springweb/web/build/classes/main
/Users/me/dev/springweb/web/build/classes/test
/Users/me/dev/springweb/services/build/resources/test
:services:compileJava UP-TO-DATE
:services:processResources UP-TO-DATE
:services:classes UP-TO-DATE
:services:jar UP-TO-DATE
:services:assemble UP-TO-DATE
:services:createDb
DROP TABLE
DROP SEQUENCE
zipped
:services:fillDb/Users/me/dev/springweb/services/build/resources/test/create-data.sql: No such file or directory

From the output I learn that the sourceSets are as I expect, but that the test resources are not copied. What is wrong?

A: Copying of test resources is done by the processTestResources task from the Java plugin. The Java plugin also specifies this as a prerequisite of the test task, so that it happens before the tests are run.
You have told gradle that your fillDb task is also a prerequisite of the test task BUT you have not told it that processTestResources is a prerequisite of your createDb task.
So you could do something like
task createDb (type:Exec, dependsOn: 'processTestResources') {
...

BTW test resources are things that are made available to the tests via the classpath. I assume your tests don't need actually your sql available on the classpath at runtime, so do they even need to be there?

A: Gradle uses processTestResources task from the java plugin to generate the test resources. By default the location of the test resources in Module/build/resources/test.
If you want to test just the testResources getting generated correctly or not
Run the following command:
./gradlew :<Module-name>:processTestResources

After running the command, check testReources directory. It should contain the correct files.
Another Suggestion
Try Segregating all the common logic in a gradle plugin and write a test for Gradle plugin. In that way, you can get confidence over the piece of code. If it works fine or not.
Eg:
TestPlugin.groovy
 project.sourceSets {
            test {
                resources {
                    srcDir project.files("${project.projectDir}/<location-of-resources>/")
                }
            }
        }

In this scenario, place your resources in some folder named  and tempFile is the resource for test.
And the Test for the same: TestPluginSpec.groovy
 @Rule
    TemporaryFolder testProjectDir = new TemporaryFolder()
    File tempFile
    tempFile = testProjectDir.newFile('tempFile')
    buildFile = testProjectDir.newFile('build.gradle')

    buildFile << """
             plugins {
                id 'java'
               }
   """
def "should add test Resources into build/resources/test"(){
        when:
        def result = GradleRunner.create().withProjectDir(testProjectDir.root).withPluginClasspath().withArguments('processTestResources').withDebug(true).build()
        then:
        result.task(":processTestResources").outcome == TaskOutcome.SUCCESS
        and:
        Files.exists(Paths.get("${testProjectDir.root.path}/build/resources/test/tempFile"))
    }


text:
Q: Neo4j Java 7 Terminal Issue I'm having issues starting my neo4j instance (2.0.0 M03). I have java 7 installed as indicated in the code block below but when trying to start neo4j it apparently does not recognize this, gives and error and does not start. The terminal output is below. Any ideas on how to fix this or what exactly is going wrong? Thanks a lot.
Tim-Bornys-MacBook-Pro:neo4j community 2.0.0 M03 BornyTM$ java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

Tim-Bornys-MacBook-Pro:neo4j community 2.0.0 M03 BornyTM$ bin/neo4j start
WARNING! You are using an unsupported version of the Java runtime. Please use Oracle(R)   Java(TM) Runtime Environment 7.
Starting Neo4j Server...WARNING: not changing user
process [88317]... waiting for server to be ready.... Failed to start within 120 seconds.
Neo4j Server may have failed to start, please check the logs.

A: The problem was JAVA_HOME was not set to the correct JVM. To determine where you have your instance installed you can enter the following into terminal:
/usr/libexec/java_home -v 1.7

This should return the location, in my case: /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/
To set JAVA_HOME just export pointing towards the location like below (enter into the console):
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/


text:
Q: Creating raster layer from numpy array using pyqgis? I am working on a plugin for Qgis to calculate spatial Kernel density maps. I have all the calculations working, all I am missing is a way to turn a Numpy Array, with density values into a multiband raster layer.
Do I have to create a geotiff on a temp file using Gdal and then load it?
Or is there a direct way to create the layer from data in memory?
if so, how to do it?

A: Here is the code that I use to convert an array to gdal raster saving it to the disk, "param" is a dicitionary containing gdal parameters (check the gdal documentation) and "array" is a numpy array. Than you can instantiate a QgsMapLayer with your file as source. You have to create the geotiff in the disk.
    from osgeo import gdal as osgdal  # Adapt the import to fit yor environement.

    driver = osgdal.GetDriverByName(param['out_format'])

    dataset = driver.Create(
            param['dst_filename'],
            param['x_pixels'],
            param['y_pixels'],
            1,
            osgdal.GDT_Float32,
            )

    dataset.SetGeoTransform((
            param['xmin'],           #0
            param['pixel_size'],     #1
            0,                       #2
            param['ymin'],           #3
            0,                       #4
            param['pixel_size']))    #5

    out_srs = osr.SpatialReference()
    out_srs.ImportFromEPSG(param['SRID'])

    dataset.SetProjection(out_srs.ExportToWkt())
    dataset.GetRasterBand(1).WriteArray(array.T)  # Remove "T" if it's inverted.
    dataset = None


text:
Q: Java sorted double-linked list: How to insert a new node quickly in the right position? I have a double-linked list that needs to have fast inserts and removes. I can just transverse the whole thing in either direction to find where to insert or remove, but is there a more clever way to find the insertion or removal point? First thing that came to mind was binary search, but since it is a linked list with no indexes (not an array), I am not sure how to jump around my linked list.
What is the right approach here to make insertions and removals the fastest they can be?

A: The smart way is to move towards a Skip List.
Other approaches include cacheing recent accesses and making intelligent guesses where to start your search, at the end, at the start or at a recent spot.

A: You may use a B-tree instead of the double linked list or, as mentioned in an other answer, use a Skip_list. For fast searching a double linked list is the wrong data-structure.

A: As you indicate yourself, because the linked list is not indexable there is no way than to loop over the list to find the right insertion point...


text:
Q: Complex Spotfire Join I am attempting a complex join. I have tried a Left Outer, Left Single, Full, Inner, Right Outer and Right Single and none of them have produced the result I need.
I feel it might be easier to explain with Pictures so here it goes. In Pic 1 you can see my main Data Table Total Sales_2.
What I want to do is bring in the Value column from  ROI RUBU Schema see Pic 2 for the corresponding Product on the corresponding Schema into Total Sales_2
So in Pic 1 you can see I have a line highlighted in green. It has its account number TY00009, its Schema Name ROI_RUBU_SCHEMA_8, the product number 156118, the product name, Estrumate 1x20ml 195,  the Qty 10 and the Total Value 424.50
what I would like to see in the next column in Total Sales_2 is Value and 0.20 but I don't get that see Pic 3
I have used and a Left Outer join in this example placed on the Product code to bring in the Value Column from ROI RUBU Schema see Pic 2 into Total Sales_2
I was expecting to see 0.20 as I have a line highlighted in green in Pic 2 because ROI_RUBU_SCHEMA_8 gives back 0.20 for product 156118
As you can see in Pic 3 I get different values back for Product 156118 on ROI_RUBU_SCHEMA_8 See Pic 3
What I need is the value to be 0.20 for all on Product 156118 on the account TY00009 because its on ROI_RUBU_SCHEMA_8
If TY00009 was on ROI_RUBU_SCHEMA_9 I would expect to see 0.27 for Product 156118 as that is what ROI_RUBU_SCHEMA_9 gives back on Product 156118 again see Pic 2 ROI RUBU Schema
I have tried every join there is available and no luck. If anyone can offer any help it would be greatly appreciated.
Pic 1

Pic 2

Pic 3

So based on feedback from an administrator please find what I believe to be a useful amount of data that can be used to recreate what I am currently facing. If more data is needed I am happy to supply
Total Sales_2 Data
Customer Maxx name  Customer Maxx Code  Schema Name Product Code    Product Description Sold Quantity   Total Value
Random Customer Name    TY00009 ROI_RUBU_SCHEMA_8   156118  Estrumate 1x20ml 195    10  424.5
Random Customer Name    TY00009 ROI_RUBU_SCHEMA_8   119977  Rotavec Corona 1x40ml 125   30  5222
Random Customer Name    TY00009 ROI_RUBU_SCHEMA_8   30179   Bovilis BVD 1x25ds 195  3   424.5
Random Customer Name    TY00009 ROI_RUBU_SCHEMA_8   21406   Delvosteron 1x20ml 125  6   5222
Random Customer Name    TY00009 ROI_RUBU_SCHEMA_8   13262   Dexafort 1x50ml 195 4   5222
Random Customer Name    TY00009 ROI_RUBU_SCHEMA_8   156118  Estrumate 1x20ml 195    12  4444
Random Customer Name    TY00009 ROI_RUBU_SCHEMA_8   119977  Rotavec Corona 1x40ml 125   32  3333

ROI RUBU Schema Data
Product Number  Product Name    List Price Oct 1st 2018 Category    Value
156118  Estrumate 1x20ml 100    €28.50  ROI_RUBU_SCHEMA_8   0.2
156118  Estrumate 1x20ml 100    €28.50  ROI_RUBU_SCHEMA_9   0.27
156118  Estrumate 1x20ml 100    €28.50  ROI_RUBU_SCHEMA_10  0.16

A: So I finally got there, and I wanted to give the answer so that it may help others.
It was simple really and silly on my part. It was a left outer join that was needed, but I only bought in 1 Column Value from the ROI RUBU Schema table, so when I saw all the different values for ROI_RUBU_SCHEMA_8 on data table Total Sales_2 Data i thought the join was wrong.
If I had of also bought in the Category Column from ROI RUBU Schema table into Total Sales_2 I would of seen all the possible Schema. I simply did not bring in Category Column from  ROI RUBU Schema table. Silly but it happened :-)


text:
Q: Time machine always needs to restart Time Machine says 100% of the time after a backup that verifcation failed and it needs to re-do the backup.

*

*I use a 4TB WD MyCloud and backup over wifi. The SAN itself is connected to the router via ethernet.

*I'm running OS X El Capitan (10.11.3).

How can I debug this issue?


text:
Q: Refactoring code in Java, alternatives to large if statement I'm refactoring some code in a project I'm working on and I ran into a large if/else if statement that follows the format:
if (changer instanceof AppleChanger)
{
   panel = new ApplePanel();
}
else if (changer instanceof OrangeChanger)
{
   panel = new OrangePanel();
}

Now my first impulse was to refactor it using polymorphism to have it appear like
panel = changer.getChangerPanel();

However unfortunately the class package doesn't have access to the panel package.
My next impulse was to create a PanelChooser class with an overloaded method:
PanelChooser.getPanel(changer);

//Overloaded Method
public Panel getPanel(OrangeChanger changer)
{
   Panel orangePanel = new OrangePanel();
   return orangePanel;
}
public Panel getPanel(AppleChanger changer)
{
   Panel applePanel = new ApplePanel();
   return applePanel;
}

Is this a good solution or is there a better way to solve this?

A: I think its good that your first impulse didn't work :) Otherwise you would couple you changer code (which should be something about logic) to UI code (panel) and its wrong.
Now I can offer you the following solution:
create an interface PanelCreator with method Panel createPanel like this:
interface PanelCreator {
   Panel createPanel();
}

Now, provide 2 implementations:
public class OrangePanelCreator implements PanelCreator{
   Panel createPanel() {
        return new OrangePanel();
   }
}

public class ApplePanelCreator implements PanelCreator {

  Panel createPanel() {
        return new ApplePanel();
  }
}

And now come the interesting part:
Create a Map, PanelCreator> this would act like a registry for your panels:
Map<Class<Changer>, PanelCreator> registry = new HashMap<>;
registry.put(OrangeChanger.class, new OrangePanelCreator());
registry.put(AppleChanger.class, new ApplePanelCreator());

And in your code now you can do the following thing:
panel = registry.get(changer.getClass()).createPanel();

I think it will be more elegant since you can easily change implementations of creators given the changer.
Hope this helps

A: If there is more than one of this if/else constructs in the code dependending on the instance type of a Changer, you can use the visitor pattern like this:
public interface ChangerVisitor {
  void visit(OrangeChanger changer);
  void visit(AppleChanger changer);
  ...
}

public class ChangerVisitorEnabler<V extends ChangerVisitor> {
  public static <V extends ChangerVisitor> ChangerVisitorEnabler<V> enable(V) {
    return new ChangerVisitorEnabler<V>(visitor);
  }

  private final V visitor;

  private ChangerVisitorEnabler(V visitor) {
    this.visitor = visitor;
  }

  public V visit(Charger changer) {
    if (changer instanceof OrangeChanger) {
      visitor.visit((OrangeChanger)changer);
    } else if (changer instanceof AppleChanger) {
      visitor.visit((AppleChanger)changer);
    } else {
      throw new IllegalArgumentException("Unsupported charger type: " + changer);
    }
    return visitor;
  }
}

Now you have a single type check code block and a type safe interface:
public PanelChooser implements ChangerVisitor {

  public static Panel choosePanel(Changer changer) {
    return ChangerVisitorEnabler.enable(new PanelChooser()).visit(changer).panel;
  }

  private Panel panel;

  private PanelChooser() {
  }

  void visit(OrangeChanger changer) {
    panel = orangePanel();
  }

  void visit(AppleChanger changer) {
    panel = applePanel();
  }

}

The usage is very simple:
panel = PanelChooser.choosePanel(chooser);

A: The fundamental 'problem' here is that you have parallel class hierarchies. You're not going to be able to replace that if statement without some fairly heavy refactoring. Some suggestions are on c2 wiki.
The best you can do, and possibly a perfectly fine solution, is to move the if statement into a 'factory' class and make sure it's not duplicated anywhere else.

A: Perhaps you can do:
public Panel getPanel(Changer changer)
{
    String changerClassName = changer.class.getName();
    String panelClassName = changerClassName.replaceFirst("Changer", "Panel");
    Panel panel = (Panel) Class.forName(panelClassName).newInstance();
    return panel;
}

I don't program in Java, but that is what I would try if this were in C#. I also don't know if this would work with your packages.
Good luck!

A: I don't see enough existing code and design at whole. So probably, first of all I would try to move the code with panel instantiation to the same place where Changer instance is created. Because choosing a Panel is the same decision as choosing a Changer.
If a selected Changer is dynamically selected, you may just create these panels and then show/hide them accordingly.

A: Your solution will not work, because Java selects the method based on the compiletime type (which here is probably Changer). You could use a Map<Class<? extends Changer>, Panel> (or Map<Class<? extends Changer>, Class<? extens Panel>> if you need to create new instances every time). This solution does require extra work if you need this to work for - yet unknown - subclasses of for example OrangeChanger.
eg for a single instance per Changer subclass
changerToPanel.get(changer.getClass());

or if you need new instances:
changerToPanelClass.get(changer.getClass()).newInstance();

The other option would be to go for your initial hunch, and make Changer know about Panel.

A: Take a look at the Factory and Abstract Factory Patterns.
The Factory Pattern is a creational pattern as it is used to control class instantiation. The factory pattern is used to replace class constructors, abstracting the process of object generation so that the type of the object instantiated can be determined at run-time.
Abstract Factory Pattern is a creational pattern, as it is used to control class instantiation. The abstract factory pattern is used to provide a client with a set of related or dependent objects. The family of objects created by the factory is determined at run-time according to the selection of concrete factory class.

A: I'd do the following:
Have an interface PanelChooser with a single method returning a Panel for a Changer.
Have an implementation ClassBasedPanelChooser returning a panel when the Change implements a certain class and null otherwise. The class and the panel to be returned get passed in in the constructor.
Have another implementation CascadingPanelChooser which takes a list of PanelChoosers in the constructor arguments and on call of its method asks each PanelChooser to provide a panel until it receives a not null panel, then it returns that panel.

A: Do not use instanceof.Why polymorphism fails
The only place to use instanceof is inside equals method.
To answer your question. Follow this link.
Credits to Cowan and jordao .

*

*Using Reflection.

public final class Handler {
  public static void handle(Object o) {
    for (Method handler : Handler.class.getMethods()) {
      if (handler.getName().equals("getPanel") &&
          handler.getParameterTypes()[0] == o.getClass()) {
        try {
          handler.invoke(null, o);
          return;
        } catch (Exception e) {
          throw new RuntimeException(e);
        }
      }
    }
    throw new RuntimeException("Can't handle");
  }

  public static void handle(Apple num) { /* ... */ }
  public static void handle(Orange num) { /* ... */ }

*

*Chain of Responsibility

 public abstract class Changer{
   private Changer next;

   public final boolean handle(Object o) {
      boolean handled = doHandle(o);
      if (handled) { return true; }
      else if (next == null) { return false; }
      else { return next.handle(o); }
   }

   public void setNext(Changer next) { this.next = next; }

   protected abstract boolean doHandle(Object o);
}

public class AppleHandler extends Changer{
   @Override
   protected boolean doHandle(Object o) {
      if (!o instanceof Apple ) {
         return false;
      }
      OrangeHandler.handle((Orange) o);
      return true;
   }
}


text:
Q: xpatch + listing + realboxes + mathmode gives wrong spacing I stumbled upon a problem that was quite hard to reproduce as it seems it required a very specific combination of several packages to make the code compile and yet produce the problem.
The problem is the spacing when using the macro mycmd instead of its expanded version. We get.

The code that provides this image in given below. Does someone have any clue of why this is the case and how to correct it ? This would be greatly appreciated.
\documentclass{article}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{realboxes}
\usepackage{xpatch}

\lstdefinestyle{def}{
    mathescape,
}

\lstset{style=def}

%To add background color to inline listings
\makeatletter
\xpretocmd\lstinline{\Colorbox{gray}\bgroup\appto\lst@DeInit{\egroup}}{}{}
\makeatother

%To produce my current use case
\newcommand{\mycmd}[1]{R=#1}

\begin{document}

%Note that none of the codes below compile without the patch to lstinline

%Wrong spacing
$\mycmd{\lstinline|toto a $b$|}$

%Correct spacing
$R=\lstinline|toto a $b$|$

\end{document}

[EDIT]: It seems my problem may not have a general solution. Therefore, is there any way I can achieve something similar to the command sctxa where the parameter may contain inline lsitings ?
\newcommand{\semantics}[1]{\llbracket #1 \rrbracket}
\newcommand{\sctxa}[1]{\semantics{#1}_{\alpha_{\mathcal{G}^{\sigma^{abs}}}(\model)}^{a_{var} \leftarrow a,vars}}


text:
Q: Winter '20 Critical Update "Restrict Access to @AuraEnabled Apex Methods for Authenticated Users Based on User Profile" I was wondering if somebody has already dealt with this critical update:

When this critical update is activated, an authenticated user can
  access an @AuraEnabled Apex method only when the user's profile allows
  access to the Apex class. This critical update enforces user profile
  restrictions for Apex classes used by Aura and Lightning web
  components.

From the look of it all apex classes that contain @AuraEnabled methods will have to be added to the profiles that need to access those.
Is the best approach to add the classes to the profiles? Or maybe tackle this with a permission set?


text:
Q: How to extract my geolocation (current position) coordinate using mapbox? https://codepen.io/Maximusssssu/pen/dyGxwMm
mapboxgl.accessToken = 'pk.eyJ1IjoibWF4aW11czEzMTIiLCJhIjoiY2s4bXU2bWp2MDVkdDNucDNvOTc2MHdueCJ9.ilwrzH23r2G3_pfxaJn6IQ';
var map = new mapboxgl.Map({
    container: 'map', // container id
    style: 'mapbox://styles/mapbox/streets-v11',
    center: [-96, 37.8], // starting position
    zoom: 3 // starting zoom
});

// Add geolocate control to the map.
map.addControl(
    new mapboxgl.GeolocateControl({
        positionOptions: {
            enableHighAccuracy: true
        },
        trackUserLocation: true
    })
);

Click the top right corner of map to view your location.
This is the demo of my code. I want to console.log() ,y current position. How to do that? I will give you my upvote if you have the ability to show your complete demo just like mine.Or else,.....

A: Try:
const map = new mapboxgl.Map({
  container: 'map', // container id
  style: 'mapbox://styles/mapbox/streets-v11',
  center: [-96, 37.8], // starting position
  zoom: 3, // starting zoom
});

// Add geolocate control to the map.
const geolocate = new mapboxgl.GeolocateControl({
  positionOptions: {
    enableHighAccuracy: true,
  },
  trackUserLocation: true,
});

map.addControl(geolocate);
// Set an event listener that fires
// when a geolocate event occurs.
geolocate.on('geolocate', function (ev) {
  console.log(ev.coords); // you'll get the coordinates
});

Updated codepen: https://codepen.io/sako_me/pen/MWKNZVJ


text:
Q: How I limit characetrs from text area using angularjs I have a text box, whose character dosent exceed 10 characters in angularjs directive.
Here is an HTML option from console,
<input type="text" id="segmentName" ng-change="mmModelChange()" class="mm-text-box  ng-dirty ng-valid-parse ng-touched" style="width: 252px;" ng-class="{disable: $parent.mmDisable, errorInput: $parent.mmError}" ng-show="$parent.isShowControl || (!!$parent.mmError && $parent.mmError !='' )" ng-model="$parent.$parent.mmModel" mm-focus="$parent.setFocus || ($parent.mmShowAsLabel && $parent.isShowControl)" ng-blur="mmModelBlur();$parent.$parent.isShowControl = !$parent.$parent.mmShowAsLabel; " ng-disabled="$parent.mmDisable" placeholder="" tabindex="">

A: Try like this
Textbox
<input type="text" maxlength="10" >

Textarea
<textarea  maxlength="10"></textarea>

If you wanna to use angular directive then
Try this
<input type="text" ng-model="name" ng-maxlength="10">

A: Use maxlength attribute:
<input type="text" maxlength="10">

A: Not sure, but may be this might work?
link: function (scope, element, attrs, ngModelCtrl) {
  var maxlength = Number(attrs.myMaxlength);
  function fromUser(text) {
      ngModelCtrl.$setValidity('unique', text.length <= maxlength);
      return text;
  }
  ngModelCtrl.$parsers.push(fromUser);
}

Or for <input />, use:
<input type="text" maxlength="10" />

A: Just use maxlength in the html on the text input. Something like maxlength="10".


text:
Q: getline as loop condition - infinite loop int main(int argc, char** argv)
{
    ifstream input;
    ofstream output;
    input.open("input.txt");
    output.open("output.txt");

    char c;

    output << "ID\tLName\tFName\tQ1 Q2 Q3 Q4 Q5 Q6 T1 T2 Final" << endl;
    output << "------------------------------------------------------" << endl;

    //Loop through each line until there is none left.
    string s;
    while (getline(input, s))
    {
        output << readNext(input) << "\t"; //ID
        output << readNext(input) << "\t"; //FName
        output << readNext(input) << "\t"; //LName

        output << endl;
    }
    return 0;
}

string readNext(ifstream& input)
{
    string s;
    char c;

    if (input.peek() == ',') input.get(c);

    do {
        input.get(c);
        s += c;
    } while(input.peek() != ',');

    return s;
}

The line "while (getline(input, s))" gets me stuck in an infinite loop. Could anyone explain why? I've been told by numerous people that this is the correct way to read input rather than looking for an EOF.
Sample Input
11111,Lu,Youmin,10,9,8,10,8,9,95,99,100
22222,Lu,Eddie,7,8,9,10,10,10,100,92,94

A: Try this. The infinite loop is most probably because of a missing comma at the eof. Hence also check for the eof would be my suggestion.
string readNext(ifstream& input)
    {
        string s;
        char c;
    if (input.peek() == ',') input.get(c);

    do {
        input.get(c);
        s += c;
    } while(input.peek() != ',' && ! input.eof()); // Check for the end of file.

    return s;
}


text:
Q: SQLAlchemy order_by string column with int values I have a table with a String column but it holds only integers (as strings).
Problem comes when I want to order_by this column on certain query. SQLAlchemy (or python more specifically) uses lexicographic order for strings, so
>>> '100000' < '99999'
True

even when
>>> 100000 < 99999
False

How can I achieve to order_by a numerical value of this string column?
I currently have a query such as this:
session.query(TableName).filter(TableName.column == 'some_value').order_by(TableName.string_column_holding_integers).all()

Please mind that changing the type of the column to an integer is not an option, I need to order_by correctly (by numerical value) on the present conditions.
Also just found that directly on the DB using SQL (this one is a MySQL DB) I cannot order by this column correctly, so I found that using a CAST(string_column_holding_integers AS unsigned) works here. But haven't found a way to do this one (the CAST part) directly on SQLAlchemy queries.

A: You can do a cast in SQLAlchemy like this:
session.query(...).filter(...).order_by(cast(TableName.string_column_holding_integers, Integer))

A: The best approach I could come up with for Alphanumeric was this:
from sqlalchemy import DECIMAL, cast, func

session.query(...).filter(...).order_by(
        func.ascii(TableName.column_name).asc(),
        cast(
            func.nullif(func.regexp_replace(TableName.column_name, "\\D", "", "g"), ""),
            DECIMAL,
        ).asc(),
    )

Which sorts things like:
-----+-------------
 1
 100
 2
 20
 A1
 A2
 B1

Not perfect (ideally, 100 would be after 20 ...). I hope the community can help me answer this better someday.


text:
Q: JSON formatting for 3 layer nest I am trying to achieve an jquery code that automatically fills in the select box with a name and an ID to the next select box (if the logic is correct). I am having issues structuring my JSON file.
I have the following attributes but it requires a 3 layer nested json:
Static Element (first thing on the html page)
<select>
<option value="first">This is the first</option>
<option value="second">This is the second</option>
<option value="third">This is the third</option>
<option value="fourth">This is the fourth</option>
<option value="fifth">This is the fifth</option>
</select>

So i have one static element where the user has to select the first option
{
    "first":[
        "london"[
            "id" = "london"
            "name" = "London UK"
            {
                "id" = "firstlondon",
                "name" = "First London"
            },
            {
                "id" = "secondlondon",
                "name" = Second London
            }
        ]
    ]
}

So the logic is that the customer will select the first element from the static select box, that will display the second layer of json file, which is London (i need the ID and the name to be generated so they can be populated within the next select option). Finally, when the person selects the location, it displays the third json.
I have worked out the jquery, just not how to formulate the json.

A: The following is valid JSON formatted for the example that you gave. I would have to know a little bit more about your data in order to truly understand if this is a proper representation of your data.
I use JSONLint if I do anything crazy with JSON or get really long files, it really helps me see what's going on. I'd recommend running your data through here, it usually catches a missing brace or bracket and REALLY helps if you miss a comma in my experience.
{
    "first": [
        {
            "london": [
                {
                    "id": "london",
                    "name": "London UK",
                    "london": [
                        {
                            "id": "london",
                            "name": "London UK"
                        },
                        {
                            "id": "secondLondon",
                            "name": "Second London"
                        }
                    ]
                }
            ]
        }
    ],
    "second": [
        {
            ...
        }
    ]
}


text:
Q: How do I exit a command that runs inside a Docker container? I have dockerized my Symfony build tools and so I try to run assetic:watch:
docker run -ti build-tool:latest ./bin/console assetic:watch

This works fine until I want to exit. Ctrl-C does nothing for me and I need to use docker stop <containerid> to make it stop.
Is there a way of getting the container to recognize Ctrl-C as a way of killing the currently running command?


text:
Q: Solving a system of equation with Sympy, python2.7 I want to solve a system of equations. But I want to be able to precise the value to "get", and as a function of "what".
To better understand, I take an exemple from here, wich I modfified:
import sympy as sp
x, y, z = sp.symbols('x, y, z')
rho, sigma, beta = sp.symbols('rho, sigma, beta')
f1 = sigma * (y - x)
f2 = x * (rho - z) - y
f3 = x * y - beta * z
print sp.solvers.solve((f1, f2, f3), (x, y, z))

in
import sympy as sp
x, y, z, w = sp.symbols('x, y, z, w')
rho, sigma, beta = sp.symbols('rho, sigma, beta')
f1 = sigma * (y - x)
f2 = x * (rho - z) - y
f3 = x * y - beta * w
f4 = z - w
print sp.solvers.solve((f1, f2, f3, f4), (x, y, z))

So, as you can see, I replace z by w in the last equation and I add a new to precise z = w.
But, sympy (on python 2.7) is unable to solve this new system of equation!!
So my question: How to get the result for x, y, z as a function of rho, sigma, beta. And more generally, how do we precise the variable "response variable".
I think that could be very helpfull because, often, you don't want to developp your system of equation before asking python to solve it.
In the same way, if I take a more complex example:
import sympy as sp
x, y, z, w, u = sp.symbols('x, y, z, w, u')
rho, sigma, beta = sp.symbols('rho, sigma, beta')
f1 = sigma * (y - x)
f2 = x * (rho - u) - y
f3 = x * y - beta * w
f4 = z - w
f5 = w - u
print sp.solvers.solve((f1, f2, f3, f4, f5), (x, y, z))

The response I get is:
[]

But as you see I have z = w = u
Son I should get the same answer!

A: Your code is giving following error:

Traceback (most recent call last):
    File "C:\temp\equation1.py", line 37, in  f3 = x * y - beta * w  NameError: name 'w' is not defined

Hence we pull symbol 'w' from  sympy symbols as below
x, y, z, w = sp.symbols('x, y, z, w')
You also mentioned you are trying to add  z = w , so once we add that to your code, it works.
Working Code:
import sympy as sp
x, y, z, w = sp.symbols('x, y, z, w')
rho, sigma, beta = sp.symbols('rho, sigma, beta')
z = w
f1 = sigma * (y - x)
f2 = x * (rho - z) - y
f3 = x * y - beta * w
f4 = z - w
print sp.solvers.solve((f1, f2, f3, f4), (x, y, z, w))

Output:
Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
[(0, 0, 0), (-sqrt(beta*rho - beta), -sqrt(beta*(rho - 1)), rho - 1), (sqrt(beta*rho - beta), sqrt(beta*(rho - 1)), rho - 1)]
>>>


text:
Q: Is the set of closed range operators open? As we know the set of surjective operators is open.
Let $T\in B(\mathcal{H})$ be a closed range operator. Is there any $\delta>0$ such that for every $T'\in B(T, \epsilon) $, we have $T'$ is closed range? If it is not true, please give me a counter example.

A: This is not true.  One (boring) counterexample is that the zero operator $0$ has closed range, but if $T$ is an operator with non-closed range, then $\frac{1}{n}T\to 0$.


text:
Q: Server side admin clients in Firebase? For example for a banking app Let's say you want to use firebase to allow people to play a betting game and they would get points.
The questions are:

*

*if there is no server side code then who decides the winner of the bet?

*who would be the authority that would give points to the users?

If an individual user has write access to their own points, they could update it (which is not what we want)
The solution that we thought about is a admin node firebase client running on a server.  It would listen and make decisions and write to the points location for each user.  Users would only have read access.
But this means that there would have to be scalable server or servers.  This seems to be a single point of failure.  Plus what if you have 100's of admin firebase clients running, that could be a synchronization issue.
What is the best practice for this type of problem?
I suspect all games must have this issue? no?

A: You can use App Engine for backend processing, which is Google's "serverless" solution. Checkout this solution: Using Firebase for Real-time Events on App Engine. It think it solves your questions.


text:
Q: album art not showing, using express.js, node.js, pug, javascript I am trying to create a music app that can serve music files to an audio element. Eventually I want a client side ui that can pick a song from a playlist and even offer a possibility of creating your own playlist. It's a personal project for learning node.js. and just a fun challenge.
But right now the album art isn't showing. I just get broken image
// var server=require('http');
var jsmediatags = require('jsmediatags');
var express= require('express');
var app=express();
var pug=require('pug');
const fs=require('fs');
const { error } = require('console');
var tagsArray=Array();

const port=3000;
const host='localhost';

app.use('/public',express.static('public'));
app.set('views','./views');
app.set('view engine', 'pug');

// var html="
Hello
"

// fs.writeFile('index.html',html, (error)=>{
//   if(error){
//     console.log(error)
//   }
//   else{
//     console.log("success")
//   }
// })

const server =app.listen(port, host, ()=>{

  console.log("server started at "+host+"port:"+port);

});

process.on('SIGTERM', () => {
  server.close(() => {
    console.log('Process terminated')
  })
})

jsmediatags.read("./public/Music/Pink_Floyd/WishYouWereHere/ShineOnYouCrazyDiamond(PartsI-V).mp3", {
  onSuccess: function(tag) {
    // console.log(tag);

    var tags=tag.tags;
    tagsArray=[tags.artist,tags.track,tags.album,tags.title,tags.picture];
    var artist=tags.artist;
    var album=tags.album;
    var title=tags.title;
    var track=tags.track;
    var base64Url=Buffer.from(tags.picture.data).toString("base64");
    var artInfo="data:"+tags.picture.format+";base64,"+base64Url;

    console.log(`data:${tags.picture.format};base64,`);

    app.get('/', (req, res)=>{

      res.render("index", {
        artist:tags.artist,
        album: tags.album,
        title: tags.title,
        track: tags.track,
        art: artInfo

      });
      console.log('done');
    });
    //   res.render('index');

  },
  onError: function(error) {
    console.log(':(', error.type, error.info);
  }
});

Here is my pug code :
    html(lang="en")
head
    title Music App
body
    img#albumC(src="#{art}" alt='album art')
    h2 Artist: #{artist}
    h2 Album: #{album}
    h2 Song: #{title}
    h2 Track: #{track}
    audio(controls src="/public/Music/Pink_Floyd/WishYouWereHere/ShineOnYouCrazyDiamond(PartsI-V).mp3")

A: If i understand your issue correctly, then the problem is, that the object "tags.picture" isn't being passed to the js correctly.
I would probalby move the "albumArt" function to the nodejs. Something like this:
//...
jsmediatags.read("./public/Music/Pink_Floyd/WishYouWereHere/ShineOnYouCrazyDiamond(PartsI-V).mp3", {
    onSuccess: function(tag) {
    // console.log(tag);

    var tags=tag.tags;
    tagsArray=[tags.artist,tags.track,tags.album,tags.title,tags.picture];
    var artist=tags.artist;
    var album=tags.album;
    var title=tags.title;
    var track=tags.track;
    //Create a buffer, stringify it and format it to a data url.
    var art=`data:${tags.picture.format};base64,${Buffer.from(tags.picture.data).toString("base64")}`;
    // console.log(tags.picture);

    app.get('/', (req, res)=>{

      res.render("index", {
        artist:tags.artist,
        album: tags.album,
        title: tags.title,
        track: tags.track,
        art: art

      });
    });
    //   res.render('index');
  },
  onError: function(error) {
    console.log(':(', error.type, error.info);
  }
});

and then in the pug code you just need to pass it as a src:
doctype html
html(lang="en")
    head
        title Music App
    body
        img#albumC(src='#{art}' alt='')
        h2 Artist: #{artist}
        h2 Album: #{album}
        h2 Song: #{title}
        h2 Track: #{track}
        audio(controls src="/public/Music/Pink_Floyd/WishYouWereHere/ShineOnYouCrazyDiamond(PartsI-V).mp3")


text:
Q: CraftyJS Blurry Pixel Art I'm new to CraftyJS.  I want to make a game with low-resolution graphics (e.g. 10x10 pixel tile).
I'm trying to use Crafty.viewport.scale(10) to make the game big enough to see, but scaling the game is making it very blurry.
It's like the web browser is using bilinear scaling instead of nearest neighbor.

What's the best way to scale the game without making it blurry?

A: I've successfully gotten sharp pixel-art in CraftyJS in the past like this:
Crafty.pixelart(true);

This below API page has some additional suggestions that it notes may be necessary for compatibility with some browsers.  However, with Chrome and Safari I've only had to call the above option to get good results.
http://craftyjs.com/api/Crafty-pixelart.html


text:
Q: cmake find_package full list of installed modules Where, or how, can I get the full list of packages supported by find_package?
I understand those are modules, so they must reside somewhere?
I'm building on online automated packaging system for C++/ROS, and I need to have a detailed list of what is available (as package).

A: Here is a complete guide for it.


text:
Q: Can I force protocol conformation in Swift? I'd like to do this:
UIView <UITextFieldDelegate>*
in swift.
Making an object that subclasses UIView also conform to the UITextFieldDelegate protocol.

A: You can express (id <UITextFieldDelegate, UIScrollViewDelegate>) using Protocol Composition
but not (UIView<UITextFieldDelegate> *). except for class definition.
// Obj-C
- (void)methodName:(id <UITextFieldDelegate, UIScrollViewDelegate>)arg { ... }

// Swift
func methodName(arg:protocol<UITextFieldDelegate, UIScrollViewDelegate>!) { ... }

Actually, an Obj-C method declared as - (void)methodName((UIView<UITextFieldDelegate> *))arg;, when it's bridged to Swift, you can call with any UIView instance.

EDIT:
After a little research, it seems you can declare your func like this
func myFunc<T:UIView where T:UITextFieldDelegate>(view:T) { ... }

A: Make a sub class of UIView and let the SubClassedView conforms to UITextFieldDelegate
In traditional way
@interface SubClassedView:UIView <UITextFieldDelegate>

@end

in swift
class SubClassedView:UIView, UITextFieldDelegate {

}


text:
Q: How to send images using an api with discord.js I am trying to create a simple discord bot which sends random pokemon names with their images with a specific command. I was successful in sending the image and name but only one is of them is sent.
This is the code that I am using
 var random= Math.floor( Math.random() * 800 )

function getPoke() {

 return fetch("https://pokeapi.co/api/v2/pokemon/" + random)
.then( res => {

    return res.json()

   }
)

   .then(data => {

return data ["name"] +data["sprites"]["front_default"]

   }
)

}
  if (msg.content === "$poke") {

    getPoke().then (pokemon=> msg.channel.send ( pokemon) );

If I only try with -
return data["sprites"]["front_default"]

It sends the image in the chat.
Please help

A: Doing

return data["name"] +data["sprites"]["front_default"]

returns the name and the URL together, or combines them.
I think you would want to return the name and the URL with a space next to each other, so you would need a space in between them.
You can fix this by either doing return `${data.name} ${data.sprites.front_default}`  or  return data.name + " " + data.sprites.front_default.

A: I solved this problem by ->
 var random= Math.floor( Math.random() * 800 )
function getPoke() {
 return fetch("https://pokeapi.co/api/v2/pokemon/" + random)
.then( res => {
    return res.json()
   }
)

   .then(data => {
return data ["name"]
   }
)

}
  if (msg.content === "$poke") {
getPoke().then(poek => msg.channel.send(poek,{
  files:[
    'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/'+random+'.png'
  ]
}

).then(
  random=Math.floor(Math.random() *898)
));
}


text:
Q: home made ethernet cable speed degradation. what is reasonable? i made my own cat5e cable  for wired ethernet backhaul between my main router and an Access Point (2nd router). the cable is about 80 feet long. one end i put male rj45 and the other i wired to a female 'block' that connects to a wall plate
i tried to follow online instructions and be careful about the twists!
internet speed test shows 150Mpbs coming direcrtly out of router but only 75Mpbs after connecting the homemade cable inline.
is it common to have so much loss of signal quality?
is it 'practical' to make homemade cables that run at these high speeds?
should i only wire male connectors on homemade cables and use those little store bought 'extenders' (female to female)? i ask because the male connectors seem easier to wire than the female
thanks!

A: You should be able to achieve the same specifications listed for the Category of the cable. Cat5, Cat5e, and Cat6 will do 1Gbps up to 100m. Cat6 will do 10Gbps up to 55m, and Cat6a will do 10Gbps up to 100m. There should never be any performance degradation due to the cable.
If you trust the quality of the cable and are not meeting these specifications, your termination is probably bad. Cut the connector off, verify you are ordering the wires per either the T-568A or the T-568B standard, and re-terminate the cable. In lieu of a fancy cable tester, your only test will be using it and seeing how it performs.


text:
Q: RestEasyClientBuild register ResteasyJackson2Provider - WARN about duplicate I am using the org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder to build a REST client in the following way:
ResteasyClient client = (new ResteasyClientBuilder())
    .maxPooledPerRoute(5)
    .connectionPoolSize(10)
    .socketTimeout(10L, TimeUnit.SECONDS)
    .register(jacksonProvider)
    .register(new RestClientLogger())
    .register(new RestClientMDCFilter())
    .build();

The jacksonProvider that is registered there is a ResteasyJackson2Provider jacksonProvider = new ResteasyJackson2Provider(); which comes with a custom ObjectMapper that is important for deserialization. So far so good, the problem is, that I get the following warning in JBoss:
10:31:38,414 WARN  [org.jboss.resteasy.resteasy_jaxrs.i18n] (default-threads - 1) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider is already registered.  2nd registration is being ignored.

This makes sense if I check the documentation when there already has been an instance of the same class that has been registered before. I used a decompiler to check what ResteasyClientBuilder is doing and was able to see, that it scans the classpath for jars that contain a resource that describes what "built in" providers should be registered.
One of the jboss provided implementations is now apparently already defining a ResteasyJackson2Provider that is registered there making it impossible for me to later register my own instance of it.
What are my options here? I need to get my version of the ResteasyJackson2Provider - or at least the ObjectMapperinto the client. Can I somehow replace the existing one?

A: I had the same issue, but I did not want to remove the resteasy-jackson2-provider dependencies because we added that dependency explicitly for other parts of the system (using undertow, not full AS).
Turns out you can just extend the org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider without adding/overriding anything so you can register it with a higher priority than the default org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider picked up from the classpath (which is registered without a priority). This way you ensure your ResteasyJackson2Provider will be chosen over the one picked up via classpath scanning.
Extending to a "custom" ResteasyJackson2Provider:
public class CustomResteasyJackson2Provider extends ResteasyJackson2Provider {
}

Plug that in to the ResteasyClientBuilder with your customized ObjectMapper:
ObjectMapper objectMapper = new ObjectMapper();
// customize your objectMapper here...
CustomResteasyJackson2Provider jacksonProvider = new CustomResteasyJackson2Provider();
jacksonProvider.setMapper(objectMapper); // add objectMapper to provider

// register provider to client
ResteasyClient client = new ResteasyClientBuilder()
     .register(jacksonProvider, 100) // any priority over 0 will do
     .build();

Hope this helps.

A: If you want to use your own packaged 'resteasy-jackson2-provider' jars, then one of the ways you can skip loading the resteasy provider provided my JBoss by excluding the below dependencies using the jboss-deployment-structure.xml,
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
    <deployment>
        <exclusions>
            <module name="org.jboss.resteasy.resteasy-jackson-provider"/>
            <module name="org.jboss.resteasy.resteasy-jettison-provider"/>
            <module name="org.jboss.resteasy.resteasy-jackson2-provider"/>
        </exclusions>
    </deployment>
</jboss-deployment-structure>


text:
Q: Simple inequality involving $\max(\cdot)$ Let $x_1, \ldots, x_n$ be real numbers. Is it true that
\begin{equation}
\max_{1 \leq i \leq n} |x_i| = \max \{ \max_{1 \leq i \leq n} x_i, \max_{1 \leq i \leq n} -x_i\}  \ ?
\end{equation}
My intuition is that the maximum in absolute value is either the smallest negative or the biggest positive number among $x_1, \ldots, x_n$, which motivates the given equation.
Any feedback is much appreciated.

A: \begin{align}
\max_{1 \leq i \leq n} |x_i| &= \max_{1 \leq i \leq n} \left(\max\{x_i,-x_i\}\right)\\
&=\max\left\{ \{x_i,1 \leq i \leq n\}\bigcup\{-x_i,1 \leq i \leq n\}\right\}\\
&= \max \left\{ \max_{1 \leq i \leq n} x_i, \max_{1 \leq i \leq n} -x_i\right\}.  \
\end{align}


text:
Q: -1 Hour timestamp in Javascript i have the following timestamp : 1445086800
I want to do - 1 hour on this timestamp.
What is the best way to do this in javascript?
The output needs to be a unix timestamp also.
Is there something like a strtotime() in javascript function?
Thanks.

A: Just do this
timestamp = timestamp - 3600

you have to subtract 3600 seconds to the timestamp var
If your timestamp is in milliseconds  multiply by 1000 the 3600 to get in seconds

A: Unix timestamps are counted in seconds. Thus, to substract 1 hour:
timestamp -= 3600; // 60 seconds * 60 minutes

Your new timestemp will be:
1445083200


text:
Q: Dealing with multiple images in MySQL I am working on an android app that displays people's posts, a single post can have multiple images the way a facebook post can. At first I thought I could have an image column in my post table like
| id | title | description | image | but later realized that this was not a good technique since a single post could hold multi images, plan B was to have a seperate table to hold all image paths so the table would be like
| id | postFk | imagePath |, with this technique the problem is; How do I fetch both the post and images at the same time? A normal join is failing, well not really, its pulling data but I have all these repetitions and duplications, Anyone dealt with a similar problem?

A: Use Left Join . A sample query below,
SELECT * FROM post_table AS u LEFT JOIN post_photo AS p ON p.userid = u.id

A: You should filter out the multiplied post rows yourself when dealing whith the result of your query. You migth want to turn the result into a datastructure like
$posts = [
  [
    'title' => 'lorem',
    'description' => 'ipsum',
    'images' => [image1, image2,...],
  ],
  [another post]
]

Or you could use an ORM that does that job for you, like Doctrine ORM.
Btw way, your query selects only posts withat least one image. Use a LEFT JOIN if post can have no images too.


text:
Q: Show/Hide objects by attribute in HTML list For example, I have checkbox that can be checked or unchecked.

*

*Whenever it is checked, I want all the elements in the HTML list to be displayed.

*Whenever it is not checked, I want just some objects (that are not filtered) to be displayed, like others don't exist (I don't want white spaces etc).

The HTML (Handlebars) list:

                    {{#each personList}}

{{showPerson this}}

                    {{/each}}

Handlebars helper:
        Handlebars.registerHelper('showPerson', function(person) {
            return person.firstName + " " + person.lastName;
        });

My filtering function looks like this:
    function filterOldPeople(person) {
        return person.age > 60;
    }

The thing I want to achieve is something like this:
var filter; // I am getting this boolean value from checkbox
if (filter) {
    doFilter(); // will filter the HTML list that is already rendered
}

Now I don't know how the function doFilter() should look like to achieve this. Now with jQuery the problem is I can get the HTML object of list item but not the actual person object so this won't work:
$( "li" ).filter(filterOldPeople).addClass("hide");

And something like that is exactly what I need. How do I achieve this?

A: Here you go! Only thing you want to do is to place all elements you want to hide in one div and then hide it, it is alot of easier to hide one element than couple of them.

function check() {
  if (document.getElementById("test").checked == true) {
    document.getElementById("two").style.display = "none";
  } else {
    document.getElementById("two").style.display = "block";
  }
}

    If you click on me, #two will hide.
    <input type="radio" id="test" onclick="check()">

    Hi, click on the button!

A: If you don't want to use two lists, you could modify using something like the following (add code to function as needed):
HTML

One

Red

Two

Green

Three

Blue

<input type="checkbox" id="numbers" checked>Show Numbers

JS
$('#numbers').change(function() {
    $('.number').hide();
});

https://jsfiddle.net/1ngotz5u/

A: How I would approach this would be:
function filterOldPeople(person) {
    return person.age > 60;
}

// Get all li Elements (useful so we don't have to search the dom multiple times)

var liElements = $("li");

// loop through each li and filter it.

function filterAges() {
   liElements.each(function () {
      if (filterOldPeople($(this).val())) {
         $(this).addClass("hide");
      }
   });
}

// Show all hidden elements by removing the hide class

function showAll() {
   liElements.removeClass("hide");
}

// Create our event

$("#checkbox").change(function () {
   if ($(this).is(":checked")) {
       filterAges();
   } else {
       showAll();
   }
});


text:
Q: Python AI Chatbot Error - nhomogeneous shape after 2 dimensions I'm trying to make a chatbot AI using tensorflow, nltk, numpy, and so on, but I get an error. Would anyone be able to help? Thank you in advance!
here's the code. I followed a tutorial online, and need to get this finished by tomorrow :(
import random
import json
import pickle
import numpy as np

import nltk
from nltk.stem import WordNetLemmatizer

from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Activation, Dropout
from tensorflow.keras.optimizers import SGD

lemmatizer = WordNetLemmatizer()

intents = json.loads(open('intents.json').read())

words = []
classes = []
documents = []
ignore_letters = ['?', '!', ',', '.']

for intent in intents['intents']:
    for pattern in intent['patterns']:
        word_list = nltk.word_tokenize(pattern)
        words.extend(word_list)
        documents.append((word_list, intent['tag']))
        if intent['tag'] not in classes:
            classes.append(intent['tag'])

words = [lemmatizer.lemmatize(word) for word in words if word not in ignore_letters]
words = sorted(set(words))

classes = sorted(set(classes))

pickle.dump(words, open('words.pkl', 'wb'))
pickle.dump(classes, open('classes.pkl', 'wb'))

training = []
output_empty = [0] *len(classes)

for document in documents:
    bag = []
    word_patterns = document[0]
    word_patterns = [lemmatizer.lemmatize(word.lower()) for word in word_patterns]
    for word in words:
        bag.append(1) if word in word_patterns else bag.append(0)

    output_row = list(output_empty)
    output_row[classes.index(document[1])] = 1
    training.append([bag, output_row])

    training = np.array(training)
    random.shuffle(training)

I followed a tutorial online https://youtu.be/1lwddP0KUEg
I've written all the code out, but I get an error that says
Traceback (most recent call last):
  File "C:\Users\willi\Documents\Uni\AI\Chatbot-AI3\venv\training.py", line 52, in <module>
    training = np.array(training)
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 2 dimensions. The detected shape was (1, 2) + inhomogeneous part.

Process finished with exit code 1


text:
Q: SKPhysicsBody Collision Not Working Below is my "Floor.swift" class below which is basically a bunch of walls. I have objects coming from the top of the screen and once the Floor and SKSpriteNodes collide, I'd like the SKSpriteNode to be removed. Below is my Floor class.
import Foundation
import SpriteKit

class Floor: SKNode {
    override init() {
        super.init()

        let leftWall = SKSpriteNode(color: UIColor.clear, size: CGSize(width: 5, height: 50))
        leftWall.position = CGPoint(x: 0, y: 50)
        leftWall.physicsBody = SKPhysicsBody(rectangleOf: leftWall.size)
        leftWall.physicsBody!.isDynamic = false
        self.addChild(leftWall)

        let rightWall = SKSpriteNode(color: UIColor.clear, size: CGSize(width: 5, height: 50))
        rightWall.position = CGPoint(x: 375, y: 50)
        rightWall.physicsBody = SKPhysicsBody(rectangleOf: rightWall.size)
        rightWall.physicsBody!.isDynamic = false
        self.addChild(rightWall)

        let bottomWall = SKSpriteNode(color: UIColor.clear, size: CGSize(width: 500, height: 10))
        bottomWall.position = CGPoint(x: 150, y: -5)
        bottomWall.physicsBody = SKPhysicsBody(rectangleOf: bottomWall.size)
        bottomWall.physicsBody!.isDynamic = false
        self.addChild(bottomWall)

        self.physicsBody = SKPhysicsBody(bodies: [leftWall.physicsBody!, rightWall.physicsBody!, bottomWall.physicsBody!])

        self.physicsBody?.categoryBitMask = floorCategory
        self.physicsBody?.contactTestBitMask = nailDropCategory | pointCategory | lifeCategory
        self.physicsBody?.collisionBitMask = balloonCategory
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemted")
    }
}

GameScene class under "func didBegin(_ contact: SKPhysicsContact)" I wrote:
func didBegin(_ contact: SKPhysicsContact) {
        if (contact.bodyA.categoryBitMask == nailDropCategory | pointCategory | lifeCategory) && (contact.bodyB.categoryBitMask == floorCategory) {
           // contact.bodyB.node!.removeFromParent()
            print("COLLISION")
        }
}

As you can see, in my Floor class I set the object as "self.physicsBody = SKPhysicsBody(bodies:)" with all my SKSpriteNode. But for some reason I'm not getting any detection what's so ever. I made my "Floor" class be a "contactTestBitMask" on each class of my objectCategory, pointCategory, lifeCategory. This has been an issue I've been stuck on for a minute now, any ideas?
Update:
So I'm using this code below now and it's working! Only issue is, the default case is removing my "balloonCategory" also and I don't want it to do that. How can I make it ignore only that category but also act as a wall to the balloon?
func didBegin(_ contact: SKPhysicsContact) {
        let contactMask = contact.bodyA.categoryBitMask | contact.bodyB.categoryBitMask

        switch contactMask {
        case balloonCategory | nailDropCategory:
            print("nailDrop and balloon have contacted.")
            contact.bodyB.node!.removeFromParent()
            self.run(SKAction.playSoundFileNamed("lostlifesound.mp3", waitForCompletion:false))
            lifeLost -= 1
        case balloonCategory | pointCategory:
            print("point and balloon have contacted.")
            contact.bodyB.node!.removeFromParent()
            totalPoints += 2
            self.run(SKAction.playSoundFileNamed("pointsound.mp3", waitForCompletion:false))
        case balloonCategory | lifeCategory:
            print("life and balloon have contacted.")
            contact.bodyB.node!.removeFromParent()
            lifeLost += 1
            self.run(SKAction.playSoundFileNamed("pointsound.mp3", waitForCompletion:false))
        default:
            contact.bodyB.node!.removeFromParent()
            print("Removed \(String(describing: contact.bodyB.node!.name))")
        }
    }

A: It sounds like you would benefit from assigning names to all your object types, like so:
class Balloon: SKSpriteNode {
    init() {
        super.init(texture: nil, color: .blue, size: CGSize(width: 50, height: 50))
        self.name = "balloon"
    }
}

Now when you make your check in the switch, you can verify the identity of objects before deciding to delete them. See the change I made to the default case in your switch statement, below. This way, the node will not be removed if it is a balloon. The physics collisions will continue to work.
func didBegin(_ contact: SKPhysicsContact) {
    let contactMask = contact.bodyA.categoryBitMask | contact.bodyB.categoryBitMask

    switch contactMask {
    case balloonCategory | nailDropCategory:
        print("nailDrop and balloon have contacted.")
        contact.bodyB.node!.removeFromParent()
        self.run(SKAction.playSoundFileNamed("lostlifesound.mp3", waitForCompletion:false))
        lifeLost -= 1
    case balloonCategory | pointCategory:
        print("point and balloon have contacted.")
        contact.bodyB.node!.removeFromParent()
        totalPoints += 2
        self.run(SKAction.playSoundFileNamed("pointsound.mp3", waitForCompletion:false))
    case balloonCategory | lifeCategory:
        print("life and balloon have contacted.")
        contact.bodyB.node!.removeFromParent()
        lifeLost += 1
        self.run(SKAction.playSoundFileNamed("pointsound.mp3", waitForCompletion:false))
    default:
        if contact.bodyB.node!.name == "balloon" {
            print("Balloon collided but we will not remove it.")
            return
        } else {
            contact.bodyB.node!.removeFromParent()
            print("Removed \(String(describing: contact.bodyB.node!.name))")
    }
}

A: You can't guarantee that nodeB is the floor and is nodeA really nailDropCategory | pointCategory | lifeCategory?
I'm assuming that naildDrop, point and life are 3 objects that you want to be notified for when any one touches the floor, so try structuring your didBegin(contact:) like this:
  func didBegin(_ contact: SKPhysicsContact) {
     print("didBeginContact entered for \(String(describing: contact.bodyA.node!.name)) and \(String(describing: contact.bodyB.node!.name))")

     let contactMask = contact.bodyA.categoryBitMask | contact.bodyB.categoryBitMask

     switch contactMask {
     case nailDropCategory | FloorCategory:
        print("nailDrop and floor have contacted.")
     case pointCategory | FloorCategory:
        print("point and floor have contacted.")
     case lifeCategory | FloorCategory:
        print("life and floor have contacted.")
     default:
        print("Undetected collision occurred")
     }
 }

Have you actually created an object from your Floor class?


text:
Q: Shared element transition blocked by other views I'm attempting to implement a shared element transition where I share some text from one fragment to another. The actual shared element animation worked fine until I attempted to combine it with a Fade transition. Now the shared element is being hidden behind the other fading content and is only visible once the fade finishes.
I'm animating from fragment A to fragment B.
In fragment A, I'm setting the exitTransition property in onCreate like so:
exitTransition = Fade()

In fragment B, I'm setting the enterTransition property in onCreate as well:
enterTransition = Fade()

The actual shared element transition is being triggered in the containing activity:
supportFragmentManager.commit {
      replace(R.id.fragmentContainer, FragmentB.newInstance())
      addSharedElement(sharedView, "transition_name")
      setReorderingAllowed(true)
      addToBackStack(null)
    }

The animation used for the shared element is being set in onCreate of fragment B:
TransitionSet set = new TransitionSet();
set.setOrdering(TransitionSet.ORDERING_TOGETHER);

Transition changeBounds = new ChangeBounds();
changeBounds.addTarget(R.id.logo);
changeBounds.addTarget("logo_transition_name");
set.addTransition(changeBounds);

ChangeTransform changeTransform = new ChangeTransform();
changeTransform.addTarget(R.id.logo);
changeTransform.addTarget("logo_transition_name");
set.addTransition(changeTransform);

Transition textSize = new TextSizeTransition();
textSize.addTarget(R.id.logo);
textSize.addTarget("logo_transition_name");
set.addTransition(textSize);

sharedElementEnterTransition = set;

What am I missing?
Here's a gif for reference:

A: Ultimately I managed to fix this issue by setting a scale on the logo TextView that was transitioning.
To elaborate, my understanding from previous stack overflow answers written by George Mount is that the ChangeTransform transition will (kind of magically) handle reparenting a shared element view such that it won't get drawn over by another view.
After debugging the ChangeTransform transition, I found that its createAnimator method was never being called. It looks like that's because the view being shared didn't have any scale or rotation changes between the fragment A and fragment B.
Setting a scale of 0.99 on the logo TextView in fragment A lead to the createAnimator method being called and the view properly transitioning over other views instead of under them.
I suspect that since people are normally sharing imageviews that theres normally a scale difference between the two images so this problem doesn't show up as much. I could be wrong about that.


text:
Q: How to use the right data name in the t-test results? I am getting the below result while performing the one sample t-test
One Sample t-test

data: x()
t = 1.9628, df = 6, p-value = 0.09731
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
-2.642339 24.070910
sample estimates:
mean of x
10.71429

Here data is not getting displayed as the column name of the data I have used for this test instead it is displaying the variable name I used as part of the code. Now how to change the data name to data column name while displaying the test result?

A: You can just overwrite the data.name variable of your result.
a <- t.test(c(12,3,4,5,2), c(2,34,2,4,3))
a$data.name <- 'bla bla'
a

Welch Two Sample t-test

data:  bla bla
t = -0.58399, df = 4.6367, p-value = 0.5865
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-20.92852  13.32852
sample estimates:
mean of x mean of y
      5.2       9.0


text:
Q: convert this LINQ code query to lambda expression I want to convert this code with lambda expression
 var employees = from e in dataContext.AccountTrees
                        where (id.HasValue ? e.ParentId == id : e.ParentId == null)
                        select new
                        {
                            id = e.AccountId,
                            Name = e.Name,
                            hasChildren = e.AccountTrees1.Any(),
                        };

A:  dataContext.AccountTrees.Where(e => id.HasValue ? e.ParentId.Value == id.Value : e.ParentId == null).Select(x => new {id = e.AccountId, Name = e.Name, hasChildren = e.AccountTrees1.Any()})


text:
Q: Angular and node.js nginx deployment on CentOS I have Nginx webserver installed on CentOS. I would like to deploy Angular 6 Apps and node.js server on this Nginx webserver. My build angular app is in /usr/share/nginx/html and node.js server is running on localhost:8080.
This is my config file:
server {
    listen       80 default_server;
    listen       443 ssl default_server;
    ssl_certificate "/home/intern/AutoScan/AutoScan_api/ssl/autoscan.crt";
    ssl_certificate_key "/home/intern/AutoScan/AutoScan_api/ssl/autoscan.pem";

    root /user/share/nginx/html/www;
    server_name  _;
    # Load configuration files for the default server block.

    location /{

            proxy_pass https://localhost:8080;
            proxy_redirect          off;
            proxy_set_header Host $https-host;
    }

    error_page 404 /404.html;
        location = /40x.html {
    }

    error_page 500 502 503 504 /50x.html;
        location = /50x.html {
    }
}

Currently i can't open Angular Application. If i change  location server for example to /server it partially works, I mean angular application works but i can't make requests, because invalid paths.
Do you have any idea, what should I do?


text:
Q: How to convert images from the jpg format to ppm(P3) I have recently learned how to read ppm3(P3) images in C++. I just read RGB pixels written in a plain format. I want to convert some certain jpg pictures to ppm3 and then experiment with different things, like identifying numbers there, the circled answers in exam papers, etc.
I have tried this website: https://convertio.co/pdf-ppm/, but it transformed a photo in the P6 format. Could anyone help?

A: You can use ImageMagick in the Terminal/shell:
magick INPUT.JPG -compress none OUTPUT.PPM

If you omit -compress none you'll get binary (i.e. P6) PPM output.

If using old v6 ImageMagick, that becomes:
convert INPUT.JPG -compress none OUTPUT.PPM

All the options, switches, operators and settings for ImageMagick are documented here.

If you want to convert PPM to JPEG, or to PNG, you can just use:
magick INPUT.PPM OUTPUT.JPG

or
magick INPUT.PPM OUTPUT.PNG

You can also programmatically create a random PPM file like this:
#!/bin/bash

W=5; H=4
echo "P3\n${W} ${H}\n255" > image.ppm
for ((i=0;i<$((W*H*3));i++)) ; do
   echo $((RANDOM%255))
done >> image.ppm

Then enlarge for easy viewing and make into a PNG:
magick image.ppm -scale 200x result.png

Or, the same thing again, nut maybe slightly more elegantly and without creating an intermediate file:
#!/bin/bash

W=5; H=4
{
    printf "P3\n${W} ${H}\n255\n"
    for ((i=0;i<$((W*H*3));i++)) ; do
      echo $((RANDOM%255))
    done
} | magick ppm:- -scale 200x result.png

If you prefer to use the lighter weight, but far less capable NetPBM tools, it would be:
jpegtopnm -plain INPUT.JPG > OUTPUT.PPM

A: For parsing pixels P6 is probably more useful for binary apps like C
P3 is about 4 times bigger than P6
both P3 and P6 are uncompressed format 1 entry = one pixel component
normally 3  components = 1 pixel (rgb) here is a white cow in a snowfield

each 255  on the Ascii =ÿ in the binary thus faster to count one byte text ÿ than 4 byte 255  the main advantage for P3 is when using an ascii editor to fettle the values as number key inputs (modify lower order numbers as 000 - 031 control code values becomes a problem in text editors)
SAFE binary bytes were used for Ansi Art as here this is a binary.ppm (just using safe non control codes.

The binary version (P6 uncompressed) is most easily generated For PDF users by xpdf or poppler pdftoppm (one single executable no real need for more than that).
http://www.xpdfreader.com/download.html
For Jpeg you can use jpegtopnm as described in other answer by Mark
https://sourceforge.net/projects/netpbm/files/
for docs and other info see https://netpbm.sourceforge.net/doc/
for  binaries on windows the Cygwin / GNUwin32 ports may be useful but older 2005 https://gnuwin32.sourceforge.net/packages/netpbm.htm One exe & 4 dlls

for better description see https://en.wikipedia.org/wiki/Netpbm#File_formats
for windows related viewing see https://github.com/vbaderks/netpbm-wic-codec and also possibly conversion https://github.com/peirick/ZackViewer