RAILS_ROOT/config/initializers/session_store.rb file
ActionController::Base.session = {
:key => 'YOUR_KEY',
:secret => 'YOUR_SECRET',
:expire_after => 180.minutes,
:domain => '.DOMAIN_NAME.com'
}
Regardless of what we discover, we must understand and truly believe that everyone did the best job he or she could, given what was known at the time, his or her skills and abilities, the resources available, and the situation at hand.
ActionController::Base.session = {
:key => 'YOUR_KEY',
:secret => 'YOUR_SECRET',
:expire_after => 180.minutes,
:domain => '.DOMAIN_NAME.com'
}
busybox mke2fs /dev/block/vold/179:2This will output some data. Once done on the second partition we now have an ext2 file system.
mount -o rw,remount -t yaffs2 /dev/block/mtdblock1 /system mkdir /system/sdThen we need to mount the ext2 partition and we can do this via this command:
mount -t ext2 /dev/block/vold/179:2 /system/sdWe need to now copy the data from the data directory to the ext2 partition, as we want to preserve
cd /data/ tar -cvf /system/sd/app.tar app tar -cvf /system/sd/data.tar data tar -cvf /system/sd/dalvik-cache.tar dalvik-cache cd /system/sd tar -xvf app.tar tar -xvf data.tar tar -xvf dalvik-cache.tar rm *.tar
#!/system/bin/sh # /system/etc/init-sd.sh& The next is called init-sd.sh and contains the following: #!/system/bin/sh # MYLOG=/data/install-recovery.log echo "$(date) Starting install-recovery.sh" > $MYLOG echo "$(date) Waiting SD to become ready..." >> $MYLOG sleep 10 mount -t ext2 /dev/block/vold/179:2 /system/sd 1>>$MYLOG 2>>$MYLOG mount -o bind /system/sd/app /data/app 1>>$MYLOG 2>>$MYLOG mount -o bind /system/sd/data /data/data 1>>$MYLOG 2>>$MYLOG mount -o bind /system/sd/dalvik-cache /data/dalvik-cache 1>>$MYLOG 2>>$MYLOG mount >> $MYLOG echo "$(date) Finishing install-recovery.sh" >> $MYLOGnow you need to use a decent text editor (I like vi) on windows I reccomend notepad++
chmod 755 /system/etc/install-recovery.sh chmod 755 /system/etc/init-sd.shFinally, we need to remove everything in the existing /data/app /data/data/ and /data/dalvik-cache
cd /data/app busybox rm -rf * cd /data/data/ busybox rm -rf * cd /data/dalvik-cache busybox rm -rf *now you will notice some odd things happening on the screen of your tablet but that will be fixed
rebootand if all went well you now have all your applications on the sdcard.
Ubuntu 10.04 server IPSEC supported by openswan: Linux Openswan U2.6.23/K2.6.32-317-ec2 (net key) L2TP supported by xl2tpd v1.3.0after the connection get failed, I found there's something like this
......
Sep 22 16:07:36 ip-xx pluto[14024]: "L2TP-PSK-NAT"[16] 114.xx.193.xx
#57: transition from state STATE_QUICK_R0 to state STATE_QUICK_R1
Sep 22 16:07:36 ip-xx pluto[14024]: "L2TP-PSK-NAT"[16] 114.xx.193.xx
#57: STATE_QUICK_R1: sent QR1, inbound IPsec SA installed, expecting
QI2
Sep 22 16:07:36 ip-xx pluto[14024]: "L2TP-PSK-NAT"[16] 114.xx.193.xx
#57: transition from state STATE_QUICK_R1 to state STATE_QUICK_R2
Sep 22 16:07:36 ip-xx pluto[14024]: "L2TP-PSK-NAT"[16] 114.xx.193.xx
#57: STATE_QUICK_R2: IPsec SA established transport mode
{ESP=>0x0687f589 <0x85b637f3 ......="......" dpd="none}" natd="114.xx.193.xx:4500" natoa="none" pre="pre" xfrm="AES_256-HMAC_SHA1">
it seems like the client made the ipsec connection successfully, so I
tried to restart the xl2tpd server with the "-D" parameter, then I got
the error like this:
.....
xl2tpd[17006]: Listening on IP address 0.0.0.0, port 1701
xl2tpd[17006]: control_finish: Peer requested tunnel 16 twice,
ignoring second one.
xl2tpd[17006]: control_finish: Peer requested tunnel 16 twice,
ignoring second one.
xl2tpd[17006]: Maximum retries exceeded for tunnel 28197. Closing.
xl2tpd[17006]: Connection 16 closed to 114.xx.193.xx, port 53911 (Timeout)
xl2tpd[17006]: control_finish: Peer requested tunnel 16 twice,
ignoring second one.
xl2tpd[17006]: Unable to deliver closing message for tunnel 28197.
Destroying anyway.
xl2tpd[17006]: control_finish: Peer requested tunnel 16 twice,
ignoring second one.
xl2tpd[17006]: Maximum retries exceeded for tunnel 4768. Closing.
xl2tpd[17006]: Connection 16 closed to 114.xx.193.xx, port 53911 (Timeout)
xl2tpd[17006]: Unable to deliver closing message for tunnel 4768.
Destroying anyway.
.....
I tried google the error message then got this article:
http://serverfault.com/questions/178309/ipsec-l2tp-vpn-with-osx-client-xl2tpd-reports-maximum-retries-exceeded
saying that just need to add the following lines to the conn
L2TP-PSK-noNAT section of ipsec.conf:leftnexthop=%defaultroute
rightnexthop=%defaultroute
now my vpn works great!0x85b637f3>
when I was doing all this, I forgot to export the DYLD_LIBRARY_PATH,
and either for the fourth step, I got the following error when running
'rake db:create':
Couldn't create database for {"reconnect"=>false, "encoding"=>"utf8",
"username"=>"root", "adapter"=>"mysql", "database"=>"xxx",
"host"=>"127.0.0.1", "pool"=>5, "password"=>"xxx",
"socket"=>"/tmp/mysql.sock"}, charset: utf8, collation:
utf8_unicode_ci (if you set the charset manually, make sure you have a
matching collation)
hope this may help you :)
1, sudo gem install rubygems-update -v THE_VERSION_YOU_WANT
this will download and install a specified version of ruby gems
2, sudo update_rubygems
this will execute the ruby gems update script to actually update
your ruby-gems
lsof will give you a list of the running processes maps to their ports
which are using
kill is for killing a process, with paramater "-9 [PROCESS_NAME]"
ps will handle the process listing job, often be used with "aux" parameters
适用场景:o(∩_∩)o… 查询呗。
说明:和SQL命令中的select作用相似但位置不同,查询表达式中的select及所接子句是放在表达式最后并把子句中的变量也就是结果返回回来;延迟。
Select/Distinct操作包括9种形式,分别为简单形式、匿名类型形式、带条件形式、指定类型形式、过滤类型形式、shaped类型形式、嵌套类型形式、LocalMethodCall形式、Distinct形式。
var q =
from c in db.Customers
select c.ContactName;
注意:这个语句只是一个声明或者一个描述,并没有真正把数据取出来,只有当你需要该数据的时候,它才会执行这个语句,这就是延迟加载(deferred loading)。如果,在声明的时候就返回的结果集是对象的集合。你可以使用ToList() 或ToArray()方法把查询结果先进行保存,然后再对这个集合进行查询。当然延迟加载(deferred loading)可以像拼接SQL语句那样拼接查询语法,再执行它。
说明:匿名类型是C# 3.0中新特性。其实质是编译器根据我们自定义自动产生一个匿名的类来帮助我们实现临时变量的储存。匿名类型还依赖于另外一个特性:支持根据property来创建对象。比如,var d = new { Name = "s" };编译器自动产生一个有property叫做Name的匿名类,然后按这个类型分配内存,并初始化对象。但是var d = new {"s"};是编译不通过的。因为,编译器不知道匿名类中的property的名字。例如string c = "d";var d = new { c}; 则是可以通过编译的。编译器会创建一个叫做匿名类带有叫c的property。
例如下例:new{c,ContactName,c.Phone};ContactName和Phone都是在映射文件中定义与表中字段相对应的property。编译器读取数据并创建对象时,会创建一个匿名类,这个类有两个属性,为ContactName和Phone,然后根据数据初始化对象。另外编译器还可以重命名property的名字。
var q =
from c in db.Customers
select new {c.ContactName, c.Phone};
语句描述:查询顾客的联系人和电话。
var q =
from e in db.Employees
select new {Name = e.FirstName + " " + e.LastName, Phone = e.HomePhone};
语句描述:查询职员的姓名和家庭电话
var q =
from p in db.Products
select new {p.ProductID, HalfPrice = p.UnitPrice / 2};
说明:生成SQL语句为:case when condition then else。
var q =
from p in db.Products
select new {p.ProductName, Availability = p.UnitsInStock - p.UnitsOnOrder < 0 ? "Out Of Stock": "In Stock"};
说明:该形式返回你自定义类型的对象集。
var q =
from e in db.Employees
select new Name {FirstName = e.FirstName, LastName = e.LastName};
说明:结合where使用,起到过滤作用。
var q =
from c in db.Customers
where c.City == "London"
select c.ContactName;
说明:其select操作使用了匿名对象,而这个匿名对象中,其属性也是个匿名对象。
var q =
from c in db.Customers
select new {
c.CustomerID,
CompanyInfo = new {c.CompanyName, c.City, c.Country},
ContactInfo = new {c.ContactName, c.ContactTitle}
};
语句描述:查询顾客的ID和公司信息(公司名称,城市,国家)以及联系信息(联系人和职位)。
说明:返回的对象集中的每个对象DiscountedProducts属性中,又包含一个集合。也就是每个对象也是一个集合类。
var q =
from o in db.Orders
select new {
o.OrderID,
DiscountedProducts =
from od in o.OrderDetails
where od.Discount > 0.0
select od,
FreeShippingDiscount = o.Freight
};
var q = from c in db.Customers
where c.Country == "UK" || c.Country == "USA"
select new { c.CustomerID, c.CompanyName, Phone = c.Phone, InternationalPhone =
PhoneNumberConverter(c.Country, c.Phone) };
XDocument doc = new XDocument(
new XElement("Customers", from c in db.Customers
where c.Country == "UK" || c.Country == "USA"
select (new XElement("Customer",
new XAttribute("CustomerID", c.CustomerID),
new XAttribute("CompanyName", c.CompanyName),
new XAttribute("InterationalPhone", PhoneNumberConverter(c.Country, c.Phone))
))));
说明:筛选字段中不相同的值。用于查询不重复的结果集。生成SQL语句为:SELECT DISTINCT [City] FROM [Customers]
var q = (
from c in db.Customers
select c.City )
.Distinct();
语句描述:查询顾客覆盖的国家。
适用场景:统计数据吧,比如统计一些数据的个数,求和,最小值,最大值,平均数。
说明:返回集合中的元素个数,返回INT类型;不延迟。生成SQL语句为:SELECT COUNT(*) FROM
var q = db.Customers.Count();var q = db.Products.Count(p => !p.Discontinued);说明:返回集合中的元素个数,返回LONG类型;不延迟。对于元素个数较多的集合可视情况可以选用LongCount来统计元素个数,它返回long类型,比较精确。生成SQL语句为:SELECT COUNT_BIG(*) FROM
var q = db.Customers.LongCount();说明:返回集合中数值类型元素之和,集合应为INT类型集合;不延迟。生成SQL语句为:SELECT SUM(…) FROM
var q = db.Orders.Select(o => o.Freight).Sum();var q = db.Products.Sum(p => p.UnitsOnOrder);说明:返回集合中元素的最小值;不延迟。生成SQL语句为:SELECT MIN(…) FROM
var q = db.Products.Select(p => p.UnitPrice).Min();var q = db.Orders.Min(o => o.Freight);var categories =
from p in db.Products
group p by p.CategoryID into g
select new {
CategoryID = g.Key,
CheapestProducts =
from p2 in g
where p2.UnitPrice == g.Min(p3 => p3.UnitPrice)
select p2
};
说明:返回集合中元素的最大值;不延迟。生成SQL语句为:SELECT MAX(…) FROM
var q = db.Employees.Select(e => e.HireDate).Max();var q = db.Products.Max(p => p.UnitsInStock);var categories =
from p in db.Products
group p by p.CategoryID into g
select new {
g.Key,
MostExpensiveProducts =
from p2 in g
where p2.UnitPrice == g.Max(p3 => p3.UnitPrice)
select p2
};
说明:返回集合中的数值类型元素的平均值。集合应为数字类型集合,其返回值类型为double;不延迟。生成SQL语句为:SELECT AVG(…) FROM
var q = db.Orders.Select(o => o.Freight).Average();var q = db.Products.Average(p => p.UnitPrice);var categories =
from p in db.Products
group p by p.CategoryID into g
select new {
g.Key,
ExpensiveProducts =
from p2 in g
where p2.UnitPrice > g.Average(p3 => p3.UnitPrice)
select p2
};
说明:根据输入的表达式获取聚合值;不延迟。即是说:用一个种子值与当前元素通过指定的函数来进行对比来遍历集合中的元素,符合条件的元素保留下来。如果没有指定种子值的话,种子值默认为集合的第一个元素。
下面用一个表格总结一下这篇说的LINQ语句
| Where | 过滤;延迟 |
| Select | 选择;延迟 |
| Distinct | 查询不重复的结果集;延迟 |
| Count | 返回集合中的元素个数,返回INT类型;不延迟 |
| LongCount | 返回集合中的元素个数,返回LONG类型;不延迟 |
| Sum | 返回集合中数值类型元素之和,集合应为INT类型集合;不延迟 |
| Min | 返回集合中元素的最小值;不延迟 |
| Max | 返回集合中元素的最大值;不延迟 |
| Average | 返回集合中的数值类型元素的平均值。集合应为数字类型集合,其返回值类型为double;不延迟 |
| Aggregate | 根据输入的表达式获取聚合值;不延迟 |