Показаны сообщения с ярлыком programming. Показать все сообщения
Показаны сообщения с ярлыком programming. Показать все сообщения

четверг, 18 августа 2016 г.

symfony fixtures cannot delete or update a parent row

* you can add to problem entity field, which is described in error onDelete="set null"

* or deny to purge your database, add to your command key --append.

пятница, 1 июля 2016 г.

Sonata-admin how to add entity filter

protected function configureDatagridFilters(DatagridMapper $datagridMapper){    $datagridMapper        ->add('id')        ->add('translations.name', null, ['label' => 'Name'])        ->add('eanCode')        ->add('catalogCode')        ->add(            'product', null, [], 'entity', [            'class'    => 'AppBundle\Entity\Product',            'property' => 'name'        ])    ;}

In the beginning I thought that 'entity' doesn't work in sonata-admin ^2.3, 
and tried 'doctrine_orm_choice'. It could get elements in dropdown, but filter didn't 
worked correctly (results always was empty, but there should be elements).

понедельник, 9 мая 2016 г.

undefined method named "setFormTheme" in SonataAdminBundle

Your class needs to be extended like this:

class CategoryAdmin extends Admin{

}

четверг, 5 мая 2016 г.

Symfony {urn:oasis:names:tc:xliff:documen t:1.2}br not expected

You can get the same error like me:
[Symfony\Component\Translation\Exception\InvalidResourceException]
  Invalid resource provided: "1.2"; Errors: [ERROR 1871] Element '{urn:oasis:names:tc:xliff:documen
  t:1.2}br': This element is not expected. Expected is one of ( {urn:oasis:names:tc:xliff:document:
  1.2}g, {urn:oasis:names:tc:xliff:document:1.2}bpt, {urn:oasis:names:tc:xliff:document:1.2}ept, {u
  rn:oasis:names:tc:xliff:document:1.2}ph, {urn:oasis:names:tc:xliff:document:1.2}it, {urn:oasis:na
  mes:tc:xliff:document:1.2}mrk, {urn:oasis:names:tc:xliff:document:1.2}x, {urn:oasis:names:tc:xlif
  f:document:1.2}bx, {urn:oasis:names:tc:xliff:document:1.2}ex ). (in /var/www/rgk.lv/rgk-symfony/
  - line 12, column 0)
It solves by adding string in composer.json:
"geschke/translator-gui-bundle": "dev-master"

And doing composer update

понедельник, 2 мая 2016 г.

RouteNotFoundException "lexik_translation_new" as such route does not exist

Do not forget make changes in files:
  • *.html.twig
  • Config/routing/routing.yml
  • Config/routing/app.yml

Especially in the second, do not forget to add there these lines:

lexik_translation_edition:    resource: "@LexikTranslationBundle/Resources/config/routing.yml"    prefix: /translations/grid

пятница, 29 апреля 2016 г.

'lexik\Bundle\TranslationBundle\LexikTranslationBundle' not found

It solves by changing from 4.0 version to 2.0 by the string in "composer.json":
"lexik/translation-bundle": "~2.0"

среда, 27 января 2016 г.

Webstorm & PhoneGap/Cordova: cannot find Android SDK path error

just add "<your downloaded location>\android-sdk\platform-tools" and "<your downloaded location>\android-sdk\tools" in system PATH variable.

Got from http://learn.ionicframework.com/videos/windows-android/ 

вторник, 26 января 2016 г.

Visual Studio Windows Phone emulator doesnt run app

It fixes by turning on "vEthernet (Internal Ethernet Port Windows Phone Emulator Internal Switch)" or something like this in Control Panel > Network Connections.

понедельник, 11 января 2016 г.

Android button onclick simple event

First of all you need to declare method below setContentView(R.layout.main), and add this:
public void buttonOnClick(View v) {

}

Then select in created button's onClick event in /layout/main.xml designer in "properties" toolbar this method.

воскресенье, 10 января 2016 г.

configure Intellij IDEA for Android project

1. do not forget to install Android SDK;
2. just add "Android support" in Plugins in Idea. It because you installed IDE without Android plugin.

понедельник, 14 сентября 2015 г.

Finding palindrome in array in Java

static ArrayList<String> arr = new ArrayList<>();
public static void palidrome() throws IOException {
InputStream fis = new FileInputStream("C://tmp/palidrome.txt");
InputStreamReader isr = new InputStreamReader(fis, Charset.forName("UTF-8"));
BufferedReader br = new BufferedReader(isr);
String line;
while ((line = br.readLine()) != null) arr.add(line);
for (int i=0; i<arr.size(); i++) {
if (!isPal(arr.get(i))) arr.set(i, "-1");
System.out.println(arr.get(i));
}
}
public static boolean isPal(String str) {
int i=0; int k = str.length()-1;
while (i<=k) {
if (str.charAt(i)==str.charAt(k) ) {
i++;
k--;
}
else return false;
}
return true;
}

воскресенье, 6 сентября 2015 г.

Quicksort in Java example

quicksort is the fastest sorting algorithm, and here is example of method in Java:
static public void quickSort(int[] arr, int l, int r) {
        int left = l; int right = r; int tmp;
        int middle = arr[(left + right) / 2];
       
        while (left <= right) {
            while (arr[left]<middle) left++;
            while (arr[right]>middle) right--;
            if (arr[left]>arr[right]) {
                tmp = arr[left];
                arr[left] = arr[right];
                arr[right] = tmp;
            }
        }
        if (left<r) quickSort(arr, left, r);
        if (l<right) quickSort(arr, l, right);
       
    }
It needs to be called like this:
public static void main(String args[]) {
int[] array = { 4, 23,65, 76, 99, 12, 90, 34 }
quickSort(array, 0, array.length-1)
}

среда, 29 июля 2015 г.

Helloworld in Java Graphics2D

For this need to make 2 classes with names Painting and Frame. In my situation I have package named graphh
Painting.class:
package graphh;
import java.awt.*;
import javax.swing.*;
public class Painting extends JPanel {
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawOval(60, 80, 20, 20);
}
}

Frame.class:
package graphh;
import java.awt.*;
import javax.swing.*;
public class Frame {
public Frame() {
JFrame gui = new JFrame();
gui.setTitle("fsdfdsf");
gui.setSize(400, 300);
gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Painting panel = new Painting();
Container pane = gui.getContentPane();
pane.setLayout(new GridLayout(1, 1));
pane.add(panel);
gui.setVisible(true);
}
public static void main(String args[]) {
new Frame();
}
}

If you are using Eclipse just press Run button
Taken from https://www.youtube.com/watch?v=U2G_2AS0otE