text:
Q: how to call custom jquery function on custom phtml in magento 2 I want to call a custom JS method quickViewPopUp like below on a list.phtml file in magento2.
 How can i do it? I'm doing something like this.
<?php
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
use Magento\Framework\App\Action\Action;

// @codingStandardsIgnoreFile
?>
<?php
/**
 * Product list template
 *
 * @var $block \Magento\Catalog\Block\Product\ListProduct
 */
?>
<?php
$_productCollection = $block->getLoadedProductCollection();
$_helper = $this->helper('Magento\Catalog\Helper\Output');
?>
<?php if (!$_productCollection->count()): ?>

<?php /* @escapeNotVerified */ echo __('We can\'t find products matching the selection.') ?>

<?php else: ?>
    <?php echo $block->getToolbarHtml() ?>
    <?php echo $block->getAdditionalHtml() ?>
    <?php
    if ($block->getMode() == 'grid') {
        $viewMode = 'grid';
        $image = 'category_page_grid';
        $showDescription = false;
        $templateType = \Magento\Catalog\Block\Product\ReviewRendererInterface::SHORT_VIEW;
    } else {
        $viewMode = 'list';
        $image = 'category_page_list';
        $showDescription = true;
        $templateType = \Magento\Catalog\Block\Product\ReviewRendererInterface::FULL_VIEW;
    }
    /**
     * Position for actions regarding image size changing in vde if needed
     */
    $pos = $block->getPositioned();
    ?>
    <div class="products wrapper <?php /* @escapeNotVerified */ echo $viewMode; ?> products-<?php /* @escapeNotVerified */ echo $viewMode; ?>">
        <?php $iterator = 1; ?>

            <?php /** @var $_product \Magento\Catalog\Model\Product */ ?>
            <?php foreach ($_productCollection as $_product): ?>
                <?php /* @escapeNotVerified */ echo($iterator++ == 1) ? '
' : '

' ?>

                    <?php
                    $productImage = $block->getImage($_product, $image);
                    if ($pos != null) {
                        $position = ' style="left:' . $productImage->getWidth() . 'px;'
                                . 'top:' . $productImage->getHeight() . 'px;"';
                    }
                    ?>
                    <?php // Product Image ?>
                    <a href="<?php /* @escapeNotVerified */ echo $_product->getProductUrl() ?>" class="product photo product-item-photo" tabindex="-1">
                        <?php echo $productImage->toHtml(); ?>

                        <?php
                        $_productNameStripped = $block->stripTags($_product->getName(), null, true);
                        ?>

                            <a class="product-item-link"
                               href="<?php /* @escapeNotVerified */ echo $_product->getProductUrl() ?>">
                                   <?php /* @escapeNotVerified */ echo $_helper->productAttribute($_product, $_product->getName(), 'name'); ?>

                        <?php echo $block->getReviewsSummaryHtml($_product, $templateType); ?>
                        <?php /* @escapeNotVerified */ echo $block->getProductPrice($_product) ?>
                        <?php echo $block->getProductDetailsHtml($_product); ?>

                            <div class="product actions product-item-actions"<?php echo strpos($pos, $viewMode . '-actions') ? $position : ''; ?>>
                                <div class="actions-primary"<?php echo strpos($pos, $viewMode . '-primary') ? $position : ''; ?>>
                                    <?php if ($_product->isSaleable()): ?>
                                        <?php $postParams = $block->getAddToCartPostParams($_product); ?>
                                        <form data-role="tocart-form" action="<?php /* @escapeNotVerified */ echo $postParams['action']; ?>" method="post">
                                            <input type="hidden" name="product" value="<?php /* @escapeNotVerified */ echo $postParams['data']['product']; ?>">
                                            <input type="hidden" name="<?php /* @escapeNotVerified */ echo Action::PARAM_NAME_URL_ENCODED; ?>" value="<?php /* @escapeNotVerified */ echo $postParams['data'][Action::PARAM_NAME_URL_ENCODED]; ?>">
                                            <?php echo $block->getBlockHtml('formkey') ?>
                                            <button type="submit"
                                                    title="<?php echo $block->escapeHtml(__('Add to Cart')); ?>"
                                                    class="action tocart primary">
                                                <?php /* @escapeNotVerified */ echo __('Add to Cart') ?>
                                            </button>
                                        </form>
                                    <?php else: ?>
                                        <?php if ($_product->getIsSalable()): ?>

<?php /* @escapeNotVerified */ echo __('In stock') ?>

                                        <?php else: ?>

<?php /* @escapeNotVerified */ echo __('Out of stock') ?>

                                        <?php endif; ?>
                                    <?php endif; ?>

                                    <button type="button" onclick="quickViewPopUp(this)" data-id="<?php echo $_product->getId() ?>" class="quick-view-btn-<?php echo $_product->getId() ?>"><?php echo __('Quick-View') ?></button>

                                <div data-role="add-to-links" class="actions-secondary"<?php echo strpos($pos, $viewMode . '-secondary') ? $position : ''; ?>>
                                    <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow()): ?>
                                        <a href="#"
                                           class="action towishlist"
                                           title="<?php echo $block->escapeHtml(__('Add to Wish List')); ?>"
                                           aria-label="<?php echo $block->escapeHtml(__('Add to Wish List')); ?>"
                                           data-post='<?php /* @escapeNotVerified */ echo $block->getAddToWishlistParams($_product); ?>'
                                           data-action="add-to-wishlist"
                                           role="button">
                                            <?php /* @escapeNotVerified */ echo __('Add to Wish List') ?>

                                    <?php endif; ?>
                                    <?php
                                    $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');
                                    ?>
                                    <a href="#"
                                       class="action tocompare"
                                       title="<?php echo $block->escapeHtml(__('Add to Compare')); ?>"
                                       aria-label="<?php echo $block->escapeHtml(__('Add to Compare')); ?>"
                                       data-post='<?php /* @escapeNotVerified */ echo $compareHelper->getPostDataParams($_product); ?>'
                                       role="button">
                                        <?php /* @escapeNotVerified */ echo __('Add to Compare') ?>

                            <?php if ($showDescription): ?>

                                    <?php /* @escapeNotVerified */ echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
                                    <a href="<?php /* @escapeNotVerified */ echo $_product->getProductUrl() ?>" title="<?php /* @escapeNotVerified */ echo $_productNameStripped ?>"
                                       class="action more"><?php /* @escapeNotVerified */ echo __('Learn More') ?>

                            <?php endif; ?>

                <?php echo($iterator == count($_productCollection) + 1) ? '
' : '' ?>
            <?php endforeach; ?>

    <?php echo $block->getToolbarHtml() ?>
    <?php if (!$block->isRedirectToCartEnabled()) : ?>

    <?php endif; ?>
<?php endif; ?>

A:  Links
Use custom JS in M2 - Dev Docs
Calling and initialising JS in M2 - Dev Docs
How to use Knockout JS in Magento 2 - Magento Stack Exchange
Reference the JS
The first step is to reference your JS file inside the PHTML template:

For example if you wanted to load vendor/magento/module-catalog/view/frontend/web/product/view/validation.js when the dom element #test has loaded you would write:

If you don't care about making sure the node has been rendered then you can use * which will load the JS regardless of any DOM elements.
Add your JS
In your JS file you will need to use the following structure:
define ([
    'jquery',
    'other/dependencies/can/go/here',
    `domReady!` // If you require your script to run after page load
], function ($, anotherFunction, domReady) {
    // Your code here
});

Loading the new file
To load the file on the frontend you'll need to clear pub/static/frontend, pub/static/_requirejs, and var/view_preprocessed. Also clear your browser cache.
 Notes
I would highly recommend choosing this method over adding JS inside a template, I'm a big fan of separating the content and logic.

A: You can call any script from template you want if you already register it in requirejs-config


text:
Q: In Scripted Coldfusion Query - why would queryParams not get added? I have a dynamically generated query, all but one params are optional with one required field.
I thought I would be smart but something very odd happens.
-cfscript
// Standard new query(), set name, datasource etc

query.addParam(value=requiredParam, type=cf_sql_varchar);
sqlStatement = "select ....";

if (optional field 2){
    sqlStatement &= "and field like '%?%' ";
    query.addParam(value=optionalValue, type=cf_sql_varchar);
}
... optional fields 2,3,4,5 repeats ...
query.execute(sql=sqlStatement);

So when I execute passing only the required field, the query is correct as are the results.
dump shows just the required entry in the sqlParameter (with 2 results)
When I add calls with the optional arguments, only the first (required argument is shown). The optional arguments are NOT shown (in the result dump) and the result set goes to 0 rows. (?? very odd)
I traced it with the debugger, (from cf8 extenstions, cfeclipse, not builder, on CF9 standalone)
The optional field logic was correct, the code was tested and executed.
In the variables pane the params seemed to be added properly but don't show up in the result query, (dump on the result page) only the required one.
I am guessing something odd is happening, but this does not make sense.
Is it possible that all the addParams have to be added together?
Is the like (syntax) the problem?
Why would working with ifs/conditional prevent additional addParams to not work/showup?
Some odd display issue from dump?
Sorry about not providing real code, in a sensitive area.

A: If you have multiple fields I think it would be best to use the name parameter:
if (optional field 1) {
    sqlStatement &= "AND Field LIKE :field1 ";
    query.addParam( name="field2", value="%#optionalvalue#%", type=cf_sql_varchar);

}
if (optional field 2) {
    sqlStatement &= "AND Field LIKE :field2 ";
    query.addParam( name="field2", value="%#optionalvalue#%", type=cf_sql_varchar);
}

Good reading: http://www.bennadel.com/blog/1678-Learning-ColdFusion-9-Using-CFQuery-And-Other-Service-Tags-In-CFScript.htm
Note the bug about putting a space behind the :name in the statement in some cases.

A: PEBKAC ...
Wrote
if (optional field 2){
    sqlStatement &= "and field like '%?%' ";
    query.addParam(value=optionalValue, type=cf_sql_varchar);
}

Should have been:
if (optional field 2){
    sqlStatement &= "and field like ? ";
    query.addParam(value='%#optionalValue#%', type=cf_sql_varchar);
}

Query works properly now, returns correct rows and the parameters used show up in the dump ...

redpajama_set_name: RedPajamaStackExchange


text:
Q: New to coding an need help figuring out why certain portions aren't working as they should be OK I need help figuring out why my code doesn't work like I want it to. I need it to calculate the weighted percentages of a student taking 4 quizzes, 2 midterms and a final exam. the final and quizzes are weighted 30% while the midterm is 40%. The problems I'm having are:

*

*The test/Midterm section of the code isn't accepting the fourth input; I would put 80 80 80 80, but the compiler wouldn't recognize the last input and calculate as is.

*The final exam portion only works if I put a zero after enter the two test/midterm inputs

I'm new to coding and any help would be appreciated (:
#include <stdio.h>

