Q: TypeError: _onRequestWithOpts is not a function at Object.httpsProvider._onRequestWithOpts I'm creating an app that uses firebase-functions.  I created my app directory and ran firebase init.  After that was completed I tried to run the hello world program that it gives you using firebase serve, and I get this error:
TypeError: _onRequestWithOpts is not a function
at Object.httpsProvider._onRequestWithOpts

from what it looks like, it seems to be an issue with the onRequest() method but I have made apps using this before and have never ran into this issue.  I literally didn't change a single piece of code that they initially give you so unless they decided to change something overnight i'm not sure what the issue is.
using firebase deploy works, but firebase serve does not.  Using express and adding new functions, the error pops up when running firebase deploy and serve.
const functions = require('firebase-functions');

// // Create and Deploy Your First Cloud Functions
// // https://firebase.google.com/docs/functions/write-firebase-
functions
//
exports.helloWorld = functions.https.onRequest((request, response)
=> {
response.send("Hello from Firebase!");
});

    Gabriels-MacBook-Pro:functions Mike$ firebase serve

    === Serving from '/Users/Gabe/Desktop/mycart-functions'...

   ⚠  Your requested "node" version "8" doesn't match your global
    version "10"
    ✔  functions: Emulator started at http://localhost:5000
    i  functions: Watching "/Users/Gabe/Desktop/mycart-
   functions/functions" for Cloud Functions...
   ⚠  TypeError: _onRequestWithOpts is not a function
    at Object.httpsProvider._onRequestWithOpts
   (/usr/local/lib/node_modules/firebase-
  tools/lib/emulator/functionsEmulatorRuntime.js:278:24)
    at Object.httpsProvider.onRequest
   (/usr/local/lib/node_modules/firebase-
  tools/lib/emulator/functionsEmulatorRuntime.js:283:34)
    at Object.<anonymous> (/Users/Gabe/Desktop/mycart-
   functions/functions/index.js:6:39)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js
   (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
   ⚠  We were unable to load your functions code. (see above)


Q: SQLite query running successfully in version 3.5.2 but giving error in version 3.7.11 - using aggregate functions My query was working fine in Sqlite 3.5.1 version but when I run the same query in 3.7.11 version am getting misuse of aggregate function min() error. Below one is my query. Please help me in this regard
select distinct category from m_ipaperdara  order by min(displayorder) asc

A: DISTINCT is not a grouping that can be used for aggregate functions.
If you want take the smalled displayorder in each category, you have to explicitly group by that column:
SELECT category FROM m_ipaperdara GROUP BY category ORDER BY MIN(displayorder)


Q: Is PyCharm Community Edition doesn't have Database Tool? I'm using pycharm 2020.3 community edition. but id doesn't showing database tool. it means this edition comes without that option? or any action we have to do for this?
*Note: some people saying add plugin data base browser. but that is not built in. I want database tool.

A: PyCharm Community doesn't have database tools. See comparison matrix https://www.jetbrains.com/pycharm/features/editions_comparison_matrix.html


Q: solr LowerCaseFilterFactory should not filter number I'm using a query schema which need to let abc match Abc and 400 match 400 (user name match).
But I found when I use LowerCaseFilterFactory, It not return any result when I query 400.
I digg into the source code, and found LowerCaseTokenizerFactory use LowerCaseTokenizer which extends LetterTokenizer, and it filter all the numbers.
How should I fix this?

A: You are right that LowerCaseTokenizer will remove all non-letters.  It would very useful (as far as providing a meaningful answer) to see your schema, as I don't believe just using the lowercase filter factory should generate a Tokenizer of any kind.
At any rate, though, there are plenty of other options for tokenizers.  Both Standard or Classic might suit your needs better.
Something along the line of:
<analyzer>
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
</analyzer>

Might do well for you.


Q: ErrorException: Creating default object from empty value - Laravel I have just got this error all the tries while updating my table data.

ErrorException: Creating default object from empty value

AdminController.php
public function update(Request $r, $post_id) {
    $post = Post::find($post_id);

    $post->post_title = $r->post_title;
    $post->post_image = $r->post_image;
    $post->post_details = $r->post_details;
    $post->post_rating = $r->post_rating;
    $post->id = $r->id;

    $post->save();

    return back();
}

My Resource Route
Route::resource('post', AdminController::class);

Blade File

    <form action="{{ route('post.update',$list->post_id) }}" method="POST">
        @csrf
        @method('PUT')

        <input type="hidden" name="id" value="{{$list->id}}">
        <input type="hidden" name="post_rating" value="{{$list->post_rating}}">

            Edit Title: <input class="form-control" name="post_title" type="text" id="exampleFormControlInput1" value="{{$list->post_title}}" aria-label="default input example">

            Edit Description:
            <textarea class="form-control" id="exampleFormControlTextarea1"  name="post_details"  rows="3">
                {{ $list->post_details }}
            </textarea>

            post_image))}}" alt="" width="120px;">
            Edit Photos:
            <input id="formFileMultiple" class="form-control form-control-lg" name="post_image" type="file" value="{{ $list->post_image }}" multiple>

        <button type="submit" class="btn btn-primary">Save Changes</button>
    </form>

Could someone help me, please?

A: There is a chance that the model doesn't exist. You can add a check for this in your controller as follows:
public function update(Request $r, $post_id) {
    $post = Post::find($post_id);
    if (!$post) {
        // You can add code to handle the case when the model isn't found like displaying an error message
        return back();
    }

    $post->post_title = $r->post_title;
    $post->post_image = $r->post_image;
    $post->post_details = $r->post_details;
    $post->post_rating = $r->post_rating;
    $post->id = $r->id;

    $post->save();

    return back();
}


Q: Communicating between Kernel Threads in Linux I am porting a app/PCI driver from vxWorks to Linux and I would like to keep the same architecture if possible.  The current driver has 2 tasks(threads) that communicate with each other using message queues.  Is there a mechanism to communicate between kernel threads?  The message queues are being used to pass buffer addresses and size info so the tasks can use DMA to move large amounts of data.

A: It sounds like the workqueue interface might be what you're after - or for something lighter-weight, a kfifo combined with a rwsem semaphore.

A: I would strongly advise against keeping the VxWorks architecture on Linux. Kernel thread proliferation is frowned upon, your code will never make it into official kernel tree. Even if you don't care about that, are you 100% sure that you want to develop a driver in a non-standard way ? Things would be much simpler if you would just get rid of these two tasks. BTW, why on earth you need tasks for PCI driver to begin with ?


Q: Django Attribute Error - Form object has no attribute 'is_valid' I am receiving an error, object has no attribute 'is_valid', when trying to insert form data into a form. Below is the structure of my code:
Views.py:
def add_user(request):
    form = Car(request.POST)
    if request.method == 'POST' and form.is_valid():
        last_store = form.cleaned_data.get['value']
        make = request.POST.get('make', '')
        model = request.POST.get('model', '')
        ..

        car_obj = Car(last_store = last_store, make = make, model = model, series = series, series_year = series_year, price_new = price_new, engine_size = engine_size, fuel_system = fuel_system, tank_capacity = tank_capacity, power = power, seating_capacity = seating_capacity, standard_transmission = standard_transmission,  body_type = body_type, drive = drive, wheelbase = wheelbase, available = available)
        car_obj.save()
        return HttpResponseRedirect('/inventory/add/')
    else:
        form = Car()

    return render(request, 'cars/inventory-add.html', {})

Class:
class Car(models.Model):
    make = models.CharField(max_length=200, null=False)
    model = models.CharField(max_length=200, null=False)
    series = models.CharField(max_length=200, null=False)
    series_year = models.IntegerField(null=False)
    price_new = models.IntegerField(null=False)
    ..
    last_store = models.ForeignKey(Store, on_delete=models.DO_NOTHING, related_name="last_store")
    available = models.BooleanField(null=False, default=True)

    def __str__(self):
        return(self.make + " " + self.model)

CarForm (forms.py)
class CarForm(forms.ModelForm):
    class Meta:
        model = Car
        fields = ['last_store', 'make', 'model', 'series', 'series_year', 'price_new', 'engine_size', 'fuel_system', 'tank_capacity', 'power', 'seating_capacity', 'standard_transmission', 'body_type', 'drive', 'wheelbase', 'available']

The error lies within the last_store as without form.is_valid(), apparently I cannot use form.cleaned_data, but form.is_valid() seems to not even exist? As seen in the class, last_store is of type a foreign key, therefore I am struggling to set the default value for it when the user enters input into the form. The last_store variable is attempting to fetch the value from the inputted form data which consists of a SELECT option..

A: You have a clash between your model and form, which are both named Car. Typically you would fix this by renaming the form CarForm.
Note that you shouldn't normally need to create the object with car_obj = Car(...). If you use a model form, you can simplify your code to car_obj = form.save(). You should also move CarForm(request.POST) inside the if request.method == 'POST' check, and include form in the template context. Putting that together, you get something like:
def add_user(request):
    if request.method == 'POST':
        form = CarForm(request.POST)
        if form.is_valid():
            car_obj = form.save()
            return HttpResponseRedirect('/inventory/add/')
    else:
        form = CarForm()
    return render(request, 'cars/inventory-add.html', {'form': form})

A: In your views.py file line 2
form = Car(request.POST):

change it to
form = CarForm(request.POST):

Hope it works!


Q: how do i define props in a function i am new to react and i am trying to use props in a function and i am not sure how to use it. This is the code.
import React from 'react';
import './Card.css';
import { connect } from 'react-redux';
import { addBasket } from '../actions/addAction';
function Card({props},{image, title,author,price}) {
    return (

{props.title}

{props.author}

 £{props.price}

                <button>

                        Add to Basket

                </button>

    );
}

export default connect(null, { addBasket })(Card);

And that's the error i am getting.
TypeError: Cannot read property 'title' of undefined

{props.title}

{props.author}

