说我的桌子就像这样......
`
Tenancy Number Tenant Number Tenant
1 1 John
1 2 Jane
1 3 Pete
2 56 Fred
2 78 Jackie
Run Code Online (Sandbox Code Playgroud)
如何根据tenany号码分组选择rownumber?到目前为止,我可以得到行号,但我无法找到一种方法来"重置"下一个租期号码.
我想取得以下成果
MYROWNUM Tenancy Number Tenant Number Tenant
1 1 1 John
2 1 2 Jane
3 1 3 Pete
1 2 56 Fred
2 2 78 Jackie
Run Code Online (Sandbox Code Playgroud)
对不起,如果我没有解释这个太好了!
谢谢!
我有一个Map<String, Person>
(实际上我使用的是更复杂的POJO,但为了我的问题而简化它)
Person
好像 :
class Person
{
String name;
Integer age;
//accessors
}
Run Code Online (Sandbox Code Playgroud)
如何遍历此地图,打印出密钥,然后是人名,然后是人员年龄,例如:
System.out.println(String.format("Key : %s Name : %s Age : %s", a, b, c));
Run Code Online (Sandbox Code Playgroud)
我可以使用.values()从地图中提取所有值,详见HashMap文档,但我有点不确定如何获取密钥
马上,这是我的Soap调用实现,减去不相关的位.
public class MySoapClient implements AbstractSoapClient
{
private String NAMESPACE = "http://www.examples.com/wsdl/MyService/";
private String METHOD_NAME = "getPersonDetails";
private String SOAP_ACTION = "http://www.examples.com/getPersonDetails/";
String URL = "http://192.168.0.10:8088/mockMyServiceBinding?WSDL";
public Object process() throws Exception
{
SoapSerializationEnvelope envelope = generateEnvelope();
return responseObject = makeCall(envelope);
}
private SoapSerializationEnvelope generateEnvelope()
{
// dont set a namespace for the requestobject, otherwise ksoap adds implicit namespaces onto request elements
SoapObject requestObject = new SoapObject("", METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.implicitTypes = true;
requestObject.addProperty("name", "Dave"); …
Run Code Online (Sandbox Code Playgroud) 我正在使用以下代码段发出套接字连接
Socket socket = new Socket();
InetSocketAddress endPoint = new InetSocketAddress("localhost", 1234);
try
{
socket.connect(endPoint, 30000);
}
catch (IOException e)
{
e.printStackTrace();
// Logging
}
Run Code Online (Sandbox Code Playgroud)
它尝试连接的端点是脱机的,我想要它做的是尝试连接,并使用30000
ms超时,等待结束结果之前的那段时间
目前,30000
似乎没有应用该参数,因为从我的日志记录中的时间戳开始,它似乎在1秒内确定连接失败.
如何强制连接在放弃之前等待一段时间?
13:13:57,685 6235 DEBUG [Thread-7] - Unable to connect to [localhost:1234]
13:13:58,685 7235 DEBUG [Thread-7] - Unable to connect to [localhost:1234]
13:13:59,695 8245 DEBUG [Thread-7] - Unable to connect to [localhost:1234]
13:14:00,695 9245 DEBUG [Thread-7] - Unable to connect to [localhost:1234]
Run Code Online (Sandbox Code Playgroud)
编辑:API确实说明Connects this socket to the …
我在我的活动中添加了一个广告,如下所示:
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.languageselection);
// Create the adView
adView = new AdView(this, AdSize.BANNER, MY_AD_UNIT_ID);
// Lookup your LinearLayout assuming it?s been given
// the attribute android:id="@+id/mainLayout"
LinearLayout layout = (LinearLayout) findViewById(R.id.ad_layout);
// Add the adView to it
layout.addView(adView);
// Initiate a generic request to load it with an ad
adView.loadAd(new AdRequest());
}
Run Code Online (Sandbox Code Playgroud)
这加载了广告.但是,如果我单击菜单按钮并修改某些共享首选项并返回,则广告已消失且无法重新填充.
这就是我从我的活动中导航的方式,注意我没有在活动上调用完成,因此在onCreate中创建的广告应该仍然存在?
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
switch (item.getItemId())
{
case R.id.aboutme:
startActivity(new Intent(this, About.class));
return true;
case R.id.help:
startActivity(new Intent(this, Help.class)); …
Run Code Online (Sandbox Code Playgroud) 我正在尝试检查特定进程是否正在运行,如果是,请尝试杀死它.
到目前为止,我已经提出了以下建议:
PID=$(ps aux | grep myprocessname | grep -v grep | awk '{print $2}')
if [ -z $PID];
then
echo Still running on PID $PID, attempting to kill..
kill -9 $PID > /dev/null
fi
Run Code Online (Sandbox Code Playgroud)
但是当我运行它时,我得到以下输出:
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
Run Code Online (Sandbox Code Playgroud)
在unix上静默杀死正在运行的进程的最佳方法是什么?