当前位置: 首页 > 编程日记 > 正文

Android项目框架综合实例

综合使用ViewPager、Fragment、RecycleView等,实现类似“网易新闻浏览器 ”的项目综合框架,要求实现:

  • 底部导航,分别是“首页”,“视频”,“讲讲”,“我的”;底部导航不要求滑动翻页(使用Framelayout作为容器,但也可以使用Viewpager作为容器,图片可自行准备,也可以用分享的图片素材)。
  • 内导航,在“首页”对应的Fragment中实现若干项组成的顶部导航;内导航要求实现滑动翻页(使用ViewPager作为容器,要求内导航碎片不少于十项)。

加分项:内导航的第一个碎片页使用Listview或者RecylceView实现的宝宝相册列表(或者聊天界面或者其它类似的页面)进行填充,单击列表项时能做出合适的响应,例如展开详情页。

MainActivity.java

package com.example.amicool2020s;import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.LinearLayout;import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.viewpager.widget.ViewPager;import java.util.ArrayList;
import java.util.List;public class MainActivity extends AppCompatActivity {private ViewPager mViewPager;private List<Fragment> mFragments;private LinearLayout mTabWechat,mTabFriend,mTabContact,mTabSetting;private ImageButton mImgWechat,mImgFriend,mImgContact,mImgSetting;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);//1.获取引用mViewPager =  (ViewPager)findViewById(R.id.viewPager);//2.准备碎片initFragment();//3.准备适配器FragmentPagerAdapter mAdapter = new FragmentPagerAdapter(getSupportFragmentManager()) {@Overridepublic Fragment getItem(int position) {return mFragments.get(position);}@Overridepublic int getCount() {return mFragments.size();}};//设置适配器mViewPager.setAdapter(mAdapter);//4.设置Viewpager的切换监听mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {@Override//页面滚动事件public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {}@Override//页面选中事件public void onPageSelected(int position) {//mViewPager.setCurrentItem(position);resetImgs();selectTab(position);}@Override//页面滚动状态改变事件public void onPageScrollStateChanged(int state) {}});initViews();//底部导航控件initEvents();//底部导航控件事件}private void initFragment(){mFragments = new ArrayList<>();//mFragments.add(new WechatFragment());String[] channelList = getResources().getStringArray(R.array.news_category_title);mFragments.add((WechatFragment.newInstance(channelList)));mFragments.add(new FriendFragment());mFragments.add(new ContactFragment());mFragments.add(new SettingFragment());}private void initViews(){mTabWechat = (LinearLayout)findViewById(R.id.id_tab_wechat);mTabFriend = (LinearLayout)findViewById(R.id.id_tab_friend);mTabContact = (LinearLayout)findViewById(R.id.id_tab_contact);mTabSetting = (LinearLayout)findViewById(R.id.id_tab_setting);mImgWechat = (ImageButton)findViewById(R.id.id_tab_wechat_img);mImgFriend = (ImageButton)findViewById(R.id.id_tab_friend_img);mImgContact = (ImageButton)findViewById(R.id.id_tab_contact_img);mImgSetting = (ImageButton)findViewById(R.id.id_tab_setting_img);}private void initEvents(){View.OnClickListener onClickListener = new View.OnClickListener() {@Overridepublic void onClick(View v) {//重置所有的IMagebuttonresetImgs();// 根据点击的Tab切换不同的页面及设置对应为绿色switch (v.getId()){case R.id.id_tab_wechat:selectTab(0);break;case R.id.id_tab_friend:selectTab(1);break;case R.id.id_tab_contact:selectTab(2);break;case R.id.id_tab_setting:selectTab(3);break;}}};mTabWechat.setOnClickListener(onClickListener);mTabFriend.setOnClickListener(onClickListener);mTabContact.setOnClickListener(onClickListener);mTabSetting.setOnClickListener(onClickListener);}private void resetImgs(){mImgWechat.setImageResource(R.mipmap.tab_weixin_normal);mImgFriend.setImageResource(R.mipmap.tab_find_frd_normal);mImgContact.setImageResource(R.mipmap.tab_address_normal);mImgSetting.setImageResource(R.mipmap.tab_settings_normal);}private void selectTab(int i){switch (i){case 0:mImgWechat.setImageResource(R.mipmap.tab_weixin_pressed);break;case 1:mImgFriend.setImageResource(R.mipmap.tab_find_frd_pressed);break;case 2:mImgContact.setImageResource(R.mipmap.tab_address_pressed);break;case 3:mImgSetting.setImageResource(R.mipmap.tab_settings_pressed);break;}//设置当前点击的Tab所对应的页面mViewPager.setCurrentItem(i);}}
NewsChannelFragment.java
package com.example.amicool2020s;import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;/*** A simple {@link Fragment} subclass.*/
public class NewsChannelFragment extends Fragment {private String newsCategoryTitle;public static NewsChannelFragment newInstance(String newsCategoryTitle){Bundle bundle = new Bundle();bundle.putString("categoryTitle",newsCategoryTitle);NewsChannelFragment fragment = new NewsChannelFragment();fragment.setArguments(bundle);return fragment;}public NewsChannelFragment() {// Required empty public constructor}@Overridepublic void onCreate(@Nullable Bundle savedInstanceState) {super.onCreate(savedInstanceState);newsCategoryTitle = getArguments().getString("categoryTitle");}@Overridepublic View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {// Inflate the layout for this fragmentView view = inflater.inflate(R.layout.fragment_news_channel, container, false);TextView textView = (TextView)view.findViewById(R.id.newsCategoryTitle);textView.setText(newsCategoryTitle);return view;}}
NewsPageFragmentAdapter.java
package com.example.amicool2020s;import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;public class NewsPageFragmentAdapter extends FragmentPagerAdapter {String[] channelList;public NewsPageFragmentAdapter(FragmentManager fm, String [] channelList) {super(fm);this.channelList = channelList;}@Overridepublic Fragment getItem(int position) {return NewsChannelFragment.newInstance(channelList[position]);}@Overridepublic int getCount() {return channelList.length;}
}
SettingFragment.java
package com.example.amicool2020s;import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;import androidx.fragment.app.Fragment;/*** A simple {@link Fragment} subclass.*/
public class SettingFragment extends Fragment {public SettingFragment() {// Required empty public constructor}@Overridepublic View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {// Inflate the layout for this fragmentreturn inflater.inflate(R.layout.fragment_setting, container, false);}}
WechatFragment.java
package com.example.amicool2020s;import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.HorizontalScrollView;
import android.widget.RadioButton;
import android.widget.RadioGroup;import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;/*** A simple {@link Fragment} subclass.*/
public class WechatFragment extends Fragment {private HorizontalScrollView hvChannel;private RadioGroup rgChannel;private ViewPager vpNewList;private String[] channelList={"关注","头条","要闻","抗疫","视频","长沙","关注","头条","要闻","抗疫","视频","长沙"};public static WechatFragment newInstance(String[]channelList){Bundle bundle = new Bundle();bundle.putStringArray("channelList",channelList);WechatFragment fragment = new WechatFragment();fragment.setArguments(bundle);return fragment;}public WechatFragment() {// Required empty public constructor}@Overridepublic void onCreate(@Nullable Bundle savedInstanceState) {super.onCreate(savedInstanceState);channelList = getArguments().getStringArray("channelList");}@Overridepublic View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {// Inflate the layout for this fragmentView view = inflater.inflate(R.layout.fragment_wechat, container, false);hvChannel  =(HorizontalScrollView)view.findViewById(R.id.hvChannel);rgChannel = (RadioGroup)view.findViewById(R.id.rgChannel);vpNewList = (ViewPager)view.findViewById(R.id.vpNewList);rgChannel.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {@Overridepublic void onCheckedChanged(RadioGroup group, int checkedId) {vpNewList.setCurrentItem(checkedId);}});initTab(inflater);//初始化内导航标签initViewPager();return view;}private void initTab(LayoutInflater inflater){for(int i=0;i<channelList.length;i++){RadioButton rb = (RadioButton)inflater.inflate(R.layout.tab_rb,null);rb.setId(i);rb.setText(channelList[i]);RadioGroup.LayoutParams params = newRadioGroup.LayoutParams(RadioGroup.LayoutParams.WRAP_CONTENT,RadioGroup.LayoutParams.WRAP_CONTENT);rgChannel.addView(rb,params);}rgChannel.check(0);//模拟选择第一个选项,触发监听器,显示第一个碎片}private void initViewPager(){NewsPageFragmentAdapter adapter = new NewsPageFragmentAdapter(getActivity().getSupportFragmentManager(),channelList);vpNewList.setAdapter(adapter);vpNewList.setCurrentItem(0);vpNewList.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {@Overridepublic void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {}@Overridepublic void onPageSelected(int position) {setTab(position);}@Overridepublic void onPageScrollStateChanged(int state) {}});}private void setTab(int position){//切换ViewPager中的碎片RadioButton rb = (RadioButton)rgChannel.getChildAt(position);rb.setChecked(true);//模拟RadioButton的选择//滚动hvChannel,使得rb居中显示int left = rb.getLeft();int width = rb.getMeasuredWidth();DisplayMetrics metrics= new DisplayMetrics();super.getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);int screenWidth = metrics.widthPixels;int len = left+width/2-screenWidth/2;hvChannel.smoothScrollTo(len,0);}
}
ContactFragment.java
package com.example.amicool2020s;import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;import androidx.fragment.app.Fragment;/*** A simple {@link Fragment} subclass.*/
public class ContactFragment extends Fragment {public ContactFragment() {// Required empty public constructor}@Overridepublic View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {// Inflate the layout for this fragmentreturn inflater.inflate(R.layout.fragment_contact, container, false);}}
FriendFragment.java
package com.example.amicool2020s;import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;import androidx.fragment.app.Fragment;/*** A simple {@link Fragment} subclass.*/
public class ContactFragment extends Fragment {public ContactFragment() {// Required empty public constructor}@Overridepublic View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {// Inflate the layout for this fragmentreturn inflater.inflate(R.layout.fragment_contact, container, false);}}

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"tools:context=".MainActivity"><androidx.viewpager.widget.ViewPagerandroid:id="@+id/viewPager"android:layout_width="match_parent"android:layout_height="0dp"android:layout_weight="1"/><include layout="@layout/bottom"/>
</LinearLayout>

bottom.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="wrap_content"android:background="@android:color/darker_gray"><LinearLayoutandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:id="@+id/id_tab_wechat"android:gravity="center"android:orientation="vertical"><ImageButtonandroid:id="@+id/id_tab_wechat_img"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="#00000000"android:clickable="false"android:src="@mipmap/tab_weixin_pressed"/><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="微信"android:textColor="#ffffff" /></LinearLayout><LinearLayoutandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:id="@+id/id_tab_friend"android:gravity="center"android:orientation="vertical"><ImageButtonandroid:id="@+id/id_tab_friend_img"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="#00000000"android:clickable="false"android:src="@mipmap/tab_find_frd_normal" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="联系人"android:textColor="#ffffff" /></LinearLayout><LinearLayoutandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:id="@+id/id_tab_contact"android:gravity="center"android:orientation="vertical"><ImageButtonandroid:id="@+id/id_tab_contact_img"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="#00000000"android:clickable="false"android:src="@mipmap/tab_address_normal" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="通讯录"android:textColor="#ffffff" /></LinearLayout><LinearLayoutandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:id="@+id/id_tab_setting"android:gravity="center"android:orientation="vertical"><ImageButtonandroid:id="@+id/id_tab_setting_img"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="#00000000"android:clickable="false"android:src="@mipmap/tab_settings_normal" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="设置"android:textColor="#ffffff" /></LinearLayout></LinearLayout>

fragment_contact.xml

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"tools:context=".ContactFragment"><!-- TODO: Update blank fragment layout --><TextViewandroid:layout_width="match_parent"android:layout_height="match_parent"android:gravity="center"android:text="contact fragment" /></FrameLayout>

fragment_friend.xml

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"tools:context=".FriendFragment"><!-- TODO: Update blank fragment layout --><TextViewandroid:layout_width="match_parent"android:layout_height="match_parent"android:gravity="center"android:text="friend fragment" /></FrameLayout>

fragment_news_channel.xml

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"tools:context=".NewsChannelFragment"><!-- TODO: Update blank fragment layout --><TextViewandroid:id="@+id/newsCategoryTitle"android:layout_width="match_parent"android:layout_height="match_parent"android:gravity="center"android:textSize="30sp"android:text="@string/hello_blank_fragment" /></FrameLayout>

fragment_setting.xml

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"tools:context=".SettingFragment"><!-- TODO: Update blank fragment layout --><TextViewandroid:layout_width="match_parent"android:layout_height="match_parent"android:gravity="center"android:text="setting fragment" /></FrameLayout>

fragment_wechat.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"tools:context=".WechatFragment"><!-- TODO: Update blank fragment layout -->
<RelativeLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"><HorizontalScrollViewandroid:id="@+id/hvChannel"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_toLeftOf="@+id/ivShowChannel"android:scrollbars="none"><RadioGroupandroid:id="@+id/rgChannel"android:layout_width="wrap_content"android:layout_height="wrap_content"android:orientation="horizontal"/></HorizontalScrollView><ImageViewandroid:id="@+id/ivShowChannel"android:layout_width="40dp"android:layout_height="40dp"android:layout_alignParentRight="true"android:src="@mipmap/channel_down_narrow"android:scaleType="fitXY"/>
</RelativeLayout><androidx.viewpager.widget.ViewPagerandroid:id="@+id/vpNewList"android:layout_width="match_parent"android:layout_height="0dp"android:layout_weight="1"></androidx.viewpager.widget.ViewPager>
</LinearLayout>

tab_rb.xml

<?xml version="1.0" encoding="utf-8"?>
<RadioButton xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="wrap_content"android:layout_height="30dp"android:text=""android:background="@drawable/tab_selector"android:paddingLeft="15dp"android:paddingRight="15dp"android:paddingTop="10dp"android:paddingBottom="10dp"android:button="@null"
/>

Strings.xml

<resources><string name="app_name">Amicool2020S</string><!-- TODO: Remove or change this placeholder text --><string name="hello_blank_fragment">Hello blank fragment</string><string-array name="news_category_title"><item>关注</item><item>头条</item><item>视频</item><item>长沙</item><item>新时代</item><item>要闻</item><item>娱乐</item><item>知否</item><item>体育</item><item>公开课</item><item>财经</item><item>科技</item><item>汽车</item><item>时尚</item><item>热点</item><item>房产</item><item>NBA</item><item>直播</item><item>故事</item></string-array>
</resources>

相关文章:

配置Windows Server 2003 的RADIUS Server的方法

配置Windows Server 2003 的RADIUS Server的方法1、安装Windows 2003操作系统&#xff1b;2、添加角色&#xff08;须插网线&#xff09;&#xff1b;3、添加组件->网络服务、证书服务&#xff1b;4、管理工具->域安全策略->帐户策略->密码策略&#xff1b;&#x…

Y15BeTa蜂鸣器唱歌程序-演奏版

最优版&#xff0c;自由演奏你的音乐&#xff01; 每天进步一点点&#xff01; 2018-12-09最新版 #include<bits/stdc.h> #include<windows.h> using namespace std; int md[8]{0,262,294,330,349,392,440,494}, mz[8]{0,523,587,659,698,784,880,988}, mg[8]{0,10…

实验6 触发器的使用

实验6 触发器的使用 实验目的 掌握触发器的创建、修改和删除操作。 掌握触发器的触发执行。 掌握触发器与约束的不同。二、实验要求 1.创建触发器。 2.触发器执行触发器。 3.验证约束与触发器的不同作用期。 4.删除新创建的触发器。 三、实验内容 &#xff08;一&#x…

神经网络二(Neural Network)

#!/usr/bin/env python # -*- coding: utf-8 -*- """ __title__ __author__ wlc __mtime__ 2017/9/04 """ import numpy as np import randomclass Network(object):def __init__(self,sizes):#size神经元个数list[3,2,4]self.num_layers l…

要想成功 需要了解的东西

凭我工作的经历来看 在it界要想成功必须要做到以下几点。 1 基本的开发语言不一定精通&#xff0c;但是一定要熟练的使用。 2 对公的主营业务一定要熟悉&#xff0c;不但要熟悉&#xff0c;而且要烂熟于心。如果不能做到这一点&#xff0c;那么起码对自己负责的工作要做到烂熟…

合并下载的Solaris镜像为DVD文件的方法

有很多朋友想安装solaris10操作系统&#xff0c;但是没有系统盘或者在官方网站下载之后不会合成。经过多次试验之后现在把正确的方法写下&#xff0c;以方便大家的学习之用。1。先到官方网站下载最新的系统包&#xff0c;下载之后的软件包为&#xff1a;sol-10-u4-ga-x86-dvd-i…

oracle测试环境表空间清理

测试场景下&#xff0c;使用的oralce遇到表空间的占用超大&#xff0c;可以采用如下的方式进行空间的清理 首先使用sqlplus连接数据库sqlplus sys/passwordorcl as sysdba 之类进行数据库的连接没然后进行如下的操作 ##创建表空间对于自己的测试库和表等最好都建立自己的表空间…

Google Chrome(谷歌浏览器) 发布下载

Google Chrome 下载地址&#xff1a;http://www.google.com/chrome 刚刚装上&#xff0c;还没怎么用&#xff0c;说一下大概印象&#xff0c;整体非常简洁&#xff0c;只有两个菜单选项。访问上明显感觉很快&#xff0c;比 Firefox 快&#xff0c;也比 IE7快&#xff1b;对网页…

实验 5   数据的完整性管理

实验 5 数据的完整性管理 一、实验目的 掌握实体完整性的实现方法。掌握用户定义完整性的实现方法。掌握参照完整性的方法。二、实验内容 数据库的完整性设置。三、实验步骤 可视化界面的操作方法&#xff1a;实体完整性 将 student 表的“sno”字段设为主键&#xff1a;在表…

16-acrobat por 简单使用指南

用于pdf编辑&#xff0c;这里我主要讲下图片的切割和保存&#xff0c;以及合并&#xff1a; 切割选中区域双击 合并的话&#xff0c;在编辑界面选中对象&#xff0c;复制&#xff0c;在另一个pdf的编辑界面粘贴&#xff0c;并挪动位置&#xff1a; 转载于:https://www.cnblogs.…

可突破任意ARP防火墙,以限制流量为目标的简单网络管理软件

以下消息来自幻影论坛[Ph4nt0m]邮件组软件说明&#xff1a;可突破任意ARP防火墙&#xff0c;以限制流量为目标的简单网络管理软件。使用方法&#xff1a;1.在参数设置中选择好工作网卡&#xff1b;2.检查网关信息和本机信息是否正确&#xff0c;如果不正确&#xff0c;请手动输…

OpenCV 学习笔记03 boundingRect、minAreaRect、minEnclosingCircle、boxPoints、int0、circle、rectangle函数的用法...

函数中的代码是部分代码&#xff0c;详细代码在最后 1 cv2.boundingRect 作用&#xff1a;矩形边框&#xff08;boundingRect&#xff09;&#xff0c;用于计算图像一系列点的外部矩形边界。 cv2.boundingRect(array) -> retval 参数&#xff1a; array - 灰度图像&#xff…

实验1 应用SQL Server进行数据定义和管理

实验1 应用SQL Server进行数据定义和管理 【实验目的】 1&#xff09;熟悉SQL Server的配置和管理。 2&#xff09;掌握数据库的定义和修改方法。 3&#xff09;掌握表的定义和修改方法。 4&#xff09;掌握使用SQL语句进行数据管理的方法。 【实验环境】 SQL Server 20…

谷歌Chrome浏览器发布

谷歌已提前启用了浏览器Google Chrome的官方网站gears.google.com/chrome/&#xff0c;今天该浏览器的Windows版本首发。在此以前&#xff0c;谷歌与微软之间的斗争更象是“冷战”&#xff0c;大多局限于谷歌开发小型的、基于网络的软件&#xff0c;与微软占主导地位的Word、Po…

【bzoj1853】[Scoi2010]幸运数字 容斥原理+搜索

题目描述 在中国&#xff0c;很多人都把6和8视为是幸运数字&#xff01;lxhgww也这样认为&#xff0c;于是他定义自己的“幸运号码”是十进制表示中只包含数字6和8的那些号码&#xff0c;比如68&#xff0c;666&#xff0c;888都是“幸运号码”&#xff01;但是这种“幸运号码”…

Creating a LINQ Enabled ASP.NET Web application template using C#.[转]

原文地址&#xff1a;http://www.wwwcoder.com/Weblogs/tabid/283/EntryID/839/Default.aspx其他相关地址&#xff1a;Building and using a LINQ for SQL Class Library with ASP.NET 2.0 1. Install Visual Studio 2005 RTM. 2. Download and install "…

深入理解Java线程池:ThreadPoolExecutor

线程池介绍 在web开发中&#xff0c;服务器需要接受并处理请求&#xff0c;所以会为一个请求来分配一个线程来进行处理。如果每次请求都新创建一个线程的话实现起来非常简便&#xff0c;但是存在一个问题&#xff1a; 如果并发的请求数量非常多&#xff0c;但每个线程执行的时间…

[zt]petshop4.0 详解之八(PetShop表示层设计)

代码中&#xff0c;InsertUser()方法就是负责用户的创建&#xff0c;而在之前则需要判断创建的用户是否已经存在。InsertUser()方法的定义如下&#xff1a; privatestaticboolInsertUser(OracleTransaction transaction, intuserId, stringemail, stringpassword, intpassForma…

Install Java 8 Ubuntu

sudo add-apt-repository ppa:webupd8team/javasudo apt-get -y update sudo apt-get -y install oracle-java8-installer sudo vim /etc/environment Add this at the end of the file JAVA_HOME"/usr/lib/jvm/java-8-oracle" source /etc/environment转载于:https:…

实验2  使用T-SQL编写程序

实验2 使用T-SQL编写程序 【实验目的】 &#xff11;&#xff09;掌握常用函数的使用方法。 &#xff12;&#xff09;掌握流程控制语句的使用方法。 【实验环境】 SQL Server 2012 Express&#xff08;或SQL Server 2017 Express&#xff09; 【实验重点及难点】 1&…

超酷flash光芒光线特效

http://thefwa.com/ 一个不错的英文设计展示站点 超酷flash光芒光线特效 http://www.zcool.com.cn/flash/light/page_1.html

实验3  数据库综合查询

实验3 数据库综合查询 一、实验目的 掌握SELECT语句的基本语法和查询条件表示方法&#xff1b;掌握查询条件种类和表示方法&#xff1b;掌握连接查询的表示及使用&#xff1b;掌握嵌套查询的表示及使用&#xff1b;了解集合查询的表示及使用。 二、实验环境 已安装SQL Serv…

Find Large Files in Linux

https://www.rosehosting.com/blog/find-large-files-linux/转载于:https://www.cnblogs.com/WCFGROUP/p/10328469.html

Linux统计行数命令wc(转)

Linux wc命令用于计算字数。 利用wc指令我们可以计算文件的Byte数、字数、或是列数&#xff0c;若不指定文件名称、或是所给予的文件名为"-"&#xff0c;则wc指令会从标准输入设备读取数据。 语法 wc [-clw][--help][--version][文件...] 参数 -c或--bytes或--chars …

There is no Citrix MetaFrame server configured on the specified address错误的解决方法

环境:windows server 2003 enterprise Citrix MetaFrame XP Server for Windows with Feature Release 3MetaFrame XP 1.0 Service Pack 4 for Windows 2003公网IP内网IP(有防火墙) 客户端:windows xp sp2Citrix MetaFrame Program Neighborhood Version 9.00.32649 错误描述:使…

Cisco交换机解决网络蠕虫病毒***问题

Cisco交换机解决网络蠕虫病毒***问题今年来网络蠕虫泛滥给ISP和企业都造成了巨大损失&#xff0c;截至目前已发现近百万种病毒及***。受感染的网络基础设施遭到破坏&#xff0c;以Sql Slammer为例&#xff0c;它发作时会造成丢包率为30%。我们如何在LAN上防范蠕虫&#xff1f;大…

实验4  数据的安全性管理

实验4 数据的安全性管理 一、实验目的 掌握SQL Server身份验证模式。掌握创建登录账户、数据库用户的方法。掌握使用角色实现数据库安全性的方法。掌握权限的分配。 二、实验内容 1、设置身份验证模式&#xff1a;Windows身份验证模式和混合模验证模式。 2、设置登录账户 …

scala构建工具sbt使用介绍

sbt工具下载及说明&#xff1a; https://www.scala-sbt.org/0.13/docs/zh-cn/Installing-sbt-on-Windows.html sbt是交互式构建工具&#xff0c;使用scala定义任务并执行它们 目录下启动 sbt&#xff0c;然后执行 run 命令进入到 sbt 的交互式命令 $ mkdir hello $ cd hello $ …

读书笔记--C陷阱与缺陷(三)

第三章 1. 指针与数组 书中强调C中数组注意的两点&#xff1a; 1) C语言只有一维数组&#xff0c;但是数组元素可以是任何类型对象&#xff0c;是另外一个数组时就产生了二维数组。数组大小是常数&#xff08;但GCC实现了变长数组。。&#xff09; 2) 一个数组只能做两…

[导入]儿子语录

2008.09.16&#xff1a;笑脸&#xff0c;笑脸&#xff0c;不笑脸&#xff0c;不笑脸&#xff0c;不高兴脸&#xff0c;不高兴脸。2008.09.19&#xff1a;爸爸是黄毛毛虫&#xff0c;我是绿毛毛虫&#xff0c;妈妈是紫毛毛虫&#xff0c;奶奶是咖啡色毛毛虫&#xff0c;太太是白…