Jump to content

cs.punk

Members
  • Posts

    437
  • Joined

  • Last visited

Posts posted by cs.punk

  1. Hi there. I'm trying to figure out a way to 'add' to a javascript function dynamically.

     

    Basically I'm using the JQuery library and within the $(document).ready() function I would like to add some 'code' that would change on each page generated via PHP. Basically it is just gonna be some variables that hold the 'original' values of some data. So because they can't be hard-coded, how could I 'add' them to the $(document).ready()? I could just run them as a normal script but I just thought I'd ask.

     

    Any ideas how I could go about this? Thank you!

  2. Hey guys.

     

    I have a site that has a bit of an audience now days, so usually when I've done some work on it, to 'update it' I'd just open filezilla, delete all files on the live server, reupload the new ones and fix any thing I've forget to change (database credentials etc).

     

    Although obviously it's not the most effective way to do it. Can anybody share how you go about it?

  3. Did you try using the GLOB_NOESCAPE flag? See the manual for glob

     

    That would disable a blackslash from quoting a metacharecter. Although '\\test' with the flag on would correctly look for a '\test' folder which goes against my logic?

  4. Hey guys. I'm trying to fix this small library's bug.

    It's having issues when there are special characters in the string name. I'm wondering perhaps if there's a function available to escape it all in one go?

     

    My actual question is concerning backslashes.

     

    Say we have

    $dir1 = "\\test\\";
    $dir2 = "{test";
    

     

    In the case that I'm actually looking for a folder with this name, what rules apply say with str replace? What would the search/replace string be for say $dir1, would they be the same by any chance, as the search has characters 'escaped' while the replace is inserting raw text?

    //Dir 1:
    Search:  \\\\t\\\\
    Replace \\\\t\\\\

  5. Hi! I was just sending this message to know: Do you have a specific software to write the scripts or do you use just notepad or something else?

    Thanks.

     

    Most people use an IDE (Integrated Development Enviroment, I think). Its has syntax highlighting and other such features to write more efficiently etc.

  6. I have a README file which does not have a file extension, I can open it with notepad but at the same time the layout is broken and it is just one on going text.

     

    How can one open it properly with the layout together?

     

    Try Notepad++, it might be that the file you are trying to open is using windows/unix style line endings.

     

    As for 'on going' text lol, click of format>word wrap (notepad in windows).

  7. To run hg you need to install mercurial. You should be able to download any of these projects a simple zip or tar file as well though. Generally, you would only clone a repo if you plan on actually contributing to the project.

     

    Is cloning the same as 'getting a local copy'? In which case should I rather be looking for a zip/tar file? Could you point me in the right direction?

     

  8. Woot I've got GIT running and reading tutorials..

     

    Anyway, I noticed the line "Clone this repository: hg clone https://bitbucket.org/hhatto/pgmagick".

    It appears hg is a command from the Mercurial repository system.

     

    However off wikipedia's page on bitbucket: Bitbucket is a web-based hosting service for projects that use either the Mercurial or Git revision control systems.

     

    Does this mean I need Mercurial is being used as the project's repository system, in which case I need Mercurial?

  9. The link given is pointing to bitbucket a mercurial-based code hosting provider, similar to github.  Mercurial is a revision control system (or software code management) tool, similar to git.  If no package such as an archive is provided you'll need the appropriate revision control software to copy/clone/export a local copy of the code. As with most software, reading the README file or related documentation will lead you as to how to install it.

     

    Is 'cloning' the same as 'getting a local copy'? It seems I need either Git or Mercurial right? :D

    How does this relate to 'package managers' that sort out dependencies on linux/unix systems?

  10. Does anyone have knowledge of pulling data from the view of an image?  What is a view of an image?

     

    For example, I have an image of a map that I'm putting on GoogleMapsApi. Instead of the user drawing a bunch of polygons, I'd like to be able to know where the lines in the image areWhat lines?, and i'd automatically trace the polygon. It'd be a simple black and white image [white background, a few black lines].

     

    Anyone know a solution or method for this?

     

    Thanks.

  11. Hey guys.

     

    What I am trying to do is have a page that updates the records every time period (15 seconds?).

     

    So it keeps a local 'array' and it downloads the updated 'record list' via ajax (will implement this later).

    It then checks which records are missing from local one and updates it if necessary.

     

    For now my question is should I be using objects/arrays to store the record list. If object, how do I sort the list?

     

    Thank you.

     

    <script type='text/javascript'>
    
    var users = {
    						1 : ["Jay", 11],
    						2 : ["Bob", 12],
    						3 : ["Chris", 18]
    					  };
    
    var jsonOb = {"users": {
    						3 : ["Chris", 18],
    						4 : ["Joe", 17],
    						5 : ["Jack", 16]
    					   }
    			 };
    
    for (var i in jsonOb.users)
    {
    	if (users[i] == null)
    	{
    		alert ('Added:' + i);
    		users[i] = jsonOb.users[i];
    	}
    }
    
    console.debug(users);
    </script>
    

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.