A: Replace
function Card({props},{image, title,author,price}) {

with
function Card(props) {

I recommend working through the official React tutorial before using Redux.


Q: How To get the Check Rule Constraint How can I get the expression of a check constraint?
With MSSMS I can easly see that Table Person has a CHECK constraint named CK_Person validating the expression ([DateOfBirth]<[DateOfDeath]).
With this query I can get the COLUMN_NAME, CONSTRAINT_NAME and CONSTRAINT_TYPE:
SELECT CCU.COLUMN_NAME, CCU.CONSTRAINT_NAME,  TC.CONSTRAINT_TYPE
    FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS TC
    INNER JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE AS CCU ON TC.CONSTRAINT_NAME = CCU.CONSTRAINT_NAME
    WHERE TC.TABLE_NAME = 'Person'

Resulting
+-------------+-----------------+-----------------+
| COLUMN_NAME | CONSTRAINT_NAME | CONSTRAINT_TYPE |
+-------------+-----------------+-----------------+
| PersonID    | PK_Person       | PRIMARY KEY     |
| DateOfBirth | CK_Person       | CHECK           |
| DateOfDeath | CK_Person       | CHECK           |
+-------------+-----------------+-----------------+

But how can I get the actual expression itself?

A: Try this...
SELECT definition AS Check_Expression
      ,name       AS ConstraintName
FROM sys.check_constraints
WHERE Parent_object_ID = OBJECT_ID('TableName')


Q: Custom view, onSaveInstanceState is not called I created a custom view, and tried to restore the state automatically on screen rotation (just as EditText restores current input text automatically), but when I see the log, onSaveInstanceState is not called, and only onRestoreInstanceState is called. What is wrong?
class MyView:LinearLayout
{
    constructor(context: Context?) : super(context)
    constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
    constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(
            context, attrs, defStyleAttr)

    init
    {
        isSaveEnabled=true
    }

    override fun onSaveInstanceState(): Parcelable
    {
        return super.onSaveInstanceState()
        Log.d("ss", "save")
    }

    override fun onRestoreInstanceState(state: Parcelable?)
    {
        super.onRestoreInstanceState(state)
        Log.d("ss", "restore")
    }
}

Activity layout:
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/top"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <com.loser.mylayouttest.MyView
        android:id="@+id/myView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
</AbsoluteLayout>

Activity:
class MainActivity : AppCompatActivity()
{

    override fun onCreate(savedInstanceState: Bundle?)
    {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
    }
}

A: The reason why you can't see Log.d("ss", "save") being called is simply that the code line is invoked after the return statement. The onSaveInstanceState() is actually called. To see the log move Log.d("ss", "save") above return super.onSaveInstanceState().


Q: MySQL : Updating a table having a 'where' clause with a max value I want to update the last generated row (the max(id) row.
I tried this code but it doesn't work
update person t1
set t1.age = 25
where t1.id = (select max(t2.id)  from person t2
            where t2.address = 'LA, California');

MySQL tells me that : Error Code: 1093. You can't specify target table 't1' for update in FROM clause
So, I suppose that I cannot reach the same tale while performing operations such as updates.
How can I sole this problem ?
Regards.

A: You cannot reference the same table in a subquery, but you can instead do it in a JOIN (which is allowed in UPDATE and DELETE statements):
UPDATE person a
JOIN   (SELECT MAX(id) AS id FROM person WHERE address = 'LA, California') b
       ON a.id = b.id
SET    a.age = 25

Another way you can do it is by using the ORDER BY / LIMIT technique:
UPDATE   person
SET      age = 25
WHERE    address = 'LA, California'
ORDER BY id DESC
LIMIT    1

A: You can try as:
UPDATE person t1
    INNER JOIN (SELECT MAX(id) AS id  FROM person
            WHERE t2.address = 'LA, California') t2
        ON t1.id = t2.id
SET t1.age = 25;

or
SELECT MAX(t2.id)
INTO @var_max_id
FROM person t2
WHERE t2.address = 'LA, California';

UPDATE person t1
SET t1.age = 25
WHERE t1.id = IFNULL(@var_max_id, -1);


Q: ClosedXML Copy and Paste Range of formulas as values I have a function ApplyFormulas() that will obviously apply formulas like so
detailWs.Range(companyModel.RevenueFormulaRangeDollars).FormulaR1C1 = companyModel.RevenueFormulaDollars;

However Now I need to copy that range and paste it in the same spot so the values are real and not just formula references.
I am able to do this in VBA with excel interop but I am utilizing ClosedXML. Does anyone know of a way to do this? I tried CopyTo() but there is no paste special etc.
I also attempted
detailWs.Range(companyModel.NoChargeFormulaRangePercent).Value = detailWs.Range(companyModel.NoChargeFormulaRangePercent).Value;

but im getting a property or indexer cant be used because it lacks a getter but from what I can tell both have a get; set; property.
I've tried a couple for things and still not working..
    var test = detailWs.Range(companyModel.NoChargeFormulaRangePercent).CellsUsed();
    foreach(var c in test)
    {
        c.Value = c.Value.ToString();
    }

A: Here's what I created a few months ago to copy all the formulas in one worksheet to another.
Note: I am having a problem where some formulas using a Name are not correctly copying the Name because something thinks the Name(i.e. =QF00) is a reference and will change it with AutoFill. Will update when I figure it out.
cx.IXLWorksheet out_buff
cx.IXLRange src_range
cx.IXLCells tRows = src_range.CellsUsed(x => x.FormulaA1.Length > 0);

foreach (cx.IXLCell v in tRows)
{
    cell_address = v.Address.ToString();
    out_buff.Range(cell_address).FormulaA1 = v.FormulaA1;
}


Q: Only the last usercontrol shows contentcontrol I have a weird problem. I've created a usercontrol with a label and a canvas.
The canvas references a resource.
But the canvas is only shown on the last control in my stackpanel.
This is my window
<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:UserControlSolution" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="UserControlSolution.MainWindow"
    Title="MainWindow" Height="836" Width="270.5" Background="#FF2B2B2B" BorderBrush="{DynamicResource Border}" Loaded="Window_Loaded" >

<Window.Resources>

    <LinearGradientBrush x:Key="Border" EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
        <GradientStop Color="#FF6C6C6C" Offset="0.009"/>
        <GradientStop Color="#FFA1A1A1" Offset="1"/>
    </LinearGradientBrush>
    <SolidColorBrush x:Key="Orange" Color="#FFF5610E"/>
    <SolidColorBrush x:Key="Red" Color="#FFE51400"/>
    <SolidColorBrush x:Key="Blue" Color="#FF1BA1E2"/>
    <SolidColorBrush x:Key="Yellow" Color="#FFFFC40D"/>

</Window.Resources>

<StackPanel Margin="0,10,0,0">
    <local:UserControlButton x:Name="Robby" Height="50" VerticalAlignment="Top" Margin="2,0,0,5"/>
    <local:UserControlButton x:Name="Erwin" Height="50" VerticalAlignment="Top" Margin="2,0,0,5" />
    <local:UserControlButton x:Name="Laurens" Height="50" VerticalAlignment="Top"  Margin="2,0,0,5"/>
    <local:UserControlButton x:Name="Kevin" Height="50" VerticalAlignment="Top" Margin="2,0,0,5"/>
    <local:UserControlButton x:Name="Liesbeth" Height="50" VerticalAlignment="Top" Margin="2,0,0,5" Background="{DynamicResource Orange}"/>
    <local:UserControlButton x:Name="Jack" Height="50" VerticalAlignment="Top" Margin="2,0,0,5"/>
    <local:UserControlButton x:Name="Filip" Height="50" VerticalAlignment="Top" Margin="2,0,0,5"/>
    <local:UserControlButton x:Name="Stefaan" Height="50" VerticalAlignment="Top" Margin="2,0,0,5" Background="{DynamicResource Red}"/>
    <local:UserControlButton x:Name="Sami" Height="50"  VerticalAlignment="Top" Margin="2,0,0,5" Background="{DynamicResource Blue}"/>
    <local:UserControlButton x:Name="Jurgen" Height="50" VerticalAlignment="Top" Margin="2,0,0,5"/>
</StackPanel>

This is my usercontrol, in the contentcontrol at the bottom I reference my canvas.
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
mc:Ignorable="d"
x:Class="UserControlSolution.UserControlButton"
x:Name="UserControl"
Height="50" Background="#FF2F2F2F">

<i:Interaction.Triggers>
    <i:EventTrigger EventName="MouseEnter">
        <ei:GoToStateAction TargetObject="{Binding ElementName=UserControl}" StateName="Expand"/>
    </i:EventTrigger>
    <i:EventTrigger EventName="MouseLeave">
        <ei:GoToStateAction TargetObject="{Binding ElementName=UserControl}" StateName="Collapse"/>
    </i:EventTrigger>
</i:Interaction.Triggers>

<Grid x:Name="LayoutRoot" Height="50" RenderTransformOrigin="0.5,0.5">
    <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="VisualStateGroup">
            <VisualState x:Name="Expand">
                <Storyboard>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="LayoutRoot">
                        <EasingDoubleKeyFrame KeyTime="0" Value="80"/>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="UserControl">
                        <EasingDoubleKeyFrame KeyTime="0" Value="79"/>
                    </DoubleAnimationUsingKeyFrames>
                </Storyboard>
            </VisualState>
            <VisualState x:Name="Collapse"/>
        </VisualStateGroup>
    </VisualStateManager.VisualStateGroups>
    <Rectangle x:Name="rectangle" RenderTransformOrigin="0.5,0.5" Width="230" Height="50"/>
    <TextBlock x:Name="NameLabel" FontSize="16" Foreground="#FFE5E5E5" Height="34" Width="149" Text="Onthaal Telefoon" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,10,0,0" FontFamily="Segoe UI Semibold"/>
    <Viewbox HorizontalAlignment="Right" VerticalAlignment="Top" Height="50" Width="58.789">
        <ContentControl Content="{DynamicResource appbar_close}" Width="91.96" Height="79.911" />
    </Viewbox>
</Grid>
</UserControl>

And this is my App file where I define my resources
<Application x:Class="UserControlSolution.App"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         StartupUri="MainWindow.xaml">
<Application.Resources>
    <Canvas x:Key="appbar_close" x:Name="appbar_close" Width="76" Height="76" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
        <Path Width="31.6666" Height="31.6667" Canvas.Left="22.1666" Canvas.Top="22.1667" Stretch="Fill" Fill="#FFEE1111" Data="F1 M 26.9166,22.1667L 37.9999,33.25L 49.0832,22.1668L 53.8332,26.9168L 42.7499,38L 53.8332,49.0834L 49.0833,53.8334L 37.9999,42.75L 26.9166,53.8334L 22.1666,49.0833L 33.25,38L 22.1667,26.9167L 26.9166,22.1667 Z " Stroke="#FF2F2F2F"/>
    </Canvas>

    <Canvas x:Key="appbar_check" x:Name="appbar_check" Width="76" Height="76" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
        <Path Width="37.9998" Height="31.6665" Canvas.Left="19.0001" Canvas.Top="22.1668" Stretch="Fill" Fill="#FF00A300" Data="F1 M 23.7501,33.25L 34.8334,44.3333L 52.2499,22.1668L 56.9999,26.9168L 34.8334,53.8333L 19.0001,38L 23.7501,33.25 Z " Stroke="#FF2F2F2F"/>
    </Canvas>

    <Canvas x:Key="appbar_arrow_right" x:Name="appbar_arrow_right" Width="76" Height="76" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
        <Path Width="39.25" Height="28" Canvas.Left="19.0002" Canvas.Top="24" Stretch="Fill" Fill="#FF2B5797" Data="F1 M 19.0002,34L 19.0002,42L 43.7502,42L 33.7502,52L 44.2502,52L 58.2502,38L 44.2502,24L 33.7502,24L 43.7502,34L 19.0002,34 Z " Stroke="#FF2F2F2F"/>
    </Canvas>

    <SolidColorBrush x:Key="UserControlBackground" Color="#FF2F2F2F"/>

</Application.Resources>

As you can see in the screenshot, only the last control shows the canvas..

A: Since you have only one Canvas and each Visual can have only one parent in visual tree therefore each time you place your resource it's put in that place of visual tree and removed from the previous place. You can either put Canvas directly into ViewBox in UserControl and make Path a resource or you can try setting x:Shared attribute to false on your Canvas which should result in new instance of resource being created each time you refer to it:
<Application.Resources>
    <Canvas x:Key="appbar_close" x:Shared="False" ...>
        <!-- -->
    </Canvas>
</Application.Resources>

A: Set x:Shared=false on resource. It will work.
<Canvas x:Key="appbar_close" x:Name="appbar_close" x:Shared="false" Width="76" Height="76" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0" >


Q: Problems while running the alexa helloWorldSample I try to deploy the alexa helloworld skill on my own Server using this tutorial
I can build the Sample and get 2 jar files in the target directory but when i try to run the Server via
mvn exec:java -Dexec.executable=”java” -DdisableRequestSignatureCheck=true
i get this error:
java.lang.ClassNotFoundException: Launcher
Can anyone help me in this case?
Best regards,
FelixT
Here is my logfile with the error:
[DEBUG] Goal:          org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli)
[DEBUG] Style:         Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <arguments>${exec.arguments}</arguments>
  <classpathScope default-value="runtime">${exec.classpathScope}</classpathScope>
  <cleanupDaemonThreads>${exec.cleanupDaemonThreads} default-value=</cleanupDaemonThreads>
  <commandlineArgs>${exec.args}</commandlineArgs>
  <daemonThreadJoinTimeout default-value="15000">${exec.daemonThreadJoinTimeout}</daemonThreadJoinTimeout>
  <includePluginDependencies default-value="false">${exec.includePluginDependencies}</includePluginDependencies>
  <includeProjectDependencies default-value="true">${exec.includeProjectDependencies}</includeProjectDependencies>
  <keepAlive default-value="false">${exec.keepAlive}</keepAlive>
  <killAfter default-value="-1">${exec.killAfter}</killAfter>
  <localRepository default-value="${localRepository}"/>
  <mainClass>Launcher</mainClass>
  <pluginDependencies default-value="${plugin.artifacts}"/>
  <project default-value="${project}"/>
  <remoteRepositories default-value="${project.remoteArtifactRepositories}"/>
  <skip default-value="false">${skip}</skip>
  <sourceRoot>${sourceRoot}</sourceRoot>
  <stopUnresponsiveDaemonThreads>${exec.stopUnresponsiveDaemonThreads} default-value=</stopUnresponsiveDaemonThreads>
  <systemProperties>
    <systemProperty>
      <key>javax.net.ssl.keyStore</key>
      <value>/root/java-keystore.jks</value>
    </systemProperty>
    <systemProperty>
      <key>javax.net.ssl.keyStorePassword</key>
      <value>XXXXXXXXXX</value>
    </systemProperty>
    <systemProperty>
      <key>com.amazon.speech.speechlet.servlet.disableRequestSignatureCheck</key>
      <value>true</value>
    </systemProperty>
    <systemProperty>
      <key>com.amazon.speech.speechlet.servlet.supportedApplicationIds</key>
      <value>${supportedApplicationIds}</value>
    </systemProperty>
    <systemProperty>
      <key>com.amazon.speech.speechlet.servlet.timestampTolerance</key>
      <value>${timestampTolerance}</value>
    </systemProperty>
  </systemProperties>
  <testSourceRoot>${testSourceRoot}</testSourceRoot>
</configuration>
[DEBUG] =======================================================================
[INFO]
[INFO] >>> exec-maven-plugin:1.2.1:java (default-cli) @ helloworld >>>
[INFO]
[INFO] <<< exec-maven-plugin:1.2.1:java (default-cli) @ helloworld <<<
[DEBUG] Could not find metadata joda-time:joda-time/maven-metadata.xml in local (/root/.m2/repository)
[DEBUG] Failure to find joda-time:joda-time/maven-metadata.xml in file:///root/samples/skill-samples-java-master/helloworld/repo was cached in the local repository, resolution will not be reattempted until the update interval of alexa-skills-kit-repo has elapsed or updates are forced
[DEBUG] Skipped remote update check for joda-time:joda-time/maven-metadata.xml, locally cached metadata up-to-date.
[DEBUG] alexa-skills-kit-samples:helloworld:jar:1.0
[DEBUG]    com.amazon.alexa:alexa-skills-kit:jar:1.6.0:compile
[DEBUG]    org.eclipse.jetty:jetty-server:jar:9.0.6.v20130930:compile
[DEBUG]       org.eclipse.jetty.orbit:javax.servlet:jar:3.0.0.v201112011016:compile
[DEBUG]       org.eclipse.jetty:jetty-http:jar:9.0.6.v20130930:compile
[DEBUG]          org.eclipse.jetty:jetty-util:jar:9.0.6.v20130930:compile
[DEBUG]       org.eclipse.jetty:jetty-io:jar:9.0.6.v20130930:compile
[DEBUG]    org.eclipse.jetty:jetty-servlet:jar:9.0.6.v20130930:compile
[DEBUG]       org.eclipse.jetty:jetty-security:jar:9.0.6.v20130930:compile
[DEBUG]    log4j:log4j:jar:1.2.17:compile
[DEBUG]    org.slf4j:slf4j-api:jar:1.7.10:compile
[DEBUG]    org.slf4j:slf4j-log4j12:jar:1.7.10:compile
[DEBUG]    org.apache.commons:commons-lang3:jar:3.4:compile
[DEBUG]    org.apache.directory.studio:org.apache.commons.io:jar:2.4:compile
[DEBUG]       commons-io:commons-io:jar:2.4:compile
[DEBUG]    com.amazonaws:aws-lambda-java-core:jar:1.0.0:compile
[DEBUG]    com.amazonaws:aws-lambda-java-log4j:jar:1.0.0:compile
[DEBUG]    com.amazonaws:aws-java-sdk-dynamodb:jar:1.9.40:compile
[DEBUG]       com.amazonaws:aws-java-sdk-s3:jar:1.9.40:compile
[DEBUG]          com.amazonaws:aws-java-sdk-kms:jar:1.9.40:compile
[DEBUG]       com.amazonaws:aws-java-sdk-core:jar:1.9.40:compile
[DEBUG]          commons-logging:commons-logging:jar:1.1.3:compile
[DEBUG]          org.apache.httpcomponents:httpclient:jar:4.3.4:compile
[DEBUG]             org.apache.httpcomponents:httpcore:jar:4.3.2:compile
[DEBUG]             commons-codec:commons-codec:jar:1.6:compile
[DEBUG]          com.fasterxml.jackson.core:jackson-databind:jar:2.3.2:compile
[DEBUG]             com.fasterxml.jackson.core:jackson-annotations:jar:2.3.0:compile
[DEBUG]             com.fasterxml.jackson.core:jackson-core:jar:2.3.2:compile
[DEBUG]          joda-time:joda-time:jar:2.9.9:compile
[INFO]
[INFO] --- exec-maven-plugin:1.2.1:java (default-cli) @ helloworld ---
[DEBUG] Created new class realm maven.api
[DEBUG] Importing foreign packages into class realm maven.api
[DEBUG]   Imported: org.apache.maven.cli < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.lifecycle < plexus.core
[DEBUG]   Imported: org.apache.maven.lifecycle < plexus.core
[DEBUG]   Imported: org.apache.maven.repository < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.personality < plexus.core
[DEBUG]   Imported: org.apache.maven.usability < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.configuration < plexus.core
[DEBUG]   Imported: org.sonatype.aether.version < plexus.core
[DEBUG]   Imported: org.sonatype.aether.* < plexus.core
[DEBUG]   Imported: org.sonatype.aether.artifact < plexus.core
[DEBUG]   Imported: org.apache.maven.* < plexus.core
[DEBUG]   Imported: org.apache.maven.project < plexus.core
[DEBUG]   Imported: org.sonatype.aether.repository < plexus.core
[DEBUG]   Imported: org.sonatype.aether.impl < plexus.core
[DEBUG]   Imported: org.apache.maven.exception < plexus.core
[DEBUG]   Imported: org.apache.maven.plugin < plexus.core
[DEBUG]   Imported: org.sonatype.aether.collection < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.* < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.logging < plexus.core
[DEBUG]   Imported: org.apache.maven.profiles < plexus.core
[DEBUG]   Imported: org.sonatype.aether.metadata < plexus.core
[DEBUG]   Imported: org.sonatype.aether.spi < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlPullParserException < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.* < plexus.core
[DEBUG]   Imported: org.sonatype.aether.graph < plexus.core
[DEBUG]   Imported: org.apache.maven.rtinfo < plexus.core
[DEBUG]   Imported: org.sonatype.aether.installation < plexus.core
[DEBUG]   Imported: org.apache.maven.monitor < plexus.core
[DEBUG]   Imported: org.sonatype.aether.transfer < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.context < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.observers < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.resource < plexus.core
[DEBUG]   Imported: org.sonatype.aether.deployment < plexus.core
[DEBUG]   Imported: org.apache.maven.model < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.util.xml.Xpp3Dom < plexus.core
[DEBUG]   Imported: org.apache.maven.artifact < plexus.core
[DEBUG]   Imported: org.apache.maven.toolchain < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlSerializer < plexus.core
[DEBUG]   Imported: org.apache.maven.settings < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.authorization < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.events < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.authentication < plexus.core
[DEBUG]   Imported: org.apache.maven.reporting < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.repository < plexus.core
[DEBUG]   Imported: org.apache.maven.configuration < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.classworlds < plexus.core
[DEBUG]   Imported: org.codehaus.classworlds < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlPullParser < plexus.core
[DEBUG]   Imported: org.apache.maven.classrealm < plexus.core
[DEBUG]   Imported: org.sonatype.aether.resolution < plexus.core
[DEBUG]   Imported: org.apache.maven.execution < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.proxy < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.container < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.component < plexus.core
[DEBUG] Populating class realm maven.api
[DEBUG] org.codehaus.mojo:exec-maven-plugin:jar:1.2.1:
[DEBUG]    org.apache.maven:maven-toolchain:jar:1.0:compile
[DEBUG]    org.apache.maven:maven-project:jar:2.0.6:compile
[DEBUG]       org.apache.maven:maven-settings:jar:2.0.6:compile
[DEBUG]       org.apache.maven:maven-profile:jar:2.0.6:compile
[DEBUG]       org.apache.maven:maven-plugin-registry:jar:2.0.6:compile
[DEBUG]    org.apache.maven:maven-model:jar:2.0.6:compile
[DEBUG]    org.apache.maven:maven-artifact:jar:2.0.6:compile
[DEBUG]    org.apache.maven:maven-artifact-manager:jar:2.0.6:compile
[DEBUG]       org.apache.maven:maven-repository-metadata:jar:2.0.6:compile
[DEBUG]    org.apache.maven:maven-core:jar:2.0.6:compile
[DEBUG]       org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.6:compile
[DEBUG]       org.apache.maven.reporting:maven-reporting-api:jar:2.0.6:compile
[DEBUG]          org.apache.maven.doxia:doxia-sink-api:jar:1.0-alpha-7:compile
[DEBUG]       org.apache.maven:maven-error-diagnostics:jar:2.0.6:compile
[DEBUG]       commons-cli:commons-cli:jar:1.0:compile
[DEBUG]       org.apache.maven:maven-plugin-descriptor:jar:2.0.6:compile
[DEBUG]       org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4:compile
[DEBUG]       org.apache.maven:maven-monitor:jar:2.0.6:compile
[DEBUG]       classworlds:classworlds:jar:1.1:compile
[DEBUG]    org.apache.maven:maven-plugin-api:jar:2.0.6:compile
[DEBUG]    org.codehaus.plexus:plexus-utils:jar:2.0.5:compile
[DEBUG]    org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9:compile
[DEBUG]       junit:junit:jar:3.8.2:test (scope managed from compile) (version managed from 3.8.1)
[DEBUG]    org.apache.commons:commons-exec:jar:1.1:compile
[DEBUG] Created new class realm plugin>org.codehaus.mojo:exec-maven-plugin:1.2.1
[DEBUG] Importing foreign packages into class realm plugin>org.codehaus.mojo:exec-maven-plugin:1.2.1
[DEBUG]   Imported:  < maven.api
[DEBUG] Populating class realm plugin>org.codehaus.mojo:exec-maven-plugin:1.2.1
[DEBUG]   Included: org.codehaus.mojo:exec-maven-plugin:jar:1.2.1
[DEBUG]   Included: org.apache.maven.reporting:maven-reporting-api:jar:2.0.6
[DEBUG]   Included: org.apache.maven.doxia:doxia-sink-api:jar:1.0-alpha-7
[DEBUG]   Included: commons-cli:commons-cli:jar:1.0
[DEBUG]   Included: org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4
[DEBUG]   Included: org.codehaus.plexus:plexus-utils:jar:2.0.5
[DEBUG]   Included: org.apache.commons:commons-exec:jar:1.1
[DEBUG]   Excluded: org.apache.maven:maven-toolchain:jar:1.0
[DEBUG]   Excluded: org.apache.maven:maven-project:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-settings:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-profile:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-plugin-registry:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-model:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-artifact:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-artifact-manager:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-repository-metadata:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-core:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-error-diagnostics:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-plugin-descriptor:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-monitor:jar:2.0.6
[DEBUG]   Excluded: classworlds:classworlds:jar:1.1
[DEBUG]   Excluded: org.apache.maven:maven-plugin-api:jar:2.0.6
[DEBUG]   Excluded: org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9
[DEBUG]   Excluded: junit:junit:jar:3.8.2
[DEBUG] Configuring mojo org.codehaus.mojo:exec-maven-plugin:1.2.1:java from plugin realm ClassRealm[plugin>org.codehaus.mojo:exec-maven-plugin:1.2.1, parent: sun.misc.Launcher$AppClassLoader@a14482]
[DEBUG] Configuring mojo 'org.codehaus.mojo:exec-maven-plugin:1.2.1:java' with basic configurator -->
[DEBUG]   (f) arguments = []
[DEBUG]   (f) classpathScope = runtime
[DEBUG]   (f) cleanupDaemonThreads = false
[DEBUG]   (f) daemonThreadJoinTimeout = 15000
[DEBUG]   (f) includePluginDependencies = false
[DEBUG]   (f) includeProjectDependencies = true
[DEBUG]   (f) keepAlive = false
[DEBUG]   (f) killAfter = -1
[DEBUG]   (f) localRepository =        id: local
      url: file:///root/.m2/repository/
   layout: none

[DEBUG]   (f) mainClass = Launcher
[DEBUG]   (f) pluginDependencies = [org.codehaus.mojo:exec-maven-plugin:maven-plugin:1.2.1:, org.apache.maven.reporting:maven-reporting-api:jar:2.0.6:compile, org.apache.maven.doxia:doxia-sink-api:jar:1.0-alpha-7:compile, commons-cli:commons-cli:jar:1.0:compile, org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4:compile, org.codehaus.plexus:plexus-utils:jar:2.0.5:compile, org.apache.commons:commons-exec:jar:1.1:compile]
[DEBUG]   (f) project = MavenProject: alexa-skills-kit-samples:helloworld:1.0 @ /root/samples/skill-samples-java-master/helloworld/pom.xml
[DEBUG]   (f) remoteRepositories = [       id: alexa-skills-kit-repo
      url: file:///root/samples/skill-samples-java-master/helloworld/repo
   layout: default
snapshots: [enabled => true, update => daily]
 releases: [enabled => true, update => daily]
,        id: central
      url: https://repo.maven.apache.org/maven2
   layout: default
snapshots: [enabled => false, update => daily]
 releases: [enabled => true, update => daily]
]
[DEBUG]   (f) skip = false
[DEBUG]   (f) stopUnresponsiveDaemonThreads = false
[DEBUG]   (s) key = javax.net.ssl.keyStore
[DEBUG]   (s) value = /root/java-keystore.jks
[DEBUG]   (s) key = javax.net.ssl.keyStorePassword
[DEBUG]   (s) value = Felix123
[DEBUG]   (s) key = com.amazon.speech.speechlet.servlet.disableRequestSignatureCheck
[DEBUG]   (s) value = true
[DEBUG]   (s) key = com.amazon.speech.speechlet.servlet.supportedApplicationIds
[DEBUG]   (s) key = com.amazon.speech.speechlet.servlet.timestampTolerance
[DEBUG]   (f) systemProperties = [org.codehaus.mojo.exec.Property@7b159b, org.codehaus.mojo.exec.Property@5d9a50, org.codehaus.mojo.exec.Property@957c0f, org.codehaus.mojo.exec.Property@13a5f75, org.codehaus.mojo.exec.Property@1cb4004]
[DEBUG] -- end configuration --
[DEBUG] Invoking : Launcher.main()
[DEBUG] Plugin Dependencies will be excluded.
[DEBUG] Project Dependencies will be included.
[DEBUG] Collected project artifacts [com.amazon.alexa:alexa-skills-kit:jar:1.6.0:compile, org.eclipse.jetty:jetty-server:jar:9.0.6.v20130930:compile, org.eclipse.jetty.orbit:javax.servlet:jar:3.0.0.v201112011016:compile, org.eclipse.jetty:jetty-http:jar:9.0.6.v20130930:compile, org.eclipse.jetty:jetty-util:jar:9.0.6.v20130930:compile, org.eclipse.jetty:jetty-io:jar:9.0.6.v20130930:compile, org.eclipse.jetty:jetty-servlet:jar:9.0.6.v20130930:compile, org.eclipse.jetty:jetty-security:jar:9.0.6.v20130930:compile, log4j:log4j:jar:1.2.17:compile, org.slf4j:slf4j-api:jar:1.7.10:compile, org.slf4j:slf4j-log4j12:jar:1.7.10:compile, org.apache.commons:commons-lang3:jar:3.4:compile, org.apache.directory.studio:org.apache.commons.io:jar:2.4:compile, commons-io:commons-io:jar:2.4:compile, com.amazonaws:aws-lambda-java-core:jar:1.0.0:compile, com.amazonaws:aws-lambda-java-log4j:jar:1.0.0:compile, com.amazonaws:aws-java-sdk-dynamodb:jar:1.9.40:compile, com.amazonaws:aws-java-sdk-s3:jar:1.9.40:compile, com.amazonaws:aws-java-sdk-kms:jar:1.9.40:compile, com.amazonaws:aws-java-sdk-core:jar:1.9.40:compile, commons-logging:commons-logging:jar:1.1.3:compile, org.apache.httpcomponents:httpclient:jar:4.3.4:compile, org.apache.httpcomponents:httpcore:jar:4.3.2:compile, commons-codec:commons-codec:jar:1.6:compile, com.fasterxml.jackson.core:jackson-databind:jar:2.3.2:compile, com.fasterxml.jackson.core:jackson-annotations:jar:2.3.0:compile, com.fasterxml.jackson.core:jackson-core:jar:2.3.2:compile, joda-time:joda-time:jar:2.9.9:compile]
[DEBUG] Collected project classpath [/root/samples/skill-samples-java-master/helloworld/target/classes]
[DEBUG] Adding to classpath : file:/root/samples/skill-samples-java-master/helloworld/target/classes/
[DEBUG] Adding project dependency artifact: alexa-skills-kit to classpath
[DEBUG] Adding project dependency artifact: jetty-server to classpath
[DEBUG] Adding project dependency artifact: javax.servlet to classpath
[DEBUG] Adding project dependency artifact: jetty-http to classpath
[DEBUG] Adding project dependency artifact: jetty-util to classpath
[DEBUG] Adding project dependency artifact: jetty-io to classpath
[DEBUG] Adding project dependency artifact: jetty-servlet to classpath
[DEBUG] Adding project dependency artifact: jetty-security to classpath
[DEBUG] Adding project dependency artifact: log4j to classpath
[DEBUG] Adding project dependency artifact: slf4j-api to classpath
[DEBUG] Adding project dependency artifact: slf4j-log4j12 to classpath
[DEBUG] Adding project dependency artifact: commons-lang3 to classpath
[DEBUG] Adding project dependency artifact: org.apache.commons.io to classpath
[DEBUG] Adding project dependency artifact: commons-io to classpath
[DEBUG] Adding project dependency artifact: aws-lambda-java-core to classpath
[DEBUG] Adding project dependency artifact: aws-lambda-java-log4j to classpath
[DEBUG] Adding project dependency artifact: aws-java-sdk-dynamodb to classpath
[DEBUG] Adding project dependency artifact: aws-java-sdk-s3 to classpath
[DEBUG] Adding project dependency artifact: aws-java-sdk-kms to classpath
[DEBUG] Adding project dependency artifact: aws-java-sdk-core to classpath
[DEBUG] Adding project dependency artifact: commons-logging to classpath
[DEBUG] Adding project dependency artifact: httpclient to classpath
[DEBUG] Adding project dependency artifact: httpcore to classpath
[DEBUG] Adding project dependency artifact: commons-codec to classpath
[DEBUG] Adding project dependency artifact: jackson-databind to classpath
[DEBUG] Adding project dependency artifact: jackson-annotations to classpath
[DEBUG] Adding project dependency artifact: jackson-core to classpath
[DEBUG] Adding project dependency artifact: joda-time to classpath
[DEBUG] joining on thread Thread[Launcher.main(),5,Launcher]
[WARNING]
java.lang.ClassNotFoundException: Launcher
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:285)
    at java.lang.Thread.run(Thread.java:748)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:46.627s
[INFO] Finished at: Fri Oct 27 19:09:37 UTC 2017
[INFO] Final Memory: 7M/17M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project helloworld: An exception occured while executing the Java class. Launcher -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project helloworld: An exception occured while executing the Java class. Launcher
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: An exception occured while executing the Java class. Launcher
    at org.codehaus.mojo.exec.ExecJavaMojo.execute(ExecJavaMojo.java:352)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more
Caused by: java.lang.ClassNotFoundException: Launcher
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:285)
    at java.lang.Thread.run(Thread.java:748)
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

