text:
Q: adding googlemaps to angular-cli I am trying to implement googlemaps to my angular-cli project. I know that there is a 'angular2-google-maps' component (github), but I need routes and more custom features.
I found two ways on implementing the map into an project:
1: stackoverflow: with a google api loader - but I couldn't figure out how to initialise google-maps...
2: with an DefinitelyTyped google.maps.d.ts.
I installed it with --global (since ambient ist deprecated..) into my project and added the index.d.ts (for global) to the src/typings.d.ts and can use "google.map.." in an .ts file:
  myLatLng = {lat: -25.363, lng: 131.044};
  map:any;

  constructor() {
    this.map = new google.maps.Map(document.getElementById('map'), {
      center: this.myLatLng,
      zoom: 4
    });
  }

but if I build it with angular-cli it errors:
"ReferenceError: google is not defined"
any ideas?

A: Here a step by step guide to add a google maps component to angular-cli project.
Step1 : install google.maps from DefinitelyTyped:
typings i dt~google.maps --global --save

Step2 : if you have an older typings installed add
/// <reference path="../typings/index.d.ts" />

to your src/typings.d.ts
Step3 : generate new component
ng g component google-maps

Add the following code to:
.ts :
  height = '100px';
  myLatLng = {lat: -25.363, lng: 131.044};
  map:any;

  constructor(private googleApi:GoogleApiService) {}

  ngOnInit() {
    this.googleApi.initMap().then(() => {

      let latlng = new google.maps.LatLng(this.myLatLng.lat, this.myLatLng.lng);

      this.map = new google.maps.Map(document.getElementById('map'), {
        center: latlng,
        zoom: 4
      });

      new google.maps.Marker({
        position: latlng,
        map: this.map,
        title: 'Hello World!'
      });
    });
  }

.html :

Step4 : generate new service
ng g service google-maps/shared/google-api

Add GoogleApiService + HTTP_PROVIDERS to src/main.ts
code :
const API_KEY = '[insert your code]';
const url = 'https://maps.googleapis.com/maps/api/js?key='+ API_KEY +'&callback=initMap';

@Injectable()
export class GoogleApiService {
  private loadMap: Promise<any>;

  constructor(private http:Http) {
    this.loadMap = new Promise((resolve) => {
      window['initMap'] = () => {
        resolve();
      };
      this.loadScript()
    });
  }

  public initMap():Promise<any> {
    return this.loadMap;
  }

  private loadScript() {
    let script = document.createElement('script');
    script.src = url;
    script.type = 'text/javascript';

    if (document.body.contains(script)) {
      return;
    }
    document.getElementsByTagName('head')[0].appendChild(script);
  }
}

Maybe you need to delete some lines from the spec.ts files.
But then you can add the GoogleMapsComponent as a directive.

*

*it is super easy to expand with routes etc.
Maybe if I have time I upload a current version of my GoogleMapsComponent to github..


text:
Q: CodeIgniter - result_array in memory I don't know if this is a valid programming question. But there is something troubling my mind about CodeIgniter. Hope you guys with years of experience and wisdom can guide me.
Here is my story,
I am using CodeIgniter and MS SQL for a project. I am retrieving sales data that is 20M+ rows. Now, I managed to reduce the result by creating aggregated data and store in in the table. Still I get the out of memory error.
Now, I am thinking, does CodeIgniter's result_array() function store all the result to the memory? Am I right with this assumption?
If yes, can I load it instead in chunks? let's say I load top 100 rows in memory, and then delete that 100 rows, and then load another 100 rows? So PHP would not fill my memory with results.
By the way, I already use pager for the detailed data. This question is needed for a specific purpose. I want to show a summary report. I am using jQwidgets Pivot Grid
I don't know if that makes sense. But that is what I am thinking. I want to understand what is happening. Or maybe you can suggest what other options or design I can make to handle large data in PHP.
Hope I explained myself clearly. Thankyou very much. I would appreciate all your suggestions.

A: I believe you are looking for the little-known unbuffered_row function:
$query = $this->db->query("YOUR QUERY");

while ($row = $query->unbuffered_row())
{
        echo $row->title;
        echo $row->name;
        echo $row->body;
}

This method returns a single result row without prefetching the whole
  result in memory as row() does. If your query has more than one row,
  it returns the current row and moves the internal data pointer ahead.

https://www.codeigniter.com/userguide3/database/results.html
You can also get an array:
$query->unbuffered_row('array');        // associative array

redpajama_set_name: RedPajamaStackExchange


text:
Q: Flex Application with browser and .net MVC RedirectToAction == BadRequest I have a flex application with an HTML browser in it.
Whenever I try to log into my .net 4 MVC 3 application I get redirected to a url like this:
http://dev.example.com/(F(pvQgwsX3QvLrI1tN0JENknfz27yN7H00FCaLw_N06qL_SvBGmbS9Mc8V9BIlergVUhGiLeg-JU5HnEE-fzXtWqtVq-S5Pk393AXbifUTmcH29sDF9e028kpbYbX8L-VOY75QXYzXHTDfb06ozuOJzPvPB-y8atHn2B3BoDyiZMBd3DCjdO4meTwp9kvNY6ZarXbFByTU932Hu95lRcTq6yJzQ8y5Ree28nqgjqVHKEV77noegweTKkZ0_5IUZYnE0))/someDirectory

and this only happens when in the Flex browser (Adobe Air 2.6). Logging on with a regular internet browser is fine.
The login code is as follows:
    [HttpPost]
    [ActionName("sign-in")]
    public ActionResult Signin(SignInModel model, string returnUrl)
    {
        if (ModelState.IsValid)
        {
            if (MembershipService.ValidateUser(model.Email, model.Password))
            {
                FormsService.SignIn(model.Email, model.RememberMe);
                if (Url.IsLocalUrl(returnUrl) && false)
                {
                    return Redirect(returnUrl);
                }
                else
                {
                    return RedirectToAction("Index", "admin");
                }
            }
            else
            {
                ModelState.AddModelError("", "The user name or password provided is incorrect.");
            }
        }

        // If we got this far, something failed, redisplay form
        return View("signin", model);
    }

Any idea what that url is and how to get it to work?

