viernes, 13 de octubre de 2017

sintaxis de acceso al servicio ftp mediante URI

The syntax of FTP URLs

According to the specification of URL formats, RFC 1738, an FTP URL is of the form
ftp://user:password@host:port/path
so that some or all of the parts user:password@, :password, :port and /path may be excluded. Although RFC 1738 has been obsoleted as regards to generic URL syntax (now defined in RFC 3986), some of the specific parts, like FTP URL syntax, are still in force.
The components obey the following rules:
user
a user name (user id) on the host
password
the password corresponding to the user name; note: if the user and password field in a URL contains character : or @ or /, the character must be encoded
host
the fully qualified domain name of a network host, or its IP address
port
the port number to connect to; it omitted, defaults to 21
path
path specification of the form
cwd1/cwd2/.../cwdN/name
(where any occurrence of / or ; within a cwdi or the name must be encoded) optionally followed by
;type=typecode
where typecode is one of the characters a, i, d
Effectively, ;type=a means "Ascii mode" (plain text mode) of transfer whereas ;type=i means image (binary) mode. If the ;type=typecode part of an FTP URL is omitted, the client program interpreting the URL must guess the appropriate mode to use. In general, the data content type of a file can only be guessed from the name, e.g., from the suffix of the name; the appropriate type code to be used for transfer of the file can then be deduced from the data content of the file.
Fuente: http://jkorpela.fi/ftpurl.html

lunes, 2 de octubre de 2017

Extraer sólo numeros de un campo string en TSQL (Microsoft SQL Server)

El ejemplo se ha probado en una base de datos Microsoft SQL Server 2008 R2
CREATE FUNCTION dbo.udf_GetNumeric
(@strAlphaNumeric VARCHAR(256))
RETURNS VARCHAR(256)
AS
BEGIN
DECLARE @intAlpha INT
SET @intAlpha = PATINDEX('%[^0-9]%', @strAlphaNumeric)
BEGIN
WHILE @intAlpha > 0
BEGIN
SET @strAlphaNumeric = STUFF(@strAlphaNumeric, @intAlpha, 1, '' )
SET @intAlpha = PATINDEX('%[^0-9]%', @strAlphaNumeric )
END
END
RETURN ISNULL(@strAlphaNumeric,0)
END
GO
Now use the function as
SELECT dbo.udf_GetNumeric(column_name) 
from table_name
Ésta función es muy útil y permite extraer información sólo números de un campo cadena.
Ejemplo: Supongamos que tenemos una base de datos con los clientes y sus DNI. El DNI está almacenado con la letra y queremos sólo la parte numérica.

si hacemos: select dni from clientes

obtendremos:

dni
--------
1234567894X
1234567895J
1234567895P

ahora: creamos la función en la base de datos y a continuación realizamos la consulta:

select dbo.udf_GetNumeric(dni) from clientes
obtendremos:

dni
--------
1234567894
1234567895
1234567895

fuente:
https://stackoverflow.com/questions/16667251/query-to-get-only-numbers-from-a-string
Muchas gracias al usuario: https://stackoverflow.com/users/1841054/luv

martes, 18 de julio de 2017

Delphi tstringlist indexof case sensitive

Desarrollando una aplicación me encontré el siguiente problema:

Cargo un objeto TStringList con caracteres. Ejemplo 'T', 'e', 's', 't'

la propiedad indexOf del objecto TStringList devuelve las coincidencias sin tener en cuenta mayúsucla y minúsculas, es decir, no es caso sensitivo.

indexOf('t') devolvería el índice: 0. Que corresponde en realidad a 'T' (mayúscula)

Para corregirlo sustituir la función indexOf por:

function TForm1.searchStringListPosition(miLista: TStringList): integer;
begin
  for Result := 0 to miLista.count - 1 do
    if AnsiCompareStr(miLista[Result], pString) = 0 then Exit;
  Result := -1;
end;

Suerte! Esta tontería me dió muchos dolores de cabeza por eso me gustaría compartir esto.

---------------------------------------
Aclaraciones:

Aclaración 1:

Esta funcionalidad ha podido ser modificada en distintas versiones de delphi según  un comenario en: http://fpc-pascal.freepascal.narkive.com/GEdB2ACG/tstringlist-indexof-case-sensitivity

