Posts

Showing posts from April, 2014

C# class instantiation const string -

i've read const string objects stored value , have value assigned @ compile time. mean memory allocated if encapsulating class not instantiated i.e. can waste heap space if const keyword on used (too many const strings)? edit: context... i require lot of constant value string objects, definately used , others used depending on user's interaction (i.e. specific use cases only). 1st set of string know used have declared in static class const objects. remaining strings, should declared const or use unnecessary heap space if specific use cases never triggered? if strings static properties of class allocated if not no allocated until instanciated string interning proccess thast used improve memory , heap usage , allow more efficient string comparison http://en.wikipedia.org/wiki/string_interning http://broadcast.oreilly.com/2010/08/understanding-c-stringintern-m.html

java - State of HttpSession instance after timeout? -

what makes httpsession instance expire after time-out when checked if(session!=null){ system.out.println("the instance not null"); }else{ system.out.println("the instance null"); } each time if-block executed. for expiring session, use session.invalidate() . ensure session expired. even if session invalidated, doesn't mean null

asp.net - DataRepeater becomes empty -

i'm using datarepeater control in vb.net application can make custom-made list control. i know it's main functionality work datasets , stuff, don't want transfer stuff database because in program's context doesn't make sense. so goal here use datarepeater list contents of mail inbox. everything works fine until scroll down control. scroll down/up see every item (in case, every listed e-mail), contents disappear , can see bunch of lines controls' default values assigned - "label1" , on. this how i'm filling datarepeater (abreviated): each m message in mail.inbox dr.addnew() dr.currentitem .controls("lblfrom") = m.from .controls("lblsubject") = m.subject end next as said, datarepeater shows perfect until scroll up/down, , when data disappears remaining items controls' default (design-time) values. am missing here? or not possible work datarepea

MySQL: Possible to apply the OR operator across multiple selected rows? -

i have 3 mysql tables: users , roles , positions . the users table pretty self-explanatory. roles table list of job titles person might hold, such janitor , president , manager , etc. roles table has long array of boolean permissions, such access_basement or user_directory_access . if role has has bit value set false (or "0") role lacks permission. where gets tricky user might have multiple roles, hence why connected positions table, pairing of userid , roleid fields. if perform query like: select * users left join positions on users.userid=positions.userid left join roles on roles.roleid=positions.roleid users.userid=123 i might results like: +---------+-----------+-----------------+-----------------------+ | name | title | basement_access | user_directory_access | +---------+-----------+-----------------+-----------------------+ | bob | janitor | true | false | +---------+-----------+---------------

cassandra c# driver memory leak -