A: Just on a whim I decided to change the user-agent of the the flex browser to the one used by Chrome and viola! - it works.
Apparently .net or MVC 3 doesn't like flex's userAgent string and decides to muck up the url. It is probably trying to set cookieless sessions or something (which my application isn't set up for).
So here is my new, working user-agent string:
Mozilla/5.0 (Windows NT 5.1) AppleWebKit/531.9 (KHTML, like Gecko) Chrome/11.0.696.16 Safari/534.24

A: This url is used by ASP.NET when the browser doesn't support cookies or they have been turned off. It is nothing specific to ASP.NET MVC. Because there are no cookies the authentication token is sent in the url in order to keep track of logged in users.


text:
Q: Compiling Postgresql disable "fno-aggressive-loop-optimizations"? I'm trying to compilation and install PostgreSQL in my system. My operating System is Debian 9 gcc-4.9 Below posted is my error

The database cluster will be initialized with locale en_US.UTF-8. The default database encoding has accordingly been set to UTF8.

creating directory p01/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers/max_fsm_pages ... 24MB/153600
creating configuration files ... ok
creating template1 database in p01/pgsql/data/base/1 ... ok
initializing pg_authid ... FATAL:  wrong number of index expressions
STATEMENT:  CREATE TRIGGER pg_sync_pg_database   AFTER INSERT OR UPDATE OR DELETE ON

pg_database   FOR EACH STATEMENT EXECUTE PROCEDURE flatfile_update_trigger();

child process exited with exit code 1
initdb: removing data directory "p01/pgsql/data"

In another post, a user suggests to disable the "fno-aggressive-loop-optimizations". But how can I disable this? It is a parameter in ./configure when compiling the fonts.  See below the suggestion:
initdb: initializing pg_authid ... FATAL: wrong number of index expressions

I ran into the same problem after compiling postgresql 8.1.4 with gcc 4.9.3.
  The problem seems to be the way postgres uses to represent variable length arrays:
typedef struct
{
    int32       size;           /* these fields must match ArrayType! */
    int         ndim;
    int         flags;
    Oid         elemtype;
    int         dim1;
    int         lbound1;
    int2        values[1];      /* VARIABLE LENGTH ARRAY */
} int2vector;                   /* VARIABLE LENGTH STRUCT */

In some cases, for loops accessing 'values', GCC assumes that they will do one iteration at most. Loops like the one below (extracted from postgres's source code):
ii->ii_NumIndexAttrs = numKeys;
for (i = 0; i < numKeys; i++)
    ii->ii_KeyAttrNumbers[i] = indexStruct->indkey.values[i];

might end up being reduced to something like:
ii->ii_NumIndexAttrs = numKeys;
if (numKeys)
    ii->ii_KeyAttrNumbers[0] = indexStruct->indkey.values[0];

as deduced by looking at the assembler generated for it:
.L161:
    testl   %r12d, %r12d
    movl    %r12d, 4(%rbx)
    jle .L162
    movzwl  40(%r13), %eax
    movw    %ax, 8(%rbx)
.L162:

The problem went away after re-compiling postgres with that optimization disabled by using -fno-aggressive-loop-optimizations.

A: Thank you for the tips... I was able to solve the problem.
Here's the solution if someone has this problem.
To compile PostgreSQL 9.0.1 sources using GCC-4.9, I used the following directive in postgresql source:
./configure -prefix=/opt/postgres9.0 CFLAGS="-Wno-aggressive-loop-optimizations"

Wno-aggressive-looop-optiimizations disables aggressive GCCs Optimization, avoiding the error reported in previous message and in discussion-List pgsql-general ->
https://www.postgresql.org/message-id/CAOD%3DoQ-kq3Eg5SOvRYOVxDuqibVWC8R0wEivPsMGcyzZY-nfzA%40mail.gmail.com
I hope the removal of "GCCs aggressive loop optimization" does not cause any errors of any kind in the DBMS.


text:
Q: Why Flutter blue plus is not working on release mode? I want to run app on release mode but I got this output in my terminal:

A: I found that M2103K19G is Xiaomi Redmi Note 10.
For INSTALL_PARSE_FAILED_NO_CERTIFICATES error, Check this out: What is INSTALL_PARSE_FAILED_NO_CERTIFICATES error?
I guess you didn't set the signing key, alias, and their passwords.


text:
Q: How can i convert binary to number? i made a function like this
def integer(n):
    num = int(''.join(n))
    base = 2
    answer = int(num,base)
    return answer

and i want to put (1, 1, 0, 0, 1, 0, 0, 0) and answer will be 200
but i got error like this
TypeError                                 Traceback (most recent call last)
<ipython-input-70-1c8f3fd15837> in <module>
      5     return answer
      6
----> 7 integer((1, 1, 0, 0, 1, 0, 0, 0))

<ipython-input-70-1c8f3fd15837> in integer(n)
      1 def integer(n):
----> 2     num = int(''.join(n))
      3     base = 2
      4     answer = int(num,base)
      5     return answer

TypeError: sequence item 0: expected str instance, int found

what is wrong with my code?

A: You need a sequence of string to use  join and you can't convert a non-string to int with an explicit base.
>>> def integer(n):
...     num = ''.join(str(i) for i in n)
...     base = 2
...     answer = int(num, base)
...     return answer
...
>>> integer((1, 1, 0, 0, 1, 0, 0, 0))
200

A: As @deceze mentioned, the join method is only used for strings. If you are passing an array of ints, where each index represents one bit, you can use this:
def integerFromBitArray(arrBits):
    iResult = 0
    for bit in arrBits:
        iResult = (iResult << 1) | bit
    return iResult


text:
Q: require_once(dompdf/C: mpp\php\PEAR): I am trying to convert my report.php in pdf using dompdf but I keep getting an error.How can I solve this error please assist. Below is an error I am getting:-

Warning: require_once(dompdf/C: mpp\php\PEAR): failed to open stream:
  No such file or directory in C:\xampp\htdocs\check\dompdf\report.php
  on line 15
Fatal error: require_once(): Failed opening required 'dompdf/C:
  mpp\php\PEAR' (include_path='C:\xampp\php\PEAR') in
  C:\xampp\htdocs\check\dompdf\report.php on line 15

A: Sorry man, but I dont think it works like that
Try this
<?php

$fileToConvert = "C:/example/myfile.html"; // Or .php

if(!file_exists($fileToConvert)) {
    echo "File not found";
    exit;
}

/** Now, We must read php file */
$contentOfFileToConvert = readfile($fileToConvert);

/** Load Dompdf library */
require_once 'C:/libraries/.../dompdf/autoload.inc.php';

/** Reference to Dompdf namespace */
use Dompdf\Dompdf;

/** instantiate and use the dompdf class */
$DOMPDF = new Dompdf();

/** Files Content must be in HTML */
$DOMPDF->loadHtml($contentOfFileToConvert);

/** ... OTHER OPTIONS */
$DOMPDF->setPaper('A4', 'landscape');

/** AUTOMATIC DOWNLOAD DIALOG */
$DOMPDF->stream(
    /** Filename that You want */
    'my_document.pdf',
    /**
     * 'compress' = > 1 (=default) or 0:
     *   Apply content stream compression
     *
     * 'Attachment' => 1 (=default) or 0:
     *   Set the 'Content-Disposition:' HTTP header to 'attachment'
     *   (thereby causing the browser to open a download dialog)
     */
    $options = array(
        'compress' => true, //or false
        'attachment' => true //or false
    )
);

/** Options array is not necessary */
$DOMPDF->stream(
    /** Filename that You want */
    'my_document.pdf'
);


text:
Q: Jquery Uncheck all checkboxes dynamically added after ajax request I have one ajax call which append a html into page. in that html i have few check boxes which i want to uncheck but my jquery code not working. if i copy that html into page then my code is working but same code not working when ajax dynamically add html including check boxes into pages. so please tell me where i made the mistake.
This is my html which is getting added by ajax into pages

            <input class="chkbox" checked name="2|Net Sales" type="checkbox" value="chart2_1" />Net Sales

            <input class="chkbox" checked name="2|Revenue Growth- Reported" type="checkbox" value="chart2_2" />Revenue Growth- Reported

            <input class="chkbox" checked name="2|Cost of Sales-GAAP" type="checkbox" value="chart2_3" />Cost of Sales-GAAP

A: After DOMElements are rewritten by jQuery, you need to rebind events.
So you need to call the function not only from document.ready event but after ajax success.
For example:

const ajaxLoad = () => {
  return new Promise((resolve) => {
    setTimeout(() => {
      $("#root").html(`

      <input class="chkbox" checked name="2|Net Sales" type="checkbox" value="chart2_1" />Net Sales

      <input class="chkbox" checked name="2|Revenue Growth- Reported" type="checkbox" value="chart2_2" />Revenue Growth- Reported

      <input class="chkbox" checked name="2|Cost of Sales-GAAP" type="checkbox" value="chart2_3" />Cost of Sales-GAAP

  `);
      resolve();
    }, 1000);
  });
};

const uncheckAll = () => {
  $(".chkbox").each(function() {
    $(this).prop('checked', false);
  });
};

$(document).ready(function() {
  ajaxLoad().then(() => {
    uncheckAll();
  });
});

        <input class="chkbox" checked name="2|Net Sales" type="checkbox" value="chart2_1" />Net Sales

        <input class="chkbox" checked name="2|Revenue Growth- Reported" type="checkbox" value="chart2_2" />Revenue Growth- Reported

        <input class="chkbox" checked name="2|Cost of Sales-GAAP" type="checkbox" value="chart2_3" />Cost of Sales-GAAP


text:
Q: Magento: get Categories tree don't show hidden categories I use this code to show the catagories tree:
$rootcatId= Mage::app()->getStore()->getRootCategoryId();
$categories = Mage::getModel('catalog/category')->getCategories($rootcatId);

function  get_categories($categories) {
    $array= '
';
    foreach($categories as $category) {
        $cat = Mage::getModel('catalog/category')->load($category->getId());
        //$count = $cat->getProductCount();
        $array .= '
'.
        $category->getId().' getUrlPath()). '">' .
                  $category->getName(); //. "(".$count.")\n";
        if($category->hasChildren()) {
            $children = Mage::getModel('catalog/category')->getCategories($category->getId());
             $array .=  get_categories($children);
            }
         $array .= '
';
    }
    return  $array . '
';
}
echo  get_categories($categories);

How can I modify it to show also hidden categories recursivly ?
Thanks a lot.

A: Instead of using the getCategories() method you could set up a custom collection. This will show the hidden categories, unless told otherwise.
For example:
$categories = Mage::getModel('catalog/category')
->load(Mage::app()->getStore()->getRootCategoryId())
->getCollection()
->addAttributeToSort('position', 'ASC')
->addFieldToFilter('parent_id',Mage::app()->getStore()->getRootCategoryId())
->addFieldToFilter('include_in_menu',1)
->addAttributeToSelect('name')


text:
Q: How to plot a vertical section of the atmosphere along with the topography using the Iris module? I have a netcdf with wind speed at model levels. On the same netcdf I have the altitude of each model level. I converted netcdf to a cube, so the altitude of each level became an auxiliary coordinate. I would like to plot a cross section (longitude x longitude) and would like the model levels to follow the topography. I tried using the Iris module documentation example (https://scitools.org.uk/iris/docs/latest/examples/General/cross_section.html), but it's not working.
As I already have the altitude of each level relative to sea level I just need to slice into vertical sections and plot. I tried to follow the documentation example, but it is returning an error: ValueError: shape mismatch: objects cannot be broadcast to a single shape
Bellow is the Xarray.Dataset:
<xarray.Dataset>
Dimensions:    (latitude: 49, level: 21, longitude: 49)
Coordinates:
  * longitude  (longitude) float32 -52.0 -51.75 -51.5 ... -40.5 -40.25 -40.0
  * latitude   (latitude) float32 -15.0 -15.25 -15.5 ... -26.5 -26.75 -27.0
  * level      (level) int32 1 2 3 4 5 6 7 8 9 10 ... 13 14 15 16 17 18 19 20 21
    time       datetime64[ns] 2017-01-01T10:00:00
    altitude   (level, latitude, longitude) float32 271.3289 ... 1142.3843
Data variables:
    ws         (level, latitude, longitude) float32 0.77094275 ... 14.978188

I converted the DataArray to a cube named ws_iris:
Ws (unknown)    level   latitude    longitude
Shape            21       49              49
Dimension coordinates
level             x       -              -
latitude        -         x              -
longitude       -         -              x
Auxiliary coordinates
altitude       x          x              x
Scalar coordinates
time    2017-01-01 10:00:00

Here is my code:
import iris
import iris.plot as iplt
import iris.quickplot as qplt
import xarray as xr

ws = xr.open_dataset('ws.nc')

ws_iris = ws.ws.to_iris()

cross_section = next(ws_iris.slices(['longitude', 'level']))

qplt.contourf(cross_section, coords=['longitude', 'altitude'], cmap='viridis', levels=10)

As you can see I followed the same steps as the documentation example (https://scitools.org.uk/iris/docs/latest/examples/General/cross_section.html)
When I plot the longitude relative to the model level the vertical section is plotted:
qplt.contourf (cross_section, coords = ['longitude', 'level'], cmap = 'viridis', levels = 10)

But when I plot in relation to altitude:
qplt.contourf (cross_section, coords = ['longitude', 'altitude'], cmap = 'viridis', levels = 10)

I get the following error message:
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-35-c93b92f5c581> in <module>
----> 1 qplt.contourf(cross_section, coords=['longitude', 'altitude'], cmap='viridis', levels=10)

~\Anaconda3\lib\site-packages\iris\quickplot.py in contourf(cube, *args, **kwargs)
    202     coords = kwargs.get('coords')
    203     axes = kwargs.get('axes')
--> 204     result = iplt.contourf(cube, *args, **kwargs)
    205     _label_with_points(cube, result, coords=coords, axes=axes)
    206     return result

~\Anaconda3\lib\site-packages\iris\plot.py in contourf(cube, *args, **kwargs)
    937     coords = kwargs.get('coords')
    938     kwargs.setdefault('antialiased', True)
--> 939     result = _draw_2d_from_points('contourf', None, cube, *args, **kwargs)
    940
    941     # Matplotlib produces visible seams between anti-aliased polygons.

~\Anaconda3\lib\site-packages\iris\plot.py in _draw_2d_from_points(draw_method_name, arg_func, cube, *args, **kwargs)
    516
    517         u, v = plot_arrays
--> 518         u, v = _broadcast_2d(u, v)
    519
    520         axes = kwargs.pop('axes', None)

~\Anaconda3\lib\site-packages\iris\plot.py in _broadcast_2d(u, v)
    234     u = np.atleast_2d(u)
    235     v = np.atleast_2d(v.T).T
--> 236     u, v = np.broadcast_arrays(u, v)
    237     return u, v
    238

~\Anaconda3\lib\site-packages\numpy\lib\stride_tricks.py in broadcast_arrays(*args, **kwargs)
    257     args = [np.array(_m, copy=False, subok=subok) for _m in args]
    258
--> 259     shape = _broadcast_shape(*args)
    260
    261     if all(array.shape == shape for array in args):

~\Anaconda3\lib\site-packages\numpy\lib\stride_tricks.py in _broadcast_shape(*args)
    191     # use the old-iterator because np.nditer does not handle size 0 arrays
    192     # consistently
--> 193     b = np.broadcast(*args[:32])
    194     # unfortunately, it cannot handle 32 or more arguments directly
    195     for pos in range(32, len(args), 31):

ValueError: shape mismatch: objects cannot be broadcast to a single shape

Can someone help me identify what is wrong with my code.
Or maybe someone knows how to make the graph I want otherwise.
Thank you very much in advance.

A: I am not familiar with iris so I want to suggest an alternative way to plot cross sections with xarray.Datatset.
Metpy provides a very helpful function. for this issue.
https://unidata.github.io/MetPy/latest/api/generated/metpy.interpolate.cross_section.html
Otherwise you can use following code to slice your datarray:
    points_cross = geodesic(crs_data, start, end, steps)

    data_sliced = data.interp({
        x.name: xr.DataArray(points[:, 0], dims='index', attrs=x.attrs),
        y.name: xr.DataArray(points[:, 1], dims='index', attrs=y.attrs)
    }, method='linear')
    data_sliced.coords['index'] = range(len(points))

With
def geodesic(crs, start, end, steps):
    r"""Construct a geodesic path between two points.

    This function acts as a wrapper for the geodesic construction available in `pyproj`.

    Parameters
    ----------
    crs: `cartopy.crs`
        Cartopy Coordinate Reference System to use for the output
    start: (2, ) array_like
        A latitude-longitude pair designating the start point of the geodesic (units are
        degrees north and degrees east).
    end: (2, ) array_like
        A latitude-longitude pair designating the end point of the geodesic (units are degrees
        north and degrees east).
    steps: int, optional
        The number of points along the geodesic between the start and the end point
        (including the end points).

    Returns
    -------
    `numpy.ndarray`
        The list of x, y points in the given CRS of length `steps` along the geodesic.

    See Also
    --------
    cross_section

    """
    import cartopy.crs as ccrs
    from pyproj import Geod

    g = Geod(crs.proj4_init)
    geodesic = np.concatenate([
        np.array(start[::-1])[None],
        np.array(g.npts(start[1], start[0], end[1], end[0], steps - 2)),
        np.array(end[::-1])[None]
    ]).transpose()
    points = crs.transform_points(ccrs.Geodetic(), *geodesic)[:, :2]

    return points


text:
Q: java.lang.NoClassDefFoundError when running jdk 1.7 compiled jarfile inside project compiled with 1.6 jdk I'm getting a really weird error (for me). We'd added a new dependency to the project's pom file. The jar file are in the project (downloaded from the repository) and we can see all all the class files and the source code.
We added some code in our program to create some classes defined in the new jar file. The code compiles without errors and the war file deploy in the webserver (websphere) without problems too.
But when debugging the program we found an java.lang.NoClassDefFoundError exception when we try to create the first object from the new jar file.
Today I found that the jar file have been compiled with jdk 1.7 and all our projects is compiled using 1.6 jdk.
I see the jdk used to compile the jar file in the manifest file. Is this info correct ?
The difference between jdks used in jar file and my project could cause the problem ?
I checked that the jar file definition exists in classpath and websphere server was rebooted several times.
Stacktrace :
Caused by: java.lang.ClassNotFoundException: cnaf.verificateurbiciban.ws.v1.VerificateurbicibanV1ServiceCnaf
    at java.net.URLClassLoader.findClass(URLClassLoader.java:423)
    at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:191)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:660)
    at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:111)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:626)
    at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:62)
    at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:58)
    at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:510)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:626)
    at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:542)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:626)
    at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:542)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:626)
    ... 56 more