int main()
{
   int testOne,testTwo,testPoint,totTest;
    float percTest;
    printf("Enter you test grades:\n");
    scanf(" %d%d\n",&testOne,&testTwo);
    totTest=testOne+testTwo;
    printf("Your total grade points is: %d\n", totTest);
    testPoint=200;
    percTest=(totTest*.40)/testPoint *100;
    printf("Your percentage is %.1f%%\n", percTest);

    int quizOne,quizTwo,quizThree,quizFour,quizPoint,totQuiz;
    float percQuiz;
    printf("Enter you quiz grades:\n");
    scanf(" %d%d%d%d\n",&quizOne,&quizTwo,&quizThree,&quizFour);
    totQuiz=quizOne+quizTwo+quizThree+quizFour;
    printf("Your total quiz grade is %d\n", totQuiz);
    quizPoint=400;
    percQuiz=(totQuiz*.30)/quizPoint *100;
    printf("Your quiz percentage is %.1f%%\n", percQuiz);

    int examOne,examPoint;
    float percExam,finGrade;
    printf("Enter your exam grade:\n");
    scanf(" %d\n",&examOne);
    printf("Your total exam points is: %d\n", examOne);
    examPoint=100;
    percExam=(examOne*.30)/examPoint *100;
    printf("Your final exam grade is %.1f\n", percExam);

    finGrade=(percExam+percQuiz+percTest);
    printf("Your overall grade is %.1f%%\n", finGrade);

    return 0;
}


text:
Q: Why do I get "mysql: unknown option '-▒'" error on execution of mysql command performing any query? On the execution of the following command in linux
mysql --host=HOST --user=USER -–password='password' DATABASE --execute='SHOW TABLES'

I get the following error
mysql: unknown option '-▒'

This output does not depend on execute command and it is same for any password whether it is correct or wrong.
This is on shared hosting. Please advise what can I do about it?


text:
Q: Android Studio "Bumblebee" - debug and breakpoints no longer work Android Studio "Bumblebee" - 2021.1.1 Patch 2
I'm developing a mobile app with Flutter.
When upgrading to this version of Android Studio, break points no longer work. They turn grey when I start debug mode:

Is there a new setting I need to turn on or change to get my breakpoints/debug mode to work again? I have tried this with multiple projects and on multiple computers. Same issue in each place. I'm fairly new to Android Studio, but everything was working correctly before the update.

A: This is a known issue in version 65.0 of the Flutter IntelliJ plugin.  To fix it, you will need to downgrade to version 64.
As mentioned in that issue thread, you can downgrade the Flutter plugin by manually installing a lower version:

*

*Download the desired version from https://plugins.jetbrains.com/plugin/9212-flutter/versions.  Be sure to select a version compatible with your IDE.  In the case of Android Studio Bumblebee, the version you want is 64.1.2.

*Go to "Plugins" in Android Studio settings.

*Click on the gear icon in the header (not in the section with information about a specific plugin, but above that).

*Choose "Install plugin from disk" and select the zip file downloaded in step 1.

A: Just update the Flutter plugin to the latest version: >= 65.1.2


text:
Q: How to use array.filter + map on an array I'm trying to filter this array to get the id and convert from a string to a number. I want to use filter and map? Wanting to know how to make it as clear as possible.
var pets = [
  { id: '1', name: 'rupert', readyForHome: 'No', age: 12, personality: ['friendly', 'lazy', 'loving']},
  { id: '2', name: 'mrs fluffy', readyForHome: 'Yes', age: 2, personality: ['affectionate', 'playful', 'shy']},
  { id: '3', name: 'tabitha', readyForHome: 'Yes', age: 4, personality: ['aggressive', 'independent']},
  { id: '4', name: 'lily', readyForHome: 'No', age: 8, personality: ['friendly', 'playful', 'mischievous']},
];

A: All you need is map to get down to an array of ids as numbers:
pets = pets.map(function(pet) {
  return Number(pet.id);
});

var pets=[{id:"1",name:"rupert",readyForHome:"No",age:12,personality:["friendly","lazy","loving"]},{id:"2",name:"mrs fluffy",readyForHome:"Yes",age:2,personality:["affectionate","playful","shy"]},{id:"3",name:"tabitha",readyForHome:"Yes",age:4,personality:["aggressive","independent"]},{id:"4",name:"lily",readyForHome:"No",age:8,personality:["friendly","playful","mischievous"]}];

pets = pets.map(function(pet) {
  return Number(pet.id);
});

console.log(pets);

A: var petIds = pets.map(function (pet) {
    petId = parseInt(pet.id);
    return petId;
});


text:
Q: Parse OpenClipArt api json to Html I am trying to Parse this json http://openclipart.org/search/json/?&query=christmas&page=1&amount=4 in my html page.
My code is
<!doctype html>

        <meta charset="utf-8">
        <title>jQuery.getJSON demo</title>

http://jsfiddle.net/2n8ax/, But something is wrong.

A: The reason its not working on jsFiddle is because of Same-origin policy.
What this means is, you are not allowed to access resources on another domain (http://openclipart.org/) from jsfiddle.net.
See these two resources:

*

*Same-origin policy

*Cross-origin resource sharing


text:
Q: Can't find library Google play billing or Extras Referable links but didn't work for me:

*

*Android Studo 3.0 SDK Manager, can't find Extras

*I can't find Google Play Billing Library in the Android Studio SDK Manager
I'm use Android Studio 3.1.2
I am trying to find Google Play Billing Library in this Studio but didn't find it.
Also i'm Put Library in build.gradle(app):
implementation 'com.android.billingclient:billing:1.1'

Gradle Build Successfull but didn't show the Google Play Billing Library in SDK Manager
See below SDK Manager dialog Screenshot:

Below is build.gradle(app) :
    // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

A: The reason why you can't find billing library in your sdk is because according to google official blog:

you will find that Play Billing Library is available through Maven repository now that's why you can't find it on your sdk.

so now you start by adding billing library as a dependency. and then move ahead.
implementation 'com.android.billingclient:billing:1.1'

And also google have given the coding sample to get you started with:
https://codelabs.developers.google.com/codelabs/play-billing-codelab/#0
Github Link
moreover you can find some explanation in this answer too:
Why is the Google Play Billing Library not shown up in the SDK Manager?


text:
Q: Trying to add image in Git add but keep getting the following message? I tried restarting/reloading git and closing VS Code but nothing worked
That is:
hashanp@DESKTOP-9E00J4S: ~/cats-cakes$ git add .
error: open("img/cake.jpg"): Permission denied
error: unable to index file img/cake.jpg
fatal: adding files failed

Trying to add image in Git add but keep getting the following message? I tried restarting/reloading git and closing VS Code but nothing worked.

A: That looks like a git bash session on Windows, or a WSL session.
If you can not easily identify the process which keeps an handle to that file, preventing another program (like git) to access it, I would:

*

*reboot

*restart my git bash or WSL2 session

*try to add img/cake.jpg before opening any IDE.

Since it is an Ubuntu session, I would also try, for tesdting:
sudo chmod -R 755 img

That way, the folder img will be accessible.


text:
Q: Building gcc on BeagleBone Black fails Problem
I am trying to build a cross compiler on a BeagleBone Black to compile from ARM to x86. The intent of this is to use the low power consuming BeagleBone Black that I had on hand as a build server. It can already compile for windows through mingw-w64, but I need it to also compile the code for Linux x86 systems.
However, when I try to compile gcc on the BeagleBone Black I get the following errors:
/bin/bash ./libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../gcc-4.6.3/gmp -D__GMP_WITHIN_GMP    -g -O2 -c -o mpn/div_qr_1n_pi1.lo mpn/div_qr_1n_pi1.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../gcc-4.6.3/gmp -D__GMP_WITHIN_GMP -g -O2 -c mpn/div_qr_1n_pi1.c -o mpn/div_qr_1n_pi1.o
/tmp/cckCXg2a.s: Assembler messages:
/tmp/cckCXg2a.s:194: Error: thumb conditional instruction should be in IT block -- `movcc r4,#0'
/tmp/cckCXg2a.s:195: Error: thumb conditional instruction should be in IT block -- `movcs r4,#-1'
/tmp/cckCXg2a.s:452: Error: thumb conditional instruction should be in IT block -- `movcc r4,#0'
/tmp/cckCXg2a.s:453: Error: thumb conditional instruction should be in IT block -- `movcs r4,#-1'
make[4]: *** [mpn/div_qr_1n_pi1.lo] Error 1
make[4]: Leaving directory `$HOME/builds/gcc/gmp'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `$HOME/builds/gcc/gmp'
make[2]: *** [all] Error 2
make[2]: Leaving directory `$HOME/builds/gcc/gmp'
make[1]: *** [all-gmp] Error 2
make[1]: Leaving directory `$HOME/builds/gcc'
make: *** [all] Error 2

I know thumbs have something to do with ARM, but I'm mostly at a loss for why this isn't working. What did I do wrong?
Below are the steps I took in trying to create the cross-compiler. This is my first attempt at trying to make a cross-compiler, so most of this information was gleaned from several webpages and manuals.

Steps Taken
To create the cross compiler I downloaded the following packages:

*

*binutils-2.24

*gmp-6.0.0a

*mpfr-3.1.2

*mpc-1.0.2

*gcc-4.6.3

*linux-3.15.3

*glibc-2.19

These were all unpacked into the directory $HOME.
From there I set the following bash environment variables.
export PREFIX="$HOME/cross_compiler/x86_64"
export TARGET="x86_64-linux-gnu"
export PATH="$PREFIX/bin:$PATH"

I then proceeded to configure, build, and install the binutils.
mkdir -p $HOME/builds/binutils
cd $HOME/builds/binutils
../../binutils-2.24/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --disable-werror
make
make install

Binutils built without any errors, so I proceeded to build gcc. First I moved all the extras into the gcc directory.
mv $HOME/gmp-6.0.0a $HOME/gcc-4.6.3/gmp
mv $HOME/mpfr-3.1.2 $HOME/gcc-4.6.3/mpfr
mv $HOME/mpc-1.0.2 $HOME/gcc-4.6.3/mpc

I then configured, without any errors, and tried to build gcc.
mkdir -p $HOME/builds/gcc
cd $HOME/builds/gcc
../../gcc-4.6.3/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --enable-shared --with-multilib-list=m32,m64 --enable-threads=posix --enable-tls --without-headers
make

This generated the following errors:
/bin/bash ./libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../gcc-4.6.3/gmp -D__GMP_WITHIN_GMP    -g -O2 -c -o mpn/div_qr_1n_pi1.lo mpn/div_qr_1n_pi1.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../gcc-4.6.3/gmp -D__GMP_WITHIN_GMP -g -O2 -c mpn/div_qr_1n_pi1.c -o mpn/div_qr_1n_pi1.o
/tmp/cckCXg2a.s: Assembler messages:
/tmp/cckCXg2a.s:194: Error: thumb conditional instruction should be in IT block -- `movcc r4,#0'
/tmp/cckCXg2a.s:195: Error: thumb conditional instruction should be in IT block -- `movcs r4,#-1'
/tmp/cckCXg2a.s:452: Error: thumb conditional instruction should be in IT block -- `movcc r4,#0'
/tmp/cckCXg2a.s:453: Error: thumb conditional instruction should be in IT block -- `movcs r4,#-1'
make[4]: *** [mpn/div_qr_1n_pi1.lo] Error 1
make[4]: Leaving directory `$HOME/builds/gcc/gmp'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `$HOME/builds/gcc/gmp'
make[2]: *** [all] Error 2
make[2]: Leaving directory `$HOME/builds/gcc/gmp'
make[1]: *** [all-gmp] Error 2
make[1]: Leaving directory `$HOME/builds/gcc'
make: *** [all] Error 2

BeagleBone Black
Linux version 3.14.1-bone2 (root@imx6q-wandboard-2gb-0) (gcc version 4.6.3 (Debian 4.6.3-14) ) #1 SMP Sun Apr 20 09:56:48 UTC 2014

"gcc -v" output
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.6/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Debian 4.6.3-14' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-sjlj-exceptions --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 4.6.3 (Debian 4.6.3-14)

Desktop
This is the computer I am trying to get the code to run on in the end.
Linux version 3.2.0-65-generic (buildd@brownie) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #98-Ubuntu SMP Wed Jun 11 20:27:07 UTC 2014

"gcc -v" output:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu

A: Instead of trying to manually build a cross-compiler, I would advise to use one of the existing toolchain generation frameworks: buildroot or crosstool-NG. You need to install some dependencies on your BBB using apt-get, but otherwise it's just a matter of configure; make.


text:
Q: EKRecurrenceRule - add recurring events but exclude weekends I have this method which adds events to native iphone calendar.
It is already adding monthly reminders successfully - but I want to force any monthy reminders to fall into week days (not weekends).
The NSDictionary model is simply
Id:
Start_Date__c
Finish_Date__c
Payment_Interval__c = Monthly
- (void)addRecurringEventsForPartnership:(NSDictionary *)dict{
    ENTER_METHOD;

    NSError *error = nil;
    EKEvent *startEvent  = [EKEvent eventWithEventStore:self.eventStore];
    startEvent.calendar = self.defaultCalendar;
     startEvent.availability = EKEventAvailabilityFree;
    startEvent.startDate = [NSDate dateWithLongFormatString:[dict valueForKey:@"Start_Date__c"]];
    startEvent.allDay = YES;
   // startEvent.endDate =  [startEvent.startDate dateByAddingTimeInterval:30*60];
     startEvent.title = [dict theNameValue];
    //http://stackoverflow.com/questions/7718006/xcode-why-is-my-event-not-being-added-to-the-calendar
    if ([startEvent.startDate isEqualToDate:startEvent.endDate]) {
        startEvent.endDate = [startEvent.startDate dateByAddingTimeInterval:30*60];;
    }

   // if
    if ([[dict valueForKey:@"Payment_Interval__c"] isEqualToString:@"Monthly"]) {
        EKRecurrenceFrequency freq = EKRecurrenceFrequencyMonthly;
        int recurrenceInterval = 1;

        EKRecurrenceRule *rule = [[EKRecurrenceRule alloc] initRecurrenceWithFrequency:freq interval:recurrenceInterval end:nil];
        startEvent.recurrenceRule = rule;

        startEvent.notes = [NSString stringWithFormat:@"Id:%@",[dict valueForKey:@"Id"]];
        // [self.eventStore removeEvent:startEvent span:EKSpanThisEvent error:&error];
        [self.eventStore saveEvent:startEvent span:EKSpanThisEvent error:&error];

        if (error != nil)
        {
            DLog(@"WARNING:%@",error.description);
            // TODO: error handling here
        }
    }

  //  DLog(@"startEvent.endDate:%@",startEvent.endDate);

    EKEvent *finishEvent  = [EKEvent eventWithEventStore:self.eventStore];
    finishEvent.calendar = self.defaultCalendar;
    finishEvent.availability = EKEventAvailabilityFree;
    finishEvent.startDate = [NSDate dateWithLongFormatString:[dict valueForKey:@"Finish_Date__c"]];
    finishEvent.allDay = YES;
    finishEvent.title = [NSString stringWithFormat:@"%@ - Finish",[dict theNameValue]];

    finishEvent.notes = [NSString stringWithFormat:@"Id:%@",[dict valueForKey:@"Id"]];
    [self.eventStore saveEvent:finishEvent span:EKSpanThisEvent error:&error];

    if (error != nil)
    {
        DLog(@"WARNING:%@",error.description);
        // TODO: error handling here
    }

}

A: Couldn't you use NSDateFormatter to get the numeric day of the week and then adjust by subtracting or adding 1 or 2 depending on which day it returned?
[dateFormatter setDateFormat:@"c"];

Will return numeric (1-7) day of the week, I believe

A: Here's something that works (at least in iOS7, didn't test on other systems):
EKRecurrenceRule *er = [[EKRecurrenceRule alloc] initRecurrenceWithFrequency:EKRecurrenceFrequencyMonthly interval:1
                                                                   daysOfTheWeek:@[[EKRecurrenceDayOfWeek dayOfWeek:2], // Monday
                                                                                [EKRecurrenceDayOfWeek dayOfWeek:3], // Tuesday
                                                                                [EKRecurrenceDayOfWeek dayOfWeek:4], // Wednesday
                                                                                [EKRecurrenceDayOfWeek dayOfWeek:5], // Thursday
                                                                                [EKRecurrenceDayOfWeek dayOfWeek:6]] // Friday
                                                                  daysOfTheMonth:@[@1, @2]
                                                                 monthsOfTheYear:nil weeksOfTheYear:nil daysOfTheYear:nil setPositions:nil end:nil];