and the Pom.xml:
    http://maven.apache.org/maven-v4_0_0.xsd">
      4.0.0
      alexa-skills-kit-samples
      helloworld
      jar
      1.0
      helloworld
      http://developer.amazon.com/ask
  <repositories>
    <repository>
      <id>alexa-skills-kit-repo</id>
      <url>file://${project.basedir}/repo</url>
    </repository>
  </repositories>

  <dependencies>
    <dependency>
      <groupId>com.amazon.alexa</groupId>
      <artifactId>alexa-skills-kit</artifactId>
      <version>1.6.0</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-server</artifactId>
      <version>9.0.6.v20130930</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-servlet</artifactId>
      <version>9.0.6.v20130930</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.17</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>1.7.10</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
      <version>1.7.10</version>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>3.4</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.directory.studio</groupId>
      <artifactId>org.apache.commons.io</artifactId>
      <version>2.4</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.amazonaws</groupId>
      <artifactId>aws-lambda-java-core</artifactId>
      <version>1.0.0</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.amazonaws</groupId>
      <artifactId>aws-lambda-java-log4j</artifactId>
      <version>1.0.0</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.amazonaws</groupId>
      <artifactId>aws-java-sdk-dynamodb</artifactId>
      <version>1.9.40</version>
    </dependency>
  </dependencies>

  <properties>
    <property name="disableRequestSignatureCheck" value="false"/>
    <property name="supportedApplicationIds" value=""/>
    <property name="timestampTolerance" value="150"/>
  </properties>

  <build>
    <sourceDirectory>src</sourceDirectory>
    <resources>
      <resource>
        <directory>src/resources</directory>
      </resource>
    </resources>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.3</version>
          <configuration>
            <source>1.7</source>
            <target>1.7</target>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>exec-maven-plugin</artifactId>
          <version>1.2.1</version>
          <configuration>
            <mainClass>Launcher</mainClass>
            <systemProperties>
              <systemProperty>
                <key>javax.net.ssl.keyStore</key>
                <value>/root/java-keystore.jks</value>
              </systemProperty>
              <systemProperty>
                <key>javax.net.ssl.keyStorePassword</key>
                <value>Felix123</value>
              </systemProperty>
              <systemProperty>
                <key>com.amazon.speech.speechlet.servlet.disableRequestSignatureCheck</key>
                <value>${disableRequestSignatureCheck}</value>
              </systemProperty>
              <systemProperty>
                <key>com.amazon.speech.speechlet.servlet.supportedApplicationIds</key>
                <value>${supportedApplicationIds}</value>
              </systemProperty>
              <systemProperty>
                <key>com.amazon.speech.speechlet.servlet.timestampTolerance</key>
                <value>${timestampTolerance}</value>
              </systemProperty>
            </systemProperties>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</project>