A: Problem might be cause by JRE version you are using to execute your code: if you are using JRE 1.6 it would not execute bytecode compiled for JRE 1.7. JRE 1.7 would perfectly run both 1.6 and 1.7 bytecode. Try to switch to JRE 1.7 or higher.


text:
Q: How do I translate a WSDl generated for Java Webservice into a C# client? I am in .NET environment and I am supposed to reference and consume a java WebService with a WSDL.
I am not a wsdl master and neither have I done extensive work in WCF but normally WCF has two kind of binding which are BasicHTTP and WSHTTP but it sounds like I am not able to find any details on this looking at the WSDL. instead I do see something like following:
<wsdl:port name="SFAPI12" binding="tns:SFAPISoap12Binding">
  <wsdlsoap12:address location="https://api.successfactors.eu:443/sfapi/v1/soap12" />
  </wsdl:port>

followed by
<wsdl:binding name="SFAPISoapBinding" type="tns:SFAPI"><wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

I have no idea how to consume it in my C# application. Any ideas?

A: Right click the ServiceReference folder in your C# project, click on 'Add new service reference'. Give the java wsdl and enter an alias name for this service. Once this is done, then you can start using this alias for making client calls to the service.

A: You can use tool svcutil.exe.
Run from command line:
svcutil *.wsdl

It generates ".cs" and ".config" files.
svcutil.exe usually placed in directory:
c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\
or similar.


text:
Q: Register custom Transformation in SSIS Toolbox In VS 2010, how would you register/add a custom transformation to the toolbox?

A: Add the *.dll file of your customized component in the default Toolbar folder under the SSIS installation and then right click on the toolbar in the SSIS project window.
Then you will have to choose items and select the *.dll that was pasted in the folder.
http://bennyaustin.wordpress.com/2009/06/30/steps-to-build-and-deploy-custom-ssis-components/
This link may help with the screenshot
Kindly let know if it is useful


