Road of Jiumi

[图]扎克伯格回应了:我的确记得那些警察

感谢的投递
最牛路人甲扎克伯格昨天在Facebook回应了被中央电视台纪录片节目摄入镜头一事,以下是截图:
“我的确记得那些警察~当时还疑惑他们在搞什么呀。”



from cnBeta.COM http://bit.ly/N0KtIO



SkyDrive网盘容量全面下调 想要免费升级回25GB 下手快

感谢不着调的投递
微软网盘SkyDrive的容量已经开始全面的缩水了,由原来的25GB,跑到了7GB,以后注册的用户也就只有7GB了,如果之前有注册的话,使用的时候比较少的话,就会缩水到7GB,不过,微软给出了我们挽救的时间,大家就赶紧的下手吧。如果之前没有注册的话,就不用参与此活动了哦!





from cnBeta.COM http://bit.ly/I2AeQ9

GPS导航传导方式革新:触感反馈正在流行

感谢脸因的投递
对于有车一族,驾车旅行去到陌生地方得靠GPS给你指点迷津。现在一种全新的GPS传导装置正在测试,它能让导航系统更加智能化,也能减少在开车时注意力不集中的情况,效果很理想。





from cnBeta.COM http://bit.ly/JipePR

全国首个“双向感知手机召车”系统无锡投运

手机不打电话也能叫出租车,3月28日全国首个“双向感知手机召车”系统在无锡运行。只要在智能手机上安装一款“手机召车”的软件,想要打车的时候,打开软件,通过GPS定位搜索,可以在手机屏幕上显示周围空闲出租车的数量和位置,通过手机发送叫车请求,就能在几秒钟之内 “锁定”就近的出租车乘坐。





from cnBeta.COM http://bit.ly/GZmVl9

你想随时查询家庭用车的状况吗?新软件帮你实现

你是否担心过孩子开车安全?最近美国一个车载通讯公司发布了一款OnStar—Family Link的软件,可以随时告知你车辆的信息,甚至谁在开车。Family Link是一个开车辅助的可选择的追加服务,紧急响应和导航定位服务。用户可以在任何时间登录OnStar的 Family Link网页查看车辆当前的信息。同时你也可以开启定期定时的的邮件或者短信提醒。



from cnBeta.COM http://bit.ly/HbOPHu

微软宣布云构建服务

感谢zigbee开发板的投递
微软在Visual Studio Live上宣布Team Foundation Service(TFS)将增加一个基于云的构建服务。 TFS目前支持分布式构建,但每个用于构建的虚拟机必须分别设置和配置,基于云的构建服务将可以自动化这一过程。





from cnBeta.COM http://bit.ly/He4JWT

一秒钟认出你的脸:新人脸识别功能在32万人中轻松找到你

监控录像使用面部识别技术已非新谈,伦敦警察厅在去年的事件后就开始启用这一技术,但是日立公司开发出一种新系统,可以使搜索过程更快更灵活。在今年日本的安防博览会上,这个系统就分别在静止图像和动态录像上做了实时面孔识别,它可以在一秒钟在32万人中快速定位人脸,并且将给出的面孔做了缩略图和分组匹配录像对比。





from cnBeta.COM http://bit.ly/GTCRTD

做移动应用使用地图API时需要注意的问题

最近在做一个基于地点提醒的移动应用,当初考虑大家都心知肚明的原因,谨慎的选择了百度地图,现在想想其实完全没有必要,好的应用本来就不分国界的,最后可能还是得换回Google地图。毕竟Google地图在技术和成熟度上完胜百度地图,当然百度也在慢慢追赶,希望有一天大家都能用上咱们自己的好用的地图服务。