Q: Keep icon bar floated right and wrap text around I have a little header bar in html/css where there are a couple icons floated to the right side. I want them to remain in position and have the title (on the left) just wrap below if the area gets too small on the right side. Right now, my html looks like so (using bootstrap) :

02 Development, LLC v. 607 South Park, LLC

So I have a col-sm-8 and col-sm-4. This will not work in the long run because col-sm-4 is too small in certain sizes, so I need to make the right column with the icon have a set width (140px lets say). So if a set a min-width on the right side it's going break on smaller sizes.
What I am wondering if, is there a way to let that title on the left side in the col-sm-8 move around the set width buttons on the right side when responsive (i basically want the buttons to stay in the same place the whole time). Something like if the buttons on the right were absolutely position but not out of the flow so the text reacts to it.
Here is a fiddle I was fooling with https://jsfiddle.net/DTcHh/24085/
EDIT
So I improvised a solution by doing the following :
- taking the right icon-bar element out of the dom flow by absolutely positioning it and giving it a set with
- adding the same width as padding to the element wrapping both the left and the right items
I could then just do away with the col's all together. The code looks like so :
HTML:

02 Development, LLC v. 607 South Park, LLC

        123

test 123345.

cases

CSS:
.activity-panel-item {
  height: 100%;
  padding: 0;
}

