...

View Full Version : make a dynamic URL shorter?



stokks
05-21-2012, 07:52 PM
Hi, i'm working with a javascript function that fires a netbeans function (deployed through glassfish) that stores data in 119 columns in a postgresql database. My URL right now is:



http://www.mirodinero.com:8080/mirodinero-war/setMisDatos?callback=respuestaGuardarMisDatos&param=%26usuario%3DIsa%20Mirodinero%26nivel%3D109%26gano_sal_neto%3D211113.45%26gano_sal_prof%3D2480 %26gano_monet%3D0%26gano_renta_fija%3D0%26gano_renta_vble%3D0%26gano_inmuebles%3D2226.75%26gano_otro s%3D2223.73%26gano_otros_ing%3D2411.12%26porc_gano_monet%3D0%26porc_gano_rentaf%3D0%26porc_gano_rent av%3D0%26porc_gano_inm%3D2%26porc_gano_otros%3D2%26porc_gano_otros_ing%3D1%26gasto_casa1%3D1306.46%2 6gasto_casa2%3D2402.38%26gasto_casa3%3D3999.57%26gasto_prestamo1%3D93475.58%26gasto_prestamo2%3D7325 .88%26gasto_prestamo3%3D34090.9%26gasto_tarjetas%3D29443.2%26gasto_ibi%3D5670%26gasto_imp_otros%3D67 80%26gasto_seg_inm%3D1320%26gasto_seg_pens%3D3451.22%26gasto_seg_vida%3D2330%26gasto_seg_plan%3D3423 0%26gasto_seg_medico%3D21220%26gasto_seg_coche%3D220%26gasto_luz%3D620%26gasto_agua%3D4550%26gasto_g as%3D320%26gasto_telef_f%3D22320%26gasto_telef_m%3D2350%26gasto_internet%3D20%26gasto_tv%3D3450%26ga sto_hogar%3D20%26gasto_comida%3D20%26gasto_cenas_copas%3D20%26gasto_viajes%3D20%26gasto_vacaciones%3 D220%26gasto_mobiliario%3D220%26gasto_ropa%3D2320%26gasto_transp%3D230%26gasto_otros%3D3620%26gasto_ colegios%3D240%26gasto_univ%3D340%26gasto_master%3D2230%26gasto_otros_gastos%3D7323433%26porc_gasto_ tarjetas%3D0%26porc_gasto_ibi%3D0%26porc_gasto_trib%3D0%26porc_gasto_seg_inm%3D0%26porc_gasto_seg_pe ns%3D0%26porc_gasto_seg_vida%3D2%26porc_gasto_seg_plan%3D2%26porc_gasto_seg_med%3D0%26porc_gasto_seg _coche%3D0%26porc_gasto_sum_luz%3D2%26porc_gasto_sum_agua%3D2%26porc_gasto_sum_gas%3D0%26porc_gasto_ sum_teleff%3D0%26porc_gasto_sum_telefm%3D0%26porc_gasto_sum_int%3D0%26porc_gasto_sum_tv%3D0%26porc_g asto_nivel_hogar%3D0%26porc_gasto_nivel_comida%3D0%26porc_gasto_nivel_cenas%3D0%26porc_gasto_nivel_v iajes%3D0%26porc_gasto_nivel_vacac%3D0%26porc_gasto_nivel_mob%3D0%26porc_gasto_nivel_ropa%3D20%26por c_gasto_nivel_transp%3D30%26porc_gasto_nivel_otros%3D30%26porc_gasto_colegios%3D2%26porc_gasto_univ% 3D0%26porc_gasto_master%3D0%26porc_gasto_otros_gastos%3D23%26tengo_casa1%3D1231.11%26tengo_casa2%3D1 0000%26tengo_casa3%3D22240%26tengo_otras%3D23560%26tengo_monetario%3D1212.34%26tengo_planpensiones%3 D23230%26tengo_otros%3D23330%26porc_tengo_casa1%3D1%26porc_tengo_casa2%3D0%26porc_tengo_casa3%3D2%26 porc_tengo_otras%3D0%26porc_tengo_monet%3D0%26porc_tengo_plan%3D0%26porc_tengo_otros%3D0%26debo_casa 1%3D4340%26debo_casa2%3D23450%26debo_casa3%3D23430%26debo_prestamo1%3D23330%26debo_prestamo2%3D6871. 11%26debo_prestamo3%3D11340%26debo_tarjetas%3D61340%26porc_debo_casa1%3D30%26porc_debo_casa2%3D10%26 porc_debo_casa3%3D12%26porc_debo_prestamo1%3D1%26porc_debo_prestamo2%3D12%26porc_debo_prestamo3%3D1% 26porc_debo_tarjetas%3D4%26plazo_debo_casa1%3D230%26plazo_debo_casa2%3D450%26plazo_debo_casa3%3D122% 26plazo_debo_prestamo1%3D3%26plazo_debo_prestamo2%3D12%26plazo_debo_prestamo3%3D4

