溪夏(xixia)

溪夏,夏天的小溪。

夏天虽然不是我最喜欢的,但是夏天不会那么慵懒。

小溪没有大河大江那样的气魄,但是却很容易亲近。

希望能够像夏日的小溪那样平凡而安静的生活。

新的生活伴随这个花名展开。

powershot SX130 IS的CHDK,可以拍DNG等等

原帖地址:http://chdk.setepontos.com/index.php?topic=5691.75

需要准备的bootable.exe以及中文语言文件请搜索SSCN04.rar,很懒的话就直接用下面的附件吧

首先格式化SD卡:

image

完成后将压缩包解压放到根目录:

image

找到“运行”(win+R)输入CMD:

image

输入你的SD盘符:(我的是H)

H:

bootable.exe H:

image

就ok了!

下面是相机操作了!

把SD保护打开(往LOCK方向推)

插入相机

开机,等待出现chdk的载入提示之后(一瞬间)按笑脸

可以看到屏幕下边有“alt”

按menu进入chdk

先在“Visual Settings -> Menu RBF Font…”下选择字体文件(随便一个都可以),再在“Visual Settings -> Language…”下选择语言文件(只有一个中文的)

现在汉化完成

接下来设置相机拍摄DNG格式的图片

RAW参数设置

勾选保存RAW文件,RAW文件存入JPEG文件夹

如果现在勾选DNG format会提示没有坏点文件

所以必须按按笑脸退出chdk设置,然后按快门,进入拍摄状态

然后按笑脸,进入刚才的地方,选择creat badpixel.bin

相机会自动拍摄两张照片

然后取下SD卡,将保护关闭,找到CHDK文件夹下面的一个BAD tmp文件(具体名字忘记了)将他改为badpixel.bin

重新写保护

插回相机,现在可以设置DNG了

附上压缩包

http://lansepink.appspot.com/media/aglsYW5zZXBpbmtyDQsSBU1lZGlhGPHjGAw/CHDK.zip

为discuz帖子列表页面增加ajax更新

先看效果吧:

image

目的就是使用户能够不用刷新就能获得帖子更新。

第一步:修改模板文件forumdisplay,htm

1、在文件开头添加ajax请求的判断

<!–{if !$inajax}–>

如图:

image

2、在文件结尾加上else

