1. Count

    Date: 02/25/09     Keywords: no keywords

    *---: / COUNT
    0291: COUNT1 = 0
    0292: COUNT2 = 0
    0293: COUNT3 = 0
    0294: COUNT4 = 0
    0295: COUNT5 = 0
    0296: COUNT6 = 0
    0297: COUNT7 = 0

    0298: COUNT8 = 0
    0299: COUNT9 = 0
    0300: COUNT10 = 0
    0301: COUNT11 = 0
    0302: COUNT12 = 0
    0303: COUNT13 = 0
    0304: COUNT14 = 0
    0305: COUNT15 = 0
    0306: COUNT17 = 0
    0307: COUNT18 = 0
    0308: COUNT19 = 0
    0309: COUNT20 = 0
    0310: COUNT21 = 0
    0311: COUNT22 = 0
    0312: COUNT23 = 0
    0313: COUNT24 = 0
    0314: COUNT25 = 0
    0315: COUNT26 = 0
    0316: COUNT27 = 0
    0317: COUNT28 = 0
    0318: COUNT29 = 0
    0319: COUNT30 = 0
    0320: COUNT31 = 0
    0321: COUNT32 = 0
    0322: COUNT33 = 0
    0323: COUNT34 = 0
    0324: COUNT35 = 0
    0325: COUNT36 = 0
    0326: COUNT37 = 0
    0327: COUNT38 = 0
    0328: COUNT39 = 0
    0329: COUNT40 = 0
    0330: COUNT41 = 0
    0331: COUNT43 = 0
    0332: COUNT44 = 0
    0333: COUNT45 = 0
    0334: COUNT46 = 0
    0335: COUNT48 = 0
    0336: COUNT49 = 0
    0337: COUNT99 = 0
    0338: COUNT100 = 0
    0339: COUNT101 = 0
    0340: COUNT102 = 0
    0341: COUNT103 = 0
    1352: COUNT33 += NO.ITEMS
    1377: COUNT9 += 1
    1380: COUNT29 += 1
    1412: COUNT99 += NO.ITEMS
    1452: COUNT33 += NO.ITEMS
    1554: COUNT25 += 1
    1562: COUNT101 += 1
    1567: COUNT100 += 1
    1637: COUNT40 += 1
    1666: COUNT36 += 1
    1743: COUNT30 += 1
    2092: COUNT17 += NO.ITEMS
    2103: COUNT18 += NO.ITEMS
    2114: COUNT19 += NO.ITEMS
    2125: COUNT20 += NO.ITEMS
    2136: COUNT21 += NO.ITEMS
    2147: COUNT22 += NO.ITEMS
    2159: COUNT23 += NO.ITEMS
    2172: COUNT24 += NO.ITEMS
    2192: COUNT25 += NO.ITEMS
    2204: COUNT27 += NO.ITEMS
    2220: COUNT27 += NO.ITEMS
    2237: COUNT28 += NO.ITEMS
    2252: COUNT28 += NO.ITEMS
    2269: COUNT26 += NO.ITEMS
    2281: COUNT37 += NO.ITEMS
    2304: COUNT36 += NO.ITEMS
    2317: COUNT43 += NO.ITEMS
    2328: COUNT44 += NO.ITEMS
    2486: COUNT102 += 1
    2511: COUNT35 += 1
    2521: COUNT1 += 1
    2537: COUNT34 += 1
    2556: COUNT2 += NO.ITEMS
    2573: COUNT3 += NO.ITEMS
    2602: COUNT4 += NO.ITEMS
    2615: COUNT5 += 1
    2622: COUNT6 += NO.ITEMS
    2634: COUNT7 += 1
    2662: COUNT8 += 1
    2667: COUNT29 += 1
    2673: COUNT30 += 1
    2684: COUNT31 += 1
    2694: COUNT9 += 1
    2717: COUNT49 += 1
    2739: COUNT103 += 1
    2764: COUNT46 += 1
    2777: COUNT41 += 1
    2791: COUNT45 += 1
    2801: COUNT9 += 1
    2826: COUNT39 += 1
    2842: COUNT10 += 1
    2888: COUNT101 += 1
    2897: COUNT32 += 1
    2904: COUNT32 += 1
    2915: COUNT12 += 1
    2955: COUNT11 += 1
    2985: COUNT13 += 1
    2991: COUNT14 += 1
    2997: COUNT15 += 1
    3003: COUNT15 += 1
    3008: COUNT15 += 1
    3013: COUNT15 += 1
    3018: COUNT14 += 1
    3159: COUNT14 += NO.ITEMS
    3168: COUNT15 += NO.ITEMS
    3178: COUNT15 += NO.ITEMS
    3188: COUNT15 += NO.ITEMS
    3196: COUNT15 += NO.ITEMS
    3202: COUNT15 += NO.ITEMS
    3208: COUNT15 += NO.ITEMS
    3214: COUNT14 += NO.ITEMS
    4991: COUNT.TOTAL = COUNT1 + COUNT2 + COUNT3 + COUNT4 + COUNT5 + COUNT6 +
    COU
    NT7 + COUNT8 + COUNT9 + COUNT10+ COUNT11 + COUNT12 + COUNT13 + COUNT14 +
    COUNT15
    + COUNT17 + COUNT18 + COUNT19 + COUNT20 + COUNT21 + COUNT22 + COUNT23 +
    COUNT24
    + COUNT25 + COUNT26 + COUNT27 + COUNT28 + COUNT29 + COUNT30 + COUNT31 +
    COUNT32
    + COUNT33 + COUNT34 + COUNT35 + COUNT36 + COUNT37 + COUNT38 + COUNT39 +
    COUNT40
    + COUNT41 + COUNT43 + COUNT44 + COUNT45 + COUNT46 + COUNT48 + COUNT49 +
    COUNT99
    + COUNT100 + COUNT101 + COUNT102 + COUNT103

    Source: http://community.livejournal.com/code_wtf/159614.html

  2. Machine learning

    Date: 02/24/09     Keywords: google

    using namespace std;
    typedef double Float;
    typedef vector > L;  // T[1:n]^N
    typedef vector  X;		 // w_i
    typedef vector S;             // w[1:n]
    typedef vector Z;             // W[1:n]^N
    typedef pair rf; // real-valued feature
    typedef vector Xr;
    typedef vector Sr;
    typedef vector Zr; 
    
    #define Train 0
    #define Decode 1


    Это писал чувак из Research который сейчас работает в Google :)

    Source: http://community.livejournal.com/code_wtf/159270.html

  3. Сортировка списков

    Date: 02/19/09     Keywords: java

    Это у нас теперь так java.util.List сортируется.

        @SuppressWarnings(value = { "unchecked" })
        public List sortTimes(List studioTimes) {
            Object[] arr = studioTimes.toArray();
            Comparator comp = new StudioTimeComparator();
            Arrays.sort(arr, comp);
            List sortedTimes = new ArrayList();
            for (Object time : arr) {
                sortedTimes.add((StudioTime) time);
            }
            return sortedTimes;
        }
    

    Source: http://community.livejournal.com/code_wtf/158806.html

  4. Суровые украинские программисты реально суровы

    Date: 02/14/09     Keywords: html

    [13:40:24] <1> var inDIV = rangeHtml.search(/
    =0 || rangeHtml.search(/]/ig)>=0 || rangeHtml.search(/]/ig)>=0 || rangeHtml.search(/]/ig)>=0 || rangeHtml.search(/]/ig)>=0 || rangeHtml.search(/]/ig)>=0 || rangeHtml.search(/]/ig)>=0; в эту [censored] добавить font [13:40:29] <2> тогда работает норм [13:40:38] <1> но есть нюанс [13:40:52] <2> [censored] [13:40:54] <2> [censored] [13:40:56] <2> [CENSORED] [13:41:00] <1> ? [13:41:06] <2> кто ЭТО писал? [13:41:13] <1> *ROFL* [13:41:26] <1> изначально не знаю [13:42:46] <2> var inDIV = rangeHtml.search(/(]|]|]|]|]|])/ig)>=0; [13:42:59] <2> или даже [13:43:44] <2> var inDIV = rangeHtml.search(/<(div|p|h\d|ul|li|dl|dt)[\s>]/ig)>=0; [13:43:46] <2> [censored] [13:44:01] <1> так мне больше нравиццо))

    Source: http://community.livejournal.com/code_wtf/158663.html

  5. oracle pl/sql

    Date: 02/13/09     Keywords: no keywords

    for i in (select count(*) from ...)
    loop
    ...
    end loop;

    Source: http://community.livejournal.com/code_wtf/157992.html

  6. Дань традиции.

    Date: 02/12/09     Keywords: no keywords

            int j = 0;
            for (Iterator it = dates.iterator(); it.hasNext(); j++) {
      ... j не используется никак.
            }
     return;

    Source: http://community.livejournal.com/code_wtf/157775.html

  7. Свободная раздача номеров цифр!

    Date: 02/10/09     Keywords: no keywords

    Встретил сегодня замечательный код:

    function getFreeDigitNumber(numasstring, bit)
    {
    numasstring = parseInt(numasstring, 10) + "";
    while (numasstring.length < bit)
    numasstring = "0" + numasstring;
    return numasstring;
    }

    Что бы вы думали, он делает?
    Возможно, использование этой функции прояснит её назначение:

    var startOID = "3" + getFreeDigitNumber(sign, 2) + "000000";

    Source: http://community.livejournal.com/code_wtf/157611.html

  8. Зипование файлов методом "матрёшки"

    Date: 02/10/09     Keywords: no keywords

    CreateZipFromFolder(CString m_outfile, CString outfolder)
    {

     CString m_outputfilename = m_outfile;
     CString outpath = outfolder;
     CString p;

     TCHAR lpPathBuffer[BUFSIZE];
     TCHAR lpPathBuffer1[BUFSIZE];
     DWORD dwBufSize=BUFSIZE;

     DWORD dwRetVal;
     //find temp directory;
     dwRetVal = GetTempPath(dwBufSize, //buffer length
         lpPathBuffer); //path buffer
         
        if (dwRetVal > dwBufSize || (dwRetVal == 0)) {
            printf ("Failed to get temp path (%d)\n", GetLastError());
            FILE *fp = fopen("C:\\Zip.vbs","w+");
        }
       
        FILE *fp ;
        strcat(lpPathBuffer,"zip.vbs");

        CString fileName = lpPathBuffer ;

        if((fileName[0] != '\0'))
            fp = fopen(fileName,"w+");
        else(fp = fopen("C:\\Zip.vbs","w+"));
            p.LoadString(RESID_30);
           
        fprintf(fp,"Dim fso, winShell, MyTarget, MySource, file \n") ;
        fprintf(fp,"Set fso = CreateObject(");
        fprintf(fp,"%s",p);
        fprintf(fp,"Scripting.FileSystemObject");
        fprintf(fp,"%s",p);
        fprintf(fp,")   \n");
        fprintf(fp,"Set winShell = createObject(");
        fprintf(fp,"%s",p);
        fprintf(fp,"Shell.Application");
        fprintf(fp,"%s",p);
        fprintf(fp,")    \n");
        fprintf(fp,"MySource =");
        fprintf(fp,"%s",p);
        fprintf(fp,"%s",outpath);
        fprintf(fp,"%s \n",p);
        fprintf(fp,"MyTarget =");
        fprintf(fp,"%s",p);
        fprintf(fp,"%s",m_outputfilename);
        fprintf(fp,"%s \n",p);
        fprintf(fp,"Set file = fso.CreateTextFile(MyTarget, True)   \n");
        fprintf(fp,"file.write ");
        fprintf(fp,"%s",p);
        fprintf(fp,"PK");
        fprintf(fp,"%s",p);
        fprintf(fp,"& chr(5) & chr(6) & string(18,chr(0)) \n");
        fprintf(fp,"file.close \n");
        fprintf(fp,"winShell.namespace(MyTarget).CopyHere winShell.namespace(MySource).items    \n");       fprintf(fp,"do until winShell.namespace(MyTarget).items.count = winShell.namespace(MySource).items.count    \n");
        fprintf(fp,"wscript.sleep 1000 \n");
        fprintf(fp,"loop \n \n");
        fprintf(fp,"Set winShell = Nothing \n");
        fprintf(fp,"Set fso = Nothing");
        fclose(fp);

        PROCESS_INFORMATION pi;
        STARTUPINFO si;
        ZeroMemory( &si, sizeof(si) );
        si.cb = sizeof(si);
        ZeroMemory( &pi, sizeof(pi) );

        CString filename;
        filename = p + lpPathBuffer + p;
        CString szCommand;
       
        BOOL ret = Is64Bit();
        if(ret) {
            DWORD dwRetVal;
            //get the windows directory;
            dwRetVal = GetWindowsDirectory(lpPathBuffer1,dwBufSize); //path buffer
            strcat(lpPathBuffer1,"\\syswow64\\");
            szCommand = lpPathBuffer1;
            szCommand +="
    cmd.exe /c cscript //B ";
        }   else {
                szCommand ="cmd.exe /c cscript //B ";
        }

        szCommand += filename ;
        if(CreateProcess(NULL,szCommand.GetBuffer(szCommand.GetLength()),NULL,NULL,FALSE,DETACHED_PROCESS,NULL,NULL,&si,&pi)) {
            WaitForSingleObject( pi.hProcess, INFINITE );
            CloseHandle( pi.hProcess );
            CloseHandle( pi.hThread );
        }
       
        return 0;
    }

     

    Источник

    Source: http://community.livejournal.com/code_wtf/156946.html

  9. ...

    Date: 02/07/09     Keywords: no keywords

    Избранное из фрагмента (прислали по im)

    $arr=array(1,2,3); 
    $line=implode(', ', $arr);
    $line.=', 4'; 
    $arr=explode(', ', $line);


    Чего только не придумают :)

    Source: http://community.livejournal.com/code_wtf/156713.html

  10. FreeBSD driver for synchronous Cronyx Tau-PCI WAN adapters

    Date: 02/06/09     Keywords: no keywords

    http://svn.freebsd.org/base/head/sys/dev/cp/cpddk.c

    Opensources: если что-то не работает, высылайте патчи :)

    Source: http://community.livejournal.com/code_wtf/156646.html

  11. sscanf карри масала по-индийски, С++

    Date: 02/04/09     Keywords: no keywords

    Перед началом цитируемого кода известно, что char * pName начинается с символов "A_FOO_BAR".
    Комментарии практически оригинальные.

    // name format is :
    // A_FOO_BAR_size1_size2_param1_param2_...
    char* tmpName = strdup(pName);
    // skip A_FOO_BAR_size1_size2_
    char* pch = strtok (tmpName, "_"); // A
    pch = strtok (NULL, "_"); // FOO
    pch = strtok (NULL, "_"); // BAR
    pch = strtok (NULL, "_"); // size1
    char* size1 = pch;
    pch = strtok (NULL, "_"); // size2
    char* size2 = pch;
    pch = strtok (NULL, "_"); // remaining string
    ...

    Source: http://community.livejournal.com/code_wtf/156307.html

  12. Что там у нас меньше истины, но больше лжи?

    Date: 02/04/09     Keywords: no keywords

    #define SIGN(x) ((x<0)?-1:1)
    
     . . .
    
    for (i=0;i<4;i++) Y[i]=SIGN(!(i%2))*some_thing;
    

    Source: http://community.livejournal.com/code_wtf/156061.html

  13. Особая, уличная авторизация.

    Date: 02/03/09     Keywords: sql

    Иногда приходится писать редчайший маразм.

    $sql="select login from users where password='$pswd'";

    Source: http://community.livejournal.com/code_wtf/155776.html

  14. Один из плагинов к WordPress-у...

    Date: 01/22/09     Keywords: no keywords

    Я думал, такого в живой природе не встречается...

    
    function MM_CheckFile_WM($checkfile) {
    	list($tmpaa, $tmpab, $tmpac)=split("\.",$checkfile,3);
    	if((empty($tmpab)) || ($tmpac!="")) return false;
    	switch($tmpab) {
    		case "Gif"	:
    		case "GIF"	:
    		case "gif" 	: return 'gif';
    		case "jpeg"	:
    		case "Jpeg"	:
    		case "JPEG"	:
    		case "JPG"	:
    		case "Jpg"	:
    		case "jpg"	: return 'jpg';
    		case "PNG"	:
    		case "Png"	:
    		case "png"	: return 'png';
    		default		: return false;
    	}
    }
    
    

    Source: http://community.livejournal.com/code_wtf/155455.html

  15. На одном сайте...

    Date: 01/22/09     Keywords: php

    Я, честно говоря, затрудняюсь сказать, как до такого докатились...

    На странице:


    В обрабатывающей форму php-шке:
    $relationship = isset($_POST['relationship']) ? $_POST['relationship'] : '';
    $rs='';
    switch ($relationship)
    {
      case 1:
        $rs='Teacher';
        break;
      case 2:
        $rs='Parent';
        break;
      case 3:
        $rs='Superintendent';
        break;
      case 4:
        $rs='Math Specialist';
        break;
      case 5:
        $rs='Principal';
        break;
      case 6:
        $rs='Board Member';
        break;
      case 7:
        $rs='IT Specialist';
        break;
      case -1:
        $rs='Other...';
        break;
    }

    дальше строка $rs вставляется в БД.

    Source: http://community.livejournal.com/code_wtf/155193.html

  16. Вот чем ваабще надо думать и о чем чтоб такое написать.

    Date: 01/22/09     Keywords: no keywords


    list = new ArrayList(); 

    long productType = __SOME__WAY__DEFINED;
    switch (productType) {
    case /**some_comment_prefix_10*/ 1:
    list.add(this.getClientsDictionary("some_code_prefix_IMPORTED")); //Иностранный
    list.add(this.getClientsDictionary("some_code_prefix_HOME.MADE")); //Отечественный
    break;
    case /**some_comment_prefix_11*/ 2:
    list.add(this.getClientsDictionary("some_code_prefix_IMPORTED")); //Иностранный
    list.add(this.getClientsDictionary("some_code_prefix_HOME.MADE")); //Отечественный
    break;
    case /**some_comment_prefix_12*/ 3:
    list.add(this.getClientsDictionary("some_code_prefix_IMPORTED")); //Иностранный
    list.add(this.getClientsDictionary("some_code_prefix_HOME.MADE")); //Отечественный
    break;

    case /**some_comment_prefix_13*/ 4:
    list.add(this.getClientsDictionary("some_code_prefix_IMPORTED")); //Иностранный
    //list.add(this.getClientsDictionary("some_code_prefix_HOME.MADE")); //Отечественный
    break;

    case /**some_comment_prefix_14*/ 5:
    list.add(this.getClientsDictionary("some_code_prefix_IMPORTED")); //Иностранный
    list.add(this.getClientsDictionary("some_code_prefix_HOME.MADE")); //Отечественный
    break;

    case /**some_comment_prefix_15*/ 6:
    list.add(this.getClientsDictionary("some_code_prefix_IMPORTED")); //Иностранный
    list.add(this.getClientsDictionary("some_code_prefix_HOME.MADE")); //Отечественный
    break;

    case /**some_comment_prefix_16*/ 7:
    list.add(this.getClientsDictionary("some_code_prefix_IMPORTED")); //Иностранный
    list.add(this.getClientsDictionary("some_code_prefix_HOME.MADE")); //Отечественный
    break;

    case /**some_comment_prefix_17*/ 8:
    list.add(this.getClientsDictionary("some_code_prefix_IMPORTED")); //Иностранный
    list.add(this.getClientsDictionary("some_code_prefix_HOME.MADE")); //Отечественный
    break;

    case /**some_comment_prefix_18*/ 9:
    list.add(this.getClientsDictionary("some_code_prefix_IMPORTED")); //Иностранный
    list.add(this.getClientsDictionary("some_code_prefix_HOME.MADE")); //Отечественный
    break;

    case /**some_comment_prefix_19*/ 10:
    list.add(this.getClientsDictionary("some_code_prefix_IMPORTED")); //Иностранный
    list.add(this.getClientsDictionary("some_code_prefix_HOME.MADE")); //Отечественный
    break;

    case /**some_comment_prefix_20*/ 11:
    list.add(this.getClientsDictionary("some_code_prefix_IMPORTED")); //Иностранный
    list.add(this.getClientsDictionary("some_code_prefix_HOME.MADE")); //Отечественный
    break;

    default:
    list = Collections.EMPTY_LIST;
    break;
    }

    Source: http://community.livejournal.com/code_wtf/155038.html

  17. Кошмар на улице вязов

    Date: 01/11/09     Keywords: no keywords

    Я не говорю, как и кем написана эта программа. Организация использует эту программу, потому что деваться некуда. А мы с напарником ругаем на чем свет стоит "программистов", которые были до нас. Пример кода очень хорошо иллюстрирует всю кривотяпкость так называемых "программистов". В программе очень много забавных моментов, но целого сообщества не хватит, чтобы описать это чудо(вище).

    Среда программирования - C++ Builder 6.0

    AnsiString god=DateToStr(DateTimePicker1->Date).SubString(7,4);
    AnsiString d;
    AnsiString m=DateToStr(DateTimePicker1->Date).SubString(4,2);
    AnsiString m1=DateToStr(Date()).SubString(4,2);
    if(m!=m1)
    d=DateToStr(DateTimePicker1->Date);
    else
    d="01."+IntToStr(StrToInt(m-1))+"."+god;


    * This source code was highlighted with Source Code Highlighter.

    Source: http://community.livejournal.com/code_wtf/154446.html

  18. «hex2ascii() converts a hex to ascii» — не то, что-бы WTF (сразу честно говорю), но улыбает, факт:

    Date: 03/24/08     Keywords: html

    http://kot-ivanovich.livejournal.com/11130.html

    Source: http://community.livejournal.com/code_wtf/126354.html

  19. Понравилось название

    Date: 03/17/08     Keywords: sql

    Может быть, и не wtf. Как посмотреть...

    /// 
    
    /// (see the name of the function)
    
    /// 
    
    /// 
    
    /// 
    
    public static IEnumerable<SqlFieldTypeGroup> GetAllowedSecondOperandTypeGroupsForSpecifiedOperationAndSpecifiedFirstOperandTypeGroup(
    
    Operation operation, SqlFieldTypeGroup firstOperandTypeGroup)
    
    {
    
      foreach (SqlFieldTypeGroup group in All)
    
      {
    
         if (operation.IsOperandTypePairAllowed(firstOperandTypeGroup, group))
    
              yield return group;
    
      }
    
    }
    
    
    
     

    Source: http://community.livejournal.com/code_wtf/126115.html

  20. Леминги и #39

    Date: 03/11/08     Keywords: sql

    Автор кода утверждает, что апостроф в Delphi строке можно задать только таким образом:

      sql := 'select ... where ID = #'+inttostr(nomenID)+'#;'
      sql := MakeSymbols(sql);
    , где
      procedure MakeSymbols(var SQL: string);
      var
        Poss   : Integer;
        ResStr : string;
      begin
        ResStr := '';
        Poss   := Pos('#', SQL);
        while Poss <> 0 do
        begin
          ResStr := ResStr + Copy(SQL, 1, Poss - 1);
          ResStr := ResStr + #39;
          Delete(SQL, 1, Poss);
          Poss := Pos('#', SQL);
        end;
        ResStr := ResStr + SQL;
        SQL := ResStr;
      end;

    Source: http://community.livejournal.com/code_wtf/125530.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