Oct 11
29
Today I had to put a simple script on one of my hosting server where a “Facebook Login” button was available for login. However when I had to run it I encountered the following error:
Warning: file_get_contents() [function.file-get-contents]: Unable to find the wrapper “https” – did you forget to enable it when you configured PHP?
This was becouse the url served to file_get_contents start with http:// ….
If you have the same problem there are 2 steps to rezolve it:
Server restart and you are good to go.
To test from PHP is extension php_openssl is active just paste this code:
Along with the “upload_max_filesize” when uploading files with PHP there is another parameter named “max_file_uploads” witch prevent uploading more files that the value of this parameter.
Default size of this parameter is 20 and is should be enough for more apps then I can count but today I had to repair a bug in a page where a form contain 30 file uploads and just 20 were availble in $_FILES from php script.
How can you change this?
There are 2 methods. One is to change it from php.ini but not always you can access php.ini file
The second method is not using ini_set :( . Tried that and not working.
I did find another method witch need some javascript. The method is when submiting the form a javascript will disable all unused upload elements like this:
and the form:
I had stumbled today on 7pic.com website witch is a new and free hosting service for photo sharing. I give it a try and I like it becouse i can use the 7pic uploader to upload picts without to start a browser.
Uploaded images are stored in albums and can be shares as an images witch can be embedded in a blog post or as a link to a page on 7pic.com where anybody can comment that images share on facebook, twitter and other social networks and of course anybody can rate the picture.
In this post you will see a example of using call_user_func_array (from PHP) to call a simple function, a public static method from a class and a public method.
First I define one function and one class:
Maybe you notice that in the class I did inserted a construct and destruct functions. You dont realy need them for this example to work but I always include them when I write a class.
Call a simple function with call_user_func_array:
Call a public static method:
Call a public class method
Apr 11
24
If you want to see what Apple will know about you on your next device sync look for file consolidated.db and open it with a sqlite application or watch it sync over a map with the free application iPhoneTraker (just for MAC users)
This days I was working on a webpage but to test in Firefox was a pain. Firefox store css and js in cache with the rest of the page. Reloading page with CRTL + F5 combination seems to reload from server the page but not the css/js files. After hours of frustration and complete cache delete before every page test I did found 2 methods to prevent Firefox to cache.
First and the easy one is to enter in the about:config menu (if you do not know what I mean by about:config go to Firefox url box paste about:config and press <enter>. You will find there settings you will not find in the firefox menus).
From the about:config search network.http.use-cache and set it to false. This will force Firefox to stop loading pages from cache (this will slow your firefox).
The second method to prevent caching (and this method is working for all browsers) is to load the js / css like this
The second method is availble just for developers
This replace will search in every row of the table where condition from WHERE is true and replace function will replace all instances in a string.
ex. if you have text “hello world” and you want to replace the “o” letter with “*” this will will transform the text in “hell* w*rld”
When you let users input text in a textfield or input box iti is always a good ideea to use trim function to remove spaces form the begining or the end of the string.
Today I needed a function to trim spaces from the middle of a string and replace with a single space.
if you need to remove all spaces you can use this function:
Nov 11
21
How to disable comments notification for WordPress
Do you receive alot of emails sent by your WordPress Blog becouse people comment your posts?
You can turn this off like this:
1. Login to your blog admin page
2. Click on Settings -> Discussion
3. Search in that list for “E-mail me whenever:”
Now by default you receive email when “Anyone posts a comment” and “A comment is held for moderation“. Uncheck any or both of this options as you like.
You should definitely uncheck “Anyone posts a comment”.
Posted in Wordpress by admin. Comments Off