<!–{else}–>
{template header_ajax}
<table>
                <!–{loop $threadlist $key $thread}–>

                <tbody id=”$thread[id]“>
                    <tr>
                        <td class=”folder”>
                            <a href=”viewthread.php?tid=$thread[tid]&amp;extra=$extra” title=”{lang target_blank}” target=”_blank”>
                            <!–{if $thread[folder] == ‘lock’}–>
                                <img src=”{IMGDIR}/folder_lock.gif” /></a>
                            <!–{elseif in_array($thread['displayorder'], array(1, 2, 3, 4))}–>
                                <img src=”{IMGDIR}/pin_$thread[displayorder].gif” alt=”$threadsticky[3-$thread[displayorder]]” /></a>
                            <!–{else}–>
                                <img src=”{IMGDIR}/folder_$thread[folder].gif” /></a>
                            <!–{/if}–>
                        </td>
                        <td class=”icon”>
                        <!–{if $thread['special'] == 1}–>
                            <a href=”forumdisplay.php?fid=$fid&amp;filter=poll”><img src=”{IMGDIR}/pollsmall.gif” alt=”{lang thread_poll}” /></a>
                        <!–{elseif $thread['special'] == 2}–>
                            <a href=”forumdisplay.php?fid=$fid&amp;filter=trade”><img src=”{IMGDIR}/tradesmall.gif” alt=”{lang thread_trade}” /></a>
                        <!–{elseif $thread['special'] == 3}–>
                            <a href=”forumdisplay.php?fid=$fid&amp;filter=reward”><img src=”{IMGDIR}/rewardsmall.gif” alt=”{lang thread_reward}” <!–{if $thread['price'] < 0}–>class=”solved”<!–{/if}–> /></a>
                        <!–{elseif $thread['special'] == 4}–>
                            <a href=”forumdisplay.php?fid=$fid&amp;filter=activity”><img src=”{IMGDIR}/activitysmall.gif” alt=”{lang thread_activity}” /></a>
                        <!–{elseif $thread['special'] == 5}–>
                            <a href=”forumdisplay.php?fid=$fid&amp;filter=debate”><img src=”{IMGDIR}/debatesmall.gif” alt=”{lang thread_debate}” /></a>
                        <!–{else}–>
                            $thread['icon']
                        <!–{/if}–>
                        </td>
                        <!–{if $forum['ismoderator']}–>
                        <td class=”icon”>
                            <!–{if $thread['fid'] == $fid && $thread['digest'] >= 0}–>
                                <!–{if $thread['displayorder'] <= 3 || $adminid == 1}–>
                                    <input onclick=”tmodclick(this)” class=”checkbox” type=”checkbox” name=”moderate[]” value=”$thread[tid]” />
                                <!–{else}–>
                                    <input class=”checkbox” type=”checkbox” disabled=”disabled” />
                                <!–{/if}–>
                            <!–{else}–>
                                <input class=”checkbox” type=”checkbox” disabled=”disabled” />
                            <!–{/if}–>
                        </td>
                        <!–{/if}–>
                        <th class=”subject $thread[folder]“>
                            <label>{$pluginhooks[forumdisplay_thread][$key]}&nbsp;</label>
                            <!–{if $thread['moved']}–>
                                <!–{if $forum['ismoderator']}–>
                                    <a href=”topicadmin.php?action=moderate&optgroup=3&operation=delete&tid=$thread[moved]” onclick=”showWindow(‘mods’, this.href);return false”>{lang thread_moved}:</a>
                                <!–{else}–>
                                    {lang thread_moved}:
                                <!–{/if}–>
                            <!–{/if}–>
                            $thread[sortid] $thread[typeid]
                            <span id=”thread_$thread[tid]“><a href=”viewthread.php?tid=$thread[tid]&amp;extra=$extra”$thread[highlight]>$thread[subject]</a></span>
                            <!–{if $thread['readperm']}–> – [{lang readperm} <span class="bold">$thread[readperm]</span>]<!–{/if}–>
                            <!–{if $thread['price'] > 0}–>
                                <!–{if $thread['special'] == ’3′}–>
                                – <span style=”color: #C60″>[{lang thread_reward}{$extcredits[$creditstransextra[2]][title]} <span class=”bold”>$thread[price]</span> {$extcredits[$creditstransextra[2]][unit]}]</span>
                                <!–{else}–>
                                – [{lang price} {$extcredits[$creditstransextra[1]][title]} <span class=”bold”>$thread[price]</span> {$extcredits[$creditstransextra[1]][unit]}]
                                <!–{/if}–>
                            <!–{elseif $thread['special'] == ’3′ && $thread['price'] < 0}–>
                                – <span style=”color: #269F11″>[{lang reward_solved}]</span>
                            <!–{/if}–>
                            <!–{if $thread['attachment'] == 2}–>
                                <img src=”images/attachicons/image_s.gif” alt=”{lang attach_img}” class=”attach” />
                            <!–{elseif $thread['attachment'] == 1}–>
                                <img src=”images/attachicons/common.gif” alt=”{lang attachment}” class=”attach” />
                            <!–{/if}–>
                            <!–{if $thread['displayorder'] == 0}–>
                                <!–{if $thread[recommendicon]}–>
                                    <img src=”{IMGDIR}/recommend_$thread[recommendicon].gif” class=”attach” alt=”{lang thread_recommend}” title=”{lang thread_recommend}” />
                                <!–{/if}–>
                                <!–{if $thread[heatlevel]}–>
                                    <img src=”{IMGDIR}/hot_$thread[heatlevel].gif” class=”attach” alt=”$thread[heatlevel] {lang heats}” title=”$thread[heatlevel] {lang heats}” />
                                <!–{/if}–>
                                <!–{if $thread['digest'] > 0}–>
                                    <img src=”{IMGDIR}/digest_$thread[digest].gif” class=”attach” alt=”{lang thread_digest} $thread[digest]” title=”{lang thread_digest} $thread[digest]” />
                                <!–{/if}–>
                                <!–{if $thread['rate'] > 0}–>
                                    <img src=”{IMGDIR}/agree.gif” class=”attach” alt=”{lang rate_credit_add}” title=”{lang rate_credit_add}” />
                                <!–{/if}–>
                            <!–{/if}–>
                            <!–{if $thread[multipage]}–>
                                <span class=”threadpages”>$thread[multipage]</span>
                            <!–{/if}–>
                        </th>
                        <td class=”author”>
                            <cite>
                            <!–{if $thread['authorid'] && $thread['author']}–>
                                <a href=”space.php?uid=$thread[authorid]“>$thread[author]</a>
                            <!–{else}–>
                                <!–{if $forum['ismoderator']}–>
                                    <a href=”space.php?uid=$thread[authorid]“>{lang anonymous}</a>
                                <!–{else}–>
                                    {lang anonymous}
                                <!–{/if}–>
                            <!–{/if}–>
                            </cite>
                            <em>$thread[dateline]</em>
                        </td>
                        <td class=”nums”><strong>$thread[replies]</strong>/<em>$thread[views]</em></td>
                        <td class=”lastpost”>
                            <cite><!–{if $thread['lastposter']}–><a href=”{if $thread[digest] != -2}space.php?username=$thread[lastposterenc]{else}viewthread.php?tid=$thread[tid]&amp;page={echo max(1, $thread[pages]);}{/if}”>$thread[lastposter]</a><!–{else}–>{lang anonymous}<!–{/if}–></cite>
                            <em><a href=”{if $thread[digest] != -2}redirect.php?tid=$thread[tid]&amp;goto=lastpost$highlight#lastpost{else}viewthread.php?tid=$thread[tid]&amp;page={echo max(1, $thread[pages]);}{/if}”>$thread[lastpost]</a></em>
                        </td>
                    </tr>
                </tbody>
                <!–{/loop}–>
</table>
{template footer_ajax}
<!–{/if}–>

如图:

image

3、增加模板调用forumdisplay_ajax

                <!–用于ajax自动更新页面 start–>
                {template forumdisplay_ajax}   
                <!–用于ajax自动更新页面 end—>

如图:

image

第二步:添加模板文件forumdisplay_ajax.htm到模板default目录

文件内容:

                <style type=”text/css”>
                    .newnotice{
                        font-size:13px;display:block;padding:5px 1px;margin:2px 0px 2px 0px;cursor:pointer;background:#E3F1FA;border:1px solid #C6E4F2;text-align:center;text-shadow:0 1px 0 #fff;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;z-index:2;
                    }
                    .newnotice:hover{
                        background-color:rgba(0,132,180,0.2);border-color:rgba(0,132,180,0.25);
                    }
                </style>
                <tbody style=”display:none;”>
                    <tr>
                        <td colspan=”7″><div id=”newnotice1″ class=”newnotice” onclick=”shownewthread();”>&nbsp;</div></td>
                    </tr>
                </tbody>
                <script type=”text/javascript”>
                var now=new Date();
                var timeline=Math.floor(now.getTime()/1000);
                var div_unread1=document.createElement(‘div’);
                div_unread1.id=”unread1″;
                div_unread1.style.display=”none”;
                var div_unread2=document.createElement(‘div’);
                div_unread2.id=”unread2″;
                div_unread2.style.display=”none”;
                _attachEvent(window, ‘load’,ajax_forum, document);
               
                function ajax_forum(){
                                document.body.appendChild(div_unread1);
                                document.body.appendChild(div_unread2);
                                setInterval(checknewthread,60000);
                }
                function shownewthread(){
                    var noticetbody=$(‘newnotice1′).parentNode.parentNode.parentNode;
                    noticetbody.style.display=”none”;
                    var newthreads=div_unread1.getElementsByTagName(‘tbody’);
                    var newcount=newthreads.length;
                    document.title=document.title.replace(/(.+)/g,”);
                    for(i=0;i<newcount;i++){
                        noticetbody.parentNode.insertBefore(newthreads[0],noticetbody.nextSibling);
                    }
                }
                function storenewthread(){
                    var newthreads=div_unread2.getElementsByTagName(‘tbody’);
                    var newcount=newthreads.length;
                    if(BROWSER.ie){
                        //如果是ie还要继续判断一下,ie回自动为table添加tbody
                        if(div_unread2.innerHTML.length<=32){
                            newcount=0;
                        }
                    }
                    for(i=0;i<newcount;i++){
                        //div_unread1.insertBefore(newthreads[0],div_unread1.getElementsByTagName(‘tbody’)[0]);
                        div_unread1.appendChild(newthreads[0]);
                    }
                    var newcount=div_unread1.getElementsByTagName(‘tbody’).length;
                    var newtitle=document.title;
                    if(newcount){
                        $(‘newnotice1′).innerHTML=newcount+” new threads”;
                        $(‘newnotice1′).parentNode.parentNode.parentNode.style.display=”table-header-group”;
                        if(newtitle.indexOf(‘(‘)!=-1){
                            document.title=newtitle.replace(/(.+)/g,’(‘+newcount+’)');
                        }else{
                            document.title=’(‘+newcount+’) ‘+document.title;
                        }
                    }else{
                        $(‘newnotice1′).parentNode.parentNode.parentNode.style.display=”none”;
                    }
                }
                function checknewthread(){
                    ajaxget(“forumdisplay.php?checknewthread=” + Math.random() +”&fid=”+fid+”&dateline=”+timeline,”unread2″,”,”,’none’,storenewthread);
                    now=new Date();
                    timeline=Math.floor(now.getTime()/1000);
                }
                </script>

第三步:修改forumdisplay.php(位于根目录)

1、增加数据库查询限制语句

/*用于ajax自动更新页面 start*/
$ajaxunread=false;
$ajaxunread=$inajax && $dateline && $ajaxtarget==’unread2′;
if($ajaxunread)
{
    $filteraddajax=”AND dateline>=’$dateline’”;
}
/*用于ajax自动更新页面 end*/

位置在这里:

image

2、添加到查询中,如图的三个位置

image

第四步:修补一些小的细节

1、这样请求会照成对在线时间统计的混乱,相当于用户可以“挂机”了,所以对于这些请求不能计算在在线时间里

在forumdisplay.php文件里面做修改

updatesession()

修改成

if(!$ajaxunread)updatesession();

不过效果还没有测试。

2、本来在帖子浏览页面(viewthread.php)也是可以增加ajax请求的,样式和方法都类似,但是一般用户关注的帖子都会有短消息提示,所以我们只需要不断请求短消息就可以了(其实是我偷懒了,(^o^)/~)

discuz本身会在页面载入完成后请求一次短消息:

在include/js/common.js文件里面:

_attachEvent(window, ‘load’, pmchecknew, document);

其中的pmcheckmew是ajax请求短消息更新,

所以我们在其下面添加一段:

_attachEvent(window, ‘load’, function(){setInterval(pmchecknew,30000)}, document);

image

为了能够及时的更新短消息,采取的是重新再绑定函数的方法,如果直接替换掉以前的那么页面就需要在等待30s才会检查短消息。

最好更新缓存,生效!

补充:经测试ie5.5以上以及FF、chorme通过!

抓取QQ的好友列表用于导入其他IM

最近的3Q大战很激烈,不管怎么说对于我们来说已经对QQ开始动摇了。好多朋友都开始转移到MSN、Gtalk等等服务。

可是qq很吝啬,没有提供好友导出功能。

一时冲动写了一个php小程序来抓取所有好友列表。主要原理是利用qq邮箱来获取好友列表。

一些细节问题在源代码中都有说明,为了能够让大家多用一点时间,不会像MSN的导入功能那样短命,于是不说明了。

本实例采用的方法有很多bug,毕竟只是几个小时写出的东西,希望大家完善它吧。

记得看到云风的一个想法,我觉得要是他的想法在这个程序的基础上增加邮件以及数据库就能够实现了。原文:QQ 用户关系的迁移

截图:

image

下载地址:http://cid-e594a9a9f877361e.office.live.com/self.aspx/.Public/qq%5E_login%5E_.zip

在线测试地址:http://bt.sicau.edu.cn/qq/

(由于服务器端通过snoopy抓取,所以有点慢,请耐心)

校园网(华为,锐捷,Dr,VPN等环境)中,在寝室中布置无线网络

在我们学校,上网是要通过网线拨华为客户端才能上网的。但是常规的无线路由是不能拨802.1认证的,于是在寝室我们不能像在家里面一样使用无线路由。但是我们可以通过无线交换机的配置,使我们可以通过无线拨号上网,具体操作如下。

首先我们想像家里的ADSL一样直接连接无线就上网是不太可能在寝室里面实现的。我们只能连接上无线之后再打开你的拨号客户端拨号成功才能上网。

我配置的是TP-link的无线路由,首先我们直接我们的电脑于路由的LAN扣相连接,设置路由的上网方式为动态IP,然后确保笔记本能够获取到无线信号,并可以连接上。

我们参看TP-LINK官方文章说的http://www.tp-link.com.cn/pages/article-detail.asp?result=faq&d=37,需要关闭DHCP,但是在我们学校不是动态获取IP的,所以我们可以不用关闭,反之情一定要关闭DHCP。

关键部分来了:大家注意路由的插口一般是五口,其中一个与其余四个不相同的。我们不使用哪个特别的插口(WAN),只使用四个LAN即可,将你的主网线(或者你上网的网线)插入四口之一。

然后使用你的笔记本,修改你的无限的上网参数(即IP,掩码,网关,DNS),注意还有一个是必须要修改你的无线网卡mac地址,如果不能修改就去学校改吧。接着连接无线网络,打开拨号软件选择无线网卡开始拨号。

大家是不是成功了呢?

其实操作十分简单,主要是不要插错了端口,另外如果寝室有台式机同样可以插剩下的WAN口上网。

主要难点是修改网卡的mac地址,大家可以在网上搜索,这里就不在多说了。

地址:http://www.feeqi.com/09/13/106001.html