블로거에서 위키 마크업을 자바스크립트로 사용 edit

creole 말고도 수많은 자바스크립트 마크업들을 테스트해보았지만 모두 블로거에서 사용하기 적절하지 않았다.

  • 일반 HTML태그와 혼용 불가
  • <nowiki></nowiki>태그의 미지원 혹은 불완전한 지원
  • <pre></pre>태그안에서 줄바꿈을 인식하여 <p></p>로 감싼뒤 태그를 그대로 이스케이프하여 태그가 그대로 출력됨.

class이름으로 element를 얻기위한 getElementsByClass함수




위 함수 대신 jquery같은걸 써도됨.

아래 자바스크립트 소스들은 페이지 맨 하단에 삽입되어야 함.(페이지가 모두 로드 된 뒤 렌더링)

Creole




모든 포스트에 자동으로 위키마크업을 사용하려면 위 주석처리된 코드처럼 post-body entry-content클래스를 지정해주되지만 일반 HTML태그를 지원해주지 않기때문에 wiki-content클래스를 지정하여 위키마크업을 사용할 부분에만 사용한다.

wiky






InstaView by Pilaf from wikipedia



Firefox HTTP 301 redirected permanent update edit

Javascript document.location edit

http://fuckthis.com/shit

  • document.location -> http://fuckthis.com/shit
  • document.location.hostname -> fuckthis.com
  • document.location.pathname -> /shit

Firefox page captures sometimes fail with an "out of memory" error temporary fix edit

https://addons.mozilla.org/en-US/firefox/addon/pagesaver/

Note: we are aware of a problem where, on some Windows systems, page captures sometimes fail with an "out of memory" error. This is caused by a Firefox bug that has been fixed; the fix should be included in Firefox 8. In the meantime, please refer to the Known Issues and Limitations for more information including a temporary workaround for this problem.

http://pearlcrescent.com/products/pagesaver/doc/#knownissues

With Firefox 4 and newer on some Windows systems, attempts to capture a page that is taller or wider than 8,192 pixels may fail and an "out of memory" error will be reported. This is caused by Mozilla bug 649924 which occurs when hardware acceleration is used. To work around this problem, follow these steps to disable hardware acceleration:

  1. Open the Firefox options and view the Advanced panel.
  2. Within the General tab (Browsing section), uncheck the Firefox option named "Use hardware acceleration when available".
  3. Restart Firefox.

Uncheck the Firefox option named "Use hardware acceleration when available":


배컴2 피시방 플레이 edit

이 팁은 EA코리아에서 바로 구입한 분들에게만 적용될겁니다.

  • 인증횟수는 자신의 시디키에 종속됩니다. (즉 다른사람의 설치파일로 설치하여도 자신의 시디키의 인증횟수가 감소됩니다. *설치파일이 마구마구 뿌려져도 문제없음)
  • 시디키는 EADM의 게임정보에서 복사한다음부턴 EADM없이도 설치파일에 직접 시디키를 입력하여 바로 설치가 가능합니다.
  • 시디키는 레지스트리에 암호화되지 않은 상태로 저장됩니다.

EADM에서 설치파일 받으려면 속 터집니다.

  1. 일단 EADM에서 베컴2 게임정보에 보면 시디키가 나와있습니다. 다른곳에 소중히 간직하세요. (시디키가 곧 게임값)
  2. EADM에서 설치파일을 다 받고 그 디렉토리만(bfbc2_dd) USB메모리스틱이나 외장하드에 백업하시거나 피시방 컴퓨터에 백업하실 수 있으신경우 백업합니다.
  3. 패치도 설치 후 업데이터로 패치하면 속 터집니다. 패치도중 오류도 자주 나구요. 메뉴얼 패치파일도 같이 백업해둡니다.

R10 최신 메뉴얼 패치

http://www.bigdownload.com/games/battlefield-bad-company-2/pc/battlefield-bad-company-2-r10-update/

이 후 부터는 EADM없이 설치하실때(bfbc2_dd\Setup.exe) 보관해둔 시디키를 입력하고 바로 설치가 가능합니다.

설치 완료 후 펑크버스터 업데이트와 동시에 메뉴얼패치를 진행할 수 있습니다.

펑크버스터 메뉴얼 업데이트 pbsetup.zip

게임을 다 즐긴 후 삭제를 프로그램 추가/제거에서 하면 속터집니다.

시작메뉴의 Deauthorize로 인증을 풀어주신 후 시디키정보가 들어있는 레지스트리를 삭제하신 후 바로 나가시면 안전합니다.

시디키 레지스트리 삭제

레지스트리 편집기에서 HKEY_LOCAL_MACHINE\SOFTWARE\Electronic Arts\Electronic Arts\Battlefield Bad Company 2\ergc 의 값을 지우시거나 아래 내용을 빈 텍스트 문서에 복사한 후 확장자를 .reg로 변경한 후 실행시켜줍니다.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Electronic Arts\Electronic Arts\Battlefield Bad Company 2\ergc]
@=-

만약 인증전에 레지스트리에있는 시디키를 지우셨다면 Deauthorize를 할 수 없습니다.

이때에는 다시 시디키 정보를 ergc에 입력하신 후 Deauthorize하시면 인증을 풀 수 있습니다.

레지스트리의 시디키 삭제후에도 걱정되시는분은 게임폴더(C:\Program Files\Electronic Arts)를 Shift+Delete키로 지워버리세요. :)

Javascript getElementsByClass edit

http://jsnu.cafe24.com/lagooniweb/-web-technology/js-javascript/

