Showing posts with label Code. Show all posts
Showing posts with label Code. Show all posts

Saturday, August 10, 2013

PSPad Scripts menu missing Solution

If you missing scripst menu in your pspad and same results after update / install, do this:


  1. Go to Settings -> Program settings
  2. -> Sistem integration 
  3. Enable option "Integrated scripting support (WSH)"
Done.

Good luck in your scripts, thanks for comments & likes <3 div="">

Tuesday, July 17, 2012

htaccess file invisible on ftp

Once again i faced with this problem...

I have connected to ftp to edit htaccess file but it is invisible. I use PSPad Editor with ftp client support.

Here is how to fix


Invisible files on ftp in PSPad:
1. Edit your ftp connection
2. Check checkbox with text - "Show hidden files (must be supported by FTP server)"
3. Reconnect
4. Done.

Cureftp fixing hidden files:

1. Open CuteFTP and Enter Hostname , Username and Password.
2. Click Action tab in Settings
3. Click on Filter button
4. tick on Enable server side filtering
5. Enter -a in Remote filter
6. Click on apply & connect.

FileZilla fix to see invisible files:

For FileZilla 2,
1. Click on Settings.
2. Select Edit -> Settings -> Interface settings -> Remote file list
3. Tick check box syas Always show hidden files & press ok.

For FileZilla 3,
1. Click on Server from top navigation.
2. Click on Force showing hidden files at last option
3. Press ok when it shows warning.

Monday, June 25, 2012

Multiple mysql insert quiery

i was trying to insert a lot ( 1.000.000 ) values into single table with single query, because inserting each value takes much longer time.

table looks like:

id , value

so solution is to create array with php of the values:

code:
    $insert = array();
    for($i=0;$i<=950000;$i++)
    {
      $insert[] = "('".md5(rand(0,1000))."')";
    }

and then executing the query:

$sql = "INSERT INTO `skelbimai` ( `value` ) VALUES ".implode(",",$insert)." ";
ALSO

You might have problem with time limit. so i set up this limit:

set_time_limit(1800);
Also you might have problem with memory_limit, so use it:
ini_set('memory_limit', '150M'); 

Good luck. 

Wednesday, June 13, 2012

Blockly - Google's programming language

Blockly is a web-based, graphical programming language. Users can drag blocks together to build an application. No typing required.
Blockly is currently a technology preview. We want developers to be able to play with Blockly, give feedback, and think of novel uses for it. All the code is free and open source. Join the mailing list and let us know what you think.
You can try to programm with Blockly by your self.
  • Maze - Use Blockly to solve a maze.
  • Code - Export a Blockly program into JavaScript, Dart, Python or XML.
  • RTL - See what Blockly looks like in right-to-left mode (for Arabic and Hebrew).
 
My result for Maze:

Thursday, January 26, 2012

Change prestashop stores google maps zoom


Good day visitor.

In prestashop there is "Stores" section.

To change zoom of the default map which loads up after navigating there, go to:


  • /js/ folder
  • open stores.js
Go to line 196.

You will see code like this:

map = new google.maps.Map(document.getElementById('map'), {
center: new google.maps.LatLng(defaultLat, defaultLong),
zoom: 15,
mapTypeId: 'roadmap',
mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}
});

Change Zoom to whatever you like.

Good luck!

Thursday, August 4, 2011

PHP string replace all except numbers and chars

Here is PHP function(code) to remove all but not characters and numbers.
$result= preg_replace("/[^a-zA-Z0-9]+/", "", $text);
p.s. If you are looking to delete everything but numbers, than look here:
http://pilotaz.blogspot.com/2011/05/php-remove-all-characters-and-leave_29.html

Monday, August 1, 2011

PHP multidimensional array check

Today i faced with problem that array had array inside it. It means that the array is multidimensional. So i was forced to recheck the array check with function is_array to new check. Here is the code of check:


function is_multi($a) {
    $rv = array_filter($a,'is_array');
    if(count($rv)>0) return true;
    return false;
}

Source: http://stackoverflow.com/questions/145337/checking-if-array-is-multidimensional-or-not
Big thanks to Vinko Vrsalovic

Sunday, May 29, 2011

PHP remove all characters and leave only numbers

function which will remove all but leave only numbers for php:
$string = preg_replace('#[^0-9]#','',strip_tags($string));

p.s. If you are looking for function to delete all except chars and numbers look here:
http://pilotaz.blogspot.com/2011/08/php-string-replace-all-except-numbers.html 

Friday, May 27, 2011

Broken image. Failed to load images fix with JQuery

Today i was solving problem with failed to load images. There was 2 solutions for this - 1) php with getimagesize and 2) JQuery check.

getimagesize showed me warnings so my choice was JQuery.

And it was great choice, because using jquery is always fun.

Code i used for all img ( CSS attribute ):

$(window).load(function() {
$('img').each(function() {
if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) {
// image was broken, replace with your new image
this.src = 'http://www.example.com/replace_no_image.jpg';
}
});
});

Friday, April 15, 2011

Solution 1030:Got error 139 from storage engine

Today i meet with one big problem while updating MySQL database. The error is 1030:Got error 139 from storage engine.
The problem is that rows has limit.
I was trying to change limit, but there is no need.

Solution for this is very easy. All you need to change ENGINE of your table. While engine almost does nothing, and it will not effect on your values. ( Please read http://dev.mysql.com/doc/refman/5.0/en/storage-engines.html , before doing something ).

I had no time to read this so i executed the query:
ALTER TABLE `table_name` ENGINE = MYISAM

It worked for me. Hope it will work for you too.

Saturday, April 2, 2011

htaccess doesnt work on windows of xampp [Solved]


My situation: I have xampp and perfectly working website. And problem is that site does nothing, while changing htaccess.

Here is solutions for this:

  • go to xampp folder and search for httpd.conf in apache/conf folders.
  • open it
  • make sure that LoadModule rewrite_module modules/mod_rewrite.so is uncommented
  • find all AllowOverride and changed None to All. All AllowOverride!!! There should be 3 of them..
It worked for me.. and might help you.

Happy htaccess editing!

Thursday, March 31, 2011

Search folder and subfolders in text files for a string


While developing on new project which was created not by you, the software always is good for searching something..
Big plus of the software is that it is searching in sub directories... and it searches in text files! And most important it works just great!

Searches text files for strings and combination of strings. Has useful or / and / and not search combinations, and can also use regular expressions. New in version 3, is the built-in viewer / editor that highlights the matched strings and lines.

URL: http://www.sadmansoftware.com/

Page speed checker by Google



Here you go... google launched Page speed online analyzer. While it analyzes, it gives you lots of suggestions after completeing them, you website speed will improve!
There is 2 methods of analyzing - Desktop and Mobile. After analyze you will get number from 0 till 100 which describes your result of website speed.

URL: http://pagespeed.googlelabs.com/

Tuesday, March 22, 2011

Rounded corners border CSS Problem in IE [ Internet Explorer ] [ Joomla ] [ Solved ]


Here you go.. There is an css code for "good" browsers to change your div's corners to rounded ones. But "bad" browsers such as Internet Explorer ( IE - IE6, IE7 and so on... doesnt works pretty good under this conditions.. ), so here is solution for this problem.


CSS CODE EXAMPLE OF DIV WITH CLASS = "box"
.box {
-moz-border-radius: 15px; /* Firefox */
-webkit-border-radius: 15px; /* Safari and Chrome */
border-radius: 15px; /* Opera 10.5+, future browsers, and now also Internet Explorer 6+ using IE-CSS3 */
-moz-box-shadow: 10px 10px 20px #000; /* Firefox */
-webkit-box-shadow: 10px 10px 20px #000; /* Safari and Chrome */
box-shadow: 10px 10px 20px #000; /* Opera 10.5+, future browsers and IE6+ using IE-CSS3 */
behavior: url(ie-css3.htc); /* This lets IE know to call the script on all elements which get the 'box' class */

}

There should be like this: "behavior: url(path/to/ie-css3.htc);"

Download url of the ie-css3.htc file. Put the file into root and css folder. ( and into other folders in other cases.. ^^ ):
http://uploading.com/files/dm247e4c/pie.zip/

I faced with this problem while doing rounded corners in Joomla template. Also this resources might be helpful

Friday, February 25, 2011

Hidden new line in string PHP


I guess you seen the problem, or maybe facing with it at the moment. So if you echo the string with pre tags, it will show normally. But without pre tags, it shows ugly... just like a plain text.

The problem is that there is hidden new lines symbols like /r or /n and so on...

Just by replacing the with str_replace is not enough. So here solution for it:

$value = preg_replace('/[\r\n]+/', '\n', $value);
echo htmlentities($value);

Wednesday, January 12, 2011

PHP export mysql table to text file


Here is simple script which will help you a bit, to export all fields of your database table to text file. It will not be same as export of MyAdmin, but its better than nothing... at least you will have data.
$sql_export = "SELECT * INTO OUTFILE 'tables.txt' FROM `table_name` ";
//var_dump($sql_export);
if($result = mysql_query($sql_export))
echo "Recorded";
else echo "Not recorded";

Thursday, January 6, 2011

Finding time difference in seconds between 2 dates ( timestamps )


In my situation i needed query to find time difference in seconds between current time and field's value.
SELECT TIME_TO_SEC(TIMEDIFF(NOW(),`field_name`));
between 2 mysql fields can look like this:
 SELECT TIME_TO_SEC(TIMEDIFF(`field_name1`,`field_name2`));