Posts

ruby on rails - what is the maximum amount of flags flag_shih_tzu can handle? -

i'm using "flag_shih_tzu" gem , want know maximum amount of flags can handle, or depend on int. length in flags column? need handle 64 flags. can it? i maintainer of flag_shih_tzu. best practice: each column used flags should have @ 16 flags set, performance reasons. find performance suffers columns holding more 16 flags. workaround: single table can have multiple flag columns. i create design follows: class foo ... has_flags 1 => :is_a1, # ... snip ... 16 => :is_a16, :column => 'flag_col_a' has_flags 1 => :is_b1, # ... snip ... 16 => :is_b16, :column => 'flag_col_b' has_flags 1 => :is_c1, # ... snip ... 16 => :is_c16, :column => 'flag_col_c' has_flags 1 => :is_d1, # ... snip ... 16 => :is_d16, :column => 'flag_col_d' end now...

Postgres array of JSON avoid casting -

issuing on postgressql 9.2 following: create table test (j json, ja json[]); insert test (j) values('{"name":"alex", "age":20}' ); -- works fine insert test (ja) values( array['{"name":"alex", "age":20}', '{"name":"peter", "age":24}'] ); -- returns error the first insert works fine. second insert returns error: column "ja" of type json[] expression of type text[] i can cast type prevent error: insert test(ja) values( cast (array['{"name":"alex", "age":20}', '{"name":"peter", "age":24}'] json[]) ); -- works fine my question if there way avoid casting? insert test(ja) values ('{"{\"name\":\"alex\", \"age\":20}", "{\"name\":\"peter\", \"age\":24}"}'); to avoid confuse escaping cast...

html - Send Form with email attached in PHP -

i have html form.i want send clients. what best ways send client via email client can download form i tried cread pdf , send pdf document can not create proper pdf html. so there other way out pdf? $pdf->writehtml($html, true, false, true, false, ''); $pdf->lastpage(); $sr = $filename . '.pdf'; $pdf->output('tmp_email/'.$sr, 'f'); note:my email function working good... my question type of document should created without pdf? can send html attached?how? swiftmailer option creating html emails: http://swiftmailer.org/ when generating pdfs html, might want take @ dompdf: https://github.com/dompdf/dompdf it supports images, external stylesheets , loads of other things: http://pxd.me/dompdf/www/examples.php

How to get 'milliseconds' as a part of time in perl? -

this question has answer here: get time in milliseconds without installing package? 1 answer i need time in format "20130808 12:12:12.123" i.e., "yyyymmdd hour:min:sec.msec" . i tried my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $year += 1900; $mon++; if ($mon<10){$mon="0$mon"} if ($mday<10){$mday="0$mday"} if ($hour<10){$hour="0$hour"} if ($min<10){$min="0$min"} if ($sec<10){$sec="0$sec"} doesn't provide `msec` part of time. how can ? here's complete script. proposed before, using time::hires::time microsecond support, , it's using posix::strftime easier formatting. unfortunately strftime cannot deal microseconds, has added manually. use time::hires qw(time); use posix qw(strftime); $t = time; $date = strftime ...

apache spark - java.lang.NoClassDefFoundError: scala/reflect/ClassManifest -

i getting error when trying run example on spark. can please let me know changes need pom.xml run programs spark. currently spark works scala 2.9.3. not work later versions of scala. saw error describe when tried run sparkpi example scala_home pointing 2.10.2 installation. when pointed scala_home @ 2.9.3 installation instead, things worked me. details here .

variables - Restrict Upload on FileSize for FCKeditor PHP -

hi add restriction on uploading image files, on 500kb fck editor. so in fck edior upload script there included require files: require('./config.php') ; require('./util.php') ; require('./io.php') ; require('./commands.php') ; require('./phpcompat.php') ; filesize calcualted in commands.php file , thought take variable (from within function (commands.php) , test see if breaks limit size) so still in upload.php, have snippet underneath require includes: $limit_size = 512000; if ( $globals['myfilesize'] >= $limit_size ) { senduploadresults( 1, '', '', ''. $globals['myfilesize'].'' ) ; } so here function within commands.php file: function getfoldersandfiles( $resourcetype, $currentfolder ) { global $ifilesize; // map virtual path local server path. $sserverdir = servermapfolder( $resourcetype, $currentfolder, 'getfoldersandfiles' ) ; // arrays hold fol...

php - Setting a button text dynamically in jquery -

i trying set text of button of dialog in jquery. have 2 variables value change dynamically. these values should set button text. have written following code. var monthnames = [ "january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december" ]; var today = new date(); var month = monthnames[today.getmonth()]; var nextmonth = monthnames[today.getmonth()+1]; $( ".selector" ).dialog({ buttons: [ { text: month, click: function() { $(this).dialog("close"); } }, { text: nextmonth, click: function() { $(this).dialog('close'); } } ] }); }); but form dialog not loading. pls me valuable suggestions. your code working fine, make sure have added jquery , jquery ui reference , have selector class in html mark...