This is weird, could you show us the console please?

Yes, it was, used this method with ant to build my jar file and it worked well.

http://wiki.eclipse.org/Efxclipse/Tutorials/Tutorial1

Hi guys,

I've made an application in JavaFX and I do want to export it into a runnable jar.
When I run it from Eclipse or Netbeans, it works well.
But when I run it from windows as an executable jar I get this error for my layout.

Exception in Application start method
Exception in thread "main" java.lang.reflect.InvocationTargetException
        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:497)
        at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.RuntimeException: Exception in Application start method
        at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$152(LauncherImpl.java:182)
        at com.sun.javafx.application.LauncherImpl$$Lambda$2/1338668845.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: Location is not set.
        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2438)
        at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2413)
        at application.MainApp.initRootLayout(MainApp.java:47)
        at application.MainApp.start(MainApp.java:38)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$159(LauncherImpl.java:863)
        at com.sun.javafx.application.LauncherImpl$$Lambda$52/2117128939.run(Unknown Source)
        at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$172(PlatformImpl.java:326)
        at com.sun.javafx.application.PlatformImpl$$Lambda$48/1721003345.run(Unknown Source)
        at com.sun.javafx.application.PlatformImpl.lambda$null$170(PlatformImpl.java:295)
        at com.sun.javafx.application.PlatformImpl$$Lambda$50/268638582.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$171(PlatformImpl.java:294)
        at com.sun.javafx.application.PlatformImpl$$Lambda$49/42105627.run(Unknown Source)
        at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.lambda$null$145(WinApplication.java:101)
        at com.sun.glass.ui.win.WinApplication$$Lambda$38/622073264.run(Unknown Source)
        ... 1 more

My code looks like this on the 47'th line loader.setLocation(getClass().getResource("../application/view/RootLayout.fxml"));

private void initRootLayout() {
    try {
        // Load root layout from fxml file.
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(getClass().getResource("../application/view/RootLayout.fxml"));
        rootLayout = (BorderPane) loader.load();
        // Show the scene containing the root layout
        Scene scene = new Scene(rootLayout);
        //scene.getStylesheets().add("application/application.css");
        primaryStage.setScene(scene);
        primaryStage.show();

    } catch(IOException e) {
        e.printStackTrace();
    }
}

Got the problem, I've changed the layout from RelativeLayout to LinearLayout and it is all working fine.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@color/view_background"
    android:orientation="vertical"
    android:padding="10dp"
    android:weightSum="1">

    <ProgressBar
        android:id="@+id/progressBar1"
        style="@style/Base.Widget.AppCompat.ProgressBar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:progress="@integer/abc_config_activityShortDur"
        android:layout_centerInParent="true"
        android:maxHeight="100dp"
        android:maxWidth="100dp"
        android:minHeight="200dp"
        android:minWidth="200dp" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:text="@string/btnUploadedActivity"
        android:id="@+id/imagesListViewTitle"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true" />

    <ListView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/imagesListView"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_alignLeft="@+id/imagesListViewTitle"
        android:layout_below="@+id/imagesListViewTitle"
        android:smoothScrollbar="true" />
</LinearLayout>

Sorry, here it is :)

My Model:

public class ImagesModel {
    private int sapCode;
    private String imagePath;
    private int icon;

    public ImagesModel(int sapCode, String imagePath, int icon) {
        this.sapCode = sapCode;
        this.imagePath = imagePath;
        this.icon = icon;
    }

    public int getSapCode() {
        return sapCode;
    }

    public String getImagePath() {
        return imagePath;
    }

    public int getIcon() {
        return icon;
    }
}

And My Activity

import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import com.squareup.picasso.Picasso;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

import ro.sz.dezmembrari.sza.Config;
import ro.sz.dezmembrari.sza.JSONParser;
import ro.sz.dezmembrari.sza.R;
import ro.sz.dezmembrari.sza.model.ImagesModel;

/**
 * Created by Szabi.Zsoldos on 28/04/2015.
 */
public class ImagesListView extends Activity {