text:
Q: Finding number of distinct primes: a paradoxical solution Let $a$, $b$, be primes such that the difference between their squares is prime. How many distinct values of $b$ are there?
This problem basically asks for distinct solutions to:
$a^2 - b^2 = p$, where $p$ is prime
or equivalently:
$$(a + b)(a - b) = p$$
Since a prime has only two factors, $1$ and itself, $a - b$ is $1$
($a + b$ can't be $1$ since no primes satisfy that equation)
So, $a$ and $b$ are consecutive, there's only one pair of consecutive primes, so one solution, easy.
But, if we go back to $(a + b)(a - b) = p,$
since $a - b$ is $1,$ $a + b$ is $p$
or $b + b + 1 = 2b + 1$ is prime
Here, there are actually infinitely many values of b which would yield a prime(every prime is of the form $2q + 1$).
Can someone point out the error in this? There has to be something I'm doing wrong here.

A: There's nothing paradoxical here. The only reason that you know that $a+b=2b+1$ is that you've already deduced that $a-b=1$. Thus, you can't conclude that every prime of the form $2b+1$ yields a solution: it's only the ones for which $b$ and $b-1$ are both prime, and the only one of those is $b=3$.

A: Yes, $2b+1$ is prime, but then it must also satisfy $a-b=1$. And since $a$ and $b$ are primes anyway, there can be only one solution to them. The reasoning on $2b+1$ needs to take into account conditions previously established – and said reasoning adds nothing to the solution.


text:
Q: Prove that $(Q\leftrightarrow Q')\rightarrow (P\leftrightarrow P') $ is a tautology Let $P,Q'$ be propositions and $Q$ a subformula of $P$ ($Q\in sub(P)$). Prove that if we get the formula $P'$ from $P$ by replacing the occurrence of the formula $Q$ with the formula $Q'$, then
$$(Q\leftrightarrow Q')\rightarrow (P\leftrightarrow P') $$
is a tautology.
I am having a hard time understanding the problem so I can't really get started on it. I just tried to do some truth table business, but it didn't really go anywhere. Maybe because I didn't know how to factor in the assumption that $Q\in sub(P)$. Help would be appreciated.

A: What does the implication $(Q\leftrightarrow Q')\rightarrow (P\leftrightarrow P')$ say: if Q and Q' have same truth value then P and P' have same truth value. Now, it should be obvious why this implication holds.
If you are still not convinced, lets try to take it slowly. How we should prove an implication? Well, we should conjecture antecedent and then derive consequent. So, lets assume that $Q\leftrightarrow Q'$ holds. Then, if we replace every occurrence of $Q$ with $Q'$ in $P$ we will get formula $P'$. But this formula has same truth value as $P'$ because $Q$ has same truth value as $Q'$. So, it is true that $P\leftrightarrow P'$. Thus, we proved the implication $(Q\leftrightarrow Q')\rightarrow (P\leftrightarrow P')$.
In other words, formulas $P$ and $P'$ are semantically equivalent even if they are  potentially different formulas (takan as sequences of symbols). For example, formulas $\neg(p\land q)$ and $\neg p \lor \neg q$ are different but they have same truth tables (check this). So we can exchange them in other formulas without altering truth values of those formulas.
Formally, this statement is proved by induction on subformulas of $P$.


text:
Q: Playing Audio file freezing UI using C# In this particular application I am showing Video using Web Cam.When I press any button it runs Audio file using SoundPlayer.
Code to Run Audio
System.Media.SoundPlayer player = new System.Media.SoundPlayer(@"Audio\audio1.wav");
player.PlayLooping();

This code snippet freezing the UI even if I put this code in thread
still my UI is freezing

So can anyone please tell me how I can solve this problem. Thank you
Edit1:
So in above code snippet
I am declaring Sound Player object Globally
System.Media.SoundPlayer player = new System.Media.SoundPlayer(@"Audio\audio1.wav");

and calling function PlayAudio() on Button click Event
private void PlayAudio()
{
    player.PlayLooping();
}

A: It should NOT freeze the UI, unless there is some other blocking code running. Below is a sample 'Hello World' WPF code with your code sample -
XAML -
<StackPanel>
    <Button Content="Play" Height="50" Width="100" Click="Button_Click"/>
    <Button Content="Test" Height="50" Width="100" Click="Button_Click_1"/>
    <TextBlock x:Name="txtSample" Text="Hello"/>
</StackPanel>

xaml.cs -
public MainWindow()
{
    InitializeComponent();
}

private void Button_Click(object sender, RoutedEventArgs e)
{
    System.Media.SoundPlayer player = new System.Media.SoundPlayer(@"Audio\audio1.wav");
    player.PlayLooping();
}

private void Button_Click_1(object sender, RoutedEventArgs e)
{
    txtSample.Text = Guid.NewGuid().ToString();
}

Now click on the Play button to play the sound, now while the sound is playing click on Test button any number of times it should not freeze.
Also as per Microsoft documentation PlayLooping should not hang UI as it runs in a new thread by default.


text:
Q: How can I make a Collection of Integer using a List of "Person"? Hi I'm new here and I have a Question.
I have this Object.
    public Person(int id,String name, int age){
    this.id=id;
    this.name=name;
    this.age=age;
    }

And I want to create a Collection studentsIds.
Until now I have
    List<Person> students=new ArrayList<Person>();

    Collection<Integer> studentsIds=new ArrayList<Person>(students);

Can someone help me?

A: You cannot do it like that. Both are different data types. So create an Integer collection and then Look into persons collection.
List<Integer> studentsIds=new ArrayList<Integer>();

Then
for (Person p : students){

  studentsIds.add(p.age); // change to p.id if you need

}

A: You would have to do something like this
for(Person s: students) studentIds.add(s.id);

A: While others stated a right answer, you can achieve that also in Java 8 using lambda expressions :
List<Integer> studentsIds = students.stream()
                                    .map(student -> student.id)
                                    .collect(Collectors.toList());

A: Without Java 8 lambdas you could use anonymous classes with the help of Guava library:
List<Integer> studentsIds = Lists.transform(students, getStudentId);

private final Function<Person, Integer> getStudentId =
        new Function<Person, Integer>() {
            @Nullable
            @Override
            public Integer apply(@Nullable Person student) {
                return student == null ? null : student.id;
            }
        };


text: Q: Does time flows differently now compared to moments after big bang? Has time been flowing at a steady pace ever since big bang or it was very different compared to the early universe say before photon epoch? I suspect time ticks at the same rate throughout the timeline since the big bang occurs because speed of light is a constant but that's just my hunch.


text:
Q: Using UIDynamics gravity to animate CGRects My goal is to have a bunch of UIViews that have a property of CGRect falling from offscreen and then piling up. Right now, I have one circle working, but every time I try to add another circle, they won't animate anymore. I am using UIDynamics and its gravity function.  Here is my code:
func addBox(location: CGRect) -> UIView {
    let newBox = UIView(frame: location)
    newBox.backgroundColor = UIColor(red: 186.0/255.0, green: 216.0/255.0, blue: 242.0/255.0, alpha: 1.0)
    newBox.layer.cornerRadius = newBox.frame.width/2

    hView.insertSubview(newBox, at: 0)

    return newBox
}

addBox(location: CGRect(x: 100, y: -100, width: 100, height: 100))

var animator: UIDynamicAnimator? = nil;
let gravity = UIGravityBehavior()
var collision: UICollisionBehavior!
animator = UIDynamicAnimator(referenceView: hView)

func createAnimatorStuff(box: UIView) {
    collision = UICollisionBehavior(items: [box])
    collision.translatesReferenceBoundsIntoBoundary = true
    animator?.addBehavior(collision)

    gravity.addItem(box)
    gravity.gravityDirection = CGVector(dx: 0, dy: 0.8)
    animator?.addBehavior(gravity)

}

func dropDown() {
    let xVal = 100
    let xVal2 = 700

    let box = addBox(location: CGRect(x: xVal, y: 100, width: 100, height: 100))
    let box2 = addBox(location: CGRect(x: xVal2, y: 100, width: 100, height: 100))
    createAnimatorStuff(box: box)
    createAnimatorStuff(box: box2)
}
dropDown()

If anyone could help me and adjust my code to create more circles falling and then piling up I would immensely appreciate it. Truly. Please ask any questions and thank you so much in advance.

A: (NOTE: the question was updated with these suggestions, so that's why it appears to suggest things that were already done)
The general problem you are having is that you made box a global variable and you keep reinitializing the UIDynamicAnimator. So ...
Remove the box var, then
Change:
func addBox(location: CGRect)

to:
func addBox(location: CGRect) -> UIView

and return newBox at the end.
Then, change:
func createAnimatorStuff() {

to:
func createAnimatorStuff(box: UIView) {

and
addBox(location: CGRect(x: xVal, y: 100, width: 100, height: 100))
createAnimatorStuff()

To
let box = addBox(location: CGRect(x: xVal, y: 100, width: 100, height: 100))
createAnimatorStuff(box: box)

Finally, don't create a new UIDynamicAnimator for every call -- make one and share it.  You can do this with
let animator = UIDynamicAnimator(referenceView: hView)

(also, you don't need semicolons in Swift)


text:
Q: Delphi apps, form size varies on different machines I've got a Delphi 7 app, on the WinXP development machine the form size is the same as it was designed.
However, running the app on a Vista machine, some forms have been enlarged 20-30%, leaving big blank spaces on the right and bottom edge of forms.
On one of our client's WinXP machine, the forms have shrink, causing scroll bars to show up on the forms.
On most other machines, it shows up OK.
The app does remember the form size that was last used on some forms, and uses it next time the form is opened, however even removing these settings, the default form size is still different to how it was designed.
Any ideas?

A: This sounds like a well known issue with Delphi forms and interactions with system font sizes.
The default behaviour of a Delphi form is to attempt to scale to respect the (runtime) user's desktop environment.  This can have unintended and undesirable side effects however, and your "symptoms" sound like this could be what's going on in your case.
But all is not lost!  The Scaled property (TRUE by default) can be set FALSE to prevent this, but I recommend you read that first article, and also consider The information in this article in order to determine whether this is the right solution in your case.

A: Large Fonts versus Small Fonts on the Vista machine maybe?

A: Use this code in OnCreate event for every your form:
if Win32Platform = VER_PLATFORM_WIN32_NT then
    Font.Name := 'MS Shell Dlg 2'
  else
    Font.Name := 'MS Shell Dlg';


text:
Q: kernel oops messages - addresses In the course of kernel studying I have two questions:
1) I'd like to know if the addresses displayed in kernel Oops messages are virtual or physical? (I think those should be virtual, as long CPU operates with virtual address space and does MMU remapping?)
2) My platform is ARM based, and it supports MMU, however when I look in to addresses kernel modules load at, I see this:
# cat /sys/module/mydrv/sections/.data
0xbf00b4f4
# cat /sys/module/mydrv/sections/.text
0xbf006000

Should not those addresses be something like 0xffffffffa0110000, 0xffffffffa011b948? What I mean is in my understanding virtual memory addresses are supposed to be larger and thus provide larger virtual address space? Again I'm newbie and of course don't completely understand VM and MMU :)
Appreciate your comments, thanks.
Mark

A: 1) I'd like to know if the addresses displayed in kernel Oops messages are virtual or physical? (I think those should be virtual, as long CPU operates with virtual address space and does MMU remapping?)
The addresses displayed in the OOPS/panic stack traces are all virtual
2) Should not those addresses be something like 0xffffffffa0110000, 0xffffffffa011b948? What I mean is in my understanding virtual memory addresses are supposed to be larger and thus provide larger virtual address space? Again I'm newbie and of course don't completely understand VM and MMU :)
No you should see only 32 bit addresses unless you are using the new 64-bit armv8 architecture :-) So the answer is it depends on what architecture you are using and whether you are using the 3G/1G vs 2G/2G kernel split. [Most linux machines  are configured so that the kernel occupies the upper 1G (0xc0000000 - 0xffffffff) of the 4G address space and processes use the lower 3G (0x00000000 - 0xbfffffff). However, some machine are configured with a 2G/2G split, with the kernel occupying the upper 2G (0x80000000 - 0xffffffff) and processes using the lower 2G (0x00000000 - 0x7fffffff). I think the kernel config VMSPLIT_3G/VMSPLIT_2G sets this].


text:
Q: Bootstrap 4 make nested row fill parent that has been made to fill viewport height using flex-grow Currently, I am have a (class="d-flex flex-column") containing a navbar and a container and this container contains a (class="d-flex flex-column") as well that contains two rows. I use flex-grow to make my container fill the page. I wish to make the second row in this nested container to fill its parent using flex-grow again but it doesn't work. How do I make a nested element grow to fill a parent that has been made made to fill the viewport height using flex-grow in Bootstrap v4?
Should I not combine flex and container to do what I want? If so, how should I do this?
When I do the following, while the container expand to fill the height, the row within the container just stay the same height, it doesn't expand accordingly.

      <button class="btn btn-outline-warning mr-auto" type="submit">Back</button>
      <button class="btn btn-outline-success" type="submit">Logout</button>

                  <select class="form-control form-control-sm" id="label-option">
                    <option>Main</option>
                    <option>Unknown</option>
                  </select>
                  <button type="button" class="btn btn-outline-primary btn-sm" id="create-button">Create</button>
                  <button type="button" class="btn btn-outline-primary btn-sm" id="delete-button">Delete</button>
                  <button type="button" class="btn btn-outline-primary btn-sm" id="edit-button">Edit</button>

                  <button type="button" class="btn btn-outline-success btn-sm" id="previous-button">Previous</button>
                  <button type="button" class="btn btn-outline-success btn-sm" id="next-button">Next</button>

Update
The following error occurs when using @ZimSystem code. How should I solve this?

A: I think you just need to remember that flex-grow applies to the child of display:flex, and not the parent. Therefore, if the parent is also a child flex-grow will work.
.flex-fill {
    flex: 1 1 auto;
}

In your case,

 should also be d-flex so that you can use flex-grow to have it's children grow in height, and then continue this down to the drawing area.
https://codeply.com/go/gT3jsg43Lv

        <button class="btn btn-outline-warning mr-auto" type="submit">Back</button>
        <button class="btn btn-outline-success" type="submit">Logout</button>

                                <select class="form-control form-control-sm" id="label-option">
                                    <option>Main</option>
                                    <option>Unknown</option>
                                </select>
                                <button type="button" class="btn btn-outline-primary btn-sm" id="create-button">Create</button>
                                <button type="button" class="btn btn-outline-primary btn-sm" id="delete-button">Delete</button>
                                <button type="button" class="btn btn-outline-primary btn-sm" id="edit-button">Edit</button>

                                <button type="button" class="btn btn-outline-success btn-sm" id="previous-button">Previous</button>
                                <button type="button" class="btn btn-outline-success btn-sm" id="next-button">Next</button>

 draw area

Note: The flex-fill utility class will be included in the next Bootstrap 4.1 release: https://github.com/twbs/bootstrap/commit/2137d61eacbd962ea41e16a492da8b1d1597d3d9
Here's another example with scrollable right column, and top navbar:
https://codeply.com/p/93751rK5WQ

Related
Bootstrap 4.0 - responsive header with image + navbar + full-height body
How to make the row stretch remaining height


text:
Q: Intermediate field extensions of inseparable extensions. This question grew out of the following problem.

Prove that if $L/K$ is a separable extension of degree $4$, then there
  are at most $3$ intermediate extensions.

I was wondering if this separable condition was necessary or if it was inserted to make the question simpler.
Using the only example of a inseparable extension I knew (i.e. extensions of rational function field), I was thinking of classifying the intermediate extensions of $L/K$ where $L=\mathbb{F}_2(\sqrt{x},\sqrt{y})$ and $K=\mathbb{F}_2(x,y)$.
I came to the conclusion that this degree 4 extension had more than $3$ intermediate fields. Apart from $F_1=K(\sqrt{x}), F_2=K(\sqrt{y}), F_3=K(\sqrt{xy})$, $F_4=K(\sqrt{x}+\sqrt{y})$ was a different intermediate extension.
(Compare this to the case when the characteristic of the field is not $2$, for example, $K=\mathbb{Q}(x,y)$ and $L=K(\sqrt{x},\sqrt{y})$. Then,  $F=K(\sqrt{x}+\sqrt{y})=L$ by using the trick $\sqrt{x}=\frac{1}{2}(\sqrt{x}+\sqrt{y})+\frac{1}{2}(\sqrt{x}-\sqrt{y})=\frac{1}{2}(\sqrt{x}+\sqrt{y})+\frac{1}{2}\frac{x-y}{(\sqrt{x}+\sqrt{y})}$)

*

*My question is my reasoning correct?

*Moreover, can I classify all intermediate extensions of this extension $\mathbb{F}_2(\sqrt{x},\sqrt{y})/\mathbb{F}_2(x,y)$?
(If I am not mistaken $K(\sqrt{x^i},K(\sqrt{y^j}, K(\sqrt{x^i}+\sqrt{y^j})$ give us distinct intermediate extensions for odd $i,j$ but there are many more. Is there a simple way to list all such extensions?)

*If you have any reference for intermediate field extensions for inseparable extensions, that would also be very nice.


text:
Q: Raw sql transactions with golang prepared statements I'm having trouble finding some examples that do three of the following things:
1) Allow raw sql transactions in golang.
2) Use prepared statements.
3) Rollback on query failures.
I would like to do something like this, but with prepared statements.
    stmt, stmt_err := db.Prepare(`
            BEGIN TRANSACTION;

            -- Insert record into first table.

            INSERT INTO table_1 (
                    thing_1,
                    whatever)
            VALUES($1,$2);

            -- Inert record into second table.

            INSERT INTO table_2 (
                    thing_2,
                    whatever)
            VALUES($3,$4);

            END TRANSACTION;
            `)
    if stmt_err != nil {
            return stmt_err
    }
    res, res_err := stmt.Exec(
            thing_1,
            whatever,
            thing_2,
            whatever)

When I run this, I get this error:
pq: cannot insert multiple commands into a prepared statement
What gives? Are ACID compliant transactions even possible in golang? I cannot find an example.
EDIT
no examples here.

A: Yes Go has a great implementation of sql transactions. We start the transaction with db.Begin and we can end it with tx.Commit if everything goes good or with tx.Rollback in case of error.

type Tx struct { }
Tx is an in-progress database transaction.
A transaction must end with a call to Commit or Rollback.
After a call to Commit or Rollback, all operations on the transaction fail with ErrTxDone.
The statements prepared for a transaction by calling the transaction's Prepare or Stmt methods are closed by the call to Commit or Rollback.

Also note that we prepare queries with the transaction variable tx.Prepare(...)
Your function may looks like this:
func doubleInsert(db *sql.DB) error {

    tx, err := db.Begin()
    if err != nil {
        return err
    }

    {
        stmt, err := tx.Prepare(`INSERT INTO table_1 (thing_1, whatever)
                     VALUES($1,$2);`)
        if err != nil {
            tx.Rollback()
            return err
        }
        defer stmt.Close()

        if _, err := stmt.Exec(thing_1, whatever); err != nil {
            tx.Rollback() // return an error too, we may want to wrap them
            return err
        }
    }

    {
        stmt, err := tx.Prepare(`INSERT INTO table_2 (thing_2, whatever)
                     VALUES($1, $2);`)
        if err != nil {
            tx.Rollback()
            return err
        }
        defer stmt.Close()

        if _, err := stmt.Exec(thing_2, whatever); err != nil {
            tx.Rollback() // return an error too, we may want to wrap them
            return err
        }
    }

    return tx.Commit()
}

I have a full example here

A: I came up with a possible solution to rollback on any failure without any significant drawbacks. I am pretty new to Golang though, I could be wrong.
func CloseTransaction(tx *sql.Tx, commit *bool) {
  if *commit {
    log.Println("Commit sql transaction")
    if err := tx.Commit(); err != nil {
      log.Panic(err)
    }
  } else {
    log.Println("Rollback sql transcation")
    if err := tx.Rollback(); err != nil {
      log.Panic(err)
    }
  }
}

func MultipleSqlQuriesWithTx(db *sql.DB, .. /* some parameter(s) */)  (.. .. /* some named return parameter(s) */, err error) {
  tx, err := db.Begin()
  if err != nil {
    return
  }
  commitTx := false
  defer CloseTransaction(tx, &commitTx)

  // First sql query
  stmt, err := tx.Prepare(..) // some raw sql
  if err != nil {
    return
  }
  defer stmt.Close()

  res, err := stmt.Exec(..) // some var args
  if err != nil {
    return
  }

  // Second sql query
  stmt, err := tx.Prepare(..) // some raw sql
  if err != nil {
    return
  }
  defer stmt.Close()

  res, err := stmt.Exec(..) // some var args
  if err != nil {
    return
  }

  /*
    more tx sql statements and queries here
  */

  // success, commit and return result
  commitTx = true
  return
}


text:
Q: Visual Studio 2019 - Step in I am currently using Visual Studio 2019, when I use the debug method Step In (F11) it prioritizes the command prompt over the actual Visual Studio 2019 program. How do I change it so that it will keep me within Visual Studio 2019 but open the command prompt on the side?

A: I had the same problem and googled a lot for this, here is the result in short and long story:
The  short  answer is : use  SHIFT + ALT + F5  instead of  F5  and the long answer with more details can be found here:
Microsoft Documents for Visual Studio 2019
VISUAL STUDIO 2019
Here is the way to do this with SIMPLE  COMBO  KEY, It is more simple than first solution :)

*

*Go to  Tools  menu

*Go to  Options

*Press  Ctrl+E  and search Keyboard // OR go to
 Environment>Keyboard

*In right side type  YOUR LANGUAGE NAME (I am using Python for example )  in search bar(below of "Show commands
containing" I mean)

*Go down and select the proper result belong your language, ( for Python you can choose "PYTHON.EXECUTEININTERACTIVE" from the results)

*Click on the box  "Press shortcuts keys:"  and specify your
combo key.

*Be aware that Visual Studio has a lot of default combination and combo keys
and do not use any regular shortcut.( I used  F8 )

*Check the "Use new shortcut in:" and select your place that want to
use this shortcut (I suggest to use GLOBAL)

*Click Assign > OK > Have Fun


text:
Q: I can't get my web form to post to the database using PHP The database is connected - but I can't seem to insert a new record.
The database has been created, the table is created, but my form won't work.
I have to be able to add new users, verify the password - but I have been able to work out this part.
I have tried many times - different code - I am not sure if it's syntax error or variables etc.
Here is the code:
<!DOCTYPE html>

    <meta charset="UTF-8"/>

        Home
        About
        ArtGallery
        Shop
        Register
        ArtTheory
        MyAccount
        UserLogin

Website Sign Up

        <form action="register.php" method="post">
        <input type="hidden" name="Submit" value="true"/>

Enter User Email:* 	<input type="text" name="loginEmail" class="form-field" value=""/>

Enter a Password:* 	<input type="text" id="password" name="password" class="form-field" value=""/>

First Name: 	<input type="text" name="firstName" class="form-field" value=""/>

Last Name: 	<input type="text" name="lastName" class="form-field" value=""/>

Street Address: 	<input type="text"  name="street" class="form-field" value=""/>

City: 	<input type="text" name="city" class="form-field" value=""/>

State: 	<input type="text" name="state" class="form-field" value=""/>

Postcode: 	<input type="text" name="zip" class="form-field" value=""/>

Phone: 	<input type="text" name="phone" class="form-field" value=""/>

	<input type="Submit" class="Submit" value="Submit"/>

        </form>

<?php
include ('libcommon.php');

mysql_select_db($membersDB,$conn);
    if (!$membersDB) {
            echo mysql_error();
        }else{
            echo "
Successfully connected to the MembersDirectory database: Waiting for new record...";
        }

// query
$db = new PDO('mysql:host=localhost;dbname=MembersDirectory;charset=utf8', 'root', '');
$q = $db->prepare("INSERT INTO members (loginEmail,password,firstName,lastName,street,city,state,zip,phone)
    VALUES (:loginEmail,:password,:fname,:lname,:street,:city,:state,:zip,:phone)");
$q->execute(array(':loginEmail'=>$uname,
                  ':password'=>$pwd,
                  ':firstName'=>$fname,
                  ':lastName'=>$lname,
                  ':street'=>$Street,
                  ':city'=>$City,
                  ':state'=>$State,
                  ':zip'=>$PostCd,
                  ':phone'=>$Phone));

?>

A: There are a couple of security problems here:

*

*You're inserting 'unsafe' data straight into the database, without validating it. Ideally, you'd have a list of valid inputs to compare to (whitelisting). You COULD have a blacklist, but thats likely to be incomplete.

*You're creating a string containing unsafe data, then executing it! This means you're vulnerable to SQL injection. Consider if the user types '; UPDATE users SET password = 'lol'; - they're able to execute any SQL they want!

*You're storing passwords in plaintext. If anyone has access to the database, legitimately (developers/admins) or otherwise (hackers), they can see the user's passwords.

*You're using the root database user, with a default/empty password. For a serious system, don't do that. You'd also want to store the database password elsewhere (some config or keystore), no straight in the source. And the server name, etc, too.

Regarding #1, perhaps don't worry TOO much. PHP has some validation/sanitization functions. See here if you're interested. It may be worth at least checking that all of those keys exist in the $_POST array though. Try iterating through every expected key, confirm that array_key_exists($key, $_POST), and error out if not.
To solve #2, we should really rewrite that PHP script to use PDO, rather than mysql functions. This gives a good tutorial. Ideally, we'd also be doing some error handling (try-catch, set error display mode to the strictest, etc). Essentially, you want to:
// Establish a connection
$db = new PDO('mysql:host=localhost;dbname=testdb;charset=utf8', 'username', 'password');
// Prepare a query
$stmt = $db->prepare("INSERT INTO table(field1,field2,field3,field4,field5) VALUES(:field1,:field2,:field3,:field4,:field5)");
// Execute a query
$stmt->execute(array(':field1' => $field1, ':field2' => $field2, ':field3' => $field3, ':field4' => $field4, ':field5' => $field5));
// Close the connection
$db = null;

To solve #3, save the hash of a password, rather than the plaintext. A hash is a one-way encrypted version of some data, such that you can convert the plaintext to the hash, but can't convert a hash to the plaintext. So if someone gets access to your database, they won't be able to determine the passwords. So, we store passwords as password_hash($input) rather than $input, and compare with password_verify($usersAttempt, $valueInDb) rather than $usersAttempt === $valueInDb. See here for more info.

A: Add name for the submit button like
<input type="Submit" class="Submit" name="submit" value="Submit"/>

Note: Name is need for the submit button or input type in the form


text:
Q: How to add an element to Array and shift indexes? I need to add an element to Array specifying position and value.
For example, I have Array
int []a = {1, 2, 3, 4, 5, 6};

after applying addPos(int 4, int 87) it should be
int []a = {1, 2, 3, 4, 87, 5};

I understand that here should be a shift of Array's indexes, but don't see how to implement it in code.

A: You must make a new array, use System.arraycopy to copy the prefix and suffix, and set that one slot to the new value.

A: If you prefer to use Apache Commons instead of reinventing the wheel, the current approach is this:
a = ArrayUtils.insert(4, a, 87);

It used to be ArrayUtils.add(...) but that was deprecated a while ago. More info here: 1

A: I smell homework, so probably an ArrayList won't be allowed (?)
Instead of looking for a way to "shift indexes", maybe just build a new array:
int[] b = new int[a.length +1];

Then

*

*copy indexes form array a counting from zero up to insert position

*...

*...

//edit: copy values of course, not indexes

A: Unless I'm missing something, the question is not about increasing the array size. In the example the array size remains the same. (Like a bit shift.)
 In this case, there is really no reason to create a new array or to copy it. This should do the trick:
static void addPos(int[] array, int pos, int value) {
    // initially set to value parameter so the first iteration, the value is replaced by it
    int prevValue = value;

    // Shift all elements to the right, starting at pos
    for (int i = pos; i < array.length; i++) {
        int tmp = prevValue;
        prevValue = array[i];
        array[i] = tmp;
    }
}

int[] a = {1, 2, 3, 4, 5, 6};
addPos(a, 4, 87);
// output: {1, 2, 3, 4, 87, 5}

A: Here is a quasi-oneliner that does it:
String[] prependedArray = new ArrayList<String>() {
  {
    add("newElement");
    addAll(Arrays.asList(originalArray));
  }
}.toArray(new String[0]);

A: Have a look at commons. It uses arrayCopy(), but has nicer syntax. To those answering with the element-by-element code: if this isn't homework, that's trivial and the interesting answer is the one that promotes reuse. To those who propose lists: probably readers know about that too and performance issues should be mentioned.

A: org.apache.commons.lang3.ArrayUtils#add(T[], int, T) is deprecated in newest commons lang3, you can use org.apache.commons.lang3.ArrayUtils#insert(int, T[], T...) instead.

Deprecated this method has been superseded by insert(int, T[], T...) and may be removed in a future release. Please note the handling of null input arrays differs in the new method: inserting X into a null array results in null not X

Sample code:
    Assert.assertArrayEquals
            (org.apache.commons.lang3.ArrayUtils.insert
            (4, new int[]{1, 2, 3, 4, 5, 6}, 87), new int[]{1, 2, 3, 4, 87, 5, 6});

A: The most simple way of doing this is to use an ArrayList<Integer> and use the add(int, T) method.
List<Integer> list = new ArrayList<Integer>();
list.add(1);
list.add(2);
list.add(3);
list.add(4);
list.add(5);
list.add(6);

// Now, we will insert the number
list.add(4, 87);

A: This should do the trick:
public static int[] addPos(int[] a, int pos, int num) {
    int[] result = new int[a.length];
    for(int i = 0; i < pos; i++)
        result[i] = a[i];
    result[pos] = num;
    for(int i = pos + 1; i < a.length; i++)
        result[i] = a[i - 1];
    return result;
}

Where a is the original array, pos is the position of insertion, and num is the number to be inserted.

A: Jrad solution is good but I don't like that he doesn't use array copy. Internally System.arraycopy() does a native call so you will a get faster results.
public static int[] addPos(int[] a, int index, int num) {
    int[] result = new int[a.length];
    System.arraycopy(a, 0, result, 0, index);
    System.arraycopy(a, index, result, index + 1, a.length - index - 1);
    result[index] = num;
    return result;
}

A: int[] b = new int[a.length +1];
System.arraycopy(a,0,b,0,4);
//System.arraycopy(srcArray, srcPosition, destnArray, destnPosition, length)
b[4]=87;
System.arraycopy(a,4,b,5,2);

b array would be created as {1, 2, 3, 4, 87, 5,6};

A: Try this
public static int [] insertArry (int inputArray[], int index, int value){
    for(int i=0; i< inputArray.length-1; i++) {

        if (i == index){

            for (int j = inputArray.length-1; j >= index; j-- ){
                inputArray[j]= inputArray[j-1];
            }

            inputArray[index]=value;
        }

    }
    return inputArray;
}

A: public class HelloWorld{

     public static void main(String[] args){
        int[] LA = {1,2,4,5};
        int k = 2;
        int item = 3;
        int j = LA.length;
        int[] LA_NEW = new int[LA.length+1];

       while(j >k){
            LA_NEW[j] = LA[j-1];
            j = j-1;
        }
        LA_NEW[k] = item;
        for(int i = 0;i<k;i++){
            LA_NEW[i] = LA[i];
        }
        for(int i : LA_NEW){
            System.out.println(i);
        }
     }
}

A: System.arraycopy is more performant but tricky to get right due to indexes calculations. Better stick with jrad answer or ArrayList if you don't have performance requirements.
public static int[] insert(
    int[] array, int elementToInsert, int index) {
  int[] result = new int[array.length + 1];
  // copies first part of the array from the start up until the index
  System.arraycopy(
      array /* src */,
      0 /* srcPos */,
      result /* dest */,
      0 /* destPos */,
      index /* length */);
  // copies second part from the index up until the end shifting by 1 to the right
  System.arraycopy(
      array /* src */,
      index /* srcPos */,
      result /* dest */,
      index + 1 /* destPos */,
      array.length - index /* length */);
  result[index] = elementToInsert;
  return result;
}

And JUnit4 test to check it works as expected.
@Test
public void shouldInsertCorrectly() {
  Assert.assertArrayEquals(
      new int[]{1, 2, 3}, insert(new int[]{1, 3}, 2, 1));
  Assert.assertArrayEquals(
      new int[]{1}, insert(new int[]{}, 1, 0));
  Assert.assertArrayEquals(
      new int[]{1, 2, 3}, insert(new int[]{2, 3}, 1, 0));
  Assert.assertArrayEquals(
      new int[]{1, 2, 3}, insert(new int[]{1, 2}, 3, 2));
}

A: Following code will insert the element at specified position and shift the existing elements to move next to new element.
public class InsertNumInArray {

public static void main(String[] args) {
    int[] inputArray = new int[] { 10, 20, 30, 40 };
    int inputArraylength = inputArray.length;
    int tempArrayLength = inputArraylength + 1;
    int num = 50, position = 2;
    int[] tempArray = new int[tempArrayLength];

    for (int i = 0; i < tempArrayLength; i++) {
        if (i != position && i < position)
            tempArray[i] = inputArray[i];
        else if (i == position)
            tempArray[i] = num;
        else
            tempArray[i] = inputArray[i-1];
    }

      inputArray = tempArray;

    for (int number : inputArray) {
        System.out.println("Number is: " + number);
    }
}
}


text:
Q: How to use utf-8 in Servlet handler for request parameters? I have a default installation of Tomcat 8.5.6. It seems like UTF-8 encoded requests are not being interpreted correctly, even though the docs say the default (if not in strict mode) should be UTF-8 everywhere these days. My java POST requests look like:
HttpPost post = new HttpPost(url);
post.setEntity(new UrlEncodedFormEntity(nameValuePairs, HTTP.UTF_8));
...

Testing, I see the tilde character ñ is not decoded correctly in my servlet handler:
public class MyServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, ...) {
        String tildeTest = request.getParam("foo"); // no good.
    }
}

if I explicitly set the encoding on the request before access, it decodes properly:
protected void doPost(HttpServletRequest request, ...) {
    request.setCharacterEncoding("UTF-8");
    String tildeTest = request.getParam("foo"); // works!
    ...
}

so I'm not sure if:

*

*Tomcat 8.5.6 is not really using UTF-8 everywhere, and I need to set that manually in the config files somewhere.

*My http request is missing some header which tells Tomcat which encoding to use - perhaps the http post is defaulting to some other encoding which Tomcat is just honoring.
Anyone know which one?
Thanks

A: https://wiki.apache.org/tomcat/FAQ/CharacterEncoding

POST requests should specify the encoding of the parameters and values
  they send. Since many clients fail to set an explicit encoding, the
  default is used (ISO-8859-1).

What can you recommend to just make everything work? (How to use UTF-8 everywhere).
There are 6 ways listed to ensure this, for servlet requests 1,2 should be relevant

*

*Set URIEncoding="UTF-8" on your  in server.xml. References: HTTP Connector, AJP Connector.

*Use a character encoding filter with the default encoding set to UTF-8


text:
Q: updating normal in bufferGeometry in three.js I have two cylinders which intersect on one end. I can change the radius of the intersection separately but still they meet at one end as shown below. However, I want the intersection between these two be smooth or in other words, their normals in the intersection to be shared as mentioned here: http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-9-vbo-indexing/.
I have set the normal updates TRUE, and also change all the y components of the normals to zero in the intersection. It is still not showing a smooth intersection. These two cylinders are made with BufferGeometry.
so part of my code that is more important: 1- since the geometry is BufferGeometry, I use two commands below first for both geometries to create the normals:
comp.mesh.geometry.computeFaceNormals();
comp.mesh.geometry.computeVertexNormals();

2- then since both geometries has same number of vertices, I set y component of all vertices to 0:
for (i=0;i<comp.mesh.geometry.attributes.position.array.length;i++){
comp.mesh.geometry.attributes.normal.array[i*3 + 1]  = 0;
comp1.mesh.geometry.attributes.normal.array[i*3 + 1]  = 0;
}

When I let the program show the normals, their y component of normals is 0, but the geometry is not smooth yet.

A: I think the only way possible to do this is to weld these points. You need to check for duplicates, and assign them the same index. Use these indecis for triangulation and for vertex normal computation.


text:
Q: Print all elements in rowmapper in java How to get the data in rowmapper and print in log statements? Can any one please help ? I tried to see in various blogs but didnt help. Thanks in advance.
Can any one please suggest?

A: public interface LogDAO extends AbstractDAO<TblLogEntity, TblLogEntity1>
{
    void logEvent(String id, String action, String oldValue, String newValue);
}

And you can get data to log like this:
LtblTableEntity e;
logDAO.logEvent(e.getId().toString(), "action", e.getName(), "NewName");


text:
Q: Maven: java package does not exist I was working on this project for months, all was fine and well.  One day I open the project and suddenly maven doesn't recognize ANY of its dependencies.  I have been endlessly searching for an answer online but came across nothing that has helped.
I have tried several things: mvn clean install, I deleted the project and pulled it from git.  Sometimes it will work for a couple compiles, but after that it gives me the same exact errors.  This has been giving me a headache and have been trying to fix it for a couple days now but am exhausted trying to find things that will fix this.  Has anyone had this problem before?  Again, the same project has been working fine for months except for one day where I open it up and decide to work on it, Maven gives me errors similar to: Error: package doesn't exist
After a couple successful compiles, it will show me about ~100 similar errors to this next time I try and compile the application again: Error:(4, 26) java: package com.amazonaws.auth does not exist
pom.xml file:
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>

<properties>
    <!-- Use latest version whenever available -->
    <jackson.version>2.9.4</jackson.version>
    <aws.version>1.11.295</aws.version>
    <apache.commons.version>2.6</apache.commons.version>
</properties>

<dependencies>

    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-java-sdk</artifactId>
        <version>${aws.version}</version>
    </dependency>

    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-java-sdk-kinesisvideo</artifactId>
        <version>${aws.version}</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-kinesisvideo -->
    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-java-sdk-kinesisvideo</artifactId>
        <version>${aws.version}</version>
    </dependency>

    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>amazon-kinesis-client</artifactId>
        <version>1.9.0</version>
    </dependency>

    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>amazon-kinesis-producer</artifactId>
        <version>0.12.8</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>${jackson.version}</version>
    </dependency>

    <dependency>
        <groupId>com.fasterxml.jackson.dataformat</groupId>
        <artifactId>jackson-dataformat-cbor</artifactId>
        <version>${jackson.version}</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>${apache.commons.version}</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.25</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.eclipse.paho/org.eclipse.paho.client.mqttv3 -->
    <dependency>
        <groupId>org.eclipse.paho</groupId>
        <artifactId>org.eclipse.paho.client.mqttv3</artifactId>
        <version>1.0.2</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.scream3r/jssc -->
    <dependency>
        <groupId>org.scream3r</groupId>
        <artifactId>jssc</artifactId>
        <version>2.8.0</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.openpnp/opencv -->
    <dependency>
        <groupId>org.openpnp</groupId>
        <artifactId>opencv</artifactId>
        <version>3.2.0-0</version>
    </dependency>

</dependencies>


text:
Q: How can I use query of Google Spreadsheet to sum the amount in another sheet filtering by month & date I have two spread sheet 1 is record for customer data and 1 is use for check the amount for particular month. I would to the calculation sum of the amount from first sheet to second sheet with filtering by month & year
First sheet will look something like this

In second sheets the only things that I would like to show is amount. Does not have to show the date anymore since filtering the amount by month & year
The Formula that failed is
=QUERY('CustomerData'!A:B, "select A, SUM(B) WHERE month(X)=month(date'2021-9-30')")