function getElementsByClass(searchClass,node,tag) {
    var classElements = new Array();
    if ( node == null )
        node = document;
    if ( tag == null )
        tag = '*';
    var els = node.getElementsByTagName(tag);
    var elsLen = els.length;
    var pattern = new RegExp('(^|\\\\s)'+searchClass+'(\\\\s|$)');
    for (i = 0, j = 0; i < elsLen; i++) {
        if ( pattern.test(els[i].className) ) {
            classElements[j] = els[i];
            j++;
        }
    }
    return classElements;
}

XML online escape encoder/decoder edit

Encoder: http://www.opinionatedgeek.com/dotnet/tools/htmlencode/encode.aspx
Decoder: http://www.opinionatedgeek.com/dotnet/tools/htmlencode/decode.aspx

Block search bots using meta tag edit

http://code.google.com/intl/ko/web/controlcrawlindex/docs/robots_meta_tag.html

Add below code inside of head tag:
<meta name="robots" content="noindex, noarchive, nofollow, nosnippet, noodp, notranslate, noimageindex">
<meta name="googlebot" content="noindex, noarchive, nofollow, nosnippet, noodp, notranslate, noimageindex">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">

Adding SyntaxHighlighter to blogger edit

SyntaxHighligher: http://alexgorbatchev.com/SyntaxHighlighter/

I have a problem if i use higher version than 2.0.320.

Design -> Edit HTML

Add below code between ]]></b:skin> and </head>
...
]]></b:skin>

<link href='http://alexgorbatchev.com/pub/sh/2.0.320/styles/shCore.css' rel='stylesheet' type='text/css'/>
<link href='http://alexgorbatchev.com/pub/sh/2.0.320/styles/shThemeDefault.css' rel='stylesheet' type='text/css'/>
<script src='http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shCore.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushCpp.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushCSharp.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushCss.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushJava.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushJScript.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushPhp.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushPython.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushRuby.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushSql.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushVb.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushXml.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushPerl.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushBash.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/2.0.320/scripts/shBrushPlain.js' type='text/javascript'/>

</head>
...

Add below code before </body>
...
<script language='javascript'>
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.config.stripBrs = true;
SyntaxHighlighter.config.clipboardSwf = &#39;http://alexgorbatchev.com/pub/sh/2.1.364/scripts/clipboard.swf&#39;;
SyntaxHighlighter.all();
</script>

</body>
</html>

Using libcurl in libpurple edit

http://pidgin.im/pipermail/devel/2007-November/003967.html
Vishal Rao vishalrao at gmail.com
Tue Nov 6 01:08:27 EST 2007


Hello,

I'm writing a libpurple plugin (cross-platform Windows and Linux/Unix)
and I need to do an FTP upload via code. Can you recommend some
quick/easy library to do an FTP upload which also compiles/works on
Windows and Linux?

Thanks,
Vishal Rao

--
"Thou shalt not follow the null pointer for at it's end madness and chaos lie."

http://pidgin.im/pipermail/devel/2007-November/003968.html
Casey Harkins caseyharkins at gmail.com
Tue Nov 6 01:41:18 EST 2007


libcurl perhaps? Never used it, so I'm not sure about quick/easy, but it
does support most platforms (including Windows, Linux and most flavors
of Unix) and multiple protocols.

http://curl.haxx.se/libcurl/

-casey

http://pidgin.im/pipermail/devel/2007-November/003971.html
Vishal Rao vishalrao at gmail.com
Tue Nov 6 08:29:02 EST 2007


thanks, i've started to use the libcurl which comes with cygwin and my
libpurple plugin compiles under windows/cygwin/mingw.

problem is, when i include curl and call its init and cleanup
functions in the plugin code, the plugin no longer shows up in
pidgin's plugin list to load! the plugin works again when i comment
out the curl code... im statically linking curl and my plugin dll size
goes up from about 100k to 500k.

any ideas as to why this is happening and how to get it to work?

--
"Thou shalt not follow the null pointer for at it's end madness and chaos lie."

http://pidgin.im/pipermail/devel/2007-November/003972.html
Daniel Atallah daniel.atallah at gmail.com
Tue Nov 6 09:10:12 EST 2007


The problem is likely that you're using the cygwin-dependent libcurl.
The reason that your plugin no longer appears is that it probably
can't find cygwin1.dll, which libcurl needs. Using the MS dependency
checker application on your plugin dll will verify this. Pidgin (on
Windows) is a native win32 application, so you should use a natively
compiled libcurl instead and avoid having these problems.

-D

http://pidgin.im/pipermail/devel/2007-November/003977.html
Vishal Rao vishalrao at gmail.com
Tue Nov 6 11:19:38 EST 2007


Yup, it did seem to have a dependency on cygwin. So I built libcurl
myself and rebuilt the plugin. Still see the same problem. Dependency
walker shows dependency on libpurple.dll and dwmapi.dll which is the
same as the working plugin without curl.

If I comment out the calls to curl's init and cleanup, the plugin
loads. I moved the calls to other functions and not the plugin's
init/load, still the plugin does not load if I include curl calls...

--
"Thou shalt not follow the null pointer for at it's end madness and chaos lie."

http://pidgin.im/pipermail/devel/2007-November/003980.html
Vishal Rao vishalrao at gmail.com
Tue Nov 6 11:36:42 EST 2007


Doh, nevermind. I just needed to place libcurl.dll in Pidgin's folder
not in the plugins subfolder. Static linking is giving me linker
errors so I'm using the curl dll.... thanks!