that is like 2568 characters long, and since i use Apache 2.2.15 (for windows 2008 server edition), i get error on the first time i click. So I would like to change the length of my URL with something like this:


http://www.mirodinero.com:8080/mirodinero-war/setMisDatos?callback=rGMD&p=%26u%3DIsa%20Mirodinero%26n%3D109%26gsn%3D211113.45%26gsp%3D2480%26gm%3D0%26grf%3D0%26grv%3D0%26gi %3D2226.75%26go%3D2223.73%26goi%3D2411.12%26pgm%3D0%26pgr%3D0%26pgr%3D0%26pgi%3D2%26pgo%3D2%26pgoi%3 D1%26gc1%3D1306.46%26gc2%3D2402.38%26gc3%3D3999.57%26gp1%3D93475.58%26gp2%3D7325.88%26gp3%3D34090.9% 26gt%3D29443.2%26gibi%3D5670%26gimo%3D6780%26gsi%3D1320%26gsegp%3D3451.22%26gsv%3D2330%26gsp%3D34230 %26gseg%3D21220%26gasto_seg_coche%3D220%26gl%3D620%26ga%3D4550%26ggas%3D320%26gasto_telef_f%3D22320% 26gasto_telef_m%3D2350%26gasto_internet%3D20%26gasto_tv%3D3450%26gasto_hogar%3D20%26gasto_comida%3D2 0%26gasto_cenas_copas%3D20%26gasto_viajes%3D20%26gasto_vacaciones%3D220%26gasto_mobiliario%3D220%26g asto_ropa%3D2320%26gasto_transp%3D230%26gasto_otros%3D3620%26gasto_colegios%3D240%26gasto_univ%3D340 %26gasto_master%3D2230%26gasto_otros_gastos%3D7323433%26porc_gasto_tarjetas%3D0%26porc_gasto_ibi%3D0 %26porc_gasto_trib%3D0%26porc_gasto_seg_inm%3D0%26porc_gasto_seg_pens%3D0%26porc_gasto_seg_vida%3D2% 26porc_gasto_seg_plan%3D2%26porc_gasto_seg_med%3D0%26porc_gasto_seg_coche%3D0%26porc_gasto_sum_luz%3 D2%26porc_gasto_sum_agua%3D2%26porc_gasto_sum_gas%3D0%26porc_gasto_sum_teleff%3D0%26porc_gasto_sum_t elefm%3D0%26porc_gasto_sum_int%3D0%26porc_gasto_sum_tv%3D0%26porc_gasto_nivel_hogar%3D0%26porc_gasto _nivel_comida%3D0%26porc_gasto_nivel_cenas%3D0%26porc_gasto_nivel_viajes%3D0%26pgnv%3D0%26pgnm%3D0%2 6pgnr%3D20%26pgnt%3D30%26pogoo%3D30%26pogc%3D2%26pgu%3D0%26pgma%3D0%26pgog%3D23%26tc1%3D1231.11%26tc 2%3D10000%26tc3%3D22240%26toa%3D23560%26tm%3D1212.34%26tpp%3D23230%26too%3D23330%26potc1%3D1%26potc2 %3D0%26potc3%3D2%26poto%3D0%26potm%3D0%26potp%3D0%26poto%3D0%26dc1%3D4340%26dc2%3D23450%26dc3%3D2343 0%26dp1%3D23330%26dp2%3D6871.11%26dp3%3D11340%26dt%3D61340%26podc1%3D30%26podc2%3D10%26pdc3%3D12%26p odp1%3D1%26podp2%3D12%26podp3%3D1%26pdt%3D4%26pdc1%3D230%26pdc2%3D450%26pdc3%3D122%26pdp1%3D3%26pdp2 %3D12%26pdp3%3D4


