-
+133
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
/// <summary>
/// Подключение к удаленному трек серверу
/// Повторяет попытки подключения в фоновом режиме.
/// </summary>
public void ConnectToTrackServer()
{
lock (LockConnToTrack)
{
if (ConnTrackServer == null)
{
ConnTrackServer = new Thread(new ParameterizedThreadStart(ConnectToTrackServerAsync));
ConnTrackServer.Start();
}
else if (!ConnTrackServer.IsAlive)
{
ConnTrackServer.Start();
}
}
//ThreadPool.QueueUserWorkItem(new WaitCallback(ConnectToTrackServerAsync));
}
Продолжение к прошлому посту
HLW,
02 Марта 2013
-
+135
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
private uint IdOnTrackServer
{
get
{
try
{
if (m_IdOnTrackServer == null || m_IdOnTrackServer == uint.MaxValue)
{
ConnectToTrackServer();
}
//if (m_IdOnTrackServer == null)
//{
// // асинхронно подключаемся к серверу треков
// // если сразу подключиться не получилось, то в фоновом потоке стартим reconnect
// if (!TryToConnectToTrackServer_UseResults())
// {
// ConnectToTrackServer();
// }
//}
//else if (m_IdOnTrackServer == uint.MaxValue)
//{
// TryToConnectToTrackServer_UseResults();
//}
return m_IdOnTrackServer.Value;
}
catch
{
return uint.MaxValue;
}
}
}
HLW,
02 Марта 2013
-
+159
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
function validateForm(form){
if (isNotEmpty(form.fa)){
if (isColvo(form.fa,3)){
if (isNotEmpty(form.im)){
if (isColvo(form.im,2)){
if (isNotEmpty(form.ot)){
if (isColvo(form.ot,3)){
if(isNotEmpty(form.day)){
if(isNumbr(form.day)){
if(isNotEmpty(form.month)){
if(isNumbr(form.month)){
if(isNotEmpty(form.year)){
if (isColvo(form.year,4)){
if(isNumbr(form.year)){
if(isNotEmpty(form.city)){
if(isNotEmpty(form.road)){
if(isNotEmpty(form.house)){
if(isNumbr(form.house)){
return true;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
return false;
};
http://национальныйзакон.рф
lads,
01 Марта 2013
-
+179
- 1
$.datepicker.formatDate('yy-mm-dd', new Date(2007, 1 - 1, 26));
Форматирование даты в жс. Без jQuery ясное дело не обойтись.
If you are already using jQuery UI in your project, you can use the built-in datepicker method for formatting your date object:
http://stackoverflow.com/a/7022296
Раз уж неделя стековерфловочки...
3.14159265,
01 Марта 2013
-
+71
- 1
- 2
- 3
- 4
- 5
- 6
- 7
String currentDate = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss").format(new Date());
accountNumber.append(String.valueOf(1900 + new SimpleDateFormat("MM/dd/yyyy HH:mm:ss").parse(currentDate).getYear()));
accountNumber.append(String.valueOf(new SimpleDateFormat("MM/dd/yyyy HH:mm:ss").parse(currentDate).getMonth()));
accountNumber.append(String.valueOf(new SimpleDateFormat("MM/dd/yyyy HH:mm:ss").parse(currentDate).getDate()));
accountNumber.append(String.valueOf(new SimpleDateFormat("MM/dd/yyyy HH:mm:ss").parse(currentDate).getHours()));
accountNumber.append(String.valueOf(new SimpleDateFormat("MM/dd/yyyy HH:mm:ss").parse(currentDate).getMinutes()));
accountNumber.append(String.valueOf(new SimpleDateFormat("MM/dd/yyyy HH:mm:ss").parse(currentDate).getSeconds()));
ну а чо, зато внушительно выглядит
nafania217518,
01 Марта 2013
-
−166
- 1
IFNULL(sum(r.value), 0)/ IF(count(r.value) <> 0, count(r.value), 1) as rating
А как вы считаете среднее арифметическое?
SunnyMagadan,
01 Марта 2013
-
+18
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
#include <iostream>
#include <map>
struct A {
const static int i = 10;
};
using namespace std;
int main()
{
map<int, string> m;
m[0] = "zero";
m[A::i] = "A::i"; // Не везде работает
cout << A::i << endl;
return 0;
}
Недели stackoverflow на уютненьньком.
Почему-то этот код не собирается в GCC 4.7.2, но при этом работает в 4.6.3 и 4.8.0.
http://liveworkspace.org/code/2o5qOP$1
http://liveworkspace.org/code/2o5qOP$2
http://liveworkspace.org/code/2o5qOP$3
absolut,
01 Марта 2013
-
+27
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
//Определение рангов узлов
NL1=NL2=0; int msKl1,kl1I1;
M6: NL1=NL1+NL2; FormMS(NL1,MS); K9=NO-NL1; KSS=32767*32767*2;
for(J=2;J<=K9;J++)
{KS[J]=KU1[J]*(KU1[J]-1)/2;
if(KS[J] != 0)
{L6=KU2[J-1]+1; L8=KU2[J]; L7=L8-1;
for(I1=L6;I1<=L7;I1++)
{II2=I1+1; kl1I1=KL1[I1];
for(I2=II2;I2<=L8;I2++)
{msKl1=MS[KL1[I2]];
L61=KU2[msKl1-1]+1; L71=KU2[msKl1];
for(L=L61;L<=L71;L++)
{if(KL1[L] != kl1I1)goto M10;
else { KS[J]--; goto M9;}
M10:;}
M9:;}
}
}
if(KS[J] < KSS) KSS=KS[J];
}
//=================
куски кода какой-то очень древней расчетной программы. Радует форматирование
mapron,
01 Марта 2013
-
+139
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
for (int i = 0; i < 100; i++)
{
string s = i.ToString();
if (s.Length == 1)
{
s = "00" + s;
}
if (s.Length == 2)
{
s = "0" + s;
}
Console.WriteLine(s);
}
Из рабочего проекта. Парень не слышал про string.Format("{0:000}", i)
pewpew,
28 Февраля 2013
-
+81
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
public String isThisScreenWithHdpiDensity() {
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
switch (metrics.densityDpi) {
case DisplayMetrics.DENSITY_LOW:
return "ldpi";
case DisplayMetrics.DENSITY_MEDIUM:
return "mdpi";
case DisplayMetrics.DENSITY_HIGH:
return "hdpi";
}
return "xhdpi";
}
...
if (isThisScreenWithHdpiDensity().equals("hdpi")) {
lpTabPane.height = 65;
}
if (isThisScreenWithHdpiDensity().equals("mdpi")) {
lpUpperPane.height = 70;
}
if (isThisScreenWithHdpiDensity().equals("ldpi")) {
lpTabPane.height = 32;
}
if (isThisScreenWithHdpiDensity().equals("xhdpi")) {
}
Перегоним константу в стрингу, а потом проверим ее equals. Отлично!
danikula,
28 Февраля 2013