--
"Thou shalt not follow the null pointer for at it's end madness and chaos lie."

http://pidgin.im/pipermail/devel/2007-November/003988.html
Vishal Rao vishalrao at gmail.com
Wed Nov 7 00:46:56 EST 2007

FYI I've attached my libpurple plugin code for any comments on it.
It's supposed to be a "webaware" plugin similar to miranda-im's
webaware plugin which uploads your status so you can display it on
your webpage.

I'm writing it mostly for myself because I didn't find an existing
replacement plugin for Pidgin which I'm starting to use on Linux and
Windows... I hope there doesn't already exist a similar plugin for
Pidgin which I could just use?

--
"Thou shalt not follow the null pointer for at it's end madness and chaos lie."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: webaware.c
Type: text/x-csrc
Size: 11254 bytes
Desc: not available
Url : http://pidgin.im/pipermail/devel/attachments/20071107/eeedb93a/attachment-0001.c

attachment-0001.c:
/*
 * WebAware (version 0.0.3) libpurple plugin.
 *
 * Copyright (C) 2007 Vishal Rao <vishal.rao@lahsiv.net>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 * http://www.gnu.org/copyleft/gpl.html
 */

/** 
 * This is a libpurple plugin which places your IM status on FTP or local directories.
 * It is useful for displaying your status on your website.
 */

/*
Changelog:

0.0.3 (Nov 6th, 2007) :
Now using libcurl and glib threads/mutexes for the (hardcoded for me) FTP upload.

0.0.2 (Oct 9th, 2007) :
Now just listens to account-status-changed signals.

0.0.1 (Oct 9th, 2007) :
First cut based on helloworld.c hardcoded only for MSN, Yahoo and GoogleTalk.
Can only listen to signed-on and signed-off signals.
Does not store status anywhere in this version.
*/

/*
TODO :

1. Actually place status on multiple FTP and local dirs.
2. Handle all available protocols not just MSN, Yahoo and GoogleTalk.
3. Use Pref API to load/store config along with UI.
*/

#define PURPLE_PLUGINS

#include <glib.h>

#ifndef G_GNUC_NULL_TERMINATED
  #if __GNUC__ >= 4
    #define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__))
  #else
    #define G_GNUC_NULL_TERMINATED
  #endif /* __GNUC__ >= 4 */
#endif /* G_GNUC_NULL_TERMINATED */

#include "plugin.h"
#include "version.h"
#include "request.h"
#include "notify.h"
#include "connection.h"
#include "signals.h"
#include "util.h"

#include <curl/curl.h>

CURL * g_curl = NULL;

char g_curldata[500] = {0};
int g_curldatalen = 0;

GMutex * g_statusmutex = NULL;
GMutex * g_threadmutex = NULL;

int g_threadstarted = 0;
GThread * g_thread = NULL;
GError * g_error = NULL;

PurplePlugin * g_plugin = NULL;

/*
 * Connection protocol_id list:
 * MSN is "prpl-msn"
 * Yahoo is "prpl-yahoo"
 * GTalk is "prpl-jabber"
 */

PurpleConnection * g_msn = NULL;
PurpleConnection * g_yahoo = NULL;
PurpleConnection * g_gtalk = NULL;

gulong g_statusid = 0;

char g_msnstatus[100] = {0};
char g_yahoostatus[100] = {0};
char g_gtalkstatus[100] = {0};

static void
check_connection(PurpleConnection * conn)
{
  const char * msn = NULL;
  const char * yahoo = NULL;
  const char * gtalk = NULL;

  if (!g_msn)
  {
    msn = purple_strcasestr(conn->account->protocol_id, "prpl-msn");

    if (msn)
    {
      g_msn = conn;
      return;
    }
  }

  if (!g_yahoo)
  {
    yahoo = purple_strcasestr(conn->account->protocol_id, "prpl-yahoo");

    if (yahoo)
    {
      g_yahoo = conn;
      return;
    }
  }

  if (!g_gtalk)
  {
    gtalk = purple_strcasestr(conn->account->protocol_id, "prpl-jabber");

    if (gtalk)
    {
      g_gtalk = conn;
      return;
    }
  }
}

static void
update_status(PurpleConnection * conn, char * gstatus)
{
  GList * statuses = NULL;
  GList * statusitem = NULL;
  PurpleStatus * status = NULL;
  PurpleStatusType * statustype = NULL;
  PurpleStatusPrimitive statusprimitive = PURPLE_STATUS_UNSET;

  g_strlcpy(gstatus, "Unknown", 99);
  
  statuses = purple_presence_get_statuses(conn->account->presence);
  
  statusitem = g_list_first(statuses);

  g_mutex_lock(g_statusmutex);
  
  while (statusitem)
  {
    status = (PurpleStatus *) statusitem->data;
    
    if (purple_status_is_active(status))
    {
      statustype = purple_status_get_type(status);
      
      statusprimitive = purple_status_type_get_primitive(statustype);

/*      
      purple_notify_message(g_plugin, PURPLE_NOTIFY_MSG_INFO, conn->account->protocol_id,
        purple_primitive_get_name_from_type(statusprimitive), NULL, NULL, NULL);
        */
      
      g_strlcpy(gstatus, purple_primitive_get_name_from_type(statusprimitive), 99);
    }
    
    statusitem = g_list_next(statusitem);
  }
  
  g_mutex_unlock(g_statusmutex);
}

