Posts

Showing posts from May, 2012

iphone - iOS - How to print value in textfield using delegate -

i new ios. have problem have solution it? not able print json value in textfield contactviewcontroller.m file: - (void)viewdidload { [super viewdidload]; // additional setup after loading view, typically nib. fname.text=@"hello"; } after view loaded hello value shown in text box, when call list button json values: -(ibaction)list:(id)sender{ vedant=[[webserviceviewcontroller alloc]init]; [vedant listcontacts]; } then webserviceviewcontroller.m pass jsonresponse same file i.e contactviewcontroller.m , parse json value , print not shows value in text field -(void)allcontacts:(nsstring *)jsonresponse{ nslog(@"%@",jsonresponse); nsdata *jsondata = [jsonresponse datausingencoding:nsasciistringencoding]; // nserror *err; nsdictionary *json = [nsjsonserialization jsonobjectwithdata:jsondata options:kniloptions error:&err]; int acccount =[json count]; for(int i=0;i<acccoun

javascript - How to animate transitions triggered by links -

i found this useful jquery navigation highlights linked content scrolls. think understand how works, i'm having trouble including transitions / animations clicked items. want sections smoothly transition when triggered navigation. i have tried adding css .section { transition: transform .5s ease-in-out; } and jquery $('#navigation').click(function(){ $('.section').animate('slow'); }); i'd appreciate explanation of doing wrong in particular example. here code , https://jsfiddle.net/r040p7oa/ <div id="navigation"> <ul> <li><a href="#section1">section 1</a></li> <li><a href="#section2">section 2</a></li> </ul> </div> <div id="sections"> <div id ="section1" class="section">i'm section 1</div> <div id ="section2" class="section">i'm section 2 <

java - Importance of order when using multiple optional patterns -

how order of optional patterns in datetimeformatter affect parsing operation? i running program , wondered why last line throws exception not first three. public static void main(string[] args) { string p1 = "[eeee][e] dd-mm-yyyy"; string p2 = "[e][eeee] dd-mm-yyyy"; string date1 = "thu 07-01-2016"; string date2 = "thursday 07-01-2016"; parse(date1, p1); //ok parse(date1, p2); //ok parse(date2, p1); //ok parse(date2, p2); //exception } private static void parse(string date, string pattern) { datetimeformatter fmt = datetimeformatter.ofpattern(pattern, locale.english); system.out.println(fmt.parse(date)); } the exception on last line is: java.time.format.datetimeparseexception: text 'thursday 07-01-2016' not parsed @ index 3 the documentation not mention precedence , i'll argue result getting normal. result of reading string format left right. let's consider first format "[eeee

postgresql - Configuring Django with Nginx, uWSGI and Postgres on Docker -

i'm trying setup django app on docker nginx, uwsgi , postgres. found great guide on setting compose django , postgres: https://docs.docker.com/v1.5/compose/django/ however, need add nginx , uwsgi. i've tried using files of repo ( https://github.com/baxeico/django-uwsgi-nginx ) compose setup of docker docs without succes, sadly. this happens when enter docker-compose run web : step 17 : run pip install -r /home/docker/code/app/requirements.txt ---> running in e1ec89e80d9c collecting django==1.9.1 (from -r /home/docker/code/app/requirements.txt (line 1)) /usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: insecureplatformwarning: true sslcontext object not available. prevents urllib3 configuring ssl appropriately , may cause ssl connections fail. more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. insecureplatformwarning downloading django-1.9.1-py2.p

python - An example of POST request in Flask API gives "Method Not Allowed" -

i'm using flask api , want use post requests. i want example post requests return something, keep getting error message "method not allowed". i want give parameter(e.g query_params = 'name1' ) search user , return json, don't know give parameter , don't understand why i'm getting message. here did simple route: @mod_api.route('/show-user', methods=['post']) def show_user(): query_params = 'name1' query = {query_params: 'myname' } json_resp = mongo.db.coordinates.find(query) return response(response=json_util.dumps(json_resp), status=200, mimetype='application/json') any please? the reason not doing post request against route, accepts post requests. here simplified example mongodb details removed illustrate this. from flask import flask app = flask(__name__) @app.route('/show-user', methods=('post',)) def show_user(): return "name info" if _

c - No display of array -

the following implementation of spoj problem: http://www.spoj.com/problems/fctrl2/ #include <stdio.h> int main() { int t; scanf("%d",&t); while(t--) { int carry=0,k,i,j,num,arr[1000]={1}; scanf("%d",&num); for(i=1;i<=num;i++) { for(j=0;j<=k;j++) { arr[j]=arr[j]*i+carry; carry=arr[j]/10; arr[j]=arr[j]%10; } while(carry) { k++; arr[k]=carry%10; carry/=10; } } for(i=k;i>=0;i--)//doubt { printf("%d",arr[i]); } printf("\n"); } return 0; } i guess there mistake in displaying array in reverse direction, when change condition i.e for(i=0;i<=k;i++) prints array. please me solve problem. int carry=0,k,i,j,num,arr[1000]={1}; for(j=0;j<=k;

qt vertical and horzontal layouts inside gridlayout? -

Image
hi all, new qt app development . attaching 2 screen shots , 1 desired ui , other created 1 using code . believe code explain things , instead of typing here , confusing friends here . kindly suggest needs changed /updated? regards /* header file */ #ifndef widget_h #define widget_h #include <qwidget> namespace ui { class widget; } class widget : public qwidget { q_object public: explicit widget(qwidget *parent = 0); ~widget(); private: // ui::widget *ui; }; #endif // widget_h /*implementation code */ #include "widget.h" #include "ui_widget.h" #include<qgridlayout> #include<qvboxlayout> #include<qhboxlayout> widget::widget(qwidget *parent) : qwidget(parent)//, //ui(new ui::widget) {

How to make Vim ignore file extensions when opening files through the command line/shell? -

consider following directory tree: root/include/file.hpp root/source/file.cpp root/images/file.png the command line inside directory root . in vimrc file, there set wildignore=*.png . if open vim in folder root , run :next */file.* , opens file.hpp , file.cpp . however, if launch vim command line vim */file.* , opens 3 files. so, when feeding filename, first loads files, vimrc ? there way ignore extensions when opening files vim through command line? or make vim load vimrc first? in first scenario, glob expansion done vim , obeys rules in vimrc . in second scenario, glob expansion done shell , there's no reason expect obey rules in vimrc . you can $ vim -c "next */file.*" , opens vim without filename , executes next */file.* . or can exclude pattern directly in shell. assuming have extglob set, can done in bash $ vim !(file.png) .

excel vba - VBA Issue when connecting to Avaya CMS application -

Image
i need here please :( ok here want do, open excel , run interval report (("historical\designer\gsd cr summary interval report") cms (call management system). when open excel file select time/date range , skills cms search for. please see image below: once required feilds filled in click generate report , vba take over, clear data cms rawdata , paste in new data. keep getting undefined error , cant head around it... code is: `' created keith carpenter 06/01/2016 dim cvsapp new acsup.cvsapplication dim cvsconn new acscn.cvsconnection dim cvssrv new acsupsrv.cvsserver dim rep new acsrep.cvsreport dim info object, log object, b object 'this method main function prepare extraction cms load in excel public sub reportinterval() on error goto errhandler: application.calculation = xlcalculationmanual application.screenupdating = false unhide_sheets 'clean mtd sheet sheets("cms_rawdata").select cells.select selection.clearcontents range("a1&q

animation - Mapping and Binding Joints and Bones -

when using mecanim-rigged character in unity, can bind mocap device segments onto mecanim bones , animate character, don't have find or mecanim bones, because defined , accessible through humanbodybones , use of animator . (at least, think case, please correct me if wrong...) so, example, through simple process follows, map own animation segments onto mecanim character , animate live mocap device: private dictionary<xsanimationsegment, humanbodybones> mecanimbones; public enum xsanimationsegment { pelvis = 0, . . . neck = 21, head = 22 } int[] segmentorder = { (int)xsanimationsegment.pelvis, . . . (int)xsanimationsegment.neck, (int)xsanimationsegment.head }; protected void mapmecanimbones() { mecanimbones = new dictionary<xsanimationsegment, humanbodybones>(); mecanimbones.add(xsanimationsegment.pelvis, hu

if statement - R- Conditional calculation based on values in other row and column -

my data has following format: - first column: indication if machine running - second column: total time machine running see here below dataset: structure(c("", "running", "running", "running", "", "", "", "running", "running", "", "10", "15", "30", "2", "5", "17", "47", "12", "57", "87"), .dim = c(10l, 2l), .dimnames = list(null, c("c", "v"))) i add third column gives total time machine has been running (by adding times since machine started run). see here below desired output: [1,] "" "10" "0" [2,] "running" "15" "15" [3,] "running" "30" "45" [4,] "running" "2" "47" [5,] "" "5" "

Tmux-powerline status-interval make flicker -

mac osx ei capitan tmux 1.9a powerline https://github.com/erikw/tmux-powerline sometimes status line flash, segments disappear , appeare. if config set-option -g status-interval=5 it seems better not real time status . is normal phenomenon? or maybe should config avoid this. thanks! it sounds 1 of segments doing takes long time update. can disable segments see if helps ( configuration docs ). defaults pretty expensive, , on older macbook, tmux regularly sits @ 5% cpu or more. disabling uptime , else don't need might help. here's example config trimmed of fat right status (removed uptime , system load, removed seconds time). goes in ~/.config/powerline/themes/tmux/default.json : { "segments": { "right": [ { "function": "powerline.segments.common.time.date" }, { "function": "powerline.segments.common.time.date", "name": &

java - Passing double values into 2D Array -

i'm trying initialize 2d array in java passing specific double values it, i'm returning error " ']' expected". double[][] englishtofrenchprob = new double[2][3]; double[0][0] = 0.0; //unused double[0][1] = 0.08; double[0][2] = 0.06; double[1][0] = 0; //unused double[1][1] = 0.08; double[1][2] = 0.06; what doing wrong, , realise there's easier way pass values 2d arrays way think can index them own values (which need do) to set value have use variable's name: englishtofrenchprob[0][0] = 0.00; you can use following syntax: double[][] englishtofrenchprob = {{0.00, 0.08, 0.06}, {0.00, 0.08, 0.06}};

ruby - Rails routes formatted params in URL -

i have following in routes: match '/car-rentals(/:address)' => 'search#search', via: :get i can visit: localhost:3000/car-rentals/montreal shows available cars montreal. when enter: localhost:3000/car-rentals/montreal quebec my url becomes localhost:3000/car-rentals/montreal%20quebec i be: localhost:3000/car-rentals/montreal-quebec i tried using to_param in model. class search < activerecord::base def to_param "#{address.parameterize}" end end any other ways achieve this? also worth mentioning. when stick binding.pry in to_param , reload page, doesn't stop process, not getting there. def to_param binding.pry # on page load, not getting here "#{address.parameterize}" end thanks in advance! there several gems generate slugs seo friendly urls. i've used https://github.com/norman/friendly_id in past , worked fine. has helpful documentation. there this: https://github.com/sut

Using barcode scanner (like Grabba) from with-in my iOS application -

my objective simple: read data barcode scanner. i know there's option scanning barcode using camera, in experience results not accurate in less ideal situation i.e. bad lighting. so, i'm exploring if external device can connected iphone/ipad , can provide barcode data external keyboard. so, can read barcode, scanned using external device? if so, can without writing code, or have add kind of support in application? answer any ios compatible bluetooth scanner supports hid mode. instance, socket chs. once connected, behave said "just external keyboard". hid vs sdk hid: using scanner keyboard, limited inputting scanned data open input fields user can modify scanned data , there limited options post-processing , validation. because scanner appears ios keyboard, ios hides onscreen keyboard - makes sense... if scanner actual keyboard. scanners (incl. socket chs 7ci & 7xi) provide mechanism force keyboard (on our chs double-click power button) o

c++ - How to open ECW file with GDAL in OpenCV 3.0 -

as know, gdal added opencv version 3. have satellite ecw image , want read , show it. try use opencv sample named : gdal-image.cpp. has line reading input image: cv::mat image = cv::imread(argv[1], cv::imread_load_gdal | cv::imread_color ); my problem : set ecw image argv[1] doesnt work. should convert image before? way read ecw using gdal? ecw file has own drivers built gdal may should test supported driver in opencv. if author didnt add support of ecw, may have youself. here page gdal in opencv: http://code.opencv.org/issues/3725

java - Cordova passbook from restful response -

i building cordova application using cordova-plugin-passbook plugin, can seen here: https://github.com/passslot/cordova-plugin-passbook . i trying consume pkpass our java server returning file expected if directly hit our service browser, problem need use auth token , go through our oauth server first. must request pass via ajax in front end using angular. the data octet-stream , somehow need parse , work plugin above. plugin configured url ending in ".pkpass", wondering if can configured parsed data instead of url. can see in src of plugin if there possible way that? not familiar objective c, trying think of options. thanks using cordova filetransfer plugin, got working: filetransfer.download( uri, fileurl, function(entry) { passbook.downloadpass(fileurl); }, function(error) { alert('error retrieving pass, please try again in little while.'); }, true, { headers: { "author

Display UIProgressbar With Percentage in iOS -

i new ios developement. want display uiprogressbar percentage on screen in ios. any appreciated. as vlad mentioned can have method updates value of progressview , associated label. call following method when update happens. - (void)updateprogress { cgfloat stepsize = 0.1f; [self.progressview setprogress:self.progressview.progress+stepsize]; self.progresslabel.text = [nsstring stringwithformat:@"completed : %.0f",self.progressview.progress*100]; }

Django and wkhtmltopdf working fine from Python shell but not from URL -

call([wkhtmltopdf_command_path, html_file_url, pdf_file_path]) the above command generates pdf in specified location when run python shell. when url, gets stuck show below loading pages (1/6) 10%

objective c - ObjC: can't subclass NSUserNotification -

as title says, can't subclass nsusernotification . well, can write , compile subclass can't subclassed objects @ runtime: if create instance of subclass , test class @ runtime _nsconcreteusernotification . why? you run class cluster . not subclassed, discussed here: http://www.mikeash.com/pyblog/friday-qa-2010-03-12-subclassing-class-clusters.html

angularjs - ngCordova plugin zip deosn't works with Android -

i spent entire day trying resolve problem. file downloaded , stored in device memory, unziped. // url of file download var url = "http://exapmle/someurl"; // file names var file = "aaa.zip"; $scope.contenutodownload = function () { // save location var targetpath = cordova.file.datadirectory + file; // use cordovafiletransfer store file in device storage $cordovafiletransfer.download(url + file, targetpath, {}, true).then(function (result) { console.log('file downloaded. ' + json.stringify(result)); $cordovazip .unzip( result.nativeurl, cordova.file.datadirectory ).then(function () { console.log('cordovazip success'); //delete zip file if(cordova.platformid == 'ios') { $cordovafile.removefile(cordova.file.tempdirectory,file); } else { $cordovafile.removefile(cordova

Google Chrome error help CSS error -

i have been getting error google chrome saying : failed load resource: server responded status 404 error. i linked path correct folder in cloud 9 project, there project same format current 1 , works fine. using semantic ui have it? the error code: https://job-ayub.c9users.io/stylesheets/main.css resource: server responded status of 404 (not found) on other project got similar error , fixed changing link href="/sylesheets/main.css"> error handled , fine until opened new project , tried same fix didn't work. <html> <head> <title></title> <link rel="stylesheets" text="type/css" href="stylesheets/main.css"> </head> <body> </body> css use easy sublime why different c9.io ? okay solved problem if using express , node.js should use app.use(express.static('_dirname')); in app.js file. creating path directly css fil

ruby - Sinatra with Kaminari: cannot load such file -- kaminari/sinatra -

i want realize pagination in sinatra kaminari. gemfile looks this: source "https://rubygems.org" gem "sinatra" gem "activerecord", :require => "active_record" gem "mysql2" gem "padrino-helpers" gem "kaminari", :require => "kaminari/sinatra" my sinatra config.ru has bundler.require . however, passenger displays following error: cannot load such file -- kaminari/sinatra i don't know what's wrong. there not documentation kaminari sinatra, , bit found was: "you need padrino-helpers , require kaminari/sinatra". , that's did. sinatra (~> 1.4.0) depends on rack (1.5.2), while kaminari (~> 0.13.0) depends on rack (~> 1.2.1). , since kaminari began experimental support sinatra since version 0.13.0, there appears impasse.

javascript - Complex object data structure to xlsx -

i have javascript object contains in other objects: { "10": {}, "12": { "20": { "value": 1, "id": 1, }, "100": { "value": 12, "id": 1, } }, "14": { "100": { "value": 14, "id": 2, } }, "16": {}, "18": {}, "20": { "100": { "value": 23, "id": 1, }, "150": { "value": 56, "id": 3, } }, "22": {}, "24": {}, "26": { "50": { ... i want export xlsx file, have issues doing so. i have resorted @ using js-xlsx not helpful regarding it's documentation, , alasql . creating such file simp

python - Can't access variable from another class? -

here code class a(): def __init__(self): self.say_hello = "hello" def donea(self): print "a done" class b(a): def __init__(self): print self.say_hello def doneb(self): print "b done" = a() b = b() a.donea() b.doneb() when run error attributeerror: b instance has no attribute 'say_hello' you need add call super in constructor of class b, otherwise say_hello never created. this: class b(a): def __init__(self): super(b, self).__init__() print self.say_hello def doneb(self): print "b done" if you're doing in python 2 (which apparently based on print statements), you'll have make sure you're using "new style" class instead of old-style class. having a class inherit object , so: class a(object): def __init__(self): self.say_hello = "hello" def donea(self): print "a done" class

Facebook Login Button Retrieving Wrong User Email Sometimes -

i have social network called recommendation book , using facebook , google plus login buttons register users first time click button , log them second time click button. other day talking girl , showing website , tried register on website using facebook login button , system logged in user's account, instead of registering her. sure bug facebook made facebook system return email person , wondering if issue @ of facebook login button log users in wrong account. pasting code, mobile version, , wanna ask if there wrong on code, working, make facebook system return user's email user tried login? issue @ facebook login button logging users in wrong account? <script type="text/javascript"> <!-- $(document).ready(function(){ $(".spinnertr").hide(); }); function mytrim(x) { return x.replace(/^\s+|\s+$/gm,''); } function setcookiesrb(id) { var date = new date(); date.settime(date.gettime() + (365 * 24 * 60 * 60 * 10

SVG and rectangle line thickness in Safari? -

Image
i experiencing issue safari 9.0.2 on macos x 10.11, seems draw lines in svg thicker in other browsers on same computer. can't tell whether need tweak in svg settings or whether issue safari. note not seem impact regular lines. a screen capture of seeing: and code use generate it: https://jsfiddle.net/ajmas/jh3144b3/ or essential code (using snap svg): centerx = snap.node.clientwidth / 2; centery = snap.node.clientheight / 2; (i=0; i<8; i++) { width = 20 + (i*20); height = width; snap.rect(centerx - width/2, centery - height/2, width, height).attr({ 'stroke': 'black', 'stroke-width': + 'px', 'fill': 'none' }); } any insight appreciated.

php - How to store a piece of a name -

i'm trying store piece of first name split firstname can store in table. beginner @ php programming. appriciated, thanks. $names = 'donny p, raph rsa, leo old, laugh orange'; foreach ($fullnames $fullname) { $namesplit = explode(" ", $fullname); if ($names == empty($namesplit[0]) || empty($names)){ echo 'no first name here or no name @ all'; echo '<br>'; echo '<br>'; } elseif ($names == empty($namesplit[1])){ echo 'no last name here'; echo '<br>'; echo '<br>'; } else{ echo 'first name: ' . $namesplit[0]; echo '<br>'; echo 'last name: ' . $namesplit[1]; echo '<br>'; echo 'email address: ' . $namesplit[0] . $email; echo '<br>'; echo '<br>'; } } below i'm thinking of logically in

entity relationship model - Translating an EER diagram supertype into a database schema -

how go turning supertype 2 subtypes database schema? if have supertype person 2 subtypes, student , staff, how translate database schema? (they have id, name, , email address). i make table called person because if make table called stundent , staff if student staff @ same time? database become redundant. make table called person , assign students classes , staff there department.

ios - Unable to generate bundle inside static library -

i followed tutorial http://www.seifeet.com/2014/08/ios-coredata-as-static-library.html , error says bundle missing when try compiling. downloaded source , got same problem. the error got was: "error: /users/my_username/library/developer/xcode/deriveddata/sftwobuttonlayout-arwyiyjaammyrwcedmnwmvatexok/build/products/debug-iphonesimulator/sfdatamodels.bundle: no such file or directory" any appreciated.

Laravel 5.1 datatables reorder row -

i need help. i'm using yajra/laravel-datatables include datatables project. all working. now want use row reorder extension: https://datatables.net/extensions/rowreorder/ but when make drag , drop row seems work, not working. i think possible reloaded because use ajax url load data, unmaking reorder do. possible? well, these codes: controller: /** * display listing of resource. * * @return \illuminate\http\response */ public function index() { $med = new medicinas; return view('admin.medicinas.index', ['med' => $med->get()]); } /** * process datatables ajax request. * * @return \illuminate\http\jsonresponse */ public function anydata() { return datatables::of(user::select('*'))->make(true); } routes: route::get('administrator/medicinas', [ 'as' => 'admin.medicinas', 'uses' => 'medicinascontroller@index' ]); route::controller('administ

php - Tackle specific Array Key -

i not php expert or intermediate means. i trying assign couple of html spans post title in wordpress page.php one span added first word of title , other span should apply rest of rest of title. started code, got me half way there: <?php $words = explode(' ', the_title('', '', false)); $words[0] = '<span class="bold-caption">'.$words[0].'</span>'; $title = implode(' ', $words); echo $title; ?> as can see first key of array has first spam assigned. i can't manage assign other rest of title. how can accomplish this? thank in advance. you're close...i'd unset() first item after adding span around it, implode() rest, , concatenate: <?php // split title array of words $words = explode(' ', get_the_title()); // create new title, first word bolded $newtitle = '<span class="bold-caption">' . $words[0] . '&

html - Keeping 3 Floating Divs Center Stacked -

i have 3 divs inside of body, , need them stay centered @ times, without overlapping. i post link page being hosted locally testing purposes. body { background-color: #c8dbdd; background-image: url("http://www.splashpage.dev/wpcontent/uploads/2016/01/splashbackground.jpg"); background-position: center center; display:inline-block; } #title { left: 50%; top: 50%; /* bring own prefixes */ transform: translate(-50%, -50%); margin-top: 80px; margin-bottom: 20px; display:block; position:absolute; display:inline-block; } .carousel { left: 50%; top: 50%; /* bring own prefixes */ transform: translate(-50%, -50%); height: 210px; width: 950px; background-color: rgba(255, 255, 255, 0.24); position:fixed; padding: 10px; outline: #fff solid thin; display:table; clear:both; display:inline-block; } .text { font-family:'ubuntu', sans-serif; color: #ffffff; font-size: 12px; text-align:center; margin-bottom: 3px; line-height: 25

c# - Message BOX not showing up on InfoPath form -

the message box should appear when view switched on form screen comes blank? i'm not sure why. tried adding reference windows.forms well using microsoft.office.infopath; using system; using system.xml; using system.windows.forms; using system.xml.xpath; namespace form1 { public partial class formcode { public void internalstartup() { } public static dialogresult formevents_viewswitched(object sender, viewswitchedeventargs e) { string string1 = "error"; string string2 = "empty field found on form"; // set button of type "messageboxbutton" messageboxbuttons button = messageboxbuttons.yesno; // static method, referenced without object using class return (messagebox.show(string1, string2, button)); } } } you should use following messagebox.show("display error message text here", "title appears on messagebox here", m

sql - how to get row having least value from a table in mysql -

i have written mysql query comprising couple of joins, , result follows. id | title | type | rent ------------------------------ 1 abc low 100 2 xyz low 200 2 xyz mid 150 2 xyz high 300 3 mno low 600 3 mno mid 200 i have result group ( group by ) title having 'least rent'. plz help. i have following result set id | title | type | rent ------------------------------ 1 | abc | low | 100 ------------------------------ 2 | xyz | mid | 150 ------------------------------ 3 | mno | mid | 200 ------------------------------ you can this: select t1.* tablename t1 inner join ( select title, min(rent) minrent tablename group title ) t2 on t1.title = t2.title , t1.rent = t2.minrent; sql fiddle demo this give you: | id | title | type | rent | ---------------------------- | 1 |

javafx - java fx printing simple form document -

i'm writing simple application in java fx main ability print form i've created in scene builder (some labels plus textfields can fill user , print button in bottom of page). have ideas how can write this?i read printerjob class i'm not sure how use properly.maybe there better ways achieve goal? regards as have said printerjob starting place of javafx printing. follow documentation: https://docs.oracle.com/javase/8/javafx/api/javafx/print/printerjob.html and here few more examples: http://www.programcreek.com/java-api-examples/index.php?api=javafx.print.printerjob

IntelliJ IDEA: Running a shell script as a Run/Debug Configuration -

is there way shell script can invoked intellij run/debug configurations? i found out can invoke shell script of bashsupport plugin.

memory management - C++ new allocates more space than expected -

i trying test c++ app behavior when memory requirements high, seems cannot use of available ram. have following program: class node { public: node *next; }; int main() { int i=0; node *first = new node(); node *last = first; //should 120000000 * 8 bytes each -> approx 1 gb (i=0; < 120000000; i++) { node *node = new node(); node->next = 0; last->next = node; last = last->next; } (i=0; < 120000000; i++) { node *oldfirst = first; first = first->next; delete oldfirst; } delete first; return 0; } it supposed allocate approx 1 gb of data , because node class occupies 8 bytes. ve verified via sizeof, gdb, valgrind. this program allocates 4 gb of data! if double size, ( 120000000 -> 2400000000 ), there 2 options (my laptop has 8gb of ram installed): if have turned off swap area, process killed kernel. if not, paging takes place, , os be

Google Docs: Table of content page numbers -

we building application on google cloud platform, generates reports in google doc. them, important have table of content ... page numbers. know feature request since few years , there add-ons (paragraph styles +, didn't work us) provide solution, butt considering build ourselves. if has suggestion on how start this, great help! thanks, best bet file feature request on product forums. currently way level of manipulation of doc provide custom toc use apps script. provides access document structure sufficient enough build , insert basic table of contents, i'm not sure there's enough paging correctly (unless force page break on ever page...) there's no method answer question of "what page element on?" hacks writing docx , converting don't work because tocs recognized , show without page numbers. of course write docx or pdf toc you'd , upload blob rather google doc. can still viewed in drive , such.

django - AWS: CodeDeploy for a Docker Compose project? -

my current objective have travis deploy our django+docker-compose project upon successful merge of pull request our git master branch. have done work setting our aws codedeploy since travis has builtin support it. when got appspec , actual deployment part, @ first tried have afterinstall script docker-compose build , have applicationstart script docker-compose up . containers have images pulled web our postgresql container (named db , image aidanlister/postgres-hstore usual postgres image plus hstore extension), redis container (uses redis image), , selenium container (image selenium/standalone-firefox ). other 2 containers, web , worker , django server , celery worker respectively, use same dockerfile build image. main command is: cmd paver docker_run which uses pavement.py file: from paver.easy import task paver.easy import sh @task def docker_run(): migrate() collectstatic() updaterequirements() startserver() @task def migrate(): sh('./manag

javascript - Move a character with touch buttons in unity -

i creating mobile game in unity android devices , scene sprites, 2d game. know input.getaxis() can move character desktop apps. need know how axis horizontal movement , info , assign mobile button you need use unity ui system eventsystem . create canvas , unityui.button s want (an eventsystem , object should created), add eventtrigger component button want control movement , hook onpointerdown (and onpointerup if want) event function script. (list of events: http://docs.unity3d.com/manual/supportedevents.html ). in function can put logic of controlling player / movement. this demonstrated in 1 of unity's learning videos @ https://unity3d.com/learn/tutorials/modules/beginner/ui/ui-events-and-event-triggers .

c - how to create a union -

i made mistake while using union,and don't know why. problem in function goto_xy(); read book, cannot compiled. in function trying locate cursor, regs variable not declared. want know function. #include<stdio.h> #include<windows.h> #include<dos.h> #include<conio.h> void goto_xy(int x,int y); //goto key word;define subfunction creat original cursor int coordinate system void rectangle_clear(int x1,int x2,int y1,int y2); //define rectangle_clear opening subfunction void center_clear(int x1,int x2,int y1,int y2); //define center_clear opening subfunction void creat(); //define subfunction of creating star int main() //the main function { creat(); getch(); center_clear(0,25,0,79); getch(); } void center_clear(int x1,int x2,int y1,int y2) //the subfunction creats stars while opening project { int x00,y00,x0,y0,i,d; if((y2-y

Swift: NSTimer, delay hiding UIButton with each tap -

i have button (actually 2 identical buttons) unhide action in uiview. the buttons hide automatically 2 seconds after panning in second uiview ends using dispatch_after keep buttons visible if either tapped while visible. here timer property , 2 methods uibutton subclass. have @ibaction calls "justtapped" in viewcontroller. var timer = nstimer() func hideandshrink(){ if !self.hidden && !timer.valid{ self.hidden = true } } func justtapped(){ timer.invalidate() timer = nstimer.scheduledtimerwithtimeinterval(2.0, target: self, selector: "hideandshrink", userinfo: nil, repeats: false) } once either button tapped, not hide. is timer still valid while calls method in selector? the answer this, luk2302, yes, timer valid when sends selector how can around this? as suggested, wrote second method timer hid buttons without !timer.valid ? it turned out did not need second method @ had attempt hide buttons call justtapped inst

ios - OpenGL ES Texture Not Rendering -

i attempting render texture plane opengl es on iphone. have worked opengl before i'm not sure why isn't working. when run code plane rendered black square , not textured square. believe problem may when loading texture although see no errors when run code. hopefully spot problem , able help. in advance. here code mesh. // mesh loading - ( id ) init { if ( self = [ super init ] ) { glgenvertexarraysoes( 1, &m_vertexarray ); glbindvertexarrayoes( m_vertexarray ); glgenbuffers( 1, &m_vertexbuffer ); glbindbuffer( gl_array_buffer, m_vertexbuffer ); glbufferdata( gl_array_buffer, sizeof( g_vertices ), g_vertices, gl_static_draw ); glgenbuffers( 1, &m_texcoordbuffer ); glbindbuffer( gl_array_buffer, m_texcoordbuffer ); glbufferdata( gl_array_buffer, sizeof( g_texcoords ), g_texcoords, gl_static_draw ); } return self; } - ( void ) render { glbindbuffer( gl_array_buffer, m_vertexb