Posts

perl - Email::MIME can't parse message from Gmail -

so i'm using perl , email::mime email gmail. here code: use net::imap::simple::gmail; use email::mime; # creat object read emails $server = 'imap.gmail.com'; $imap = net::imap::simple::gmail->new($server); # user , password $user = 'username@gmail.com'; $password = 'passowrd'; $imap->login($user => $password); # select inbox , returns number of messages $numberofmessages = $imap->select('inbox'); # let's go through messages top ($i = 1; $i <= $numberofmessages; $i++) { $top = $imap->top($i); print "top = $top\n"; $email = email::mime->new( join '', @{ $imap->top($i) } ); $body = $email->body_str; print "body = $body\n"; }#end when run it, following error: can't body string multipart/related; boundary="----=_part_6796768_17893472.1369009276778"; type="text/html" @ /library/perl/5.8.8/email/mime.pm line 341 email::mime::body_str...

css - How to select all classes inside a class with jQuery selector -

how go selecting classes in class using jquery selector? think $(".content .*").click(); work. in addition, on click of class in .content want store class name of clicked class in variable. here selector elements have @ least 1 class specified $('.content [class]') or here elements $('.content *') or better: $('.content').on('click', '*', function() { //handler here }); your second question doesn't make sense , needs rephrased

php - Form header:location sequence order -

hi i'm trying redirect next page after data sumbmitted mysql. have far <?php $name = ""; $email = ""; $msg_to_user = ""; if ($_post['name'] != "") { include_once "newsletter/connect_to_mysql.php"; // sure filter data deter sql injection, filter before querying database $name = $_post['name']; $email = $_post['email']; $sql = mysql_query("select * newsletter email='$email'"); $numrows = mysql_num_rows($sql); if (!$email) { $msg_to_user = '<br /><br /><span style="font color="ff0000">please type email address ' . $name . '.</span>'; } else if ($numrows > 0) { $msg_to_user = '<br /><br /><font color="ff0000">' . $email . ' in system.</font>'; } else { $sql_insert = mysql_query("insert newsletter (name, email, dat...

MYSQL PHP PDO order of statements in a transaction -

i using innodb in mysql , accessing table php pdo. i need lock table, select , then, depending on result of either insert row or not. since want have table locked short time possible, can this? prepare select prepare insert begin transaction lock table execute select if reservation time available execute insert unlock table commit or prepares have inside transaction? or have after lock? should transaction include insert, or make difference? begintransaction turns off autocommit mode, affects queries commit changes. means prepared statements, select , , lock tables not affected transactions @ all. in fact, if you're doing single insert there's no need use transaction; need use them if wanted multiple write queries atomically.

php - Creating dropdown list with data from sql and when post is called, keeping the tab selected -

ok, heres problem: i can create dropdown list, when try , set last used tab selected runs through while query , selects bottom option. heres code: <?php $sql="select id, description sites"; $result=mysql_query($sql); $options=""; while ($row=mysql_fetch_array($result)) { $id=$row["id"]; $thing=$row["description"]; $thing2 = $_post['thing']; $options.="<option value='if (isset($_post['thing'])){ echo $thing2; 'selected='selected''}else{ echo $id}'>".$thing; } ?> <form action="" method="post" /> <select name="thing" id="thing"> <option value=0>all <?=$options ?> </select> <input type="submit" name="submit" value="update"/> </form> how set selected tab 1 on after submit button c...

ios - Using UIControlEventTouchDragEnter to trigger a button's method... but doesn't work? -

i trying set button using uicontroleventtouchdragenter way trigger button's method. specifically, have button, , want button's method triggered if user presses finger outside of button, , drags finger bounds of button. according apple , event, uicontroleventtouchdragenter, is: event finger dragged bounds of control. however, can't button trigger. here code: - (ibaction)touchdragenter:(uibutton *)sender { _samlpe.image = [uiimage imagenamed:@"alternate_pic.png"]; } so, when touchinto button triggered, method change current image of _sample alternate image. if use touchupinside, image change alternate upon button click. does know why isn't working, or have work-arounds? thanks! the touchdragenter triggered when tap button, drag finger outside of bounds of button, , drag again bounds of button. you might want make use of touchesmoved method in view controller class , detect button entered based on location of touch: - (void)touche...

jdbc - How to get postgresql to work with sequel and jruby -

require 'sequel' require 'jdbc/postgres' db = sequel.connect("jdbc:postgresql://user:pass@domain/database") db.tables returns: ....(bla bla bla stack trace bla bla bla).... sequel::databaseconnectionerror: java::orgpostgresqlutil::psqlexception: connection attempt failed. ........... i have tried jdbc:postgresql://domain/database?user=name&pass=word and got error well, different one('password requested not provided') ruby 1.9.3 - jruby 1.7.3 i have looked , looked, tried many code samples, unable sequel working so, how sequel interface postgres while using jruby? sequel passes jdbc connection string directly jdbc, there nothing sequel-specific it. want jdbc:postgresql://domain/database?user=name&password=secret