.activity-panel-item--header {
  position: fixed;
  width: 100%;
  top: 0;
  left: 0;
  padding: 12px 125px 12px 12px;
  min-height: 50px;
  background-color: rgba(0, 0, 0, 0.8);
}

.activity-panel-item--header p {
  color: #fff;
}

.activity-panel-item--header .icon {
  cursor: pointer;
  color: #fff;
  margin: 0px 12px;
  font-size: 20px;
}

.activity-panel-item--body {
  overflow-y: auto;
  padding: 10px 20px;
  display: block;
  width: 100%;
  height: 100%
}

.activity-title-input {
  width: 100%;
}

.activity-panel-item--header--iconbar {
  display: block;
  float: right;
  top: 10px;
  right: 10px;
  width: 125px;
  min-height: 50px;
  height: auto;
  position: absolute;
}

See working fiddle: https://jsfiddle.net/DTcHh/24114/
Any and all input would be helpful, or if anyone has a different working approach that would be great also. Thanks!

A: You can do it without bootstrap col-*-* and by giving the explicit width to both divs, plus little extra style to your icon bar.
Updated Code

02 Development, LLC v. 607 South Park, LLC

123

jsFiddle
EDIT 1
If you think deeply according to this solution we both are at same point. Let me explain, I am giving minimum width 25% to icon bar and 75% width to left element. That mean depending on situation width of icon bar can be increase but it must be at least 25% of total screen or container and width of left element is 75% that can be decrease depending on situation.
And you are giving width 125px or any to icon bar that means it can be increase or decrease depending on situation but the original is 125px
Here the situation I mean area and screen resolution. If icon are larger and not fit in 25% then this width can be increase and left element can be decrease same is your edited case if icon bar not fit in 125px then this width can be increase because we are not mentioning the maximum width to icon bar or minimum width to left element.
.
EDIT 2
I hope this is not illegal on stackoverflow to edit answer as many time as I need.
Apart from coding let’s do some math. Suppose we have 3 icon of (32x32) each. So the total width of icon wrapper will (32+32+32) 96px add little margin of 12px to each icon (12x3=36) on right side for beauty. Now the wrapper width is 96+36 = 132px. And we are on device that has width of 400px. My icon wrapper is (25%) 100px of 400px (device width) and your wrapper is 125px. I am saying OK browser minimum width of icon wrapper is 100px but if icons are larger and not fit in 100px you can increase this width according to you need, In this case it will increase 100px to 132px or any. But I don't want to break these icons to next line. They should be display in their original size and style (32x32) plus margin. You can break left content (text) to wrap around these icons but don't break the icons itself. They should retain their original size. No matter what ever device width is. Browser, Please don't decrease the icon size just increase wrapper width.
And your 125px is less than 132px. So your wrapper will break and one of its icon will move to next line. Until you have to go to you CSS and explicitly wrote 132px or any in width. And what if after one month your boss said please place icon of 40x40 and after 3 month and so on...?
Try it, place larger icons and see what happens to your width: 125px.

A: Unless I am totally misunderstanding you.. here is a easy method. Too much CSS
classes so I used my own but you get the concept.

02 Development, LLC v. 607 South Park, LLC

    1
    2
    3

test 123345.

Nothing Here

cases

Demo: https://jsfiddle.net/norcaljohnny/ovo83p5k/


Q: Displaying malformed html with twig Assume we have a string
$mystring = "<b> Hello"

How can I display this string using twig while preventing leaking html tags? Or in other word how can I make twig to close tags automatically if they are still open?
I guess {{ mystring | raw }} just prints raw text without verifying / purifying.

A: sw_sanitize does this already.
{{ '<b> hello' | sw_sanitize }}

Produces:
<b> hello</b
Internally \HTMLPurifier::purify is used, which

Filters an HTML snippet/document to be XSS-free and standards-compliant.


Q: Compare Checkbox List values for Nothing Checked through LINQ I'm using below code for filtering on the basis of Checkboxlist but, filter is not working if I don't select anything. It has to show all the values if I don't checked any value.
Below is the code for that :
var selectedIds = chklstDepartment.Items.Cast<ListItem>().Where(item => item.Selected).Select(item => item.Value).ToArray();
                        List<LessonLearnDetails> objLessonDetails = objLessonDashboard.getLessonLearntDetails();
                        var searchData = objLessonDetails.Where(i => (ddlAsset.SelectedValue == "0") || (i._Asset.AssetID == ddlAsset.SelectedValue))
                    .Where(i => (ddlAuditType.SelectedValue == "0") || (i._Audit.AuditTypeID == ddlAuditType.SelectedValue))
                    .Where(i => (chklstDepartment.SelectedValue == "0") || (selectedIds.Contains(i._Department.DepartmentID)))
                    .Where(i => (ddlCategory.SelectedValue == "0") || (i._Category.CategoryID == ddlCategory.SelectedValue))
                      .Where(i => (ddlStartYear.SelectedItem.Text == "--Select All--") || (Convert.ToInt32(i._Year.StartYear) >= Convert.ToInt32(ddlStartYear.SelectedItem.Text)))
                .Where(i => (ddlEndYear.SelectedItem.Text == "--Select All--") || (Convert.ToInt32(i._Year.EndYear) <= Convert.ToInt32(ddlEndYear.SelectedItem.Text)))
                    .Distinct().ToList();
                        BindGrid(searchData);

A: Use "" in place of "0".
chklstDepartment.SelectedValue == ""


Q: How can I create views with dynamic content in iOS? I' m encountered with a problem because of my lack of knowledge of iOS platform I think.I have a view controller User Profile. The main view has next structure: ScrollView which contains one subview and this UIView has 7 UIViews with UILabels, UItextViews, UIImageViews, etc. each of them displays specific info about user. The problem - data for this views is fetched from the server and it can be different. E.g I have a subview Education, it contains next info: name of the institute, degree, years of learning, etc. But one user can have several educations. So the size of this view can be dynamic. But i can't simply change the view size with view.frame = CGRectMake because under it I have a view job experience and etc. Or for example professional skills view: it can be one skill and it can be one hundred skills for one user -so I need to change the size of this view but under it I have another view so i need to move it and so on and so forth. So the question what is the correct way of dealing with this situation? I understood that I can't just change view frames with view.frame= CGRectMake() - because it is too much work and it is a stupid approach I think. I know there must be some more straightforward way for this very common problem, may be autolayout or something else? Anyway I hope for some help and advice of how can I make views with dynamic content.

