1. MSVC

    Date: 05/26/05     Keywords: no keywords

            // Few lines of code goes before
            return S_OK;
        }
    
        // Format conversation is not yet supported.
        // Sorry.
        // Will be implemented later for sure.
        // I swear.
        return E_NOTIMPL;
    }

    Source: http://www.livejournal.com/community/code_wtf/7421.html

  2. PHP

    Date: 05/25/05     Keywords: no keywords

    $Fecha = $Fecha;
    $Header = $Header;
    $Body = $Body;

    $Fecha = stripslashes($Fecha);
    $Header = stripslashes($Header);
    $Body = stripslashes($Body);

    Source: http://www.livejournal.com/community/code_wtf/6903.html

  3. php

    Date: 05/25/05     Keywords: no keywords


    echo $err;
    die();

    Source: http://www.livejournal.com/community/code_wtf/6509.html

  4. C++

    Date: 05/23/05     Keywords: no keywords

    #define HANDLE_CATCH_GPF if ( 0 != 0 )

    Source: http://www.livejournal.com/community/code_wtf/6246.html

  5. Из MSDN'а

    Date: 05/20/05     Keywords: no keywords

    char *strrchr( const char
    *string, int c );



    functions returns a pointer to the last occurrence of c in
    string, or NULL if c is not found.

    Кто-нибудь мне объяснит зачем char надо передавать как int?

    Source: http://www.livejournal.com/community/code_wtf/5970.html

  6. traslation_wtf

    Date: 05/16/05     Keywords: no keywords

    In that community are published part of programs which have made your laugh or have caused perplexities, what is it and for what it.

    WTF!?


    Мой вариант:
    Funny or perplexity causing parts of programs are published in this community.

    Source: http://www.livejournal.com/community/code_wtf/5681.html

  7. C obfuscated programming contest

    Date: 05/15/05     Keywords: no keywords

    IOCCC

    I think it is very relevant, no?

    Source: http://www.livejournal.com/community/code_wtf/5402.html

  8. вот вам еще монстр

    Date: 05/14/05     Keywords: no keywords



    select p.person_id_i, coalesce((select s.new_anketa_state from stack s
    where s.person_id_i=p.person_id_i),-1) as "in_stack", CASE WHEN
    to_char(p.per_regdate,'YYYY')=to_char(date 'now','YYYY') THEN
    to_char(p.per_regdate,'DD Mon') ELSE to_char(p.per_regdate,'DD Mon
    YYYY')END as per_regdate, p.per_anketa_state, p.per_screenname,
    p.per_email_m, p.per_sex, p.per_seeking, cit.city_name_ru,
    reg.region_name_ru, co.co_name_ru, p.per_zip_i, r.rel_name_ru,
    lan.lan_name_ru, tm.tm_name_ru, to_char(datetime(p.per_birthdate), 'dd
    month yyyy') as "per_birthdate", occu.occu_name_ru, ind.ind_name_ru,
    inc.income_name_ru, relig.relig_name_ru, hei.height_name_ru,
    wei.weight_name_ru, hc.hc_name_ru, ec.ec_name_ru, bt.bt_name_ru,
    act.act_name_ru, sm.smoke_name_ru, dr.drink_name_ru,
    ms.m_stat_name_ru, ha.have_ch_name_ru, cu.cus_name_ru, case when
    mp.want_ch_id_i=1 then 'Yes' when mp.want_ch_id_i=0 then 'No' else
    'not filled yet' end as "want_ch_name", case when p.per_relocate=1
    then 'Yes' when p.per_relocate=0 then 'No' else 'not filled yet' end
    as "per_relocate_name", et.etn_name_ru, ed.edu_name_ru,
    po.pol_sen_name_ru, ap.ap_s_name_ru, ins.is_name_ru,
    bm.bit_per_traits, bm.bit_per_act, bm.bit_fav_cuisines,
    bm.bit_like_music, bm.bit_like_read, bm.bit_languages, bm.bit_go_to,
    bm.bit_phys_act, bm.cat , bm.dog , bm.fish , bm.bird , bm.rodent ,
    bm.exotic , itm.txt1, case when itm.txt1_state=1 then 'approoved' when
    itm.txt1_state = 3 then 'banned' when itm.txt1_state = 0 then
    'waiting' when itm.txt1 is null then 'not filled yet' else 'unchecked'
    end as "txt1_stat", itm.txt2, case when itm.txt2_state=1 then
    'approoved' when itm.txt2_state = 3 then 'banned' when itm.txt2_state
    = 0 then 'waiting' when itm.txt2 is null then 'not filled yet' else
    'unchecked' end as "txt2_stat", itm.txt3, case when itm.txt3_state=1
    then 'approoved' when itm.txt3_state = 3 then 'banned' when
    itm.txt3_state = 0 then 'waiting' when itm.txt3 is null then 'not
    filled yet' else 'unchecked' end as "txt3_stat", itm.txt4, case when
    itm.txt4_state=1 then 'approoved' when itm.txt4_state = 3 then
    'banned' when itm.txt4_state = 0 then 'waiting' when itm.txt4 is null
    then 'not filled yet' else 'unchecked' end as "txt4_stat", itm.txt5,
    case when itm.txt5_state=1 then 'approoved' when itm.txt5_state = 3
    then 'banned' when itm.txt5_state = 0 then 'waiting' when itm.txt5 is
    null then 'not filled yet' else 'unchecked' end as "txt5_stat",
    itm.foto1, itm.foto1_state, itm.foto1_width, itm.foto1_height,
    itm.foto2, itm.foto2_state, itm.foto2_width, itm.foto2_height,
    itm.foto3, itm.foto3_state, itm.foto3_width, itm.foto3_height,
    itm.foto4, itm.foto4_state, itm.foto4_width, itm.foto4_height,
    itm.sound, itm.sound_file from person p LEFT JOIN country co ON
    (co.co_id_i=p.co_id_i) LEFT JOIN region reg ON
    (reg.region_id_i=p.region_id_i) LEFT JOIN city cit ON
    (cit.city_id_i=p.city_id_i) LEFT JOIN time_zones tm ON
    (tm.tm_id_i=p.tm_id_i) LEFT JOIN bit_mask bm ON
    (bm.person_id_i=p.person_id_i) LEFT JOIN spoken_languages lan ON
    (lan.lan_id_i=p.lan_id_i) LEFT JOIN m_stat ms ON
    (ms.m_stat_id_i=p.m_stat_id_i) LEFT JOIN relationship r ON
    (r.rel_id_i=p.rel_id_i), my_profile mp LEFT JOIN education ed ON
    (ed.edu_id_i=mp.edu_id_i) LEFT JOIN etnicity et ON
    (et.etn_id_i=mp.etn_id_i) LEFT JOIN custody cu ON
    (cu.cus_id_i=mp.cus_id_i) LEFT JOIN have_children ha ON
    (ha.have_ch_id_i=mp.have_ch_id_i) LEFT JOIN drink dr ON
    (dr.drink_id_i=mp.drink_id_i) LEFT JOIN smoke sm ON
    (sm.smoke_id_i=mp.smoke_id_i) LEFT JOIN occupation occu ON
    (occu.occu_id_i=mp.occu_id_i) LEFT JOIN industry ind ON
    (ind.ind_id_i=mp.ind_id_i) LEFT JOIN income inc ON
    (inc.income_id_i=mp.income_id_i) LEFT JOIN height hei ON
    (hei.height_id_i=mp.height_id_i) LEFT JOIN weight wei ON
    (wei.weight_id_i=mp.weight_id_i) LEFT JOIN hair_color hc ON
    (hc.hc_id_i=mp.hc_id_i) LEFT JOIN eye_color ec ON
    (ec.ec_id_i=mp.ec_id_i) LEFT JOIN body_type bt ON
    (bt.bt_id_i=mp.bt_id_i) LEFT JOIN activity act ON
    (act.act_id_i=mp.act_id_i) LEFT JOIN religion relig ON
    (relig.relig_id_i=mp.relig_id_i), my_personality me LEFT JOIN
    politic_sense po ON (po.pol_sen_id_i=me.pol_sen_id_i) LEFT JOIN
    apearance_sense ap ON (ap.ap_s_id_i=me.ap_s_id_i) LEFT JOIN
    intelegence_sense ins ON (ins.is_id_i=me.is_id_i), items itm where
    itm.person_id_i = '1073742786' and mp.person_id_i='1073742786' and
    p.person_id_i='1073742786' and me.person_id_i='1073742786'

    Source: http://www.livejournal.com/community/code_wtf/5371.html

  9. [php] функция редиректа

    Date: 05/14/05     Keywords: no keywords

    Вот вам монстр: моя функция редиректа. Объяснять код не буду.

    class HTTP {
       /*
        * в режиме отладки функция не делает редирект, а просто выводит ссылку
        */

       function redirect($url, $debug_constant_name = 'DEBUG_MODE') {
          $input_url = $url;
          // если путь не абсолютный
          if (!preg_match("~^(https?|ftp|mailto|ed2k)://~", $url)) {
             $server = $_SERVER['HTTP_HOST'];
             if (!isset($_SERVER['SERVER_PORT']) ||
                  in_array($_SERVER['SERVER_PORT'], array(80, 433))) {
                $port = '';
             } else {
                $port = ':'.$_SERVER['SERVER_PORT'];
             }
             $protocol = 'http';
             if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')
                $protocol .= 's';

             // генерируем путь
             if ($url{0} != '/') {
                $path = dirname($_SERVER['PHP_SELF']);
                if (strlen($path) <= 1) $path = '/';
                else $path .= '/';
                $url = $path.$url;
             }
             $url = $protocol.'://'.$server.$port.$url;
             // чистим путь - убираем всякие './' ,  '../',  '//'
             $url_parts = parse_url($url);
             $paths = array_reverse(explode("/", $url_parts['path']));
             $delete_next = 0;
             foreach ($paths as $k=>$v) {
                if (empty($v) || $v == '.') unset($paths[$k]);
                elseif ($v == '..') {
                   $delete_next++;
                   unset($paths[$k]);
                   continue;
                } elseif ($delete_next) {
                   unset($paths[$k]);
                   $delete_next--;
                }
             }
             $path = '/'.implode('/', array_reverse($paths));
             $url = $url_parts['scheme'].'://'.$url_parts['host'];
             if (isset($url_parts['port'])) $url .= ':'.$url_parts['port'];
             $url .= $path;
             if (isset($url_parts['query'])) $url .= '?'.$url_parts['query'];
          }
          // если была включена буферизация - очищаем буфер
          if (!defined($debug_constant_name)) {
             for ($i = 0, $level = ob_get_level(); $i < $level; $i++) ob_end_clean();
          }

          $headers = array();
          $mode = php_sapi_name();
          // !!! здесь могут быть ошибки в "нестандартных" установках ПХП
          if (strpos($mode, 'cgi')) {
             $headers[] = 'Status: 307 Temporary redirect';
          } else {
             $headers[] = 'HTTP/1.1 307 Temporary redirect';
          }
          $headers[] = "Location: ".$url;
          if (!defined($debug_constant_name)) {
             foreach($headers as $header)
                header($header);
          } else {
             // debug mode
             echo "Input URL: ".htmlspecialchars($input_url).'
    '
    ;
             echo "
    "; print_r($headers); echo "
    "
    ;
             echo '.$url.'">'.htmlspecialchars($url).'
    '
    ;
          }
       }
    }
    ?>

    Source: http://www.livejournal.com/community/code_wtf/5041.html

  10. [php]

    Date: 05/14/05     Keywords: html

    Нашел в одном из фреймворков на ПХП :
    $hui = new Hui( $gEnv['root']['db'], TRUE );
    HUI - это у автора Html User Interface :-)

    Source: http://www.livejournal.com/community/code_wtf/4295.html

  11. Из файлов примеров модуля PHP mnogosearch // From the example files in mnogosearch PHP module

    Date: 05/14/05     Keywords: php

    $str=ereg_replace('\$DT', $title, $str);
    $str=ereg_replace('\$DR', "$rating", $str);
    $str=ereg_replace('\$DX', $text, $str);
    $str=ereg_replace('\$DE', ($desc != '')?$desc:$text, $str);
    $str=ereg_replace('\$DC', $contype, $str);
    $str=ereg_replace('\$DM', $lastmod, $str);
    $str=ereg_replace('\$DS', "$docsize", $str);
    $str=ereg_replace('\$DN', "$ndoc", $str);

    Для незнающих PHP поясню: ereg_replace - функция для работы с POSIX regexp, поэтому $ в строке заэкранирован. Т.е., фактически, в данном случае нужна другая функция - str_replace, которая заменяет одну строку на другу. Впрочем, PHP позволяет задать массив замен и вопрользоваться функцией strtr

    Source: http://www.livejournal.com/community/code_wtf/3889.html

  12. PHP

    Date: 05/14/05     Keywords: no keywords

    чувак не нашёл функцию в документации функцию substr:
    а сейчас на английском (не бейте за язык).

    guy've not found substr function in manual:

    function copystr($str, $pos, $len)
    {
      $tmp = "";
      for ($i = $pos; $i < $pos+$len; $i++)
         $tmp .= $str[$i];
      return $tmp;
    }
    

    Source: http://www.livejournal.com/community/code_wtf/3826.html

  13. О языках... // About the languages...

    Date: 05/14/05     Keywords: no keywords

    Русский / Russian
    Гхм.... Очень прошу прощения за оффтопик....

    Но в этом сообществе участвуют не только русскоязычные пользователи (скажем - •lj://johnreen/26112). И в коммьюнити инфо прописано на нескольких языках... С одной стороны это хорошо - больше народу - веселее жить, но рождается проблема с языками. Мнения участников и, особенно, разумеется, создателей сообщества? Может быть, скажем, имеет смысл указывать рекомендуемый язык обсуждения для записей в заголовке?..

    English / Английский
    Ahem... I'm very sorry for offtopic (and my worse English =[)...

    But there are not only Russian-speaking users participating in this community (for example - •lj://johnreen/26112). And community info is written in two languages... On the one hand this is good - the more people are there - the more fun it is, but on the other hand there's a language barrier problem. Members' and, especially, the community creators' opinion on this? For example, maybe it's reasonable to specify recommended comments language in the title?..

    Source: http://www.livejournal.com/community/code_wtf/3527.html

  14. mysql_sex

    Date: 05/14/05     Keywords: mysql, sql

    [ru] писал выборку из БД по полу .. на автомате написал....
    mysql_sex(); // и тут призадумался над аргументами....
    [uk] писав виборку з БД по статті... на автоматі написав....
    mysql_sex(); // і тут призадумався над аргументами....
    [en] have wrote a select query, selecting a sex of user... but i have write not mysql_query, i have type mysql_sex(); // how do you think what arguments should be?

    Source: http://www.livejournal.com/community/code_wtf/2990.html

  15. C++ :)

    Date: 05/14/05     Keywords: no keywords

    WCHAR* wcharstr=new WCHAR(64);
    char* charstr=new char(64);
    wcharstr=(WCHAR*)fieldValue;
    Wide2Ansi(charstr,wcharstr,64);

    Source: http://www.livejournal.com/community/code_wtf/2738.html

  16. Еще из кода, который я разбирал на работе:

    Date: 05/14/05     Keywords: no keywords

    float f;
    float* ptr;

    if (memcmp(&f,ptr,sizeof(float))
    {
    ...
    }

    Source: http://www.livejournal.com/community/code_wtf/2282.html

  17. С++

    Date: 05/14/05     Keywords: no keywords

    if(num == 40702)
    {
      num = num;
    }
    

    Как мне объяснил автор кода - для отладки :)

    А так же из творчества студентов (заставило вспомнить анекдот про два стакана)

    {PASCAL}
    {фрагмент поиска максимального элемента}
    if max < d[i] then
      max := d[i]
    else
      max := max;
    

    Source: http://www.livejournal.com/community/code_wtf/1928.html

  18. Perl

    Date: 05/14/05     Keywords: no keywords

    Seen at work:

    DoCleanup($FALSE, $FALSE, $TRUE, $FALSE);


    P.S. To whomever had the idea for this community: <3

    Source: http://www.livejournal.com/community/code_wtf/1476.html

  19. PHP::else?:)

    Date: 05/14/05     Keywords: no keywords


    
    

    Source: http://www.livejournal.com/community/code_wtf/1248.html

  20. PHP

    Date: 05/14/05     Keywords: no keywords

    @die("error");

    Source: http://www.livejournal.com/community/code_wtf/624.html

Previous page  ||  Next page


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home