Posts

Showing posts from May, 2011

Need help moving a middle initial from the end of a name to the middle using java regex -

i made topic on before , got closed , labeled off-topic. tried reading faqs couldn't figure out why pardon me if off-topic had additional questions on issue. i have field contains full name in following format: first, last (mi.) challenges: the middle initial isn't present entries don't have middle initial listed. some middle initials have period @ end. many of names spanish names can have multiple first , last names splitting field space isn't option. the name field may have white spaces @ end. the middle name may contain accented character (i couldn't find spanish middle names did start accent couldn't sure wouldn't have any). what i've done far: the first thing did used trim() remove padding @ end of field. fname.trim() next, i've split name first , last names following: string[] names = fname.split(","); i need split middle name last name, can following: fname = names[0] + " " names [1] + " ...

Customizing of code generation in IntelliJ IDEA -

im using intellij idea 12. can customise code generated using "refactor" functional? for example want change template of setting generation(encapsulate fields) from: public void setfield(string field) { this.field = field; } to public myclass setfield(string field) { this.field = field; return this; } as far know, can't you're suggesting in intellij. there plugins , however, can generation of fluent interfaces.

html - Full width content middle of 1170px using Drupal Bootsrap -

i'm using drupal bootsrap base theme , i'm building sub theme on top of it. site default 1170 px wide middle of content on same page have browser full width content (max 1400px). since drupal bootsrap theme has container s 1170 wide can somehow make wider middle of div? <div class="main-container container"> <div>normal 1170 wide content</div> <div> full browser width content</div> </div> so container class make whole div 1170 wide. can somehow make wider middle? bootstrap have class stuff? been trying go through documentation haven't find related case this.

Serializing and submitting a form using an AJAX call in JQuery -

i'm having trouble serializing form within mvc.net application using ajax call defined follows: @using (html.beginform("specialnotice", "displays", formmethod.post, new { id = "form" })) the form defined follows , posted following controller: public actionresult specialnotice(string dtype, bool? immediate,specialnoticemodel mod) when use $(formid).submit() works fine, form passed controller , specialnoticemodel populated correct information has been defined in form. however want ajax request instead, because not want form refresh upon submission. ajax call using is: var formdata = $('#form').serialize(); $.post(window.baseurl + 'displays/specialnotice', { dtype: $(displayid).val(), immediate: false, data: formdata }, function () { var device = $('#devicetype').val(); var postnow = '@model.postnow.tostring()'; window.location.href = window.baseurl + 'displays/speci...

android - How to listen EditText changes when changes are made by Keyboard -

i have edittext accepts changes keyboard or seekbar. how can listen changes keyboard? i want know, when changing makes input keyboard, when changing seekbar you need apply addtextchangedlistener(textwatcher watcher) edittext. here tutorial showing how use it: http://karanbalkar.com/2012/10/tutorial-11-using-textwatcher-in-android/

java - Include login methods -

i got entity user , want every method of every controller have access logged user without typing : model.addattribute(userdao.getuser(principal.getusername())); you can implement simple handlerinterceptoradapter add user instance model after handler invoked. class useraddinghandlerinterceptor extends handlerinterceptoradapter { // autowire dependencies... private static final string attribute = "user"; @override public void posthandle(httpservletrequest request, httpservletresponse response, object handler, modelandview modelandview) throws exception { if (modelandview != null && !modelandview.getmodelmap().hasattribute(attribute) { modelandview.addobject(attribute, userdao.getuser(principal.getusername())); } } }

jquery - Forcing jqGrid to use JSON for create/delete/update -

i'm starting use jqgrid display/add/edit/delete data coming rest service using json. reading data works fine, other operations such add,delete cause server error because i'm doing post of parameters using query string server expecting json content: $(document) .ready( function() { $("#list") .jqgrid( { url : 'http://localhost:8888/rest/service', datatype : 'json', mtype : 'get', colnames : [ 'name', 'city', 'country'], colmodel : [ { name : 'name', index : 'name', width : 150, editable : true ...

c++ - How can I apply a graphic effect to the image in QListView? -

i apply graphic effect pixmap of list item in qlistview. what should achieve that? as far understand, need make own delegate that. how use qgraphicseffect in it? update. if qlistwidget used, can following effect. create widgets every list item , apply desired qgraphicseffect them. widget go (for example): class portraitviewwidget : public qframe { q_object public: explicit portraitviewwidget(qwidget* parent = nullptr) { auto imageview = new qwidget(); auto imageviewlayout = new qvboxlayout(); auto imagelabel = new qlabel(); auto textlabel = new qlabel(); // test defaults imagelabel->setpixmap(qpixmap("/lenna.png")); imagelabel->setscaledcontents(true); static qreal quality = 0.f; quality += 0.1752f; if(quality > 1.f) quality = 1.f; textlabel->settext(qstring("%1%").arg(quality * 100.f, 0, 'f', 1)); textlabel->setalignment(qt::aligncenter); textlabel->sets...

libgdx - How to get the world coordinates of a point in a child actor? -

i have group objects consist of other group objects, consist of actor objects. now, when groups , actors rotated, offset , scaled, coordinates in "world", or in relation root node change. how world coordinates of point in actor's local space? to illustrate bit more, here's example of want: group parentgroup; actor childingroup; ... parentgroup.addactor(childingroup); childingroup.setposition(10f, 15f); childingroup.setrotation(45f); // childingroup's position in world float childworldposx = ...; // want know float childworldposy = ...; // ... , this. you can either use actor.localtoparentcoordinates() if want go 1 step higher in hierarchy of groups , actors , or directly use actor.localtostagecoordinates() "stage-global" coordinates directly. in case, libgdx recursively apply localtoparentcoordinates until hits root element of stage.

How to perform an unattended installation of Sitecore? -

my team attempting perform automated installation of sitecore via salt using sitecore executable. prefer use .exe on manual installation of zip package because installation wizard handles registering sitecore installed program modifying registry. theoretically let salt know "state" has been fulfilled. when running executable /? argument, following list of options displayed: /? or /help : screen /i : install (default) /x : uninstall /q : force silent (no ui) mode /qb : force basic ui mode /nq : force full ui mode /nosplash : not display splash screen /log : enable logging /logfile [path] : specify log file /configfile [path] : specify configuration file /extractcab : extract embedded components /displaycab : display list of embedded components /displayconfig : display list of configurations /componentargs ["id|display_name":"value"...] : additional component args /controlargs ["id":"value" ...] : additional control values /compl...

Running javascript code only once -

i have piece of js code & want run once. js code contains if statement if( abc.xyz && xyz.pqr) { //do } now, abc.xyz & xyz.pqr third party functions being called twice third party code on page & hence jscode have written runs twice. have no control on third party functions. need use them in js code , want code run once. tried using code below not work me: var donethestuff; if(!donethestuff){ donethestuff= true; //my code // code fires pixel can see in charles // because of third party functions called twice on page // code runs twice & drops 2 pixels instead of 1 can see in charles. } any suggestions? you can user underscore.js once() method this. var dostuff = _.once(function() { if( abc.xyz && xyz.pqr) { //do } }); and if want know how works, can browse source yourself: http://underscorejs.org/docs/underscore.html#section-73 _.once = function(func) { var ran = false, memo; re...

javascript - Uncaught RangeError: Invalid array length in Chrome version 36.0.1985.5 dev -m -

i have google map api setup here , , google chrome throw 'uncaught rangeerror: invalid array length'. here code in question: var map; var phoenix = new google.maps.latlng(33.551946,-112.109985); var locone = new google.maps.latlng(33.541061,-112.293369); var loctwo = new google.maps.latlng(33.37738,-111.833271); var locthree = new google.maps.latlng(33.454742,-112.099701); var locfour = new google.maps.latlng(33.673617,-112.020856); function homecontrol (controldiv, map){ // create div hold controls var controldiv = document.createelement('div'); controldiv.class = 'gmnoprint'; controldiv.style.margintop = '5px'; controldiv.index = 1; // set css control border var controlui = document.createelement('div'); controlui.id = 'border'; controlui.style.backgroundcolor = '#fff'; controlui.style.cursor = 'pointer'; controlui.textalign = 'center'; controlui.title = ...

java - Eclipse and Hibernate - faster and easier way to add mapping items in hibernate.cfg.xml -

i'm having problem lately adding mapping items hibernate.cfg.xml file. clear, it's not mystery me how generate mapping anotations , all, process of adding these classes hibernate.cfg.xml file takes long. instance, "hibernate configuration 3.0 xml editor" has bult-in function add mapping item in "session factory" tab. sadly, can add class once on time, means going "session factory" tab, hitting "add" button in mapping section , choosing class list. ex. <?xml version="1.0" encoding="utf-8"?> <!doctype hibernate-configuration public "-//hibernate/hibernate configuration dtd 3.0//en" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory name=""> <property name="hibernate.connection.driver_class">org.postgresql.driver</property> <propert...

batch file - Wierd issue with using task schedule to process php script -

i have created task schedule processes batch file in turn processes php script ("sendtext.php") send text message. "sendtext.php" includes php file ("prefs.php") checks whether particular text file exists or not. if does, process continues, otherwise gives alert , redirects different page create text file first. now, if run batch file manually, send text message. when run scheduled task runs same batch file, gives alert included file ("prefs.php") because can't find text file. php files , batch file in same folder. think it's kind of path issue task schedule. please help!!! on .bat file, use change directory command ( cd ) program root directory. after have configured environment variables php, can run php on next line , not have issues include, require, etc. statements. if don't configure environment variables, second line should point php.exe directory: c:\program files\php...php.exe cd c:\inetpub\wwwroot\myprogram-d...

android - socket timeout while connecting -

i'm trying implement tcp client app on android. when try connect c++ server, socket times out while trying connect server. my code: new thread(new clientthread()).start(); try { printwriter out = new printwriter(new bufferedwriter( new outputstreamwriter(socket.getoutputstream())), true); out.println("test message."); } catch (exception e) { // error1 e.printstacktrace(); } ... class clientthread implements runnable { @override public void run() { try { inetaddress serveraddr = inetaddress.getbyname("192.168.1.116"); socket = new socket(serveraddr, 9000); } catch (exception e) { // error2 e.printstacktrace(); } } } first, error1 occurs (socket null), error2 occurs (connection time out). server working fine, have tested different clients. have "uses-permission" shouldn't problem. edit: stack @ error2: 05-17 02:26:50.789: w/system.err(26625): java.net.connectexception...

join - MySQL query joining 3 tables and counting -

i've been stuck on problem far long. have merge 3 tables , counting of distinct values. have 3 tables 1.user_me profileid( string ) responded( int 1 or 0) 2.profiles profileid ( string ) idlocation ( int ) 3.lookup_location id ( int ) location (string ) i can join user_me , profiles on user_me.profileid = profiles.profileid can join profiles , lookup_location on profiles.idlocation = lookup_location.id under profiles need count number of distinct values idlocation user_me.profileid = profiles.profileid need count number of profiles.idlocation have user_me.responded = 1 i have this: select lookup.location, count(*) total user_me user join profiles on user.profileid= profiles.profileid join lookup_location lookup on profiles.idlocation = lookup.id group profiles.idlocation but still need have column giving me count user_me.responded = 1 like: select lookup.location, count(*) total, count(*) responded if i'm understandin...

ios - Parsing summary from RSS Feed causes app to crash -

i trying add summary uitableview parsing rss feed. have set method summary, app crashing. victim line is: [item setobject:summary forkey:@"summary"]; crash code: 2014-05-17 09:32:09.231 ***[1169:90b] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '*** setobjectforkey: object cannot nil (key: summary)' *** first throw call stack: ( 0 corefoundation 0x0453a1e4 __exceptionpreprocess + 180 1 libobjc.a.dylib 0x037bd8e5 objc_exception_throw + 44 2 corefoundation 0x045c3eb8 -[__nsdictionarym setobject:forkey:] + 888 3 *** 0x0010367a -[*** parser:didendelement:namespaceuri:qualifiedname:] + 394 4 foundation 0x034ac991 _endelementns + 363 5 libxml2.2.dylib 0x00626788 xmlparseendtag2 + 744 6 libxml2.2.dylib 0x00628bf8 xmlparsetry...

html - Positioning text within a width:100% (liquid?) header and footer elements -

some background: every site build based on using center container div see on screen contained within, example, 1000px wide container. nothing left or right , no top or bottom bars extend off left or right sides of screen. it's time build site top , bottom bars expand out past 1000px container div. got part, right down bars themselves. the problem: want position text (links exact) within top , bottom bars, not dissimilar how looks here. i'm getting messed because want without absolute positioning, or js or jq or via plugin. when add div contain text within, say, top bar, sits happily left of top bar, not want it. have searched, researched , made small attempts figure out no avail. therefore: built sample site includes image if how things look. site bare minimum on html , css (hopefully) make things clear, , can found here . add css: #top_content { margin: 0 auto; width: 1000px; } this make text within <div id="top_content">here</div...

Google App engine application with godaddy domain issue -

i have seen other questions on forum , several links looks of them outdated , hence not me issue. i bought domain - cinemahunter.com i setup forwarding on godaddy redirect http://cinemahunter.com http://www.cinemahunter.com in google app engine, clicked on settings, , add domain. asked me google apps, though didn't understand reasoning, did that, gave domain name, asked me login godaddy.com, logged in credentials , good. @ point, there 2 steps outlined. change how naked domain (cinemahunter.com) redirected. have www in textbox between http:// , .cinemahunter.com. said - must change a-record @ domain host change take effect. assuming forwarding setup in godaddy. clicked on continue now said create a record in dns management page. went godaddy , under (host) deleted entry ip - 50.63.202.22 , created 4 records following specified in google apps host @ points 216.239.32.21, 216.239.34.21, 216.239.36.21, 216.239.38.21 i saved changes twice in godaddy. also, verifie...

How to Convert Oracle Spatial coordinates to Java Graphics coordinates? -

i want convert oracle spatial coordinates java graphics coordinates. please me understand how conversion? there formula available? i'm not sure how convert java graphic coordinates, think first step convert jgeometry objects. have @ "oracle spatial , graph java api" http://docs.oracle.com/cd/e16655_01/appdev.121/e20856/toc.htm georaptor open source plugin sql developer. displays sdo_geometry data on map windows within sql developer. if looking examples of how display sdo_geometry data using java graphics, worse reviewing source code: http://sourceforge.net/projects/georaptor/

php - Add a variable inside a mysql query -

i have variable $text = "sometexthere" i add variable $text inside following mysql query instead of sometexthere $query = "select sum(nbr) sum table2 name '%sometexthere%'"; i tried doing in many ways like $query = "select sum(stats) sum download filename '%' . $text . '%'"; and $name = "'%' . $text . '%'"; $query = 'select sum(stats) sum download filename '.$name.''; but not working :/ try with $query = "select sum(stats) sum download filename '%$text%'"; and avoid line $name = "'%' . $text . '%'"; or try this, $name = "%".$text."%"; $query = "select sum(stats) sum download filename '$name'";

java - How can I test Memory leaks of my application in mobile device especially in iOS and Android? -

Image
i manual tester , don't of tool need know how can check memory leaks in mobile device itself. or there other method test it? without having knowledge of coding. ios for ios use instruments. see locating memory issues in app . use leaks instrument of instruments analysis tool find objects in app no longer referenced , reachable. android for android use eclipse memory analyzer tool or android debug monitor described in investigating ram usage while using tools described above, should aggressively stress app code , try forcing memory leaks. 1 way provoke memory leaks in app let run while before inspecting heap. leaks trickle top of allocations in heap. however, smaller leak, longer need run app in order see it.

regex - Issues with mod_rewrite -

i have problem mod_rewrite. rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.+)$ $1.php [l,qsa] rewriterule ^article/(.+)$ /article.php?article=$1 this .htaccess. first rewrite_rule, hide file extensions. works without problem. second rule, turn "article.php?article=example" "article/example". whenever try visit page via "article/example" 500 internal server error. first rule works fine , can access page using article.php?article=example. reverse order of rules , use multiviews disable content negotiation: options +followsymlinks -multiviews rewriteengine on rewriterule ^article/(.+)$ /article.php?article=$1 [l,qsa] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.+)$ $1.php [l]

php - Yii:Upload CSV file to database -

i'm trying save csv file database , finding issues it. controller: $mod = new csv; if(isset($_post['csv'])) { $mod->attributes=$_post['csv']; if(!empty($_files['csv']['tmp_name']['csv'])) { $file = cuploadedfile::getinstance($mod,'csv'); $fp = fopen($file->tempname, 'r'); if($fp) { { $line = fgetcsv($fp, 1000, ","); echo $line[0]; echo $line[1]; $mod['mobile'] = $line[0]; $mod['name'] = $line[1]; $mod->insert(); } while( ($line = fgetcsv($fp, 1000, ";")) != false); } }} i'm able store first record of csv file. other records stored null. dont know i'm missing here http://www.yiiframework.com/wiki/442/upload-csv-file/ $mod->save(); instead of $mod->insert();

java - Trying to get some kind of dynamic, unordered list to send the order to servlet -

i'm total programming rookie , can't jsp send servlet. i'm pretty sure servlet's ok have no idea submit button in asp trying send it. looks this: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jquery ui sortable - drop placeholder</title> <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script> <link rel="stylesheet" href="/resources/demos/style.css"> <style> #sortable { list-style-type: none; margin: 0; padding: 0; width: 60%; } #sortable li { margin: 0 5px 5px 5px; padding: 5px; font-size: 1.2em; height: 1.5em; } html>body #sortable li { height: 1.5em; line-height: 1.2em; } .ui-st...

html - How to give word wrap break word property to a datatable column -

<table id="user"> <thead> <tr class="theader"> <th>order id</th> <th>message</th> <th>date created</th> </tr> </thead> <tbody> </tbody> </table> <script> $("#user").datatable({ "bfilter": false, "bautowidth": false, "bprocessing" : false, "bserverside" : true, "sajaxsource" : "./getorderdetails.cpm" }); </script> hi friends, here data-table. want implement word-wrap break word property message column long messages out space break. can please tell me how should implement word-wrap break word property column in data-table. add class in css. #user tbody td:nth-child(2) { word-wrap:break-word !important; }

android - implement multiple screen and folders -

hi guys don't know if correct. want implement support multiple screen. have created in project layout- layout-land layout-small layout-large layout-sw230dp layout-sw400dp layout-sw720dp , put layouts in every folder. my app include support 2.x. gingerbread. there simple solution implement multiple screen? i know gingerbread layouts layout layout-small abd layout-large! i have need edit layouts in every folder. can make me exanple?step step? please guys :( :( thank u there example @ android developer website , states: if have different layout on orientation change need have land , port modifier on folder res/layout/my_layout.xml // layout normal screen size ("default") res/layout-small/my_layout.xml // layout small screen size res/layout-large/my_layout.xml // layout large screen size res/layout-xlarge/my_layout.xml // layout large screen size res/layout-xlarge-land/my_layout.xml // layout large in landscape orienta...

html - Grid elements do not align properly -

i have wordpress website (you can see problem @ duncanhill.com.au ) and if @ website, first 3 property boxes align properly, 4th , 5th weird stuff. the code looks this: html: <div id="grid-gallery" class="grid-gallery"> <section class="grid-wrap"> <ul class="grid"> <li class="grid-sizer"></li><!-- masonry column width --> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <a href="<?php the_permalink(); ?>"> <li> <figure> <div class="figimg"><?php the_post_thumbnail(); ?></div> <figcaption><h3 class="figtitle"><?php the_title(); ?></h3><p class="price"><?php the_subtitle(); ?></p><p class="figdesc"><?php the_excerpt(); ?>...

java - How do I change the image on a JButton when clicked? -

jbutton lunarbutton = new jbutton(new imageicon("assets/buttons/moon.png")); lunarbutton.setactioncommand("switch"); c.gridwidth=1; c.gridy = 0; searcharea.add(lunarbutton, c); . public void actionperformed(actionevent ev) { int count = 1; string action = ev.getactioncommand(); if("switch".equals(action)) { imageicon sun = new imageicon("assets/sun.png"); imageicon moon = new imageicon("assets/moon.png"); changelunar(); count++; if (count % 2 == 0) { lunarbutton.seticon(sun); } else { lunarbutton.seticon(moon); } i have code implemented, eclipse tells me "lunarbutton cannot resolved", not able see lunarbutton variable in init() method? missing here? your lunarbutton may declared locally, perhaps in init method. one solution: declare instance field in cla...

Understanding the concept of simple row compression in SQL server -

i read row compression feature of sql server reduces space needed store row using bytes required store given value. without compression int column needs 4 bytes. need whole 4 bytes if storing number 1 or 1 million. row compression turned on, sql server looks @ actual value being stored , calculates amount of storage needed. what don't understand - why 1 , 1mn need full 4 bytes , why other numbers, bigger 1 require lesser memory ? edit - taken book: delivering business intelligence sql server 2008 row compression reduces space required store row of data. using bytes required store given value. example, without row compression, column of type int occupies 4 bytes. true if storing number 1 or number 1 million. sql server allocates enough space store maximum value possible data type. when row compression turned on, sql server makes smarter space allocations. looks @ actual value being stored given column in given row, , determines storage required represent ...

php - CodeIgniter: how to create common layout -

i want know how create common layout codeigniter framework , how access in controller. i created layout file, don't know how load files. <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <title>starter template bootstrap</title> <base href="<?php //echo base_url(); ?>" /> <!-- bootstrap core css --> <link href="<?php echo base_url('assets/bootstrap3.0.1/css/bootstrap.min.css'); ?>" rel="stylesheet" > <!-- custom styles template --> <!-- <li...

java - game freeze when i run a different thread javafx -

i have problem javafx: when run new thread game freeze loading , never continue this game loop class: public class motor implements runnable{ private mapa mapa; public motor(canvas canvas,label label){ arraylist<nivel> lstniveles = new arraylist<nivel>(); mapa=new mapa(lstniveles,canvas,label); } public void start(){ system.out.println(platform.isfxapplicationthread()); platform.runlater(this); } public void run(){ system.out.println(platform.isfxapplicationthread()); arraylist<nivel> lstniveles = new arraylist<nivel>(); mapa=new mapa(lstniveles,controladormapa.canvas,controladormapa.mapa); mapa.cargarmapa(); while(true){ try{ mapa.repaint(); thread.sleep(2000); }catch(exception e){ e.printstacktrace(); } } } } the player class: public class pjanimado { private image imagen; private int sx; private int sy; private int sw; private int sh; pri...

java - Hibernate Criteria searching request with One to Many relationship -

i've tried like: session = hibernateutil.getsessionfactory().opensession(); criteria cr = session.createcriteria(car.class); cr.createalias("vendor", "vendor"); cr.add( restrictions.eq("vendor.name", input)); results = (list<car>) cr.list(); and like: session = hibernateutil.getsessionfactory().opensession(); criteria cr = session.createcriteria(car.class); cr.createcriteria("vendor").add(restrictions.eq("name", input)); results = (list<car>) cr.list(); both realizations return data, not specified search query. in car class i've got relationship: @manytoone(fetch=fetchtype.lazy) @joincolumn(name="id_vendor", nullable=false) public vendor getvendor() { return this.vendor; } and i've got the name column @ vendor class @ i'm trying search. so how possibly such search request? thanks. you need assign criteria original object. the reason cars because line of cod...

c - Cross-platform Library -

basically, want seperate common functionality existing projects seperate library project, allow project remain cross-platform when include library. i should clarify when "cross-platform" i'm concerned compiling multiple cpu architectures (x86/x86_64/arm). i have few useful functions use across many of software projects. decided bad practice keep copying these source code files between projects, , should create seperate library project them. i decided static library suit needs better shared library. however, occurred me static library plaform dependent, , including projects cause these projects platform dependent. disadvantage on including source code itself. two possible solutions occur me: include static library compiled each platform. continue include source code. i have reservations both of above options. option 1 seems overly complex/wasteful. option 2 seems bad practice, it's possible "library" modified per project , become out-of-syn...

ghostscript - Dramatic speed difference between PDF to PNG vs. PDF to JPEG -

using pdftocairo , on xeon e5-2630 (2.3ghz) centos 6.3 machine, poppler 0.24, cairo 1.12, libpng 1.2.49, openjpeg 1.3.10 (both centos default), tested converting 37 page pdf convert jpeg , png. ran pdftocairo no special options (so no alpha channel png, density @ 150ppi). speed difference enormous: pdf png: real 0m16.858s user 0m16.552s sys 0m0.154s that works out 0.43s per page. pdf jpeg: real 0m1.762s user 0m1.666s sys 0m0.081s which is, well, 10 times faster. now tested using gs convert, same options, , results are: pdf png: real 0m16.500s user 0m16.223s sys 0m0.093s almost identical in speed poppler, strangely. pdf jpeg: real 0m7.468s user 0m7.304s sys 0m0.079s much slower poppler, somehow, included comparison. why converting png slower? need convert them pngs, there wrong libpng setups? it's curious gs slower when converting jpegs identical pngs. png compression speed governed zlib compression...

javascript - Size of element does not update after append -

i working on following code so: console.log("size before: " + list.size()); list.append($(newitem)); console.log("size after: " + list.size()); output in console is: size before: 1 size after: 1 size before: 1 size after: 1 size before: 1 size after: 1 html: <ul class="form-list" id="list"> <li> <form class="form-inline" role="form"> <div class="form-group"> <label class="sr-only">items</label> <input type="date" class="form-control date-picker input-lg" id="sprint-start"></input> <a href="#"><i class="glyphicon glyphicon-plus list-add"></i></a> <a href="#"><i class="glyphicon glyphicon-re...

How to concat integer and string inside recursive function in C -

guys, want make program generate combination elements. example if user input (n) = 3, output must : 1 12 123 13 2 23 3 i have problem concat integer , string inside recursive function.. code : #include <stdio.h> void rekursif(int m, int n, char angka[100]){ int i; for(i=m; i<=n; i++){ sprintf(angka, "%s %d", angka, i); printf("%s \n", angka); rekursif(i+1,n,angka); } } int main(){ rekursif(1,5,""); return 0; } when run program, command prompt not responding. guess, problem in concation ( sprintf(angka, "%s %d", angka, i); ) please me solve problem. thank :) by passing "" function argument, trying modify string literal, undefined behavior. instead, do: int main(){ char str[100]; rekursif(1, 5, str); return 0; } be careful buffer overflow in practice.

javascript - Create a variable using document.createElement('a') and apply click on it without appending it to DOM -

i creating anchor element using jquery/javascript. using method: var = document.createelement('a'); a.href = '/files/target.pdf'; a.download = true; but how can perform click event on without appending/prepending dom ? intention pretty simple. want let user download file instead of opening in browser , that's why want avoid window.location = '/files/target.pdf'; function. please me. thanks. well, can trigger "click" this: var anchor = document.createelement('a'); anchor.href = 'http://gutfullofbeer.net/mozilla.pdf'; anchor.download = true; var evt = document.createevent('mouseevents'); evt.initmouseevent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null); anchor.dispatchevent(evt); however, when in firefox, pdf file that's shown in firefox's built-in pdf viewer. (chrome seems "right" thing, show "save ..." dialog.)

cordova - RhoMobile Suite vs. Titanium vs. Xamarin vs. PhoneGap vs. Telerik Platform vs. Codename One -

i, many others, looking venture mobile app development. familiar html5, css3, javascript, php, ruby, .net not java or objective-c. honest, i'm unlikely become mobile developer guru , apps develop unlikely push limits of hybrid such extent ought go native anyway. challenge me gain enough knowledge confidentally align myself 1 of mainstream hybrid development platforms - knowing made right decision according requirements. i've been reading similar posts on , researching popular hybrid mobile application development 'solutions' including: xamarin titanium rhomobile phonegap telerik platform i've come conclusion decision on go not simple. in fact, i'm no closer making decision when started. i'm therefore turning community recommend options based on specific criteria (which believe reflects self-employed developers working on small project-by-project basis rather larger corporate development team ability fund licence costs etc.) the apps build need ve...

Installing PostgreSQL within a docker container -

i've been following several different tutorials official 1 whenever try install postgresql within container following message afterwards psql: not connect server: no such file or directory server running locally , accepting connections on unix domain socket "/var/run/postgresql/.s.pgsql.5432"? i've looked through several questions here on , throughout internet no luck. the problem application/project trying access postgres socket file in host machine (not docker container). to solve 1 either have explicitly ask tcp/ip connection while using -p flag set port postgres container, or share unix socket host maching using -v flag. :note: using -v or --volume= flag means sharing space between host machine , docker container. means if have postgres installed on host machine , running run issues. below demonstrate how run postgres container both accessible tcp/ip , unix socket. naming container postgres . docker run -p 5432:5432 -v /var/run/postgre...

c++ - Memory consumption during parsing of YAML with yaml-cpp -

i developing qt application embedded system limited memory. need receive few megabytes of json data , parse fast possible , without using memory. i thinking using streams: json source (http client) ---> zip decompressor ---> yaml parser ----> objects mapped database data arrive network slower can parse it. how memory yaml-cpp need parse 1mb of data? i parsed raw data decompressor , internal memory used data yaml parser released object mapped database created. possible? does yaml-cpp support asynchronous parsing? json object parsed, can store in database without waiting full content http source. since have memory constraints , data in json, should use low-memory json parser instead of yaml parser. try jsoncpp - although i'm not sure support streaming (since json doesn't have concept of documents). yaml-cpp is designed streaming, won't block if there documents parse stream still open; however, there outstanding issue in yaml-cpp reads mo...

python - Django, Fabric: What is the best way to manage secret keys to deploy Django projects? -

for i'm trying store secret_key in environment variable: # settings/base.py def get_env_variable(var_name): """ environment variable or return exception """ try: return os.environ[var_name] except keyerror: error_msg = 'set {} environment variable'.format(var_name) raise improperlyconfigured(error_msg) secret_key = get_env_variable('secret_key') and cant realize how should deploy project fabric: @task def deploy(): syncdb() collectstatic() @task def collectstatic(): dj('collectstatic') cd('{django_root}/static'.format(**env)): fix_permissions() @task def syncdb(): dj('syncdb') @task def dj(command): run('{virtualenv_dir}/bin/python {django_root}/manage.py {dj_command}'.format(dj_command=command, **env)) which method setting env vars best in situation? i'm want make automatically , use fabscript many times. @ same time...