Post by James Mills
Hi,
Is TStringList.indexOf case sensitive or insensitive ?
TStrings.indexOf is case insensitive, but TStringList.indexOf overrides
the TStrings.indexOf implementation accoriding to the documentation.
It is case insensitive, but this was changed recently for Delphi
compatibility.
Older versions are case sensitive. Here are the relevant log entries:

revision 1.15
date: 2003/05/29 23:13:57; author: michael; state: Exp; lines: +5 -2
fixed case insensitivity of TStrings.IndexOf
----------------------------
revision 1.14
date: 2002/12/10 21:05:44; author: michael; state: Exp; lines: +12 -5
+ IndexOfName is case insensitive
----------------------------

Michael

lunes, 17 de julio de 2017

Recuperar la clave de un fichero 7z

Hace un tiempo puse una clave a un fichero 7z y no era capaz de acordarme cual era. Como la información era importante decidí realizar una pequeña aplicación que recuperase la clave mediante intentos de prueba-error o "Fuerza bruta".

Si tu también pasas por ese problema contacta conmigo para intentar obtener la clave.

El éxito de la operación dependerá de la complejidad de la clave. A mayor complejidad, mayor tiempo. Entiendo por complejidad la variedad de caracteres usados y el tamaño, mayúsculas, minúsculas...

jueves, 13 de julio de 2017

When I select a cell in the Detail grid I get the error "Key Field not found"


0
    • I have set up a grid with a Master-Detail relationship. Each view is associated to a TClientDataSet. The detail view > MasterKeyFieldNames property has been set to match the key name of the Master View. The detail view > DetailKeyFieldNames property has been set to match the key name of the Detail View. The detail view > KeyFieldNames property has been set to match the key name of the Detail View.
      When I run the program the data displays properly at first. However, when I enter one of the fields on the Detail grid I get the error "Key Field not found". There is always one row that does not give the "Key Field not found" error, but in that row the highlighted cell displays data from another cell until another cell is selected.
0
Hello Karen,
Thank you for the message.
This error occurs because your dsDetail dataset doesn't contain the cdsKeyFieldName field.
You should assign an existent column to the TcxDBDataController.KeyFieldNames property.
For more information, please read the "Master-Detail" topic.
Thanks,
Valdemar


Fuente: https://www.devexpress.com/Support/Center/Question/Details/Q267533/when-i-select-a-cell-in-the-detail-grid-i-get-the-error-key-field-not-found

martes, 4 de julio de 2017

Interesante enlace para comenzar con Drupal

Drupal es un sistema dinámico: en lugar de almacenar sus contenidos en archivos estáticos en el sistema de ficheros del servidor de forma fija, el contenido textual de las páginas y otras configuraciones son almacenados en una base de datos y se editan utilizando un entorno Web. (extraido de https://es.wikipedia.org/wiki/Drupal)


http://www.cursosdrupal.com/content/indice

martes, 27 de junio de 2017

Jesús Moreno - Ingeniero Ténico Informático - consultor Informático

Hola,
soy Jesús Moreno Ingeniero Técnico Informático en sistemas por la US y propietario de éste blog.

Mi trabajo en los ultimos años se centra especialmente en aplicaciones distribuidas con tecnologías web y centradas en software cliente servidor haciendo uso de sistemas de intercomunicación mediante protocolos json, xml, rest, soap y aplicaciones con frameworks javascript, html5, css3, php, asp, mysql, sqlserver...

Soy muy fan del software libre, que permite hacer llegar a todos el conocimiento y crear entre todos una comunidad mucho más eficaz.
El motivo principal de este blog es hacer llegar a todo el mundo una solución rápida y eficaz ante problemas que pueden surgirte mientras trabajas en un proyecto y que pueden hacerte perder mucho tiempo. Aportar una solución que otro conoce porque se ha enfrentado antes a la misma situación y ha conseguido solucionarla con éxito.
Por eso agradezco mucho vuestros comentarios de apoyo cuando os ha sido útil una entrada, porque demuestra que éste blog llega a la gente y consigue su objetivo.

Si estáis trabajando en un proyecto y tenéis dudas o errores que no os dejan continuar con vuestro trabajo. Podéis contactar conmigo dejando un comentario en esta entrada.

Saludos y buen día.

Jesús Moreno - Ingeniero Ténico Informático - consultor Informático

Hola, soy Jesús Moreno Ingeniero Técnico Informático en sistemas por la US y propietario de éste blog. Mi trabajo en los ultimos años se ...