Custom character for input - primefaces

I am new to java, I am working with primefaces and as part of a capture for username I am being asked for this.
How can I customize the capture? You can capture numbers (0-9) and letters (a-zA-Z) but I also require: # $ & -_. How can I make special characters for this? Thanks in advance and an apology in case I do not ask the question correctly.
I already made several tests but I do not have the desired result. When I put the "&" character it marks me an error leaving it like this:
<o:validator
validatorId="javax.faces.RegularExpression"
pattern="^[#$-_.A-Za-z0-9\\+]+(\\.[#$-_.A-Za-z0-9]+)*"
message="La contraseña no tiene un formato válido." />
<p:outputLabel value="Contraseña:" for="newUserPwd1"/>
<p:password
id="newUserPwd1" value="#{userManagerView.pass1}" required="true"
requiredMessage ="La contraseña es obligatoria.">
<o:validator
validatorId="javax.faces.Length" minimum="6"
message="La contraseña requiere mínimo de 6 caracteres"/>
<o:validator
validatorId="javax.faces.RegularExpression"
pattern="^[#$-_.A-Za-z0-9\\+]+(\\.[#$-_.A-Za-z0-9]+)*"
message="La contraseña no tiene un formato válido." />
</p:password>
This is the error with the character &
Parsing Error /viewMetadata/admin/usuarios.xhtml: Error Traced [line: 172] A decimal representation must appear immediately after "& #
Caused by:
javax.faces.view.facelets.FaceletException - Error Parsing /viewMetadata/admin/usuarios.xhtml: Error Traced [line: 172] A decimal representation must appear immediately after "& #
at org.apache.myfaces.view.facelets.compiler.SAXCompiler.doCompileViewMetadata (SAXCompiler.java:838)

Related

lsode function in octave

I wrote the code below and it worked for several weeks without any problem.
Suddenely it stoped working with following error:
"warning: lsode: passing function body as a string is obsolete; please use anonymous functions
warning: called from
heun at line 23 column 2
error: 'f' undefined near line 1 column 42
error: lsode: evaluation of user-supplied function failed
error: called from
__lsode_fcn__C__ at line 1 column 40
heun at line 23 column 2"
The code is:
function yn=euler(t0,y0,tend,f,n)
t0=input('Gib hier t0 ein:');
y0=input('Gib hier y0 ein:');
tend=input('Bis zu welchem Wert von t möchtest du y annährn?');
n=input('Gib hier die Anzahl der Schritte ein(n):');
fstrich=input('Wie lautet die Differentialgleichung?', 's');
f=inline('fstrich');
dt=(tend-t0)/n;
t(1)=t0;
y(1)=y0;
for i=1:n
t(i+1)=t(i)+dt;
y(i+1)=y(i)+f(t(i),y(i))*dt;
rotdim([flip(t) ; flip(y)])
scatter(t,y,'*')
hold on
f=inline('fstrich');
t=t0:0.001:tend;
y=lsode('f',y0,t);
plot(t,y)
Does anyone see a mistake or something I can change?
Apparently you updated octave.
f=inline('fstrich'); % this is discouraged
y=lsode('f',y0,t); % and this is not valid anymore.
Instead, make an anonymous function
f=str2func(fstrich);
y=lsode(f,y0,t);

I have a JSON file with 379000 lines and it is full with double quotes inside the string objects,how can I delete all of them?

The invalid format:
"studwhere": "Academia de Muzica "Gheorghe Dima" Cluj-Napoca",
Expected result:
"studwhere": "Academia de Muzica Gheorghe Dima Cluj-Napoca",
or
"studwhere": "Academia de Muzica \"Gheorghe Dima\" Cluj-Napoca",

Delphi RESTClient parsing JSON

