This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
for (p,d,f) in os.walk("."): | |
if p.find('.svn')>0: | |
os.popen('rd /s /q %s'%p) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public String getUserPassword(Long userId) { | |
JdbcTemplate jdbcTemplate = | |
new JdbcTemplate(SessionFactoryUtils.getDataSource(getSessionFactory())); | |
Table table = AnnotationUtils.findAnnotation(User.class, Table.class); | |
return jdbcTemplate.queryForObject( | |
"select password from " + table.name() + " where id=?", String.class, userId); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
几个常用用例: | |
1.导出整个数据库 | |
mysqldump -u 用户名 -p 数据库名 > 导出的文件名 | |
mysqldump -u wcnc -p smgp_apps_wcnc > wcnc.sql | |
2.导出一个表 | |
mysqldump -u 用户名 -p 数据库名 表名> 导出的文件名 | |
mysqldump -u wcnc -p smgp_apps_wcnc users> wcnc_users.sql | |
3.导出一个数据库结构 | |
mysqldump -u wcnc -p -d --add-drop-table smgp_apps_wcnc >d:\wcnc_db.sql | |
-d 没有数据 --add-drop-table 在每个create语句之前增加一个drop table |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
@NamedQuery(name="findProfessorNoCache", | |
query="SELECT e FROM Professor e WHERE e.id = ?1", | |
hints={@QueryHint(name="toplink.cache-usage", value="DoNotCheckCache")}) | |
public class Professor { | |
@Id | |
private int id; | |
private String name; | |
private long salary; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Map<String, String> splitQuery(URL url) throws UnsupportedEncodingException { | |
Map<String, String> query_pairs = new LinkedHashMap<String, String>(); | |
String query = url.getQuery(); | |
String[] pairs = query.split("&"); | |
for (String pair : pairs) { | |
int idx = pair.indexOf("="); | |
query_pairs.put(URLDecoder.decode(pair.substring(0, idx), "UTF-8"), URLDecoder.decode(pair.substring(idx + 1), "UTF-8")); | |
} | |
return query_pairs; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function FilesViewModel() { | |
var self = this; | |
self.fileServers =ko.observableArray([{"url":"http://192.168.109.130/4337/"},{"url":"http://192.168.109.122/3366/"}}); | |
self.upFileServer = function() { | |
var index = self.fileServers.indexOf(this); | |
if(index > 0){ | |
var temp = self.fileServers()[index-1]; | |
self.fileServers.splice(index-1, 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static SessionFactory getSessionFactory(EntityManagerFactory hemf) { | |
return ((HibernateEntityManagerFactory)hemf).getSessionFactory(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RequestMapping(method = RequestMethod.DELETE, value = "/{id}") | |
public ResponseEntity<Order> cancelOrder(@PathVariable String id) { | |
OrderDeletedEvent orderDeleted = orderService.deleteOrder(new DeleteOrderEvent(UUID.fromString(id))); | |
if (!orderDeleted.isEntityFound()) { | |
return new ResponseEntity<Order>(HttpStatus.NOT_FOUND); | |
} | |
Order order = Order.fromOrderDetails(orderDeleted.getDetails()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Controller | |
@RequestMapping("/order/{orderId}") | |
public class OrderStatusController { | |
private static final Logger LOG = LoggerFactory | |
.getLogger(OrderStatusController.class); | |
@Autowired | |
private OrderService orderService; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul class="nav nav-tabs" id="myTab"> | |
<li class="active"><a href="#home">Home</a></li> | |
<li><a href="#profile">Profile</a></li> | |
<li><a href="#messages">Messages</a></li> | |
<li><a href="#settings">Settings</a></li> | |
</ul> | |
<div class="tab-content"> | |
<div class="tab-pane active" id="home">...</div> | |
<div class="tab-pane" id="profile">...</div> |