Codeigniter ckeditor form problems - codeigniter

I am using a combination of codeigniter's form helper and the ckeditor to attempt to send html to my server, save it into the database, and then sent it back to the browser for re-editing.
To accomplish this, a am:
creating a textarea using codeigniter's form_textarea() function.
(optional)using CKEDITOR.replace to turn that textarea into a
ckeditor field.
pasting html into the field.
submitting the field as POST and retrieving it using codeigniter's
input->post();
inserting the data into the database using codeigniter's
db->insert()
pulling the data using ci's db->get()
putting it back into a textarea using form_textarea() again.
after performing this cycle a couple of times, the html just disappears during a post operation. I am assuming that this is being caused by some characters that need to be escaped, but I am at a loss for why this is happening and how to fix it.
It usually happens after the html is pulled form the database, put into the textarea, then resubmitted. I also noticed that if I activate the CKEditor each time the page is reloaded, the problem does not happen.
If anyone has faced this problem before, please tell me how you managed to deal with the text so that it loaded, submitted, saved and reloaded without problems. Also, anything useful that could be said about codeigniter's filters would be great too. Thanks
Note: using CKEditor for every field, all the time is not really an option.
I have included a body of text that causes this problem:
This text is pasted into the text area:
<p>Ownar and Flaght Daractar af Mass Madaa Labs, Jan Mass as a dagatal markatang stratagast and craatava madaa spacaalast wath avar 20 yaars af axparaanca warkang wath basanass awnars and axacatavas. Ha has warkad wath namaraas campanaas ta davalap thaar Dagatal Starytallang, Cantant Stratagy/Davalapmant, PR/Crasas Managamant, and Sacaal Madaa Prasanca. Jan has spakan at canfarancas an tapacs rangang fram 'LankadIn far Prafassaanals' ta 'Sacaal Madaa On Tha Ga' far basy axacatavas. Has na-nansansa appraach ta asang anlana taals cats thraagh tha hypa and facasas an tha cara raasans far prafassaanals ta asa thasa taals, fallawad ap wath traanang an affactava asa af anlana taals. Nat jast an adacatar, Jan as actavaly asang anlana taals ta attract, angaga and rataan has targat aadaanca whach makas ham an adaal anstractar far thasa laakang ta tap tha kanatac anargy af tha Intarnat; Mr. Mass as an adraat and saccassfal practataanar af all ha taachas and wratas. <br /><br />Jan Mass, an awasama vadaagraphar and phatagraphar, as alsa tha faandar af Basanass Chattanaaga, tha largast LankadIn graap an Chattanaaga araa, and tha craatar af BasanassChatt.cam - a blag far antrapranaars & prafassaanals lavang/warkang/playang an tha Chattanaaga, TN araa.</p>
After passing through the database, and back into another textarea, it looks like this:
<p>Ownar and Flaght Daractar af Mass Madaa Labs, Jan Mass as a dagatal markatang stratagast and craatava madaa spacaalast wath avar 20 yaars af axparaanca warkang wath basanass awnars and axacatavas. Ha has warkad wath namaraas campanaas ta davalap thaar Dagatal Starytallang, Cantant Stratagy/Davalapmant, PR/Crasas Managamant, and Sacaal Madaa Prasanca. Jan has spakan at canfarancas an tapacs rangang fram 'LankadIn far Prafassaanals' ta 'Sacaal Madaa On Tha Ga' far basy axacatavas. Has na-nansansa appraach ta asang anlana taals cats thraagh tha hypa and facasas an tha cara raasans far prafassaanals ta asa thasa taals, fallawad ap wath traanang an affactava asa af anlana taals. Nat jast an adacatar, Jan as actavaly asang anlana taals ta attract, angaga and rataan has targat aadaanca whach makas ham an adaal anstractar far thasa laakang ta tap tha kanatac anargy af tha Intarnat; Mr. Mass as an adraat and saccassfal practataanar af all ha taachas and wratas. <br /><br />Jan Mass, an awasama vadaagraphar and phatagraphar, as alsa tha faandar af Basanass Chattanaaga, tha largast LankadIn graap an Chattanaaga araa, and tha craatar af BasanassChatt.cam - a blag far antrapranaars & prafassaanals lavang/warkang/playang an tha Chattanaaga, TN araa.</p>
Now, if i resubmit it, the data never appears in the POST array. However, if i activate the ckeditor before I sublit this text, it is transformed into:
<p>Ownar and Flaght Daractar af Mass Madaa Labs, Jan Mass as a dagatal markatang stratagast and craatava madaa spacaalast wath avar 20 yaars af axparaanca warkang wath basanass awnars and axacatavas. Ha has warkad wath namaraas campanaas ta davalap thaar Dagatal Starytallang, Cantant Stratagy/Davalapmant, PR/Crasas Managamant, and Sacaal Madaa Prasanca. Jan has spakan at canfarancas an tapacs rangang fram 'LankadIn far Prafassaanals' ta 'Sacaal Madaa On Tha Ga' far basy axacatavas. Has na-nansansa appraach ta asang anlana taals cats thraagh tha hypa and facasas an tha cara raasans far prafassaanals ta asa thasa taals, fallawad ap wath traanang an affactava asa af anlana taals. Nat jast an adacatar, Jan as actavaly asang anlana taals ta attract, angaga and rataan has targat aadaanca whach makas ham an adaal anstractar far thasa laakang ta tap tha kanatac anargy af tha Intarnat; Mr. Mass as an adraat and saccassfal practataanar af all ha taachas and wratas. <br /><br />Jan Mass, an awasama vadaagraphar and phatagraphar, as alsa tha faandar af Basanass Chattanaaga, tha largast LankadIn graap an Chattanaaga araa, and tha craatar af BasanassChatt.cam - a blag far antrapranaars & prafassaanals lavang/warkang/playang an tha Chattanaaga, TN araa.</p>
Which makes it through without any problems. However, on the next time around, the text that appears in the textarea is:
<p>Ownar and Flaght Daractar af Mass Madaa Labs, Jan Mass as a dagatal markatang stratagast and craatava madaa spacaalast wath avar 20 yaars af axparaanca warkang wath basanass awnars and axacatavas. Ha has warkad wath namaraas campanaas ta davalap thaar Dagatal Starytallang, Cantant Stratagy/Davalapmant, PR/Crasas Managamant, and Sacaal Madaa Prasanca. Jan has spakan at canfarancas an tapacs rangang fram 'LankadIn far Prafassaanals' ta 'Sacaal Madaa On Tha Ga' far basy axacatavas. Has na-nansansa appraach ta asang anlana taals cats thraagh tha hypa and facasas an tha cara raasans far prafassaanals ta asa thasa taals, fallawad ap wath traanang an affactava asa af anlana taals. Nat jast an adacatar, Jan as actavaly asang anlana taals ta attract, angaga and rataan has targat aadaanca whach makas ham an adaal anstractar far thasa laakang ta tap tha kanatac anargy af tha Intarnat; Mr. Mass as an adraat and saccassfal practataanar af all ha taachas and wratas. <br />
<br />
Jan Mass, an awasama vadaagraphar and phatagraphar, as alsa tha faandar af Basanass Chattanaaga, tha largast LankadIn graap an Chattanaaga araa, and tha craatar af BasanassChatt.cam - a blag far antrapranaars & prafassaanals lavang/warkang/playang an tha Chattanaaga, TN araa.</p>
Which will not make it though the POST array unless ckeditor is activated again.

Related

How to convert image to text in codeignter

Hii ijust want to ask that how can i convert a image to text using OCR ?
if(isset($_FILES['image'])){
$file_name = $_FILES['image']['name'];
$file_tmp =$_FILES['image']['tmp_name'];
move_uploaded_file($file_tmp,"image/".$file_name);
echo "<h3>Image Upload Success</h3>";
echo '<img src="'.$file_name.'" style="width:70%">';
shell_exec('"C:\\Program Files\\Tesseract-OCR\\tesseract" "D:\\xampp\\htdocs\\ci3\\image\\'.$file_name.'" out');
echo "<br><h3>OCR after reading</h3><br><pre>";
$myfile = fopen("out.txt", "r") or die("Unable to open file!");
echo fread($myfile,4045);
fclose($myfile);
echo "</pre>";
}
I just write this code but it is like not convert the image text properly so is their any solution so please let me know !!
I Expecting that its work i vertical image to read the text but in my output it read like.........
The Registration Directorate at the Ministry of Industry, Commerce and Tourism
certifies that the merchant's below details have been registered in accordance with
Decree law No. (27) for the year 2015 of the Commercial Registration.
22/04/2023 GliaiuY! ~,6 Registration 22/04/2007
Date
eroup HORIZON TELECOM SERVICES COMPANY WLL
Name
Commercial
Name
Registration
Type
CR
Status
HORIZON TELECOM SERVICES COMPANY WLL
With Limited Liability Company
ACTIVE
Area 4élaicl!
ABU SAYBA/ a2 5!
P.O.BOX #.ye Road & »b
7325
Block asx
473
Commercial
Address
Activities
Sale and installation of telecommunications equipment and parts
ere! Bylo!
Registration Directorate
QF. 409 Issue 0
* This CR does not permit its holder to practice investment activities on behalf of others.
igiwltzads
(alka,
KINGDOM OF BAHRAIN pues.
Ministry of Industry, ©
Commerce and Tourism R
Solenitl J) 15 bol gd
Commercial Registration Certificate
ell ad oi hath dala yb yleill s Ae licall 8 51} 52 apsaill 6 pla) agts
GSM Dasa GLE; 2015 Aid (27) aby cy silds p pes pall Cady alld g oLisi atltly Aba uell
Judll 6 Registration == 4908 - 1
aad CYL) Glesal 6 5 jl st 4S 8 Ac gore! pul
aed VLA) Las) Oy jolt ASS ole usd
Ba gdare Aud gious IS AS ph andl ¢ 93
dads aud Le
Flat/Shop No. J=«/4a4
11
Building +
608 Gola ol gual
Woke abby SYLSIYI Glace af jlo
wsdl Ul gal pletion! LU 49) jo: 4ualial jin Y all lhe *
Issued Date: 20/04/2022 Page 1 of 1
}
Z/
Please post this certificate at a visible place.
Tel: +973 80001700 - www. sijilat.bh - www.moic.gov.bh
boat! S12 Sol GIS Bolg S! che 5 oe
but i need a seprate column to read a proper text formate

