Jump to content

jekillen

Members
  • Posts

    28
  • Joined

  • Last visited

About jekillen

  • Birthday 10/11/1948

Previous Fields

  • Languages
    html/css, javascript, actionscript, php, mysql

Contact Methods

  • Website URL
    http://www.jekillen.com

Profile Information

  • Location
    Southern Oregon
  • Interests
    art, music, web developement

jekillen's Achievements

Newbie

Newbie (1/7)

1

Reputation

  1. I have javascript code that is intended to set two cookies. The first one in this assignment document.cookie = 'TAscrollto=135; path=/; domain=192.168.1.27; max-age=3600; ' and the second in this assignment: document.cookie = 'TAscrollto=135; path=/; domain=192.168.1.27; max-age=3600; CMscrollto=199; path=/ domain=192.168.1.27; max-age=3600; ' The reason the first cookie is reproduced in the second assignment is the way my cookie manager utility works. I am assuming that would not make a difference. Both of these assignments are made just before the page reloads in call to window.location = (self processing php script). It is intended to test setting the div and textarea overflow to the figures registered in the cookies, on reload The first cookie shows up in the browser preferences for viewing cookies. The second one does not, and the behavior expected from the intended second cookie value is not evident. Firefox 34.x on Mac OSX Is there any reason visible in the strings assigned to document.cookie why the second cookie (CMscrollto) was not set?
  2. I have developed a web based text editor that I use for editing text files on a site that are owned by the web server user account (unix type system). These file contains many hundreds of lines of code (including comment blocks). When the contents of the text file is displayed in a textarea for editing of text, it overflows the visible area of the textarea element. I can scroll in the textarea with mouse scroll ball*, but no scroll bars are visible unless I scroll into the overflow area to the right of the textarea. There is a left/right scroll bar on the bottom, but that is part of the div that the textarea is nested in. *using an Apple mouse in Firefox on Mac OSX; Firefox is the primary client used for development. Is there an event type that I can monitor in js code to record the scrollHeight value? Or am I limited to recording it in a blur event handler? The textarea is generally focused when the 'Save' processing is executed. I want to be able to save the scrollHeight value when the user clicks 'Save' to save the edits. The contents of the textarea will be sent to server php code to overwrite the file with the edited version. When the 'Save' processing is done, I want the textarea to auto scroll to the last scrollHeight value recorded when 'Save' was executed.
  3. jekillen

    Help with regex?

    In original post I neglected to include an embedded double quote set around \$_ref I got what I am looking for: $_ref = 'help'; $_testStr = "do you want \" \$_ref \", or do you want $_ref?"; preg_match('/(\".*(\\$).*\")/', $_testStr, $_match); $_alt = str_replace($_match[2], '\\$', $_match[0]); $_testStr .= "\n".str_replace($_match[0], $_alt, $_testStr); in html ... etc.. <pre> <textarea > do you want " $_ref ", or do you want help? do you want " \$_ref ", or do you want help? </textarea> <spam><code> do you want " $_ref ", or do you want help? do you want " \$_ref ", or do you want help? </code></span>
  4. Has a node.js forum category been considered? I have found a node.js specific forum, but the traffic there appears to be mostly nil. As I read the Apress text about it, it does not appear to be to usable accept as a local application server that would be intalled on 'localhost' and used with a localhost browser interface. I don't see how it would be used with a registered domain name, accept via a non standard, high numbered port. Someone did not like my last posts on stackoverflow and I don't know why, so I can't go there. Thanks
  5. jekillen

    Help with regex?

    Hello; I have been doing php for some time and I had initially become somewhat knowledgable on how to use create and use regular expressions (with the old regex funtions). But I have been avoiding regex as slow, in favor of designs that would allow string manipulation functions where and when ever possible. But there are situations where it is un avoidable, as now: I am working on an html base text editor. The text to be edited is loaded into a textarea element in the editors html. If the text to be edited is a php and/or html/javascript code file, there are cases where there are escaped dollar signs inside of double quotes. I want to find instances of escaped dollar signs (\$) inside of double quoted strings only, and add an extra escape to the $, so it becomes "....\\$...." instead of "....\$...." Here is what I have so far, but it seems to be removing everything but the $ in initial testing: $_testStr = "do you want \$_ref, or do you want $_ref?"; $_testStr = preg_replace("/\".*(\\$).*\"/", '\\$', $_testStr); So, in this function, how to I reference and replace only what is matched by the sub pattern? I am having much difficulty understanding the php online manual regarding this. Do I have to do preg_match() first and then use the $n reference as the replacement? Thanks for time and attention
  6. So, if I use 'htmlspecialchars($content)' will I have to contend with the special chars once the file contents are visible and editable in the form textarea? Is TinyMCE a completely html/php text editor? My reason for doing this is because of ownership issues when php is used to create files, directories, edit files, upload content, copy content, etc. My aim is to create a custom content managment system that can be completely used via a web interface, not needing ftp access. Because it is content management it will be strictly limited to registered admin users. The core and foundation of this system is an html/javascript/php app that emulates a terminal, in that it will produce a directory listing base on user specification. The listing will produce a list similar to using ls -la in a unix shell, with the added feature of producing the octal version of rwx perms for owner group and others. It has a set of functions to do things such as change perms remove, move, create files and dirs, edit (the subject of this post), and turn over ( copy ftp user owned content, then remove the user owned version of the copied content). The text editor: can be opened from the terminal app in a javascript window.open call or opened directly from an anchor tag. A file system browser which is both stand alone and also used via call to javascript window.open from terminal app and editor. In the terminal app, the browser can be used to select items that are not visible in the currently listed content. For instance, for moving, one would choose the file or dir to move and the directory to move it to. In the editor, the browser can be used to designate that path to a new file, select a file to open and for use in save as for designating a different directory to place the saved as file. There are other facilities I am working on, such as selecting files to create a zip archive, creating the zip archive, unzipping uploaded zip files and designating what directory to place uploaded files (another use of the file browser), and selecting files and packages to download. The file browser works roughly like an operating system file browser app that would appear when on saves or opens a file in an app running on the host OS. It has two modes of operation. One is to list all the directories in the initial left most column. Each dir listing has a radio button next to it that is make into a submit button via javascript and initiates an ajax request for a listing of only the files in that directory. These secondary listings can be done in any order so a user can compare the contents of one dir with a different dir, side by side. The secondary listings can also be removed one at a time in any order. The second display mode is to display only the top directory with all its contained files and directories. Clicking on a radio next to a directory listing will produce a secondary listing of that directory and all of its file and directory contents. As before the secondary listings can be produce in any order and remove in any order. Am I re inventing the wheel? Or are there features here that don't exist in any other web CMS system? I don't know, I am retired, now, and not having secured work in the development field inspite of over ten years of self guided learning and developing. Instead of alchohol consumption or computer games, I sit around dreaming up reasons to program. I think of apps and features and figure out how I would get them to work. I have nothing to sell or solicit for here: www.jekillen.com
  7. I would think that the interpreter could figure out that this was not productive syntax, as it occures where there is absolutely no sense for it. The interpreter should be able to recognize a conditional statement, branching statement such as switch, and a looping statement; and distinguish it from a function call; and find a semicolon after the closing parenthesis to be adverse to the process of the code. The use of string true or false instead of the boolean is because sometimes it comes from a form field value or similar string representation, such as using php to initiate a javascript variable via a php print statement.
  8. Perhaps this will help someone who is having maddening problems with managing simple true/false conditionals. I have had a problem with the following code: argument 'e' is event being being handled. The user has clicked on an item in the web page. // etc... case 'either': if(heading == 'false') { heading = setFile(e); // if a file is detected, returns 'true', else returns 'false' } if(heading == 'false') { heading = setDir(e); // if a directory is detected, returns 'true', else returns 'false' } break; // etc.... The explanation is: The snippet is from a function that detects user generated event on visible item in the page. The items to select are either directories or files from a file system directory listing. case 'either' means that the user can select either files or directories from the list. If setFile() returns 'true', the user has selected a file listing. So setDir() will not be run The problem I was having is that setFile() would set heading to 'true' but setDir() was still being run. The cause turned out to be in the code below. I had a semicolon after the conditional. I was NOT getting a syntax error. The browser I am using for developement is Firefox v34.0.5 on MacOSX v10.6.8 The presence of the semicolon appears to have had the effect of resetting heading to 'false' when setFile() set it to 'true'. The problem was this: if(heading == 'false'); // <- Notice the semicolon? { heading = setDir(e) }
  9. I have developed a web based file editor that loads text file contents into a textarea element for raw display and editing. However there are problems with this: 1: any closing textarea tag forward slash has to be escaped: <\/textarea> other wise the browser goes berzerk and smears code and markup all over the place. 2: The browser will remove escapes when the content is posted, so all escapes have to be doubled: <\\/textarea>, then the extra escape has to be added by code when the file content is loaded into the textarea for edit. That means: generally inside pre tags and in modal dialogs when the text string is composed by javascript code. Or, in strings precomposed and printed/echoed by php in html markup. new line sequences E.G. '\n' or '\n\r' Also: double quotes E.G. " \" \" " single quotes E.G. ' \'\' ' apostrophes inside of single quotes E.G. ' can\'t ' And regular expressions in code and etc. My question is: How to detect and escape backslashes in any circumstance? Would this be less of a problem with wiki editing? (any developers working on this forum have any tips?) Here is what I have so far: (naming variables with $_varName is just my style) // </textArea> being the only html tag with 'text' in the name $_fileStr = str_replace('</text', '<\\\/text', $_fileStr); $_fileStr = str_replace('\n', '\\\\n', $_fileStr); $_fileStr = str_replace('\"', '\\\\"', $_fileStr); $_fileStr = str_replace('\'', "\\\\'", $_fileStr); But: $_fileStr = str_replace('\', "\\\\", $_fileStr); Appears to cause my BBedit text editor syntax color coding to break down and I assume it will not fly with the php interpreter either.
  10. I have a project that uses javascript window.open to open a window that loads a php enabled html form page. When the window is originally opened, it opens in the expected separate window. BUT, if I use one of the buttons assigned event handlers that call form.submit()* (method is set to post) * in the separate window. This is a self processing html/php form page. The resulting page opens in a new browser tab with the original window still opened but unresponsive to events. I am developing in Firefox 34.0.5. But I am assuming that this would be encountered on any DOM browser type and version. This is the first time I have encountered this phenom, even in this same project. What could be causing Firefox to open a new tab for the same html/php file? Possibly a js var naming conflct with the target attribute in an html element such as <a> or <form>? EDIT: Yes, that was the problem: I had a variable named 'target' that is supposed to hold path information and then refered to it and had some code manipulations to it in a 'with(document.forms.formName)' block. The result seems to have set the target attribute of the form. But it may be useful to know how to program javascript to open windows in a separate tab intentionally. Thanks for time and attention JK
  11. EDITED: While waiting for a reply, I have figured out the solution to this problem: The path info is wrong. All of the sub dirs have an index.php file and '.' and '..' And most have identical sets of directories such as php, js, css, and img. So, I am using scandir() to get the file list but it doesn't provide the necessary path info for each listing. I have to add that for the other functions to find and process the files properly. Maybe some else will see and benefit from this. Hello; I have a project that is run on a FreeBSD server and I am running into problems I can't figure out with code that is supposed to list directory contents in the servers file system, along with user and wrx and octal file perms for each entry. So, the problem is that a directory listing for a directory below the 'home' directory will only successfully list the following: . .. index.php any directory (mostly, there is one dir where sub dirs are also not showing up) all other files return errors for function code I have for getting wrx perms. The same is true for results of calls to stat() and other related function code such as fileperms(). index.php IS a file, so why would the other 'files' fail to produce results? Any ideas? Any similar experience and solutions? Ownership issues? (why would index.php go through with the same ownership and perms?) file corruption? inadequate php ini settings? Sample output follows: Sample of home directory listing (default for the user interface display) Owner type and permissions Octal value Name jekftp d : dir | r w x r w x r w x 0777 . jekftp d : dir | r w x r - x r - x 0755 .. jekftp - : file | r w x r w x r - - 0774 BTO.php jekftp - : file | r w - r - - r - - 0644 B_shebangInCShell.txt jekftp - : file | r w - r - - r - - 0644 adminUPLD.php jekftp - : file | r w - r - - r w - 0646 browserDev.txt jekftp - : file | r w - r - - r - - 0644 clear.php server - : file | r w - r - - r - - 0644 codeSamples.txt jekftp - : file | r w - r - - r - - 0644 console.php jekftp - : file | r w - r w - r w - 0666 consoleTestGrid.txt server - : file | r w - r - - r - - 0644 consoleTestGridCopy.txt jekftp - : file | r w - r - - r - - 0644 console_help.php jekftp d : dir | r w x r - x r - x 0755 css server - : file | r w - r w - r w - 0666 customSelector.php jekftp - : file | r w - r - - r - - 0644 dirIndex.php jekftp - : file | r w - r - - r - - 0644 dirLstDev.php jekftp d : dir | r w x r w x r w x 0777 dist jekftp - : file | r w - r - - r - - 0644 editorComments.txt jekftp - : file | r w - r - - r - - 0644 file_browser.php jekftp - : file | r w - r - - r - - 0644 file_browserEXP.php jekftp - : file | r w - r - - r - - 0644 file_browser_old.php jekftp - : file | r w - r - - r - - 0644 file_editor.php jekftp - : file | r w - r - - r - - 0644 file_editor_help.php jekftp - : file | r w - r - - r - - 0644 getServerName.php jekftp - : file | r w - r - - r w - 0646 goForIt.txt ==================================================== directory listing USING THE SAME CODE with errors: (there were also php related errors appearing in with html above the doctype declaration about fileperms failing that I have supressed with @) Current Directory: dev_lab_current/lab_1 Owner type and permissions Octal value Name jekftp d : dir | r w x r w x r w x 0777 . jekftp d : dir | r w x r - x r - x 0755 .. _CONSOLE -> getWRXPerms error: conf_lab_1.php was not found, or is not a file or directory 0 conf_lab_1.php jekftp d : dir | r w x r - x r - x 0755 css jekftp d : dir | r w x r - x r - x 0755 img jekftp - : file | r w - r - - r - - 0644 index.php jekftp d : dir | r w x r - x r w x 0757 js _CONSOLE -> getWRXPerms error: lab_editor.php was not found, or is not a file or directory 0 lab_editor.php _CONSOLE -> getWRXPerms error: lab_interface.php was not found, or is not a file or directory 0 lab_interface.php _CONSOLE -> getWRXPerms error: lab_reader.php was not found, or is not a file or directory 0 lab_reader.php _CONSOLE -> getWRXPerms error: lab_sampler.php was not found, or is not a file or directory 0 lab_sampler.php jekftp d : dir | r w x r w x r w x 0777 php _CONSOLE -> getWRXPerms error: text was not found, or is not a file or directory 0 text
  12. Thankyou Moderator: I thought that null would remove the property because null is used to remove a select element option. So, it appears that it is not just a value here, at least. I am using O'Reilly's Javascript: the Definitive Guide, 6th ed for guidance where possible but it does not mention delete.
  13. I have this code: if(active[active.id].group.propertyIsEnumerable(selection)) { alert(selection) active[active.id].group[selection] = null; } That is looking for a particular property (selection) and is supposed to remove it from the object. In this case setting it to null, I thought, would remove the specific property so it would no longer be defined and therefore not be enumerable. But it does not seem to, as demonstrated by var test for(var x in active[active.id].group) { test += "n"+x; // new line in DOM browsers } alert(test) // The selection property continues to be listed. Am I doing something wrong, or is there another way to remove the property altogether? I have nit picked through the exact string construction for any differences and have not found any and, in fact the alert in the first code snip does show up, so I know that selection is a valid property. Thanks for time and attention
  14. Thanks for the cntrl-click suggestion, but trying it out, it turns out to be cmd-click on my system. JK
  15. This is something that I have not worked with in the past, though I have often worked with select/option elements in the past. When I set the type attribute to multiple, I have to shift/click to select more than one item. Then I cannot deselect just one item. Am I doing something wrong, or is this typical behavior. The initial development is being done in FIrefox in Mac OSX. I am developing an application where a user can select items from a different list. The select/option element is added to as the user selects items from the list. The select/option element is to allow the user to remove a selection from the list if he/she changes their mind about a selection and wants to remove it. So: the user selects from a group of items in other elements the item is added to a display of selected items It is also added to the select/option list for potential removal. Allowing multiple selections from this would allow the user to remove multiple selections. With XHTML transitional doctype: <select id="remove" name="remove" size="5" multiple="multiple"> <option id="default" value="">Remove:</option> <!-- options are added here by javascript as user makes selections elsewhere --> </select> It is much easier to add/remove options one at a time. I can remove options with an onchange event listener assigned to the select/option element. Thanks for time and attention; JK
×
×
  • Create New...