using cassandra .net driver facing following issue: when inserting lot of rows parameterized inserts, application memory usage continuously grows: class program { static cluster cluster = cluster.builder() .addcontactpoints(configurationmanager.appsettings["address"]) .build(); static session session = cluster .connect(configurationmanager.appsettings["keyspace"]); static int counter = 0; static void main(string[] args) { (int = 0; < 50; i++) { new thread(() => { while (true) { new person() { name = interlocked.increment(ref counter).tostring(), id = guid.newguid(), data = new byte[4096], }.save(session); } }).start(); } console.readline(); } } class person {

python - How do I report the currently logged in user to Sentry? -

i'm using sentry (raven 3.4.1) on user-facing python/pyramid webapp. sentry seems have ability track , how many users experienced exception. (see example sentry 6.2.0 changelog , mentions: "streams have recorded user data show number of unique users event has happened to.") how supply information raven, shows in sentry? can if pass exception raven manually? right now, i'm using sentryhandler logging handler, attached root logger, , egg:raven#raven filter in pastedeploy pipeline. (following official raven configuration docs pyramid closely.) is there trick pass information raven? can maybe set local variable name somewhere @ bottom of stack, have loaded user's session, , raven pick automatically? what's best practice here? i suspect this has i'm trying do, can't find in raven docs. the way found overwrite internal methods of raven. the basic idea want modify handle_exception() method on sentry class of raven. there, can inject

certificate - Puppet master does not receive cert request from client -

netstat shows puppet master listening on port 8140 the client configured shown here: # /etc/hosts file: 192.xx.xx.xx bt-ppt-client 192.yy.yy.yy bt-ppt-master # /etc/puppet/puppet.conf (agent section) server = puppet report = true pluginsync = true # set puppet agent run on boot: chkconfig puppet on puppet agent --daemonize this done root user. run 'puppet cert list' on puppet master , not find cert requests. without more information, answer can't conclusive. believe problem line : server = puppet how client know puppet ? /etc/hosts shows master hostname bt-ppt-master . either change hostname of puppet-master machine puppet.org.name or alias bt-puppet-master puppet. line in /etc/hosts may this 192.yy.yy.yy bt-ppt-master puppet

html - Text all on one line causes problems with table-cell -

the text on 1 line causes several errors, not considered width of table, , of cell (#tablecell-b, 70px) overflow: hidden . jsfiddle: http://jsfiddle.net/8pxjd/ the algorithms table layout , width calculations described in css specs quite complex – won’t work want to. but ins case, should fixable quite easy – adding table-layout:fixed table element, see jsfiddle .

c# - Refresh WPF usercontrol when navigated to it -

i'm new wpf , i'm making app gets data ms sql server, places table , allows modify it. i'm using m:ui template make app metro-styled. app structure: mainwindow.xaml , usercontrols placed itemsource="page" etc. navigation between usercontrols made links , linkgroups, generated upon mainwindow after successful login. what want launch method gets data sql every time go of usercontrols. data retrieved server sqldatareader , placed observablecollection (one usercontrol - 1 collection). @ moment method works fine when first go of usercontrols, because it's placed constructor of usercontrol class, , want changes in tables when other table edited. how can this? there event can raise or other way update table? since communicating or background tasks running server might take overhead , bit of memory wastage prefer u start using push notification :) here's link guide through push notification push notification overview raw notifications pleas

Placing a TextView below two ImageViews and in middle - Android -

please share code achieve layout of screen shown in below link. text should in center of 2 images , these components can dynamic. ( https://docs.google.com/file/d/0b9n2ihvep_qendfkawfhverqovk/edit?usp=sharing ) https://www.dropbox.com/s/2j4bpwdmv0wgesg/untitled%20diagram.png hope works <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" > <imageview android:id="@+id/imageview1" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" />

ASP.NET control rendering HTML attributes -

i have custom control in asp.net web forms project inherits system.web.ui.control . i want add attributes in markup not correspond properties of control e.g. <mycontrols:hyperlink runat=server custom-client-side-attr="1"></<mycontrols:hyperlink> the problem having exception type 'mycontrols.hyperlink' not have public property named 'custom-client-side-attr'. i have tried persistchildren(false) , not fix it. has been while since have been in depths of asp.net web forms , cannot remember how done. you have add in server-code: hl1.attributes["custom-client-side-attr"] = "1"; you can still in markup - you'd have prior the declaration: <% hl1.attributes["custom-client-side-attr"] = "1"; %> <mycontrols:hyperlink id="hl1" runat=server custom-client-side-attr="1"></<mycontrols:hyperlink>

Java socket polling for checking if client is available -

i trying poll socket on server side check if client still available. checked few threads here nothing seems work. as found out there no direct way of checking tried perform write opperation socket and... java writing socket (when client disconnected) , no exception ioexception expected. i set thread supposed perform polling sending packet each second. while sending disconnected client after minute response "operation timed out". i tried mess around socket setsotimeout doens't work expected either. anyone has suggestions how make work? thank in advance. best regards, tom why not receive call , catch exceptions. if broken pipe exception or socket timeout, know client no longer present. for such cases, typical approach server set tcp keepalive using setkeepalive , getkeepalive methods. http://docs.oracle.com/javase/6/docs/api/java/net/socket.html . if client goes away, tcp keepalive kick in (becuase of inactivity) , detect client disconnected. the

xml - A module I uploaded block is displaying before the catalog category block. How do I change it? -

i downloaded module display pictures on category page. category pages displaying breadcrumbs, title, , static block within referenced content under category default. want change positioning images displaying below within content reference. how change position , why module content being pulled first? the before , after attributes work in 1 of 2 cases when insert core/text_list block like template block calls getchildhtml without paramaters for example <reference name="root"> <block type="core/template" name="example_block" after="content" template="page/html/example-block.phtml"/> </reference>

perl - How to change name of relationships created by dbicdump -

i have couple of tables like: user user_address -> fk users and i'm generating dbic schema using dbicdump. creates following relationship in user.pm: __package__->has_many( "user_addresses", "world::dbic::result::useraddress", { "foreign.user_id" => "self.id" }, { cascade_copy => 0, cascade_delete => 0 }, ); is possible change name of relationship "addresses"? how? (i meant without changing code before # not modify or above!) if not, there way make alias relationship? have @ rel_name_map in dbix::class::schema::loader::base . should able when create schema: my %args = ( use_moose => 1, use_namespaces => 1, rel_name_map => { user_addresses => 'addresses' }, # more args here... ); make_schema_at( 'my::schema', \%args, [ $connect_arg ... ] ); the rel_name_map important one, i've added few more lines context.

Remove object name from output header entry with bash and/or sed -

i have output file looks this: aaa1:var1 aaa1:var2 bbb2:var3 ccc3:var4 ... i need find way find prior colon each entry in header row. example: var1 var2 var3 var4 ... i want remove objx: each header entry, object names aren't uniformly named (nor variable names) can rip out "obj*:" or similar. the thing separated spaces (not including leading space first entry) , object separated variable colon. thanks. read -a headers < file echo "${headers[@]/*:/}"

javascript - Trigger iframe hiding from within iframe -

i have small widget users can install on sites. need "close" (ie. hide iframe) when has performed action within widget. the big issue here domain widget installed on different domain of widget itself. ie. source of widget embed http://example.com/embed.js while may embedded on http://cnn.com i'm aware there cross-domain security issues prevent accessing parent doc window.parent.document . so, i'm asking clever workarounds make work. for it's worth, i'm dynamically creating iframe within embed.js code.

java - populating a spinner with unique strings -

im trying populate action bar spinner unique strings based on user input in dialog box, eg user enters string , if it's not in spinner, should add there. such implementation possible ? tried using arraylist class of course, duplicates there, should use hashset ? thanks // array of sample strings popluate dropdown list arraylist<string> categories = new arraylist<string>(); // create array adapter popluate dropdown list arrayadapter<string> adapter = new arrayadapter<string>( getbasecontext(), android.r.layout.simple_spinner_dropdown_item, categories); //thats alert dialog through user enters strings alertdialog.builder alert = new alertdialog.builder(this); alert.settitle("new category"); alert.setmessage("please enter new category "); // set edittext view user input final edittext input = new edittext(this); alert.setview(input); alert.setpositivebut

ios - Multiple lines of a label in a custom UITableviewCell -

i have searched around tip problem. cannot find solution this. i have made subclass of uitableviewcell (feedcell). 1 image , 2 labels. problem label need multiline not show multilines. i use autolayot. this app display users twitterfeed. my code: - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; feedcell *tweetcell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (tweetcell == nil) { tweetcell = [[feedcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; [tweetcell.tweettext setnumberoflines:0]; [tweetcell.tweettext setlinebreakmode:nslinebreakbywordwrapping]; [tweetcell.tweettext setfont:[self fontforcell] ]; } nsdictionary *tweet = _datasource[[indexpath row]]; nsstring *tweetstring = [tweet valueforkey:@"text"]; tweetcell.name.text =[tweet valueforkeypath:@"user.n

wpf - How to make a styled DataGridCheckBoxColumn to respect DataGrid.IsReadonly? -

i have datagrid.isreadonly bound property changes based on condition. datagrid contains datagridcheckbox column had style in order center vertically in cell. however, after applying style check box column not respect parent's isreadonly value. is, regardless of value checkbox can clicked on , changed. i've seen quite number of posts dealing similar situations not find reliable solution. could please let me know how style checkbox column respects parent griddata's isreadonly? theory behind appreciated. this how apply style: <style x:key="centerstylecb" targettype="{x:type checkbox}"> <setter property="horizontalalignment" value="center" /> <setter property="verticalalignment" value="center" /> </style> <datagridcheckboxcolumn ... elementstyle="{staticresource centerstylecb}" /> add following code style: <style.triggers> &

c - Using dup,pipe,fifo to communicate with the child process -

i trying sample program read data beginning of file 2 processes using fork(). when fork() called, kernel creates child process, , child process inherits properties of parent process. open files , file descriptors. aim read file beginning both child , parent. tried create separate descriptors using dup2(), not working. my second question is there way make child process continue processing task after completing initial task. (signal has send parent ask task? , parent communicating child through pipe or fifo) int main(int argc, char* argv[]){ int fd1,fd2; int fd; int read_bytes; pid_t pid; char* buff; buff = malloc(sizeof(buff)*5); if(argc < 2){ perror("\nargc: forgot ip file"); return 1; } fd = open(argv[1],o_rdonly); if(-1 == fd){ perror("\nfd: "); return 2; } pid = fork(); if(pid == -1){ perror("\n pid"); return 1; } else if(pid == 0){ // child dup2(fd1,fd); read

git add - Git adding "unchanged" files to the stage -

for project i'm working on, want use: git add . -a to add files stage. problem git thinks these files unchanged last commit, ignored. however, changed file, git still sees file unchanged. how can "forcefully" add single file repository? check .gitignore file there must pattern matching file excluding file being staged. or can use git add . -f forcely add these files.

Foundation 4 : render custom select returned with ajax call -

i'm struggling trying figure out how render custom form select in zurbs foundation 4, has been returned ajax call. @ moment i'm re-initialising plugin, know that's not right way: $(document).foundation('forms'); also - same question resetting select. there way of doing without hard code id of element object? $('form select').trigger('change', true); you can fire foundation('forms') function on parent container. example, have modal window contains form loaded via ajax. modal window has id="modal-region". custom fields in form do: $('#modal-region').foundation('forms');

math - Calculating if or not a 3D eyepoint is behind a 2D plane or upwards -

the setup draw xy-coordinate axes on piece of paper. write word on along x-axis, word's centerpoint @ origo (half on positive side of x/y, other half on negative side of x/y). now, if flip paper upside down you'll notice word mirrored in relation both x- , y-axis. if behind paper, it's mirrored in relation y-axis. if @ behind , upside down, it's mirrored in relation x-axis. ok, have points in 2d-plane ( vertices ) created in similar way @ origo , need apply same rule them. make things interesting: the 2d plane 3d, each point ( vertex ) being (x, y, 0). vertices positioned origo , normal pn (0,0,1). => correctly seen when looked @ point pn towards origo. the vertex-plane has it's own rotation matrix [rp] , position p (x,y,z) in 3d-world. rotation applied before positioning. the 3d world "right handed". viewer looking towards origo distance along positive z-axis world oriented rotation matrix [rw] . [rw] * (0,0,1) point directly viewer&#

Why is the css margin of inner element pushing down the outer element? -

i have following code. <!doctype html> <html> <head> <title>home</title> <meta name="viewport" content="width=device-width, maximum-scale=1.0,initial-scale=1.0, user-scalable=no" /> <style type="text/css"> #nav {display:block; width:100%; height:80px; text-align:center; background: -webkit-gradient(linear,left top, left bottom, from(#2b2b2b), to(#111)); background: -moz-linear-gradient(center top , #2b2b2b, #111) repeat scroll 0 0 transparent; filter: progid:dximagetransform.microsoft.gradient(startcolorstr='#2b2b2b', endcolorstr='#111111'); -ms-filter: progid:dximagetransform.microsoft.gradient(startcolorstr='#2b2b2b', endcolorstr='#111111'); } #nav li {display:inline-block; width:19%; height:100%;} #nav li.active {background-color:#333;} #nav {display:block; width:100%; height:100%; position:relative; background:blue

java - retrieve part of Linux directory path -

i getting value of linux environment variable in java code follows: string path = getenv("my_home") //my_home corresponds mydir/myproject/proj/landing_page/home i want write method returns absolute directory path- mydir/myproject/logs using my_home environment variable. can please suggest how can retrieve 'mydir/myproject/'part of path in my_home? maybe looking file 's getparentfile method: new file(getenv("my_home")).getparentfile().getabsolutepath()

javascript - jQuery parameter for a function -

this code using now: $(document).ready(function(){ $('#btn2').click(function(){ $('iframe').contents().find('body').css('background-image', 'url(http://mk7vrlist.altervista.org/backgrounds/1.png)'); $('iframe').contents().find('body').css('opacity', 1.0); }); }); and here's html: <select onchange="bg(this[this.selectedindex].value);"> <option value="0.png" id="btn1">1. default skin</option> <option value="1.png" id="btn2">2. mk7 collage</option> <option value="1.png" id="btn3">3. solid queen</option> </select> when click 2. mk7 collage , can see in jquery function, background of iframe changes. i have 3 option values , each 1 has different background , id. i'd change them everytime 'option value' clicked. it's like: $('#the_optionvalue_id').click(

android - Intents and their parameters -

it seems various tutorials ive seen people jump 1 activity calling intents activity working on. ex:intent(this, anotheractivity.class) sometimes see people using class going parameter ex: intent (android.content.blahblahblah) whats difference in functionality? second made default classes? help appreciated there 2 "types" of intents. 1 called , explicit intent in tell android specific class trying reach (i.e. myclass.class). other case uses android's filtering system give best "match" class targeting. when call new intent(string action) specifying action match intentfilter . if app shares intentfilter other app, dialog pop user can select app he/she wants use.

visual studio 2010 - Qt installation directory woes -

i want use qt in new project. installer target compiler (vs2010 64bit), not exist. i using windows 7 64-bit qt 5.1.1. a colleague of mine planning on using qt , has managed compile target compiler (which uses well). has built in directory, dira. graciously gives me copy of entire qt sdk build (binaries, examples, headers, , all), , copy dirb on machine. i need in dirb, because 3rd party libraries installed, , cmake scripts know how find them. added qt bin folder path. problems ensue. qt binaries reason have install path (in case build path) hard coded within them. though qt bin folder in path (so dlls found), qt's dll(s) looking in wrong place windows "plugin". looking in dira, not exist on machine. so found researching, using qt.conf file specifying install path root, supposed way go. add 1 qt bin dir, , qt binaries (assistant, qmake, etc) can run. but build 1 of examples. builds fine. run exe, qt dlls load, , crashes because can't find plugin directo

Quad-buffer OpenGL for 4.2 core-profile? -

i'm developing 3d stereoscopic opengl app windows 7 , nvidia quadro k5000 cards. rendering scene left , right-eye perspectives using gldrawbuffer(gl_back_left) , gldrawbuffer(gl_back_right) works fine, , 3d effect displayed nicely. while works, i'd use nvidia's nsight graphics local debugging. however, error "cannot enter frame debugging. nsight supports frame debugging ... opengl 4.2. reason: gldrawbuffer(bufs[i] = 0x00000402)" if calls gldrawbuffer removed, nsight local debugging works. going through opengl 4.2 spec , drawbuffer described in section 4.2.1 so, 2 questions: 1) there other way (besides drawbuffer) specify back_right or back_left buffers drawing quad-buffers? 2) nsight capable of doing frame-level debugging on quad-buffered stereoscopic setups? if so, how?

sockets - How to deal with getaddrinfo and thread-safety? -

i using getaddrinfo ipv6-related c-project. "man getaddrinfo" on computer (uname -a: 3.5.0-23) indicates "reentrant". guess not thread-safe. in scenarios thread-safety required, how handle it? checked unp seems no concrete answer provided. lot. getaddrinfo() indeed thread-safe. required rfc 3493 section 6.1 : functions getaddrinfo() , freeaddrinfo() must thread-safe. on platforms, gethostbyname() thread-safe, on others nt. gethostbyname() not on platforms reentrant. if call gethostbyname() , call gethostbyname() again in same thread, data first call overwritten data second call. because gethostbyname() uses static buffer internally, why have copy data before calling gethostbyname() again. getaddrinfo() not suffer problem, allocates new addrinfo struct every time called.

java - What's the appropriate listener for JComboBox for updating itself? -

i have jcombobox it's items updating other parts of program every second. need listener when user tried type there or tried select item jcombobox updates it's content , show new items added. used actionperformed bringing new items user can not select used itemstatechanged program crashed , had close netbeans! answer: jcombobox on jpanel. best way figure out add listener on jpanel element on jpanel jcombobox clicked update combobox. my jcombobox on jpanel. best way figure out add listener on jpanel element on jpanel jcombobox clicked update combobox. events effecting contents of combo box generated model . try attaching listdatalistener model itself. if worried being notified when/if model changes, need attach propertychangelistener jcombobox , monitor model property , update data listeners accordingly...

object - Javascript memory management (requestAnimationFrame callback) -

i trying make blatant rip off of asteroids, i'm running serious memory management problem. i'm using window.requestanimationframe serve frames game having "gameloop" function call requestanimationframe argument. however, must doing wrong because memory usage of game massive results in frequent garbage collection , poor performance (and typical saw-toothed memory usage pattern associated it). i'm pretty sure reason problem many function objects being created loop of function , callback - innocuous statement results in function being created instead of being reused... gameloop function... i got idea post: https://www.scirra.com/blog/76/how-to-write-low-garbage-real-time-javascript here's jsfiddle code on it: http://jsfiddle.net/lequr/ (hit space window in focus make new asteroids appear). know of stuff camel case , done underscores - sorry. here's (i think) relevant part of code: var gameloop = function () { getsetstagesize(1, 1); ctx.

r - Using system with windows -

i have following string i'm trying pass system on win 7 machine. should creating .git directory in repo using system not (though similar approach work on linux box windows specific problem). system( "cd c:/users/trinker/desktop/foo2 && \"c:\\program files (x86)\\git\\bin\\git.exe\" init" ) c:/users/trinker/desktop/foo2 location of repo. c:\\program files (x86)\\git\\bin\\git.exe location of git on system. when run above nothing happens. no message, nadda. run cat on string , paste directly command line runs, gives following message , creates .git in appropriate place. so running... cat("cd c:/users/trinker/desktop/foo2 && \"c:\\program files (x86)\\git\\bin\\git.exe\" init") pasting command line... cd c:/users/trinker/desktop/foo2 && "c:\program files (x86)\git\bin\git.exe" init gives... initialized empty git repository in c:/users/trinker/desktop/foo2/.git/ ...which good s

jquery - Problems with dynamic select boxes -

my application has table 1 row , "add" button add more lines using jquery's clone method. each of these lines has 2 select boxes filled dynamically using jquery. the ids of select boxes dinamically generated (mark1, mark2, mark3, ...) , (model1, model2, model3, ...). i use loop fill select boxes not working. here code: for(count=1; count<=numrows; count++) { $('#mark'+count).change(function(){ $('#model'+count).load('findmodel.php?mark='+$('#mark'+count).val()); }); } is possible jquery? thanks, marcelo. hi simdrouin, i'm using script (countrows.php) receive number of rows , pass again main script. $.ajax({ url: 'countrows.php', type: 'post', data: { data : window.numrows }, success: function (data) { $('#mark'+data).change(function(){ $('#model'+data).load('findmodel.php?mark='+$('#mark'+data).val()+'&numrows

google spreadsheet setvalues overwrites all values -

i have values so a b c i want setvalues() on range with d e f result d e f pretty simple. except if e blank? d f i want keep old value if blank so d b f if setvalues() on range, not keep there blank. there way without looping through whole range , set each 1 individually if statement? you dont neex enhancement request. read original data, merge in-memory new array , single setvalues. cheers.

Kineticjs group begins to drag when its resized to minimum size -

i have kineticjs canvas 1 layer on it. layer has group. group has 4 anchors , image. used code resizing tutorial ( http://www.html5canvastutorials.com/labs/html5-canvas-drag-and-drop-resize-and-invert-images/ ) modifications. wanted enforce minimun size (50 x 50px). when user drags 1 of resizing anchors (topleft or bottomright), once reaches minimum size, whole group begins drag. happens topleft anchor. bottomright behaves expected (when reaches minimum size, stops , group doesn't drag). appreciated. thanks. here code using: the selector calls resizingmodeon() $('.someselector').on('click', function() { // created layer, created image... // add new layer stage, // add group layer, // add large image group group.add(image); newlayer.add(group); stage.add(newlayer); addanchor(group, 0, 0, 'topleft'); addanchor(group,

playframework - Play Framework 2.1.3 Not Serving GZIP Assets -

i'm using play framework 2.1.3 site , i've noticed built-in web server (netty) not serving gzipped assets, though play documentation says should automatically whenever same-name asset .gz prefix present in public folder. i have tried gzipping assets manually (e.g. bootstrap.min.js -> bootstrap.min.js.gz) , framework not serve .gz version of file through assets controller. have tried using following (hackish) code in build.scala implement automatic gzipping still doesn't appear work @ (and can't determine gzip files located, either, though log says assets in fact gzipped): val gzippableassets = settingkey[pathfinder]("gzippable-assets", "defines files gzip") val gzipassets = taskkey[seq[file]]("gzip-assets", "gzip assets") lazy val gzipassetssetting = gzipassets <<= gzipassetstask dependson (copyresources in compile) lazy val gzipassetstask = (gzippableassets, streams) map { case (finder: pathfinder

java - UTC Timestamp + Joda Time -

i trying utc timestamp in simple java program using joda: public timestamp getcurrentutc(localdatetime date, datetimezone srctz, datetimezone dsttz, locale l) { datetime srcdatetime = date.todatetime(srctz); datetime dstdatetime = srcdatetime.todatetime(dsttz); system.out.println("utc time:" + dstdatetime.getmillis()); system.out.println("utc time:" + new timestamp(dstdatetime.getmillis())); return new timestamp(dstdatetime.getmillis()); } the output of program follows: utc time:1378265162047 utc time:2013-09-03 23:26:02.047 the millisecond value correct utc time (i.e. confirmed gmt-4 timezone) second value est timezone. what need utc value unchanged java.sql.timestamp (ie tz independent), database write. possible? edit 1 datetime srcdatetime = date.todatetime(srctz); datetime dstdatetime = srcdatetime.todatetime(dsttz); system.out.println("utc time:" + dstdatetime.getmillis()); i know srcdatetime local

linux - How to create an email file? -

after fetchmail fetches mails, new mails stored in file /var/mail/user . can open file user text editor vim . how can create such text-based email files? say, want send email contents: from: sender <sender@xx.com> to: receiver <receiver@xx.com> subject: test subject contents: ... attached: file1.txt, file2.png, file3.pdf the problem how make these formal text-based email. besides, if have such email file. how can extract files(say, subjects, contents, attached files, etc.) command line tools. know can open program mutt . can done using command line utility? there bunch of standards need understand, email fundamentally text. the file format in /var/spool/mail or /var/mail/user etc typically berkeley mbox . not formally defined anywhere, consists of sequence of rfc5322 (née rfc822) email messages, each preceded from_ line, format of from %s %c %s sender's email address (what see in return-path: ) , %c date when message arrived. notice 2

php - Load unicode character map when user select the language -

i know question bit vague , not sure possible. on web site want display combo box maximum possible languages (available in unicode) , when user selects language respective character map of language should loaded. users can click , complete given text area comments in own language. not asking code kind guide line possibility of , way helpful. ultimate need give user type in language of choice. users need install language in computer before using it? thank you. the unicode standard not divide characters language, , there no rigorous definition concept “characters used in language”. example, “é” character used in english? (think “fiancé”.) “è”? (think spelling “belovèd” used in forms of writing.) the unicode consortium has created cldr database, contains information “exemplar characters” in languages, these based on subjective judgement , debatable – in sense of covering much, might not serious here. data in xml formal, automatically fed application. there nothing user

php - setting Default Text inside Yii textarea -

i'm new yii , facing issues it. hope pros here can me solve this. bought script online , editing needs. i want have text area default texts. example; name: age: sex: what generating now: <textarea class="span vertical medium" name="maccount[accountinfo]" id="maccount_accountinfo"></textarea> what want generate,or : <textarea class="span vertical medium" name="maccount[accountinfo]" id="maccount_accountinfo">name: <br> age: <br> sex:</textarea> something above. able produce textarea blank/no content.below code,it located inside worklet.; public function properties() { $properties = array( 'elements' => array( 'accountinfo' => array( 'type' => 'textarea', 'class' => 'span vertical medium', ), 'email' => array(

sql - How to do this query in MySQL which one should I use using left join or right join or inner join? -

table book: bookcode| authorshortn |title ============================================ 101 | anton b | book of leaves 102 | jj. abram | wish upon star 103 | anonymous | secret of universe 104 | anton b | sentinel table author: authorid|authorfullname |nationality ===================================== a01 | anton balwin | usa j02 | johannes j abram| uk table bookauthor: bookcode|authorid ================= 101 | a01 102 | j02 103 | x01 104 | a01 i have 3 table structure this. , have query such result be: if query select * book tb , author ta, bookauthor tba tb.bookcode = tba.bookcode , tba.authorid = ta.authorid it not show row 103 | anonymous | secret of universe author not in table author. and want is: bookcode| title | authorid | authorshortn =========================================================== 101 | book of leaves|a01 | anton balwin 102 | wish upon star |j02 | johannes j abram 103 | secret of universe|null

drools - Call guvnor rules in a sequence -

i developing few rules on guvnor plugin. e.g. check the person teacher. the teacher male. the male teacher of 45 years or above age. i have these 3 rules working separately. want call them in sequence. like if person teacher. insert new fact maleteacher. in next rule populate age of teacher in received fact. check age of teacher. so how can achieve in drools-guvnor plugin. i have created these rules using guided editor in drools-guvnor5.5 plugin jboss. there option create chain of rules execution. any appreciated. if need sequential invocation of rules please take @ agenda-group , ruleflow-group topics in documentation.

c - Segmentation fault in sigaction signal handler -

in below code, if i'm declaring old_act global variable program works fine. if declared inside main: if sa_restart used, works fine if sa_restart not used, causes segmentation fault. can please me comprehend happening. void sighandler(int signum) { printf("caught signal:%d pressed ctrl+c!!\n",signum); } int main() { struct sigaction act_h; struct sigaction old_act; act_h.sa_handler = sighandler; // act_h.sa_flags = sa_restart; sigaction(sigint,&act_h,&old_act); printf("this infinite loop\n"); int remain=sleep(10); printf("remaining time in sec : %d\n",remain); printf("before second sleep\n"); sleep(10); printf("this infinite loop\n"); return 0; } from gdb looks function call happening @ illegal location ,but not sure: this gdb configured "i686-linux-gnu". bug reporting instructions, please see: &

mysql - Exclude left join in case of empty cells -

so need join company table in case email field populated. is there way exclude company table join in case there empty email field? select * person p left join company c on(substring_index(p.email, '@', -1)=c.website , p.email <> '') i can't "where" clause because joining yet table, , want table joined regardless. any appreciated, thanks! i figured out! flash of inspiration, and... select * person p left join company c on((case when length(p.email)>0 substring_index(p.email,'@',-1) else "purplepower" end)=c.website) by using "case" clause have made sure email values exist matched. if not, matching arbitrary string of course doesn't match company table.

android - showing images in an imagview in a loop -

i beginner please bear ,i have images in app on sd card , want show these images user 1 one duration,lets 1 image other 1 after 1 minute 1 after 1 minute this.i using aysnctask in convert image in bitmap , show it.i want show these images in continous loop until user exists app app should show images 1 one using following code it:- for(i=1;i<z-1;i++) { xc=cont_id.get(1).tostring(); what=environment.getexternalstoragedirectory() + "/playerimages/" + xc + ".jpg"; play_duration=durat.get(1); //s1.execute(what,play_duration); new showtime().execute(what,play_duration); log.i("lenght",string.valueof(i));} but when try execute in endless loop app crashes:- for(i=1;i<z-1;i++) { xc=cont_id.get(1).tostring(); what=environment.getexternalstoragedirectory() + "/playerimages/" + xc + ".jpg"; play_duration=durat.get(1); //s1.execute(what,play_duration); new showtime().e

ruby on rails - Cloudinary Gem Breaking Bootstrap on Heroku -

i have rails app has photo uploading feature. using carrierwave_direct upload directly s3 (based on railscast 383 ). in order optimize app, went ahead , switched cloudinary. the app works locally fine cloudinary. when pushed heroku app crashes server log error: actionview::template::error (invalid css after " font-family: ": expected expression (e.g. 1px, bold), "@altfontfamily;" 2013-09-04t05:16:29.148898+00:00 app[web.1]: (in /app/app/assets/stylesheets/application.css)): 2013-09-04t05:16:29.148898+00:00 app[web.1]: 12: <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js" type="text/javascript"></script> 2013-09-04t05:16:29.148898+00:00 app[web.1]: 13: <![endif]--> 2013-09-04t05:16:29.148898+00:00 app[web.1]: 14: 2013-09-04t05:16:29.148898+00:00 app[web.1]: 15: <%= stylesheet_link_tag "application", :media => "all" %> 2013-09-04t05:16