COBOL "File not found" while opening a file

I am trying to familiarize myself with COBOL. I try to start the following program:
identification division.
program-id. Bestand.
date-written. 08.05.2020
environment division.
input-output section.
file-control.
select bestand-datei-ein assign to
"C:\Users\Michael\Desktop\Microfocus\Programme\aus.txt".
select bestand-datei-aus assign to
"C:\Users\Michael\Desktop\Microfocus\Programme\aus.txt".
data division.
file section.
fd bestand-datei-ein label records are omitted.
01 bestand-satz-ein.
05 e-teile-nr PIC X(6).
05 e-bestand-menge PIC 9(5).
05 e-eingang-menge PIC 9(4).
05 e-stueck-preis PIC 999V99.
fd bestand-datei-aus label records are omitted.
01 bestand-satz-aus.
05 a-teile-nr PIC X(6).
05 filler PIC X(4).
05 a-bestand-menge PIC 9(5).
05 filler PIC X(3).
05 a-eingang-menge PIC 9(4).
05 filler PIC X(3).
05 a-stueck-preis PIC 999.99.
05 filler PIC X(3).
05 a-bestand-menge-neu PIC 9(5).
05 filler PIC X(3).
05 a-kosten PIC 9(6).99.
01 a PIC X.
working-storage section.
01 bestand-datei-ein-ende PIC X.
procedure division.
a000-haupt-steuerung-routine.
open input bestand-datei-ein
output bestand-datei-aus.
move 'N' to bestand-datei-ein-ende.
read bestand-datei-ein
at end move 'J' to bestand-datei-ein-ende.
perform b010-listen-bestandsdaten
until bestand-datei-ein-ende = 'J'.
close bestand-datei-aus
bestand-datei-ein.
accept a.
stop run.
b010-listen-bestandsdaten.
move spaces to bestand-satz-aus.
move e-teile-nr to a-teile-nr.
move e-bestand-menge to a-bestand-menge.
move e-eingang-menge to a-eingang-menge.
move e-stueck-preis to a-stueck-preis.
add e-bestand-menge, e-eingang-menge
giving a-bestand-menge-neu.
multiply a-bestand-menge-neu by e-stueck-preis
giving a-kosten.
read bestand-datei-ein
at end
move 'J' to bestand-datei-ein-ende.
I always get the error message "File not found: C: \ Users \ Michael \ Desktop \ Microfocus \ Program \ aus.txt" when I start the program and the should be opened.
I work with Micro Focus Visual Cobol for Visual Studio
Any idea ?
From comment:
The problem has now been solved. The file names were not displayed correctly in the code (cut and paste errors). It should read "ein.txt" and aus.txt. The problem was that the file names in the file system were set so that the extension is not displayed. I named the input file "ein.txt" and basically created a file named "ein.txt.txt". Therefore the file was not found.

