Eclipse的HTML/JSP/XML/CSS/DTD/JavaScript的插件

我习惯偏好于Eclipse的最精简版--Eclipse IDE for Java Developers,它本省只带了很少的插件,当用到某些新技术的时候,我再去安装相关的插件,选择插件的首选原则也是实用、简洁。其实Eclipse有很多非常优秀的Plug-ins. 如,tomcat-plugin、Easyexplore、Eclipse HTML Editor等。

其中Eclipse HTML Editor就是一个优秀的Plug-in。

Eclipse HTML Editor is an Eclipse plugin for HTML/JSP/XML Editing. It works on Eclipse 3.0 (or higher), JDT and GEF. It has following features.

  • HTML/JSP/XML/CSS/DTD/JavaScript语法高亮
  • HTML/JSP预览
  • JSP/XML验证
  • 内容提示 (HTML标签/属性, XML based on DTD和JSP标签库等)
  • HTML/JSP/XML文件创建向导
  • 大纲视图
  • Editor Preferences
  • Editor Folding
  • Web Browser (It works as an Eclipse's editor)
  • Image Viewer
  • Tag Palette
  • CSS code completion and outline
  • DTD code completion, outline and validation
  • JavaScript code completion, outline and validation
Posted in 编程开发 | 1 Comment

Discuz! X2设置禁止游客访问所有页面

Discuz! X2如何设置禁止游客访问所有页面?

管理员进入管理中心,选中“用户”tab,选中左边类目的“用户组”,然后选中子tab“系统用户组”,在页面上找到游客组,点击编辑!
如图


最后做如下设置

Posted in 生活笔记 | 3 Comments

[android]设置Spinner弹出框/下拉框的样式

Spinner drop-down list 默认的样式比较丑陋的,默认效果图见上一篇文章Android Spinner例子

所以我们要自定义dropdown list的样式,下拉框的样式不能直接在Spinner标签里定义的,但也非常简单。
如下所以:

1. Define layout XML
在res/layout/下新建一个XML文件-drop_down_item.xml

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
	android:textColor="#000000" android:layout_width="match_parent"
	android:layout_height="wrap_content" android:padding="12dip">
</TextView>

此layout XML是作用于下拉列表中一项的样式。

2. setDropDownViewResource

ArrayAdapter<String> accountTypesAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item,	array_type);
accountTypesAdapter.setDropDownViewResource(R.layout.account_type_drop_down_item);
spinner.setAdapter(accountTypesAdapter);

最终的效果

Posted in android, 编程开发 | Tagged , , , , | 2 Comments

Android的沙箱模式

一旦安装到设备上,每个Android应用都存活在各自的安全沙箱中:

  • Android OS是多用户的Linux系统,每个应用都被分配给不同用户。
  • 默认情况下,系统给每个应用分配唯一的Linux user ID(User ID只给系统使用,应用本身是不知道的)。系统为每一个应用下所有的文件都设置正确的权限,只有属于该应用的user ID才能访问它们。
  • 每个进程都拥有专属的虚拟机,所以应用代码的运行跟另外的应用都是独立开来的。
  • 默认下,每个应用都运行在自己专属的Linux进程。当一个应用中的任何一个组件要执行的时,Android会先为它启动进程;当应用不用的时或者必须要为其他应用腾出内存时,Android会关闭该进程。
Posted in android, 编程开发 | Tagged , | Comments Off

Android Spinner例子

在Android中, Spinner组件就是下拉列表. 弹出一个选项列表,允许你从列表中选择一项。

布局的XML文件如下

<Spinner android:id="@+id/Spinner01"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

Activity

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
public class SpinnerExample extends Activity {
private String array_spinner[];
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
array_spinner=new String[5];
array_spinner[0]="1";
array_spinner[1]="2";
array_spinner[2]="3";
array_spinner[3]="4";
array_spinner[4]="5";
Spinner s = (Spinner) findViewById(R.id.Spinner01);
ArrayAdapter adapter = new ArrayAdapter(this,
android.R.layout.simple_spinner_item, array_spinner);
s.setAdapter(adapter);
}
}

根据value设置Spinner,当然用position设置Spinner会更好,但是有些场景下只能用value来设置。

spinner.setSelection(adapter.getPosition(account.type));

The Output will look like

设置弹出下拉列表的样式见设置Spinner弹出框/下拉框的样式

Posted in android, 编程开发 | 2 Comments

android自动关闭(隐藏)提示框(对话框)

正在做一个小项目,实现修改密码的功能,当输入的旧密码不正确时,弹出一个提示然后自动消失。

代码如下:

if (!settingInfo.getString(KEY_PWD, "132465").equals(oldPwd)) {
Toast.makeText(getApplicationContext(), "Old password is wrong", Toast.LENGTH_SHORT).show();
return;
}

A toast notification is a message that pops up on the surface of the window. It only fills the amount of space required for the message and the user's current activity remains visible and interactive. The notification automatically fades in and out, and does not accept interaction events.

Posted in android, 编程开发 | Comments Off

Android的LayoutInflater

