Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2009.02.01;
Скачать: CL | DM;

Вниз

TListView get item   Найти похожие ветки 

 
bit   (2008-12-15 23:53) [0]

Hi,

Имеется таблица (TListView):

Fname|Lname|Email

Как проверить наличие/валидность Email"а выделенной строки?


 
Германн ©   (2008-12-16 00:38) [1]


> Имеется таблица (TListView):
>

TListView это не таблица. Это ListView. ListView содержит список Item"ов, которые, в свою очередь, содержат списки своих SubItem"ов.
И тут сразу возникает встречный вопрос. А как ты этот TListView заполняешь данными, если ничего не знаешь про сущность TListView? И не понимаешь как узнать содержимое конкретного SubItem"a конкретного Item"a?


 
bit   (2008-12-16 00:57) [2]

type
...
lv: TListView;
...

var
li:tlistitem;
...

while not q1.Eof do
begin
li:=lv.Items.Add;
li.Caption:=q1.fieldbyname("First_Name").Value;
li.SubItems.Add(q1.fieldbyname("First_Name").text);
 li.SubItems.Add(q1.fieldbyname("Email").text);
...
end;

{I try to do that in this way: Showmessage(lv.Items.Item[7].Caption);
but Receive only First_Name of selected row, but I need to get Text from Email field
}


 
Германн ©   (2008-12-16 01:54) [3]


> {I try to do that in this way: Showmessage(lv.Items.Item[7].
> Caption);
> but Receive only First_Name of selected row, but I need
> to get Text from Email field
> }
>

А справку прочитать? Лень?
Некий код, который заполняет TListView данными ты где-то надыбал. (Кстати, стрёмный какой-то код).  Но сей надыбанный код не имел той функциональности, которая была тебе нужна.
Читай справку.
Токо не говори, что не знаешь аглицкого языка. Тебе же хуже будет.


 
Eraser ©   (2008-12-16 02:25) [4]

> [0] bit   (15.12.08 23:53)

с помощью регулярных выражений.


 
KilkennyCat ©   (2008-12-16 03:24) [5]


> Германн

о чем ты? ему валидность надо проверять, значит, получать умеет.


> [0] bit

100% решения не существует.
Частично можно решить проверкой существования сервера (части строки после обезьянки), запросом на него о существовании ящика (часть строки до обезьянки).


 
Сергей М. ©   (2008-12-16 08:38) [6]


> проверить наличие/валидность Email"а выделенной строки?


try
 s := lv.Selected.Subitems[1];
 if IsValidEmailAddress(s) then
   ShowMessage("Адрес валидный");
except
 ShowMessage("Адрес не указан");
end;


 
bit   (2008-12-16 09:27) [7]

Thanks! :

lv.Items.Item[0].SubItems[4]; // it works corrrectly

but

IsValidEmailAddress - I don"t find any info in Help about this function. Can you give example how to check string if it is correct email?
One more question:

What function can compare two strings using regular expression?
(for example in sql : select * from table Where "fiels" REGEXP "some_ regular string";)

Help would be greatly appreciated!

Ps. I work with mysql connector, get iform from custom db and fill TlistView


 
Palladin ©   (2008-12-16 09:37) [8]


> IsValidEmailAddress - I don"t find any info in Help about
> this function.

кто бы сомневался...


 
Сергей М. ©   (2008-12-16 10:26) [9]


> lv.Items.Item[0].SubItems[4]; // it works corrrectly


Не трынди)
EMail-сабитем ты, судя по [2], добавляешь вторым по счету, соответственно индекс колонки равен 1, а не 4


 
Сергей М. ©   (2008-12-16 10:30) [10]


> I don"t find any info in Help about this function


You must write this function by youself


 
bit   (2008-12-16 13:25) [11]

i don"t familar with regular expression.
Can  you tell what function(!!!) compare or find out if string and regular expression match to each other?

What kind of regular expression/template should i use in function which compares custom string and regexp?

Ps. You can write in russian, coz i understand. Temporarily I have english only keyboard=)

@[6] Сергей М. -> I don"t need help in using ShowMessage func!


 
Сергей М. ©   (2008-12-16 13:35) [12]

http://regexpstudio.com/RU/TRegExpr/TRegExpr.html

uses .. RegExpr ..
...
const
 rtUser = "([\w|\d][\w|\d|\-|\.]*)";
 rtDomain = "(([a-z\d][a-z\d\-]*[a-z\d\.])+[a-z]{2,6})";
 rtMailAddress = rtUser + "@" + rtDomain;
..

 RegExpr := TRegExpr.Create;
 RegExpr.ModifierI := True;
 ...

 RegExpr.Expression := rtMailAddress;
 if not RegExpr.Exec("проверяемый на валидность адрес") then
   ShowMessage("Инвалид !")


 
