当前位置:  编程技术>移动开发
本页文章导读:
    ▪setSocketOption各项的含意        setSocketOption各项的含义 DELAY      小缓冲写如延迟值。如果为0,则禁用了TCP对于小缓冲区操作的Nagle算法。如果需要启动该算法则需要把该值设置为非0       KEEPLIVE      保持连接的特.........
    ▪ [征集]关于背景灯的文章收集        [收集]关于背景灯的文章收集 最近由于工作需要,需要对背景灯进行操作。对于背景灯设置API说得并不清晰而且缺少例子,网上能找到的资料也不多,这里放上一些最近搜集到的,以作备忘.........
    ▪ Object-C入门美教材《Learn Objective–C on the Mac》       Object-C入门好教材《Learn Objective–C on the Mac》 这本书是我在www.iphoneside.com上看到的,Amazon上给出了4星半。于是我把它下载回来看,现在还差最后一张内容和AppendixA没看。总体感觉写的非常好.........

[1]setSocketOption各项的含意
    来源: 互联网  发布时间: 2014-02-18
setSocketOption各项的含义

DELAY      小缓冲写如延迟值。如果为0,则禁用了TCP对于小缓冲区操作的Nagle算法。如果需要启动该算法则需要把该值设置为非0
 
    KEEPLIVE      保持连接的特性。如果该值为0,则禁用了保持连接的特性。如果要启动该特性则要把该值设置为非0
    LINGER     关闭一个连接前等待未发送的数据发送完毕所经过的秒数。如果该值为0,则禁用了该属性
    RCVBUF  接受缓冲区的大小,单位字节
    SNDBUF  发送缓冲区的大小,单位字节

1 楼 longzy 2009-06-19  
这个很有用。。。我之前一直搞不懂linger,后来测试了很久才发现是怎么回事。
这些细节往往是 重要但是容易乎略的。

    
[2] [征集]关于背景灯的文章收集
    来源: 互联网  发布时间: 2014-02-18
[收集]关于背景灯的文章收集
最近由于工作需要,需要对背景灯进行操作。对于背景灯设置API说得并不清晰而且缺少例子,网上能找到的资料也不多,这里放上一些最近搜集到的,以作备忘。 CS000957 - Flashing the backlight
From Forum Nokia Wiki ID CS000957 Creation date May 14, 2008 Platform S60 3rd Edition, MR
S60 3rd Edition, FP1 Tested on devices Nokia E61i
Nokia N95 8GB Category Java ME Subcategory Hardware

 

Keywords (APIs, classes, methods, functions) : javax.microedition.lcdui.Display, javax.microedition.lcdui.Display.flashBacklight() Overview

This snippet demonstrates how to flash the backlight of the device for a specified duration. In practice, the MIDlet constructs a menu item through which the user can flash the backlight.

Source

Flashing the backlight can be implemented as follows:

// Flash the backlight for 5 seconds

Display.getDisplay
(
this
)
.flashBacklight
(
5000)
;

Here is a complete example:

import
 
javax.microedition.lcdui.Command
;

import
 
javax.microedition.lcdui.CommandListener
;

import
 javax.microedition.lcdui.Display
;

import
 javax.microedition.lcdui.Displayable
;

import
 javax.microedition.lcdui.Form
;

import
 javax.microedition.midlet.MIDlet
;

