( 49228 )
↓
3d 3dmax action script as3 bash blender c# debian eclipse flash game development gamedev java java 6 linux nginx php poser raid shred ssh ubuntu unix windows -
GUI |
|
: GUI UI WYSIWYG |
LiqPay API |
|
: liqpay liqpay api |
Java 6 |
|
// From:
// http://blog.efftinge.de/2008/10/multi-line-string-literals-in-java.html
// Takes a comment (/**/) and turns everything inside the comment to a string
// that is returned from S()
public static String S()
{
StackTraceElement element = new RuntimeException().getStackTrace()[1];
String name = element.getClassName().replace('.', '/') + ".java";
StringBuilder sb = new StringBuilder();
String line = null;
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
InputStream in = classLoader.getResourceAsStream(name);
String s = convertStreamToString(in, element.getLineNumber());
return s.substring(s.indexOf("/*") + 2, s.indexOf("*/"));
}
// From http://www.kodejava.org/examples/266.html
private static String convertStreamToString(InputStream is, int lineNum)
{
/*
* To convert the InputStream to String we use the BufferedReader.readLine()
* method. We iterate until the BufferedReader return null which means
* there's no more data to read. Each line will appended to a StringBuilder
* and returned as String.
*/
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
StringBuilder sb = new StringBuilder();
String line = null;
int i = 1;
try
{
while ((line = reader.readLine()) != null)
{
if (i++ >= lineNum)
{
sb.append(line + "\n");
}
}
}
catch (IOException e)
{
e.printStackTrace();
}
finally
{
try
{
is.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
return sb.toString();
}
public static void main(String[] args) throws Exception
{
String s = S(/*
Wow, we finally have
multiline strings in
Java! HOOO!
*/);
System.out.println(s);
}
: java java 6 java multiline strings |
|
|
class Simple
{
private int a = 0;
public void add(int b)
{
a = a + b;
}
public int getA()
{
return a;
}
}
class Difficult
{
private int a = 0;
public void add(int b)
{
if ((float)(a % 100) / 3 == (int)((a % 100) / 3) )
a = a + b;
else
a = a - b;
}
public int getA()
{
return a;
}
}
class D
{
var param1: boolean;
var param2: boolean;
function func1(...)
{
.........
if (param2)
param1 = abc;
else
param1 = xyz;
.........
}
function func2(...)
{
.........
if (param1 && asd)
param2 = ...;
...........
}
}
: oop |
|
|
PHP:
// S1
1.) __(A0, S1)
// S1 , A1
// S2
2.) __(A0 + A1, S2)
// S2 , A2
// S1 a75 S75
3.) __(A0 + A1 + A2, S75)
// S75, S1
4.) __(a75)
// S1 ,
...
font>
PHP:
__(A: , St: )
{
Ac = ____(A, St)
Ss = __(Ac)
while (S != St && not(S in Ss))
{
a = A0[random(LEN(A))]
__(a)
}
if (S == St)
return;
if (S in Ss)
{
a = ____(Ac, S)
__(a)
if (S == St)
return;
else
exit(" , .");
}
}
font>
: artifical life |
: |
|
PHP:
j = 2
while (j<=n && LEN(D) < x)
{
c = C[j]
a = A[c]
if (D[a] == NULL)
{
d = {}
for (i=1; i<=m; i++)
{
ds = { S[i][j-1], S[i][j] }
d[i] = ds
}
D[a] = d
}
j++
}
font>
PHP:
T = {} //
j = 1
while (j<=n) //
{
c = C[j]
a = A[c]
d = {}
for (i=1; i<=m; i++) // d
{
ds = { S[i][j-1], S[i][j] }
d[i] = ds
}
if (D[a] != d) //
{
f = d //
t = []
i = j
while (i>=2 && i>=j-10) // 10
{
c = C[i]
a = A[c]
d = {}
for (k=1; k<=m; k++) // d
{
ds = { S[k][i-1], S[k][i] }
d[i] = ds
}
// t a d
t[LEN(t) + 1] = { a, d }
i--
}
// 10 f
T[f][LEN(T[f]) + 1] = t
}
j++
}
// E
for (f, Z) in T // f - , Z - T
{
if (LEN(Z) >= 3) // ?
{
e = [] // E
o = Z[1] // , f
// ,
for (j=2; j<=LEN(Z); j++)
{
t = Z[j]
i = LEN(t)
do
{
a = t[i].a //
d = t[i].d //
if (a == o[i].a && d == o[i].d)
{
if (e[LEN(e) + 1] == NULL)
e[LEN(e) + 1] = a
}
else
break
i++
}
while(i <= LEN(t))
}
E[f] = e // E f
}
}
font>
: |
Hello World |
|
<input type="button" value=" " ONCLICK="AlertButton()" >
<script>
function AlertButton()
{
window.alert("Hello, World!");
}
</script>
: |
Away3D 4.0 public beta now available! |
|
: flash away3d molehill |
: | [1] |