Search Results

Search found 59 results on 3 pages for 'alvaro justen'.

Page 3/3 | < Previous Page | 1 2 3 

  • Validate decimal number in (known) national format

    - by Álvaro G. Vicario
    PHP has many built-in functions to validate numbers but they all expect input in computer format: 1234.56. I need to validate stuff like 1,234.56 (English) or 1.234,56 (Spanish), together with some typical attributes (accepted range, max number of decimals, etc.). I started writing my own function but I soon got lost. It's easy to read the user input into a float variable but I want to be able to detect numbers with invalid formats like 1,23456.7 or 1..25. Do you have any recommendation on the subject? (Decimal and thousand characters are known beforehand and it's okay to hard-code digit groups as three, there's no need to cover Indian number format.)

    Read the article

  • Unobstrusive pseudo-classes and attribute selectors emulation in IE

    - by Álvaro G. Vicario
    I'm trying to emulate some pseudo-classes and attribute selectors in Internet Explorer 6 and 7, such as :focus, :hover or [type=text]. So far, I've managed to add a class name to the affected elements: $("input, textarea, select") .hover(function(){ $(this).addClass("hover"); }, function(){ $(this).removeClass("hover"); }) .focus(function(){ $(this).addClass("focus"); }) .blur(function(){ $(this).removeClass("focus"); }); $("input[type=text]").each(function(){ $(this).addClass("text"); }); However, I'm still forced to duplicate selector in my style sheets: textarea:focus, textarea.focus{ } And, to make things worse, IE6 seems to ignore all the selectors when it finds an attribute: input[type=text], input.text{ /* IE6 ignores this */ } And, of course, IE6 ignores selectors with multiple classes: input.text.focus{ /* IE6 ignores this */ } So I'm likely to end up with this mess: input[type=text]{ /* Rules here */ } input.text{ /* Same rules again */ } input[type=text]:focus{ } input.text_and_focus{ } input.text_and_hover{ } input.text_and_focus_and_hover{ } My question: is there any way to read the rules or computed style defined for a CSS selector and apply it to certain elements, so I only need to maintain one set of standard CSS?

    Read the article

  • does this raw sql only one trip to the database or many trips?

    - by Álvaro García
    I gues that I have this sql: string strTSQL = "Begin TRAN delete from MyTable where ID = 1"; string strTSQL = ";delete from MyTable where ID = 2"; string strTSQL = ";delete from MyTable where ID = 3 COMMIT"; using(Entities dbContext = new Entities()) { dbCntext.MyTable.SQLQuery(strTSQL); } This use a transaction in the dataBase, so all the commands are executed or no one. But how I execute it through EF, it does only one trip to the database or many? Thanks.

    Read the article

  • JQuery: can I submit values from inputs that aren't in a form?

    - by Alvaro
    Simple as that: I have some inputs that are rendered inside another form element, but I want to submit then individually. I tried "serializing" the div that contains them, but it didn't work. Is there an easy way to do this? My code: var form = $("#my_div"); var get_data = $(form).serialize(); /* Get #my_div inputs value */ $.get(self.url_form_rendering, get_data, function (data){ /* handle server response */ }) Serialize returns "", any ideas that don't involve redesigning the layout to avoid form nesting?

    Read the article

  • Greatest not null column

    - by Álvaro G. Vicario
    I need to update a row with a formula based on the largest value of two DATETIME columns. I would normally do this: GREATEST(date_one, date_two) However, both columns are allowed to be NULL. I need the greatest date even when the other is NULL (of course, I expect NULL when both are NULL) and GREATEST() returns NULL when one of the columns is NULL. This seems to work: GREATEST(COALESCE(date_one, date_two), COALESCE(date_two, date_one)) But I wonder... am I missing a more straightforward method?

    Read the article

  • why the exception is not caught?

    - by Álvaro García
    I have the following code: List<MyEntity> lstAllMyRecords = miDbContext.MyEntity.ToList<MyEntity>(); foreach MyEntity iterator in lstMainRecord) { tasks.Add( TaskEx.Run(() => { try { checkData(lstAllMyRecords.Where(n => n.IDReference == iterator.IDReference).ToList<MyEntity>()); } catch CustomRepository ex) { //handle my custom repository } catch (Exception) { throw; } }) ); }//foreach Task.WaitAll(tasks.ToArray()); I get all the records from my data base and in the foreach loop, I group all the records that have the same IDReference. Thenk I check if the data is correct with the method chekData. The checkData method throw a custom exception if something is wrong. I would like to catch this exception to handle it. But the problem is that with this code the exceptions are not caught and all seem to work without errors, but I know that this is not true. I try to check only one group of records that I know that has problems. If I check only one group of registrers, the loop is execute once and then only task is created. In this case the exception is caught, but if I have many groups, then any exception s thrwon. Why when I only have one task the exception is caught and with many groups are not? Thanks.

    Read the article

  • Find node level in a tree

    - by Álvaro G. Vicario
    I have a tree (nested categories) stored as follows: CREATE TABLE `category` ( `category_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `category_name` varchar(100) NOT NULL, `parent_id` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`category_id`), UNIQUE KEY `category_name_UNIQUE` (`category_name`,`parent_id`), KEY `fk_category_category1` (`parent_id`,`category_id`), CONSTRAINT `fk_category_category1` FOREIGN KEY (`parent_id`) REFERENCES `category` (`category_id`) ON DELETE SET NULL ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci I need to feed my client-side language (PHP) with node information (child+parent) so it can build the tree in memory. I can tweak my PHP code but I think the operation would be way simpler if I could just retrieve the rows in such an order that all parents come before their children. I could do that if I knew the level for each node: SELECT category_id, category_name, parent_id FROM category ORDER BY level -- No `level` column so far :( Can you think of a way (view, stored routine or whatever...) to calculate the node level? I guess it's okay if it's not real-time and I need to recalculate it on node modification.

    Read the article

  • Roadshow Microsoft – Primeira Parada: Londrina, PR

    - by anobre
    Hoje (23/03) tivemos aqui em Londrina a primeira parada do Roadshow Microsoft, com apresentação de diversos produtos com aplicação em cenários técnicos. Como já é de costume, o evento reuniu alguns dos melhores profissionais de DEV e INFRA, com informações extremamente úteis sobre .NET Framework 4, Entity Framework, Exchange, Sharepoint, entre outras tecnologias e produtos. Na minha visão, o evento conseguiu atender a expectativa dos participantes, através dos cenários técnicos criados para a ficticia Adventure Works (acho que eu conheço esta empresa… :). Através da participação ativa de todos, as tracks de DEV e INFRA tiveram o sucesso aparente no comentário do pessoal nos intervalos e almoço. Depois das palestras, lá por 19h, tivemos um jantar com o pessoal da Microsoft e influenciadores da região, onde, até as 21h, discutimos muita coisa (até Commerce Server!). Esta aproximação com o time de comunidades da Microsoft, além de alguns “penetras” como o próprio Alex disse, é extremamente importante e útil, visto que passamos conhecemos a fundo as intenções e futuras ações da Microsoft visando as comunidades locais. Para concluir, algo que sempre digo: participe de alguma comunidade técnica da sua região. Entre em contato com influenciadores, conheça os grupos de usuários perto de você e não perca tempo. Ter o conhecimento perto de você, contribuir e crescer profissionalmente não tem preço. Obrigado novamente a todo time, em especial a Fabio Hara, Rodrigo Dias, Alex Schulz, Alvaro Rezende, Murilo e Renato Haddad. Abraços. OBS.: Lembre-se: em Londrina e região, procure o Sharpcode! :) OBS. 2: Se você é de Londrina e não participou, não perca mais oportunidades. Alias, se o seu chefe não deixa você ir, se você tem que participar de sorteio para ter uma chance de ir, ou se a sua empresa nem fica sabendo de eventos como este, acho que tá na hora de você pensar em outros opções né? :)

    Read the article

  • Infinite loop when using fscanf

    - by user1409641
    I wrote this simple program in C, because I'm studying FILES right now at University. I take a txt file with a list of the results of the last race so my program will show the data formatted as I want. Here's my code: /* Esercizio file Motogp */ #include <stdio.h> #define SIZE 20 int main () { int pos, punt, num; float kmh; char nome[SIZE+1], cognome[SIZE+1], moto[SIZE+1]; char naz[SIZE+1], nome_file[SIZE+1]; FILE *fp; printf ("Inserisci il nome del file da aprire: "); gets (nome_file); fp = fopen (nome_file, "r"); if (fopen == NULL) printf ("Errore nell' apertura del file %s\n", nome_file); else { while (fscanf (fp, "%d %d %d %s %s %s %s %.2f", &pos, &punt, &num, nome, cognome, naz, moto, &kmh) != EOF ) { printf ("Posizione di arrivo: %d\n", pos); printf ("Punteggio: %d\n", punt); printf ("Numero pilota: %d\n", num); printf ("Nome pilota: %s\n", nome); printf ("Cognome pilota: %s\n", cognome); printf ("Nazione: %s\n", naz); printf ("Moto: %s\n", moto); printf ("Media Kmh: %d\n\n", kmh); } } fclose(fp); return 0; } and there's my txt file: 1 25 99 Jorge LORENZO SPA Yamaha 164.4 2 20 26 Dani PEDROSA SPA Honda 164.1 3 16 4 Andrea DOVIZIOSO ITA Yamaha 163.8 4 13 1 Casey STONER AUS Honda 163.8 5 11 35 Cal CRUTCHLOW GBR Yamaha 163.6 6 10 19 Alvaro BAUTISTA SPA Honda 163.5 7 9 46 Valentino ROSSI ITA Ducati 163.3 8 8 6 Stefan BRADL GER Honda 162.9 9 7 69 Nicky HAYDEN USA Ducati 162.5 10 6 11 Ben SPIES USA Yamaha 162.3 11 5 8 Hector BARBERA SPA Ducati 162.1 12 4 17 Karel ABRAHAM CZE Ducati 160.9 13 3 41 Aleix ESPARGARO SPA ART 160.2 14 2 51 Michele PIRRO ITA FTR 160.1 15 1 14 Randy DE PUNIET FRA ART 160.0 16 0 77 James ELLISON GBR ART 159.9 17 0 54 Mattia PASINI ITA ART 159.4 18 0 68 Yonny HERNANDEZ COL BQR 159.4 19 0 9 Danilo PETRUCCI ITA Ioda 158.2 20 0 22 Ivan SILVA SPA BQR 158.2 When I run my program, it return me an infinite loop of the first one. Why? Is there another function to read those data?

    Read the article

< Previous Page | 1 2 3