bit   (2008-12-16 14:29) [13]

Can I avoid including external library what increase size of my program?

may be there is other way , using native delphi components or whatever it is


 
Сергей М. ©   (2008-12-16 14:36) [14]

В Делфи нет штатных компонентов, реализующих функ-ть процессора рег.выражений.

В составе TIdMessage (Indy) есть, конечно, соответствующий парсер, но это уже на любителя помучиться перед смертью)


 
bit   (2008-12-16 15:00) [15]

@[14] Сергей М.-> Thanks! I will try it

One more question->
I need simple function which provide Encrypt/Decryp custom string

Something like that:

function EnDeCrypt("input string", "key", encrypt or decrypt): string;

This feature will take place in keeping passwd in external file.

I prefer RC4 en/decrypter.
Do you know alternative opportunity to do that?


 
Сергей М. ©   (2008-12-16 15:23) [16]

Альтернатив великое множество, но лучшим вариантом будет хранение хэша пароля, а не самого пароля в каком бы то ни было виде.


 
bit   (2008-12-16 18:21) [17]

I argree with you but there is one tricky thing.
I need to ask user every time for password.

I"m going to do function which
1. Ask for password
2. Encrypt passwd
3. Put Encrypted passwd in file
4. If program starts it check for passwd external file
5. If file exists then ReadString, Decrypt String

*passwd will be encrypted by one static string located in binary program code/or simply in compiled executable file.

What you think about that?
Can you afford me some function/give advice how to compile this function (I prefer RC4 algorithm )?


 
bit   (2008-12-16 22:00) [18]

Я соглашаюсь с Вами, но есть одна хитрая вещь.
Я должен спросить пользователя каждый раз относительно пароля.

Я собираюсь сделать функцию который
1. Попросите пароль
2. Зашифруйте passwd
3. Помещенный Зашифрованный passwd в файле
4. Если программа начинает это чек на passwd внешний файл
5. Если файл существует тогда ReadString, Расшифруйте Последовательность

*passwd будет зашифрован одной статической последовательностью, расположенной в кодексе/или программы в двоичном представлении просто в собранном выполнимом файле.

Что Вы думаете об этом?
Могите позволить себе Вас меня, некоторые функционируют/дают совет, как собрать эту функцию (я предпочитаю алгоритм RC4)?


 
Германн ©   (2008-12-17 01:27) [19]


> Могите позволить себе Вас меня, некоторые функционируют/дают
> совет

Могим. :)


 
Сергей М. ©   (2008-12-17 08:24) [20]


> bit


http://www.experts-exchange.com/Security/Encryption/Q_22956476.html


 
bit   (2008-12-17 09:36) [21]

@Германн

---PROMT edition --- unrated!!! =)


 
bit   (2008-12-17 09:40) [22]

Сергей М.. If you need to ask once user for passwd and keep/use in every program run, what would be you  choice   to do it?


 
Сергей М. ©   (2008-12-17 09:56) [23]


> bit   (17.12.08 09:40) [22]


Лучше этого вообще не делать - сохранять пароль в каком бы то ни было виде, особенно во внешнем (по отношению к исполняемому программному файлу) контейнере.
Возможность несанкционированного использования функциональности программы при этом резко возрастает.


 
bit   (2008-12-17 12:45) [24]

Any delphi native component or function for calculating MD5 hash?
*(if you know)How to run exe , get pointer for process (), send data to process threat*

Abstract question. We live in modern world where people trying to  simplify everything, but I don"t find any OneClick/Simplified function in delphi for essential/daily function like Reg Expression, Encrypt, SortTListView and so one and so far. Is C++ also so irrational and hard to deploy?
By the way I finded "C++ simplifier" - AutoIt-(something like VB but more advanced) which use native C++ code and functions/parameters is mush more User Friendly. Why developers don"t think about it?
For example: RC4 function in autoit(which analog i didn"t find in Delphi!!!!):
_StringEncrypt($i_Encrypt, $s_EncryptText, $s_EncryptPassword[, $i_EncryptLevel = 1])



 
Сергей М. ©   (2008-12-17 12:53) [25]


> Any delphi native component or function for calculating
> MD5 hash?


Среди штатных таких нет.
Сторонние ищи сам.


 
Сергей М. ©   (2008-12-17 13:01) [26]


> How to run exe


см. CreateProcess


> get pointer for process


У процесса нет "указателя".
Процесс идентифицируется хендлом (локально) и уникальным числовым идентификатором (глобально), см. последний параметр ф-ции CreateProcess


> send data to process threat


threat - это что за грозный зверь ?)
Може быть thread ?
Тогда см. PostThreadMessage


> Why developers don"t think about it?


