Jump to content

dsp77

Members
  • Posts

    143
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

dsp77's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Hello, I have this piece of code that works as intended: $chars = array('1','2','3'); $cnt = count($chars); $strings = array(); for ($f = 0; $f < $cnt; $f++) { for ($s = 0; $s < $cnt; $s++) { for ($t= 0; $t < $cnt; $t++) { $strings[] = $chars[$f] . $chars[$s] . $chars[$t]; } } } print_r($strings); The problem i'm facing is that i want to transform it in a function where i pass the chars and the nr of elements in the permutation in the above code if i want more elements ill duplicate the for loop and so on. For example i'm trying to create a function like: function perm($chars,$nrElements){ } thank you in advance
  2. i swear i did that at one point, but thank you!!! now i got it
  3. I took in consideration that some ppl might find the stripes buggy and i noted to add a JS bg changer with different circles, squares animals:) etc
  4. thank you Adam, I made a few changes in moving the api key and the url into the class but i cannot make the __construct i looked over the manual but i cannot make it work still need 2 understand more about class logic. <?php class shortenGoogle { public $google_api_key = 'sadasdfasfasfds'; const GOOGLE_ENDPOINT = 'https://www.googleapis.com/urlshortener/v1'; function shortenUrl($longUrl){ // initialize the cURL connection $ch = curl_init(self::GOOGLE_ENDPOINT.'/url?key='.$this->google_api_key); // tell cURL to return the data rather than outputting it curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // create the data to be encoded into JSON $requestData = array( 'longUrl' => $longUrl ); // change the request type to POST curl_setopt($ch, CURLOPT_POST, true); // set the form content type for JSON data curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json')); // set the post body to encoded JSON data curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($requestData)); // perform the request $result = curl_exec($ch); curl_close($ch); // decode and return the JSON response return json_decode($result, true); } function expandUrl($shortUrl){ // initialize the cURL connection $ch = curl_init(self::GOOGLE_ENDPOINT.'/url?key='.$this->google_api_key.'&shortUrl='.$shortUrl.''); // tell cURL to return the data rather than outputting it curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // tell cURL to ignore the SSL certificate in case it expires curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // perform the request $result = curl_exec($ch); curl_close($ch); // decode and return the JSON response return json_decode($result, true); } } $short = new shortenGoogle; $url = $short->shortenUrl('http://www.google.com/'); $url2 = $short->expandUrl('http://goo.gl/fbsS'); print_r($url); print_r($url2); ?>
  5. with time i will add the free themes to, now i'm still working to retrieve templates automatically with all descriptions.
  6. I created a functional class that shortens or expands the URL using google's shortening service. The class works but i feel like i can optimize it more but i don't know really how because i'm new in using classes. here is the code define('GOOGLE_API_KEY', 'khjdaskjfsjkdhgfbsdhgsj'); define('GOOGLE_ENDPOINT', 'https://www.googleapis.com/urlshortener/v1'); class shortenGoogle { function shortenUrl($longUrl){ // initialize the cURL connection $ch = curl_init(sprintf('%s/url?key=%s', GOOGLE_ENDPOINT, GOOGLE_API_KEY)); // tell cURL to return the data rather than outputting it curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // create the data to be encoded into JSON $requestData = array( 'longUrl' => $longUrl ); // change the request type to POST curl_setopt($ch, CURLOPT_POST, true); // set the form content type for JSON data curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json')); // set the post body to encoded JSON data curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($requestData)); // perform the request $result = curl_exec($ch); curl_close($ch); // decode and return the JSON response return json_decode($result, true); } function expandUrl($shortUrl){ // initialize the cURL connection $ch = curl_init(sprintf('%s/url?key=%s&shortUrl='.$shortUrl.'', GOOGLE_ENDPOINT, GOOGLE_API_KEY)); // tell cURL to return the data rather than outputting it curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // tell cURL to ignore the SSL certificate in case it expires curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // perform the request $result = curl_exec($ch); curl_close($ch); // decode and return the JSON response return json_decode($result, true); } } $short = new shortenGoogle; $url = $short->shortenUrl('http://www.google.com/'); print_r($url);
  7. Hello, I have a beta site with wordpress themes from other sites, i'm still working on it. http://www.wp-skin.com/ The hover is horrible i know ill try my best, the usage is intended until final touch. Thanks
  8. that's funny, so easy that i didn't think about it. Thanks Man
  9. i managed to do a code for all pictures but i still cannot make them disappear after clicking other picture $('#echipa_left a').click(function (e) { e.preventDefault(); $('#echipa_' + this.id).css('display','block'); });
  10. hello, i have a gallery that shows the hidden div after click, the problem is that i have around 20 pictures and i'm not able to hide the selected picture after the user selects other and so on. here is the piece of the code: $('.id2').one("click",function() { $('#test').css('display','block'); }); $('.id3').one("click",function() { $('#test3').css('display','block'); }); and the html <div id="big_photo"> <div id="test" style="display:none;"> <img src="images/team/team1.jpg" rel="images/team/team11.jpg" /> <p>Name</p> <span>title</span> </div> <div id="test3" style="display:none;"> <img src="images/team/team2.jpg" rel="images/echipa/team22.jpg" /> <p>Name2</p> <span>title2</span> </div> </div> and so on.
  11. i made a tweak on the object element and it works, the problem now is how to make the pointer to show that there is a link there. I made in flash a hand cursor but it persists after i move the mouse out of the flash. i uploaded the fla file. [attachment deleted by admin]
  12. if you look at the code i'm using "wmode='transparent'"
  13. the java script searches for the first a href in #letter and shows a hidden div, the problem is that flash cannot launch this call and i want the href to be on top of the flash, i tried with z-index but no luck.
  14. i'm trying to place the href over the object because i need to call a javascript event. the html works in firefox but not in others #letter { position:relative; top: -15px; left: 0px; width:250px; height:175px; float:left; } #letter a { width:250px; height:175px; display:block; cursor:pointer; } <div id="letter"><a href="#" title="click"> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="250" height="175" id="plic" align="middle"> <param name="movie" value="media/plic.swf" /> <param name="quality" value="high" /> <param name="bgcolor" value="#ffffff" /> <param name="play" value="true" /> <param name="loop" value="true" /> <param name="wmode" value="transparent" /> <param name="scale" value="showall" /> <param name="menu" value="true" /> <param name="devicefont" value="false" /> <param name="salign" value="" /> <param name="allowScriptAccess" value="sameDomain" /> <!--[if !IE]>--> <object type="application/x-shockwave-flash" data="media/plic.swf" width="250" height="175"> <param name="movie" value="plic.swf" /> <param name="quality" value="high" /> <param name="bgcolor" value="#ffffff" /> <param name="play" value="true" /> <param name="loop" value="true" /> <param name="wmode" value="transparent" /> <param name="scale" value="showall" /> <param name="menu" value="true" /> <param name="devicefont" value="false" /> <param name="salign" value="" /> <param name="allowScriptAccess" value="sameDomain" /> <!--<![endif]--> <a href="http://www.adobe.com/go/getflash"> <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /> </a> <!--[if !IE]>--> </object> <!--<![endif]--> </object> </a> </div> any advise?
  15. i made an animated gif but it sucks and its not transparent on the edges. [attachment deleted by admin]
×
×
  • 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.