现在把碰到的问题和解决方案罗列一下:

  • 版权:如果是大量商用的话,还是得事先注意一下版权意识,不然到时候就很被动了。两者的免费版都不允许商业应用,具体可以看这里Google Maps API百度API常见问题。不过在万能的国度,也有其他解决方案Google地图采集遇到IP限制的解决思路,其他的大家可以google一下。
  • GPS偏差(仅限中国国大陆地区):刚开始在看API文档时,没太注意这样一句话[百度对外接口的坐标系,都是经过国家测绘局加密处理,符合国家测绘局对地理信息保密要求] 悲催了。这就是中国特色(看看月光博主这篇网络地图国家队进场抢钱)。我们的需求是:根据手机GPS获得的坐标跟用户从地图上选择的坐标进行比较,然后决定是否在用户进入或离开该区域进行提醒。由于百度对外提供的坐标系是百度自己的坐标系,而手机GPS获得的是原始坐标,两者不在一个坐标系上,所以有很大的误差,我们测试了一下,误差在千米之外。所以必须得把两者换成统一坐标系。换成原始GPS坐标在国内原则上是违法的,所以只能统一成各个地图运营商自己的坐标系,比如百度坐标系或者google坐标系。
  • API性能比较,请参照:多家地图API内存消耗对比测试
  • 如何转换成百度坐标系:官方文档给的是:坐标转换接口非公开。请将您的公司名称、项目名称、项目简介、联系人和联系方式,发邮件至mapapi@baidu.com咨询。有专人为您解答。说白了就是收钱,不过这个东西在网上有人透露了。我试过还挺好使。
    •   
      http://api.map.baidu.com/ag/coord/convert?from=0&to=4&x=longitude&y=latitude
      其中:
      from: 来源坐标系 (0表示原始GPS坐标,2表示Google坐标)
      to: 转换后的坐标 (4就是百度自己啦,好像这个必须是4才行)
      x: 精度
      y: 纬度

      返回的结果是一个json字符串:
      {"error":0,"x":"MTIxLjUwMDIyODIxNDk2","y":"MzEuMjM1ODUwMjYwMTE3"}
      error:是结果是否出错标志位,"0"表示OK
      x: 百度坐标系的精度(Base64加密)
      y: 百度坐标系的纬度(Base64加密)
    • 百度还提供了js的转换工具,可参考官方链接:常用坐标转换
  • 如何转换成google坐标系:
    •   
      http://ditu.google.cn/maps/vp?spn=0.0,0.0&z=18&vp=latitude,longitude

      注意,google的参数里经纬度是反过来的。

      相关详细见
      http://blog.sina.com.cn/s/blog_65bd7eef0100hu5o.html
  • 其他
    • 如何让程序推出时,GPS的图标不再闪烁(即停止使用GPS)
      #启动GPS的时候,根据需求设置一些参数,注册监听方法
      Criteria criteria = new Criteria();
      criteria.setAccuracy(Criteria.ACCURACY_FINE);
      criteria.setAltitudeRequired(false);
      criteria.setBearingRequired(false);
      criteria.setCostAllowed(true);
      criteria.setPowerRequirement(Criteria.POWER_HIGH);
      String provider = this.mLocationManager.getBestProvider(criteria, false);


      this.mLocationManager.requestLocationUpdates(provider, MINIMUM_TIME_BETWEEN_UPDATE, MINIMUM_DISTANCE_FOR_UPDATE, this.mListener);

      #退出的时候,需要取消该监听方法
      this.mLocationManager.removeUpdates(this.mListener);
      使用地图的时候也需要注意:
      1:使用BMapManager一定要最后调用stop和destroy
      2:使用MyLocationOverlay的时候,如果enableMyLocation之后一定接的disable掉
      3:其实就一个原则,记得及时安全的资源释放,特别是这种全局资源(用户很care的)
    • LocationManager.addProximityAlert()可以试用,但是不好控制,特别是他的启动间隔无法控制,最好还是自己实现相关的功能,然后在准确度和耗电上根据应用找到一个好的平衡点。

暂时就总结这么多。

本文链接



from 博客园_首页 http://bit.ly/GUrAof

天气预报源代码

先上效果图

14523