// curlreader is the "data provider" for the libcurl ftp upload
static size_t
curlreader(void *ptr, size_t size, size_t nmemb, void *stream)
{
  static int total = 0;
  int current = 0;
  
  while (total < g_curldatalen && current < size*nmemb)
  {
    *(((char*)ptr)+current) = *(((char*)stream)+total);
    
    total++;
    current++;
  }
  
  if (current == 0) total = 0;
  
  return current;
}

// uploader is the thread which waits 10s before performing the upload
static gpointer
uploader(gpointer data)
{
  CURLcode result;
  //GTimer * timer = NULL;
  
  //sleep(10000); // wait 10 seconds before uploading status...
  
  /*
  timer = g_timer_new();
  g_timer_start(timer);
  while(g_timer_elapsed(timer, NULL) < 10.0);
  g_timer_destroy(timer);
  */
  
  g_usleep(10000000); // wait 10 seconds before uploading status...
  
  // currently uploading miranda-im's webaware_data.js file format!
  
  g_mutex_lock(g_statusmutex);
  strcpy(g_curldata, "initArray(4);\n");
  strcat(g_curldata, "addData(new Array(\"CSTIME\", 2007, 11, 06, 15, 00, 00));\n");
  strcat(g_curldata, "addData(new Array(\"STATUS\", \"JABBER\", 40071, \"");
  strcat(g_curldata, g_gtalkstatus);
  strcat(g_curldata, "\", \"Nope, not here.\"));\n");
  strcat(g_curldata, "addData(new Array(\"STATUS\", \"MSN\", 40071, \"");
  strcat(g_curldata, g_msnstatus);
  strcat(g_curldata, "\", \"Nope, not here.\"));\n");
  strcat(g_curldata, "addData(new Array(\"STATUS\", \"YAHOO\", 40071, \"");
  strcat(g_curldata, g_yahoostatus);
  strcat(g_curldata, "\", \"Nope, not here.\"));\n");  
  g_mutex_unlock(g_statusmutex);
  g_curldatalen = strlen(g_curldata);
  
  g_curl = curl_easy_init();
  // upload to ftp
  if (g_curl)
  {
    curl_easy_setopt(g_curl, CURLOPT_UPLOAD, 1);
    curl_easy_setopt(g_curl, CURLOPT_URL, "ftp://user:pass@site.tld/folder/file");
    curl_easy_setopt(g_curl, CURLOPT_READDATA, g_curldata);
    curl_easy_setopt(g_curl, CURLOPT_READFUNCTION, &curlreader);
    result = curl_easy_perform(g_curl);
    curl_easy_cleanup(g_curl);
  }  
  
  g_mutex_lock(g_threadmutex);
  g_threadstarted = 0;
  g_mutex_unlock(g_threadmutex);
  
  return NULL;
}

static void
save_status(const char * gstatus)
{
  g_mutex_lock(g_threadmutex);
  
  if (g_threadstarted == 0)
  {
    g_thread = g_thread_create(&uploader, NULL, FALSE, &g_error);
    g_threadstarted = 1;
  }
  
  g_mutex_unlock(g_threadmutex);
}

static void
save_status2(const char * gstatus)
{
  CURLcode result;
  
  // TODO : Read prefs and save status to FTP and/or local dir.
  /*
  purple_notify_message(g_plugin, PURPLE_NOTIFY_MSG_INFO, "Save Status",
    gstatus, NULL, NULL, NULL);  
  */
  g_curl = curl_easy_init();
  // upload to ftp
  if (g_curl)
  {
    curl_easy_setopt(g_curl, CURLOPT_UPLOAD, 1);
    curl_easy_setopt(g_curl,CURLOPT_URL, "ftp://user:pass@site.tld/folder/file");
    curl_easy_setopt(g_curl, CURLOPT_READDATA, g_curldata);
    curl_easy_setopt(g_curl, CURLOPT_READFUNCTION, &curlreader);
    result = curl_easy_perform(g_curl);
    curl_easy_cleanup(g_curl);
  }
}

static void
update_and_save_status(PurpleConnection * conn)
{
  const char * msn = NULL;
  const char * yahoo = NULL;
  const char * gtalk = NULL;

  msn = purple_strcasestr(conn->account->protocol_id, "prpl-msn");
  yahoo = purple_strcasestr(conn->account->protocol_id, "prpl-yahoo");
  gtalk = purple_strcasestr(conn->account->protocol_id, "prpl-jabber");

  if (msn)
  {
    update_status(g_msn, g_msnstatus);
    save_status(g_msnstatus);
  }
  else if (yahoo)
  {
    update_status(g_yahoo, g_yahoostatus);
    save_status(g_yahoostatus);
  }
  else if (gtalk)
  {
    update_status(g_gtalk, g_gtalkstatus);
    save_status(g_gtalkstatus);
  }
}

static void
account_status_changed(PurpleAccount *account, PurpleStatus *old, PurpleStatus *new, gpointer data)
{
  PurpleConnection * conn = NULL;
  /*
  purple_debug_misc("signals test", "account-status-changed (%s, %s, %s)\n",
          purple_account_get_username(account),
          purple_status_get_name(old),
          purple_status_get_name(new));
  */
  
  /*
  char msg[100] = {0};
  
  g_snprintf(msg, 99, "account: %s, old: %s, new: %s", purple_account_get_protocol_name(account),
    purple_status_get_name(old), purple_status_get_name(new));
  
  purple_notify_message(g_plugin, PURPLE_NOTIFY_MSG_INFO, "Account Status Changed",
    msg, NULL, NULL, NULL);  
  */
  
  conn = purple_account_get_connection(account);
  check_connection(conn);
  update_and_save_status(conn);  
}

