Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of module_invoke_all(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file in /home/.megatoes/geniusy/geniusy/drupal/modules/fuzzysearch/fuzzysearch.module on line 324
Blogs | Geniusy's Blog

Blogs

原来龟兔赛跑是有四次的

今天马哲课上听到了一个全新版本,也可以说是一个大综合版本的龟兔赛跑故事,感触颇深,写出来与大家分享。

第一次:一只乌龟和一只兔子举行了一次赛跑,比赛一开始,兔子就将乌龟远远的甩在了后面。兔子心想自己是胜券在握的,于是就在半路睡起了大觉,等它醒来时发现乌龟已经一步一步的爬到了终点。

这是大家都耳熟能详的版本,告诫我们要始终如一,坚持不懈;

Tags: 创造环境, 团结协作, 始终如一, 自身条件, 龟兔赛跑

CISA+ICFE+NCR3+2门ACCA

既然没有勇气创业,就得面对现实。但既然为人家打工,也得找个好的雇主,四大是无数财会人的梦想的起点,我也不能脱俗。竞争是残酷的,人才的过剩的。要想脱颖而出,就得让人家看到你比他人闪光的地方。浑浑噩噩,两年半就过去了,到目前为止,就考了CET-4,CET-6和NCR-2,ACCA应该是过了8门,真是惭愧啊。前几天和Samson学长谈了一下,才感觉到了时间的紧迫。明年的这个时候,好的工作基本上就已经尘埃落定了。要想为之前的求职环节增加砝码,唯一的机会就是下学期。

在为我自己找一个定义时,可以用精通网络的财会人或者精通财会的网络人,我现在更倾向于前者。虽然我努力想让自己更加的IT-Professional,但是从学长的反馈来看,我那样定义自己无疑会在与交大、复旦计算机专业高材生的较量中败下阵来。虽然我们学校并不出名,某些人还认为很垃圾,但不可否认的是在财会,特别是审计方面还是有些地位的,这也是每年都有不少学姐学长在与上财、复旦财会高材生较量中胜出的原因。

选择好了对自己的定义,就相当于明确了方向。奋斗方向很明确——有IT特长的财会毕业生;奋斗时间也很明确——一半年,也就是一学期。

Tags: acca, CISA, ICFE, NCR, 四大, 奋斗

Tabular menu items in Drupal

tabluar-menu-items/teaser.

In today’s excercise, we are going to adapt some nice styles to the Drupal menu items. There is a widely known CSS technique called sliding doors which became very popular since it became published. We are going to spice this a little more with extra hover states and implement sprites to improve the performance a little. This will involve a little PHP code – overriding a themeable function, and some CSS markup.

Let’s start with a piece of generated html code:

<ul class="links-menu">
<li><a href="/free">Download templates</a></li>
<li><a href="/about">About</a></li>
<li class="active"><a href="/blog" class="active">Blog</a></li>
<li><a href="/contact">Contact</a></li>
</ul>

This is how Drupal renders primary links. Notice the active menu item which is set by a CSS class active on both the <li> and <a> tags. Since the anchor element’s parent is set to a class, it makes extremely easy to theme nice menu items.

Let’s create a background image for the tabs. Our tab will have four states: one for a regular item, one for hover, and both of them once they’re .active. I prefer using sprites as this will improve performance a little: loading several little images takes more time than loading one bigger image which holds all the necessary background elements.

So I decided to come up with this tab image.

Tags: drupal, menu, Tabular

Dealing with taxonomy display

A little foreword on Drupal theming

Most of you reading now aware of that it’s said: Drupal is a great CMS. It is a completely flexible platform and serves as a great foundation to build nearly any kind of website. It has a well structured system which nearly completely separates code, content and style. Perhaps this flexibility causes most issues when dealing with theming. Creating templates for Drupal is wonderfully simple when it comes to the basics. Vast documentation and a helpful community stands there for the template developer but there are so many possibilities and so many available options that it’s often not enough.

Apart from creativity, developing themes for Drupal needs a widely open brain who understands the logic behind the scenes and can take the advantage of flexibility. Indeed it needs both a designer and a developer in mind.

During one of my latest works I realized why the majority of Drupal themes are very similar, because its developers don’t take their time to go beyond the basics. I believe this is a must if you wish to create something that you want to be outstanding from the crowd. Nada to say Ubiquity isn’t that outstanding that way, too. As you can see it only serves basic needs but it might be a nice base for customizing.

Anyway, I decided to publish some of my theming tricks, bits and pieces what I used before. It will cover css, php and Drupal. I mostly use the core PHPTemplate engine. Why not using some of the custom engines like Smarty? Smarty is great but I believe performance is really what shouldn’t be overlooked and the richer the template engine is in features the faster it will die under high load. PHPTemplate is just fine for what we do.
Cut to the cheese

Enough said, let’s deal with taxonomy display.

Tags: display, taxonomy, 分类信息

Firefox切换标签(TAB)迟钝问题解决办法

  本来是冲着FF打开网页速度快才用它的,但没想到切换一下页面都要先顿2秒钟,真是无语了。Google了几次,也都没找到好的解决办法。
  今天将FF升级到3.0发现不迟钝了,但提示google工具条和alexa工具条不能用了。我就在想了,问题会不会是出在google工具条和alexa toolbar上面呢?于是又换回2.0,毕竟3.0下面兼容性问题还很多,而且做网站的,没这两个工具条怎么行呢。我先把google工具条禁用,问题解决,2.0下面也不顿了,alexa工具条就没试了。
  先是找出了问题处在google工具条上,但是没它也不行啊,所以就准备再从它的各个功能下手。当只关闭翻译菜单的时候,切换也不迟钝了,终于找到元凶了,现在FF终于工作正常了。
  最近经常用FF,的确是越来越喜欢上它了,FF+IETAB,基本上任何网页都没问题。所以今天顺便又搜了一下linux ietab,不过让我很失望,linux下面不能直接用ietab的,ietab调用的是ie的核心,虽然可以通过wine安装IE,然后安装IETab,但还是打消了给小黑装linux的想法,我没办法离开IE,也没办法离开微软的。谁叫我是以淘宝为生的人呢?

Tags: firefox, tab, 切换, 标签, 迟钝

X61无线问题终于解决了

  X61在vista下面无线不能上网的问题已经困扰我两个月了,一直没时间好好弄一下,所以只能把无线路由当有线路由用,今天终于圆满解决了。
  买来后无线一直是好的,只是X61的无线信号接收能力不怎么好,这是大家都知道的,但是在家里面用还是没问题的。不知道什么时候突然无线不能上了,能连上,IP也能分配到,192.168.1.2嘛,正常的,但就是显示无法识别网络,外网不能上,连无线路由的控制面板都连不上。Goole了几次,都没找到解决办法,我已经彻底失望了,准备换回XP。但前几天vista升到了SP1,速度更流畅了,也解决了C盘空间不足的问题,我真没理由重装系统了。今天抱着试试看的态度,又搜了一下,还是未果。网上有人提出自己设定IP的建议,我虽然知道问题不是在这儿,因为我已经自动分配到正常的IP了,但还是试了一下,结果当然是和我预想的一样了。但刚好凑巧了,在无线网络连接的属性页面我发现了一个异常项目,Dr.com ARP Firewall Driver。我之前转过Dr.com的登陆程序的,因为在学校上无线的时候可以用。前段时间学校无线经常受ARP干扰,所以提供的是Dr.com最新版的登录程序,自带了ARP防火墙。刚装上的时候发现有这个我还挺兴奋的,因为360的ARP防火墙不能用在vista上面,而这个可以正常使用,但没想到它就是阻截我无线连接的元凶。把它卸掉,一切正常了,还到Netgear美国官网下载了最新版的固件,可以解决链接数过多时的死机情况。但说到这儿我就又比较气愤了,首先,Netgear中国官网上面一次固件都没更新过,在线播放的时候经常就会无故掉线;其次,人家WGR614在美国官网上面都出了V9版本,国内最新的还是V7版本,问题多多。

Tags: vista, X61, 无线, 路由, 连接, 问题

一点圣诞的气氛都没有

  圣诞节,在国外是多么隆重的节日。而我,在国内,却一点都没感觉到,只在中午下课后在校门口碰到个送花的快递员。今天没有在床上躺了,昨晚睡了一觉,今天精神也特别好,但比较迷茫,不知道该做什么。
  到教室去了一下,没听课,又回来了。收到了几条短信,一条都没回。哎,现在特烦短信,也特烦人家来找我,貌似越来越自闭了。估计元旦的时候就没人给我发短信了,呵呵。
  今天又发现了一套模板,multiflex,感觉挺不错的,准备转到drupal上来,最新的drupal还没有,有的是2.0版本,不好看。
  其实itheme这个风格我也是越看越好看,但是就是在IE6下面有重大问题,我都不忍看。不过我小黑装的是vista,所以眼不见心不烦啦。但最近还是准备把问题找出来给修复了,这的确是套不错的风格。
  昨天心血来潮,准备做个垃圾站,也就是guokuai.com,但是捣弄了几个小时火车头,总是出问题,如果是用dedecms,ecms或者phpcms的话,采集简直是小菜一碟,但谁叫我现在爱上Drupal了呢?
  想来想去,还是觉得把xy2s.com做好是当务之急,然后就是把52acca改版,做垃圾站真不是我的特长,而且我的精力也太有限了,不能浪费到垃圾站上面。

Tags: 圣诞, 气氛

太兴奋了,百度收录了!

  呵呵,我说的当然不是这个网站了,geniusy.com被收录是很正常的。我指的是52acca,不过不是52acca.com,是52acca.cn,之前准备从dedecms转到phpcms时的试验站点,全部文章都已经转换过去了的,但是之前查一直也都没收录,今天无意中site:52acca.cn了一下,发现竟然有100多页收录了,我今后到底该怎么办呢?难道要从52acca.com转到52acca.cn,这太不像话了吧?况且现在网站多数流量都是老客户,都只知道52acca.com,如果转的话会损失很多客户的;其实,google对我的站还不错,关键字排名都很靠前的,acca已经排到第二位了,这都不是新站所能达到的权重啊。哎,这可真让我为难了啊,以前正常情况下百度的流量是google的两倍,如果没被baidu封站的话,网站流量可以轻松翻番的。

  谁可以给我点建议啊,如果真转域名的话,是可以通过url_rewrite将google的流量暂时转到52acca.cn的,但是一段时间后链接肯定会被降权的,到时候从google来的流量也就真是没落了,而且百度到底会怎样对待我的站,这也是个很大的未知数啊。

刚才还google了一下,发现同样也是很令人欣慰的一件事。我之前发的那篇文章竟然在发布后半个小时内就被收录了,google的效率真高啊,倒是百度最近倒像是人到老年了,要么不收录,要么N天才来收录几页,哎,难道真的是中了百毒?

Tags: 52acca.cn, 52acca.com,google, site, 收录, 百度

Drupal常用API函数列表

comment_num_all($nid):调用评论数,$nid为node的ID,当前node可用$node->nid。

taxonomy_get_tree($vid):显示分类(item),vid为category的ID,必须是category,不能是item,也就是说只能显示父层下面的item。

taxonomy_get_children($tid):显示Item下面的item,$tid为父item的id。

menu_get_menu():Return the menu data structure.不带参数,显示系统所有的menu。

menu_primary_links($start_level = 1, $pid = 0):pid可以指定起始层数,start_level貌似意思也差不多,还没实验过,有时间试试再说,下面是英文说明:
$start_level This optional parameter can be used to retrieve a context-sensitive array of links at $start_level levels deep into the Primary links menu. The default is to return the top-level links.

$pid The parent menu ID from which to search for children. Defaults to the menu_primary_menu setting.

menu_overview_tree:Present the menu tree, rendered along with links to edit menu items.

menu_get_item($mid, $path = NULL):Retrieves the menu item specified by $mid, or by $path if $mid is not given.

node_last_viewed:Retrieves the timestamp at which the current user last viewed the specified node.放在首页可以返回用户上次访问网站的时间。

referer_uri:Return the URI of the referring page.可以用来统计来源页面。

request_uri:Since $_SERVER['REQUEST_URI'] is only available on Apache, we generate an equivalent using other environment variables.任何服务器系统下面都可以使用。

sess_count($timestamp = 0, $anonymous = true):Counts how many users have sessions. Can count either anonymous sessions, authenticated sessions, or both.貌似可以分别统计在线会员与游客数了。可以通过指定$timestam来实现15分钟内在线人数效果。

statistics_title_list($dbfield, $dbrows):
Description

Returns all time or today top or last viewed node(s).

Parameters

$dbfield one of

Tags: api, drupal, function, 函数, 功能

Drupal如何调用文章阅读次数和评论次数

初次接触Drupal的新手可能会和我一样手足无措,本来很简单的功能都没办法实现。调用阅读数和评论数真是很简单的功能,如果使用其它CMS或者Blog CMS,这些一般都能从官方默认的模板或者使用帮助中找到,但是Drupal就不同了,什么都得靠自己摸索。

为了调用这两个变量我首先想到的是在数据库里面找,但是非常令我失望,drupal的node表里面根本没记录阅读次数,评论到是可以通过count一下comments表里面每个nid出现的次数得到,但是每次那样也未必烦琐了一点。

在DrupalChina里面提出了这个问题,第一个问题得到了解答:先要在后台,“管理”-“日志”-“访问记录设置”里面启用“页面访问计数”功能,然后就可以通过<?php
print $node->links['statistics_counter']['title']
?>语句调用node阅读次数了。

显示评论数是我自己摸索出来的,在api.drupal.org上面找到了三个函数,comment_num_all,comment_num_new和comment_num_replies,我只用了第一个,后面两个具体什么功能没用过,官方上也没说明。但我要的功能达到了,在需要显示评论数的地方加上<?php print comment_num_all($node->nid) ?>语句就OK了。

上次在api.drupal.org上还找到了一个显示分类的函数,我现在右边的分类就是用taxonomy_get_tree($vid)和taxonomy_get_children($vid)来获取分类(category或者taxonemy),这样就可以不需要自己写SQL语句了,其实这些函数就是由一些SQL语句组成的。有空的时候可以多到api网站上转转,上面可以找到很多好用的函数的。

Tags: api, comment_num_all, drupal, node, statistics_counter, taxonomy_get_tree, 文章, 次数, 评论数, 调用, 阅读