I use TRESTClient, TRESTRequest, FRESTResponse and RESTResponseDataSetAdapter like in RESTDebugger (Delphi Tokyo) and it works fine but for one JSONValue the webservice send me some HTML mix and It do not display the right thing in my TFDMemTable.
I make the same test with JSONViewer and it make the same things
Is there a way to modify my JSONStream just before it start to parse my RestReponse ?
Why it don't display all my JSONString for dev_msg_attention_to_garage ?
{"id_commande":"15672","id_devis":"16347","status":"CONFIRM","res_codres":"IDG","nom_client":"TESTRDV","prenom_client":"toto","mail":"test#test.fr","tel_port":"0606060606","date_prise_rdv":"2017-09-25 09:25:43.281269","date_rdv":"2017-09-27","heure_rdv":"17:30-18:00","immatriculation":"EC620XP ","type_prestation":"FREINAGE","famille":"Disques et plaquettes avant","type_mine":"","codmar":"PEUG","numord":"9938","marque":"PEUGEOT","marque_modele":"PEUGEOT 206 1.1 60CV","cnit":"MPE1002K6315","aaa_caliloca":null,"aaa_cape":null,"aaa_ccreditbail":null,"aaa_canton":null,"aaa_carrosserie":"BERLINE","aaa_carrosseriecg":"CI","aaa_catclient":null,"aaa_catclientvo":null,"aaa_catvendeur":null,"aaa_co2":"154","aaa_codifvin":"VF32AHFZE40061368","aaa_consexurb":"5.1","aaa_consmixte":"6.2","aaa_consurb":"8.2","aaa_couleurvehic":"MARRON","aaa_cstrvincg":null,"aaa_cylindree":"1124","aaa_date1ercir":"1998-10-15","aaa_datedcg":"2016-06-09","aaa_datedcgachat":null,"aaa_datedcgpr":null,"aaa_datedcgprachat":null,"aaa_depart":null,"aaa_departement":null,"aaa_depollution":"NON","aaa_empat":"245.0","aaa_empreintesol":null,"aaa_energie":"ESSENCE","aaa_gammemarche":null,"aaa_genrev":"VP","aaa_genrevcg":"VP","aaa_hauteur":"144","aaa_immatsiv":"EC620XP","aaa_largeur":"165","aaa_longueur":"384","aaa_marque":"PEUGEOT","aaa_marquecarros":"PEUGEOT","aaa_modeinject":"AUTR. CARBURATIONS","aaa_moderefroid":null,"aaa_modele":"206","aaa_modeleetude":"206","aaa_modeleprf":"206","aaa_mouvmt":null,"aaa_nserie":"40061368","aaa_nsiren":"000000000","aaa_nbcylind":"4","aaa_nbdecibels":null,"aaa_nbmain":null,"aaa_nbplass":"5","aaa_nbportes":"5","aaa_nbpropriet":null,"aaa_nbsoupape":"2","aaa_nbvitesse":"5","aaa_nbvolume":"2","aaa_nuancecouleur":null,"aaa_poidsvide":"910","aaa_prixvehic":"0","aaa_propulsion":"AVANT","aaa_ptr":"1405","aaa_ptrprf":"0192","aaa_puisch":"60","aaa_puisfisc":"5","aaa_rappuispoids":null,"aaa_regionadmin":null,"aaa_regmdecibels":null,"aaa_statutimmat":null,"aaa_temoincession":null,"aaa_tpboitevit":"MECANIQUE","aaa_transmiss":null,"aaa_turbocompr":"NON TURBO","aaa_type":"MPE1002K6315","aaa_typevincg":"2AHFZE","aaa_version":"XR\/PRESE","aaa_voiear":null,"aaa_voieav":null,"aaa_datews":"2017-06-16","aaa_3lnom":"fff","veh_codmar":null,"veh_numord":null,"veh_ktypenr":null,"aaa_pneus":"175\/65 R14 82 T, 165\/70 R13 79 T","aaa_typevarversprf":"2AHFZE","aaa_codemoteur":"HFZ","aaa_puiskw":"44","total_ht":"141.58","total_tva":"28.32","total_ttc":"169.90","total_ttc_max":"169.90","total_ttc_min":"169.90","dev_msg_attention_to_garage":" \r\n \r\n \r\n attention\r\n \r\n ATTENTION Pour ce rendez-vous web nous avons identifié\r\n plusieurs références constructeur possible :<\/br\/>\r\n 4249A5, <b>424995<\/b><br\/> \r\n <br \/>Vous devez vous assurer que la\r\n référence indiquée correspond bien à\r\n celle montée sur le véhicule du client <br \/>Le\r\n prix final à payer par le client doit être de 169,90 \u20AC TTC \r\n \r\n \r\n\t\r\n \/ Le devis est en pi\u00E8ce budget","dev_msg_from_customer":"test message;\r\n","id":"15672","created_at":"2017-09-25 09:25:43.460187","updated_at":"2017-09-25 09:26:10.621387","coupon":[],"promotion_globale":[],"lignes_pieces":[{"codfam":"FDI","ssfam":"AV","designation_piece":"DISQUE DE FREIN AV PLEIN. DIAMETRE= 247X10MM","ref_constructeur":"424995","quantity":"2.00","remise":"0.00","pu":"0.00","taux_tva":null},{"codfam":"FPL","ssfam":"AV","designation_piece":"PLAQUETTES DE FREIN AV. MONTAGE BOSCH","ref_constructeur":"425320","quantity":"1.00","remise":"0.00","pu":"0.00","taux_tva":null}],"lignes_mo":[{"type_ligne":"FOI","designation_mo":"Forfait Isotech ","ref_operation_adauto":"FISOAD16990","quantity":"1.00","taux_horaire":"141.58","remise":null,"code_taux_horaire":null,"taux_tva":1.2,"montant_ht_ligne_apres_remise":141.58}],"deduction_rdv_en_ligne_ttc":"16.99","montant_a_regler_par_client":152.91,"pourcentage_remise_calculee_pieces":0,"total_remises":0,"total_ht_avant_remises":141.58,"pourcentage_remises":0,"pourcentage_remise_calculee_mo":0}
You are being presented with a limitation of Windows' Tree View. From the documentation:
Note that although the tree-view control allows any length string to be stored as item text, only the first 260 characters are displayed.
(Emphasis mine)
The quick answer is that since this control wraps Delphi's TTreeView implementation, it also inherits this limitation, and thus there's not too much you can do to overcome it, besides either implementing custom drawing or finding another control without this limitation.

