27

expire_time为每隔多少分钟检测一下dead connection(发送一个包到client),如果是dead connection,则是否session/process资源
idle_time为超过这一期限则把session状态设置为sniped,等下次交互的时候会断开连接并释放资源
sqlnet.expire_time

sqlnet.expire_time actually works on a different principle and is used to detect dead connections as opposed to disconnecting(actually ‘sniping’) a session based on idle_time which the profile accomplishes.

Sqlnet.expire_time basically instructs the Server to send a probe packet every set minutes to the client , and if it finds a terminated connection or a connection that is no longer in use, causes the associated server process to terminate on the server.
A valid database connection that is idle will respond to the probe packet causing no action on the part of the Server , whereas the resource_limit will snipe the session when idle_time is exceeded. The ‘sniped’ session will get disconnected when the user(or the user process) tries to communicate with the server again.
But again,as you mentioned, expire_time works globally while idle_time profile works for that user. You can use both of them to make sure that the client not only gets sniped but also gets disconnected if the user process abnormally terminates.

查看idle_time的设置可以先查看用哪个profile,然后再查询这个profile的设置
select username,profile from dba_users where username=’
select * from dba_profiles where profile = ‘

标签:
25

http://my.btodo.com

有中文版,简洁,对我来说够用了

标签:
23

在android中拼接图片,可以先生成空的位图,然后在往里面依次drawBitmap,不过要注意内存的使用,可以先缩小1/2后拼接起来

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
int height = 0,width=0;
int pic_num = flipper.getChildCount();
ByteArrayOutputStream out = new ByteArrayOutputStream();
for(int j = 0 ; j<pic_num ; j++){
	height+=((MyImageView)flipper.getChildAt(j)).myPic.getHeight();
	int c_width = ((MyImageView)flipper.getChildAt(j)).myPic.getWidth();
	if(c_width>width)
		width=c_width;
}
Bitmap newbm = Bitmap.createBitmap(width, height, Config.ARGB_8888);
Canvas canvas = new Canvas(newbm);
int y=0;
for(int j = 0 ; j<pic_num ; j++){
	Bitmap bm = ((MyImageView)flipper.getChildAt(j)).myPic;
	canvas.drawBitmap(bm, 0, y, null);
	y+=bm.getHeight();
}
newbm.compress(Bitmap.CompressFormat.PNG, 70, out);
return out.toByteArray();
标签:
18

android开发者对如何赚钱肯定很有疑问,这边转一篇文章,感觉写的很有道理
网上关于如何写程序的文章多如牛毛,但我至今却没看到一篇真正告诉咱开发者如何赚钱的。我觉得该写点东西了,我暂且称之为《Android开发者的盈利圣经》,希望大家能也能早日脱离苦海。首先声明,这不是教条,也不是广告,而是我和身边一批Android圣斗士们通过血与泪的教训摸索出来的一点启发,它对我们的价值或许远远大于10万行代码。

1、
如果做的是中文应用,不要幻想下载收费。Android Market不是AppStore,中文应用很少有人付费下载。Android Market至今还不支持国内用户付费下载,即使未来支持,也没几个人会为你的应用付费,因为用户总有类似的免费应用可选择。

2、
不要在应用内通过SP收费代码收费。一旦你的应用中加入了SP代码,国内所有主流的应用商店基本上都不会收录你的应用,勉强收录了也会直接置底。关键是,你的应用会因此骂名昭著,用户量一落千丈。

3、
广告要加在用户长期停留的界面,而不是加在最显眼的地方。不要在用户短暂停留的界面加广告,不要在应用的封面、游戏的主菜单界面加广告,这样不仅很招人烦,也不会有任何效果。只在个别主要的界面加入广告,收入要比很多界面都加满了广告要高。
继续阅读 »

标签:
16

Android中常常使用shape来定义控件的一些显示属性,今天看了一些shape的使用,对shape有了大体的了解,稍作总结:
先看下面的代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
            <shape>
                <!-- 实心 -->
                <solid android:color="#ff9d77"/>
                <!-- 渐变 -->
                <gradient android:startColor="#ff8c00"
                    android:endColor="#FFFFFF"
                    android:angle="270" />
                <!-- 描边 -->
                <stroke android:width="2dp"
                    android:color="#dcdcdc" />
                <!-- 圆角 -->
                <corners android:radius="2dp" />
                <padding android:left="10dp"
                    android:top="10dp"
                    android:right="10dp"
                    android:bottom="10dp" />
            </shape>

