intall ruby on rails on Mac 0S X 10.9 tutorial link
http://railsapps.github.io/installrubyonrails-mac.html
we're not kids anymore.
No title available

No title available

Kiana Khansmith

#extradirty
h

Andulka
Mike Driver

roma★

No title available
taylor price
Show & Tell

shark vs the universe
Monterey Bay Aquarium

PR's Tumblrdome

★

Origami Around
sheepfilms
Misplaced Lens Cap

Product Placement

seen from Italy
seen from United States
seen from Poland

seen from Netherlands

seen from Malaysia

seen from Malaysia
seen from United States
seen from United Kingdom
seen from United States

seen from Canada

seen from Germany
seen from Germany

seen from United Kingdom
seen from United States

seen from France

seen from United Kingdom

seen from Hong Kong SAR China

seen from Canada
seen from United Kingdom
seen from United States
@guangyi-flyaway
intall ruby on rails on Mac 0S X 10.9 tutorial link
http://railsapps.github.io/installrubyonrails-mac.html
solution to Eclipse start project doesn't has settings.py
Use python shell to start a project, for me it's not easy to import into Eclipse--can't find that project.
So after starting a project from shell, go to eclipse, start a project in eclipse where that project stored. Use the same name, and eclipse automatically "import" settings.py files etc.
How to center an element vertically
This is the blog I learned from.
Basically it creates pseudo element ('ghost element') within the parent container.
Take a look, it's very helpful
还是你
其实多么清楚 这是理性与感性的挣扎。 虽然我喜欢他,但他不曾走进我的内心。 喜欢又不一定适合。 在一起时的passion带不来我所需要的温暖和依靠。 他是谁,我又是谁。 分开只是时间问题,只是如何的分开。 即便明知这样的结果,现在却依旧不放手让自己走,这算飞蛾扑火么?还是这只算傻? 其实,他完全不了解我。 在他面前不敢展现那个脆弱敏感的我。
Django: Find and kill all running manage.py processes
To list all running processes of manage.py:
ps aux | grep -i manage
You probably get something like this:
14770 30144 0.0 2.1 612488 44912 ? S Sep18 0:00 /usr/local/bin/python manage.py runserver 0.0.0.0:8000 14770 30282 0.0 1.9 678024 40104 ? S Sep18 0:00 /usr/local/bin/python manage.py runserver 0.0.0.0:8002 14770 30592 0.0 2.1 678024 45008 ? S Sep18 0:00 /usr/local/bin/python manage.py runserver 0.0.0.0:8003
To kill a paticular process:
kill -9 30144
Study note: Set up Django+MongoDB+Django MongoDB engine
As a background, I just begin to study MongoDB and have a little knowledge of Django.
This is more like a study note to help me remember how did I finish every step.
I use Django + MongoDB +Django MongoDB Engine And this is the tutorial I followed to create a single user blog application.
To install and setup MongoDB, I use this tutorial. I think it's detailed than the official one
1. install pip I don't know why I didn't install it before.... Here is the steps I followed to install pip
But I have to add "sudo" in front of the commands to get permission
Below are some very import steps...I messed up at first, and it took me a very long time to find out why! It almost drive me crazy...
2.install Django MongoDB Engine: Following the setup tutorial
a: install virtualenv
$sudo pip install virtualenv
b: I'd like to create Django project first. Because we will use it later. Change into the target directory, and input
$django-admin.py startproject myproject
This will create a folder called "myproject" and under that folder there are some python files. One of them is called settings.py, another is manage.py.
DO NOT skip step c and d to install the following python packages! Skipping those two step was a mistake I made which made the setup of Django_MongoDB_Engine so annoying....I had no idea what is virtualenv when I began to install the Engine, now I have better idea what it's for.
c:Set up a virtual environment for "myproject", Not inside "myproject" folder, but in the container of "myproject" folder, use:
$virtualenv myproject
This will initialize the myproject folder with python site-package and something essential. It will create /bin, /lib etc... folders. d:Activate it use:
$source myproject/bin/activate
e: Make sure the virtual environment is active now! and then install Djang_nonrel and toolbox and that engine.
$sudo pip install git+https://github.com/django-nonrel/[email protected] $sudo pip install -U git+https://github.com/django-nonrel/djangotoolbox/@toolbox-1.3 $pip install git+https://github.com/django-nonrel/[email protected]
4.Set up Django database: In the settings.py(/myproject/settings.py) find DATABASES, and do the changes as below.
DATABASES = { 'default' : { 'ENGINE' : 'django_mongodb_engine', 'NAME' : 'my_database' } }
5.Create my_database in the terminal, input "$mongod" to start the MongoDB server, and in another terminal window, input "$mongo" to start the database shell. to create and switch to my_database:
use my_database
6.Test it: under the "myproject" folder, where manage.py locates, try
$python manage.py runserver
If you see this:
Validating models... 0 errors found Django version 1.3.7, using settings 'myproject.settings' Development server is running at http://127.0.0.1:8080/
Then Hurray! it success!
But you may also see some other errors like what i have experienced...Frustration. 1.If you see the error message, like "'django_mongodb_engine' isn't an available database backend.. No module named utils" .
It may caused by no activate the environment. or if you do activate it, but still see this message, then the toolbox version is not correct. Make sure its version is 1.3. After I reinstall toolbox, it works!
2.You may also see this: "ImportError: No module named core.management"
In my case, while activate the virtual environment, I will see this message. Go to /myproject/lib/python2.7/site-packages (you may use different version python) if you couldn't find django, django_mongodb_engine, djangotoolbox, that probably means when you install these packages, you are not activate the virtual environment! That's my mistake. I also can't import django while in this virtual environment.
But probably you have other reasons other than mine, this is a related stack overflow questions and answers I think may helpful.
BTW, the first line in my manage.py is #!/usr/bin/env python I didn't change it.
These are almost every step and problems I encountered during the setup.
If you are newbie like me, I hope this is helpful~
Taking a break now~~~
AngularJS $watch() function
$Scope.$watch(watchExpression, callbackFunction);
"The first parameter of the $watch method (the "watchExpression") can be either an Angular string expression (that is evaluated against the $scope), or a function, which is called with $scope as the first parameter. "
So if I want to watch the current URL with $location.path(), I need to do it this way:
$scope.$watch( function(){
return $location.path();
}, function(value){
// here value = current location path.
// Do what you want with value.
// if there are two parameter with value, the first is newValue, the second is the previous location path.
}
有点难受的时刻
总是猜测你喜欢她。因为我感觉到的是,你总是给予她更多关注,而不是我。
我的照片,状态你会忽略,而我总是在意你的回应。
不能控制你喜欢谁。但是我会在意,会心里难受。我不喜欢这样的自己,不自信的自己,在她面前不自信的自己。我想这样的情况以后还会有很多吧,总是会有无谓的比较,觉得自己败下阵来。但是实际上,没有必要比较,也没有输赢,心态,都是心态。但是稳定到一个最好的心态,我想我还需要给自己一些时间。给自己时间更多的接受自己,了解自己,完善自己, 把重心放到自己身上。
我知道我能做的就是慢慢放下,不去在意,同时不断做好自己,做自己想做的事。
嗯,写出来就好多了。
已不知道你离开多少天
喜欢,但也许不合适。 大概你是一个适合用来怀念,不适合做陪伴的人吧。 即便如此我还是决定给自己时间,用来继续喜欢你,时间到了再慢慢放下,虽然在那片夜晚的沙滩,我已在心里和你道别。
You are my lovely one
so sweet~~~~
多久
其实,喜欢的不过是喜欢的感觉;回忆的不过是回忆本身;喜欢的和回忆的都是我做付出的感情和时间。其实,不是你。其实和你无关。
理性的明白了,感性上接受需要多久?
想念。
想念一个人大概就是在逛超市时会忽然想起他喜欢在蒸米饭时放两根这个牌子的香肠;吃水饺时要放泰式辣酱;觉得那种干脆面一样的零食好吃的要命;还有noosa的酸奶必须原味才正点。
大概就是开到某条路上时会忽然想起当时在他车上对他说竟然不用gps就知道从这种小路如何上90高速好厉害;或者开到另一条路上时我们一起跟着音乐合唱lonely Christmas
这么多场景这么多条路,我默默陷在记忆中,一个人走一个人回忆。没有放声大哭 没有眼泪成河,似乎害怕一旦有一点松口就会决堤。他大概早已将他们丢在风中。我装作不在乎,我努力让自己不在乎。
对于拥有的东西总是不够关心。难道不该是自己喜欢的倾注最多的时间精力和感情,而不是其他人么。是不是关注的焦点才是喜欢的东西。一定要等到有一天她选择退出,选择离开,消失不见才会意识到之前不够珍惜么,那时还有意义么。
我希望被你关注的需求总得不到满足,别人却可以。
我在你身上浪费什么时间。
请再也别手贱
再也不手贱,点什么like她的照片。就不能对自己好点么,明知道自己接受不了他对她的关注。何必展示出来看似的和睦而伤了自己。也许他没什么意思,但是自己还是接受不了那就别让自己再有被伤害的机会。 还没强大到可以伪装且不心疼,那何必要伪装。忽略就好了。 想结束却没有勇气。
在乎不在乎
第七天。
我始终觉得,我在乎你,但是你其实没那么在乎我。
距离会放大一个人的优点,模糊一个人的缺点。
我明知这点,却做不到阻止自己被它影响。
每天的情绪要不因为想你而低落,要不就是学习时的理性没有情绪。
我该怎样让自己开心起来。
好想再简简单单 彻彻底底的开心笑很久 很久。
不过第七天,再多给自己点时间。
我想要的,是一个可以温暖我的人。
是一杯热咖啡,或许是一杯温开水。但绝不是冰镇可乐。
第六天
一晃6天过去了。
你走的第三天,我去跑步。是不是身体疲倦的时候情感也是最脆弱。‘
路过margarita的时候,想起曾经的种种,那些关于这里的记忆就又浮现上来,走在路上就默默哭了。
你走的第四天,我去参加了meet up. 关于Git. Git 第一次还是你讲给我的。在我的房间,温暖的灯光下,你熟练的讲解操作着。这次meet up讲的大部分都是你曾经告诉过我的东西。我走在charlse river边,看boston夜景,想起你。
你走的第五天,我和上次party上认识的另外三个女生一起聊天吃饭。我们四个女生聊的很来。其中一个女生,我觉得从她身上我会学到很多东西。她们不知道我们的关系。
你走的第六天,我在target买了和你的完全不一样的漱口杯。我换掉了一层卫生间和你用的一样的洗手液。我努力想减少想起你的时间,但是走到哪里都是你的影子,连ihop和那个小操场都没有放过。
似乎你走以后,有你痕迹的东西就特别多,或者说我看到的都是和你有关的东西。今天你给我电话说你不适应那里的生活,我很想去给你温暖,给你归属感,可是我的归属感在哪里呢? 我也知道像今天这样你说你不适应的日子,在以后会逐渐减少到没有;但是像今天这样回忆泛滥的日子,对我来说也许还有很多。我都要都要这样一个人回忆,都要这样默默流泪,都要一个人挺过来。
这多不像我的风格呀。我怎么会让自己伤心难过呢。但是不知道为什么,明明知道你不完美,明明总是告诉自己you are not the one for me,却还是让自己在回忆里沉沦。
我以为我适应的挺好,没有你的生活,更自由更独立更有我的味道。但是忽然一下,又成了这个样子。
给自己点时间吧,我会努力适应没有你的日子的。
How to create image slider with javascript
There are many image sliders on the internet. Most of then are written by jQuery. I just want to learn JS and get a better understanding of it, so i use javascript to complete it.
you can find the demo here:
1.basic:http://cssdeck.com/labs/image-slider-1
2.with prev/next button: http://cssdeck.com/labs/imageslider-button
3.with pager: http://cssdeck.com/labs/imageslider-pager
Demo 1 is different from demo 2 and 3
demo 2 and 3 are using the same core codes.
Below is how to do the basic one--move to the next image after a set of time interval. no user interrupt.
The basic id of image slider is to create a long list. actually is a long <ul>
the html part is this:
<div class="container"> <div class="image-slider-wrapper"> <ul id="image_slider"> <li><img src="./image/1.jpg"></li> <li><img src="./image/4.jpg"></li> <li><img src="./image/5.jpg"></li> <li><img src="./image/4.jpg"></li> <li><img src="./image/1.jpg"></li> <li><img src="./image/5.jpg"></li> </ul> </div> </div>
the image-slider-wrapper part is for the convenience when I do future work.
the css part for this is:
.container{ width:800px; height:400px; padding:20px; border:1px solid gray; -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box; background: black; } .image-slider-wrapper{ overflow: hidden; } #image_slider{ position: relative; height: 280px; padding:0; } #image_slider li{ max-width: 100%; float:left; list-style: none; }
The image-slider-wrapper need to set overflow: hidden cause ul will be a very long list in a line. but only one image can be seen.
There are no width set for ul( id=image_slider) because we will set it in Javascript. So when there are more/less images we don't need to change css.
Webkit has default padding and margin for ul, so we will initialize it with 0px.
Set li to list-style:none and float left, so the images will be in a long line.
All right, now we've have everything ready to move.
Next is the JS part.
In the function init(), 1. set ul width 2. move ul
var ul; var liItems; var imageWidth; var imageNumber;
function init(){
ul = document.getElementById('image_slider'); liItems = ul.children; imageNumber = liItems.length; imageWidth = liItems[0].children[0].offsetWidth; // set ul's width as the total width of all images in image slider. ul.style.width = parseInt(imageWidth * imageNumber) + 'px';
slider(ul);
}
.clientWidht returns a number! (typeof(imageWidth) returns "number")
we can also use computedStyle to get the width of one image, but in that case what we get is "760px", not 760
var computedStyle = document.defaultView.getComputedStyle(liItems[i].childNodes[0], null); imageWidth = computedStyle.width;
Also, offsetWidth is the width that includes content, padding, scrollbar and border.if there are borders for each image, the width of ul will also be correct.
here is the function slider()
function slider(ul){ animate({ delay:17, duration: 3000, //delta function is to set how the image slide--keep still for a while and move to next picture. delta:function(p){return Math.max(0, -1 + 2 * p)}, step:function(delta){ //step function will be called many times until clearInterval() been called // currentImage * imageWidth is the currentImage position of ul // delta start from 0 to 1, delta * imageWidth is the pixels that changes ul.style.left = '-' + parseInt(currentImage * imageWidth + delta * imageWidth) + 'px'; }, callback:function(){ currentImage++; // if it doesn't slied to the last image, keep sliding if(currentImage < imageNumber-1){ slider(ul); } // if current image it's the last one, it slides back to the first one else{ var leftPosition = (imageNumber - 1) * imageWidth; // after 2 seconds, call the goBack function to slide to the first image setTimeout(function(){goBack(leftPosition)},2000); setTimeout(function(){slider(ul)}, 4000); } } }); }
The animate function is a generic function I Learned from this article:
I think it's a pretty good one.
http://javascript.info/tutorial/animation#the-generic-animation
The delta function make sure that each animation will keep still for a while then move to the next image. (if y<0, then y=0;)
The step function does the animation. But it only slide one image. The callback function will make sure there is a loop for all images. And if it's the last image, it calls the "goBack" function to slide to the first image.
function goBack(leftPosition){ currentImage = 0; var id = setInterval(function(){ if(leftPosition >= 0){ ul.style.left = '-' + parseInt(leftPosition) + 'px'; // everytime goBack be called, the ul moves 1/10 of image width until it goes to 0 px. leftPosition -= imageWidth / 10; } else{ clearInterval(id); } }, 17); }
Here is the generic animation function I learned form the javascript animation tutorial i posted the link above. The only difference is after clearInterval() i will call the callback function to keep the animation loop going on.
//generic animate function function animate(opts){ var start = new Date; var id = setInterval(function(){ var timePassed = new Date - start; var progress = timePassed / opts.duration if(progress > 1){ progress = 1; } var delta = opts.delta(progress); opts.step(delta); if (progress == 1){ clearInterval(id); opts.callback(); } }, opts.dalay || 17); } window.onload = init;
WIth the window.inload = init; as the end, the image slider has been successfully finished!
I know there are many places to improve, like this one is not a responsive one. I will keep working on and write better code.
Fortune cookie
The day before you left, i got this note from a fortune cookie:
Cleaning up the past will always clear up the future.
yep, I guess it's time to clean up the past, our past.