>DansTonCode();

Tous les codes sources "Mais pourquoi ?"page 30

Python
 12 Juillet, 2014 à 02:30
#211
            try:
                createImage(path_info)
            except:
                try:
                    # sleep 0..1 segond
                    time.sleep(random())
                    createImage(path_info)
                except:
                    # sleep 0..1 segond
                    time.sleep(random())
                    createImage(path_info)
JavaScript
 12 Juillet, 2014 à 02:23
#148
$('a').click(function () {

            var id = '';
            var id2 = '';
            id = $(this).attr('id');
            id2 = $(this).attr('id');

            if (id == "search11") {
                //...
            }
            if (id2 == "search1") {

                //...
            }
            });
SQL
 11 Juillet, 2014 à 09:41
#167
CREATE FUNCTION [dbo].[get_number_of_workers] 
(
	 @number_of_workers varchar(10)

)
RETURNS int
AS
BEGIN


set @number_of_workers = replace(replace(replace(replace(LTRIM(RTRIM(@number_of_workers)), char(9), ''), char(10), ''), char(13),''), char(13)+char(10), '')

DECLARE @temp varchar(10)

SELECT
	@temp = number_of_workers 
FROM
	(SELECT LTRIM(RTRIM(@number_of_workers)) as number_of_workers) as temp
WHERE
	   number_of_workers like  '[0-9]'
	or number_of_workers like  '[0-9][0-9]'
	or number_of_workers like  '[0-9][0-9][0-9]'
	or number_of_workers like  '[0-9][0-9][0-9][0-9]'
	or number_of_workers like  '[0-9][0-9][0-9][0-9][0-9]'
	or number_of_workers like  '[0-9][0-9][0-9][0-9][0-9][0-9]'
	or number_of_workers like  '[0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
	or number_of_workers like  '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
	or number_of_workers like  '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
	or number_of_workers like  '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
	or number_of_workers like  '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
	
	
RETURN CONVERT(INT, @temp)

END