A: I really don't know why you said "I can't just change view frames". Of course you can!
The approach I always take to this scenario (where your view's height is variable) is to declare a yOffset property and based on this I place my content at the right y position.
@property (nonatomic, assign) int yOffset;

Then inside the init method I initialize this property to either 0 or some predefined initial margin.
_yOffset = TOP_MARGIN;

Then consider the following scenario: a user profile with n number of skills. This is how you would use the yOffset property.
for (int i=0; i<n; ++i)
{
    // place the skillView at the right 'y' position
    SkillView *skillView = [[SkillView alloc] initWithFrame:CGRectMake(0,self.yOffset,300,50)];
    // configure the skillView here
    [self.view addSubview:skillView];

    // Don't forget it has to be "+=" because you have to keep track of the height!!!
    self.yOffset += skillView.frame.size.height + MARGIN_BETWEEN_SKILLS;
}

And then imagine the user profile has c number of Education entries; same thing:
for (int i=0; i<c; ++i)
{
    // place the educationView at the right 'y' position
    EducationView *educationView = [[EducationView alloc] initWithFrame:CGRectMake(0,self.yOffset,300,50)];
    // configure the educationView here
    [self.view educationView];

    // Don't forget it has to be "+=" because you have to keep track of the height!!!
    self.yOffset += educationView.frame.size.height + MARGIN_BETWEEN_EDUCATIONS;
}

Finally, when all your subviews have been added you have to change the frame of the containing view. (Because when you created it you couldn't know upfront how tall it was going to be)
CGRect viewFrame = self.view.frame;
viewFrame.size.height = self.yOffset + BOTTOM_MARGIN;
self.view.frame = viewFrame;

And that's it.
Hope this helps!

A: As you've stated, manually updating the frames is a lot of work and is the old way of doing things. The new better way as you've also said is to use auto layout. Describing how to use auto layout to position your views would require more specific information on how you want it to look but there are some awesome tutorials out there on the web! Here's one of many:
Ray Wenderlich autolayout in iOS 7 part 1


Q: [wso2][APIM 3.2] conditional engagement of handler does not work I try to write my own WSO2 3.2 APIM Handler.
My purpose is :

*

*engage Handler when a dedicated property is set on API

*consume the request and use the binary response to decrypt part of it

*change the content type of the response after decryption

I successfuly write my handler and modify the velocity_template.xml as follow (following the documentation):
#if($apiObj.additionalProperties.get('encrypted') == "true"))
<handler class="org.rudi.wso2.mediation.EncryptedMediaHandler">
    <property name="encryptedMimeType" value="$apiObj.additionalProperties.get('encrypted_mime_type')"/>
    <property name="mimeType" value="$apiObj.additionalProperties.get('mime_type')"/>
    <property name="providerUuid" value="dummy"/>
</handler>
#end

But this does not work and the handler is not engaged.
If I remove the #if condition the handler is engaged but the properties are not interpreted (for exemple the "mimeType" field is explicitly set to "$apiObj.additionalProperties.get('mime_type')" and not to the value of the additionnalProperty set on API.
What is wrong ?
How could I use the additionnal properties added on API ?
Next when the Handler is called, I did not find any way to read the response of the endpoint.
I find code to change the response ou the response status code to write fault for exemple
But I did not find a way to read the binary response send by my endpoint to work on it.
Help will be appreciated!
UPDATED
For the second part of the question, I create a method as follow:
private void replaceBody(SOAPBody body) throws IOException {
        OMElement element = body.getFirstElement();
        if (element.getLocalName().equalsIgnoreCase(BINARY_LOCAL_NAME)) {
            OMNode subChild = element.getFirstOMChild();
            if (subChild instanceof OMText && ((OMText) subChild).isBinary()) {
                OMText textNode = ((OMText) subChild);
                DataHandler originalDataHandler = (DataHandler) textNode.getDataHandler();

                InputStream modifiedInputStream = modify(originalDataHandler.getInputStream());

                DataHandler newDataHandler = new DataHandler(new StreamingOnRequestDataSource(modifiedInputStream ));
                OMText newTextNode = body.getOMFactory().createOMText(newDataHandler, true);

                textNode.insertSiblingBefore(newTextNode);
                textNode.detach();
            }
        }
    }

And I lookup for SOAPBody as follow :
org.apache.axis2.context.MessageContext axis2MC = ((Axis2MessageContext) messageContext)
                    .getAxis2MessageContext();
RelayUtils.buildMessage(axis2MC, true);
axis2MC.setProperty(RelayConstants.FORCE_RESPONSE_EARLY_BUILD, Boolean.TRUE);
SOAPBody body = axis2MC.getEnvelope().getBody();

I test the behaviour on small file but I think we need to do more stuff to handle big file ou chunked api.
Any advice?

A: Regarding velocity_template.xml & API Properties Configurations
The velocity_template.xml file is used to construct the API Synapse Artifacts to deploy them in the Gateway. As it is a common template file, you have to place your conditions and customizations in the correct sections of the template to reflect in the Synapse Artifact.
If you are trying to publish a REST API, then place your code block after this section in the velocity_template.xml
#foreach($handler in $handlers)
<handler xmlns="http://ws.apache.org/ns/synapse" class="$handler.className">
    #if($handler.hasProperties())
    #set ($map = $handler.getProperties() )
    #foreach($property in $map.entrySet())
    <property name="$!property.key" value="$!property.value"/>
    #end
    #end
</handler>
#end

<!-- place your block here -->

This makes sure, that your handler is engaged after all mandatory Handlers of the API Managers are engaged. If you want to engage your handler in the middle, then add a condition within #foreach block to append your handler. You can follow this doc for more detailed information.
Once the velocity_template.xml changes are made, re-publish the API by selecting the Gateway environments to deploy the updated Synapse Artifacts. If it is a distributed environment, make sure to update the velocity_template.xml of the Publisher node.
Also, check for any typos in your code block: I see an extra ) at the end of the #if condition.
#if($apiObj.additionalProperties.get('encrypted') == "true"))
...


Q: Stanford Parser for Python: Output Format I am currently using the Python interface for the Stanford Parser.
    from nltk.parse.stanford import StanfordParser
    import os

    os.environ['STANFORD_PARSER'] ='/Users/au571533/Downloads/stanford-parser-full-2016-10-31'
    os.environ['STANFORD_MODELS'] = '/Users/au571533/Downloads/stanford-parser-full-2016-10-31'
    parser=StanfordParser(model_path="edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz")

    new=list(parser.raw_parse("The young man who boarded his usual train that Sunday afternoon was twenty-four years old and fat. "))
    print new

The output I get looks something like this:
    [Tree('ROOT', [Tree('S', [Tree('NP', [Tree('NP', [Tree('DT', ['The']), Tree('JJ', ['young']), Tree('NN', ['man'])]), Tree('SBAR', [Tree('WHNP', [Tree('WP', ['who'])]), Tree('S', [Tree('VP', [Tree('VBD', ['boarded']), Tree('NP', [Tree('PRP$', ['his']), Tree('JJ', ['usual']), Tree('NN', ['train'])]), Tree('NP', [Tree('DT', ['that']), Tree('NNP', ['Sunday'])])])])])]), Tree('NP', [Tree('NN', ['afternoon'])]), Tree('VP', [Tree('VBD', ['was']), Tree('NP', [Tree('NP', [Tree('JJ', ['twenty-four']), Tree('NNS', ['years'])]), Tree('ADJP', [Tree('JJ', ['old']), Tree('CC', ['and']), Tree('JJ', ['fat'])])])]), Tree('.', ['.'])])])]

However, I only need the part of speech labels, therefore I'd like to have an output in a format that looks like word/tag.
In java it is possible to specify -outputFormat 'wordsAndTags' and it gives exactly what I want. Any hint on how to implement this in Python?
Help would be GREATLY appreciated.
Thanks!
PS: Tried to use the Stanford POSTagger but it is by far less accurate on some of the words I'm interested in.

A: If you look at the NLTK classes for the Stanford parser, you can see that the the raw_parse_sents() method doesn't send the -outputFormat wordsAndTags option that you want, and instead sends -outputFormat Penn.
If you derive your own class from StanfordParser, you could override this method and specify the wordsAndTags format.
from nltk.parse.stanford import StanfordParser

class MyParser(StanfordParser):

        def raw_parse_sents(self, sentences, verbose=False):
        """
        Use StanfordParser to parse multiple sentences. Takes multiple sentences as a
        list of strings.
        Each sentence will be automatically tokenized and tagged by the Stanford Parser.
        The output format is `wordsAndTags`.

        :param sentences: Input sentences to parse
        :type sentences: list(str)
        :rtype: iter(iter(Tree))
        """
        cmd = [
            self._MAIN_CLASS,
            '-model', self.model_path,
            '-sentences', 'newline',
            '-outputFormat', 'wordsAndTags',
        ]
        return self._parse_trees_output(self._execute(cmd, '\n'.join(sentences), verbose))


Q: HTML in MySQL Database -- Best Practices I'm beginning to create a system whereby I (as the only user at present) will be loading a dynamically created PHP page which has a
 in it.  I then will be grabbing the HTML of that
 and saving it to be displayed to other users in a separate area of the website.
My Questions: What are some best practices to follow for this kind of thing?  Saving the HTML as TEXT or LONGTEXT in MySQL?  BLOB?  Maybe even saving this data as a .txt file which uses PHP include() to include it into the file which displays it to users?
I'm not really sure of the best approach for this kind of thing, and thus the barrage of questions.  I'm also not very familiar with creating databases and therefore, I'm not knowledgeable as to their strengths/weaknesses.  It seems like using a MySQL database for this is the way to go, but I'm not married to it.
Note #1: The HTML must be preserved in it's entirety.  So something like
Let's use blue for this.
 can't end up coming out as
Let\'s use blue for this.
.
Note #2: The table I'm saving from gets randomly generated (including number of rows/columns) each time.  So, I need all data within the table, including all
's and 's.

A: Both MySQL and HTML files can work. Your choice should depend on how simple the data is, and how much you are storing.
Some considerations:

*

*Speed. The HTML files and include() approach is going to be faster. The file system is the fastest, simplest form of data persistence.

*Horizontal scalability. If you adopt the file system approach, you are more or less tied to the disk on that machine. With a separate database engine, you have the future option of running the database on separate cluster servers on the network.

*Meta Data. Do you need to store things like time of creation, which user created the HTML, how many times it has been viewed by other users? If so, you probably only have one realistic choice - a "proper" database. This can be MySQL or perhaps one of the NoSQL solutions.

*Data Consumption. Do you show the table in its entirety to other users? Or do you show selected parts of it? Possibly even different parts to different users? This impacts how you store data - the entire table as ONE entity, or each row as an entity, or each individual cell.

*TEXT or LONGTEXT? Of course only applicable if you're going with SQL. The only way to answer this is to know how many bytes you are expecting to store per "HTML fragment". Note that your character encoding also impacts the number of bytes stored. Refer to: TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT maximum storage sizes
Also note that in MySQL, each TEXT/LONGTEXT may also result in an I/O to the disk.
As for the concern:

The HTML must be preserved in its entirety.

As long as you don't escape the HTML at any point, you should be fine. At first glance, this violates a security best practice, but if you think about it, "not escaping HTML" is exactly what you want to do. The practice of escaping HTML output only helps to eliminate HTML syntax being parsed as HTML tags (potential malicious), but in your case, you don't want HTML syntax eliminated at all - you intentionally want  to be parsed into an actual HTML table cell. So do not escape anything and the example you gave should never occur.
Just note: although you do not HTML-escape the output, you still should filter your inputs. In essence, this means: before writing to your DB, check that the user input is indeed HTML. To enhance your application's security, it may also be wise to define rules for what can be stored in those table cells - perhaps no  or  allowed, no style attributes allowed etc. Also, watch out for SQL injection - use PDO and prepared statements if you're going PHP + MySQL.

A: Live by this rule: PHP is for formatting; MySQL is for data.
PHP is for building HTML.  MySQL is useful as a persistent store for data from which PHP can build HTML.
I have built several systems with Apache+PHP+MySQL.  Each page is PHP-generated HTML.  I do not store  in MySQL, only data.
Some of my pages perform one SELECT; many pages perform a dozen or more.  The performance is just fine.  I use PHP subroutines to build
s.  I construct style variations based on the data.
Let's use blue for this might be in some database table; PHP code would add the
 tags around it.

A: Someone is going to come up with the php to do this correctly, but here's an idea.

*

*Learning a database is a separate exercise that should not be mixed with learning anything else.  Leave MySQL out of this.  If you want to go back and redo the project with it as a learning exercise, after you've spent some time learning the basics, go ahead.

*What you are going to want to do is to generate your table as a separate .php fragment, and then save it to the disk under a unique name that you can use to find it again later (maybe it is a date/time, maybe a number that keeps increasing, maybe a different way).  After it is saved, you can then include it into your page as well as the other pages you want to include it.  Getting that unique name may be a challenge, but that is a different question (and if you look around, probably already has an answer somewhere).

*If you know .php enough, the rest should be self explanatory.  If you don't, then now is an excellent time to learn.  If you have further questions, you can search stack overflow or google for the answers.  Chances are, the answers are out there.

*Since I do know databases, there could be an interesting discussion that the other posters are trying to have with you about how to store the data.  However, that discussion will only be really useful to you once you understand what we are trying to talk about.  Besides, I bet it has already been asked at least once.

So try out that plan and come back and post how you did it for future readers.  Happy coding.

A: What you want to do is absolutely not Three-tier architecture like said Rick James, you are mixing data and presentation.
But like in everything, it is up what you want to do and your strategy.

*

*Let say, if you are looking to build an application with specific mould of page with a specific space for an image with a specific data at this place and you want to maintain this same architecture for years, you should separate data and presentation. Most of the time, big companies, big applications are looking for this approch. Even if I know some big companies application, we have stored some HTML code in database.

*Now, if you want to be free to change every page design quickly, you can have HTML tag in your database.
For example, Wordpress has a lot of HTML tag in its table for years and it is still maintained and used by a lot of people. Saving HTML in database? According to your needs/strategy, it does not schock me.

*And for your information, in Wordpress a HTML post is saved as LONGTEXT.

*In this approach, like Wordpress, you will not have a strong database model, it will be messy and not really relationnal.
^^

A: I don't know how many tables are you planning to store, but if you don't need to make complicated operations like sorting or filtering you could just store them in files in a folder structure, that will consume less resources than MySQL and the entire file is preserved.
If you need many tables then don't store the HTML table, store a json with the info like this:
[
    [
    {
      "content": "Let's use blue for this.",
      "color": "blue"
    },
    {
      "content": "Let's use red for this.",
      "color": "red"
    }
    ],
    [
     {
      "content": "Another row.",
      "color": "blue"
    },
     {
      "content": "Another row.",
      "color": "red"
    }
  ]
]

And then rebuild it when you call it. Will use less space and will be faster to transfer.
If your tables are in a fixed format, then make a table with the fields you need.

A: I would recommend thinking of your table as a kind of object. SQL tables are meant to store relational data. As such, why not represent the table in that fashion? Below is a really basic example of how you could store a table of People data in SQL.

    People ID
    First Name
    Last Name

        1
        John
        Doe

        2
        Jane
        Doe

And then your SQL Table would store the encrypted string as follows (using JS):
function utf8_to_b64( str ) {
  return window.btoa(unescape(encodeURIComponent( str )));
}

function b64_to_utf8( str ) {
  return decodeURIComponent(escape(window.atob( str )));
}

var my_table = $('#table').html();

// Store this
var encrypted_string = utf8_to_b64(my_table);

// Decode as so
var table = b64_to_utf8(encrypted_string);

B64 encoding retrieved from here: https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding


Q: copying a page n number of times with pdfbox I have made a single page pdf template file.  I then use pdfbox to create a pdf with "n" number of pages (depending on report size).  I want all "n" of these pages to be the page from the template pdf file.  What is the best way to get all "n" pages to be a copy of that page?  Here is my current code:
PDDocument document = null;
try {
    document = PDDocument.load(WestfieldClientReportApp.class.getResource("/com/dramble/resources/template.pdf"));
} catch (IOException ex) {
    Logger.getLogger(WestfieldClientReportView.class.getName()).log(Level.SEVERE, null, ex);
}

PDPage templatepage = (PDPage) document.getDocumentCatalog().getAllPages().get(0);

int n = 0;
while (n < numPages) {
    n++;
    document.importPage(templatepage);
}

The problem is when I have large result sets.  I'll open the pdf, it will show as 11 pages, the first 2 pages look great, but when I scroll to the 3rd page, Acrobat errors, though the template page seems to be there, but without my report data on it.  I figure the problem is probably with the code above.  Any ideas?  Thanks.

A: it might be because when you are casting explicitely from list to PDPage, it removes its acrofields.

A: Your code doesn't appear to be saving the result. Are you?
Here is my answer to a similar scenario which may help you.


Q: Refresh id_token ADAL: Angular 4 I'm using Angular 4 with ADAL to authenticate users in my web application, using ng2-adal library which is a wrapper for adal.js.
The problem I'm facing is the following:
So the token expires after a time limit and I have a canActivate route guard that checks if the user is authenticated. If not, it navigates the users to the login page. This is how my route guard is looking:
import { Injectable } from '@angular/core';
import { Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { AdalService } from 'ng2-adal/dist/core';

@Injectable()
export class RouteGuard implements CanActivate {

  constructor(private router: Router, private adalService: AdalService) {}

  canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
    if (this.adalService.userInfo.isAuthenticated) {
      return true;
    } else {
        this.router.navigate(['/user-login']);
        return false;
    }
  }
}

so whenever the token expires, the user is navigated to the login page, which is annoying for the users. Is there a way to renew the token whenever it expires?

A: I figured it out. This is how I added it:
import { Injectable } from '@angular/core';
import { Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { AdalService } from 'ng2-adal/dist/core';

@Injectable()
export class RouteGuard implements CanActivate {

  constructor(private router: Router, private adalService: AdalService) {}

  canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
    if (this.adalService.userInfo.isAuthenticated) {
      return true;
    } else {
      this.adalService.acquireToken(this.adalService.config.clientId).toPromise().then((data) => {
      console.log('Generating a new authentication token.');
      return true;
    },
     (error) => {
       console.log('No user logged in.');
       this.router.navigate(['/user-login']);
       return false;
     }
    }
  }
}

A: I had the same issue and my fix worked.
In app.component.ts, add this code to ngOnit().
this.adalService.handleWindowCallback();
 this.adalService.acquireToken(this.adalService.config.loginResource).subscribe(token => {
  this.adalService.userInfo.token = token;
  if (this.adalService.userInfo.authenticated === false) {
    this.adalService.userInfo.authenticated = true;
    this.adalService.userInfo.error = '';
  }
}, error => {
  this.adalService.userInfo.authenticated = false;
  this.adalService.userInfo.error = error;
  this.adalService.login();
});

When token expires, app component gets called, and acquire token refreshes the token silently. But the this.adalService.userInfo.authenticated is still false leading to redirection or again calling login method. So manually setting it to true fixes the redirection error. this.adalService.config.loginResource this is automactically set by adal-angular itself with the resource that we need token for.
Also add       expireOffsetSeconds: 320, to adal configuration data settings along with
tenant: configData.adalConfig.tenant,
  clientId: configData.adalConfig.clientId,
  redirectUri: window.location.origin,

expireoffsetseconds invalidates the token based on the time that we specify before its actual expiry.


Q: Save changes in xlsm Workbook as xlsx without subsequent user confirmation I have an Excel file with a macro (.xlsm).
In the macro, I want to make changes in thisworkbook (where macro is) and save the organized workbook in the same folder of thisworkbook with a different name (and if possible as a .xlsx file, since I do not need the macro in the final file, if not possible as .xlsm).
After running macro, I do not want the user to do anything. Also, I do not want to save any changes in the original (reference) workbook.
I tried the following: (Assume this is in macro's sub)
    Dim wb As Workbook
    Set wb = ThisWorkbook

    ''''''''''''''''''''''''''''''''''''''''''''''''
    ' Check if final file exists, if so delete '''''
    ''''''''''''''''''''''''''''''''''''''''''''''''

    wb.SaveCopyAs (wb.path & "\final.xlsm")

    Dim wbf As Workbook
    Set wbf = Workbooks.Add(wb.path & "\final.xlsm")
    wbf.Activate

    ''''''''''''''''''''''''''''''''''''''''''''''''
    ' Changes to wbf '''''''''''''''''''''''''''''''
    ''''''''''''''''''''''''''''''''''''''''''''''''

    wbf.Save

I (as user) get a selection box:
" The following features cannot be saved in macro free workbooks
" VB project
" To save a file with these features, click No, and then choose a macro enabled file type in the File Type list.
" To continue saving as a macro free workbook, click Yes
"Yes", "No", "Help"
If I click Yes, it mentions that final1.xlsx already exists, and asks whether to overwrite or not. If click overwrite, the mentioned xlsx file open, final xlsm file gets saved at path.
This situation asks the user to click on something and also displays a new Excel file which I hope to avoid.

A: Try adding Application.DisplayAlerts = False prior to the main code, and set it back to Application.DisplayAlerts = True after.


Q: Primitive derived operations and combinators in EDSL:s I recently flunked an exam, mostly because of a EDSL question. I did not grasp these concepts so I think thats why I failed. I think my teachers explanation was to abstract for me to understand, so I wonder if someone could explain it more clearly.
I wonder if someone could explain briefly what the components of a EDSL is, and what characterize them. In our course we have gone through Shallow and Deep Embedding of a DSL and looked at the following building blocks for a DSL:

*

*Constructor functions

*Combinators (primitive and derived)

*Run functions

I think contructor and run functions are more self-explanatory, so Im more interested to understand what makes a Combinator derived or primitive. It doesn´t hurt if someone will explain the other concepts. Here is an example from our lectures for reference. Its a shallow implemenation of a DSL for creating signals:
module Signal.Shallow
( Time
-- | the 'Signal' type is abstract
, Signal
-- * Smart constructors
, constS, timeS
-- * Combinators
, ($$), mapT
-- * Derived operation
, mapS
-- * Run function
, sample
) where

-- * Smart constructors
constS :: a -> Signal a
timeS  ::      Signal Time
-- * Combinators
($$)   :: Signal (a -> b) -> Signal a -> Signal b
mapT   :: (Time -> Time)  -> Signal a -> Signal a
-- * Derived operation
mapS   :: (a -> b)        -> Signal a -> Signal b
-- * Run function
sample :: Signal a -> Time -> a

type Time = Double
newtype Signal a = Sig {unSig :: Time -> a}

-- | The constant signal.
constS x = Sig (const x)

-- | The time signal
timeS = Sig id

-- | Function application lifted to signals.
fs $$ xs = Sig (\t -> unSig fs t  (unSig xs t))

A: A primitive combinator is one that's built into the DSL, defined in the base language (ie Haskell). DSLs are often built around an abstract type—a type whose implementation is hidden to the end-user. It's completely opaque. The primitive combinators, presented by the language, are the ones that need to know how the abstraction is actually implemented to work.
A derived combinator, on the other hand, can be implemented in terms of other combinators already in the DSL. It does not need to know anything about the abstract types. In other words, a derived combinator is one you could have written yourself.
This is very similar to the idea of primitive types in Haskell itself. For example, you can't implement Int or the Int operations like + yourself. These require things built into the compiler to work because numbers are treated specially. On the other hand, Bool is not primitive; you could write it as a library.
data Bool = True | False -- ... you can't do this for Int!

"Primitive" and "derived" for DSLs is the same idea except the compiler is actually your Haskell library.
In your example, Signal is an abstract type. It's implemented as a function Time -> a, but that information is not exported from the module. In the future, you (as the author of the DSL) are free to change how Signal is implemented. (And, in fact, you'd really want to: this is not an efficient representation and using Double for time is finicky.)
A function like $$ is primitive because it depends on knowing that Signal is Time -> a. When you change the representation of Signal, you'll have to rewrite $$. Moreover, a user of your library wouldn't be able to implement $$ themselves.
On the other hand, mapS is a derived operation because it could be written entirely in terms of the other things you're exporting. It does not need to know anything special about Signal and could even be written by one of the users of the library. The implementation could look something like:
mapS f signal = constS f $$ signal

Note how it uses constS and $$, but never unwraps signal. The knowledge of how to unwrap signal is hidden entirely in those two functions. mapS is "derived" because it is written just in your DSL without needing anything below your level of abstraction. When you change the implementation of Signal, mapS will still work as-is: you just need to update constS and $$ properly and you get mapS for free.
So: primitive combinators are ones which are built directly into your language and need to know about its internal implementation details. Derived combinators are written purely in terms of your language and do not depend on any of these internal details. They're just convenience functions which could have just as easily been written by the end-user of your library.


Q: How to query on a Mysql cursor? I have fetched data into mysql cursor now i want to sum up a column in the cursor.
Is there any BIF or any thing i can do to make it work ?
db = cursor.execute("SELECT api_user.id, api_user.udid, api_user.ps, api_user.deid, selldata.lid, api_selldata.sells
FROM api_user
INNER JOIN api_user.udid=api_selldata.udid AND api_user.pc='com'")

A: I suspect the answer is that you can't include aggregate functions such as SUM() in a query unless you can guarantee (usually by adding a GROUP BY clause) that the values of the non-aggregated columns are the same for all rows included in the SUM().
The aggregate functions effectively condense a column over many rows into a single value, which cannot be done for non-aggregated columns unless SQL knows that they are guaranteed to have the same value for all considered rows (which a GROUP BY will do, but this may not be what you want).


Q: Exception in create user on ejabberd16.09：Denied by ACL I installed the ejabberd16.09 in the Linux. An when I create a new user in Android , get these codes:
<iq from='hsoft.com' to='kfb@hsoft.com/Smack' id='T61DB-59' type='error'>
    <query xmlns='jabber:iq:register'><username>ddk</username>
    <password>123456</password><registered/></query><error code='403' type='auth'>
    <forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/><text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>
    Denied by ACL</text></error></iq>

And my file 'conf/ejabberd.yml' in the Linux :
  ## To disable in-band registration, replace 'allow' with 'deny'.
  register:
    - allow
  ## Only allow to register from localhost
  trusted_network:
    - allow
  ## Do not establish S2S connections with bad servers
  ## s2s:
  ##   - deny:
  ##     - ip: "XXX.XXX.XXX.XXX/32"
  ##   - deny:
  ##     - ip: "XXX.XXX.XXX.XXX/32"
  ##   - allow

My Android code :
    private void XmppRegister(){
        AccountManager account = AccountManager.getInstance(con);
        account.sensitiveOperationOverInsecureConnection(true);
        try {
            account.createAccount("ddk".toLowerCase(), "123456");
            Log.d("PushTest", "register successfully");
        } catch (SmackException.NoResponseException e) {
            e.printStackTrace();
        } catch (XMPPException.XMPPErrorException e) {
            e.printStackTrace();
        } catch (SmackException.NotConnectedException e) {
            e.printStackTrace();
        }
    }

Please help me! Thank you!

A: You have to add
AccountManager.getInstance(connection)
                .sensitiveOperationOverInsecureConnection(true);

to disable your ACL while you are registering a new user, then switch back to default settings:
AccountManager.getInstance(connection)
                .sensitiveOperationOverInsecureConnection(false);


Q: how to define where my MDB database is stored in local hard disk (VB.NET) VB.net seem to place my database file into /userprofile/local settings/apps/2.0/data/random/random/appname/data/ folder.
Can I define easier location for my published app.  I am also worried that when upgrading this database is ignored or something bad happens?

A:
Can I define easier location for my published app.

Well inside of your connection string you can specify the location of the database under Data Source.
Take your database and move it where ever you want, and then update the Data Source inside of your connection string to point to that path. You might have to play with it a few times to get the path right, but this should do what you are wanting to do.

VB.net seem to place my database file into /userprofile/local settings/apps/2.0/data/random/random/appname/data/ folder.

If you are making an installer then you will want to keep the database close to the application, most likely inside a sub-folder in the application's directory (like the data folder). That is why VS (not VB .Net) tends to place a created database inside of the data folder.


Q: mongodb connection error in Rails I am getting following error while connecting to mongodb using rails console :
Getting Error Mongo::Error::NoServerAvailable: No server is available matching preference: # using server_selection_timeout=30 and local_threshold=0.015
This happens when I switch my rails application.
It is working fine in another rails application(which I was working on for a while) console but when I try to use it in another rails application it gives above error.
I have checked my mongo server it is running and I have also checked my mongoid.yml file configuration. Everything seems fine.
I am a newbie on rails.
Any help would be appreciated. Thanks in Advance


Q: use rollapply and zoo to calculate rolling average of a column of variables I want to calculate the rolling mean for all variables in column "sp". This is a sample of my data:
the_date    sp  wins
01-06--2012 1   305
02-06--2012 1   276
03-06--2012 1   184
04-06--2012 1   248
05-06--2012 1   243
06-06--2012 1   363
07-06--2012 1   272
01-06--2012 2   432
02-06--2012 2   369
03-06--2012 2   302
04-06--2012 2   347
05-06--2012 2   357
06-06--2012 2   331
07-06--2012 2   380
01-06--2012 3   1
02-06--2012 3   2
03-06--2012 3   3
04-06--2012 3   2
05-06--2012 3   0
06-06--2012 3   2
07-06--2012 3   0

What I want, is to have a column added to data, that gives the moving average over 3 days for each sp. So the following output is what I desire:
the_date    sp  wins    SMA_wins
01-06--2012 1   305     305.00
02-06--2012 1   276     290.50
03-06--2012 1   184     255.00
04-06--2012 1   248     236.00
05-06--2012 1   243     225.00
06-06--2012 1   363     284.67
07-06--2012 1   272     292.67
01-06--2012 2   432     432.00
02-06--2012 2   369     400.50
03-06--2012 2   302     367.67
04-06--2012 2   347     339.33
05-06--2012 2   357     335.33
06-06--2012 2   331     345.00
07-06--2012 2   380     356.00
01-06--2012 3   1       1.00
02-06--2012 3   2       1.50
03-06--2012 3   3       2.00
04-06--2012 3   2       2.33
05-06--2012 3   0       1.67
06-06--2012 3   2       1.33
07-06--2012 3   0       0.67

I am using rollapply.
df <- group_by(df, sp)
df_zoo <- zoo(df$wins, df$the_date)
mutate(df, SMA_wins=rollapplyr(df_zoo, 3, mean,  align="right", partial=TRUE))

If I filter my data on a specific sp, it works perfectly.
How can I make this work when I group by sp?
Thanks

A: You can do it like this:
library(dplyr)
library(zoo)

df %>% group_by(sp) %>%
       mutate(SMA_wins=rollapplyr(wins, 3, mean, partial=TRUE))

It looks like your use of df and df_zoo in your mutate call was messing things up.


Q: How to delete a MySQL row that only the logged-in user created I made a website that creates 'awards' and user has to login.  I am trying to create a 'delete' button so that the user can delete awards he created. The problem with the code I created, the user can delete ANY award that any user created.  I need it so that only awards that the logged-in user can be deleted by the same logged-in user.
//deletes the award from awards table
    app.post('/Update_Award', function(request, response) {
    //app.delete('/Delete_Award', function(request, response) {
        var connection = request.app.get('pool');
        if (request.session.loggedin) {
            //delete query - this delete query works but it can delete ANY award by ANY user
            //connection.query('DELETE FROM award WHERE id = ?', [request.body.id], function(error, results, fields) {
            //I tried this query so that only the logged-in user can delete its own created award
            //but this does not delete anything at all
            **connection.query('DELETE FROM award WHERE id IN (SELECT id FROM accounts WHERE username = ?)', [request.session.username], function(error, results, fields) { **
                if (error) {
                    throw error;
                } else
                    var context = {};
                    connection.query('SELECT * FROM award', function(error, results, fields) {
                    if (error) {
                        console.log(error);
                    } else {
                        context.awards = results;
                        connection.query('SELECT id, title, defaultDescription FROM awardType;', function(error, results, fields) {
                        context.awardTypes = {};
                        results.forEach(function(el) {
                            context.awardTypes[el.id] = el.title;
                        });
                        response.render('Update_Award.html', { awards: context.awards, awardTypes: context.awardTypes, msg: 'Successfully deleted!' });
                        });
                    }
                    });
            });
        }
        });

I've been stuck with this problem so any help would be much appreciated.  So far, it doesn't output any error but it cannot delete a row.
The award table has the "isserId" which is the "id" of the user in the accounts table which contains all the users.