bash awk get numbers in two digits

I want to correct wrong meta data or add missing meta data for the 75 cd's I have ripped from disc.
I got the track info from AllMusic en stripped it to almost usable "CSV" data.
Number";"1";"Piece";"Nocturne for piano No. 2 in E flat major, Op. 9/2, CT. 109";"Componist";"Frédéric Chopin
MainPiece";"";"Piece";"Symphony No. 9 in E minor ("From the New World"), B. 178 (Op. 95) (first published as No. 5)
Number";"2";"Piece";"Largo";"Componist";"Antonin Dvorák
Number";"3";"Piece";"La plus que lente, waltz for piano (or orchestra), L. 121";"Componist";"Claude Debussy
Number";"4";"Piece";"Waldesrauschen (Forest Murmurs), for piano (Zwei Konzertetuden No. 1), S. 145/1 (LW A218/1)";"Componist";"Franz Liszt
MainPiece";"";"Piece";"Oboe Concerto, for oboe, strings & continuo in D minor, Op. 8/9, RV 454
Number";"5";"Piece";"Allegro";"Componist";"Antonio Vivaldi
Number";"6";"Piece";"Largo";"Componist";"Antonio Vivaldi
Number";"7";"Piece";"Allegro";"Componist";"Antonio Vivaldi
MainPiece";"";"Piece";"Cello Concerto in A major, G. 475
Number";"8";"Piece";"1. Allegro";"Componist";"Luigi Boccherini
Number";"9";"Piece";"2. Adagio";"Componist";"Luigi Boccherini
Number";"10";"Piece";"3. Rondò - Allegro";"Componist";"Luigi Boccherini
MainPiece";"";"Piece";"Serenade No. 12 for winds in C minor ("Nacht Musique"), K. 388 (K. 384a)
Number";"11";"Piece";"Allegro";"Componist";"Wolfgang Amadeus Mozart
Number";"12";"Piece";"Liebesträume, notturno for piano No. 3 in A flat major ("O Lieb, so lang du lieben kannst"), S. 541/3 (LW A103/3)";"Componist";"Franz Liszt
MainPiece";"";"Piece";"Phantasiestücke (4) for violin, cello & piano in A minor, Op. 88
Number";"13";"Piece";"Romanze";"Componist";"Robert Schumann
MainPiece";"";"Piece";"Sinfonia Concertante for violin, cello, oboe, bassoon & orchestra, H. 1/105
Number";"14";"Piece";"Andante";"Componist";"Franz Joseph Haydn
I would like to rewrite this with awk to a script to set meta data
eyeD3 -n 01 -a composer -t mainpiece piece 01*.mp3
And with awk to rename the files
mv 01*.mp3 01 [composer] mainpiece piece.mp3
The mainpiece / piece is an manual part but I would like to rewrite 1 to 01.
I found something with printf ("%2d" ,$1,$2) but thins complaints about .mp3
Has anyone suggestions for me?

How to card emulate with ACR122U-A9