public
 class
 ExampleMIDlet extends
 MIDlet implements
 CommandListener {


    private
 Command flashCommand;

    private
 Command exitCommand;

    private
 Form mainForm;


    /**
     * Constructor. Constructs the object and initializes displayables.
     */

    public
 ExampleMIDlet(
)
 
{

        mainForm =
 new
 Form(
"ExampleMIDlet"
)
;

        flashCommand =
 new
 Command(
"Flash"
, Command.SCREEN
, 0)
;

        mainForm.addCommand
(
flashCommand)
;

        exitCommand =
 new
 Command(
"Exit"
, Command.EXIT
, 0)
;

        mainForm.addCommand
(
exitCommand)
;

        mainForm.setCommandListener
(
this
)
;

    }

 
    /**
     * Called when the MIDlet is started.
     */

    public
 void
 startApp(
)
 {

        Display.getDisplay
(
this
)
.setCurrent
(
mainForm)
;

    }


     // Other inherited methods omitted for brevity

    // ...

 
    /**
     * From CommandListener.
     * Called by the system to indicate that a command has been invoked on a
     * particular displayable.
     * @param command the command that was invoked
     * @param displayable the displayable where the command was invoked
     */

    public
 void
 commandAction(
Command command, Displayable displayable)
 {

        if
 (
command ==
 flashCommand)
 {

            // Flash the backlight for 5 seconds

            boolean
 flashAllowed =
 Display.getDisplay
(
this
)
.flashBacklight
(
5000)
;

            if
 (
!
flashAllowed)
 {

                // TODO: Flashing is not allowed. Inform the user.

            }

        }
 else
 if
 (
command ==
 exitCommand)
 {

            // Exit the MIDlet

            destroyApp(
true
)
;

            notifyDestroyed(
)
;

        }

    }

Postconditions

If the user selects the Flash menu item, the backlight is flashed for 5 seconds.

 

原文连接:http://wiki.forum.nokia.com/index.php/CS000957_-_Flashing_the_backlight
---------------------------------------------------------
---------------------------------------------------------
How to block the screen saver From Forum Nokia Wiki

If your application doesn't demand constant key presses, after a while the screen saver on a J2ME phone will start automatically.

To make sure that the display light is turned on, the setLights method should be called before the screen saver is started and this must be done in a loop since the screen saver is not disabled just interrupted.

import
 com.nokia.mid.ui.DeviceControl
;

import
 javax.microedition.lcdui.*
;

import
 javax.microedition.midlet.*
;

 
public
 class
 BacklightWorkaround extends
 MIDlet {


   private
 SimpleCanvas canvas;


   /**
   * Keeps the backlight on by repeatedly setting
   */

  class
 LightThread extends
 Thread

 {


    public
 void
 run(
)
 {

      while
(
true
)
{

        DeviceControl.setLights
(
0, 100)
;
       
        try
 {

          Thread

.sleep
(
5000)
;

        }
 catch
 
(
InterruptedException

 ex)
 {

          ex.printStackTrace
(
)
;

        }

      }

    }

  }


   private
 class
 SimpleCanvas extends
 Canvas

 implements
 CommandListener{


    private
 Command exitCmd;

    private
 MIDlet midlet;

 
    public
 SimpleCanvas(
MIDlet midlet)
 {

      this
.midlet
 =
 midlet;

      exitCmd =
 new
 Command(
"Exit"
,Command.EXIT
, 1)
;

      addCommand(
exitCmd)
;

      setCommandListener(
this
)
;

    }


    public
 void
 paint(
Graphics

 g)
 {
 
      g.drawString
(
"Let there be light."
, 0, 0, Graphics

.LEFT
|
Graphics.TOP
)
;

    }


     public
 void
 commandAction(
Command command, Displayable displayable)
 {

      if
(
command ==
 exitCmd)
{

        midlet.notifyDestroyed
(
)
;

      }

    }

  }

 
  public
 void
 startApp(
)
 {

    if
(
canvas ==
 null
)
{

      canvas =
 new
 SimpleCanvas(
this
)
;

      new
 LightThread(
)
.start
(
)
;

    }
 
    Display.getDisplay
(
this
)
.setCurrent
(
canvas)
;

  }


   public
 
void
 pauseApp(
)
 {
 }

 
  public
 void
 destroyApp(
boolean
 unconditional)
 {
 }


}

  

   原文连接:http://wiki.forum.nokia.com/index.php/How_to_block_the_screen_saver
---------------------------------------------------------
---------------------------------------------------------
Table 6.1. com.nokia.mid.ui.DeviceControl

Method

Description

static void flashLights(long duration)

Flashes the lights.

static void setLights(int num, int level)

Turns the lights on and off.

static void startVibra(int freq, long duration)

Vibrates for a given frequency and time.

static void stopVibra()

Stops vibrating.


The two device elements you can control are the lights and vibration. To temporarily flash the lights on and off, use the flashLights method. For example:

import com.nokia.mid.ui.DeviceControl;
…
    DeviceControl.flashLights(5000);

This code will cause the lights (such as the LEDs) to flash. If there is no support for this feature, then nothing will happen (duh). The integer value specifies the length of time (in milliseconds) to keep the lights on, although the device might override this value if you specify a number that is too large.

The other method relating to lights, setLights , allows you to control any of the lights on the device individually, such as the backlight or the LEDs …in theory. In reality, Nokia only gives you the ability to control the device's backlight (if it has one). To do this, call the method with the light number (the first integer) set to 0 for the backlight and the level integer set to a number between 0 and 100 (where 0 is off and 100 is the brightest level). For devices that don't support graded backlighting, all values between 1 and 100 just translate to on. Here's an example of setLights in action:

DeviceControl.setLights(0, 100);

NOTE

 

Tip

A word of warning about playing with the backlight: There is no method to determine the current backlighting level; therefore, you have no way of restoring the lighting to the level the user previously had. Be careful using this function. A user won't be impressed if, while playing in a dark place, you turn the lights out to reward them for completing a level.

If you really want to add this function to your game, consider making it an option the player can enable or disable. This applies to the vibration function as well.

 

原文连接:http://j2megame.atw.hu/ch06lev1sec122.html

 

 

 

 

 

 

 

 

 

 

 

 


    
[3] Object-C入门美教材《Learn Objective–C on the Mac》
    来源: 互联网  发布时间: 2014-02-18
Object-C入门好教材《Learn Objective–C on the Mac》

这本书是我在www.iphoneside.com上看到的,Amazon上给出了4星半。于是我把它下载回来看,现在还差最后一张内容和AppendixA没看。总体感觉写的非常好。

 

      这是一本入门书。作为一本入门书,我认为像<C++ Primer>和<Thinking in Java>这样的很不错,可惜有些大,最值得称道的是<Python Tutorial>这样的。把基本的概念告诉你,让我们有个扎实的基础。然后再讲解一些常用库,因为写过程序的都知道,我们不是活在一个真空的世界,无论写什么程序,我们都需要库甚至框架的支持。<Learn Object-C On Mac>非常注意这点。因为我相信现实中,极少有人会在Linux/Windows/Solaris这样的平台上用Object-C,而99.99%的人学习这门语言就是两个目的:(1)iPhone的开发;(2)Mac软件的开发或者移植。所以这本书就是依赖于Cocoa这个框架来讲解Object-C的。而且书中对Cocoa常用的类和特有的技巧(譬如KVC)都有涉猎。

       其次,书中的例子规模中等,而且举例恰当。始终不过几个小例子,非常适合这种入门的教材。

       最后,英文书看的不算累,语言很幽默。时不时还搞搞笑,让人看得很轻松。

 

        当然了,这本书只是一本入门书,但是我现在感觉看完这本书,我可以很平坦的去学习Mac和iPhone开发了,基础还是很不错的。当然了,我觉得增加一章节介绍线程的可能会更好:)

 