static gboolean
plugin_load(PurplePlugin * plugin)
{
  /*
  purple_notify_message(plugin, PURPLE_NOTIFY_MSG_INFO, "WebAware Load",
    "plugin_load() called", NULL, NULL, NULL);
  */

  /*
  g_signonid = purple_signal_connect(purple_connections_get_handle(), "signed-on", g_plugin,
    PURPLE_CALLBACK(signed_on_cb), NULL);

  g_signoffid = purple_signal_connect(purple_connections_get_handle(), "signed-off", g_plugin,
    PURPLE_CALLBACK(signed_off_cb), NULL);
  */

  /*
  g_statusid = purple_signal_connect(purple_connections_get_handle(), "savedstatus-changed", g_plugin,
    PURPLE_CALLBACK(savedstatus_changed_cb), NULL);
  */

  g_statusid = purple_signal_connect(purple_accounts_get_handle(), "account-status-changed", g_plugin,
    PURPLE_CALLBACK(account_status_changed), NULL);

  g_statusmutex = g_mutex_new();
  g_threadmutex = g_mutex_new();
  
  return TRUE;
}

static gboolean
plugin_unload(PurplePlugin * plugin)
{
  /*
  purple_notify_message(plugin, PURPLE_NOTIFY_MSG_INFO, "WebAware UnLoad",
    "plugin_unload() called", NULL, NULL, NULL);
  */

  purple_signals_disconnect_by_handle(g_plugin);

  g_mutex_free(g_statusmutex);
  g_mutex_free(g_threadmutex);
  
  return TRUE;
}

static void
plugin_destroy(PurplePlugin * plugin)
{
  /*
  purple_notify_message(plugin, PURPLE_NOTIFY_MSG_INFO, "WebAware Destroy",
    "plugin_destroy() called", NULL, NULL, NULL);
  */

  purple_signals_uninit();
  purple_connections_uninit();
}

static PurplePluginInfo
info =
{
    PURPLE_PLUGIN_MAGIC,
    PURPLE_MAJOR_VERSION,
    PURPLE_MINOR_VERSION,
    PURPLE_PLUGIN_STANDARD,
    NULL,
    0,
    NULL,
    PURPLE_PRIORITY_DEFAULT,

    "core-vishalrao-webaware",
    "WebAware",
    "0.0.3",

    "Web Awareness Plugin",
    "The WebAware plugin places your status information on FTP or local directories."
    " It is useful for being able to display your status on your webpage.",
    "Vishal Rao <vishal.rao@lahsiv.net>",
    "http://lahsiv.net/",

    plugin_load,
    plugin_unload,
    plugin_destroy,

    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL 
};

static void
init_plugin(PurplePlugin * plugin)
{
  g_plugin = plugin;
  purple_signals_init();
  purple_connections_init();
  
  //Note: purple_accounts_init() seems to cause Pidgin to not sign on!
  //purple_accounts_init();
}

PURPLE_INIT_PLUGIN(webaware, init_plugin, info);

// --------- The End ---------

Tumblr upload a static file edit

http://www.tumblr.com/themes/upload_static_file

Javascript decompressor edit

http://www.norazoclub.com/site/comm_study/bbs_view.asp?b_no=101218&b_code=1034

http://jsbeautifier.org/

Tumblr auto scroll edit

<script type="text/javascript" src"http://static.tumblr.com/q0etgkr/mFbkoqlkr/tumblrautopager.js"></script>