LayoutInflater是用来把XML布局文件转换成Android的View对象。它从来不是直接实例化出来的,取而代之的是使用getLayoutInflater() or getSystemService(String)获取跟当前context绑定一起的LayoutInflater实例,这个实例跟当前运行的设备也正确的配置一起。
得到LayoutInflater实例的三个方法:

LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

 

LayoutInflater inflater = ((Activity) this).getLayoutInflater();

 

LayoutInflater inflater = LayoutInflater.from(getApplicationContext())

生成View对象

View contentView = LayoutInflater.from(getApplicationContext()).inflate(R.layout.add_account, null);

 

Posted in android, 编程开发 | Comments Off

Android实现底部菜单栏和顶部菜单栏

Android App的需求:同时显示顶部菜单栏和底部菜单栏,要一直显示在屏幕上,中间是一个可滚动的动态列表。

下面是实现的简单代码

main.xml包含top menu, bottom menu以及动态列表的占位符。

Main.xml
<?xml version=“1.0″ encoding=“utf-8″?><LinearLayout xmlns:android=“http://schemas.android.com/apk/res/android”android:orientation=“vertical”android:layout_width=“fill_parent”android:layout_height=“fill_parent” > 

<!– top menu –>

<LinearLayoutandroid:id=“@+id/top_menu”

android:layout_width=“fill_parent”

android:layout_height=“wrap_content” >

<TextView android:id=“@+id/top”

android:layout_width=“fill_parent”

android:layout_height=“40px”

android:background=“@drawable/red”

android:text=“top static view” />

</LinearLayout>

<!– placeholder for list –>
<ListView android:id=“@android:id/list”

android:layout_width=“fill_parent”

android:layout_height=“wrap_content”

android:layout_weight=“1″ />

<!– bottom menu –>

<LinearLayout android:id=“@+id/bottom_meunun”

android:layout_width=“fill_parent”

android:layout_height=“wrap_content” >

<TextView android:id=“@+id/bottom”

android:layout_width=“fill_parent”

android:layout_height=“40px”

android:background=“@drawable/yellow”

android:text=“bottom static view” />

</LinearLayout>

</LinearLayout>

要达到需求中的这种效果,最关键就是weight属性,weight属性就是让控件填充parent留下的空白,LinearLayout支持weight属性。weight默认值是0,在上面的例子中,ListView有个layout_weight=“1″ ,在屏幕上top menu和bottom menu各占40pt,ListView占余下的空白区域。假设bottom menu和ListView的layout_weight都是1,那么bottom menu和ListView会平分空白区域,top menu还是占40pt。

现在,有20个列表项,每个列表项的高度都是30pt,滚动视图的实际效果如下所示:

Posted in android, 编程开发 | Comments Off

Android开发入门之如何使用ListView

ListView是Android经常用到的控件,它用来展示可以滚动的列表。ListView里的列表项是通过adapter来添加的,adapter必须是继承“BaseAdapter”,它的职责是提供数据模型,以及把数据转换成列表项。

Android自带ArrayAdapter、SimpleAdapter和CursorAdapter
ArrayAdapter处理数组或者列表里的数据,通常列表项只有一个文本。
CursorAdapter主要针对数据使用。
SimpleAdapter处理列表里的数据,不同于ArrayAdapter,SimpleAdapter每一个列表项由一个Map对象提供数据。

SimpleAdapter实现ListView的步骤:

1. 定义列表项的layout
2. 准备ListView要显示的数据 ;
3. 把数据添加到数组里;
4. 构建适配器 , 数据适配器 , 动态数组有多少元素就生成多少个列表项;
5. 把适配器 添加到ListView,并显示出来。

1.定义列表项的layout,某一项的layout,并不是整个List的layout。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
	android:layout_width="fill_parent" android:layout_height="fill_parent"
	android:orientation="horizontal">
	<TextView android:text="TextView" android:id="@+id/accountType"
		android:layout_width="wrap_content" android:layout_height="wrap_content"
		android:paddingLeft="10pt" android:background="#FFFFFF" android:width="30pt"></TextView>
	<TextView android:text="TextView" android:id="@+id/accountNumber"
		android:layout_width="wrap_content" android:layout_height="wrap_content"
		android:paddingLeft="10pt" android:background="#FFFFFF" android:width="60pt"></TextView>
	<TextView android:text="TextView" android:id="@+id/password"
		android:layout_width="wrap_content" android:layout_height="wrap_content"
		android:paddingLeft="10pt"></TextView>
</LinearLayout>

AccountsActivity

package com.eightqiu.secretbox;
 
import java.util.ArrayList;
import java.util.HashMap;
 
import android.app.Activity;
import android.os.Bundle;
import android.widget.ListView;
import android.widget.SimpleAdapter;
 