Error in for sentence robotframework

Hi im reading a CSV file (to get information from a WEB Service) with this values:
169233xxx
169129xxx
189925xxx
This is my keyword definition:
Carga RUTs
[Documentation] Carga lista de RUTs a validar desde archivo csv
[Arguments] ${file_name}
${data}= read csv file ${file_name}
[return] ${data}
I catch this values in a for:
Consultar WS
[Documentation] Lee RUTs de archivo csv y consulta cada uno al Experto Original y Migrado.
[Arguments] ${data}
${rutsd}= Set Variable 0
Log To Console .
:FOR ${element} IN #{data}
\ ${rutsd}= Fetch From Left ${element}[0] ;
\ ${dvymas}= Get Substring ${element}[0] -2
\ Log To Console Consultando RUT ${rutsd}...
\ Run Keyword And Continue On Failure WS Experto Orignal ${rutsd}
At the moment of consulting....Appears for each "[" or "$apos" icon , i dont understand
<ns1:rut>['189925xxx </ns1:rut>
<ns1:rut>[$apos 189925xxx </ns1:rut>
At finally response:
Server raised fault: '1001: RUT no Válido' (translate DNI invalid(
Can someone explain to me why I am getting this error?
Thanks,
Regards!!
EDIT:
To not creat a new post i have a new error, i modified
${element}[0] for #{element}[0]
The previous error was solved.
Now i have a new error:
List variable '#{element}' has no item in index 0
Can someone explain to me why I am getting this error?
thanks again

cakephp 2.6 confirm message spanish chars fails due to json_encode

my view code:
$confirm='¿Está seguro de que quiere borrar el nº 1?';
$this->Html->link(__d('phkapa', 'Send'), array('action' => 'send', $ticket['Ticket']['id']),array('escape' => true, 'confirm'=> $confirm));
result in alert box is :
\u00bfEst\u00e1 seguro de que quiere borrar el n\u00ba 1?
cakephp 2.6 and all app is on utf8 ...
is this a bug on cake 2.6 or am i missing something? or any ideas how to resolve this without changing the core function that returns a string to be used as onclick handler for confirm dialogs.
this function uses json_encode like $message = json_encode($message) and this is the problem, the json_enconde outputs \u00bf instead of ¿
unfortunaly we cant use option JSON_UNESCAPED_UNICODE, that encodes multibyte Unicode characters literally (default is to escape as \uXXXX), since is only available since PHP 5.4.0.
Try encoding the value with PHP first via urlencode. Hopefully CakePHP decodes the values when it produces the HTML output.
$confirm = urlencode ( '¿Está seguro de que quiere borrar el nº 1?' );
$this->Html->link(__d('phkapa', 'Send'), array('action' => 'send', $ticket['Ticket']['id']),array('escape' => true, 'confirm'=> $confirm));
You can also see this JS fiddle https://jsfiddle.net/daeyebpu/ that demonstrates encoding/decoding.
Saludos desde Colorado