i18n generator script for CakePHP 

Are you tired of running cake i18n extract and clicking over the Poedit?


#!/bin/sh
rm -rf Locale/*.pot

langs=( hun )
./Console/cake i18n extract --output ./Locale --paths ./ --merge no
for lang in "${langs[@]}"
do
:
msgmerge -U Locale/$lang/LC_MESSAGES/default.po Locale/default.pot
done


Place and run this script in your app directory of your cakephp project, and you will only need to do your translatioon with Poedit/whatever.
Enjoy.
[ hozzászólás ] ( 1 megtekintés ) [ 0 trackbackek ] permalink ( 3 / 2002 )
The macaddress in the /etc/udev/rules.d/70-persistent-net.rules is case sensitive 

Really!
It must have the letters in lowercase.
[ hozzászólás ] ( 2 megtekintés ) [ 0 trackbackek ] permalink ( 3 / 2155 )
Generate hardware configuration headers from EAGLE for AVR GCC 

I have written an ULP to auto generate the pin numbering constants for my AVR projects from the schematic net names:

https://dl.dropboxusercontent.com/u/4295670/generate_header.ulp

How to use :
1. Name all your nets in your EAGLE schematic properly like this:


2. Run the generate_header.ulp and select the proper part.

3. Include the generated hwconfig.h file to your project.

4. You will have the follwoing structure for your each pins:

#define TX_EN_PORT PORTC
#define TX_EN_PINREG PINC
#define TX_EN_PIN 1
#define TX_EN_DDR DDRC
#define TX_EN C,1


5. Use the following macros with the defines:

// bit manipulation macros
// signals has to be defined in this way: #define LED C,1
// usage: sbi(PORT,LED1) or setting data direction: sbi(DDR,LED1)
// _BV(a) is a macro which returns the value corresponding to 2 to the power 'a'.
#define sbi_(what,x,y) what##x |= _BV(what##x##y) //set bit - using bitwise OR operator
#define cbi_(what,x,y) what##x &= ~(_BV(what##x##y)) //clear bit - using bitwise AND operator
#define tbi_(what,x,y) what##x ^= _BV(what##x##y) //toggle bit - using bitwise XOR operator

#define sbi(what,p) sbi_(what,p)
#define cbi(what,p) cbi_(what,p)
#define tbi(what,p) tbi_(what,p)

#define is_high_(x,y) ((PIN##x & _BV(PIN##x##y))) == _BV(PIN##x##y) //check if the y'th bit of register 'x' is high ... test if its AND with 1 is 1
#define is_high(p) is_high_(p)
#define is_low(p) !is_high_(p)

#define set_high_(x,y) (PORT##x |= _BV(PORT##x##y))
#define set_low_(x,y) (PORT##x &= ~_BV(PORT##x##y))

#define set_high(what) set_high_(what)
#define set_low(what) set_low_(what)

#define set_in_(x,y) DDR##x &= ~_BV(DD##x##y)
#define set_out_(x,y) DDR##x |= _BV(DD##x##y)
#define set_in(p) set_in_(p)
#define set_out(p) set_out_(p)

https://dl.dropboxusercontent.com/u/4295670/avr/global.h
[ hozzászólás ] ( 1 megtekintés ) [ 0 trackbackek ] permalink ( 3 / 1898 )
Azt hittem ilyen már nincs... 

[ 1 hozzászólás ] ( 14 megtekintés ) [ 0 trackbackek ] permalink ( 3 / 2089 )
When the CakePHP session does not works 

I have migrated one of my CakePHP based webapplication to an another webhosting provider, and my Session stopeed working. The setFlash messages was not displayed, and the authorization does not worked.

The solution was simple but not obvious.
The Sessionhelper sends a cookie to you browser (CAKEPHP by default) containing your session id and store your session data on the server. This storage method can be selected with the Session.defaults.

At first I have suspected the php builting session which in the default case does the session data storage on the server. After creating some minimal tests the php built in session handling seemed to be working. Later I have realized that my CAKEPHP cookie had been never sent to my browser. I have created a small test to the php's setcookie function. It worked. I have realized the following section of the manual:
Like other headers, cookies must be sent before any output from your script (this is a protocol restriction). This requires that you place calls to this function prior to any output, including <html> and <head> tags as well as any whitespace.


After I have added a newline before my php start tag the test stopped working in the new environment, but worked on my dev box.

And yes after some code ditching I have found the malicious code:
I have left a tab in my UsersController before the php start tag...
[ hozzászólás ] ( 2 megtekintés ) [ 0 trackbackek ] permalink ( 3 / 1713 )

<< <Előző | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | Következő> >>

 
számláló