Разработчики чего ?


 
bit   (2008-12-17 15:50) [27]

>Може быть thread ?
Yes, exactly.

Can you illustrate common algorithm of (just simple way):
1. run file.exe
2. get handle (or whatever it is)
3. post data into process (does data must be inserted in specific place? how to figure out this address? coz i think process reserved array_of_ram/???)

>Developers of Delphi AND/OR C++. Why they try to deliver to coders troubles/"pain"?


 
Сергей М. ©   (2008-12-17 16:23) [28]


> i think process reserved array_of_ram


Нет, это в корне не верно.


> 3. post data into process (does data must be inserted in
> specific place? how to figure out this address?


Какова цель всего этого ?


> Why they try to deliver to coders troubles/"pain"?


Глупости.

С тему же претензиями можно обратиться, скажем, к разработчикам и производителям электродрелей - мол, почему в комплектах поставки этих инструментов нет насадок-венчиков для взбивания коктейля или, скажем, насадки-щетки для чистки зубов.


 
bit   (2008-12-17 17:03) [29]

>Какова цель всего этого ?

Read from the STDIN stream of the AutoIt script process.
ConsoleRead ( [peek = false[, binary = false ]])

Remarks
ConsoleRead reads from the console standard input stream of the AutoIt script process, which is normally used by console applications to read input from a parent process.
ConsoleRead does not block, it will return immediately. In order to get all data, it must be called in a loop.
Peeking on the stream does not remove the data from the buffer, however, it does return the available data as normal.
By default, data is returned in text format. By using the binary option, the data will be returned in binary format.


I want make delphi and 3d part Autoit script/program cooperate.

>В составе TIdMessage (Indy) есть, конечно, соответствующий парсер, но это уже на любителя помучиться перед смертью)

It isn"t close to UserFriendly relations.

For example WinXP vs Vista
Vista try to simplify users life : one click operations. friendly interface. etc.


 
Сергей М. ©   (2008-12-17 17:15) [30]


> I want make delphi and 3d part Autoit script/program cooperate


Не вижу прямой связи между Autoit и CreateProcess+PostThreadMessage ..


> It isn"t close to UserFriendly relations


Это почему же ?


 
bit   (2008-12-17 17:23) [31]

>Не вижу прямой связи между Autoit и CreateProcess+PostThreadMessage ..

ok but in what cases coders use this feature?

>Это почему же ?

RegExp library i should get from 3dr side.
Essential function is hard deplayable.

it feels like ankle Sam create low level procedures/functions (API) but don"t think to create something simple and useful for average person/coder.
Example: I love draw pictures by combining bytes (using 0 and 1) , coz I don"t have Photoshop (or nobody cares about creating it)!


 
Сергей М. ©   (2008-12-17 17:34) [32]


> in what cases coders use this feature?
>


CreateProcess - при необходимости программного старта нового процесса.

PostThreadMessage - при необходимости отправки асинхронного сообщения некоему потоку некоего процесса текущего десктопа


> RegExp library i should get from 3dr side


Что в этом плохого ?


> Essential function is hard deplayable


Абсолютно не согласен.


> it feels like ankle Sam create low level procedures/functions
> (API)


Дядя Сэм не обязан лепить оболочки для своего API на каждый чих каждого капризного "кодера")


 
bit   (2008-12-17 17:42) [33]

how about photoshop? if nobody create it/or similar program then nobody wants to draw pictures or vector compositions by combining (low level code) or using complicated methods.

The same thing with programming complexes. I appreciate that delphi have such features as components(easy access to methods and functions), form designer but I can"t understand if reg expression such a exotic function which coders use in holidays or to show how cool they are?


 
Сергей М. ©   (2008-12-17 20:54) [34]


> bit   (17.12.08 17:42) [33]


Потрепаться о фотошопах и прочих превратностях несчастной программистской судьбы ты можешь а "Прочее".

А здесь изволь вести обсуждение конкретного своего вопроса про CreateProcess и иже с ним



Страницы: 1 вся ветка

Текущий архив: 2009.02.01;
Скачать: CL | DM;

Наверх




Память: 0.53 MB
Время: 0.005 c
2-1229694301
Дмитрий
2008-12-19 16:45
2009.02.01
Передать события в качестве параметров


2-1229423980
Андрей Ал.
2008-12-16 13:39
2009.02.01
Снова таблицы!


2-1229791230
Programmer
2008-12-20 19:40
2009.02.01
Обновление программы, написанной на Делфи самой программой


2-1229785639
neveGreen
2008-12-20 18:07
2009.02.01
совместимость версий Делфи


2-1229667055
девушка
2008-12-19 09:10
2009.02.01
Как правильно динамически создавать дочерние формы





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский