置顶随笔 #
2012年4月27日 #
快递还是很给力,周四就到了,能算上大连第一台吗?
说点体会
1. 屏幕比不上ips,不过也过的去。
2. 性能绝对没问题。
3. 大小重量厚度也不错,拿在手上很舒服。那个宽边,我道感觉还好。
4. 无GPS.
5. 屏幕上的触摸‘线’,侧着看还是很明显。
6. 敲击后盖有点空的感觉,很山寨。
7. 随变装了几个应用和游戏,发现兼容性有点差.
8. 屏幕右下角是“死角”,竖着看书会稍有不适。
9. 机身发热控制很好,连续在线视频,稍有温暖。
10. 安装Flash插件后,可玩Flash游戏。
11. 五点触摸,精度可以。
12. 玻璃面很耐划(钥匙已测),完全没有贴膜的必要。
13. 40%亮度,连WIFI,1小时耗电20%,估计满电工作应该在5小时左右。
14. 玩机6小时左右时,死机一次,起机35秒左右。
图1. 小米拍摄Q8

图2. Q8拍摄Macbook

PS. 我在zhiqifans发的帖子怎么没了??!!
2012年3月31日 #
小米手机如期而至,把玩中...
前段时间打算换手机,就锁定了MX和小米,可是MX不给力,就算定货也不知何时能到货,碰巧小米首发15万电信版,于是果断抢定(真可以算上抢了,半个小时,15万就售完了。),说好的月底到货,昨天真的收到货了,快递也很给力。
一切都很满意,只是自已贴膜费了些力气,作为一个业余选手,最终还算基本满意吧。
2012年2月24日 #
真没找到这样的例子,于是自已写了个,分享出来。
第一步,首先在WebService上,添加[System.Web.Script.Services.ScriptService]属性标签,让WebServer支持JSON.
namespace jqGrid_JSON_WebService_Sample.Services
{
/// <summary>
/// Summary description for WebServiceGrid
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class WebServiceGrid : System.Web.Services.WebService
{
}
}
接着,添加ajax调用的后端代码,获取数据,返回JSON对象:
[WebMethod]
public object Grid(bool? _search, string nd, int page, int rows, string sidx, string sord, string searchField, string searchString, string searchOper)
{
int count;
var data = dc.Query<Issue>(string.IsNullOrWhiteSpace(searchField) ? null : new string[] { searchField }, new string[] { searchOper }, new object[] { searchString }, null, new string[] { string.IsNullOrWhiteSpace(sidx) ? "IssueID" : sidx }, new string[] { sord }, (page - 1) * rows, rows, out count);
return (new
{
total = Math.Ceiling((float)count / (float)rows),
page = page,
records = count,
rows = data.Select(item => new { id = item.IssueID, cell = new object[] { item.IssueID, item.Title, item.Description, item.Progress, item.CreateTime, item.Locked } })
});
}
第二步,添加前台页面,首先添加各种的js,css引用,然后添加jqGrid所需的<div>和js代码:
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="WebFormGrid.aspx.cs" Inherits="jqGrid_JSON_WebService_Sample.WebFormGrid" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
<link href="/Content/smoothness/jquery-ui-1.8.17.custom.css" rel="stylesheet" type="text/css" />
<link href="/Content/Site.css" rel="stylesheet" type="text/css" />
<script src="/Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="/Scripts/jquery-ui-1.8.11.min.js" type="text/javascript"></script>
<link href="/Content/ui.jqgrid.css" rel="stylesheet" type="text/css" />
<script src="/Scripts/i18n/grid.locale-en.js" type="text/javascript"></script>
<script src="/Scripts/jquery.jqGrid.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function ()
{
$("#list #grid").jqGrid(
{
url: '/Services/WebServiceGrid.asmx/Grid',
mtype: 'POST',
ajaxGridOptions: { contentType: 'application/json; charset=utf-8' },
serializeGridData: function (postData)
{
if (postData.searchField === undefined) postData.searchField = null;
if (postData.searchString === undefined) postData.searchString = null;
if (postData.searchOper === undefined) postData.searchOper = null;
return JSON.stringify(postData);
},
jsonReader:
{
root: "d.rows",
page: "d.page",
total: "d.total",
records: "d.records"
},
datatype: "json",
colNames:
[
'IssueID',
'Title',
'Description',
'Progress',
'CreateTime',
'Locked'
],
colModel:
[
{ name: 'IssueID', width: 100, index: 'IssueID' },
{ name: 'Title', width: 100, index: 'Title' },
{ name: 'Description', width: 300, index: 'Description' },
{ name: 'Progress', width: 150, index: 'Progress' },
{ name: 'CreateTime', width: 100, index: 'CreateTime', formatter:'date', sorttype:'datetime', datefmt:'M d h:i' },
{ name: 'Locked', width: 100, index: 'Locked' }
],
rowNum: 10,
rowList: [10, 15, 20, 25, 40],
pager: '#pager',
viewrecords: true,
sortorder: "desc",
width: 900,
height: 240,
});
$("#list #grid").jqGrid('navGrid', '#pager', { edit: false, add: false, del: false });
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div id="list">
<table id="grid">
</table>
<div id="pager">
</div>
</asp:Content>
注意jqGrid函数据前面的部分代码:
url: '/Services/WebServiceGrid.asmx/Grid',
mtype: 'POST',
ajaxGridOptions: { contentType: 'application/json; charset=utf-8' },
通过url指定WebService方法,mtype指定使用POST方法,contentType指定为json,这样WebService才会返回json对象。
可是,返回的数据是放在一个属性名为d的对象里,所以还要添加 jsonReader,来作数据映射:
jsonReader:
{
root: "d.rows",
page: "d.page",
total: "d.total",
records: "d.records"
},
最后,为了保证查询时能够POST正确的参数,还要对POST的参数值进行检查:
serializeGridData: function (postData)
{
if (postData.searchField === undefined) postData.searchField = null;
if (postData.searchString === undefined) postData.searchString = null;
if (postData.searchOper === undefined) postData.searchOper = null;
return JSON.stringify(postData);
},
到此,一个完整的jqGrid示例就完成了,成果展示:

完整示例代码:jqGrid_JSON_WebService_Sample.zip
汗!数据库文件还有版本问题,低版本的数据库文件在这下载, 低版本数据库文件的完整示例代码:jqGrid_JSON_WebService_Sample(v2).zip
2012年2月18日 #
2012年2月16日 #
2012年2月15日 #
2012年1月7日 #
2011年12月30日 #
2011年11月27日 #
2011年10月14日 #
2011年9月17日 #
2011年9月16日 #
2011年9月14日 #
2011年9月12日 #
2011年8月25日 #
2011年8月8日 #
2011年7月15日 #