天气预报是我学WindowsPhone7以来的第一个作品。用的是谷歌的api。功能一个下午就写完了,还是这个界面的设计加P图费了我不少的时间。这个应用已经通过了微软的审核。

下载地址:

http://bit.ly/GNFolm
Weather.xap

有什么问题请联系QQ:29992379  

由于界面过于复杂,为了实现高效的重用性,我使用了用户自定义控件。通过后台对象的实例化生成的界面。没有办法把所有的代码都展现出来。

   1:  // 应用程序启动(例如,从“开始”菜单启动)时执行的代码
   2:          // 此代码在重新激活应用程序时不执行
   3:          private void Application_Launching(object sender, LaunchingEventArgs e)
   4:          {
   5:              if (!IsolatedStorageSettings.ApplicationSettings.Contains("City"))
   6:              {
   7:                  List<CityWeatherInfo> citys = new List<CityWeatherInfo>();
   8:                  IsolatedStorageSettings.ApplicationSettings["City"] = citys;
   9:                  IsolatedStorageSettings.ApplicationSettings.Save();
  10:              }
  11:          }
   1:  List<CityWeatherInfo> citys = new List<CityWeatherInfo>();

我使用的是IsolatedStorageSettings.ApplicationSettings存储的城市信息。下面为添加城市信息的代码。

   1:  //添加城市
   2:          private void AddCityButton_Click(object sender, RoutedEventArgs e)
   3:          {
   4:              
   5:              if ((citys.Where(list => list.CityName == CityNameTextBox.Text).ToList()).Count == 0)
   6:              {
   7:                  citys.Add(new CityWeatherInfo() { CityGuid = Guid.NewGuid().ToString(), CityName = CityNameTextBox.Text });
   8:                  IsolatedStorageSettings.ApplicationSettings["City"] = citys;
   9:                  IsolatedStorageSettings.ApplicationSettings.Save();
  10:              }
  11:              IsolatedStorageSettings.ApplicationSettings["City"] = citys;
  12:              IsolatedStorageSettings.ApplicationSettings.Save();
  13:              NavigationService.Navigate(new Uri("/Loading.xaml?cityName=" + CityNameTextBox.Text+"&AndGoPage=MainPage", UriKind.RelativeOrAbsolute));
  14:          }
   1:  //删除城市
   2:          private void linkButtonDel_Click(object sender, RoutedEventArgs e)
   3:          {
   4:              for (int i = 0; i < citys.Count; i++)
   5:              {
   6:                  if (citys[i].CityGuid == ((HyperlinkButton)sender).Tag.ToString())
   7:                  {
   8:                      citys.RemoveAt(i);
   9:                  }
  10:              }
  11:              IsolatedStorageSettings.ApplicationSettings["City"] = citys;
  12:              IsolatedStorageSettings.ApplicationSettings.Save();
  13:              BindData();
  14:          }

先上获取天气信息的代码,我自己写了个获取谷歌天气信息的工具类,生成了DLL然后引用进来使用的。

image

