Delay before switching windows
I'm working on a game which runs on Windows and can be run in a standalone
mode and in browser using Kalydo Player. Sometimes (80% of time), when I
try to switch window by clicking on another tab in windows bar or another
tab in browser, switching happens after 3-4 seconds delay.
I would provide additional information, but I don't even now what may
cause such a problem. Any thoughts?
Thursday, 3 October 2013
Wednesday, 2 October 2013
All images including background disappears
All images including background disappears
I have two links and ReWrite rules for them. And the rules do change the
links. But all the images including the background disappears.
This code
#/viewgallery.php?cname=Colorado-Fall to /photos/Colorado-Fall RewriteCond
%{THE_REQUEST} ^[A-Z]{3,}\s/+viewgallery\.php\?cname=([^&\s]+) RewriteRule
^ /photos/%1/? [L,R=301] RewriteRule ^photos/([^/]+)/?$
/viewgallery.php?cname=$1 [L,NC,QSA]
changes
http://www.xyz.com/viewgallery.php?cname=Colorado-Fall
to
http://www.xyz.com/photos/Colorado-Fall/
Then this
# /viewgallery.php?cname=Colorado-Fall&pcaption=Poked to
/photos/Colorado-Fall/Poked.jpg
RewriteCond %{THE_REQUEST}
^[A-Z]{3,}\s/+viewgallery\.php\?cname=([^&]+)&pcaption=([^&\s]+)
RewriteRule ^ /photos/%1/%2/? [R=301,L]
RewriteRule ^photos/([^/]+)/([^.]+)/$
/viewgallery.php?cname=$1&pcaption=$2 [L,NC,NE]
changes the link
http://www.xyz.com/viewgallery.php?cname=Colorado-Fall&pcaption=Facing-Colors
to
http://www.xyz.com/photos/Colorado-Fall/Light-On-Fall-Colors/
What am I doing wrong here? I am using absolute paths in my PHP code.Like
these..
"<a
href=/viewgallery.php?cname=$cname&pcaption=".$caption_array[$next]."><img
src=/photos/assets/left.png border=0 ></a>";
I have two links and ReWrite rules for them. And the rules do change the
links. But all the images including the background disappears.
This code
#/viewgallery.php?cname=Colorado-Fall to /photos/Colorado-Fall RewriteCond
%{THE_REQUEST} ^[A-Z]{3,}\s/+viewgallery\.php\?cname=([^&\s]+) RewriteRule
^ /photos/%1/? [L,R=301] RewriteRule ^photos/([^/]+)/?$
/viewgallery.php?cname=$1 [L,NC,QSA]
changes
http://www.xyz.com/viewgallery.php?cname=Colorado-Fall
to
http://www.xyz.com/photos/Colorado-Fall/
Then this
# /viewgallery.php?cname=Colorado-Fall&pcaption=Poked to
/photos/Colorado-Fall/Poked.jpg
RewriteCond %{THE_REQUEST}
^[A-Z]{3,}\s/+viewgallery\.php\?cname=([^&]+)&pcaption=([^&\s]+)
RewriteRule ^ /photos/%1/%2/? [R=301,L]
RewriteRule ^photos/([^/]+)/([^.]+)/$
/viewgallery.php?cname=$1&pcaption=$2 [L,NC,NE]
changes the link
http://www.xyz.com/viewgallery.php?cname=Colorado-Fall&pcaption=Facing-Colors
to
http://www.xyz.com/photos/Colorado-Fall/Light-On-Fall-Colors/
What am I doing wrong here? I am using absolute paths in my PHP code.Like
these..
"<a
href=/viewgallery.php?cname=$cname&pcaption=".$caption_array[$next]."><img
src=/photos/assets/left.png border=0 ></a>";
mergesorting array not working with large arrays
mergesorting array not working with large arrays
could someone tell me why my code can't sort arrays of large sizes,
basically anything larger than size 3. I've been debugging for a while but
can't seem to find the problem, any help is appreciated. Thanks alot.
import java.util.*;
import java.io.*;
// No need to change anything in this class
class MergeSortQuestion {
// merges sorted subarrays A[start...firstThird],
A[firstThird+1,secondThird], and A[secondThird+1,stop]
public static void mergeThreeWay(int A[], int start, int firstThird,
int secondThird, int stop)
{
int indexLeft = start; //index for first third half
of array A
int indexMiddle = firstThird+1; //index for the middle element
of A
int indexRight = secondThird+1; //index for the right half of A
int [] temp = new int [A.length]; //create a new temporary array
of same type and size of array A
int tempIndex = start; //index for the temporary
array
if (tempIndex <= stop) {
//The following is valid if all 3 subdivisions of the array are
not used up
while ((indexLeft <= firstThird) && (indexMiddle <=
secondThird) && (indexRight <=stop))
{
if ((A[indexLeft] <= A[indexMiddle]) && (A[indexLeft] <=
A[indexRight]))
{
temp[tempIndex] = A[indexLeft]; //select the left element
indexLeft++;
}
else if ((A[indexMiddle] <= A[indexLeft]) &&
(A[indexMiddle] <= A[indexRight]))
{
temp[tempIndex] = A[indexMiddle]; //select the middle
element
indexMiddle++;
}
else if ((A[indexRight] <= A[indexLeft]) && (A[indexRight]
<= A[indexMiddle]))
{
temp[tempIndex] = A[indexRight]; //select the right
element
indexRight++;
}
tempIndex++;
}
//Executes when the last 3rd of the array has been used up
while ((indexLeft <= firstThird) && (indexMiddle
<=secondThird) && (indexRight > stop))
{
if (A[indexLeft]<= A[indexMiddle])
{
temp[tempIndex] = A[indexLeft];
indexLeft++;
}
else if (A[indexLeft] >= A[indexMiddle])
{
temp[tempIndex] = A[indexMiddle];
indexMiddle++;
}
tempIndex++;
}
//Executes when the middle half of the array has been used up
while ((indexLeft <= firstThird) && (indexMiddle >
secondThird) && (indexRight <= stop))
{
if (A[indexLeft]<= A[indexRight])
{
temp[tempIndex] = A[indexLeft];
indexLeft++;
}
else if (A[indexLeft] >= A[indexRight])
{
temp[tempIndex] = A[indexRight];
indexRight++;
}
tempIndex++;
}
//Executes when the first half of the array has been used up
while ((indexLeft > firstThird) && (indexMiddle <=
secondThird) && (indexRight <= stop))
{
if (A[indexMiddle] <= A[indexRight])
{
temp[tempIndex] = A[indexMiddle];
indexMiddle++;
}
else if (A[indexMiddle] >= A[indexRight])
{
temp[tempIndex] = A[indexRight];
indexRight++;
}
tempIndex++;
}
//Executes in the case where both the left and middle sections
are used up
while ((indexLeft > firstThird) && (indexMiddle > secondThird)
&& (indexRight <= stop))
{
temp[tempIndex]=A[indexRight];
indexRight++;
tempIndex++;
}
//Executes in the case where both the left and last sections
are used up
while ((indexLeft > firstThird) && (indexMiddle <=
secondThird) && (indexRight > stop))
{
temp[tempIndex]=A[indexMiddle];
indexMiddle++;
tempIndex++;
}
//Executes in the case where both the middle and last sections
are used up
while ((indexLeft <= firstThird) && (indexMiddle >
secondThird) && (indexRight > stop))
{
temp[tempIndex]=A[indexLeft];
indexLeft++;
tempIndex++;
}
}
//Now, we copy the temporary array back into array A
for (int i=0; i<A.length; i++) {
A[i]=temp[i];
}
}
// sorts A[start...stop]
public static void mergeSortThreeWay(int A[], int start, int stop) {
if (((stop-start)==1)&&(A[1]<A[0])){
int temp = A[1];
A[1] = A[0];
A[0] = temp;
}
if (start < stop) {
int firstThird = ((stop-start)/3 + start);
int secondThird = 2*(stop-start)/3 + start;
mergeSortThreeWay (A, start, firstThird);
mergeSortThreeWay (A, firstThird+1,secondThird);
mergeSortThreeWay (A, secondThird+1, stop);
mergeThreeWay(A, start, firstThird, secondThird, stop);
}
}
public static void main (String args[]) throws Exception {
int myArray[] = {3,1,4}; // an example array to be sorted. You'll need
to test your code with many cases, to be sure it works.
mergeSortThreeWay(myArray,0,myArray.length-1);
System.out.println("Sorted array is:\n");
for (int i=0;i<myArray.length;i++) {
System.out.println(myArray[i]+" ");
}
}
}
could someone tell me why my code can't sort arrays of large sizes,
basically anything larger than size 3. I've been debugging for a while but
can't seem to find the problem, any help is appreciated. Thanks alot.
import java.util.*;
import java.io.*;
// No need to change anything in this class
class MergeSortQuestion {
// merges sorted subarrays A[start...firstThird],
A[firstThird+1,secondThird], and A[secondThird+1,stop]
public static void mergeThreeWay(int A[], int start, int firstThird,
int secondThird, int stop)
{
int indexLeft = start; //index for first third half
of array A
int indexMiddle = firstThird+1; //index for the middle element
of A
int indexRight = secondThird+1; //index for the right half of A
int [] temp = new int [A.length]; //create a new temporary array
of same type and size of array A
int tempIndex = start; //index for the temporary
array
if (tempIndex <= stop) {
//The following is valid if all 3 subdivisions of the array are
not used up
while ((indexLeft <= firstThird) && (indexMiddle <=
secondThird) && (indexRight <=stop))
{
if ((A[indexLeft] <= A[indexMiddle]) && (A[indexLeft] <=
A[indexRight]))
{
temp[tempIndex] = A[indexLeft]; //select the left element
indexLeft++;
}
else if ((A[indexMiddle] <= A[indexLeft]) &&
(A[indexMiddle] <= A[indexRight]))
{
temp[tempIndex] = A[indexMiddle]; //select the middle
element
indexMiddle++;
}
else if ((A[indexRight] <= A[indexLeft]) && (A[indexRight]
<= A[indexMiddle]))
{
temp[tempIndex] = A[indexRight]; //select the right
element
indexRight++;
}
tempIndex++;
}
//Executes when the last 3rd of the array has been used up
while ((indexLeft <= firstThird) && (indexMiddle
<=secondThird) && (indexRight > stop))
{
if (A[indexLeft]<= A[indexMiddle])
{
temp[tempIndex] = A[indexLeft];
indexLeft++;
}
else if (A[indexLeft] >= A[indexMiddle])
{
temp[tempIndex] = A[indexMiddle];
indexMiddle++;
}
tempIndex++;
}
//Executes when the middle half of the array has been used up
while ((indexLeft <= firstThird) && (indexMiddle >
secondThird) && (indexRight <= stop))
{
if (A[indexLeft]<= A[indexRight])
{
temp[tempIndex] = A[indexLeft];
indexLeft++;
}
else if (A[indexLeft] >= A[indexRight])
{
temp[tempIndex] = A[indexRight];
indexRight++;
}
tempIndex++;
}
//Executes when the first half of the array has been used up
while ((indexLeft > firstThird) && (indexMiddle <=
secondThird) && (indexRight <= stop))
{
if (A[indexMiddle] <= A[indexRight])
{
temp[tempIndex] = A[indexMiddle];
indexMiddle++;
}
else if (A[indexMiddle] >= A[indexRight])
{
temp[tempIndex] = A[indexRight];
indexRight++;
}
tempIndex++;
}
//Executes in the case where both the left and middle sections
are used up
while ((indexLeft > firstThird) && (indexMiddle > secondThird)
&& (indexRight <= stop))
{
temp[tempIndex]=A[indexRight];
indexRight++;
tempIndex++;
}
//Executes in the case where both the left and last sections
are used up
while ((indexLeft > firstThird) && (indexMiddle <=
secondThird) && (indexRight > stop))
{
temp[tempIndex]=A[indexMiddle];
indexMiddle++;
tempIndex++;
}
//Executes in the case where both the middle and last sections
are used up
while ((indexLeft <= firstThird) && (indexMiddle >
secondThird) && (indexRight > stop))
{
temp[tempIndex]=A[indexLeft];
indexLeft++;
tempIndex++;
}
}
//Now, we copy the temporary array back into array A
for (int i=0; i<A.length; i++) {
A[i]=temp[i];
}
}
// sorts A[start...stop]
public static void mergeSortThreeWay(int A[], int start, int stop) {
if (((stop-start)==1)&&(A[1]<A[0])){
int temp = A[1];
A[1] = A[0];
A[0] = temp;
}
if (start < stop) {
int firstThird = ((stop-start)/3 + start);
int secondThird = 2*(stop-start)/3 + start;
mergeSortThreeWay (A, start, firstThird);
mergeSortThreeWay (A, firstThird+1,secondThird);
mergeSortThreeWay (A, secondThird+1, stop);
mergeThreeWay(A, start, firstThird, secondThird, stop);
}
}
public static void main (String args[]) throws Exception {
int myArray[] = {3,1,4}; // an example array to be sorted. You'll need
to test your code with many cases, to be sure it works.
mergeSortThreeWay(myArray,0,myArray.length-1);
System.out.println("Sorted array is:\n");
for (int i=0;i<myArray.length;i++) {
System.out.println(myArray[i]+" ");
}
}
}
Strange new iOS 7 errors: receiver from DB / ForceShrinkPersistentStore_NoLock
Strange new iOS 7 errors: receiver from DB /
ForceShrinkPersistentStore_NoLock
Good day.
I have a project that uses a lot of network connections with SSL. This
project runs fine and without errors on iOS 5 and 6. But with new iOS 7 i
keep getting these two errors:
ERROR: unable to get the receiver data from the DB
ForceShrinkPersistentStore_NoLock -delete- We do not have a BLOB or TEXT
column type. Instead, we have 5.
They are not connected in any way and i did keep getting first one for few
weeks, then later i got this second one too.
They are received on my application start, at that point i send few HTTP
POST's and process received data. I cannot catch where do these errors
come from.
I could find them if i could understand them. Anyone know what do they
mean or on what cases one can cause them?
ForceShrinkPersistentStore_NoLock
Good day.
I have a project that uses a lot of network connections with SSL. This
project runs fine and without errors on iOS 5 and 6. But with new iOS 7 i
keep getting these two errors:
ERROR: unable to get the receiver data from the DB
ForceShrinkPersistentStore_NoLock -delete- We do not have a BLOB or TEXT
column type. Instead, we have 5.
They are not connected in any way and i did keep getting first one for few
weeks, then later i got this second one too.
They are received on my application start, at that point i send few HTTP
POST's and process received data. I cannot catch where do these errors
come from.
I could find them if i could understand them. Anyone know what do they
mean or on what cases one can cause them?
types of nodes in DOM
types of nodes in DOM
I am reading the book "Dom Scripting" by Jeremy Keith. I read that there
are total 12 types of nodes in DOM. I am just aware of five of them which
are -
Document
Element
Text
Attribute
Comment
I don't know about any other node. Please provide me with the knowledge
that I don't have.
I am reading the book "Dom Scripting" by Jeremy Keith. I read that there
are total 12 types of nodes in DOM. I am just aware of five of them which
are -
Document
Element
Text
Attribute
Comment
I don't know about any other node. Please provide me with the knowledge
that I don't have.
Tuesday, 1 October 2013
Gson: illegalStateExcetpion: expected an int but NAME at line 1 column 3
Gson: illegalStateExcetpion: expected an int but NAME at line 1 column 3
I want to define my own serilaize and deserialize for Student class, so I
extends TypeAdapter and override its methods, but now deserialize does not
work. why ?
public class GSONFormat {
@Test
public void run()
{
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Student.class, new StudentAdapter());
Gson gson = builder.create();
Student s = new Student();
s.setAge(11);
s.setName("hiway");
System.out.println(gson.toJson(s));
String str = "{\"age\":11,\"name\":\"hiway\"}";
s = gson.fromJson(str, Student.class);
System.out.println(s);
}
}
class Student{
private int age;
private String name;
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
class StudentAdapter extends TypeAdapter<Student>
{
@Override
public void write(JsonWriter out, Student s) throws IOException {
out.beginObject();
out.name("age");
out.value(s.getAge());
out.name("name");
out.value(s.getName());
out.endObject();
}
@Override
public Student read(JsonReader in) throws IOException {
in.beginObject();
Student s = new Student();
s.setAge(in.nextInt());
s.setName(in.nextString());
in.endObject();
return s;
}
}
I want to define my own serilaize and deserialize for Student class, so I
extends TypeAdapter and override its methods, but now deserialize does not
work. why ?
public class GSONFormat {
@Test
public void run()
{
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Student.class, new StudentAdapter());
Gson gson = builder.create();
Student s = new Student();
s.setAge(11);
s.setName("hiway");
System.out.println(gson.toJson(s));
String str = "{\"age\":11,\"name\":\"hiway\"}";
s = gson.fromJson(str, Student.class);
System.out.println(s);
}
}
class Student{
private int age;
private String name;
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
class StudentAdapter extends TypeAdapter<Student>
{
@Override
public void write(JsonWriter out, Student s) throws IOException {
out.beginObject();
out.name("age");
out.value(s.getAge());
out.name("name");
out.value(s.getName());
out.endObject();
}
@Override
public Student read(JsonReader in) throws IOException {
in.beginObject();
Student s = new Student();
s.setAge(in.nextInt());
s.setName(in.nextString());
in.endObject();
return s;
}
}
MySQL - Why would nearly 2 identical queries result in 2 different results? GROUP BY
MySQL - Why would nearly 2 identical queries result in 2 different
results? GROUP BY
I have 2 queries that are nearly identical, one with a GROUP BY, one
without. The results are very different. The GROUP BY query results in
over double the non-GROUP BY query result.
Query 1:
SELECT table2.name, COUNT(DISTINCT(op.id))
FROM op INNER JOIN table1 ON table1.EID = op.ID
INNER JOIN table3 ON table3.id = table1.jobid
INNER JOIN table2 ON table2.id = table3.CatID
WHERE op.BID = 1
AND op.ActiveStartDate <= NOW()
AND op.ActiveEndDate >= NOW()
GROUP BY table2.name
ORDER BY COUNT(*) DESC;
Query 2:
SELECT op.Type, COUNT(DISTINCT op.id)
FROM op
WHERE op.BID = 1
AND op.ActiveStartDate <= NOW()
AND op.ActiveEndDate >= NOW()
ORDER BY op.Type ASC;
These should result in the same result. When playing around with them,
once I remove the "GROUP BY" from query 1, the result is the same. If I
put the "GROUP BY" back into Query 1, the result is more than doubled.
results? GROUP BY
I have 2 queries that are nearly identical, one with a GROUP BY, one
without. The results are very different. The GROUP BY query results in
over double the non-GROUP BY query result.
Query 1:
SELECT table2.name, COUNT(DISTINCT(op.id))
FROM op INNER JOIN table1 ON table1.EID = op.ID
INNER JOIN table3 ON table3.id = table1.jobid
INNER JOIN table2 ON table2.id = table3.CatID
WHERE op.BID = 1
AND op.ActiveStartDate <= NOW()
AND op.ActiveEndDate >= NOW()
GROUP BY table2.name
ORDER BY COUNT(*) DESC;
Query 2:
SELECT op.Type, COUNT(DISTINCT op.id)
FROM op
WHERE op.BID = 1
AND op.ActiveStartDate <= NOW()
AND op.ActiveEndDate >= NOW()
ORDER BY op.Type ASC;
These should result in the same result. When playing around with them,
once I remove the "GROUP BY" from query 1, the result is the same. If I
put the "GROUP BY" back into Query 1, the result is more than doubled.
Jboss lost connections to MongoDB "WARNING [com.mongodb] emptying DBPortPool to /x.x.x.x:27017 b/c of error"
Jboss lost connections to MongoDB "WARNING [com.mongodb] emptying
DBPortPool to /x.x.x.x:27017 b/c of error"
I have a few Jboss 5.1 servers which uses MongoDB data set. Till yesterday
I had 3 Mongo 2.0 nodes in this dataset. Yesterday I added 2 Mongo 2.4.6
secondaries to this dataset; and after that I see many warnings like that:
WARNING [com.mongodb] emptying DBPortPool to /x.x.x.x:27017 b/c of error
"Many" - about 30/day instead of 5/day before. Another thing that I don't
understand - according to jboss log, it started to use 2 new nodes, even I
didn't add them to mongo-ds.xml.
Any ideas why number of dropped connections increased and why jboss
started to use new nodes?
TIA, Vitaly
my mongo-ds is:
<mongo:mongo host="none"
replica-set="mongo1:27017,mongo2:27017,mongo3:27017">
DBPortPool to /x.x.x.x:27017 b/c of error"
I have a few Jboss 5.1 servers which uses MongoDB data set. Till yesterday
I had 3 Mongo 2.0 nodes in this dataset. Yesterday I added 2 Mongo 2.4.6
secondaries to this dataset; and after that I see many warnings like that:
WARNING [com.mongodb] emptying DBPortPool to /x.x.x.x:27017 b/c of error
"Many" - about 30/day instead of 5/day before. Another thing that I don't
understand - according to jboss log, it started to use 2 new nodes, even I
didn't add them to mongo-ds.xml.
Any ideas why number of dropped connections increased and why jboss
started to use new nodes?
TIA, Vitaly
my mongo-ds is:
<mongo:mongo host="none"
replica-set="mongo1:27017,mongo2:27017,mongo3:27017">
PowerDNS master server doesn't notify
PowerDNS master server doesn't notify
I have a PowerDNS based master nameserver with 3 slaves. Zone transfer
works through AXFR (automatically once every hour it gets checked by the
slaves). When I change a record through our panel the notified_serial gets
updated correctly as well as the serial in the SOA record.
The nameserver uses a MySQL backend. The slaves don't get notified when
changes occur. Nothing is logged when it was supposed to send a Notify.
When I force a notify (like: pdns_control notify example.com) the slaves
get notified properly.
The config is as follows:
master=yes
setuid=pdns
setgid=pdns
local-address=xx.xxx.xx.xxx
allow-axfr-ips=xx.xxx.xx.xxx
use-logfile=yes
log-dns-details=yes
log-failed-updates=yes
logging-facility=0
loglevel=4
launch=gmysql
gmysql-host=localhost
gmysql-user=xxxxxxxxxxxxxxxx
gmysql-password=xxxxxxxxxxxxxxx
gmysql-dbname=powerdns
I have a PowerDNS based master nameserver with 3 slaves. Zone transfer
works through AXFR (automatically once every hour it gets checked by the
slaves). When I change a record through our panel the notified_serial gets
updated correctly as well as the serial in the SOA record.
The nameserver uses a MySQL backend. The slaves don't get notified when
changes occur. Nothing is logged when it was supposed to send a Notify.
When I force a notify (like: pdns_control notify example.com) the slaves
get notified properly.
The config is as follows:
master=yes
setuid=pdns
setgid=pdns
local-address=xx.xxx.xx.xxx
allow-axfr-ips=xx.xxx.xx.xxx
use-logfile=yes
log-dns-details=yes
log-failed-updates=yes
logging-facility=0
loglevel=4
launch=gmysql
gmysql-host=localhost
gmysql-user=xxxxxxxxxxxxxxxx
gmysql-password=xxxxxxxxxxxxxxx
gmysql-dbname=powerdns
Subscribe to:
Comments (Atom)