In short, the problem may be in BIOS:
Go into BIOS and change the AHCI mode of your HDD to Compatible or IDE.
I've just spent a couple of hours wiping my HD, formatting and reformatting in NTFS/whatever my hard disk with GParted, while all the time, the problem was in BIOS, the mode of the hard drive was set to AHCI , and changing it to 'Compatible' solved it. It seems that Windows (XP in my case) doesn't have/load drivers for this HDD mode.
vineri, 17 mai 2013
vineri, 3 mai 2013
A boy and his Atom: this is a historical step + the end of Moore's Law
I urge anyone having anything to do with technology to watch the two movies:
http://www.research.ibm.com/articles/madewithatoms.shtml
This will be the millenium's breakthrough plus the end of Moore's Law.
http://www.research.ibm.com/articles/madewithatoms.shtml
This will be the millenium's breakthrough plus the end of Moore's Law.
vineri, 26 aprilie 2013
Find all points within radius from latitude and longitude given (from given point)
I had to use these formulas for a few times now, and the DB performance has to suffer when doing these kinds of searches.
However, i've just recently found a less accurate method, which has a great performance improvement on the database searches, the errors (unwanted results, or false positives) are neglectable in my case.
The SQL:
SELECT * FROM interest locations WHERE latitude BETWEEN @minLatitude AND @maxLatitude AND longitude BETWEEN @minLongitude AND @maxLongitude
The idea is to create a box, or, thinking planar - a square. Imagining the earth be plane (a plane map), the query above searches for all points (latitudes and longitudes) within the square the circumscribes our given radius cirlce.
The minimum and maximum latitudes, we calculate as starting (center) latitude plus/minus result of given radius divided by 111 (111 is the distance of one degree of latitude in Km):
@minLatitude = givenLatitude - givenRadius / 111
The minimum and maximum longitudes, we calculate as starting (center) longitude plus/minus result of given radius divided by 78, or if you want to be more exact, the corresponding DeltaLongitude depending on the given Latitude (0 => 111.320, 15 => 107.551, 30 => 96.486, 45 => 78.847, 60 => 55.800, 75 => 28.902, 90 => 0.0001)
@minLongitude = givenLongitude - givenRadius / longitudesArray[floor(abs(givenLatitude)/15)*15]
The funny name that somebody gave it was: 'thinking inside the box' (more info here: http://stackoverflow.com/questions/1006654/fastest-way-to-find-distance-between-two-lat-long-points , respect to Binary Worrier :).
Surface of circumscribed square / surface of circle = 1.27 (ca. 27% more surface returned [false positives])
Greatest distance error: for 50Km - 20Km, for 100Km - 40Km, for 200Km - 82Km.
The given SQL has great performance improvments, especially because it can use indexes on the latitude or longitude columns, unlike the cosines formula, which does not allow for the database engines to use indexes.
However, i've just recently found a less accurate method, which has a great performance improvement on the database searches, the errors (unwanted results, or false positives) are neglectable in my case.
The SQL:
SELECT * FROM interest locations WHERE latitude BETWEEN @minLatitude AND @maxLatitude AND longitude BETWEEN @minLongitude AND @maxLongitude
The idea is to create a box, or, thinking planar - a square. Imagining the earth be plane (a plane map), the query above searches for all points (latitudes and longitudes) within the square the circumscribes our given radius cirlce.
The minimum and maximum latitudes, we calculate as starting (center) latitude plus/minus result of given radius divided by 111 (111 is the distance of one degree of latitude in Km):
@minLatitude = givenLatitude - givenRadius / 111
The minimum and maximum longitudes, we calculate as starting (center) longitude plus/minus result of given radius divided by 78, or if you want to be more exact, the corresponding DeltaLongitude depending on the given Latitude (0 => 111.320, 15 => 107.551, 30 => 96.486, 45 => 78.847, 60 => 55.800, 75 => 28.902, 90 => 0.0001)
@minLongitude = givenLongitude - givenRadius / longitudesArray[floor(abs(givenLatitude)/15)*15]
The funny name that somebody gave it was: 'thinking inside the box' (more info here: http://stackoverflow.com/questions/1006654/fastest-way-to-find-distance-between-two-lat-long-points , respect to Binary Worrier :).
Surface of circumscribed square / surface of circle = 1.27 (ca. 27% more surface returned [false positives])
Greatest distance error: for 50Km - 20Km, for 100Km - 40Km, for 200Km - 82Km.
The given SQL has great performance improvments, especially because it can use indexes on the latitude or longitude columns, unlike the cosines formula, which does not allow for the database engines to use indexes.
Email subject UTF-8 encoded
I haven't encountered this yet, i've always been able to send email messages WITH utf-8 correctly encoded and displayed characters (umlauts, acutes), but i've also met this technique which renders good results too:
Set your subject's encoding (or another header directive's) like this:
'=?utf-8?B?'.base64_encode($subject).'?='
That means your subject needs to look like:
=?ENCODING?B?base64_encoded_data?=
Pretty easy
Display php email sent subject characters displayed correctly, umlauts.
Set your subject's encoding (or another header directive's) like this:
'=?utf-8?B?'.base64_encode($subject).'?='
That means your subject needs to look like:
=?ENCODING?B?base64_encoded_data?=
Pretty easy
Display php email sent subject characters displayed correctly, umlauts.
luni, 18 martie 2013
DataTables jQuery IE8 bug
I've just bumped into a bug while testing jquery.dataTables in Internet Explorer 8 (IE8).
I kept getting:
SCRIPT5007: Unable to get value of the property 'className': object is null or undefined
jquery.dataTables.min.js , line 27 character 288
I had my table set up and sorted at document.ready like this:
$('#CGITable').dataTable( {
"sDom": '<"top">rt<"bottom"><"clear">',
"aaSorting": [colSorted['CGITable']],
"bPaginate": false,
"aoColumns": [
{ "sType": "string", },
{ "sType": "string" },
{ "sType": "numeric-comma" },
{ "sType": "numeric-comma" },
{ "sType": "numeric-comma" },
{ "sType": "numeric-comma" },
{ "sType": "numeric-comma" },
{ "sType": "string" },
],
"fnDrawCallback": function( oSettings ) {
colSorted['CGITable'] = oSettings['aaSorting'];
}
} );
After a lot of digging, the problem seemed to rise from the following two issues in the aoColumns parameter array:
My final, working piece of jquery dataTables setup is:
$('#CGITable').dataTable( {
"sDom": '<"top">rt<"bottom"><"clear">',
"aaSorting": [colSorted['CGITable']],
"bPaginate": false,
"aoColumns": [
{ "sType": "string", 'sClass': "", "bSortable": true },
{ "sType": "string", 'sClass': "", "bSortable": true },
{ "sType": "numeric-comma", 'sClass': "", "bSortable": true },
{ "sType": "numeric-comma", 'sClass': "", "bSortable": true },
{ "sType": "numeric-comma", 'sClass': "", "bSortable": true },
{ "sType": "numeric-comma", 'sClass': "", "bSortable": true },
{ "sType": "numeric-comma", 'sClass': "", "bSortable": true },
{ "sType": "string", 'sClass': "", "bSortable": true },
],
"fnDrawCallback": function( oSettings ) {
colSorted['CGITable'] = oSettings['aaSorting'];
}
} );
Has this helped you?
Then please drop me a line :)
Keywords: jquery, dataTables, dataTable, sorting, tables, auto-sorting, aoColumns, IE8, error, unable, className
I kept getting:
SCRIPT5007: Unable to get value of the property 'className': object is null or undefined
jquery.dataTables.min.js , line 27 character 288
I had my table set up and sorted at document.ready like this:
$('#CGITable').dataTable( {
"sDom": '<"top">rt<"bottom"><"clear">',
"aaSorting": [colSorted['CGITable']],
"bPaginate": false,
"aoColumns": [
{ "sType": "string", },
{ "sType": "string" },
{ "sType": "numeric-comma" },
{ "sType": "numeric-comma" },
{ "sType": "numeric-comma" },
{ "sType": "numeric-comma" },
{ "sType": "numeric-comma" },
{ "sType": "string" },
],
"fnDrawCallback": function( oSettings ) {
colSorted['CGITable'] = oSettings['aaSorting'];
}
} );
After a lot of digging, the problem seemed to rise from the following two issues in the aoColumns parameter array:
- Remove the trailing commas from the array declaration (as somebody noted here, the syntax is invalid).
- But I also had to add these properties to each columns' configuration: 'sClass': "", "bSortable": true
My final, working piece of jquery dataTables setup is:
$('#CGITable').dataTable( {
"sDom": '<"top">rt<"bottom"><"clear">',
"aaSorting": [colSorted['CGITable']],
"bPaginate": false,
"aoColumns": [
{ "sType": "string", 'sClass': "", "bSortable": true },
{ "sType": "string", 'sClass': "", "bSortable": true },
{ "sType": "numeric-comma", 'sClass': "", "bSortable": true },
{ "sType": "numeric-comma", 'sClass': "", "bSortable": true },
{ "sType": "numeric-comma", 'sClass': "", "bSortable": true },
{ "sType": "numeric-comma", 'sClass': "", "bSortable": true },
{ "sType": "numeric-comma", 'sClass': "", "bSortable": true },
{ "sType": "string", 'sClass': "", "bSortable": true },
],
"fnDrawCallback": function( oSettings ) {
colSorted['CGITable'] = oSettings['aaSorting'];
}
} );
Has this helped you?
Then please drop me a line :)
Keywords: jquery, dataTables, dataTable, sorting, tables, auto-sorting, aoColumns, IE8, error, unable, className
miercuri, 5 decembrie 2012
php_memcache.dll for Windows 5.4
For those who cannot find the Memcache libraries for php 5.4, here is a link to the dll's php_memcache.dll for Windows:
https://www.dropbox.com/sh/0y53d29wsa1eim5/S3C0-vuIwv
PHP, 5.4., Windows, Memcache
https://www.dropbox.com/sh/0y53d29wsa1eim5/S3C0-vuIwv
PHP, 5.4., Windows, Memcache
joi, 18 octombrie 2012
Illegal mix of collations - how to solve it?
With some queries in MySQL one might encounter an 'illegal mix of collations' error similar to this:
Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '='
It occurs when joining, comparing, concatenating strings of different (incompatible) collations (assembly of information in a proper logical/numerical order).
The 'utf8_general_ci' and the 'utf8_unicode_ci' collations above can differ from case to case, it just happened so in my specific case.
In my case, I was trying to join two tables on those columns with different collations, e.g. (query 1):
SELECT * FROM a LEFT JOIN b ON (a.email=b.email);
Where ,
Table a:
`email` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL
And table b:
`email` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL
The solution is forcing the same / compatible collations on the two columns, query 1 becomes:
SELECT * FROM a LEFT JOIN b ON (a.email COLLATE utf8_unicode_ci =b.email);
There are other solutions, where possible, like changing the collation of the columns / tables by design. e.g.:
ALTER TABLE a CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
or:
ALTER TABLE a MODIFY COLUMN email varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL;
Good luck!
Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '='
It occurs when joining, comparing, concatenating strings of different (incompatible) collations (assembly of information in a proper logical/numerical order).
The 'utf8_general_ci' and the 'utf8_unicode_ci' collations above can differ from case to case, it just happened so in my specific case.
In my case, I was trying to join two tables on those columns with different collations, e.g. (query 1):
SELECT * FROM a LEFT JOIN b ON (a.email=b.email);
Where ,
Table a:
`email` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL
And table b:
`email` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL
The solution is forcing the same / compatible collations on the two columns, query 1 becomes:
SELECT * FROM a LEFT JOIN b ON (a.email COLLATE utf8_unicode_ci =b.email);
There are other solutions, where possible, like changing the collation of the columns / tables by design. e.g.:
ALTER TABLE a CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
or:
ALTER TABLE a MODIFY COLUMN email varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL;
Good luck!
Abonați-vă la:
Postări (Atom)