我已经开始学习MySQL了.
这是表格world:
+-------------+-----------+---------+
| name | continent | area |
+-------------+-----------+---------+
| Afghanistan | Asia | 652230 |
| Albania | Europe | 2831741 |
| Algeria | Africa | 28748 |
| ... | ... | ... |
+-------------+-----------+---------+
Run Code Online (Sandbox Code Playgroud)
我需要:
列出每个大洲以及按字母顺序排列的国家/地区名称
SELECT的结果必须是:
+---------------+---------------------+
| continent | name |
+---------------+---------------------+
| Africa | Algeria |
| Asia | Afghanistan |
| Caribbean | Antigua and Barbuda |
| Eurasia | Armenia |
| Europe | Albania |
| …Run Code Online (Sandbox Code Playgroud) 我想了解,ProtoBuf.js工作怎么样?
ProtoBuf - https://github.com/dcodeIO/ProtoBuf.js
我的proto文件gameSetting.proto看起来像:
message GameSettings {
required string gameName = 1;
repeated Category categories = 2;
}
message Category {
required int32 categoryId = 1;
required string categoryAbbreviation = 2;
required string categoryName = 3;
required string numberInSquad = 4;
required string numberInTeam = 5;
required string captain = 6;
}
Run Code Online (Sandbox Code Playgroud)
在这里,我正在实现具有解码和数据编码的JavaScript代码:
var ProtoBuf = dcodeIO.ProtoBuf;
var protoURL = '../_doc/protobuf/gameSettings.proto';
var dataURL = '../xmlapi?type=game-settings&competitionid=1&outputtype=text';
var builder = ProtoBuf.loadProtoFile( protoURL, function(err, builder) {
// WE …Run Code Online (Sandbox Code Playgroud) 要调整缓冲图像的大小,我有以下方法:
BufferedImage resizeImage(BufferedImage img, int newW, int newH) {
Image tmp = img.getScaledInstance(newW, newH, Image.SCALE_SMOOTH);
BufferedImage dimg = new BufferedImage(newW, newH, BufferedImage.TRANSLUCENT);
Graphics2D g2d = dimg.createGraphics();
g2d.drawImage(tmp, 0, 0, null);
g2d.dispose();
return dimg;
}
Run Code Online (Sandbox Code Playgroud)
是否有更好的方法来调整图像大小而不会降低质量?
I use google sample to create Android camera app. During several days I cannot resolve the issue with the output image quality.This is a base Fragment for capture photo/video.
public class Camera2BaseFragment extends Fragment implements View.OnTouchListener {
protected static final SparseIntArray DEFAULT_ORIENTATIONS = new SparseIntArray();
protected final String FRAGMENT_DIALOG = "dialog";
protected Integer[] mExposureCompensation = {};
protected String mCameraId = "0";
protected float mFingerSpacing = 0f;
protected double mZoomLevel = 1;
protected int mCurrentProgress = 0;
protected int mSensorOrientation;
protected …Run Code Online (Sandbox Code Playgroud) 我已经从旧式的事务管理迁移TransactionProxyFactoryBean到Spring推荐的声明式事务管理,以避免出现不时出现的事务的异常.
对于交易save update delete我添加了注释:
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
它对我有用.
问题是:
@Transactional当事务只读取数据时,我应该避免使用注释吗?
例:
public TradeData getTrade(long tradeId) throws Exception {
return em.find(TradeData.class, tradeId);
}
Run Code Online (Sandbox Code Playgroud)
看完这篇文章后说:
"更好的是,
@Transactional在执行读取操作时完全避免使用注释,如清单10所示:"
我有点困惑,我不太明白.
使用BufferedImage bgImage我想为图像上的文本设置黑色。
BufferedImage bgImage = createBgImageForText();
bgImage.createGraphics().drawString(player.getPlayerName(), 25, 15);
if ("Y".equalsIgnoreCase(player.getCaptain())) {
bgImage.createGraphics().setPaint(Color.BLACK);
} else {
bgImage.createGraphics().setPaint(Color.WHITE);
}
mainImg.getGraphics().drawImage(bgImage, 10, 10, null);
Run Code Online (Sandbox Code Playgroud)
但默认情况下,文本始终为白色。如何改变文字的颜色?