1 楼 climber2002 2009-03-10  
谢谢关注www.iphoneside.com,因为违反版权,网站上的电子书已经全部删除了
2 楼 guying1028 2009-11-03  
能给传个吗??guying1028@gmail.com,谢谢!
3 楼 zhoulei984623 2010-03-10  
兄弟 求一份  我都找了一整天了 就是下不到
zhoulei984623@qq.com

    
最新技术文章:
▪Android开发之登录验证实例教程
▪Android开发之注册登录方法示例
▪Android获取手机SIM卡运营商信息的方法
▪Android实现将已发送的短信写入短信数据库的...
▪Android发送短信功能代码
▪Android根据电话号码获得联系人头像实例代码
▪Android中GPS定位的用法实例
▪Android实现退出时关闭所有Activity的方法
▪Android实现文件的分割和组装
▪Android录音应用实例教程
▪Android双击返回键退出程序的实现方法
▪Android实现侦听电池状态显示、电量及充电动...
▪Android获取当前已连接的wifi信号强度的方法
▪Android实现动态显示或隐藏密码输入框的内容
▪根据USER-AGENT判断手机类型并跳转到相应的app...
▪Android Touch事件分发过程详解
▪Android中实现为TextView添加多个可点击的文本
▪Android程序设计之AIDL实例详解
▪Android显式启动与隐式启动Activity的区别介绍
▪Android按钮单击事件的四种常用写法总结
▪Android消息处理机制Looper和Handler详解
▪Android实现Back功能代码片段总结
▪Android实用的代码片段 常用代码总结
▪Android实现弹出键盘的方法
▪Android中通过view方式获取当前Activity的屏幕截...
▪Android提高之自定义Menu(TabMenu)实现方法
▪Android提高之多方向抽屉实现方法
▪Android提高之MediaPlayer播放网络音频的实现方法...
▪Android提高之MediaPlayer播放网络视频的实现方法...
▪Android提高之手游转电视游戏的模拟操控
 


站内导航:


特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

©2012-2021,,E-mail:www_#163.com(请将#改为@)

浙ICP备11055608号-3