that is 1990 characters long. The problem is that I have been able to change &usuario= to &u= without problem, but then when i tried to change &gano_sal_neto= to &gsn= i get error. I changed gano_sal_neto to gsn in these files:

- the javascript file of the webpage;
- the netbeans files;
- the php code on the drupal page;
- i created a new column in postgresql.

What am I missing to make this change work and get a new and shorter URL working?

stokks
05-23-2012, 12:14 PM
i have 2 types of error:

in the netbeans log file, it tells me:



error:
java.lang.NullPointerException
at com.mirodinero.web.calculos.Calculos.getTotalGano(Calculos.java:182)
at com.mirodinero.web.calculos.CalcularSegmentos.ejecutar(CalcularSegmentos.java:65)
at com.mirodinero.web.servlets.setMisDatos.actualizarSegmentos(setMisDatos.java:543)


where getTotalGano at those lines is:



public float getTotalGano() {
float res = user.getGanoMonet() + user.getGanoRentaFija() + user.getGanoRentaVble() + user.getGanoInmuebles() + user.getGanoOtros() + user.getGanoSalNeto() + user.getGanoSalProf() + user.getGanoOtrosIng();
return res;
}


, ejecutar() is



public void ejecutar() {
boolean existe = true;
DatosUsuario datosUser = datosUsuarioFacade.findById(atributosUsuario.getIdUsuario());
if (datosUser != null) {
List<Cartera> lc = carteraFacade.findByIdUsuario(atributosUsuario.getIdUsuario());
Calculos c = new Calculos(datosUser, accionesDatosFacade, fondosDatosFacade, bonosDatosFacade, lc);
ahorroLiquido = c.getTengoDisponible() / c.getTotalGasto();
ingresoAnual = c.getTotalGano(); /*this is line 65 */
diferenciaGanoGasto = c.getSupDefTotal();//indica lo que gano menos lo que gasto
modificarAtributos(c, datosUser);
}


and actualizarSegmentos is:



private void actualizarSegmentos(String usuario) {
AtributosUsuario a = atributosUsuarioFacade.find(usuario);
if (a != null) {//lista vacia
new CalcularSegmentos(a, segmentosUsuarioFacade, datosUsuarioFacade, carteraFacade, accionesDatosFacade, fondosDatosFacade, bonosDatosFacade, atributosUsuarioFacade).ejecutar();
}




on the postgres log file, i get:



2012-05-22 11:10:46 CESTLOG: could not receive data from client: Unknown winsock error 10061
2012-05-22 11:10:46 CESTLOG: unexpected EOF on client connection
2012-05-22 11:19:12 CESTLOG: CreateProcess call failed: Unknown winsock error 10004 (error code 1115)
2012-05-22 11:19:12 CESTLOG: could not fork autovacuum worker process: Unknown winsock error 10004
but i don't know what does it mean. Maybe is there something i should do with pgadmin to "upgrade" the database to the changes:i added a column named gsn -real and default 0 like gano_sal_neto-, without deleting the gano_sal_neto (that still has stored the data of the users).

stokks
05-28-2012, 04:35 PM
still nobody able to help me with this? i don't what's the problem with changing columns name in postgres, maybe a procedure i'm missing?

Philip M
05-29-2012, 08:18 AM
This is the JavaScript forum. Java and Javascript are entirely different programming languages, in spite of the confusingly similar names. Rather like Austria and Australia! Ask a mod to move this thread to the right forum.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum