Nevermind, I found something that works. I'm very rusty on Apache.
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.new-domain.com/$1 [R=301,L]
Nevermind, I found something that works. I'm very rusty on Apache.
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.new-domain.com/$1 [R=301,L]
I'm in need of some htaccess syntax. I recently migrated a drupal 6 site to a drupal 7 site. The original site was located in a subdirectory, foo.foobar.com I now have several hundred links in such places as Facebook etc linking to this domain. I have an htaccess file in the subdirectory of the new site, /public_*html/foo, that redirects simple requests but it does not work for individual node requests. They return 404 errors. This subdirectory is otherwise empty.
What is the correct syntax to accomplish a rewrite of foo.foobar.com/some/additional/pathing TO foobar.com/some/additonal/pathing
given that there are several hundreds of these additional paths. I'd rather not map the old site and write a redirect for each possibility.
I have tried such things as:
RedirectMatch 301 ^foo/.*$ http://foobar.com/
I see alot of stuff for redirecting to a subdirectory but not from a subdirectory to the root directory. Actually, in this particular case I'm going from a subdirecotry to an addon directory but that shouldn't complicate it any more than it already is.
I'm gratified to find discussion of virtual worlds here on Daniweb, and Second Life in particular. I've been a long time away from Daniweb and only came back today because of their missive about Google's new search algorithm and their desire for posts. I'm no longer an active developer because it has proved impossible for me as an independent to compete with larger companies in web development and database applications. I've recently decided to investigate opportunities in virtual worlds. I've been in Second Life for only a couple of months and yes I've noticed a great deal of sexually oriented content. I've also noticed a large number of literary groups and music groups. I'm particularly intrigued by the anthropological opportunities virtual worlds present and the phenomena I refer to as Monsters from the Id. I don't know what the future holds for Second Life. I suspect bigger and better platforms will be made available. But just like Real Life, it is what you make it. Incidentally, I have an avatar named SLClemens. He can be found doing readings from the works of Mark Twain at different venues within Second Life, or at least I hope to get him scheduled as various venues.
So, what is the secret? How can I read the results of a call to the api, xml or json, into an object? window.open displays the raw json object but does not provide much functionality and if the call fails for some reason it does not report error codes that may be returned. Also, I don't particularly want the results to be displayed in a pop-up window. I get the same 400 error using curl.
I'm trying to develop a drupal module to return json from the citysearch api. I can successfully construct the url and I can use the url to open a new window and display the returned json data, thus:
testwindow= window.open (URL, "mywindow",
"location=1,status=1,scrollbars=1,width=100,height=100");
however, my attempt to try this with ajax fails, thus:
$.ajax({
type: 'get',
url: URL,
dataType: 'jsonp',
error: function() { alert("Some error"); },
success: function() { alert("Some success"); }
}); // end ajax method
This always results in the "Some error" alert. I've tried it with 'get' and 'post' for type and with 'json' and 'jsonp' for dataType. No joy. I would appreciate any thoughts on what fundamental points I'm missing here.
I recently purchased a Seagate Expansion external drive, 1.5 TB. I wish to use it on a Debian system so I have reformatted the disk to ext3 rather than the ntfs that it came with. I can manually mount it and it works just fine. My question is how or what do I configure in order for it to mount itself auto magically when it is plugged in. I generally don't mess around with hardware much.
I have a snippet of code, thus:
$match |= in_array($type, $types);
but I am unfamiliar with the |= expression and have been unable to find it in the PHP manuals.
I'm not getting enough practice these days. I found it as a bitwise or operator. Thanks anyway.
I have a snippet of code, thus:
$match |= in_array($type, $types);
but I am unfamiliar with the |= expression and have been unable to find it in the PHP manuals.
I know what header() does, I don't know what ?header? does.
Upon applying for a job, I was given a "tester". One of the questions was what does the php function ?header? do. I have not seen this syntax nor has it come up on any google search I've attempted. Could someone here please educate me on this item? Thanks
It appears that what I actually require is a DVD decoder rather than a driver per se. I did try downloading ATI DVD Decoder 2.1.0 but ran into an out of memory error. I downloaded a copy of DVD Fab and successfully created a copy of a commercial DVD. The program was also able to display the video portion of the movie in one of the programs windows, so I know the physical drive functions correctly. To be fair, I haven't been able to view DVDs on the Ubuntu side either. I haven't had much time to play with this and am only doing so now because I am interviewing for a position that will involve a large amount of video editing. I wish to be more familiar with this process.
I don't use windows much but I have recently acquired a Fujitsu Series N 5010 and set up a dual boot, Windows 2000 Pro and Ubuntu. I'm trying to find the appropriate driver for the DVD player (it originally came with XP home version) for the 2000 side. I've been to the Fujitsu site and can find only XP drivers and nothing specific for the DVD. Any help and suggestions would be appreciated. I'm hoping to experiment with some DVD/video editing.
Thanks...
My bad. I'm a victim of my own unclear thinking. echo $buffer was doing just what it's supposed to, display the displayable part of an XML file. I was trying that just to see if the entire file was actually in $buffer and it was. What I needed to do was this:
$totlen = strlen($buffer);
for ($i=0; $i<$totlen; $i++) {
if (substr($buffer,$i, 1)=="[") {
while (substr($buffer, $i, 1) != "]") {
$fldStr = $fldStr.substr($buffer,$i,1);
$i++;
}
$fldStr = $fldStr.substr($buffer,$i,1);
echo $fldStr."<br>";
$fldStr = "";
}
$i++;
}
The tbsooo.php class uses merge fields put directly in an Open Office document in the form of [var.someVarName] It then merges the value of a variable of the same name with the Open Office template .
Just though I'd let you know...
I need to be able to parse out data fields from Open Office documents on the fly. I'm using tbsooo_class.php and I have a number of files with variable fields embedded. The code I have, derived from TBS (tiny but strong) parses out only the text. I need the entire XML document:
$handle = @fopen("OOFiles/tmp/content.xml", "r");
if ($handle) {
$fs = @filesize($handle);
if ($fs==false) {
while (!feof($handle)) $buffer .= fread($handle,4096);
} else {
if ($fs>0) $buffer = fread($handle,$fs);
}
fclose($handle);
}
echo $buffer;
The content.xml file is actually a part of the Open Office document. It is a XML 1.0 document text.
I need to know how to read this file into a string so I can parse out the information I need. That information does not appear in $buffer.
Thanks...
I currently have a php generated array that looks like:
<ul><div class="oddListing"><li><a
onClick="summaryJS.showCaseSummary('373');"
onDblClick="caseWindow('view&cnmbr=373');">ARMIJOMAR</a></li></div>
<div class="evenListing"><li><a
onClick="summaryJS.showCaseSummary('374');"
onDblClick="caseWindow('view&cnmbr=374');">ARMIJOMAR01</a></li></div>
<div class="oddListing">
....
This array can exceed a thousand records at any one time. I'm trying to
conform this to HTML 4.01 Transitional which means moving the onClick and onDblClick to a series of addEvent statements in the head section of the document.
I'd like to avoid declaring a thousand functions like:
$('someID1').addEvent('click', function() { Somefunction(); });
$('someID1').addEvent('dblclick', function() { SomeDblfunction(); });
$('someID2').addEvent('click', function() { Somefunction(); });
...
Is there some method for coding this using class rather than id? A single function that will be able to recognize the id rather than a thousand identical functions with slightly different arguments.
It seems I have a choice, my menu item can follow suckerfish and change background color on hover or the document.submit() function can work. Not both. Any ideas about this would be appreciated. I have this bit of code for a menu option: <li><a href="#" onClick="document.getElementById('cf').submit()">Commit</a></li>
This allows the Commit to behave as (this bit of css):
#topMenu ul li:hover a, #topMenu ul li.sfhover a {
padding-bottom: 1px;
background-color: #FF7F00;
color: #fff;
}
or <li><a onClick="document.getElementById('cf').submit()">Commit</a></li>
and the submit() works but the css is ignored. Both ways work fine on firefox and othe gnome browsers. The problem is strictly an IE thing.
I was recently given a criticism that a project of mine seems to be designed for "small screen". This is true as most of the work has been done on 17inch screens. I need some general advise and suggestions on what I should be most concerned about: fonts, iframe sizes, div sizes etc. I've got a pretty good idea what to do in specific situations. What I don't have is a designers eye. I've posted this query here as I'm quie sure that whatever I do will be done with AJAX.
if the cookie is set with time=0 it will expire when the browser is closed.
setcookie("name", "value", 0);
Although I still don't see the benefit I have found an explanation of public, protected and private visibility properties. I have only recently started developing in PHP5 so I really haven't paid much attention to it. PHP5 does not accept the var variable definition but does treat those so defined as public and throws an E_STRICT warning. Variables defined as public are accessible everywhere; protected is available in inherited and parent classes and in the class where defined; and, private only within the class wherein it is defined.
Variable and functions not explicitly defined with one of these attributes are treated as public.
Just thought I'd mention this.
I was just reading a new article in Developers Shed pn PHP 5 destructors and was struck by the technique used for coding the examples. I'm thinking primarily of the explicit use of private and public terms for declaring variables and functions. Is there any real benefit from this? Is this something exclusive to PHP 5? I am currently producing code that runs in both PHP 4 and 5 environments.
The task is to separate the display from the data. In this case I'm not entirely convinced it is necessary but I thought worth exploring. I am going to be doing this in a large number of places in one of my current projects. It is widely held adviseable to not encode event handlers in display code, instead set up listeners. In this case each element in an array of records has both on onClick function and an onDblClick function.
I could create an array of strings (JSON perhaps) and save it in a session variable while creating the <ul> or <ol> of records, then let php create JavaScript functions called in onLoad and onUnload. Or, I can leave well enough alone which in this case actually seems easier to maintain. Anyway, I'm just fishing for advise here.
I have this bit of php that works fine as is but I would like to separate out the javascript calls to an onLoad function.
<?php
include("casefile.class");
$cf = new casefile_Rec;
$seclogin=$sess->getSessVar("seclogin");
if ($cf->primary_case_list($seclogin["uname"])) {
echo "<ul>";
while ($row = mysql_fetch_assoc($cf->res)) {
if ($aLine=="evenListing") { $aLine="oddListing";
} else { $aLine="evenListing"; }
printf("<div class=\"%s\">\n", $aLine);
printf("<li><a onClick=\"wcmsJS.showCaseSummary('%s');\"
onDblClick=\"caseWindow('view&cnmbr=%s');\">%s</a> %s %s %s %s</li></div>",
$row["casenmbr"], $row["casenmbr"], $row["casecode"], $row["cswcab"], $row["csstamp"], $row["csclaim"], $row["casetyp_code"]);
}
echo "</ul>";
} else { echo "You have no Open Cases in the System<br>"; }
?>
This displays an unordered list of records, with alternating colors. Each element of the list has two events, onClick and onDblClick. Because the list is dynamic I have not assigned and id to each discrete <div>. An id is necessary for all event listeners I've seen so my question is what is a good way to create an array of objects and utilize the array in an onLoad (and onUnload) function.
My mistake. It wasn't php or mysql at all. I was adapting a downloaded ajax class that treats a response as an array.
As I'd mentioned, it prints the first assumed element in what it thinks is an array (Neck). If I change all the commas in the field to semicolons, the data displays fine. Most of my earlier web app work was done using Postgresql and I don't recall ever having this problem so I rather suspect something on the mysql side. Also, I'm trying this with PHP5 - in case that makes any difference.
$res[4]: Neck; back; shoulders; dizziness and headaches
mysql_escape_string() doesn't solve my problem. The database field (bdyprt varchar(75)) contains the string "Neck, back, shoulders, dizziness and headaches" (I've quoted it here for clarity).
I fetch a row, thus: $res = mysql_fetch_row($this->res); or even as
$this->ap80rec = mysql_fetch_assoc($this->res);
echo $res[4] ; displays Neck
Either mysql or PHP is treating $res[4] as an array and is only giving me the first element.. I'm obviously missing something as phpMyAdmin fetches and displays the string correctly.
I have a mysql database with user input fields. Some of these varchar fields contain commas as part of the data. When I try to display these fields they are treated as arrays and display only the first "element". This occurs both with mysql_fetch_row() and mysql_fetch_array(). I'm chagrined I haven't run into this before, perhaps because commas have generally been limited to text fields. Any help on this would be appreciated.
Even though this thread has been marked solved, I'm new here and spotted this thread. I did some similar work a year or so ago and though you might be interested in what I found. I included the parsing functions just for clarity. Of primary interest is the create_fdf() function.
<?php
session_start();
// the full http path to the PDF form
$form = sprintf("http://%s/HCFA1500/hcfa1500.pdf", $_SERVER["HTTP_HOST"]);
function isNaN( $var ) {
return !ereg ("^[-]?[0-9]+([\.][0-9]+)?$", $var);
}
function fill_string ($fld_name, $fld_value)
{
$key = addcslashes($fld_name, "\n\r\t\\()");
$value = addcslashes($fld_value, "\n\r\t\\()");
$str = "<< /T ($key) /V ($value) >> \n";
return $str;
}
function parse_date($fld_name, $fld_value, $yr_size)
{
if (!strtotime($fld_value)) {
$str = "";
} else {
$mo_str = $fld_name . "_month";
$dy_str = $fld_name . "_day";
$yr_str = $fld_name . "_year";
$str = fill_string($mo_str, substr($fld_value,0,2));
$str .= fill_string($dy_str, substr($fld_value,2,2));
if ($yr_size == '4') {
$str .= fill_string($yr_str, substr($fld_value,4,4));
} else {
$str .= fill_string($yr_str, substr($fld_value,4,2));
}
}
return $str;
}
function parse_phone($fld_name, $fld_value)
{
if (strlen($fld_value) < 11) {
$str = "";
} else {
$ac_str = $fld_name . "_areacode";
$nm_str = $fld_name . "_phone";
$str = fill_string($ac_str, substr($fld_value,0,3));
$str .= fill_string($nm_str, sprintf("%s%s", substr($fld_value,4,3), substr($fld_value,8,4)));
}
return $str;
}
function parse_float($fld_name, $fld_value)
{
if ( isNaN($fld_value) == TRUE) {
$str = "";
} else {
$dol_str = $fld_name . "_dollars";
$cnt_str = $fld_name . "_cents";
$whole_val = floor($fld_value);
$cent_val = (100 * ($fld_value - $whole_val));
$str = fill_string($dol_str, sprintf("%d", $whole_val));
$str .= fill_string($cnt_str, sprintf("%02d", $cent_val));
}
return $str;
}
function create_fdf …
By way of introduction I would like to remark on why I've joined a tech forum in the first place. I am currently developing a web application for managing worker's compensation cases. I am experienced with worker's comp systems as I spent 16 years developing and maintaining an Informix 4GL system. Unnetworked character based systems are a hard sell these days, however. What I'm hoping for, with this community, at least for the short term, are some ideas about how to output data from the web app for automatic use on clients. As an example, the user choses to print a boilerplate letter from the web app. The letter template and the selected data from the app's database are downloaded to the client. In most instances the letter should be printed automatically but I will have some in which additional, on-client editing will need to be done.
I need to figure out the best ways to handle this for MS Word, Word Perfect and of course for OpenOffice. The app is written in PHP4 (I'll probably release it in PHP5) with alot of Ajax. The database is MySQL, however I'd like to find an abstraction layer at least for Postgresql.
Aside from this I'd love to find a way to get back to GIS related work. Once upon a time I had a career as a geographer - professional cartographer actually. This was at the very beginning of the advent of GIS (geographical information systems), which is now …