sketchucation logo sketchucation
    • Login
    1. Home
    2. chrisglasier
    3. Posts
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    Check out Febhouse | New extensions for Shadow Analysis in SketchUp Download
    chrisglasierC Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 103
    • Posts 1,032
    • Groups 2

    Posts

    Recent Best Controversial
    • RE: Modules - are they needed if ...

      @thomthom said:

      Javascript namespacing:
      http://www.dustindiaz.com/namespace-your-javascript/
      http://www.crockford.com/javascript/private.html

      Thanks for that TT - all good stuff which I have implemented in part - still really trying to get to grips with it though.

      But my current concern relates to this Diaz comment:

      @unknownuser said:

      ... avoid conflicts with external application code, playing nice with the "other JavaScript kids," ...

      I don't think relying on playing nice is realistic in a global environment but making sure same named objects and functions overwrite existing by loading or reloading immediately prior to use may be. I'm just not sure if there are other implications.

      Thanks

      posted in Developers' Forum
      chrisglasierC
      chrisglasier
    • RE: Modules - are they needed if ...

      Thanks Dan. Actually I have used modules as you describe in my rather puny attempts at making Rubies and I appreciate the refresher. But lately I have been considering JavaScript device plug-ins (could be for a web dialog) as I described in the first post. Conflicts (I think) are controlled by loading or reloading a required device so that its functions overwrite any previous with the same name.

      It seems to me that provided the core functions were prefixed with reserved characters (qxq) then external device makers did not need to worry about any other naming conventions and I need not worry about laying out no-fly zones and policing them (malicious code and spam is another topic). So if this is OK with JavaScript (and that is one question) I wondered whether it would be similar with Ruby (which you have answered). I do understand that in some other languages two functions/methods of the same name will not overwrite if the number of parameters are different.

      Thanks

      posted in Developers' Forum
      chrisglasierC
      chrisglasier
    • Modules - are they needed if ...

      ... you could load the script required for a task in hand so that it overwrote anything in memory that conflicted with it?

      I have been experimenting with this with Javascript and it seems to work provided the loading and call is a two step process to allow the script to load.

      For example I have a set of keys (one of which might be color), to which I have attached a function (say setColor) and the function simply has three color options. Selecting the key loads the script file containing the function, selecting a color option puts it to work. I feel I'm being far too simplistic about this but I cannot see yet what is wrong.

      I am looking for enlightenment!

      posted in Developers' Forum
      chrisglasierC
      chrisglasier
    • RE: Uploading JSON with js/php

      The answer from Stack Overflow is:

      <span class="syntaxhtml">d&nbsp;=&nbsp;<span class="syntaxdefault"><?php&nbsp;</span><span class="syntaxkeyword">echo&nbsp;</span><span class="syntaxdefault">json_encode</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">$target_path</span><span class="syntaxkeyword">);&nbsp;</span><span class="syntaxdefault">?></span>;</span>
      

      They pointed out this is only useful if you are working with localhost.

      posted in Developers' Forum
      chrisglasierC
      chrisglasier
    • RE: Uploading JSON with js/php

      @thomthom said:

      What does the alert say?
      What does the full path string look like?

      Sorry the attachment didn't get attached. Here it is ... off to bed


      upload.gif

      posted in Developers' Forum
      chrisglasierC
      chrisglasier
    • Uploading JSON with js/php

      I am trying to get the full path of an uploaded file. The php code is like this:

      <span class="syntaxhtml"><br /><br /><span class="syntaxdefault"><?php<br />  $destination_path </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> getcwd</span><span class="syntaxkeyword">()</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">.</span><span class="syntaxdefault"> DIRECTORY_SEPARATOR</span><span class="syntaxkeyword">;<br /><br /></span><span class="syntaxdefault"> $result </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> 0</span><span class="syntaxkeyword">;<br /></span><span class="syntaxdefault"> <br /> $target_path </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> $destination_path </span><span class="syntaxkeyword">.</span><span class="syntaxdefault"> basename</span><span class="syntaxkeyword">(</span><span class="syntaxdefault"> $_FILES</span><span class="syntaxkeyword">[</span><span class="syntaxstring">'thefile'</span><span class="syntaxkeyword">][</span><span class="syntaxstring">'name'</span><span class="syntaxkeyword">]);<br /></span><span class="syntaxdefault">   <br /> if</span><span class="syntaxkeyword">(@</span><span class="syntaxdefault">move_uploaded_file</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">$_FILES</span><span class="syntaxkeyword">[</span><span class="syntaxstring">'thefile'</span><span class="syntaxkeyword">][</span><span class="syntaxstring">'tmp_name'</span><span class="syntaxkeyword">],</span><span class="syntaxdefault"> $target_path</span><span class="syntaxkeyword">))</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">{<br /></span><span class="syntaxdefault">      $result </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> 1</span><span class="syntaxkeyword">;</span><span class="syntaxdefault"> <br />  </span><span class="syntaxkeyword">}<br /></span><span class="syntaxdefault">   <br /> ?><br /></span><script language="javascript" type="text/javascript"><br />    //d = '<span class="syntaxdefault"><?php echo basename</span><span class="syntaxkeyword">(</span><span class="syntaxdefault"> $_FILES</span><span class="syntaxkeyword">[</span><span class="syntaxstring">'thefile'</span><span class="syntaxkeyword">][</span><span class="syntaxstring">'name'</span><span class="syntaxkeyword">]);</span><span class="syntaxdefault"> ?></span>';<br />    d = '<span class="syntaxdefault"><?php echo $target_path</span><span class="syntaxkeyword">;</span><span class="syntaxdefault"> ?></span>';<br />    window.top.window.phpUpload(d);<br /></script>   <br /><br /></span>
      

      The rem'd out line gives me the filename OK, but the full path gives this alert in the js function - no slashes and the initial letter 'n' of the filename is missing ...

      posted in Developers' Forum
      chrisglasierC
      chrisglasier
    • HENJ

      http://www.designboom.com/weblog/cat/8/view/13358/ikea-stonehenge-infographic.html
      HENJ.gif

      posted in Corner Bar
      chrisglasierC
      chrisglasier
    • RE: [Solved] Uploading not obviously related to Sketchup

      Yes it works just fine.

      Soon people who visit my site will be able to make and save an "ownerfile". When they return they can upload the file to work with all the named links, keys, functions, value options and config settings previously set. This will also be extended to upload shared project or activity files (later including Sketchup of course).

      This is why the uploading business is so important in this context and why your pointer was much appreciated.

      Many thanks,

      Chris

      posted in Developers' Forum
      chrisglasierC
      chrisglasier
    • RE: [Solved] Uploading not obviously related to Sketchup

      First read through that seems perfect. I think I even understand it! Will try out tomorrow.

      Many thanks

      posted in Developers' Forum
      chrisglasierC
      chrisglasier
    • RE: [Solved] Uploading not obviously related to Sketchup

      @thomthom said:

      You could try to route the action to an hidden iframe. Similar to what this guy is doing: http://www.ajaxf1.com/tutorial/ajax-file-upload-tutorial.html

      Thanks I will have a go with that.

      Meanwhile I've uploaded the files to the site.

      posted in Developers' Forum
      chrisglasierC
      chrisglasier
    • RE: [Solved] Uploading not obviously related to Sketchup

      @thomthom said:

      ...

      Your PHP snipped needs to be the target of action. And that will cause the page to navigate.

      Perhaps I should open a popup window for all this but I would prefer not to if there is another solution. I am just finishing off a mock version for my site. If you have time later perhaps you would have a look, click on owner and get a better idea of what I am trying to achieve.

      Thanks.

      posted in Developers' Forum
      chrisglasierC
      chrisglasier
    • RE: [Solved] Uploading not obviously related to Sketchup

      @thomthom said:

      So it sounds like it's the JS wrapper that can't be the target for file POSTs. I'm completely unfamiliar with that wrapper so I can't help much there.

      Can you avoid the use of history.back[-1] ?

      That's what I want. Am I right that action = "xxx.php" has to open that file in the browser? I think this is what I don't understand. And I am quite happy to lose the js wrapper (I didn't know it was one!)

      Thanks ... again

      posted in Developers' Forum
      chrisglasierC
      chrisglasier
    • RE: [Solved] Uploading not obviously related to Sketchup

      Yes I can make it work with a php file. I used a history.back[-1] in an embedded js script. That was OK but then I could not call the js that parses the json file and either reports a failure or incorporates the new file contents.

      posted in Developers' Forum
      chrisglasierC
      chrisglasier
    • RE: [Solved] Uploading not obviously related to Sketchup

      @thomthom said:

      I'm not sure why you don't get an index for the uploaded file. By first glance it looks ok. This is why I wonder if it's your JS wrapper interfering. The wrapper is the first thing I noticed that deviate from the basic example in the PHP manual: http://www.php.net/manual/en/features.file-upload.post-method.php
      Are you sure the JS wrapper can be used as the target of POST commands? Not just regular POST, but also these file variants?

      I'd try to make a regular HTML form with action pointing directly to the PHP file.

      Sorry not to respond. I don't get notifications any more although I checked with Gaieus that all my settings are correct. But of course I appreciate your help and want to get this going asap.

      I am now reading the php manual. I was using some tutorials before. The thing about a direct link to a php file was that it is opened in the browser - that's the part I really don't get ... or want.

      Thanks

      posted in Developers' Forum
      chrisglasierC
      chrisglasier
    • RE: [Solved] Uploading not obviously related to Sketchup

      @thomthom said:

      Just a PHP notice - not a warning. You can adjust the PHP server to not output notices.

      (Btw, why are you using that JS wrapper for the file upload? Doesn't look to do much except to add a another layer - which also makes you reliant on client JS.)

      Thanks TT. I wrote this just before dinner and now it would be just after breakfast. So sorry for the apparent lack of response.

      Actually the alert says uploadedFile is an undefined index, so everything stops. The problem is I don't know how to define it. But anyway maybe I am doing it all wrongly.

      Here is the upload interface:upload.gif

      I want to parse the json file and then change the display depending on the result. If I use a file.php for the action it works OK but I get into all sorts of problems/ugliness with history.back. But this is the first time I have tried the uploading business so I would be very happy to be pointed in a different direction.

      Thanks.

      posted in Developers' Forum
      chrisglasierC
      chrisglasier
    • [Solved] Uploading not obviously related to Sketchup

      Here is a js function

       function phpOwnerFile(){
      	s = UP.Upload();
      	alert(s);
      }
      

      called from this action in this form:

      <form method="post" enctype="multipart/form-data" action="javascript&#058;phpOwnerFile();">
      	<input name="uploadedfile" type="file" ><br />
      	<input type="submit" value="Upload file" />
      </form>
      

      using this class

      class UP{
      	public function Upload() {
      		$target_path = "uploads/";
      		$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 
      		if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
      			$status = basename( $_FILES['uploadedfile']['name']);
      		} 		
      		else{
      			$status = 0;
      		}
      		return $status;
      	}
      }	
      

      in jAPI-remote,

      with the resulting message attached.

      If anyone is interested in getting to a solution I will appreciate any help.

      Thanks


      jAPI alert.gif

      posted in Developers' Forum
      chrisglasierC
      chrisglasier
    • RE: [Plugin]$ Keyframe Animation

      Sorry RP that was somewhat curt - I had to rush off to a Chinese New Year dinner. And selection is probably not quite the right word, but what I meant might be explained by comparing writing a cash cheque and using an ATM. Much of the non-creative processes are allocated to the machine (pressing buttons being creative!). But we cannot get a similar advantage with tasks that are too diverse to interest software companies, so the easiest option is to emulate paperwork. This is a terrible denial of the potential of a proper marriage of information and technology - which I think these animation plug-ins go some way to illustrate.

      posted in Plugins
      chrisglasierC
      chrisglasier
    • RE: [Plugin]$ Keyframe Animation

      @regular polygon said:

      @chrisglasier said:

      Totally misconstrued. Code-based approach is good for specific tasks that are commissioned by those that can afford them - e.g. banks, airlines and stock markets. Code-based approach is also good for paperwork type applications like Word and Excel that are essentially blank. What you and I have been doing with animation plugins is to mix code and information to offer something that can be manipulated by anyone ... and that points the way to escape the subliminal stranglehold of software "total solutions". Don't you think?

      I guess I am still not clear on the distinction. Why would Excel belong to the code-based camp? It is not limited to specific tasks; anyone can configure a spreadsheet to compute what they want. Is this basically a distinction between programs that rely on text-based input as opposed to applications that use a GUI? 😕

      Yes - more precisely selection.

      posted in Plugins
      chrisglasierC
      chrisglasier
    • RE: [Plugin]$ Keyframe Animation

      @regular polygon said:

      I am not in a plugin competition either.

      Well you are because it is commercial (which in itself is just fine).

      @unknownuser said:

      Am I overzealous about communicating this plugin’s functionality?

      You are not.

      @unknownuser said:

      I can see how a code-based approach would be useful in certain situations.

      Totally misconstrued. Code-based approach is good for specific tasks that are commissioned by those that can afford them - e.g. banks, airlines and stock markets. Code-based approach is also good for paperwork type applications like Word and Excel that are essentially blank. What you and I have been doing with animation plugins is to mix code and information to offer something that can be manipulated by anyone ... and that points the way to escape the subliminal stranglehold of software "total solutions". Don't you think?

      posted in Plugins
      chrisglasierC
      chrisglasier
    • RE: [Plugin]$ Keyframe Animation

      @regular polygon said:

      There is an interesting mannequin model, by Chris Glasier, posted on his [plug-in] Skel_animation topic.

      Actually, the model was made by ArqDirk not me - all I did was "straighten" one of his out to make it easier for testing. There are many in the warehouse by him and others.

      By the way, my purpose was not to create yet another animation plug-in but to expose the difference between a code-based set up as Matt used in his Automatic Sketchup and a more layman's wysiwyg approach that relies on specific information - in this case physical data (hidden in component definitions and transformations), functionality (e.g. lower limb always follows upper limb), and most importantly a specific set of recognisable names that are used for control and could be used to search for alternative parts of the same type.

      This integration of information could be referred to as Object Oriented Information Technology in that physical objects have classes and methods similarly to OOPS. With this a diverse range of non-creative tasks might be automated. This is my real interest so please be aware I'm not in the plug-in competition but otherwise would be very happy to collaborate in some way.

      And good luck with your plug-in.

      posted in Plugins
      chrisglasierC
      chrisglasier
    • 1
    • 2
    • 8
    • 9
    • 10
    • 11
    • 12
    • 51
    • 52
    • 10 / 52