现在位置: 首页 > shms101发表的所有文章
  • 09月
  • 08日
综合 ⁄ 共 943字 评论关闭
---------------------- ASP.Net+Android+IOS开发、.Net培训、期待与您交流! ---------------------- 1、结构是一种值类型,并且不需要堆分配。结构的实例化可以不使用new运算符。如果声明一个10000个Point对象组成的数组,为了引用每个对象,则需分配更多内存;这种情况下,使用结构可以节约资源。 定义: public struct onePerson { public string name; public string sex; public int age; } 使用: onePerson person1; person1.name = "李明"; ......
阅读全文
  • 05月
  • 12日
综合 ⁄ 共 2202字 评论关闭
转载自:这里 目前公司使用JSF+Spring+JPA的开发框架,先不讨论此框架的优劣,说说早期应用中碰到的问题:在使用spring提供的JpaTemplate进行查询时,如果数据量超过100条,查询效率就会明显降低。由于开始时使用JPA内部的双向关联,造成各实体内部关联过多,从而影响所有的操作,因此怀疑是因为JPA的关联关系所致。但是去掉关联关系后的效果不显著。 此时追踪JPA生成的SQL语句,发现每一个查询执行时,都会有对应的更新操作,此时推测可能是由于某处配置有问题。 不经意中发现Spring中关于事务的“transactionAttributes”配置有些......
阅读全文
  • 02月
  • 24日
综合 ⁄ 共 610字 评论关闭
题目链接~~> 做题感悟:感觉完全没想到这种方法,竟然可以这样做!! 解题思路:这里不做解释(算法指南中有解释)。 代码: #include<stdio.h> #include<iostream> #include<map> #include<string> #include<string.h> #include<stdlib.h> #include<math.h> #include<vector> #include<queue> #include<algorithm> using namespace std ; const int INF = 99999999 ; const int MX = 1000005 ; int g[MX],c[MX] ; int main() { int n ; while(~scanf("%d......
阅读全文
  • 01月
  • 13日
算法 ⁄ 共 6788字 评论关闭
A Dicey Problem Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 788   Accepted: 271 Description The three-by-three array in Figure 1 is a maze. A standard six-sided die is needed to traverse the maze (the layout of a standard six-sided die is shown in Figure 2). Each maze has an initial position and an initial die configuration. In Figure 1, the starting position is row 1, column 2-the "2" in the top row of the maze-and the initial die configuration has the "5" o......
阅读全文
  • 10月
  • 19日
综合 ⁄ 共 657字 评论关闭
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: "((()))", "(()())", "(())()", "()(())", "()()()" class Solution { public: vector<string> generateParenthesis(int n) { vector<string> result; string item; traverse(result, item, n, n); return result; } void traverse(vector<string> &res, string &item, int left, int right)......
阅读全文
  • 09月
  • 21日
算法 ⁄ 共 1769字 评论关闭
题目链接:   poj 2337 题目大意:   给出N个单词,单词A的开头与另外单词B结尾相同                   则单词A和单词B可以连起来,问是否可以把所有单词都串成一条线                   输出最小字典序的(按单词的字典序串) 解题思路:   对于每个单词,把单词的起点和终点字母当作顶点                   这个单词即是起点到终点的一条单向边                   根据有向图的欧拉图判断,若顶点的出度-入度为0,或者一个为1一个为-1则是欧拉通路                   根据题意还可能是不连通的图,所以最后在判断一下是否是联通图    ......
阅读全文
  • 07月
  • 12日
综合 ⁄ 共 7456字 评论关闭
转自:http://www.2cto.com/kf/201403/285767.html 前言上周周会老大说到这个,顿时觉得记得不扎实了,哈哈~ 虽然这个在项目应用中是偏底层,基本上是不会开发的,线上也不会允许用到这些,但作为java基础知识,还是来回顾下java基础中的四种引用方式强引用、软引用、弱引用、虚引用。1.引用的基本概念1.1、强引用当我们使用new 这个关键字创建对象时被创建的对象就是强引用,如Object object = new Object() 这个Object()就是一个强引用了,如果一个对象具有强引用。垃圾回收器就不会去回收有强引用的对象。如当jvm内存不足时......
阅读全文
  • 05月
  • 01日
综合 ⁄ 共 476字 评论关闭
/** * 判断两个字符串的大小 *  * @author Administrator *  */public class StringCompare { public static void main(String[] args) {  String s1 = "abc";  String s2 = "def";  String result = CompareStr(s1, s2);  System.out.println(result); }  private static String CompareStr(String s1, String s2) {  String result = "";  if (s1.length() == s2.length()) {   for (int i = 0; i < s1.length(); i++) {    result = s1.charAt(i) > s2.charAt(i) ? "S1大" : "S2大";   }  } else {   System.out.println(......
阅读全文
------Java培训、Android培训、iOS培训、.Net培训、期待与您交流! ------- 黑马程序员 java 基础 毕向东 面向对象 IO操作  File Properties PrintWriter PrintStream 应用 1 Java IO操作中File类的 package day20File; import java.io.File; import java.io.IOException; import java.util.Date; public class F1_FileDemo { /* * File 类的常见方法 * 1:创建 * boolean createNewFile() throws IOException * 且仅当不存在具有此抽象路径名指定名称的文件时, * 不可分地创建一个新的空文件。 * ......
阅读全文
  • 04月
  • 16日
综合 ⁄ 共 19973字 评论关闭
1)什么引发了ANR?在Android里,应用程序的响应性是由Activity Manager和WindowManager系统服务监视的。当它监测到以下情况中的一个时,Android就会针对特定的应用程序显示ANR:在5秒内没有响应输入的事件(例如,按键按下,屏幕触摸)BroadcastReceiver在10秒内没有执行完毕一个ANR对话框显示给用户2)如何避免ANR?考虑上面的ANR定义,让我们来研究一下为什么它会在Android应用程序里发生和如何最佳构建应用程序来避免ANR。Android应用程序通常是运行在一个单独的线程(例如,main)里。这意味着你的应用程序所做的事情如果在主......
阅读全文
  • 04月
  • 01日
综合 ⁄ 共 4424字 评论关闭
PowerDesigner常见问题解决与设置集锦 一.powerdesiner的自增长列   1.如果dbms是MsSql,则选定表后,database-> edit current dbms-> 出现DBMS properties对话框,选择General页,左侧的树选择SQL 2000-> Profile-> Column-> Extended Attributes 下面的ExtIdentityIncrement是步进值,ExtIdentitySeed是起始值,分别设定默认值,后返回。   2.在表的属性对话框里面,选择Clumns页,按Ctrl+U,在Idenitity前面打上钩。如有必要,也可以将 ExtIdentityIncrement和ExtIdentitySeed也打上勾,这样在设定Idenitity......
阅读全文
  • 02月
  • 16日
综合 ⁄ 共 19281字 评论关闭
最近要实现类似Google Play Tab效果,下面搜集一些问题,大家先看看问题以及回答 1、Android - Google Play like tabs 2、ActionBar and ActionBar.Tab and Navigation Drawer android 3、PagerSlidingTabStrip 4、https://github.com/Balaji-K13/Navigation-drawer-page-sliding-tab-strip 上面的1、2是问题,3、4是里面涉及的代码,文章中的代码主要根据4来改编的,因为4依赖第三方库,实现ActionBar功能,这里直接使用V7中的ActionBar. 一、主界面 package com.example.testnavigation; import android.support.v7.app.Acti......
阅读全文