Are there any ways to check whether my Mysql database and PHP script are optimal? I want to figure it out and fix if it's possible till I publish it on internet for many users.
Thanks.
In former Mac OS x versions it was possible to call Cocoa methods via the "call method" command in applescript ("Applescript Studio").
E.g. this way:
set theURL to "http://www.apple.com"
set URLWithString to (call method "stringByAddingPercentEscapesUsingEncoding:" of theURL with parameter 30)
The script interpreter in the "Applescript Editor" (10.6) does not understand the command "call method". - Is there an equivalent for "Applescript Editor" (10.6)?
I'm currently writing out xml and have done the following:
header ("content-type: text/xml");
header ("content-length: ".strlen($xml));
$xml being the xml to be written out. I'm near about 1.8 megs of text (which I found via firebug), it seems as the writing is taking more time than the script to run.. is there a way to increase this write speed?
Thank you in advance.
I have the following code which works perfectly, but I want to allow access to the /assets directory?
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^.* controller.php
AddHandler php5-script .php
Could someone give me a little line of code or two to help?
I am using YUI rich text editor on my website (php/mysql), so that a user may enter textual matter/articles through it. But if a user copies and paste some embed code in the textarea, from any video sites like youtube, it should get saved as a text block and not as a playing video when showing the text content on the browser. Now YUI automatically converts the characters into html entities which ever is needed. Please note that if I put a new line in the yui editor (by pressing "Enter" key), it will be converted into a "<br>" tag in the background and this will not get html entity encoded when passing the value to my backend PHP script. But If I copy and paste any embed tag or for that reason any valid html tags in the textarea, it will be html entity encoded by YUI. Now to support UTF-8 characters, I am using a function (DBVarConv) in my php script before saving it into my database. The code for the function is given below
function DBVarConv($var,$isEncoded = false)
{
if($isEncoded)
return addslashes(htmlentities($var, ENT_QUOTES, 'UTF-8', false));
else
return htmlentities ($var, ENT_QUOTES, 'UTF-8', false);
}
$myeditorData = DBVarConv($myeditorData, true);
// Save $myeditorData in database.
While showing the data in the browser, I am using another function called "smart_html_entity_decode". The code is given below.
function smart_html_entity_decode($text, $isAddslashesUsed = false)
{
if($isAddslashesUsed)
$tmp = stripslashes(html_entity_decode($text, ENT_QUOTES, 'UTF-8'));
else
$tmp = html_entity_decode($text, ENT_QUOTES, 'UTF-8');
if ($tmp == $text)
return $tmp;
return smart_html_entity_decode($tmp, $isAddslashesUsed);
}
// Get $myData from database
$myData=smart_html_entity_decode($myData, true);
echo $myData;
The problem is that in doing so, it is also decoding the embed and object tags from their html encoded entities and as a result my obejct tags are shown as a video and not as a simple text. Try using the text editor at tumblr.com. If you paste an embed code in the editor, it will be shown as a text block not as a video. I am trying to build the same functionality on my website with UTF-8 support.
Any help will be highly appreciated.
Hello.
I am programming web interface which communicates with cisco switches via telnet. I want to make such system which will be storing one telnet connection per switch and every script (web interface, cron jobs, etc.) will have access to it. This is needed to make a single query queue for each device and prevent huge cisco processor load caused by several concurent telnet connections.
How do I can do this?
My current powershell script:
$document = "C:\\test.doc"
$word = new-object -comobject word.application
$word.Visible = $false
$word.DisplayAlerts = "wdAlertsNone"
$word.AutomationSecurity = "msoAutomationSecurityForceDisable"
$doc = $word.Documents.Open($document)
$word.ActivePrinter = "\\http://ptr-server:631\pdf-printer"
$background = $false
$doc.PrintOut([ref]$background)
$doc.close([ref]$false)
$word.quit()
But it results in an alert box "The macros in this project are disabled. Please refer to the online help or documentation of the host application to determine how to enable macros."
How can I open the document without it running the AutoOpen macro or displaying any sort of dialog prompt?
Each of my users has a (possibly) different TZ defined in their /.bashrc. I have a Perl script that displays date/time and want it to have it display with their profile time zone.
Does anyone know the best way to do this?
Hello! I am trying to implement a live search on my site.
I am using a script somebody has already created. http://www.reynoldsftw.com/2009/03/live-mysql-database-search-with-jquery/
I have got the Jquery, css, html working correctly but am having troubles with the php.
I need to change it to contain my database information but everytime I do I recieve an error:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\search.php on line 33
These are the details of my database:
database name: development
table name: links
Columns: id, sitename, siteurl, description, category
This is the php script
<?php
$dbhost = "localhost";
$dbuser = "root";
$dbpass = "password";
$dbname = "links";
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
mysql_select_db($dbname);
if(isset($_GET['query'])) { $query = $_GET['query']; } else { $query = ""; }
if(isset($_GET['type'])) { $type = $_GET['type']; } else { $query = "count"; }
if($type == "count")
{
$sql = mysql_query("SELECT count(url_id)
FROM urls
WHERE MATCH(url_url, url_title, url_desc)
AGAINST('$query' IN BOOLEAN MODE)");
$total = mysql_fetch_array($sql);
$num = $total[0];
echo $num;
}
if($type == "results")
{
$sql = mysql_query("SELECT url_url, url_title, url_desc
FROM urls
WHERE MATCH(url_url, url_title, url_desc)
AGAINST('$query' IN BOOLEAN MODE)");
while($array = mysql_fetch_array($sql)) {
$url_url = $array['url_url'];
$url_title = $array['url_title'];
$url_desc = $array['url_desc'];
echo "<div class=\"url-holder\"><a href=\"" . $url_url . "\" class=\"url-title\" target=\"_blank\">" . $url_title . "</a>
<div class=\"url-desc\">" . $url_desc . "</div></div>";
}
}
mysql_close($conn);
?>
Can anybody help me input this database info correctly? I have tried many times but keep getting an error. Thanks in advance.
rails - 2.3.8
ruby - 1.8.7
After auto_complete plugin installstion i still have "undefined method `auto_complete_for'" problem!
Andrey-Bezruks-MacBook-Pro:eyeonasia.stage wizeflux$ ruby script/plugin install http://github.com/rails/auto_complete.git --force
svn: '/Users/wizeflux/Projects/ionasia/eyeonasia.stage/vendor/plugins' is not a working copy
Initialized empty Git repository in /Users/wizeflux/Projects/ionasia/eyeonasia.stage/vendor/plugins/auto_complete/.git/
warning: Option "depth" is ignored for github.com/rails/auto_complete.git
From github.com/rails/auto_complete
* branch HEAD - FETCH_HEAD
Andrey-Bezruks-MacBook-Pro:eyeonasia.stage wizeflux$
after restarting server i get an error on line " auto_complete_for :listings, :name " - undefined method `auto_complete_for' for #
I am a newcomer to Python and am converting a Perl script. What is the Python equivalent to...
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
Any help is greatly appreciated.
Hello,
I need to include the content, scripts, forms and dynamic abilities of one page in another onClick.
Take a look at http://www.divethegap.com/scuba-diving-programmes-dive-the-gap/dahab-master-scuba-diver.html
Then follow one of the links that says 'Beginner' 'Open Water Diver' etc....
You will find a PHP page with a series of options. It is an adaption of the wordpress blog system to produce only specific options for specific programmes by considering each type of each diving programme a category and then displaying only results from that category.
You will see that each option is also a collapsible panel and there are also several javascripts that calculate durations, quantities and prices. There is also a validating webform at the end.
Now go back to the first page. What I would like to do is include all the content from the second page after the main header inside tabbed panels on the first page so that the customers can immidietly see everything that is included. Essentially the options on the first page would become a series of tabs.
The only way I can see to do this is with an iFrame as each option would need a unique URL ending (that is .php?cat=26 or .php?cat=27). THe problem is that the collapsible panels will not work with an iFrame as the iFrame will not resize when the panels open. There were also some calculation problems, but I think that was more down to me staring at the screen for the last 3 hours not remembering to include everything.
I have tried it with resizing iframe SSI scripts and have got nowhere.
I tried actually embedding it in the page better with a ajax script, but that left behind all the scripts that make it work. I checked with full URL's on everything and it would not take work with any scripts.
I know that you could just make the whole page reload but then the user would be at the top of the page again, and even if another script was applied to slowly bring them down again it would not be anything near as easy to use as if it was like tabbed panels.
Any ideas.
Kind Regards,
hey
i made a script that uploads files to different servers using php curl and the problem is that it eats all my upload bandwith and my apache does not respond as i would like.
the call is made from the php-cli and can not use any apache bandwith limiting bandwith
thanks in advance
Hi,
Here's what I'm trying to do:
joomla in 1 subdirectory, wordpress in another.
mysite.com directs to the joomla directory
mysite.com/blog gives wordpress.
I would also like to use seo friendly permalinks for both.
I am using Zeus Linux shared hosting with Joomla 1.5 and wordpress 2.9.2, and having a great deal of trouble finding a suitable rewrite script. Any help would be very much appreciated! Thank you.
I have this line of PHP code:
thisFunctionDoesNotExist();
And it stops script execution with:
Fatal error: Call to undefined function
I tried using set_error_handler and it does help for warning type of errors. But not for fatal errors. As I understand it from various threads on internet it should be possible to handle by set_error_handler, but I cannot make it work.
Can you please post working example?
Hey folks
I'm trying to prepend a gzip script at the beginning of every file using
php_value auto_prepend_file gzip_start.php
in my .htaccess. The problem is that I've already got a document called combine.php that gzips it contents. What I need to know is, how I can exclude combine.php from the files who get the gzip prepended. I thought about using filesmatch, but can only figure out how to do it on just that one file, and not the exact opposite.
Any ideas?
I've read through several threads about this error, but haven't been able to apply it to figure out my situation...
My flash file is an approx 5 second animation. Then, the last keyframe of each layer (frame #133) has a button in it. My flash file should stop on this last key frame, and you should be able to click on any of the 6 buttons to navigate to another html page in my website.
Here is the Action Script that I have applied to the frame in which the buttons exist (on a separate layer, see screenshot at: http://www.footprintsfamilyphoto.com/wp-content/themes/Footprints/images/flash_buttonissue.jpg
stop ();
function babieschildren(event:MouseEvent):void
{
trace("babies children method was called!!!");
var targetURL:URLRequest = new URLRequest("http://www.footprintsfamilyphoto.com/portfolio/babies-children");
navigateToURL(targetURL, "_self");
}
bc_btn1.addEventListener(MouseEvent.CLICK, babieschildren);
bc_btn2.addEventListener(MouseEvent.CLICK, babieschildren);
function fams(event:MouseEvent):void
{
trace("families method was called!!!");
var targetURL:URLRequest = new URLRequest("http://www.footprintsfamilyphoto.com/portfolio/families");
navigateToURL(targetURL, "_self");
}
f_btn1.addEventListener(MouseEvent.CLICK, fams);
f_btn2.addEventListener(MouseEvent.CLICK, fams);
function couplesweddings(event:MouseEvent):void
{
trace("couples weddings method was called!!!");
var targetURL:URLRequest = new URLRequest("http://www.footprintsfamilyphoto.com/portfolio/couples-weddings");
navigateToURL(targetURL, "_self");
}
cw_btn1.addEventListener(MouseEvent.CLICK, couplesweddings);
cw_btn2.addEventListener(MouseEvent.CLICK, couplesweddings);
When I test the movie, I get this error in the output box: "TypeError: Error #1009: Cannot access a property or method of a null object reference."
The test movie does stop on the appropriate frame, but the buttons don't do anything (no URL is opened, and the trace statements don't show up in the output box when the buttons are clicked on the test movie).
You can view the .swf file here: www.footprintsfamilyphoto.com/portfolio
I'm confident that all 6 buttons do exist in the appropriate frame (frame 133), so I don't think that's what's causing the 1009 error.
I also tried deleting each of the three function/addEventListener sections one at a time and testing, and I still got the 1009 error every time. If I delete ALL of the action script except for the "stop ()" line, then I do NOT get the 1009 error.
Any ideas?? I'm very new to Flash, so if I haven't clarified something that I need to, let me know!
How do I flag an app in Windows Vista/Seven to disable desktop composition thru registry or NSIS script?
Normally it´s done in Compatibility settings in app´s properties.
I need to script the conversion of some WMV files to a DVD-Video ISO file suitable for burning and viewing on a Windows system - does anyone have a simple solution that doesn't involve chaining together calls to ffmpeg and pegging my system CPU?
For a Bash completion script I need to get all the variables from an installed Python module that match a pattern. I want to use only Python-aware functionality, to avoid having to parse comments and such.
I need to mimic the preprocessor feature of C with Python.
If I want to run the debug release, I use as follows with C
#ifdef DEBUG
printf(...)
#endif
I just use -DDEBUG or similar to trigger it on or off.
What method can I use for Python/Ruby?
I mean, what should I do to control the behavior of python/ruby scripts in such a way that I can change a variable that affects all the script files in a project?
I am using galleria for [link text][1]
[1]: http://minavet.ro but the script works well with ie8 opera and ff but in chrome the full site goes to the dogs
Thx for any sugestions
just yesterday i finished one site, which provides video watching.
but now i need to show the number of views of each film. i never wrote such thing, so i don't know what to do.
maybe i must add one field in mysql database, and increase it every time the video opened?
but i use flash player, and i can't wrote script onclick of player.
so, could you give me an idea...
thanks
I've created a form that posts to a cfm file. When running a script onLoad that fills in the form values and tries to submit...The site takes me back to the login screen.
function f()
{
document.getElementById("email").value = "[email protected]";
document.getElementById("password").value = "asdf";
document.getElementById("form1").submit();
}
Please help!
If the user manually clicks the 'submit' button, i use this code:
if (isset($_POST['submit_findall'])) { ...
But what what code should I use if I want to activate this from within a script ?
Thanks!