Jump to content

emehrkay

Staff Alumni
  • Posts

    1,214
  • Joined

  • Last visited

Everything posted by emehrkay

  1. you need qoutes around html attributes value="<?php echo $val; ?>"
  2. I need a way to take html created with a wysiwyg editor and a few options (bkg image&color etc) and be able to print it as it was defined with the editor. All css stylings are lost when the user goes to print, so my solution would be to convert that html string into a GD image. I figure this shouldnt be too difficult as long as the style is inline with the html. I figured it would be useful for others so I would try to make it a generic lib. I just need some help identifying which gd functions would be needed to do what as I have never really used it before. Here is the process that I've thought out so far, tell me if I am missing anything and help me out in some areas [*]Define Defaults -- font, font size, font color, font bkg color, and image x y [*]Read and parse html string this step will read each html element removing the style attribute and using the applicable defintions to style the element. ie <span style="background-color: #red;">test</span> would create a red box with test as the text. If the element doesnt have one of the default settings, use the default that was defined before. The result would be an array with all of the elements' types and GD rules. array(array('type'=> 'text', 'value' => 'test' 'font_color' => '#red')) etc. [*]convert the findings on each element to the GD equivalent in this step I would have to make it follow html rules as much as possible, all block level elements are treated as such etc [*]save the image to disk (possible stream in the future) and discard the resource functions/methods that id need [*]imagettfbbox [*]imagefilledrectangle [*]imagecreatetruecolor [*]imagecolorallocate [*]gd one that loads existing images (I cannot identify this) [*]hex to rgb and back [*]add on... Any suggestions? Does this already exist? Am I in over my head? HELP! I'll make it a google code project once I get something going (well, if it proves to be of any use) Thanks
  3. 100% height only works on elements whose parent has a defined height. You are doing nested 100% height definitions. Id try to work around that.
  4. ids are supposed to be unique, it looks like you have 12 divs with the id of viewmore. change that to a class and change $('#viewmore').show(); to $('.viewmore').show(); and it will probably work
  5. http://us2.php.net/manual/en/function.fgetcsv.php not hard to figure out the loop from here
  6. Dude, think about this for a second. Every mouseover and leave, you are injecting code to start steaming a flash file. For this to work at all, you will need to leave your mouse over the element for awhile, long enough for the file to download
  7. i didnt test this, but somehting like this should be made a sticky window.onload = function(){ //collect your elements var div1 = document.getElementById('div_1_id'), div2 = document.getElementById('div_2_id'), select1 = document.getElementById('select_1'), select2 = document.getElementById('select_2'); //store your elements in an object for easy reference later var element_collection = { 1: div1, 2: div2 } //write simple show/hide function //same code as zanus' except the getElementBYId function isnt called twice each time it is run function showHideElement(show_element){ for(var i in element_collection){ var show = i == show_element ? 'block' : 'none'; element_collection[i].style.display = show; } return true; //hey } //add events to all of your elements. im doing this the old school way select1.onChange = function(){ var value = this.value; showHideElement(value); //ta-da very easy }; };
  8. I've had an iphone for a year now and early on i felt that if it had an extra row of keys for easy access to {} [] - <> ., i could write programs on it.
  9. I'm 28 and I have been [[re]in|un]stalling windows on various boxes since windows 95 -- I have a lot of history with that guy. It really took me getting a mac and using it for a few months to really consider saying "it just works." Of course it isnt perfect, but it is a breeze to use, and the fact that I have *nix under the hood makes for a good day. I'm excited about the OpenCl and grand central dispatch support (both open source), cool things are happening with that tech. http://www.engadget.com/2009/09/17/snow-leopards-grand-central-dispatch-and-opencl-boost-video-enc/ I am a bit biased though as this is my desk (minus the air) (taken with an iphone)
  10. Looking through some of my old threads. I actually used one for about four months earlier this year. Great machine, very very light. When I first got it, I would think that I left it places because it felt like it wasnt in my bag. It did have a industrial design flaw though -- the screen's bevel sat flush on the keyboard area. this caused it to rub against the areas around the mouse button so it would leave markings on the palm rest ----[mouse button]---- --- == markings
  11. Chaining in mootools is easy when dealing with the Fx namespace. Most of the Fx classes fire with a start method, so say you're using Fx.morph you'd do instance.start({ 'height': 300px }).chain(function(){ //some other action }); But mootools is pretty extendible as you can add custom events. A lot of objects have an onComplete event, so when you initialize the object, you define it var x = new Fx.morph(element, { onComplete: function(){ alert('done') }, onStart: function(){ alert('starting') } }); In regards to pure OO MooTools is vastly superior to jQuery. Like the article says -- MooTools does everything jQuery does, but jQuery cannot do everything MooTool does. There are a lot of things that I do not like about jQuery. Why are methods like css() both getters and setters? The common way to code jQuery is to keep running selector after selector instead of creating a reference and using that. My advice is to learn MooTools, jQuery is simple after that
  12. I prefer MooTools (check http://jqueryvsmootools.com/ for a comprehensive comparison). To me it comes down to the building and reuse of js objects The code that you originally posted prototypes (adds) an invoke method to the Array object -- all arrays have a .invoke() method attached
  13. You can actually do some pretty cool stuff with it. if you wanted the function to execute before the first interval call and still have a reference to it that you can pass around, do this (var y = function(){ console.log('xxx'); })(); setInterval(y, 1000);
  14. Actually quotes in this situation shouldnt be used. function x(){ console.log('xxx'); } setInterval(x, 1000);
  15. you are looking for setInterval() not timeout and you do not need it inside of the function itself function x(){} setInterval("x()", 1000); should do it
  16. As the code below works without alerting out array methods: <html> <head> <title>Blah</title> <script type="text/javascript"> window.onload = function(){ var oArray = new Array(); oArray["_KEN"] = "Enter"; oArray["_K03"] = "Exit"; oArray["_KHL"] = "Help"; for (var key in oArray){ alert("Key value is: " + key + " Value is: " + oArray[key]); } } </script> </head> <body></body> </html> Did you try this code in ALL browsers?
  17. Nightslyr - http://andrewdupont.net/2006/05/18/javascript-associative-arrays-considered-harmful/ Also, for in loop will loop over the Array Object's methods as well, avoid it for arrays geudrik - your php function makes no sense to me. When you call the function, the ids array is set to an empty array. are the arguments id and name arrays? You can easily add to a javascript array using the push() method arr.push(value) What you want to do would work better with an object literal, like I said above. var obj = {}; obj[id] = name; //use for in on the obj for(id in obj){ //id is your id //obj[id] is your name }
  18. Dont use JavaScript arrays if you're going to have a key that isnt an integer. Use an object. var obj_arry = {}; //or new Object(); //add to object is simple obj_arry[key] = value;
  19. Why is this thread so long?
  20. I'm pretty sure it is [a-zA-Z0-9:_] Or even \w:_
  21. Start here http://us2.php.net/manual/en/function.sprintf.php
  22. i guess firephp (http://www.firephp.org/) would do what im asking for With the current apps that I run, I have to set breakpoints, step through code etc. I guess implicitly showing things in firebug would be a bit easier. If I werent so lazy, I'd create something that does what I am asking for
  23. Is there any software that will allow me to view the status of my script while running or after it has run. Right now I just want to see the SESSION variables without having to implicity showing them in the browser. I use xDebug to see errors when they exist and I have it set to show POST/GET, function variable states, etc. I also use macGDBP to step through the code and I also use macCallGrind for profiling. I guess what I am asking for is sort of a live stack [back]trace -- if that exists.
×
×
  • 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.