给城市赋天气信息

   1:   public partial class Loading : PhoneApplicationPage
   2:      {
   3:          List<CityWeatherInfo> citys = new List<CityWeatherInfo>();
   4:          WebClient client = new WebClient();
   5:          string cityName = "济南";
   6:          public Loading()
   7:          {
   8:              InitializeComponent();
   9:              citys = IsolatedStorageSettings.ApplicationSettings["City"] as List<CityWeatherInfo>;
  10:          }
  11:          private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
  12:          {
  13:              LoadingData();
  14:          }
  15:          string AndGoPage = "MainPage";
  16:          public void LoadingData()
  17:          {
  18:              AndGoPage = NavigationContext.QueryString["AndGoPage"];
  19:              if (NavigationContext.QueryString.ContainsKey("cityName"))
  20:              {
  21:                  cityName = NavigationContext.QueryString["cityName"];
  22:              }
  23:              client.OpenReadAsync(new Uri("http://bit.ly/GNFp8X" + cityName, UriKind.RelativeOrAbsolute));
  24:              client.OpenReadCompleted += new OpenReadCompletedEventHandler(client_OpenReadCompleted);
  25:          }
  26:   
  27:          void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
  28:          {
  29:              XElement xmlWeather;
  30:              try
  31:              {
  32:                  xmlWeather = XElement.Load(e.Result);
  33:              }
  34:              catch (Exception)
  35:              {
  36:                  MessageBox.Show("获取城市信息失败");
  37:                  NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.RelativeOrAbsolute));
  38:                  return;
  39:              }
  40:              foreach (var item in citys)
  41:              {
  42:                  if (item.CityName == cityName)
  43:                  {
  44:                      item.TodayIcon = GoogleWeatherHelper.GetTodayIcon(xmlWeather);
  45:                      item.LastUpdateTime = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
  46:                      item.Humidity = GoogleWeatherHelper.GetHumidity(xmlWeather);
  47:                      try
  48:                      {
  49:                          item.WindCondition = GoogleWeatherHelper.GetWindCondition(xmlWeather);
  50:                      }
  51:                      catch (Exception)
  52:                      {
  53:                          item.WindCondition = "未知";
  54:                      }
  55:                      item.TodayWeek = GoogleWeatherHelper.GetTodayWeek(xmlWeather);
  56:                      item.TodayIcon = GoogleWeatherHelper.GetTodayIcon(xmlWeather);
  57:                      item.TodayLow = GoogleWeatherHelper.GetTodayLow(xmlWeather);
  58:                      item.TodayHight = GoogleWeatherHelper.GetTodayHight(xmlWeather);
  59:                      item.TodayCondition = GoogleWeatherHelper.GetTodayCondition(xmlWeather);
  60:   
  61:                      item.TomorrowWeek = GoogleWeatherHelper.GetTomorrowWeek(xmlWeather);
  62:                      item.TomorrowIcon = GoogleWeatherHelper.GetTomorrowIcon(xmlWeather);
  63:                      item.TomorrowLow = GoogleWeatherHelper.GetTomorrowLow(xmlWeather);
  64:                      item.TomorrowHight = GoogleWeatherHelper.GetTomorrowHight(xmlWeather);
  65:                      item.TomorrowCondition = GoogleWeatherHelper.GetTomorrowCondition(xmlWeather);
  66:   
  67:                      item.HouTianWeek = GoogleWeatherHelper.GetHouTianWeek(xmlWeather);
  68:                      item.HouTianIcon = GoogleWeatherHelper.GetHouTianIcon(xmlWeather);
  69:                      item.HouTianLow = GoogleWeatherHelper.GetHouTianLow(xmlWeather);
  70:                      item.HouTianHight = GoogleWeatherHelper.GetHouTianHight(xmlWeather);
  71:                      item.HouTianCondition = GoogleWeatherHelper.GetHouTianCondition(xmlWeather);
  72:   
  73:                      item.DaHouTianWeek = GoogleWeatherHelper.GetDaHouTianWeek(xmlWeather);
  74:                      item.DaHouTianIcon = GoogleWeatherHelper.GetDaHouTianIcon(xmlWeather);
  75:                      item.DaHouTianLow = GoogleWeatherHelper.GetDaHouTianLow(xmlWeather);
  76:                      item.DaHouTianHight = GoogleWeatherHelper.GetDaHouTianHight(xmlWeather);
  77:                      item.DaHouTianCondition = GoogleWeatherHelper.GetDaHouTianCondition(xmlWeather);
  78:                  }
  79:              }
  80:              IsolatedStorageSettings.ApplicationSettings["City"] = citys;
  81:              IsolatedStorageSettings.ApplicationSettings.Save();
  82:              NavigationService.Navigate(new Uri("/" + AndGoPage + ".xaml?cityName=" + cityName, UriKind.RelativeOrAbsolute));
  83:          }
  84:      }