    private List<ImagesModel> myImages = new ArrayList<ImagesModel>();
    long totalSize = 0;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.uploaded_layout);

        populateImageList();
        populateListView();
    }

    private void populateImageList() {
        new GetReportFromAPI().execute();
    }

    private void populateListView() {
        ArrayAdapter<ImagesModel> adapter = new MyListAdapter();
        ListView list = (ListView) findViewById(R.id.imagesListView);
        list.setAdapter(adapter);
        adapter.clear();
    }

    private class MyListAdapter extends ArrayAdapter<ImagesModel> {

        public MyListAdapter() {
            super(ImagesListView.this, R.layout.item_view, myImages);
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            // Make sure we have a view to work with
            View itemView = convertView;
            if(itemView == null) {
                itemView = getLayoutInflater().inflate(R.layout.item_view, parent, false);
            }

            // find the image to work with
            ImagesModel currentImage = myImages.get(position);

            // fill the view

            ImageView imageView = (ImageView) itemView.findViewById(R.id.item_icon);
            try {
                Picasso.with(ImagesListView.this).load(currentImage.getImagePath()).into(imageView);
            } catch(Exception e) {
                imageView.setImageResource(currentImage.getIcon());
            }

            TextView sapCode = (TextView) itemView.findViewById(R.id.item_txtSAPCode);
            sapCode.setText("" + currentImage.getSapCode());

            TextView imagePath = (TextView) itemView.findViewById(R.id.item_imagePath);
            imagePath.setText(currentImage.getImagePath()); ...

Hi guys,

I'm having a weird problem regarding the simple ListView.
On my emulator everything is allright and the data is loaded correctly from JSON API, the data also loads on my device.
The problem is that on my emulator, the listview is populated but on my real device, not, why ?

1.jpg 2.jpg

This might help you alot: Click Here

I would do it like this, create an invisible isPosted value and check if on the index.php it's set with isset($_POST['isPosted'])

    <h2><i>PLEASE FILL IN YOUR DETAILS TO COMPLETE YOUR ORDER</i></h2>
    <form method="post" action="index.php" enctype="multipart/form-data">
    First name:<br>
    <input type="text" name="First_Name">
    <br>
    Last name:<br>
    <input type="text" name="Sur_Name">
    <br>
    Address:<br>
    <input type="text" name="Cus_Address">
    <br>
    Email:<br>
    <input type="text" name="Cus_Email">
    <br>
    Phone:<br>
    <input type="text" name="Phone_Num">
    <br><br>
    <input type="submit" value="Submit">
    <input type="hidden" name="isPosted" value="1" />
    </form>

Try the below code as the insert query and see the output

if(isset($_POST['isPosted']) && $_POST['isPosted'] == 1) {
    $insertedData = mysql_query($serverConnection,"INSERT INTO customertable(CustomerId,FirstName, SurName, Address, PhoneNum, Email, ProductPurchase) VALUES( 'NULL', '$_POST[First_Name]', '$_POST[Sur_Name]', '$_POST[Cus_Address]', '$_POST[Phone_Num]', '$_POST[Cus_Email]', '3')" ) or die(mysql_error());
} else {
    die('No POST data found.');
}

It would be much easier to use the PDO class for MySQL queries.
Also, try to make a rule for your case typing on your Variables.

Try this, first create your PDO server connection as $connection

$customer_id = $_POST[Customer_ID];
$first_post = $_POST[First_Post];
$sur_name = $_POST[Sur_Name];
$cus_address = $_POST[Cus_Address];
$phone_num = $_POST[Phone_Num];
$cus_email = $_POST[Cus_Email];
$product_purchase = $_POST[Product_Purchase];

$sql = 'INSERT INTO customertable( `CustomerID`, `FirstName`, `SurName`, `Address`, `PhoneNum`, `Email`, `PurchaseProduct`) VALUES(:customer_id, :first_post, :sur_name, :cus_address, :phone_num, :cus_email, :product_purchase)';

$query = $connection->prepare($sql);
$query->execute(array(
    ':customer_id'      =>  $customer_id,
    ':first_post'       =>  $first_post,
    ':sur_name'         =>  $sur_name,
    ':cus_address'      =>  $cus_address,
    ':phone_num'        =>  $phone_num,
    ':cus_email'        =>  $cus_email,
    ':product_purchase' =>  $product_purchase,
));
broj1 commented: This i the way to go +11
//Try this

    <select name='price' id='price'>
        <option <?=((isset($_POST['price']) && $_POST['price'] == '')?'SELECTED="SELECTED"':'')?> value='' >Select....</option>
        <option <?=((isset($_POST['price']) && $_POST['price'] == '0-50,000')?'SELECTED="SELECTED"':'')?> value='0-50,000'>0-50,000</option>
        <option <?=((isset($_POST['price']) && $_POST['price'] == '50,000-100,000')?'SELECTED="SELECTED"':'')?> value='50,000-100,000'>50,000-100,000</option>
        <option <?=((isset($_POST['price']) && $_POST['price'] == '100,000-150,000')?'SELECTED="SELECTED"':'')?> value='100,000-150,000'>100,000-150,000</option>
        <option <?=((isset($_POST['price']) && $_POST['price'] == '150,000-200,000')?'SELECTED="SELECTED"':'')?> value='150,000-200,000'>150,000-200,000</option>
        <option <?=((isset($_POST['price']) && $_POST['price'] == '200,000 and above')?'SELECTED="SELECTED"':'')?> value='200,000 and above'>200,000 and above</option>
        <option <?=((isset($_POST['price']) && $_POST['price'] == 'see all')?'SELECTED="SELECTED"':'')?> value='see all'>See All</option>
    </select>

I am using mpdf for example and it works just great.
My aproach is that every time a customer request a document it's get generated on the fly and it's pushed to download via a header function.

Thanks pritaeas for the heads up, it was a great start :)
This is my final implementation and it works great.

        echo '<table width="600" cellpadding="0" cellspacing="0" border="0" class="table table-condensed">';    
        echo '<tbody>';        
        $previous = '';
        foreach($promotii as $promotie) {            
            if ($previous != $promotie->Marca) {
                if (!empty($previous)) {
                } else {
                    $previous = $promotie->Marca;
                }

                echo '<tr>';
                    echo '<td>';
                        echo $promotie->Marca;
                    echo '</td>';
                echo '</tr>';                  
            }

            echo '<tr>'; // start product stuff
            echo '</tr>'; // end of product stuff

            $previous = $promotie->Marca;
        }
        echo '</tbody>';
        echo '</table>';

Mine is PHPEd from NuSphere, amazing product, it's not free but it's worth the money.

Code suggestion is not case sensitive, great syntax highlighting, framework support, etc.

diafol commented: Looks interesting +15

Hi guys,

I have one simple logical question that I seem not to figure it out, sadly...

We have a list of objects and I loop trough them, list of products.
We need to create anchor maps for each category, so I did a comparison with temp variables to check the previous and current element value.

How can I display only the first occurence of a series of values for each category ?

Desired result:

Category 1

  • product 1
  • product 2
  • product 3
    Category 2
  • product 1
  • product 2
  • product 3

    $previous = '';
    if(!empty($promotii)) {
        foreach($promotii as $promotie) {
            $previous = $promotie->Marca;
        }
        $previous = $promotie->Marca;
     }

Thank you Taywin, you solution was the good one, I've splitted the output in PHP and transformed it in array and counted the same occurences and it worked well!

Because recent modified files do not have year number display in the list. You may try ls -la --full-time and will have to update some of your display.

#!/bin/bash
year=$(date +"%Y")
if [ $# -gt 0 ] ; then
year=$1
fi
echo $year
list=$(ls -la --full-time | awk -v pattern="$year" '$6 ~ pattern { printf ("%s %s ", $6, $9) }')
echo $list

The above is a quick & dirty test of how to capture all files that were modified at a given year (or the current year if no argument is passed). Column 6 in the list is now yyyy-mm-dd instead of spelling out month name.

Hey guys,

I have this script that does count one year of files, 2014, but when it comes to this year, everything messes up.
How could I count properly for each year in the same script ?

In the attached screenshot it's obvious that I would only need 2014 - all of the months and from 2015 only January, but .... how ?

Thanks in advance!

ls -la |
awk -v year="$(date "+%Y")" 'BEGIN {
        split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec", month, " ")
        for (i=1; i<=12; i++){ 
            mdigit[month[i]]=i
        }
    }
!/^-/{next}
$8 ~ /:/{$8=year} {
  dat=$8 sprintf("%02d",mdigit[$6]) sprintf("%02d",$7)
  a[dat]++
}
END{for(i in a){print i, a[i]|"sort"}}'

Hello, this is what I should do, i know, I will loose some SEO ranking because of this :(

Hi guys,

I have this weird .htaccess rule that is used for a dropdown search engine

RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+) index.php?bla1=$1&bla2=$2... and so on [L]

If I want to maintain the above rule, it is allright.
The problem is that I want to creat a new rule with 3 variables, but the above rule is overwriting everything and it does not let me, what should I do?
If I rewrite the above rule, I will loose some important SEO ranking points.

Thanks in advance,
Szabi Zsoldos

Got my solution.

SELECT p.SKU,
  p.productName,
  MAX(IF(t.AttributeClassValueId = '1', t.AttributeClassValue, NULL)) AS Atribute1,
  MAX(IF(t.AttributeClassValueId = '2', t.AttributeClassValue, NULL)) AS Atribute2,
  MAX(IF(t.AttributeClassValueId = '3', t.AttributeClassValue, NULL)) AS Atribute3,
  MAX(IF(t.AttributeClassValueId = '4', t.AttributeClassValue, NULL)) AS Atribute4,
  MAX(IF(t.AttributeClassValueId = '5', t.AttributeClassValue, NULL)) AS Atribute5
FROM CatSys_products p
    LEFT JOIN CatSys_productAttributeClassValuesFromProducts t ON p.id = t.ProductId
    LEFT JOIN CatSys_productAttributeClassValues a ON t.AttributeClassValueId = a.id
GROUP BY p.SKU, p.productName

Hi guys,

Trying to develop a custom facet like search in Mysql.
I have 3 tables for this:

1.Attribute class
2.Attribute class Name
3.Attribute class Value
    - attributeClassName Id
    - productId
4.Products

Each product has one attribute class
Each attribute class has many values

Each value is contained in a sepparate row in the AttributeClassValue table, how can i Filter by values in that table ?
Group Concat is not the best solution....

Thank you Dani, good job on finding the problem.

My bad ...

This is the link commons.apache.org/proper/commons-lang/javadocs/api-2.6/org/apache/commons/lang/StringUtils.html#substring(java.lang.String, int, int)

for the Substring.

Tha application does not stop, it is built upon Spring and this is a file processor that reads all the lines.

As you can see on the first printscreen, the characters are there, but the method exits.

LE: with the standard value.substring() method, it works...

Hello people :)