A: Try
=QUERY(CustomerData!A:B, "select sum(B) WHERE A>=DATE'2021-09-01' and A<=DATE'2021-09-30' ")


text:
Q: $templateCache in angular2? I need an equivalent solution for the angular1.x $templateCache:
On App start I have to translate and configure all html views depending on the user's profile, role, permissions, language and current location. I want to accomplish this on the server side with ASP.NET Razor syntax and tools in one request (not in one for each component). This request should place all ready to use templates into  angular2 client side cache. From now on every component which references its template will be served from this cache first, if available. In Angular1.x it was easily possible to load all the template in one request, separated by <script id="myView.html" type="text/ng-template">...</script>. Before placing them into the cache I had to compile each template by calling $compiler().
How can I accomplish this in Angular2?
One possible solution I could imagine would be if Angular2 supports Component's templateUrl as a function(). This way I could build my own cache.

A: After some more research and digging into the angular2 source code this $templateCache in Angular 2? pointed me to the right solution. I have to register a new custom Http and a custom XHR implementation via provide():
 providers: [HTTP_PROVIDERS,
                provide(Http, {
                        useFactory: (xhrBackend: XHRBackend, requestOptions: RequestOptions) => new HttpInterceptor(xhrBackend, requestOptions),
                        deps: [XHRBackend, RequestOptions]
                    }),
                provide(XHR, {
                    useFactory: (http: Http) => new XHRInterceptor(http), deps: [Http]
                })],

The XHRInterceptor (implementation of XHR interface) is injected and internally used by angular2 each time angular2 loads html temlates via Compontent's tempateUrl. Because we inject our custom Http implementation into XHRInterceptor constructor and delegate all get requests through HttpInterceptor we gain full control over all http requests from our application:
export class XHRInterceptor extends XHR {
    constructor(private _http: Http) {
        super()
    }
    get(url: string): Promise<string> {
        var completer: PromiseCompleter<string> = PromiseWrapper.completer();
        this._http.get(url).map(data=> {
            return data.text();
        }).subscribe( data => {
            completer.resolve(data);
        }, error=>{
            completer.reject(`Failed to load ${url}`, null);
        });
        return completer.promise;
    }
}

and this is my HttpInterceptor class:
export class HttpInterceptor extends Http {

    constructor(backend: ConnectionBackend, defaultOptions: RequestOptions) {
        super(backend, defaultOptions);
    }

    request(url: string | Request, options?: RequestOptionsArgs): Observable<Response> {
        if (typeof url === "string") {
            return this.interceptResult(super.request(this.interceptUrl(url), this.interceptOptions(options)));
        } else {
            return this.interceptResult(super.request(url, this.interceptOptions(options)));
        }
    }
    get(url: string, options?: RequestOptionsArgs): Observable<Response> {
        return this.interceptResult(super.get(this.interceptUrl(url), this.interceptOptions(options)));
    }

    post(url: string, body: string, options?: RequestOptionsArgs): Observable<Response> {
        return this.interceptResult(super.post(this.interceptUrl(url), body, this.interceptOptions(options)));
    }

    put(url: string, body: string, options?: RequestOptionsArgs): Observable<Response> {
        return this.interceptResult(super.put(this.interceptUrl(url), body, this.interceptOptions(options)));
    }

    delete(url: string, options?: RequestOptionsArgs): Observable<Response> {
        return this.interceptResult(super.delete(this.interceptUrl(url), this.interceptOptions(options)));
    }

    interceptUrl(url: string): string {
        // Do some stuff with the url....
        //...
        return url;
    }

    interceptOptions(options?: RequestOptionsArgs): RequestOptionsArgs {
        // prepare options...
        if (options == null) {
            options = new RequestOptions();
        }
        if (options.headers == null) {
            options.headers = new Headers();
        }

        // insert some custom headers...
        // options.headers.append('Content-Type', 'application/json');

        return options;
    }

    interceptResult(observable: Observable<Response>): Observable<Response> {
        // Do some stuff with the result...
        // ...
        return observable;
    }
}


text:
Q: Can access detailed information through URL with function parameters (Codeigniter) I am creaiting my first Codeigniter application for a blog with news. In the main page there is only the title of the news which is also a link to a view with the detailed information and body of the news. Im having trouble on accessing the get through the URL that has to go over a function that receives the ID of the new as a parameter. I just can get that to work. Can someone help me?
The problem is not in the function itself because it works fine when i assig an static value to the URL, but for some reason i can send the $row->id object as a Get through the URL with the proper value for each of the news.
MODEL
class Post extends CI_Model{

    public function getPost(){

        $this->load->database('fintech_blog');
        $data = $this->db->get('post');
        return $data->$result();

    }

CONTROLLER
public function getPost($id){

    $query = $this->db->query("select * from post where id = '$id' ");
    $rows = $query->result(); //method for putting into an array format
    $data=array('result'=>$rows);

    $this->load->view('view',$data);

}

VIEW
foreach ($result as $row):

$id = $row->id;
$post = site_url('welcome/getPost/$row->id');

?>

                <a href="<?php echo $post; ?>">

                        <?php echo $row->title; ?>

                        <?php echo $row->calling; ?>

Posted on

                    <?php echo time_elapsed_string($row->created); ?>

<?php endforeach; ?>

A: The problem comes from the way you create the string for $post.
As one commenter suggests the problem is the use of single quotes and to use double quotes instead. The most important feature of double-quoted strings is the fact that variable names will be expanded. Meaning the variable symbol ($test in this case) is replaced with the value of the variable.
To illustrate:
$test = "blue";
//first, a string created with single quotes
echo 'The sky is $test today.';  //outputs: The sky is $test today.

But using double quotes to create the string...
echo "The sky is $test today.";  //outputs: The sky is blue today.

The var $test get expanded to the value it holds.
So, the first two lines of the foreach loop in the view should be.
 $id = $row->id;
 $post = site_url("welcome/getPost/$row->id");

However, you never use $id and you only use $post once. That says to me that these two lines are not needed. Delete them both.
Change the line
<a href="<?php echo $post; ?>">

to
<a href="<?php echo site_url("welcome/getPost/$row->id"); ?>">


text:
Q: When i kill the running instance and relaunch the application using Db ecncryption app is crashing i have implemented code below scenarios
namespace Inspect.Droid
{

public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
{
    private DataBaseEncryption dbEncryption;
    protected override async void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);
        MainAppActivity = this;
        Forms.Init(this, bundle);
        //to get the current device language code
        var code = Locale.Default.GetDisplayLanguage(Locale.Default);
        CommonInfo.Instance.DeviceCurrentLanguageCode = code.Substring(0, 2).ToUpper();
        Console.WriteLine("Device lang code: " + CommonInfo.Instance.DeviceCurrentLanguageCode);
        try
        {
            ConfigurationManager.Initialise(PCLAppConfig.FileSystemStream.PortableStream.Current);
        }
        catch (Exception ex)
        {
            //when application coming back from background throws exception, bcz PCLAppConfig is already initialized, so as there is no change no need to change here
            Console.WriteLine(ex.Message);
        }
        GLOBAL_CONTEXT = Android.App.Application.Context;
        ACTIVITY_CONTEXT = this;
        FragmentMgr = FragmentManager;
        dbEncryption = new DataBaseEncryption();
        //await PrepareDb();
        await  dbEncryption.InitiateDecryption();
        //AzureMobileServices Initialization for Android
        Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();
        SessionInfo.Instance.DeviceId = Utility.GenerateGuid().ToString();

        //This will set the value for _skipCount variable in all respected helper classes.
        SetSkipCount();
        Inspect.ScreenSize = new Xamarin.Forms.Size(Resources.DisplayMetrics.WidthPixels / Resources.DisplayMetrics.Density,
        Resources.DisplayMetrics.HeightPixels / Resources.DisplayMetrics.Density);

        Inspect.AndroidDisplayMetricsDensity = Resources.DisplayMetrics.Density;
        int statusBarResId = Resources.GetIdentifier("status_bar_height", "dimen", "android");
        if (statusBarResId > 0)
        {
            Inspect.AndroidStatusBarHeight = Resources.GetDimensionPixelSize(statusBarResId);
        }

        Context context = this.ApplicationContext;
        Acr.UserDialogs.UserDialogs.Init(this);

        //allowing the device to change the screen orientation based on the rotation
        MessagingCenter.Subscribe<InspectionAddNotesPage>(this, CommonConstants.AllowLandScape, sender =>
        {
            RequestedOrientation = ScreenOrientation.Unspecified;
        });
        //during page close setting back to portrait
        MessagingCenter.Subscribe<InspectionAddNotesPage>(this, CommonConstants.PreventLandScape, sender =>
        {
            RequestedOrientation = ScreenOrientation.Portrait;
        });
        LoadApplication(new Inspect());
        //Intializing the context for Media access
        CrossCurrentActivity.Current.Activity = this;
        PasscodeAuthDependency.Activity = this;
    }

    protected override void OnStop()
    {
        base.OnStop();

        dbEncryption.InitiateEncryption(true);

    }
    protected override void OnRestart()
    {
        base.OnRestart();
        dbEncryption.InitiateDecryption();

    }
    protected override void OnDestroy()
    {
        base.OnDestroy();

    }

Please provide the solution.

A: Where exactly is your exception coming from? Did you manage to get the origin?
And in case you are talking about the exception from the ConfigurationManager.Initialize() method, try this.
if(Configurationmanager.AppSettings == null)
{
    ConfigurationManager.Initialise(PCLAppConfig.FileSystemStream.PortableStream.Current);
}

Its just that the ConfigurationManager throws an exception if it already finds a NameValueCollection initialized.