首页显示城市列表和城市精简天气信息的实现代码

   1:  public partial class MainPage : PhoneApplicationPage
   2:      {
   3:          List<CityWeatherInfo> citys = new List<CityWeatherInfo>();
   4:          public MainPage()
   5:          {
   6:              InitializeComponent();
   7:              citys = IsolatedStorageSettings.ApplicationSettings["City"] as List<CityWeatherInfo>;
   8:              BingUI();
   9:          }
  10:   
  11:          private void BingUI()
  12:          {
  13:              string DayOrNight;
  14:              int hour = DateTime.Now.Hour;
  15:              ImageBrush img = new ImageBrush();
  16:              DayOrNight = TimeTools.GetDayorNight();
  17:              img.ImageSource = new BitmapImage(new Uri("/Images/Back/" + DayOrNight + ".jpg", UriKind.RelativeOrAbsolute));
  18:   
  19:              LayoutRoot.Background = img;
  20:              foreach (var item in citys)
  21:              {
  22:                  AddCity(item.CityName, item.TodayLow + "℃~" + item.TodayHight + "℃", "/Images/Forecasts/" + DayOrNight + "/" + item.TodayIcon + ".png");
  23:              }
  24:          }
  25:   
  26:          private void ApplicationBarIconButton_Click(object sender, EventArgs e)
  27:          {
  28:              NavigationService.Navigate(new Uri("/CityListEdit.xaml", UriKind.RelativeOrAbsolute));
  29:          }
  30:   
  31:          private void AddCity(string cityName, string cityTemperature, string WeatherIconPath) 
  32:          {
  33:              CityTileData cityData = new CityTileData();
  34:              cityData.cityTemperature = cityTemperature;
  35:              cityData.cityWeatherIcon = WeatherIconPath;
  36:              CityTile city = new CityTile();
  37:              city.DataContext = cityData;
  38:              city.cityName.Content = cityName;
  39:              city.Width = 184;
  40:              city.Height = 105;
  41:              city.Margin = new Thickness(15, 10, 15, 10);
  42:              wrapPanelCityList.Children.Add(city);
  43:              city.cityName.Click += new RoutedEventHandler(cityName_Click);
  44:          }
  45:   
  46:          void cityName_Click(object sender, RoutedEventArgs e)
  47:          {
  48:              NavigationService.Navigate(new Uri("/Loading.xaml?cityName=" + ((Button)sender).Content + "&AndGoPage=WeatherView", UriKind.RelativeOrAbsolute));
  49:          }
  50:   
  51:          protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
  52:          {
  53:              e.Cancel = true;
  54:              if (MessageBox.Show("", "确定要退出程序吗", MessageBoxButton.OKCancel)==MessageBoxResult.OK) 
  55:              {
  56:                  App.Quit();
  57:              }
  58:              base.OnBackKeyPress(e);
  59:          }
  60:   
  61:          private void ApplicationBarIconButton2_Click(object sender, EventArgs e)
  62:          {
  63:              NavigationService.Navigate(new Uri("/About.xaml", UriKind.RelativeOrAbsolute));
  64:          }
  65:      }