Decompressed source:
var tumblrAutoPager = {
    url: "http://proto.jp/",
    ver: "0.1.7",
    rF: true,
    gP: {},
    pp: null,
    ppId: "",
    LN: location.hostname,
    init: function ()
    {
        if ($("autopagerize_icon") || navigator.userAgent.indexOf('iPhone') != -1) return;
        var tAP = tumblrAutoPager;
        var p = 1;
        var lh = location.href;
        var lhp = lh.lastIndexOf("/page/");
        var lht = lh.lastIndexOf("/tagged/");
        if (lhp != -1)
        {
            p = parseInt(lh.slice(lhp + 6));
            tAP.LN = lh.slice(7, lhp);
        }
        else if (lht != -1)
        {
            tAP.LN = lh.slice(7);
            if (tAP.LN.slice(tAP.LN.length - 1) == "/") tAP.LN = tAP.LN.slice(0, tAP.LN.length - 1);
        }
        else if ("http://" + tAP.LN + "/" != lh)
        {
            return;
        };
        var gPFncs = [];
        gPFncs[0] = function (aE)
        {
            var r = [];
            for (var i = 0, l = aE.length; i < l; i++)
            {
                if (aE[i].className == "autopagerize_page_element")
                {
                    r = gCE(aE[i]);
                    break;
                }
            }
            return r;
        };
        gPFncs[1] = function (aE)
        {
            var r = [];
            for (var i = 0, l = aE.length; i < l; i++)
            {
                var arr = aE[i].className ? aE[i].className.split(" ") : null;
                if (arr)
                {
                    for (var j = 0; j < arr.length; j++)
                    {
                        arr[j] == "post" ? r.push(aE[i]) : null;
                    }
                }
            }
            return r;
        };
        gPFncs[2] = function (aE)
        {
            var r = [];
            var tmpId = tAP.ppId ? [tAP.ppId] : ["posts", "main", "container", "content", "apDiv2", "wrapper", "projects"];
            for (var i = 0, l = aE.length; i < l; i++)
            {
                for (var j = 0; j < tmpId.length; j++)
                {
                    if (aE[i].id == tmpId[j])
                    {
                        r = gCE(aE[i]);
                        tAP.ppId = aE[i].id;
                        break;
                    }
                }
            }
            return r;
        };
        for (var i = 0; i < gPFncs.length; i++)
        {
            var getElems = gPFncs[i](document.body.getElementsByTagName('*'));
            if (getElems.length)
            {
                tAP.gP = gPFncs[i];
                tAP.pp = getElems[0].parentNode;
                break;
            }
        }
        function gCE(pElem)
        {
            var r = [];
            for (var i = 0, l = pElem.childNodes.length; i < l; i++)
            {
                r.push(pElem.childNodes.item(i))
            }
            return r;
        }
        if (!tAP.pp)
        {
            return;
        }
        sendRequest.README = {
            license: 'Public Domain',
            url: 'http://jsgt.org/lib/ajax/ref.htm',
            version: 0.516,
            author: 'Toshiro Takahashi'
        };

        function chkAjaBrowser()
        {
            var A, B = navigator.userAgent;
            this.bw = {
                safari: ((A = B.split('AppleWebKit/')[1]) ? A.split('(')[0].split('.')[0] : 0) >= 124,
                konqueror: ((A = B.split('Konqueror/')[1]) ? A.split(';')[0] : 0) >= 3.3,
                mozes: ((A = B.split('Gecko/')[1]) ? A.split(' ')[0] : 0) >= 20011128,
                opera: ( !! window.opera) && ((typeof XMLHttpRequest) == 'function'),
                msie: ( !! window.ActiveXObject) ? ( !! createHttpRequest()) : false
            };
            return (this.bw.safari || this.bw.konqueror || this.bw.mozes || this.bw.opera || this.bw.msie)
        }
        function createHttpRequest()
        {
            if (window.XMLHttpRequest)
            {
                return new XMLHttpRequest()
            }
            else
            {
                if (window.ActiveXObject)
                {
                    try
                    {
                        return new ActiveXObject('Msxml2.XMLHTTP')
                    }
                    catch (B)
                    {
                        try
                        {
                            return new ActiveXObject('Microsoft.XMLHTTP')
                        }
                        catch (A)
                        {
                            return null
                        }
                    }
                }
                else
                {
                    return null
                }
            }
        };

        function sendRequest(E, R, C, D, F, G, S, A)
        {
            var Q = C.toUpperCase() == 'GET',
                H = createHttpRequest();
            if (H == null)
            {
                return null
            }
            if ((G) ? G : false)
            {
                D += ((D.indexOf('?') == -1) ? '?' : '&') + 't=' + (new Date()).getTime()
            }
            var P = new chkAjaBrowser(),
                L = P.bw.opera,
                I = P.bw.safari,
                N = P.bw.konqueror,
                M = P.bw.mozes;
            if (typeof E == 'object')
            {
                var J = E.onload;
                var O = E.onbeforsetheader
            }
            else
            {
                var J = E;
                var O = null
            }
            if (L || I || M)
            {
                H.onload = function ()
                {
                    J(H);
                    H.abort()
                }
            }
            else
            {
                H.onreadystatechange = function ()
                {
                    if (H.readyState == 4)
                    {
                        J(H);
                        H.abort()
                    }
                }
            }
            R = K(R, D);
            if (Q)
            {
                D += ((D.indexOf('?') == -1) ? '?' : (R == '') ? '' : '&') + R
            }
            H.open(C, D, F, S, A);
            if ( !! O)
            {
                O(H)
            }
            B(H);
            H.send(R);

            function B(T)
            {
                if (!L || typeof T.setRequestHeader == 'function')
                {
                    T.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8')
                }
                return T
            }
            function K(X, V)
            {
                var Z = [];
                if (typeof X == 'object')
                {
                    for (var W in X)
                    {
                        Y(W, X[W])
                    }
                }
                else
                {
                    if (typeof X == 'string')
                    {
                        if (X == '')
                        {
                            return ''
                        }
                        if (X.charAt(0) == '&')
                        {
                            X = X.substring(1, X.length)
                        }
                        var T = X.split('&');
                        for (var W = 0; W < T.length; W++)
                        {
                            var U = T[W].split('=');
                            Y(U[0], U[1])
                        }
                    }
                }
                function Y(b, a)
                {
                    Z.push(encodeURIComponent(b) + '=' + encodeURIComponent(a))
                }
                return Z.join('&')
            }
            return H
        }
        function addNextPage(oj)
        {
            if (oj.status == 404)
            {
                tAP.remainFlg = false;
                return;
            }
            var d = document.createElement("div");
            d.innerHTML = oj.responseText;
            var posts = tAP.gP(d.getElementsByTagName("*"));
            if (posts.length < 2)
            {
                tAP.rF = false;
                return;
            }
            var hr = document.createElement("hr");
            hr.className = "tumblrAutoPager_page_separator";
            tAP.pp.appendChild(hr);
            d = document.createElement("div");
            d.className = "tumblrAutoPager_page_info";
            d.innerHTML = "<p style='float:left'><a href=http://" + tAP.LN + "/page/" + p + ">Page " + p + "</a></p>
" + "<br style='clear:both' />";
            tAP.pp.appendChild(d);
            for (var i = 0; i < posts.length; i++)
            {
                tAP.pp.appendChild(posts[i]);
            }
            var footer = $("footer");
            footer ? footer.parentNode.appendChild(footer) : null;
            tAP.rF = true;
        }
        watch_scroll();

        function watch_scroll()
        {
            var d = document.compatMode == "BackCompat" ? document.body : document.documentElement;
            var r = d.scrollHeight - d.clientHeight - (d.scrollTop || document.body.scrollTop);
            if (r < d.clientHeight * 2 && tAP.rF)
            {
                tAP.rF = false;
                p++;
                sendRequest(addNextPage, "", "GET", "http://" + tAP.LN + "/page/" + p, true);
            }
            setTimeout(arguments.callee, 200);
        };

        function $(id)
        {
            return document.getElementById(id)
        };
    },
    switchAutoPage: function ()
    {
        this.rF = !this.rF;
        var aE = document.getElementsByTagName('*');
        for (var i = 0, l = aE.length; i < l; i++)
        {
            if (aE[i].className == "tAP_switch")
            {
                aE[i].firstChild.nodeValue = this.rF ? "AutoPage[OFF]" : "AutoPage[ON]";
            }
        }
    }
};
window.addEventListener ? window.addEventListener('load', tumblrAutoPager.init, false) : window.attachEvent ? window.attachEvent("onload", tumblrAutoPager.init) : window.onload = tumblrAutoPager.init;