public class AccountsActivity extends Activity {
 
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.passwords);
		ListView listView = (ListView) findViewById(R.id.list_view_passwords);
		ArrayList<HashMap<String, String>> accountInfos = getAccountInfos();
 
		// 4. 构建适配器 , 数据适配器 , 动态数组有多少元素就生成多少个列表项;
		SimpleAdapter simpleAdapter = new SimpleAdapter(this, accountInfos, R.layout.account_info_item, new String[] {
				"accountType", "accountNumber", "password" }, new int[] { R.id.accountType, R.id.accountNumber,
				R.id.password });
 
		// 5. 把适配器 添加到ListView,并显示出来。
		listView.setAdapter(simpleAdapter);
	}
 
	/**
	 * 2.准备ListView要显示的数据; <br>
	 * 3.把数据添加到数组里;
	 **/
	private ArrayList<HashMap<String, String>> getAccountInfos() {
		ArrayList<HashMap<String, String>> accountInfos = new ArrayList<HashMap<String, String>>();
 
		HashMap<String, String> accountInfo1 = new HashMap<String, String>();
		accountInfo1.put("accountType", "qq");
		accountInfo1.put("accountNumber", "335373989");
		accountInfo1.put("password", "132456");
 
		HashMap<String, String> accountInfo2 = new HashMap<String, String>();
		accountInfo2.put("accountType", "email");
		accountInfo2.put("accountNumber", "dinglei@126.com");
		accountInfo2.put("password", "132456");
 
		accountInfos.add(accountInfo1);
		accountInfos.add(accountInfo2);
		return accountInfos;
	}
 
}
Posted in android, 编程开发 | Comments Off

力学增高法

只要是人类,背脊或多或少都有不正常的弯曲。如果把此种(不正常的弯曲)矫正,则各部的关节会伸长,使你的高度增加,你不要小看一个关节由弯曲到伸直能长多少,人体的关节有那么多,积少成多,当然可观。

力学治疗法,不仅对小儿麻痹及半身不遂有显著效果,同时能治疗严重的猫背及O型脚,并使脊椎恢复正常,使体态转好,增加身高。除此之外,也能够治疗妇 女生理的不顺、冷症等。因此,从事于这种美容体操的妇女日益增多。只要每天施行3次,3个月之后,最少能长高3厘米,体态会变得婀娜多姿,可以说是一举两 得的美容体操。

(一)并拢两脚,笔直地站立,把一条腿向后移开半步,然后把上体向前弯曲,不要弯膝盖,使手指能触到地面为止,如此,连续做15~20次。这个动作,可以使大腿及膝盖的线条优美柔和,令左右两腿匀称。

(二)两脚打开30~60厘米,挺直地站立,把一条腿向后退半步,然后把上身扭曲,使指尖能够触及另一侧的脚趾。并连续做10~15次。这个动作,可以使两腕的线条优美柔和,腰围缩小,并矫正脊椎柱的弯曲。

(三)两脚打开60~70厘米,把一条腿向后退半步,再抬起双臂,与肩膀同高,然后把双臂水平地向后甩去。向长腿的方向扭转7次,向短腿的方向扭转4次。这动作,可以使腰围紧缩,体态娇美。

(四)面向墙壁,保持30厘米的距离站住,一条腿向后退半步,脚后跟张开,让足尖朝向内侧,再把两手按在墙壁上,挺起胸部,以臀部向后突起的姿势,并拢着 两个膝盖,曲伸双腿。连续做20~50次。这个动作,可以让股关节有了转位,能治好两腿不匀称的毛病,而且能使腿部线条美丽。

(五)做一个长度乃厘米,阔度约有手腕两倍的腰枕系在腰部,把一条腿向后退半步,深深地坐人椅子里面,再把肩膀向后面靠去,挺起胸部,连续做20次。这个动作,能治好疲劳及肩膀酸痛的毛病,并可以收缩腹部。

(六)拿起一条绳子站立,把一条腿向后退半步,然后,以这种姿势,有韵律地跳跃60~70次。跳绳是一种很好的全身运动,不仅对健康及美容有很大的帮助,同时能收缩全身的肌肉,增加身高。

(七)正坐在小腿上,把一条腿的膝盖向后退3~5厘米,两肩向后扳开,手臂笔直地向上举起,以此姿势,把上体向前倾倒,尽量贴近地板。连续做20~40次。这个动作,是矫正猫背最有效的运动,不仅能使背部挺直,同时能美化腕部的线条。

(八)坐下来,用布条将两膝盖上部绑好,两手抱住小腿,让一条腿的膝盖与另外一条腿的膝盖保持平整一般高,再利用两手拉身体弯曲,使下巴触到膝盖,连续做20~30次,这个动作,可以拉紧臀部肌肉。

(九)做过上述8项运动之后,暂时不要解除膝盖上的布,用一个枕头垫在背部,伸直两腿,躺上15分钟。如果你具有冷症,夜晚可以绑着布条入睡,如此,经过一段时间即可把冷症治愈。对于猫背及O型脚的人来说,这些是最有效的运动。

能增高的食物

如果你现在尚未满25岁(最好先确认你的骨骺线没有闭合),那么只要你遵行下面所说的饮食方法,仍然有机会再增高一点。

要想增高,应该多吃蛋白质,尤其是含有中"胺基酸"的食物,如:面粉、小麦胚芽、豆类、虾、螃蟹、贝类、海藻、牛肉、鸡肉、肝脏、猪腿肉、蛋、牛奶、乳酪及深色蔬菜等。

Posted in 生活笔记 | Comments Off