Skip to main content

Posts

Some Image Editing examples needed [closed]

I am looking for some code which manipulates images of arbitrary facial images. It should recognize the locations of the left and right eye, mouth, and cheeks to apply the effects properly. If possible editing the image such that it looks like "damage" is done to the face each time the application is run on the image. example: -Give black eye to left eye -Give black eye to right eye -Bloody mouth/lip -Bruises on cheek/face Each effect should be singular, and additional effects are added when the application is run again on the image. The application needs to run on linux and can be command line. I will be implementing the application using a php script. I know there are plenty of guys out there already done these kind of projects, so please help me out. Thanks in advance...

Shopify API - add to basket

I'm thinking of using Shopify to manage my shop. I need to add the products to the website with the API. http://api.shopify.com/ I can get the products and stocks with this API call : http://api.shopify.com/product.html#index But, then I would like to 'Add to basket' - I cannot see from the API docs how to do this. Once added to the basket - I'd like to get the basket contents so I can display something like... "2 items : £130 - checkout" I don't need a detailed answer - just point me in the right direction - thanks.

How to spot all $tickers in string?

Consider the following string: $MRK - Merck - ($AAPL, $MSFT, $F) having day $AA! like $P and me :) Although it's jibberish, it shows my problem. I want to scan for all words starting with a dollar-sign ($) and check them against a pre-defined list of tickers. If there's a match, replace them with a label ({TICKER}), as follows: {TICKER} - Merck - ({TICKER}, {TICKER},{TICKER}) having a day {TICKER}! like {TICKER} an me :) I now use this function: function _process_tickers($string) { $result = db_query("SELECT symbol FROM us_stocks"); while ($row = db_fetch_object($result)) { $tickers[] = ' $' . $row->symbol . ' '; } return str_replace($tickers, ' {TICKER} ', $tweet); } Problem: this only catches tickers that are surrounded by spaces (this $AA is surrounded by spaces) but not other situations like (this ticker has only a space in in front $AA) or (this one is surrounded by commas: my,$AA, ticker). But also two tickers right

Does using method chaining in PHP cause any problems with resources or memory?

I'm talking about methods like this: $object->method()->method1('param')->method2('param'); Those are created by returning the object in the function. return $this; I've seen third-party software use that method, but I'm wondering, wouldn't that cause a bit of a problem with the resources or memory because you're continuously returning the entire object?

PostGIS function to connect geometry LINE together?

(note: the_geom is a geometry value (TYPE: LINESTRING), in this case i random them for readability) gid | kstart | kend | ctrl_sec_no | the_geom | the_sum_geom 626 | 238 | 239 | 120802 | 123456 | NULL 638 | 249 | 250 | 120802 | 234567 | NULL 4037| 239 | 249 | 120802 | 345678 | NULL [Real Practice Description] just skip this for those who don't mind the purpose I would like to do 'this' (a set of queries from my past question, link located on the end of this post) for every row in Table B (aka. land_inventory). These two tables are related by 'ctrl_sec_no' (aka. control section number of a road) which means :: in ONE ctrl_sec_no -- 120802 (in fact, it is a road which is equivalent to 3 geometry LINESTRINGs (the_geom) connected together, from kstart 238 (start at kilometre of 238) to kend 250) [PostGIS question] the question is how to connect this 3 lines {aka gid(626,638,4037) from the table} together a

Database error after moving website?

I just moved my website from a test domain to the actual domain and I changed the DB info in the PHP script, but I'm still getting an error even though I triple-checked that I have the correct database, host, username and password. Am I missing something? This is the code I use to connect. The database info is definitely correct. $dbhost = "localhost"; $dbuser = "username"; $dbpass = "password"; function dbConnect($db='dbname') { global $dbhost, $dbuser, $dbpass; $dbcnx = @mysql_connect($dbhost, $dbuser, $dbpass) or die('Database problem.'); if ($db!='' and !@mysql_select_db($db)) die('Database not available at the moment. Please try again in a couple of minutes.'); return $dbcnx; } And then I call the function dbConnect('dbname') from the script. The error I get is the second error from the code above, "Database not available at the moment. Please try again in a couple o