单个城市的详细天气信息以及未来4天的天气情况实现代码。

   1:  public partial class WeatherView : PhoneApplicationPage
   2:      {
   3:          List<CityWeatherInfo> citys = new List<CityWeatherInfo>();
   4:          public WeatherView()
   5:          {
   6:              InitializeComponent();
   7:              citys = IsolatedStorageSettings.ApplicationSettings["City"] as List<CityWeatherInfo>;
   8:          }
   9:          string cityName = "济南";
  10:          string TodayIcon = "";
  11:          string TodayInfo = "未知";
  12:          private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
  13:          {
  14:              if (NavigationContext.QueryString.ContainsKey("cityName"))
  15:              {
  16:                  cityName = NavigationContext.QueryString["cityName"];
  17:              }
  18:              BingUI();
  19:              BingData();
  20:          }
  21:          string DayOrNight;
  22:          private void BingData() 
  23:          {
  24:              foreach (var item in citys)
  25:              {
  26:                  if (item.CityName==cityName)
  27:                  {
  28:                      imgWeather.Source = new BitmapImage(new Uri("/Images/Weathericon/" + DayOrNight + "/" + item.TodayIcon + ".png", UriKind.RelativeOrAbsolute));
  29:   
  30:                      txtTodayTemperature.Text = item.TodayLow + "℃~" + item.TodayHight + "℃";
  31:                      txtCityName.Text = item.CityName;
  32:                      txtLastUpdateTime.Text = item.LastUpdateTime;
  33:                      TodayInfo = item.TodayCondition;
  34:                      txtTodayInfo.Text = "今日天气实况:" + item.TodayCondition + ";气温:" + txtTodayTemperature.Text + ";" + item.WindCondition + ";" + item.Humidity;
  35:                      TodayIcon = item.TodayIcon;
  36:                      forecastTile1.WhichDay = item.TodayWeek;
  37:                      forecastTile1.Weathericon = new BitmapImage(new Uri("/Images/Forecasts/" + DayOrNight + "/" + item.TodayIcon + ".png", UriKind.RelativeOrAbsolute));
  38:                      forecastTile1.Temperature = item.TodayLow + "°/" + item.TodayHight + "°";
  39:   
  40:                      forecastTile2.WhichDay = item.TomorrowWeek;
  41:                      forecastTile2.Weathericon = new BitmapImage(new Uri("/Images/Forecasts/" + DayOrNight + "/" + item.TomorrowIcon + ".png", UriKind.RelativeOrAbsolute));
  42:                      forecastTile2.Temperature = item.TomorrowLow + "°/" + item.TomorrowHight + "°";
  43:   
  44:                      forecastTile3.WhichDay = item.HouTianWeek;
  45:                      forecastTile3.Weathericon = new BitmapImage(new Uri("/Images/Forecasts/" + DayOrNight + "/" + item.HouTianIcon + ".png", UriKind.RelativeOrAbsolute));
  46:                      forecastTile3.Temperature = item.HouTianLow + "°/" + item.HouTianHight + "°";
  47:   
  48:                      forecastTile4.WhichDay = item.DaHouTianWeek;
  49:                      forecastTile4.Weathericon = new BitmapImage(new Uri("/Images/Forecasts/" + DayOrNight + "/" + item.DaHouTianIcon + ".png", UriKind.RelativeOrAbsolute));
  50:                      forecastTile4.Temperature = item.DaHouTianLow + "°/" + item.DaHouTianHight + "°";
  51:                  }
  52:              }
  53:          }
  54:   
  55:          private void BingUI() 
  56:          {
  57:              int hour = DateTime.Now.Hour;
  58:              ImageBrush img = new ImageBrush();
  59:              DayOrNight = TimeTools.GetDayorNight();
  60:              img.ImageSource = new BitmapImage(new Uri("/Images/Back/"+DayOrNight+".jpg", UriKind.RelativeOrAbsolute));
  61:              LayoutRoot.Background = img;
  62:          }
  63:   
  64:          protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
  65:          {
  66:              e.Cancel = true;
  67:              NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.RelativeOrAbsolute));
  68:              base.OnBackKeyPress(e);
  69:          }
  70:   
  71:          private void ApplicationBarIconButton_Click(object sender, EventArgs e)
  72:          {
  73:              ChangeTile.ChangeTileByCityName(cityName, TodayIcon, TodayInfo, txtTodayTemperature.Text);
  74:          }
  75:      }

今天先更新到这个地方。尽请期待…..

本文链接



from 博客园_首页 http://bit.ly/GNFppf

16
To Tumblr, Love PixelUnion

We're updating Fluid!

Soon, we'll be updating the look and feel of this theme. Read about the changes here. You can easily turn off this notification in the theme customization panel.

Close