乱七八糟
guzizai2007 · 共 164 篇文章
2天弄了个个人网站
花了两天时间做了个小小的个人网站,功能不多但基本够用: 前后台页面基本都是从别人网站上爬下来的,对于前端不是很强的我的说真是省心省力,后台代码逻辑都很简单,主要是发布文章和页面缓存、静态化那块,其实做的还挺粗糙的,不过用起来也还好了,毕竟2天弄完,希望自己以后还是坚持写写博客吧,虽然挺忙的~ 前台:http://coriger.com/ 后台:
2015-09-01T18:21:28Z · 非技术 · 评论(10)
select()和poll()函数
select()函数和poll()函数均是主要用来处理多路I/O复用的情况。比如一个服务器既想等待输入终端到来,又想等待若干个套接字有客户请求到达,这时候就需要借助select或者poll函数了。 1、select()函数 int select(int fdsp1, fd_set *readfds, fd_set *writefds, fd_set *errorfds, const struct timeval *timeout); 各个参数含义如下: int fdsp1:最大描述符值 + 1 fd_set *readfds:对可读感兴趣的文件描述符集 fd_set *writefds:对可…
2014-09-14T23:43:52Z · 非技术 · 评论(0)
linux文件描述符
1、文件描述符是一个简单的整数,用以标明每一个被进程所打开的文件或socket 2、每一个进程都有自己的文件描述符集合 3、当创建进程时,通常默认会有3个文件描述符(0,1,2),0代表标准输入,1代表标准输出,2代表标准错误,它们统称为标准IO,所以如果进程通过open打开一个文件的时候,文件描述符会从3开始,fd的值其实就是进程中打开文件列表的下标索引 4、由于文件描述符在一个进程中是特有的,因此不能在多个进程中间实现共享,而唯一的例外是在父/子进程之间,当一个进程调用fork时,调用fork时打开的所有文件在子进程和父进程中仍然是打开的,而且子进程写入文件描述符会影响到父进程的同一文件…
2014-09-14T21:44:01Z · 非技术 · 评论(0)
OnPageChangeListener-->>onPageSelected
public void onPageSelected(int arg0) 此方法是页面跳转完后得到调用,arg0是你当前选中的页面的Position(位置编号)。
2014-09-10T17:25:57Z · 非技术 · 评论(0)
OnPageChangeListener-->>onPageScrollStateChanged
public void onPageScrollStateChanged(int arg0) 此方法是在状态改变的时候调用,其中arg0这个参数有三种状态(0,1,2)。arg0 ==1的时辰默示正在滑动,arg0==2的时辰默示滑动完毕了,arg0==0的时辰默示什么都没做。 当页面开始滑动的时候,三种状态的变化顺序为(1,2,0)
2014-09-10T17:22:36Z · 非技术 · 评论(0)
OnPageChangeListener-->>onPageScrolled
public void onPageScrolled(int arg0, float arg1, int arg2) 当页面在滑动的时候会调用此方法,在滑动被停止之前,此方法回一直得到调用。其中三个参数的含义分别为: arg0 :当前页面,及你点击滑动的页面 arg1:当前页面偏移的百分比 arg2:当前页面偏移的像素位置
2014-09-10T17:19:42Z · 非技术 · 评论(0)
头条新闻(6)
修改了一下评论的样式: <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:scrollbars="vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="…
2014-09-08T11:34:26Z · 非技术 · 评论(0)
头条新闻(5)
新闻详情页面初步设计: <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:scrollbars="vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="…
2014-09-07T23:40:45Z · 非技术 · 评论(0)
头条新闻(4)
填充ListView 新闻列表: // 填充ListView 显示新闻列表 ListView listView = (ListView)findViewById(R.id.newsList); List<HashMap<String, Object>> newList = new ArrayList<HashMap<String, Object>>(); for (int i = 0; i < 20; i++) { HashMap<String, Object> map = new HashMap<String, Object>(); map.put("title", "中日钓鱼岛争端中P3…
2014-09-06T19:29:07Z · 非技术 · 评论(0)
头条新闻(3)
默认选中推荐类型: 需要自定义adapter: package com.cmge.news; import java.util.List; import java.util.Map; import android.content.Context; import android.view.View; import android.view.ViewGroup; import android.widget.SimpleAdapter; import android.widget.TextView; public class CustomSimplerAdapter extends SimpleA…
2014-09-06T18:03:31Z · 非技术 · 评论(0)
头条新闻(2)
新闻分类动态生成: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height=…
2014-09-06T17:08:14Z · 非技术 · 评论(0)
头条新闻(1)
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:layout_gravity="center" android:gravity="center_horizontal"> <LinearLayout …
2014-09-06T15:33:51Z · 非技术 · 评论(0)
Android中设置全屏的方法
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //设置无标题 requestWindowFeature(Window.FEATURE_NO_TITLE); //设置全屏 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.main); } <?xml ve…
2014-09-03T17:47:10Z · 非技术 · 评论(0)
Service1.1
定义一个服务: package com.example.android_service; import android.app.Service; import android.content.Intent; import android.os.IBinder; import android.util.Log; /** * @desc 自定义Service * @author ljt * @time 2014年8月29日 下午5:25:21 */ public class HelloService extends Service{ @Override public void onCreate(…
2014-08-29T18:39:18Z · 非技术 · 评论(0)
Intent1.1
Intent intent = new Intent(); ComponentName comName = new ComponentName(MainActivity.this, MainActivity2.class); intent.setComponent(comName); startActivity(intent); 配置Action Category: 默认Category: <activity android:name="com.example.android_intent.MainActivity2"> <intent-filter> <action android:nam…
2014-08-29T16:59:49Z · 非技术 · 评论(0)