finch(pidgin) compile cf.sh edit

pidgin compile options to use finch only. (disable GUI and audio related features)

cf.sh:
#!/bin/bash

PREFIX="/home/me/usr"

export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$PREFIX/libxml/lib/pkgconfig"

PATH="$PATH:$PREFIX/intltool/bin" \

./configure \
--disable-gtkui \
--disable-screensaver \
--disable-sm \
--disable-gtkspell \
--disable-gestures \
--disable-gstreamer \
--disable-gstreamer-interfaces \
--disable-farsight \
--disable-vv \
--disable-idn \
--disable-meanwhile \
--disable-avahi \
--disable-tcl \
--disable-tk \
--disable-pixmaps-install \
--disable-doxygen \
--disable-dot \
--disable-devhelp \
--with-ncurses-headers=$PREFIX/ncurses/include \
--disable-nm \
--disable-perl \

$ make DESTDIR="$PWD/build" install

finch install edit

데비안 lenny 머신에서 apt-get install finch로 설치하고보니 버전이 낮아서 MSN을 지원안한다.
컴파일해보려고 pidgin 소스를 받아 삽질 해봤는데 한글이 자꾸 깨짐.
알고보니 libncursesw를 설치하지 않아서였음 (/2011/05/libncursesw.html)

귀찮아서 그냥 백포트로 설치했더니 MSN이 지원됨 (/2011/05/aptitude.html)

$ sudo aptitude -t lenny-backports install finch

Linux에서 특정 텍스트내의 문자열 찾기 edit

http://fotobank-textcube.blogspot.com/2010/04/100429-linux에서-특정-텍스트내의-문자열-찾기.html

100429 Linux에서 특정 텍스트내의 문자열 찾기
"가나다" 으로 시작하는건 모두 가져와라~~~(해당 폴더 및 하위폴더)

grep -ir 가나다 * ( 가나다와 * 사이에 한칸 띄워야 함)

"가 나다" 으로 시작하는건 모두 가져와라~~~(해당 폴더 및 하위폴더)

grep -ir 가.나다 * 텍스트사이가 떨어져 있을 경우에는 .으로 표시

Shared library - static link specific dependency edit

http://www.mail-archive.com/libtool@gnu.org/msg10643.html

Hello Alon, and sorry for the delay,

* Alon Bar-Lev wrote on Fri, Jun 06, 2008 at 09:15:37AM CEST:
> > > I want to make a shared library without dependencies. I compile the
> > > dependencies in PIC mode, so it should be compatible.

> Let's say I have liba.la pointing to liba.so* and liba.a(pic)
> installed in my system. I am not building this right now.
> Now, I would like to create moduleb.so that use liba but I do not want
> to have external dependency of liba.so*.

Ah, ok. Libtool doesn't really support this. Well, only with
convenience archives, but not with installed stuff. Here's why:

The general idea is that you should not have multiple entities
of the same code in different libraries
, as this can lead to
subtle and difficult-to-analyze bugs. Either your libraries are
shared (and its dependencies are, too), or your libraries are
static, and their code will end up in the final program (but not
in other libraries depending on it). This is how libtool handles
shared libraries and shared modules, and also how it handles
static libraries and dlpreopened modules. Of course the latter
only work with libltdl.

This is also the reason why installing convenience archives is
discouraged: it makes it easy to end up with code being duplicated
into several libraries.

(I suppose you could hack around this by manually copying
libconvenience.la and $(LT_OBJDIR)/libconvenience.a into some installed
location, and use that later; but again, be warned). Maybe libtool
should support this (I think it did at one point in the past), but add a
big fat warning sign. Hmm.

Cheers,
Ralf

What Alon Bar-Lev(questioner) wants



Packet Sniffer Wireshark edit

http://www.wireshark.org/

using wireshark under windows needs winpcap: http://www.winpcap.org/install/default.htm

http://sectools.org/sniffers.html