event.recurrenceRules = @[er];


text:
Q: dbTest not defined Am going through my spark training on databricks but everthing seems to be breaking down when I click run. I have this error
error: name 'dbTest' is not defined
when I run this below:
ip1, count1 = ipCountDF.first()
cols = set(ipCountDF.columns)
dbTest("ET1-P-02-01-01", "213.152.28.bhe", ip1)
dbTest("ET1-P-02-01-02", True, count1 > 500000 and count1 < 550000)
dbTest("ET1-P-02-01-03", True, 'count' in cols)
dbTest("ET1-P-02-01-03", True, 'ip' in cols)

print("Tests passed!")

please guys any tips?


text:
Q: Cache lines required to hold an array Consider an Array declared in C as double a[100]. How many 64 byte cache lines are required to hold the complete array?

A: Short Answer: 100 / 64 / 8 = 12.5 -> 13 cache lines.
More Information:
here is the general calculation:
Assume you have X elements of type A. Since this is an array you can assume continuous memory. Let size(A) be the size in bytes of one element of type A. Assuming size(A) <= 64B, the number of 64B cache lines needed to hold the array is (X / (64 / size(A))).
Explanation:
You want to calculate the number of elements per cache line, which is (64 / size(A)). Then you want to know how many cache lines are required for holding X elements which is X divided by the number of elements per cache line. You might want to round the result up in order to avoid issues like "false cache sharing".
For your case:
Size of double is 8B (couldn't find any case where it would be 2B like the comment on the question suggests). You can fit (64 / 8) = 8 elements on each cache line. So you'll need (100 / 8) = 12.5 cache lines to hold the entire array. Since most of the time you'll want to avoid "false cache sharing", this means you'll probably take the entire 13th cache line as well.
Note: this works well when the size of the element divides the cache line size with no reminder. It would also work on the general case but would result in some elements being written on two different cache lines. This is not idle in general as you'll have to sometime read two cache lines in order to read a single value, but as you're dealing with a continuous array, it is less of a big deal. If you do want to calculate for the general case without elements crossing cache lines simply use: (X / floor(64 / size(A))). E.g. if A was a long double over a 32b system size(A) would be 10B. In this case the first formula would give (100 / (64 / 10)) = 15.625, but without crossing cache lines you'll get (100 / floor(64 / 10)) = 100 / 6 = 16.6 - so one more cache line in total.


text:
Q: Calling knockout.js functions from external script Ok I'm new to using knockout, and I'm wondering how this is supposed to work.
I'm using it in conjunction with ASP.NET MVC, if that makes any difference.
Ideally I'd like to do all the functionality in an external script file. In the script file, I have the following function:
function GetIncidentNotes (incidentID, node) {
    $.getJSON('GetIncidentNotes', { IncidentID: incidentID }, function (data, status, xhr) {
        var notesViewModel =
            { notesArray: ko.observableArray(data) }
        ko.applyBindings(notesViewModel, document.getElementById(node));
    });

And in my cshtml razor file, I am testing by using the following inline script and associated html:

 0">

I'm getting the JSON array back, but then nothing populates my table. I'm definitely doing something wrong, but I'm not sure what.
Here's an example of the array being brought back:
[{"NoteID":3,
"IncidentID":124,
"GrievanceID":null,
"NoteSubtypeID":null,
"NoteDate":"2013-06-13T14:25:42.95",
"NoteBody":"travissimantor non non habitatio dolorum Quad esset rarendum eggredior. quartu et transit. imaginator Versus bono",
"CreateDate":"2014-04-23T16:12:01.553",
"CreateUser":"jsteranko",
"UpdateDate":"2014-04-23T16:12:01.553","UpdateUser":"jsteranko"},

{"NoteID":1,
"IncidentID":124,
"GrievanceID":496,
"NoteSubtypeID":6,
"NoteDate":"2000-01-30T13:27:14.51",
"NoteBody":"linguens e dolorum non transit. Quad imaginator Pro homo, quartu Quad Longam, rarendum Sed si egreddior estum. quartu",
"CreateDate":"2014-04-23T16:12:01.553",
"CreateUser":"jsteranko",
"UpdateDate":"2014-04-23T16:12:01.553",
"UpdateUser":"jsteranko"}]

A: You have an array here, so there is no text to display...what you should convert your html over to would be something like

A: Looks like you need a breakpoint at this point to inspect the values.  If you are absolutely certain your JSON is returning correctly then this would be my next step.
ko.applyBindings(notesViewModel, document.getElementById(node));

Are the variables notesViewModel and node what you expect?

A: Turns out this was indeed a mapping issue. I downloading the mapping plugin and voila. Working js function:
function GetIncidentNotes(incidentID, node) {
    $.getJSON('GetIncidentNotes', { IncidentID: incidentID }, function (data, status, xhr) {
        var notesViewModel = { notesArray: [] };
        notesViewModel.notesArray = ko.mapping.fromJS(data);
        ko.applyBindings(notesViewModel, document.getElementById(node));
    });
}


text:
Q: How to enable viewBinging in android project using Kotlin gradle dsl? android {
    ...I'm trying to enalbe ViewBinding in my project witch use Kotlin Gradle DSL.
All examples show how to do it with Groovy DSL.
android {
    ...
    viewBinding {
        enabled = true
    }
}

But this solution isn't works with Kotlin DSL.
I was trying solution like this:
android {
    ...
    viewBinding.enabled = true
}

But it also doesn't work. It's interesting, that this approach works for DataBinding.

A: Just an updated way of doing same thing, since isEnabled is deprecated.
just add this block
 viewBinding {
    android.buildFeatures.viewBinding = true
}

A: This happens because of old android gradle plugin version.
After updating up to 3.6.2 version the problem was solved.


text:
Q: Image layout android There is my layout in android xml, but the image does not in the top of the layout. What can be the problem?

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="match_parent">

    <ScrollView android:layout_width="match_parent"
                android:layout_height="match_parent">

        <LinearLayout android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:orientation="vertical">

            <ImageView android:id="@+id/description_imageview"
                       android:layout_width="match_parent"
                       android:layout_height="wrap_content"
                       android:src="@drawable/hand"
                       android:contentDescription="@string/app_version"/>

            <TextView android:id="@+id/first_help_textview"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:text="sdsjkfhsdjkfhsdkjfh skdfjh skjdfh skdjfh skjdfh skjdfh skjdhfk jshdfkjh  jskdfh skjdfh skdjfh skdjfh skdjfh skjdfh skjdfh skjdfh kjsdhf kjsdhfk jhs"/>
        </LinearLayout>
    </ScrollView>
</LinearLayout>

add scale_type:

A: might be your image having white spaces or you can say some area covered by image is null
either crop your image first and eliminate all white space
 <ImageView android:id="@+id/description_imageview"
                   android:layout_width="match_parent"
                   android:layout_height="wrap_content"
                   android:src="@drawable/hand"
                   ***android:scaleType="fitXY"***
                   android:contentDescription="@string/app_version"/>

A: try Setting scaleType to your ImageView
 android:scaleType="fitXY"

Edit : Try Changing LinearLayout height :
<LinearLayout android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:orientation="vertical">

A: <ImageView android:id="@+id/description_imageview"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:src="@drawable/hand"
      android:contentDescription="@string/app_version"
      android:layout_marginTop="-5dp"
/>


text:
Q: Slow SQL Queries against a table causing blocking What could be possible reasons on why all statements executing against a table would run extremely slowly causing blocking.  No particular query was the culprit.  At some point whatever was causing it ended and all statements started executing normal and all blocking was cleared up.

A: A corrupt index could cause the issue.  If there are indexes, you can recreate them.  If you're using table replication, if the replication is out of sync, this can cause slow queries especially if the tables handle a high volume of transactions.  If you haven't done so, you may want to log the slow queries as even queries that take .5 seconds can quickly cause a bottleneck on high-traffic systems.  Those are my "surface" thoughts.  Other considerations such as disk space, RAM, disk integrity, etc. also come to mind.  You may want to consider checking your system logs to see if anything shows up there during the time you experienced the issue.


text:
Q: Why do ArrayLists not initialize in Web Services? The client has a very old .net 1.1 app they need to hit a service. I built a middle piece in 4.0 that hits the service and I am attempting to return the data. The classes I built use ArrayLists since the .net 1.1 won't have access to generic lists. When the client consumes my code, the ArtayLists come over as ArrayOfAnyType and each must be initialized on the CLIENT side, despite the fact that I initialized them in Sub New(). I don't wan tthe client to have to initialize every arraylist. Here is the unremarkable code...
<Serializable()> _
Public Class XApplication

    Public Sub New()
        _People = New ArrayList
        _PhysicalHouseholds = New ArrayList
        _TaxReturns = New ArrayList
    End Sub

    Public Property People() As ArrayList
    Public Property PhysicalHouseholds() As ArrayList
    Public Property TaxReturns() As ArrayList
End Class

Tried using the XmlInclude Attribute to define the class type but it had no effect. To be clear, I CAN NOT use WCF. I have to use web services.

A: When a client proxy is generated from a web reference, the proxy will only model the data. Implementation code (including the constructor) cannot be obtained from WSDL. As a result, when a new instance of the proxy class is created, properties will have the default value.

A: You always have to create the object on the client side.
You can't send an object though a web service. The message that is sent is plain text, so any object has to be sent as the text representation that it contains, and be recreated on the client side by parsing the text and putting the data into a new object.


text:
Q: sync.Pool unexpected behavior Getting to know the sync.Pool i wrote 2 different New methods for it:

*

*Returns a slice;

*Returns a ptr to slice;

*Just alloc a new slice without pool (for compare performance);

Benchmarks surprised me

*

*6ns/op and 1 alloc

*17ns/op and 0 alloc

*130ns/op and 1 alloc

Please explain why is such a big difference between 1 and 3, given that both allocate memory?
And why 1st allocates?
package main

import (
    "bytes"
    "sync"
)

func main() {}

type MyBuffer struct {
    pool sync.Pool
}

func New() *MyBuffer {
    return &MyBuffer{pool: sync.Pool{
        New: func() any {
            buf := make([]int, 0, 128)
            return &buf
        },
    }}
}

func New2() *MyBuffer {
    return &MyBuffer{pool: sync.Pool{
        New: func() any {
            buf := make([]int, 0, 128)
            return buf
        },
    }}
}

func Fill[S ~[]E, E any](buf *S) {
    var some E
    for i := 0; i < cap(*buf); i++ {
        *buf = append(*buf, some)
    }
}

func BenchmarkAlloc(b *testing.B) {
    b.RunParallel(func(p *testing.PB) {
        for p.Next() {
            // Get buf
            buf := make([]int, 0, 128)
            // fill
            Fill(&buf)
            // Reset
            buf = buf[:0]
        }
    })
}

func BenchmarkPoolPtr(b *testing.B) {
    mb := New()
    b.RunParallel(func(p *testing.PB) {
        for p.Next() {
            // Get buf
            buf, _ := mb.pool.Get().(*[]int)
            // fill
            Fill(buf)
            // reset
            *buf = (*buf)[:0]
            // put
            mb.pool.Put(buf)
        }
    })
}

func BenchmarkPoolNoPtr(b *testing.B) {
    mb := New2()
    b.RunParallel(func(p *testing.PB) {
        for p.Next() {
            // Get buf
            buf, _ := mb.pool.Get().([]int)
            // fill
            Fill(&buf)
            // reset
            buf = buf[:0]
            // put
            mb.pool.Put(&buf)
        }
    })
}

A: I think in the 1st case, the allocation is a reference to your slice. In the 3rd case, the allocation is the complete slice.
When you look the size allocated, it's 32 B/op vs 1024 B/op
so the allocation is the reference to your slice, that is not needed when your variable is a pointer.


text:
Q: How to find the width of the longest line in multi-paragraph text Question
Is it possible to get the width of a multi-paragraph piece of text? For example, if I want to get the width of a single piece of text, I can do the following:
\documentclass[a4paper]{article}
\begin{document}

\newlength{\mytextwidth}
\settowidth{\mytextwidth}{some text}

\end{document}

However, if that text has multiple paragraphs, that doesn't work. E.g. If I do something like the following I get the error Paragraph ended before \@settodim was complete. <to be read again>:
\documentclass[a4paper]{article}
\begin{document}

\newlength{\testlen}
\settowidth{\testlen}{
    some text

    some longer text
}

\end{document}

What I'm wondering is if there is a way to get the widest width of text content (even if it's multi-paragraph text). So, for the first example it would still give the length of some text and for the second example, it would give the length of some longer text.

Context
Above is what I think I need for what I'm trying to do, but in case it's helpful, I'll also add the context for why I'm interested in getting this.
I'm attempting to write a command that will take in text content for a left side and right side. The content will be split into two columns, with the left side content being flush left and the right side content being flush right. The columns will adjust themselves to fit as much text on a line as they can before wrapping to the next line.
So if the left side content is much longer than the right side content, the right column will be much shorter in width than the left column and vice-versa. If neither side's content requires half the line width, each column's width will simply be half the line width. Similarly, if both side's content requires at least half the line width, each column's width will just be half the line width.
Here's what I have, which is working for single paragraph text:
\documentclass[a4paper]{article}
\begin{document}

% length variables for the command below
\newlength{\leftwidth}
\newlength{\rightwidth}
\newlength{\halfline}
\newlength{\leftexcess}
\newlength{\rightexcess}

% arg1: flush left minipage content
% arg2: flush right minipage content
\newcommand{\mycmd}[2]{
    \settowidth{\leftwidth}{#1}
    \settowidth{\rightwidth}{#2}
    \setlength{\halfline}{0.5\linewidth}

    % if the left side content doesn't need at least half of the
    % line width, store the excess leftover space
    \ifdim\leftwidth<\halfline\relax
        \setlength{\leftexcess}{\dimexpr(\halfline-\leftwidth)}
    \else
        \setlength{\leftexcess}{0pt}
    \fi

    % if the right side content doesn't need at least half of the
    % line width, store the excess leftover space
    \ifdim\rightwidth<\halfline\relax
        \setlength{\rightexcess}{\dimexpr(\halfline-\rightwidth)}
    \else
        \setlength{\rightexcess}{0pt}
    \fi

    % neither side has any leftover space, so each column just gets half the line
    \ifdim\rightexcess=0pt\relax
        \ifdim\leftexcess=0pt\relax
            \setlength{\leftwidth}{\halfline}
            \setlength{\rightwidth}{\halfline}
        \fi
    \fi

    % neither side needs any extra space to fit, so each column just gets half the line
    \ifdim\leftexcess>0pt\relax
        \ifdim\rightexcess>0pt\relax
            \setlength{\leftwidth}{\halfline}
            \setlength{\rightwidth}{\halfline}
        \fi
    \fi

    % if the right side has space to spare and the left side needs more space than
    % just half the line, give the left side the excess space from the right side.
    \ifdim\rightexcess>0pt\relax
        \ifdim\leftwidth>\halfline\relax
            \setlength{\leftwidth}{\dimexpr(\halfline+\rightexcess)}
        \fi
    \fi

    % if the left side has space to spare and the right side needs more space than
    % just half the line, give the right side the excess space from the left side.
    \ifdim\leftexcess>0pt\relax
        \ifdim\rightwidth>\halfline\relax
            \setlength{\rightwidth}{\dimexpr(\halfline+\leftexcess)}
        \fi
    \fi

    % command output
    \par\noindent%
    \begin{minipage}[t]{\leftwidth}%
        \begin{flushleft}%
            #1
        \end{flushleft}%
    \end{minipage}%
    \begin{minipage}[t]{\rightwidth}%
        \begin{flushright}%
            #2
        \end{flushright}%
    \end{minipage}%
}

% works fine
\mycmd
{
    left left left left left left left left left left left left left left left
}
{
    right right
}

% errors with: Paragraph ended before \@settodim was complete.
% \mycmd
% {
%     left left left left left left left left left left left left left left left

%     left left left
% }
% {
%     right right
% }

\end{document}

A: The varwidth package provides a similarly-named varwidth environment that acts like minipage. It takes a width argument like minipage, but instead of fixing the output to this width, it reduces the width of the resulting box to something smaller if the contents can fit within this smaller width. So you can specify the maximum width possible (\maxdimen) and varwidth should shrink that down to what you need - the maximum width of any paragraph within the environment body.

\documentclass{article}

\usepackage{varwidth}

\newsavebox{\mybox}
\newlength{\mylen}
\begin{document}

\settowidth{\mylen}{left left left left left left left left left left left left left left left}%
1: \the\mylen

\begin{lrbox}{\mybox}
\begin{varwidth}{\maxdimen}
left left left left left left left left left left left left left left left

right right
\end{varwidth}
\end{lrbox}%
2: \the\wd\mybox

\end{document}

A: tabulary can be used to get a similar effect.

\documentclass{article}

\usepackage{tabulary}
\newcommand\mycmd[2]{%
  \begin{center}
    \begin{tabulary}{\textwidth}{@{}LR@{}}
     #1&#2
    \end{tabulary}
  \end{center}}
\begin{document}

\mycmd
 {
     left left left left left left left left left left left left left left left

     left left left
 }
 {
     right right
 }

\mycmd
 {
     left left left left left

     left left left
 }
 {
     right right
 }

\mycmd
 {
     left left left left left left left left left left left left left left left
     left left left left left left left left left left left left left left left

     left left left
 }
 {
     right right
 }

\mycmd
 {
     left left left left left left left left left left left left left left left

     left left left
 }
 {
     right right right right right right right right right right right right right right
     right right right right right right right right right right right right right right
     right right right right right right right right right right right right right right
     right right right right right right right right right right right right right right
     right right right right right right right right right right right right right right
 }

\end{document}

A: Here, I count the width of all cat-11 and 12 tokens, as well as \parindent associated with paragraphs (I bypass any expansion of macros and ignore their width).  In \balance, I do the math to calculate the ratio of each width to the total width.
I create minipages, using a specified usable fraction of linewidth to set the parts in minipages based on those ratios.  Not knowing how much blank space is available at the end of a paragraph, I add .25\usablewidth as a very approximate average.  So if the two sides vary in numbers of paragraphs, that can screw things up a little.
I also, at this point do not account for extremely short entries, less than a line in width...I'm not sure how a general algorithm should handle that case anyhow, if one entry is very short and the other very long.
\documentclass{article}
\usepackage{tokcycle}
\newlength\Xwd
\newlength\Ywd
\edef\svparindent{\the\parindent}
\newcommand\addtowd[2]{\sbox0{#2}\addtolength #1{\wd0}}
\newcommand\countwidth[3]{%
  \def#1{#3}%
  \setlength#2{0pt}%
  \tokcycle
  {\tctestifcatnx A##1{\addtowd{#2}{##1}}
    {\tctestifcatnx.##1{\addtowd{#2}{##1}}{}}\addcytoks{##1}}
  {\processtoks{##1}}
  {\tctestifx\par##1{\addtolength{#2}{%
  \dimexpr\parindent+.25\usablewidth}}{}\addcytoks{##1}}
  {\addtowd{#2}{##1}\addcytoks{##1}}
  {#3}%
}
\newlength\Awd
\newlength\Bwd
\newlength\ABwd
\newlength\usablewidth
\usablewidth=.9\textwidth
\def\truncdec#1.#2\relax{#1}
\makeatletter
\newcommand\balance[4]{%
  \Awd=#2\relax
  \Bwd=#4\relax
  \ABwd=\dimexpr\Awd+\Bwd\relax
  \edef\ABcnt{\strip@pt\ABwd}
  \divide\Awd by \expandafter\truncdec\ABcnt\relax
  \divide\Bwd by \expandafter\truncdec\ABcnt\relax
  \edef\Apct{\strip@pt\Awd}%
  \edef\Bpct{\strip@pt\Bwd}%
  \par\noindent
  \begin{minipage}[t]{\Apct\usablewidth}
    \parindent=\svparindent#1\end{minipage}%
  \hfill
  \begin{minipage}[t]{\Bpct\usablewidth}
    \parindent=\svparindent#3\end{minipage}%
  \bigskip
}
\makeatother
\begin{document}
\countwidth{\X}{\Xwd}{This is a test of blah bla blah.
This is a test of blah bla blah.

This is a test of blah bla blah.
This is a test of blah bla blah.
This is a test of blah bla blah.
This is a test of blah bla blah.}

\countwidth{\Y}{\Ywd}{This is a test of blah bla blah.
This is a test of blah bla blah.

This is a test of blah bla blah.}

\balance{\X}{\Xwd}{\Y}{\Ywd}

\countwidth{\Y}{\Ywd}{This is a test of blah bla blah.
This is a test of blah bla blah.

This is a test of blah bla blah.
This is a test of blah bla blah.
This is a test of blah bla blah.
This is a test of blah bla blah.
This is a test of blah bla blah.
This is a test of blah bla blah.
This is a test of blah bla blah.
This is a test of blah bla blah.

This is a test of blah bla blah.
This is a test of blah bla blah.
This is a test of blah bla blah.
This is a test of blah bla blah.
This is a test of blah bla blah.
This is a test of blah bla blah.
This is a test of blah bla blah.
This is a test of blah bla blah.}

\balance{\X}{\Xwd}{\Y}{\Ywd}

\countwidth{\Y}{\Ywd}{This is a test of blah bla blah.
This is a test of blah bla blah.

This is a test of blah bla blah.
This is a test of blah bla blah.
This is a test of blah bla blah.
This is a test of blah bla blah.

This is a test of blah bla blah.
This is a test of blah bla blah.

This is a test of blah bla blah.

This is a test of blah bla blah.
This is a test of blah bla blah.
This is a test of blah bla blah.}

\balance{\X}{\Xwd}{\Y}{\Ywd}

\end{document}


text:
Q: Should an ending semicolon be underlined? Should the semicolon at the end of an underlined heading also be underlined?

A: Why are you underlining text?  In HTML parlance, adhering punctuation marks are not placed inside of a link.  For example:

This is a very useful link; use it when you want to find stuff.

Underlining text, to me, seems  to be an anachronism that goes back to the typewriter.

A: In the good ol' days of the typewriter, we would carefully avoid underlining punctuation marks, esp., the period, comma, colon, semicolon, etc., because all or part of the punctuation mark would be obscured by the underline.

A: The general rule seems to be to include the punctuation in the underlined text only if it is an integral part of the final word. This would include initialisms such as U.S. and special cases such as the musical Oklahoma!
Otherwise, if the punctuation is simply to end the piece of text — such as a period, semi-colon, and so on — it should not be underlined.

A: Perhaps I do this wrong in my own writing, but I do not underline punctuation (comma, period, exclamation point, question mark, colon, semicolon, etc) when the preceding word is underlined unless that punctuation mark is part of the title, as in Oklahoma! or Stomp!.
Underlining text is certainly not an  "anachronism that goes back to the typewriter" because in MLA (Modern Language Association) format, APA (American Psychological Association) format, etc, underlining is one of the several ways specified to refer to books.

A:
Underlining text is certainly not an "anachronism that goes back to the typewriter" because in MLA (Modern Language Association) format, APA (American Psychological Association) format, etc, underlining is one of the several ways specified to refer to books.

I realize this topic is old but I did just want to post an update for anyone who comes across this- official MLA guidelines now prefer italicized book titles instead of underlined, unless someone is writing by hand, in which case underlining may be used.

A: As I learned in Typing in both high school and Business School -- you do not underline punctuation!  You end the underline under the last word, unless it is a title.  Where did "anachronism that goes back to typewriter" person pick up their knowledge -- Twitter?


text:
Q: Can I create a standalone .exe installer for a Java application with Inno Setup? Can all those steps be accomplished with Inno Setup or do I need additional software?

*

*Create a standalone .exe installer for a Java application (either a main JAR plus libraries or a Uber JAR)

*Bundle a JRE

*Create a Desktop shortcut so users can start the application manually if necessary

*Set up the application to run on startup

The answer could be either "yes" or "no, you would need the following additional software...".
Unless it's considered too broad a basic script would be appreciated too, but this is optional.

A: Instead of INNO setup, I use NSIS (https://sourceforge.net/projects/nsis/), it's open source software, and very powerful, you can use script.

*

*Create a standanlone .exe installer for a Java application (either a main JAR plus libraries or a Uber JAR)
A: Yes, you need additional software like Launch4j(http://launch4j.sourceforge.net/) , or if you use Eclipse or IDEA there is built-in tools to create executable application

*Bundle a JRE
A: Yes, use NSIS script you can bundle JRE installation

*Create a Desktop shortcut so users can start the application manually if necessary
A: Yes, use NSIS script you can Create a Desktop shortcut

*Set up the application to run on startup
A: Yes, NSIS script you can write  windows registry. depends on where you put, Programs defined in Run, RunOnce or StartUp will be loaded in following order:
HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce
HKLM\Software\Microsoft\Windows\CurrentVersion\Run
HKCU\Software\Microsoft\Windows\CurrentVersion\Run
StartUp Folder
HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce


text:
Q: How to add column if not exists on PostgreSQL? Question is simple. How to add column x to table y, but only when x column doesn't exist  ? I found only solution here how to check if column exists.
SELECT column_name
FROM information_schema.columns
WHERE table_name='x' and column_name='y';

A: With Postgres 9.6 this can be done using the option if not exists
ALTER TABLE table_name ADD COLUMN IF NOT EXISTS column_name INTEGER;

A: For those who use Postgre 9.5+(I believe most of you do), there is a quite simple and clean solution
ALTER TABLE if exists <tablename> add if not exists <columnname> <columntype>

A: Postgres 9.6 added ALTER TABLE tbl ADD COLUMN IF NOT EXISTS column_name.
So this is mostly outdated now. You might use it in older versions, or a variation to check for more than just the column name.

CREATE OR REPLACE function f_add_col(_tbl regclass, _col  text, _type regtype)
  RETURNS bool
  LANGUAGE plpgsql AS
$func$
BEGIN
   IF EXISTS (SELECT FROM pg_attribute
              WHERE  attrelid = _tbl
              AND    attname  = _col
              AND    NOT attisdropped) THEN
      RETURN false;
   ELSE
      EXECUTE format('ALTER TABLE %s ADD COLUMN %I %s', _tbl, _col, _type);
      RETURN true;
   END IF;
END
$func$;

Call:
SELECT f_add_col('public.kat', 'pfad1', 'int');

Returns true on success, else false (column already exists).
Raises an exception for invalid table or type name.
Why another version?

*

*This could be done with a DO statement, but DO statements cannot return anything. And if it's for repeated use, I would create a function.

*I use the object identifier types regclass and regtype for _tbl and _type which a) prevents SQL injection and b) checks validity of both immediately (cheapest possible way). The column name _col has still to be sanitized for EXECUTE with quote_ident(). See:

*

*Table name as a PostgreSQL function parameter

*format() requires Postgres 9.1+. For older versions concatenate manually:
  EXECUTE 'ALTER TABLE ' || _tbl || ' ADD COLUMN ' || quote_ident(_col) || ' ' || _type;

*You can schema-qualify your table name, but you don't have to.
You can double-quote the identifiers in the function call to preserve camel-case and reserved words (but you shouldn't use any of this anyway).

*I query pg_catalog instead of the information_schema. Detailed explanation:

*

*How to check if a table exists in a given schema

*Blocks containing an EXCEPTION clause are substantially slower.
This is simpler and faster. The manual:

Tip
A block containing an EXCEPTION clause is significantly more
expensive to enter and exit than a block without one.
Therefore, don't use EXCEPTION without need.

A: Following select query will return true/false, using EXISTS() function.

EXISTS(): The argument of EXISTS is an arbitrary SELECT statement, or
subquery. The subquery is evaluated to determine whether it returns
any rows. If it returns at least one row, the result of EXISTS is
"true"; if the subquery returns no rows, the result of EXISTS is
"false"

SELECT EXISTS(SELECT  column_name
                FROM  information_schema.columns
               WHERE  table_schema = 'public'
                 AND  table_name = 'x'
                 AND  column_name = 'y');

and use the following dynamic SQL statement to alter your table
DO
$$
BEGIN
IF NOT EXISTS (SELECT column_name
                 FROM  information_schema.columns
                WHERE  table_schema = 'public'
                  AND  table_name = 'x'
                  AND  column_name = 'y') THEN
ALTER TABLE x ADD COLUMN y int DEFAULT NULL;
ELSE
RAISE NOTICE 'Already exists';
END IF;
END
$$

A: Here's a short-and-sweet version using the "DO" statement:
DO $$
    BEGIN
        BEGIN
            ALTER TABLE <table_name> ADD COLUMN <column_name> <column_type>;
        EXCEPTION
            WHEN duplicate_column THEN RAISE NOTICE 'column <column_name> already exists in <table_name>.';
        END;
    END;
$$

You can't pass these as parameters, you'll need to do variable substitution in the string on the client side, but this is a self contained query that only emits a message if the column already exists, adds if it doesn't and will continue to fail on other errors (like an invalid data type).
I don't recommend doing ANY of these methods if these are random strings coming from external sources.  No matter what method you use (client-side or server-side dynamic strings executed as queries), it would be a recipe for disaster as it opens you to SQL injection attacks.

A: the below function will check the column if exist return appropriate message else it will add the column to the table.
create or replace function addcol(schemaname varchar, tablename varchar, colname varchar, coltype varchar)
returns varchar
language 'plpgsql'
as
$$
declare
    col_name varchar ;
begin
      execute 'select column_name from information_schema.columns  where  table_schema = ' ||
      quote_literal(schemaname)||' and table_name='|| quote_literal(tablename) || '   and    column_name= '|| quote_literal(colname)
      into   col_name ;

      raise info  ' the val : % ', col_name;
      if(col_name is null ) then
          col_name := colname;
          execute 'alter table ' ||schemaname|| '.'|| tablename || ' add column '|| colname || '  ' || coltype;
      else
           col_name := colname ||' Already exist';
      end if;
return col_name;
end;
$$

A: This is basically the solution from sola, but just cleaned up a bit.  It's different enough that I didn't just want to "improve" his solution (plus, I sort of think that's rude).
Main difference is that it uses the EXECUTE format.  Which I think is a bit cleaner, but I believe means that you must be on PostgresSQL 9.1 or newer.
This has been tested on 9.1 and works.  Note: It will raise an error if the schema/table_name/or data_type are invalid.  That could "fixed", but might be the correct behavior in many cases.
CREATE OR REPLACE FUNCTION add_column(schema_name TEXT, table_name TEXT,
column_name TEXT, data_type TEXT)
RETURNS BOOLEAN
AS
$BODY$
DECLARE
  _tmp text;
BEGIN

  EXECUTE format('SELECT COLUMN_NAME FROM information_schema.columns WHERE
    table_schema=%L
    AND table_name=%L
    AND column_name=%L', schema_name, table_name, column_name)
  INTO _tmp;

  IF _tmp IS NOT NULL THEN
    RAISE NOTICE 'Column % already exists in %.%', column_name, schema_name, table_name;
    RETURN FALSE;
  END IF;

  EXECUTE format('ALTER TABLE %I.%I ADD COLUMN %I %s;', schema_name, table_name, column_name, data_type);

  RAISE NOTICE 'Column % added to %.%', column_name, schema_name, table_name;

  RETURN TRUE;
END;
$BODY$
LANGUAGE 'plpgsql';

usage:
select add_column('public', 'foo', 'bar', 'varchar(30)');

A: Can be added to migration scripts invoke function and drop when done.
create or replace function patch_column() returns void as
$$
begin
    if exists (
        select * from information_schema.columns
            where table_name='my_table'
            and column_name='missing_col'
     )
    then
        raise notice 'missing_col already exists';
    else
        alter table my_table
            add column missing_col varchar;
    end if;
end;
$$ language plpgsql;

select patch_column();

drop function if exists patch_column();

A: In my case, for how it was created reason it is a bit difficult for our migration scripts to cut across different schemas.
To work around this we used an exception that just caught and ignored the error. This also had the nice side effect of being a lot easier to look at.
However, be wary that the other solutions have their own advantages that probably outweigh this solution:
DO $$
BEGIN
  BEGIN
    ALTER TABLE IF EXISTS bobby_tables RENAME COLUMN "dckx" TO "xkcd";
  EXCEPTION
    WHEN undefined_column THEN RAISE NOTICE 'Column was already renamed';
  END;
END $$;

A: Simply check if the query returned a column_name.
If not, execute something like this:
ALTER TABLE x ADD COLUMN y int;

Where you put something useful for 'x' and 'y' and of course a suitable datatype where I used  int.

A: You can do it by following way.
ALTER TABLE tableName drop column if exists columnName;
ALTER TABLE tableName ADD COLUMN columnName character varying(8);

So it will drop the column if it is already exists. And then add the column to particular table.


text:
Q: PHP date adding in DateTime object does not work Try to do:
$datetime = new DateTime();
$onehour = new DateInterval('PT1H');
$datetime->add($onehour);
$timestamp = $datetime->date;

echo $timestamp; // nothing

What's wrong with it?

A: There's no such date property in the DateTime object.
Instead you can use format() to get the date formatted according to given format.
echo $datetime->format('Y-m-d H:i:s');

or use getTimestamp() to get the Unix timestamp:
echo $datetime->getTimestamp();

http://php.net/manual/en/datetime.format.php
http://php.net/manual/en/datetime.gettimestamp.php

A: You have to use :
DateInterval::createFromDateString("1 hours");

Instead of :
new DateInterval('PT1H');

As Given Below Code :
$onehour = DateInterval::createFromDateString("1 hours");
$date = new DateTime();
$date->add($onehour);
echo $date->format("Y-m-d H:i:s");


text:
Q: Search inside an array of objects under an object property for a string assistance in JavaScript I am using a JavaScript library that has some code that expects a simple flat array of items like this...
var items = [
    'item 1',
    'item 2',
    'item 3',
];

This is too limited for my project needs so I am editing the library to accept an array of object instead like this...
var items = [
    {
        id: 1,
        name: 'Item 1',
        image: 'img 1',
    },
    {
        id: 2,
        name: 'Item 2',
        image: 'img 2',
    },
    {
        id: 3,
        name: 'Item 3',
        image: 'img 3',
    },
];

The library calls some code like this...
if (_helpers.inArray(val, this.options.items) || (val === '')) {
    return val;
}

It check to see if a string is in the items array.
Because my items array is no longer a simple string value and is instead an object now.  This breaks this part of the library code.
The code for the function it calls is this...
var _helpers = {

    inArray: function(val, arr) {
        return ($.inArray(val, arr) !== -1);
    },

};

So I need some help in making my own _helpers.inArray(val, this.options.items) function which will check for a string value in an array of objects under the object property name
Any help appreciated

A: Could be something like this?
var _helpers = {
    inArray: function(val, arr) {
        for (var i = 0; i < arr.length; i++){
            if (arr[i].name === val)
                return true;
        }
        return false;
    },
};

https://jsfiddle.net/z54qnukd/1/

A: Try mapping your array of objects back to the simple format:
var _helpers = {

    inArray: function(val, arr) {
        var mappedArr = $.map( items, function(item, index) {
            return item.name;
        });
        return ($.inArray(val, mappedArr) !== -1);
    },

};

https://jsbin.com/tihuyuquni/edit?html,output


text: Q: Photo rotate and crop image swift iOS I want when user tap on image option appears select from gallery or camera when user select on either gallery or camera after selection I want user can adjust photo through cropping or rotating so anyone help me how I can achieve this functionality.


text:
Q: Percentage sorting on a column in jqGrid Have the following in my jqGrid:
colModel.push({ name: 'pcc2008-2007', index: 'pcc0807', width: 100, align: "Right",
    sorttype: "float", formatter: "number", resizable: false,
    formatter: function (cellvalue, options, rowObject) {
        return percentageChange(rowObject['vol08'], rowObject['vol07'], 4);
    }
});

The formatter works perfectly, returning a value (with a prefixing %) at the end, but when I come to click on the column header on the grid, the results are not sorted what-so-ever.
I've added an "unformatter" function, which simply replaces the "%" with nothing to see if that produced the correct sort, but likewise the sort just doesn't implement correctly at all.
Can anyone explain what I'm doing wrong please?
** EDIT **
function percentageChange(endYear, startYear, duration) {
    var p1 = Math.abs((endYear - startYear) / Math.abs(startYear) * 100);
    if (p1 == Number.POSITIVE_INFINITY || p1 == Number.NEGATIVE_INFINITY) { return '0'; }
    if (isNaN(p1)) { return '0'; }
    else { return Math.round(p1 * 100) / 100; }
}

** EDI2 **
Entire jqGrid calling here:
$("#list2").jqGrid({
    datastr: formattedBrandData,
    datatype: "jsonstring",
    colModel: colModel,
    height: 'auto',
    width: 1000,
    loadonce: true,
    sortable:  true,
    gridview: true,
    shrinkToFit: false,
    viewrecords: true,
    rowNum: 100,
    gridComplete: function (index, colindex, sortorder) {

        var aaa = $("#list2").jqGrid('getRowData');
        formattedBrandData = aaa;
        drawChart();

        var rowIDs = jQuery("#list2").getDataIDs();
        for (var i = 0; i < rowIDs.length; i = i + 1) {
            if (i == 0) { var trElement = jQuery("#" + rowIDs[i], $('#list2')); trElement.removeClass('ui-widget-content'); trElement.addClass('resultsColour1'); }
            if (i == 1) { var trElement = jQuery("#" + rowIDs[i], $('#list2')); trElement.removeClass('ui-widget-content'); trElement.addClass('resultsColour2'); }
            if (i == 2) { var trElement = jQuery("#" + rowIDs[i], $('#list2')); trElement.removeClass('ui-widget-content'); trElement.addClass('resultsColour3'); }
            if (i == 3) { var trElement = jQuery("#" + rowIDs[i], $('#list2')); trElement.removeClass('ui-widget-content'); trElement.addClass('resultsColour4'); }
            if (i == 4) { var trElement = jQuery("#" + rowIDs[i], $('#list2')); trElement.removeClass('ui-widget-content'); trElement.addClass('resultsColour5'); }
            if (i == 5) { var trElement = jQuery("#" + rowIDs[i], $('#list2')); trElement.removeClass('ui-widget-content'); trElement.addClass('resultsColour6'); }
            if (i == 6) { var trElement = jQuery("#" + rowIDs[i], $('#list2')); trElement.removeClass('ui-widget-content'); trElement.addClass('resultsColour7'); }
            if (i == 7) { var trElement = jQuery("#" + rowIDs[i], $('#list2')); trElement.removeClass('ui-widget-content'); trElement.addClass('resultsColour8'); }
        }
    },

    loadComplete: function () {

    },

    jsonReader: {
        repeatitems: false,
        root: function (obj) {
            return obj;
        },
        onComplete: function (data, response) {

        }
    }
});

A: I think you should better use
formatter: 'currency', formatoptions: {suffix: '%'}, sorttype: 'currency'

See the demo:

UPDATED: There are some problems in the code which you posted.
The first one is the gridComplete callback which will be called by jqGrid. jqGrid never call gridComplete with additional parameters, so index, colindex and sortorder parameters of your callback will be always undefined. You should remove the parameters.
The second problem is design problem. You use datatype: "jsonstring" together with datastr: formattedBrandData which provide the data. The data will be read once and the data will be saved in the internal data array with the same properties as the name property of the colModel. So it will be more effective and more easy to fill 'pcc2008-2007' property inside of formattedBrandData array. You will calculate the value once and will just use the float retult of the calculation. Later you can use predefined currency formatter (see my answer above) directly only to add % at the end of the float value.
If you use some local datatype (inclusive datatype: "jsonstring") you should never use index other as name. It's better just remove any index definition from the colModel in the case it will be used the value from name property. Different values of name and index are supported and can be helpful only in case of datatype: "json" or datatype: "xml" where the server code in responsible for the sorting of data.
You should reduce the number of changes of the grid (or any other changes of the data on the HTML page) inside of gridComplete or loadComplete whenever it's possible. In case of one change of one element the web browser have to recalculate position of all other existing elements on the page. So the changes of elements on the page could be expensive. On the other side the usage of gridview: true together with formatters, rowattr callback (see here) or cellattr allows to modify the HTML fragment of the grid before it will be placed on the page. In the way you get the best performance. See the answer for the corresponding code example where rowattr callback is demonstrated.
The last remark about the performance. The code jQuery("#" + rowIDs[i], $('#list2')) is slowly as jQuery("#" + rowIDs[i]). The reason is that jQuery("#" + rowIDs[i]) just use id which is indexed. So it works quickly. On the other side the code jQuery("#" + rowIDs[i], $('#list2')) uses explicit context which don't allows to use the index of the HTML page. So the simple scan will be used for the implementation which will be slow.


text:
Q: Visual Basic Console application only loops once new to everything here, i was messing around with VB 2012 when i found out my program only loops once.
Help would be appreciated.
Module Module1
    Dim i As Integer = 0

    Sub Main()
        While i < 3
            i = i + 1
            Console.WriteLine(i)
            Console.ReadLine()
        End While
        End
    End Sub
End Module

EDIT:
Yeah, the people here are right, with that code it is impossible, so i screwed around a bit more and came up with a solution
Module Module1
    Dim i As Integer = 0
    Sub Main()
        While i < 3
            i = i + 1
            Console.WriteLine(i)
            System.Threading.Thread.Sleep(1000)
        End While
    End Sub
End Module

A: Why have you put extra End? Are you sure that's not the culprit.
While i < 3
    i = i + 1
    Console.WriteLine(i)
    Console.ReadLine()
End While
End  <-- not required.


text:
Q: Ripple effect not working in bootstrap material design I am using Material Design for Bootstrap by fezvrasta.
I am able to have all color and other building blocks but ripple effect on buttons, textbox and others are not working.
In search bar, underline for ripple effect is there but I am not getting the same. Buttons or links do not have ripple effect.

  <title>Materialize Demo</title>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="css/bootstrap.css">
  <link rel="stylesheet" href="css/bootstrap-material-design.css">
  <link rel="stylesheet" href="css/ripples.css">
  <link rel="stylesheet" href="css/style.css">

        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">

        </button>
        Web Technology Classes

            Learn

Basics of Web

Web Design Principles

HTML

CSS

JavaScript

XML

PHP

MySQL

            Practicals

HTML

CSS

JavaScript

XML

PHP

MySQL

            Q & A

Basics of Web

Web Design Principles

HTML

CSS

JavaScript

XML

PHP

MySQL

        <form class="navbar-form navbar-right">

            <input type="text" class="form-control col-md-8" placeholder="Search">

        </form>

      Google Adsense (Manual Responsive) 728x90 Leaderboard + 468x60 Small Leaderboard + 180x150 Small Rectangle

Basics of Web

            Concept of WWW, Internet and WWW, HTTP Protocol : Request and Response, Web browser and Web servers, Features of Web 2.0

Web Design Principles

            Concepts of effective web design, Web design issues including Browser, Bandwidth and Cache, Display resolution

Google Adsense

            300x250 Adsense Content

300x250 Adsense Content

300x250 Adsense Content

300x250 Adsense Content

HTML

            Basics of HTML, formatting and fonts, commenting code, color, hyperlink, lists, tables, images, forms, XHTML, Meta tags, Character entities, frames

CSS

            Need for CSS, introduction to CSS, basic syntax and structure, using CSS, background images, colors and properties, manipulating texts, using fonts, borders and boxes

Content.Ad

            300x250 Advt. Content

300x250 Advt. Content

300x250 Advt. Content

300x250 Advt. Content

300x250 Advt. Content

JavaScript

            Client side scripting with JavaScript, variables, functions, conditions, loops and repetition, Pop up boxes, Advance JavaScript: Javascript and objects, JavaScript own objects, the DOM

XML

            Introduction to XML, uses of XML, simple XML, XML key components, DTD and Schemas, Using XML with application. Transforming XML using XSL and XSLT

Content.Ad

            300x250 Advt. Content

300x250 Advt. Content

300x250 Advt. Content

300x250 Advt. Content

300x250 Advt. Content

PHP

            Introduction and basic syntax of PHP, decision and looping with examples, PHP and HTML, Arrays, Functions, Browser control and detection, string, Form processing, Files

MySQL

            Basic commands with PHP examples, Connection to server, creating database, selecting a database, listing database, listing table names, creating a table, inserting data

Content.Ad

            300x250 Advt. Content

300x250 Advt. Content

300x250 Advt. Content

300x250 Advt. Content

300x250 Advt. Content

      Google Adsense (Manual Responsive) 728x90 Leaderboard + 468x60 Small Leaderboard + 180x150 Small Rectangle

Please refer this codepen.

A: You need to initialize the material design plugin like:
$.material.init();

also the codepen is missing CDN's to jQuery and Bootstrap's JavaScript. Your local references in won't work there.
Updated codepen


text:
Q: How to search 2 words from 2 table database Is it possible to search for 2 words in 2 tables?
For example, in an input form, I'm searching for arrow 01
The system will search for arrow in the table film, and 01 in the table episode.
Space is the separator.

A: Why not?, You can split the input string using explode($string, " ") then create 2 SQL queries to search database. please try yourself before asking.

A: You can do that. once the string is entered by the user, split the string based on the separator(int your case space) then store those words in array or variables. After that you can perform the process for making connection with the database as many times as the words are there or databases you need to refer


text:
Q: Stanford Topic Modeling Toolbox: Exception I'm trying to work with the Stanford Topic Modeling Toolbox. I downloaded the "tmt-0.4.0.jar"-File from here: http://nlp.stanford.edu/software/tmt/tmt-0.4/ and I tried to examples.
Example 0 and 1 worked fine, but trying example 2 (no code-changes), I receive the following exception:

[cell] loading pubmed-oa-subset.csv.term-counts.cache.70108071.gz
  [Concurrent] 32 permits Exception in thread "Thread-3"
  java.lang.ArrayIndexOutOfBoundsException: -1  at
  scalanlp.stage.text.TermCounts$class.getDF(TermFilters.scala:64)  at
  scalanlp.stage.text.TermCounts$$anon$2.getDF(TermFilters.scala:84)    at
  scalanlp.stage.text.TermMinimumDocumentCountFilter$$anonfun$apply$4$$anonfun$apply$5$$anonfun$apply$6.apply(TermFilters.scala:172)
    at
  scalanlp.stage.text.TermMinimumDocumentCountFilter$$anonfun$apply$4$$anonfun$apply$5$$anonfun$apply$6.apply(TermFilters.scala:172)
    at scala.collection.Iterator$$anon$22.hasNext(Iterator.scala:390)   at
  scala.collection.Iterator$$anon$22.hasNext(Iterator.scala:388)    at
  scala.collection.Iterator$class.foreach(Iterator.scala:660)   at
  scala.collection.Iterator$$anon$22.foreach(Iterator.scala:382)    at
  scala.collection.IterableViewLike$Transformed$class.foreach(IterableViewLike.scala:41)
    at
  scala.collection.IterableViewLike$$anon$5.foreach(IterableViewLike.scala:82)
    at
  scala.collection.TraversableOnce$class.size(TraversableOnce.scala:104)
    at
  scala.collection.IterableViewLike$$anon$5.size(IterableViewLike.scala:82)
    at
  scalanlp.stage.text.DocumentMinimumLengthFilter.filter(DocumentFilters.scala:31)
    at
  scalanlp.stage.text.DocumentMinimumLengthFilter.filter(DocumentFilters.scala:28)
    at
  scalanlp.stage.generic.Filter$$anonfun$apply$1.apply(Filter.scala:38)
    at
  scalanlp.stage.generic.Filter$$anonfun$apply$1.apply(Filter.scala:38)
    at scala.collection.Iterator$$anon$22.hasNext(Iterator.scala:390)   at
  edu.stanford.nlp.tmt.data.concurrent.Concurrent$$anonfun$map$2.apply(Concurrent.scala:100)
    at
  edu.stanford.nlp.tmt.data.concurrent.Concurrent$$anonfun$map$2.apply(Concurrent.scala:88)
    at
  edu.stanford.nlp.tmt.data.concurrent.Concurrent$$anon$4.run(Concurrent.scala:45)

Why do I receive this exception, and how can this be fixed?
Thanks a lot for your help!
PS: The code is the same as in example 2 of the website:
// Stanford TMT Example 2 - Learning an LDA model
// http://nlp.stanford.edu/software/tmt/0.4/

// tells Scala where to find the TMT classes
import scalanlp.io._;
import scalanlp.stage._;
import scalanlp.stage.text._;
import scalanlp.text.tokenize._;
import scalanlp.pipes.Pipes.global._;

import edu.stanford.nlp.tmt.stage._;
import edu.stanford.nlp.tmt.model.lda._;
import edu.stanford.nlp.tmt.model.llda._;

val source = CSVFile("pubmed-oa-subset.csv") ~> IDColumn(1);

val tokenizer = {
  SimpleEnglishTokenizer() ~>            // tokenize on space and punctuation
  CaseFolder() ~>                        // lowercase everything
  WordsAndNumbersOnlyFilter() ~>         // ignore non-words and non-numbers
  MinimumLengthFilter(3)                 // take terms with >=3 characters
}

val text = {
  source ~>                              // read from the source file
  Column(4) ~>                           // select column containing text
  TokenizeWith(tokenizer) ~>             // tokenize with tokenizer above
  TermCounter() ~>                       // collect counts (needed below)
  TermMinimumDocumentCountFilter(4) ~>   // filter terms in <4 docs
  TermDynamicStopListFilter(30) ~>       // filter out 30 most common terms
  DocumentMinimumLengthFilter(5)         // take only docs with >=5 terms
}

// turn the text into a dataset ready to be used with LDA
val dataset = LDADataset(text);

// define the model parameters
val params = LDAModelParams(numTopics = 30, dataset = dataset,
  topicSmoothing = 0.01, termSmoothing = 0.01);

// Name of the output model folder to generate
val modelPath = file("lda-"+dataset.signature+"-"+params.signature);

// Trains the model: the model (and intermediate models) are written to the
// output folder.  If a partially trained model with the same dataset and
// parameters exists in that folder, training will be resumed.
TrainCVB0LDA(params, dataset, output=modelPath, maxIterations=1000);

// To use the Gibbs sampler for inference, instead use
// TrainGibbsLDA(params, dataset, output=modelPath, maxIterations=1500);

A: The answer has been posted by the author of the tool. Please have a look here.
This usually happens when you have a stale .cache file - unfortunately the
error message isn't particularly useful.  Try deleting cache in the run
folder and running again.
https://lists.cs.princeton.edu/pipermail/topic-models/2012-July/001979.html


text:
Q: Javascript code work fine on google chrome but not working on mozilla firefox I have a slider on my website but it is working fine on google chrome but not working on mozilla firefox. Please help me to fix this problem.
javascript code:

html code:

I recently booked a tour with
Green Apple Travel around Kathmandu. This is the second time I use their
services.
I have traveled worldwide for the last 50 years and have been in
business with dozens of t...

Client Name

I recently booked a tour with
Green Apple Travel around Kathmandu. This is the second time I use their
services.
I have traveled worldwide for the last 50 years and have been in
business with dozens of t...

Client Name

I recently booked a tour with
Green Apple Travel around Kathmandu. This is the second time I use their
services.
I have traveled worldwide for the last 50 years and have been in
business with dozens of t...

Client Name

Slider is working perfectly on chrome but when i tested it on mozilla firefox it is not working and shows blank on it. I hope someone will be available for the help. Thank you in advance.


text:
Q: How to check if the webpage was loaded (without JS)? How can I check if user has loaded the webpage if the JavaScript is disabled (otherwise I can just send a request on page ready)?

A: You can put a code in the footer that will make the request, for example:
<img src="http://<example.url>/?user_ip=<?php echo $_SERVER['REMOTE_ADDR']&<any other data needed>" style="display:none" />

When a user loads the page, he will ping the example.url and you can store and process further this request.


text:
Q: How to use std::enable_if with a condition which itself depends on another condition? I have a situation where I need to distinguish two overloads, say, foo, using std::enable_if. The condition given to std::enable_if itself depends on a dependent type of the template parameter of foo.
What is the best way to express this using std::enable_if?
The following test code is what I have so far. I realize there are possibly better ways besides std::enable_if to achieve the behavior I want in the test code. However, the following is a simplified version of my use case which itself requires std::enable_if.
#include <type_traits>
#include <cassert>

struct bar
{
  using baz = int;
};

template<class T> struct is_bar : std::false_type {};
template<> struct is_bar<bar> : std::true_type {};

template<class Bar>
struct baz_type
{
  using type = typename Bar::baz;
};

template<class T>
typename std::enable_if<
  std::is_integral<
    typename baz_type<T>::type
  >::value,
  int
>::type
  foo(T x)
{
  return 7;
}

template<class T>
typename std::enable_if<
  !is_bar<T>::value,
  int
>::type
  foo(T x)
{
  return 13;
}

int main()
{
  assert(foo(bar()) == 7);
  assert(foo(0) == 13);

  return 0;
}

The compiler output:
$ g++ --version ; echo ; g++ -std=c++11 repro.cpp
g++ (Ubuntu 4.8.2-19ubuntu1) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

repro.cpp: In instantiation of 'struct baz_type<int>':
repro.cpp:29:3:   required by substitution of 'template<class T> typename std::enable_if<std::is_integral<typename baz_type<Bar>::type>::value, int>::type foo(T) [with T = int]'
repro.cpp:49:3:   required from here
repro.cpp:18:33: error: 'int' is not a class, struct, or union type
   using type = typename Bar::baz;

This code does not compile because the enable_if used in the first overload of foo depends on the nested type T::baz. Because int does not have this nested type, the code is illegal.
What is the correct way to express what I want?

A: While I wrote the below on Coliru, @dyp already showed the important part in his comment. The following is what will work and what is, IMHO, quite readable:
template<
    class T,
    typename=typename std::enable_if<is_bar<T>::value>::type,
    typename=typename std::enable_if<std::is_integral<typename baz_type<T>::type>::value>::type
>
int foo(T x)
{
  return 7;
}

template<
    class T,
    typename=typename std::enable_if<!is_bar<T>::value>::type
>
int foo(T x)
{
  return 13;
}

Live example
With C++14, one would use std::enable_if_t to make it even shorter.


text:
Q: Animated series bases on human-operated robots fighting bad robots I want to know the name of this very old cartoon series of maybe Chinese, Japanese or Korean origin IDK. I used to watch it when I was a kid around 2005.
It consists of human operated robots who fight evil when needed, the pilots used to go inside the robots to operate them. These two evil girls and a guy used to bring a different evil robot every time.
This was also a funny and serious series. And I remember the name of one robot being "shasha".  Among the professional fighter robot there was this stupid robot and the kid.


text:
Q: Codeigniter sessions errors and workarounds So after reading the documentation on the session library for CodeIgniter, I'm finding it rather confusing.
My problem has arisen from the need to store a few bits of information (a filename, a product ID and an array of colour IDs). I'm using flashdata for this bit.
I got a 502 error. Removing the set_flashdata() methods has stopped it, but I still need to send the data.
From what I understand, CI by default scrubs all data from superglobal arrays, so I can't use PHPs native sessions.
In addition, the documentation states the following:

A useful aspect of the session array is that you can add your own data
  to it and it will be stored in the user's cookie

This, I find quite confusing, PHP stores the session ID in the cookie, and the session data on the server. What does CI mean when it says it adds your own data to the cookie?
Surely I wanted this functionality I'd just store data in the cookie instead of using sessions?
Also, another part of the documentation states:

Cookies can only hold 4KB of data, so be careful not to exceed the
  capacity.
  The encryption process in particular produces a longer data string than the original so keep careful track of how much data you are storing.

Are they talking about storing my data in actual cookies? Or within the session? And how do I know if I'm using more than 4KB of data?? Is this per flashdata session? Or all data total?
So my questions (as bullet points), are:

*

*When using the session library, is data stored in the cookie, or an actual session?

*Why would I be getting a 502 error while using flashdata?

*How do I work out how much data I'm using

*Can the userdata() and flashdata() methods store different amounts of information?

*Is there anyway I can use CIs session library in conjunction with PHPs native sessions?

Any more information would be appreciated.
Many thanks

A: You seem to be confused about what a session even is or the difference between a cookie and a session.

*

*it's called the session library, and a session, because it's a server side session

*are you aware that php has an error log and you have an ability to find the specific error, in fact that's what you should have done.?

*you'll be fine unless you are trying to abuse the purpose of a session

*flashdata is for flash messages, userdata is for storing data that needs to be retrieved for other purposes. your question is meaningless even if answered.

*at the very top of the documentation "Note: The Session class does not utilize native PHP sessions. It generates its own session data, offering more flexibility for developers." I would advise against this, as it serves no purpose.


text:
Q: Adding a css classname to fullcalendar event to fill entire day with event I'm trying to add a classname 'fc-event-height-override' to my event so that a single event fills the entire day box.
{
       title: 'Sales Meeting',
       start: new Date(y, m, d, 10, 30),
       end: new Date(y, m, d, 11, 30),
       allDay: false,
       className: 'fc-event-height-overirde'
}

I can get the box to fill mostly but the top part is still visible. I have a Fiddle here that shows the day area isn't being completely filled with the event.
Here is some code for the calendar.

$(document).ready(function() {
  var date = new Date();
  var d = date.getDate();
  var m = date.getMonth();
  var y = date.getFullYear();

  var calendar = $('#calendar').fullCalendar({

    header: {
      left: 'prev,next today',
      center: 'title',
      right: 'month,agendaWeek,agendaDay'
    },
    eventRender: function(event, element, view) {
      var nextEventLeft = element.offset().left + element.width() + 5;
      element.parent().children().eq(element.index() + 1).css('left', nextEventLeft);
    },
    selectable: true,
    selectHelper: true,

    year: y,
    month: m,
    date: d,

    slotMinutes: 15,
    editable: true,

    events: [{
      title: 'Sales Meeting',
      start: new Date(y, m, d, 10, 30),
      end: new Date(y, m, d, 11, 30),
      allDay: false,
      className: 'fc-event-height-overirde'
    }]

  });

  console.log($('#calendar').html());

});
.fc-event-height-overirde {
  height: 100px !important;
  opacity: 0.5
}


text:
Q: Java multiple input UPDATED
How can you by using this method (Collatz conjecture) to find the number with the highest number of operations between, say 4 and 230.
Any guidance appreciated.
public static void main(String[] args) {

    System.out.print("Enter a low integer ");
    Scanner input = new Scanner(System.in);
    int low = input.nextInt();
    System.out.print("Enter a high integer ");
    int number = input.nextInt();
    maxendurance(number);
}

public static int maxendurance(int number) {

    int count = 0;

    System.out.print("The number " + number);
   // need to loop this i suppose in relative to user input
    while (number != 1) {
        number = (number & 1) != 0 ? number * 3 + 1 : number >> 1;
        count++;
    }
    System.out.println(" has endurance: " + count);

    return number;
}

A: You will have to loop through all the numbers between low and high. Look into for-loops:
for(int number = low; number <= high; number++)
{
   // do something with number
}

Somehow you will need to execute a for every number within the loop (hint: pass it in as a parameter). Then keep track of the number with the highest count.
Oh, and please name your methods more clearly than a and b - nobody will understand what they do without going through the code.

A: First of all, move the input out of method a:
public static void main(String[] args) {
    System.out.print("Enter an integer to be checked: ");
    Scanner input = new Scanner(System.in);
    int number = input.nextInt();
    a(number);
    b();
}

public static int a(int number) {
    int count = 0;
    System.out.print("The number " + number);
    [...]

Then you can use a simple for loop to iterate between low and high:
int bestNumber = -1;
int bestScore = -1;
for (int i = low; i <= high; i++) {
    int score = a(i);
    if (score < bestScore) {
        bestNumber = i;
        bestScore = score;
    }
}

The result can then be found in bestNumber.

A: I am going to suggest a more advanced approach, in case relevant and incase anyone comes upon this. If you are concerned about time efficiency, Memoization or Dynamic Programming can help you, especially inverse dragon recursion.
I'll give you a hint. If you need more, just comment.
Take 3 for example. One transformation T has T(3)=10. If prior you had found it takes v transformations to take 10 to 1 and you stored (10,v) in a map, then instantly you know that it takes (v+1) steps to get 3 to 1.


text:
Q: iText 2 replace text in paragraph with different font I am working with iText. I am building a simple "parser" for reading data from database(JSON) and a template(pdf structure) in XML to create a PDF dynamically. I want to change some words in paragraph with different font.
For example if I had a paragraph with text  "Hello world", I want to change the word "world" in bold or italic. Is this any way to do this with iText2.
**XML template:**
<paragraph type="italic" font="16"> Hello @@databaseParam</paragraph>
**Database value:**
{
"databaseParam":"world"
}
**Result:**
PDF with paragraph Hello world with all text italic and font 16

This is for moment what i did, i just need to change "world"(data read from db) with diffent font(maybe bold with 20 font).