solid:实心,就是填充的意思
android:color指定填充的颜色
继续阅读 »

标签:
10

在写相机相关应用的时候遇到捕获的画面方向和手机的方向不一致的问题,比如手机是竖着拿的,但是画面是横的,这是由于摄像头默认捕获的画面byte[]是根据横向来的,而你的应用是竖向的,解决办法是调用setDisplayOrientation来设置PreviewDisplay的方向,效果就是将捕获的画面旋转多少度显示。
设置 preview 的顺时针旋转角度。这将影响 preview frames 和拍照之后的相片显示。该方法主要用于垂直模式的应用。注意在旋转之前, front-facing cameras 的 preview 显示是水平 flip 的,这就是说, image 是沿着 camera sensor 的垂直中心轴来反射的 。所以用户可以像照镜子一样看到他们自己。这不会影响传入函数 onPreviewFrame(byte[], Camera) 的、 JPEG 相片的、或记录的 video 的 byte array 的顺序,你可以自己做旋转处理。在 preview 期间是不允许调用该方法的。如果你想要是你的照片和显示出来的角度一致,你可以参考下列代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  public static void setCameraDisplayOrientation ( Activity activity ,
          int cameraId , android.hardware.Camera camera ) {
     android.hardware.Camera.CameraInfo info =
              new android.hardware.Camera.CameraInfo();
     android.hardware.Camera.getCameraInfo ( cameraId , info );
      int rotation = activity.getWindowManager ().getDefaultDisplay ().getRotation ();
      int degrees = 0 ;
      switch ( rotation ) {
          case Surface.ROTATION_0 : degrees = 0 ; break ;
          case Surface.ROTATION_90 : degrees = 90 ; break ;
          case Surface.ROTATION_180 : degrees = 180 ; break ;
          case Surface.ROTATION_270 : degrees = 270 ; break ;
      }
 
      int result ;
      if ( info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT ) {
         result = ( info.orientation + degrees ) % 360 ;
         result = ( 360 - result ) % 360 ;   // compensate the mirror
      } else {   // back-facing
         result = ( info.orientation - degrees + 360 ) % 360 ;
      }
     camera.setDisplayOrientation ( result );
  }
标签:
10

LinearLayout also supports assigning a weight to individual children. This attribute assigns an “importance” value to a view, and allows it to expand to fill any remaining space in the parent view. Child views can specify an integer weight value, and then any remaining space in the view group is assigned to children in the proportion of their declared weight. Default weight is zero. For example, if there are three text boxes and two of them declare a weight of 1, while the other is given no weight (0), the third text box without weight will not grow and will only occupy the area required by its content. The other two will expand equally to fill the space remaining after all three boxes are measured. If the third box is then given a weight of 2 (instead of 0), then it is now declared “more important” than both the others, so it gets half the total remaining space, while the first two share the rest equally.

其实很简单,weight本来的意思就是重量,即这个属性所代表的是重要程度,而不是比例
如果三个view横列,前两个view的wieght是1,第三个是默认值0。可见第三个view的权weight最低,那么第三个view就只会占用自己内容所需的宽度,剩下的宽度会被前两个view平分。
如果第三个view的wieght是2,那么前两个view就只占据自己内容所需的宽度,第三个会占据剩下所有空间。

至于Linearlayout的weight属性越小的所占空间越多,网上有人说是

layout的weight的作用和view的weight类似,但是效果相反。部分weight取1,其他layout的weight取0就是让内容部分独占剩下的所有空间

标签:
06

如下

1
2
3
BitmapFactory.Options options = new BitmapFactory.Options();
	options.inSampleSize = 2;//图片宽高都为原来的二分之一,即图片为原来的四分之一
	Bitmap bitmap = BitmapFactory.decodeStream(cr.openInputStream(uri), null, options);
preload preload preload