Having some difficulties regarding a simple substring.
Then length of my line is 52 and I iterate it without any problems.

When I use this untill the 22nd character it is working

final String articleNumber = StringUtils.trimToEmpty(StringUtils.substring(lineValue, 0, 22));

If I want to pass over the 22nd character, everything stops, empty.
Take a look at the StackTrace screenshot...can you figure it out why it is not working ?

488afabad01fca57105183078113085f

        final String articleNumber = StringUtils.trimToEmpty(StringUtils.substring(lineValue, 0, 22));
        final String articleManufacturer = StringUtils.trimToEmpty(StringUtils.substring(lineValue, 22, 4));
        final String descriptionNumber = StringUtils.trimToEmpty(StringUtils.substring(lineValue, 26, 9));

Thank you!

Hey guys,

Just tried to log in on Mozilla Firefox 30.0 and it does not give me an alert toast/message.
My credentials are good because it worked on IE11 and Google Chrome.

I've tried searching something on this topic, but haven't found anything.

Have a great day everybody!

Got it solved with &&

if i use each part separately, it works ...

Hey guys,

Having some difficulties understanding why my OR || operator is not working...
First part is BOOLEAN and it is working
Second part is STRING and it is working, it returns the desired value

What could it be ?

<?php if(($oferte->isOrdered($oferte->CleanSapStyleNumbers($oferta->VBELN)) == false) || ($oferte->OfertaValida($oferte->CleanSapStyleNumbers($oferta->VBELN))->valabilitate == "VALABILA")): ?>
some stuff
<?php endif; ?>

can you post the code from the upload from your script ?

As far it seems, you did not give permission to the Java to load properly.

Forgot to add after the url parameter the data: data, parameter so you can send your values to extract exactly what you need.