Wireshark : Sniffing the glue that holds the Internet together
Wireshark (known as Ethereal until a trademark dispute in Summer 2006) is a fantastic open source network protocol analyzer for Unix and Windows. It allows you to examine data from a live network or from a capture file on disk. You can interactively browse the capture data, delving down into just the level of packet detail you need. Wireshark has several powerful features, including a rich display filter language and the ability to view the reconstructed stream of a TCP session. It also supports hundreds of protocols and media types. A tcpdump-like console version named tethereal is included. One word of caution is that Ethereal has suffered from dozens of remotely exploitable security holes, so stay up-to-date and be wary of running it on untrusted or hostile networks (such as security conferences).

OH fuck yeah Wireshark!

vmware 공인 IP 설정 edit

vmware player 3.0 이상의 버전을 사용중이라면 여기에서 네트워크 설정을 해주는 vmnetcfg.exe를 설치해야 하고 VM머신을 위한 공인 아이피가 있어야함.

http://blog.nextcube.pe.kr/tag/%EA%B3%B5%EC%9D%B8ip

vmnetcfg.exe 설정


Bridged의 랜카드를 잡아준다.



VM머신의 네트워크 어뎁터 설정


아래와 같이 설정한다.



DHCP가 설정되어 있지 않다면 VM머신의 OS에서 네트워크 설정을 해주면 된다.

VMware Player 3.0 이상 버전에서 NAT 등의 네트워크 설정 vmnetcfg.exe 설치 edit

VMware Player 3.0 이후 부터 NAT 등의 네트워크 설정을 해 주는 vmnetcfg.exe가 설치가 되지 않는다고 한다. 그렇지만 설치 파일 안에는 들어있다고 하네요. 먼저 VMware-player-3.0.0-XXX.exe에 /e 옵션을 주어서 실행합니다. 압축 해제만 하는 옵션입니다.
VMware-player-3.0.0-203739.exe /e INSTALL_DIR
여러 개의 파일이 설치가 되는데 그 중에 network.cab 파일 안에 vmnetcfg.exe가 숨어 있습니다. 그 파일만 꺼내면 됩니다.

vmware 우분투 한영키 문제 edit

어찌저찌 찾아보니 vmware에서 우분투를 깔면 한영키와 한자키가 인식되지 않는 문제가 더러 있다고 한다.

http://barosl.com/blog/entry/using-han-eng-key-without-kernel-patch

뿌리 권한으로 다음을 실행합니다:

# setkeycodes 71 122
# setkeycodes 72 123

그다음 xev 를 실행시켜 보면, 커널 패치를 하지 않은 상태에서도 한영키가 122, 한자키가 121 로 인식됩니다!

시스템 시작시에 항상 이 명령이 실행되도록 해 놓는 것이 좋겠죠?

그럼 이제 늘 하던대로 xmodmap 만 먹이면 됩니다. ;)

$ xmodmap -e 'keycode 122 = Hangul'
$ xmodmap -e 'keycode 121 = Hangul_Hanja'

흐흐... 굉장한 팁이군요... 커널 패치의 번거로움이 하나 줄겠네요... ^^

내가 적용한 방법


스크립트 생성


/etc/init.d/hangul_setkeycodes.sh

#!/bin/bash
setkeycodes 71 123
setkeycodes 72 122

시작시 자동으로 실행되게끔 설정


# update-rc.d hangul_setkeycodes.sh defaults

다른위치에 설치된 'pkg-config'의 '.pc'파일 'PKG_CONFIG_PATH'환경변수로 컴파일시 인식시키기 edit

http://kldp.org/node/52070

참고로 위 환경 변수 내용을 바꾸기 전에 pkg-config를 실행해서, pkg-config가 제대로 설정 파일을 인식했는지 확인할 수도 있습니다:

$ pkg-config --list-all

문제


libxml을 다른위치에 설치했더니 pidgin 컴파일시 아무리 CFLAG, LDFLAG, LIBS, LIBXML_CFLAGS, LIBXML_LIBS 환경변수들을 설정해줘도 인식하질 못했다.

libxml/lib/ 하위에 pkgconfig 디렉토리가 있는것을 발견하고, 인식시키려고 configure 실행시 환경변수 'PKG_CONFIG_PATH'에 경로를 환경변수 'PATH'처럼 ':'로 구별하여 평소에 하던대로 실행시만 적용되게끔 아래와 같이 실행해도 인식되지 않았다.

$ PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/home/me/usr/libxml/lib/pkgconfig" ./configure

해결방법


아래와같이 환경변수를 export 시킨 후 configure 해보니 인식성공.

$ export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/home/me/usr/libxml/lib/pkgconfig"

/2011/08/finchpidgin-compile-cfsh.html

원인예상


configure 도중 내부적으로 pkg-config 를 호출하는데 처음의 방법은 환경변수를 ./configure 에만 전달하고 pkg-config 에는 전달하지 못해서 생기는 문제일까?

pidgin nateon 플러그인 접속 불가 현상 원인 edit

왜 갑자기 pidgin에서 네이트온 접속이 안되나 소켓을 캡쳐해 봤더니...

네이트온 3.5-3.7버전 일부(3.7.3.0) 종료안내

좀더 다양한 서비스와 편리한 기능을 제공하기 위해 네이트온 3.5-3.7버전 일부(3.7.3.0) 종료하게 되었습니다.

*종료일시 : 2011년 8월 1일(월)

그동안 네이트온 3.5-3.7버전 일부(3.7.3.0)를 이용해주셔서 감사합니다.
네이트온 최신 버전을 통해 계속해서 서비스를 이용하실 수 있습니다.
( http://nateonweb-stage.nate.com/download/messenger/windows/4.1/download.php )
감사합니다.

하지만 네이트온 리눅스버전 클라이언트는 잘 동작함.
Newer -> <- Older