玉世界加入天气预报

    2012年3月21日。为了纪念本人迎来了25岁生日,在玉世界上加入了“天气情况”区域。该区域会根据访问者的ip进行动态提示近2-3日的天气情况。当然,如果获取不到相关的地区信息,则会默认提示上海天气。

    当然php和JQueryAlax都还不太熟悉,也都是自学的。因此我还以可能会有些BUG。如果您在访问玉世界时,“天气情况”区域出现了莫名其妙的异常显示,请留言告知。THX!

    天气信息是用JQueryAlax动态获取的,这样不会影响到界面载入。在获取时,“天气情况”区域提示“获取中”:

    本人在帝都,获取之后进行显示:

文章分类: JQuery, PHP, 玉世界历程 | 标签: , | 我要评论

工程硕士英语Unit 1-My First Job

My First Job

Two noted Americans explain why it’s not what you earn – it’s what you learn

The Auto Prepper(Jay Leno)

    I acquired a very strong work ethic from my parents, both of whom lived through the Great Depression. They couldn’t understand people who didn’t work regularly. I once told my mom that Sylvester Stallone was getting $12 million for ten weeks of work.”What’s he going to do the rest of the year?”she asked.

    I took my parents’ work ethic into my first job at Wilmington Ford near my hometown of Andover, Mass, when I was 16.I worked until five or six o’clock on school days and put in 12-hour days during the summer as a prepper. This meant washing and polishing the new cars, and making sure the paper floor mats were in place. Another responsibility was taking off the hubcaps at night, so they wouldn’t get stolen, and replacing them the next day. This was hard work because we had about seven acres of cars.

    One day, carrying an armful of hubcaps around a corner, I almost bumped into our new general manager. Startled, I dropped them all. He fired me on the spot.

    I was too ashamed to tell my parents. Every day for about two weeks, I stayed busy until evening. Then I would go home and say I had a great day at work.

    Desperate, I wrote a letter to Henry Ford II and told him what happened. I said that we were a loyal Ford family and that when I was old enough, I was going to buy a Mustang. Eventually the owner of the dealership called. “I don’t know who you know in Detroit,” he said,”but if you want your job back, you got it.”

    Later, during college, I wanted to work at a Rolls-Royce dealership, but the owner said there were no openings. So I started washing cars there anyway. When then owner noticed me, I said I was working until he hired me.He did.

    It takes persistence to succeed. Attitude also matters. I have never thought I was better than anyone else, but I hanve always believed I couldn’t be outworked.

[Continue reading ]

文章分类: 英语 | 标签: , | 我要评论

.NET之栈,堆,值类型,引用类型,装箱,拆箱

引言

  这篇文章是我很早之前看到的,当时解决了我很多疑惑的地方。现在拿出来与大家分享。本篇文章主要介绍.NET中6个重要的概念:栈,堆,值类型,引用类型,装箱,拆箱。文章开始介绍当你声明一个变量时,编译器内部发生了什么,然后介绍两个重要的概念:栈和堆;最后介绍值类型和引用类型,并说明一些有关它们的重要原理。

  最后通过一个简单的示例代码说明装箱拆箱带来的性能损耗。

 

声明变量的内部机制

  在.NET程序中,当你声明一个变量,将在内存中分配一块内存。这块内存分为三部分:1,变量名;2,变量类型;3,变量值。

  下图揭示了声明一个变量时的内部机制,其中分配的内存类型依据你的变量类型。.NET中有两种类型的内存:栈内存和堆内存。在接下来的内容中,我们会了解到这两种类型的详细内容。

  

[Continue reading ]

文章分类: C# | 标签: , | 我要评论

JQuery实现开关灯按钮

    由于玉世界一直使用黑色系,有些反主流。可能不太适应部分网友的阅读需求。加之最近在学习JQuery,很想练练手。所以做了一个像土豆网一样“开灯/关灯”的按钮,来改变色调。但这个关灯后的效果的确不敢恭维。土豆的效果也一样不好接受…

    采用toggle()方法,就可以不用判断开关灯的状态,直接顺序执行参数里的函数。另外之前还引入了其他的js包,对JQuery包有参冲突,解决方式也在如下的代码中实现。用noConflict()方法重新定义为$j。



  1. <script type=“text/javascript”>   

  2. var $j = jQuery.noConflict(); //解决js库冲突,$j赋值给jQuery   

  3. $j(function(){   

  4.     $j(“#lightSwitcher”).toggle(function(){   

  5.         $j(“#wrapper”).css(“background-color”, “white”);//改变背景颜色   

  6.         $j(“h2 a,p,#site-description,#site-title a”).css({“color”:“black”});//改变文章标题,正文,站点标题,站点描述的颜色   

  7.         return false;//不执行链接跳转   

  8.     },function(){   

  9.         $j(“#wrapper”).css(“background-color”, “black”);   

  10.         $j(“h2 a,p,#site-description,#site-title a”).css({“color”:“white”});   

  11.         return false;   

  12.     });   

  13. })   

  14. </script>  

文章分类: JQuery | 标签: , | 我要评论

JQuery选择器

    这几天在研究JQuery,所以在这里写上了一些JQuery选择器。一是当做学习笔记,巩固一下记忆,而是提供给更多的网友以供学习和查询。下面蓝色字是选择器的名字;跟在后面的正常字是解释;还有些选择器的最后有黄色字是这个选择器的示例。

基本选择器

#id 根据给定的id匹配一个元素 $(“#test”)选取id为test的元素
.class 根据给定的类名匹配元素 $(“.test”)选取所有class为test的元素
element 根据给定的元素名匹配元素 $(“p”)选取所有的<p>元素
* 匹配所有元素 $(“*”)选取所有的元素
selector1,selector2,…,selectorN 将每一个选择器匹配到的元素合并后一起返回 $(“div,span,p.myClass”)选取所有<div>,<span>和拥有class为myClass 的<p>标签的一组元素

层次原则器

$(“ancestor descendant”) 选取ancestor元素里的所有descendant元素 $(“div span”)选取<div>里的所有的<span>元素
$(“parent > child”) 选取parent元素下的child元素 $(“div > span”)选取<div>元素下元素名是<span>的子元素
$(“prev + next”) 选取紧接在prev元素后的next元素 $(“.one + div”)选取class为one的下一个<div>元素
$(“prev ~ siblings”) 选取prev元素之后的所有siblings元素 $(“#two ~ div”)选取id为two的元素后面的所有<div>兄弟元素
[Continue reading ]

文章分类: JQuery | 标签: , | 我要评论