I have a ACR122U-A9, I want to card emulate with it.
I ask who has done this point? Can you give me some suggestions?
Now I have also other problems, when I put the white smartcard on this NFC reader, LED blinks only once. But when I put the phone on it, the LED always blinks until phone out.
The ACR122U contains a PN532 NFC controller chip. The PN532 supports host card emulation through its TgInitAsTarget command (see the PN532 user manual). In order to pass commands to the PN532, you would connect to the ACR122U just as if it was a normal smartcard reader (e.g. using PC/SC). You can then send pack PN532 commands into reader-APDUs of the form
> FF000000 <Lc> <Command>
and get responses in the form
< <Response> 9000
So for getting the ACR122 into card emulation mode, you would do about the following:
ReadRegister:
> FF000000 08 D406 6305 630D 6338
< D507 xx yy zz 9000
Update register values:
xx = xx | 0x004; // CIU_TxAuto |= InitialRFOn
yy = yy & 0x0EF; // CIU_ManualRCV &= ~ParityDisable
zz = zz & 0x0F7; // CIU_Status2 &= ~MFCrypto1On
WriteRegister:
> FF000000 11 D408 6302 80 6303 80 6305 xx 630D yy 6338 zz
< D509 9000
SetParameters:
> FF000000 03 D412 30
< D513 9000
TgInitAsTarget
> FF000000 27 D48C 05 0400 123456 20 000000000000000000000000000000000000 00000000000000000000 00 00
< D58D xx ... 9000
Where xx should be equal to 0x08.
Communicate using a sequence of TgGetData and TgSetData commands:
> FF000000 02 D486
< D587 xx <C-APDU> 9000
Where xx is the status code (should be 0x00 for success) and C-APDU is the command sent from the reader.
> FF000000 yy D48E <R-APDU>
< D587 xx 9000
Where yy is 2 + the length of the R-APDU (response) and xx is the status code (should be 0x00 for success).
Basically ACR122U is not made to emulate the card while there is still very little information from manufacturer saying that it can be used to emulate an NFC card. If this is possible, it would be not that straight forward. I suggest you try Android Host Card Emulation (HCE on Android 4.4).
For part 2: I tried with my phone (Xperia Z) when I turned on the NFC chip and place the phone over the card reader, nothing happened from both sides. Maybe you are using card emulation feature of the phone.

Preview label written in Eltron Programming Language EPL?

I have code produced by our proprietry system in the Eltron Programming Language:
This is sent to Eltron/Zebra label printers to be printed.
Is there some kind of software that would allow me to interpret this code to do some form of 'print preview'?
I am considering developing a way to convert this into an image or even postscript pdf, but I am struggling with how to do the barcodes (the lines starting in B is for barcodes).
N
Q296,24
R132,0
S2
D9
ZB
A3,2,0,3,1,1,N,"RB10SS5"
B3,22,0,2C,2,4,35,N,"391369840"
A3,60,0,3,1,1,N,"391369840"
A3,80,0,3,1,1,N,"Testing"
A3,100,0,4,1,1,N,"Serology"
A3,130,0,1,1,1,N,"SSTORE"
A185,16,0,1,1,1,N,"17 Mar"
A185,35,0,1,1,1,N,"SEROL"
A185,51,0,1,1,1,N,"0.50"
B400,208,0,2C,2,4,40,N,"391369840"
A400,254,0,2,1,1,N,"391369840"
P1
Zebra doesn't provide software to do this for EPL labels, but if you have a ZPL/EPL printer and convert the labels to ZPL, you can use the printer's web page to view the label once its on the printer
I8,A,001
Q200,024
q448
rN
S4
D7
ZT
JF
O
R24,0
f100N
I8,
A,001
Q200,
024
q448
rN
S4
D7
ZT
JF
O
R24,
0
f100
N
B380,179,2,1,2,6,40,N,"<parcel_name>"
A355,107,2,4,1,1,N,"<model> <color> <clarity> Cut:<cut>"
A355,80,2,4,1,1,N,"Dpt:<depth> Tbl:<table_size>"
A355,54,2,4,1,1,N,"Pol:<polish> Sym:<symmetry> Fl:<flouresence>"
A355,27,2,4,1,1,N,"<gemology_institute_name> <certificate_number>"
A355,134,2,4,1,1,N,"<parcel_name_formatted> <carat>"
P1

Resources