Posts

Showing posts from February, 2012

c++ - Lifecycle of an OpenGLAppComponent in Juce -

i can't seem grasp on how these openglappcomponents come , go. can please correct thinking if wrong? object created inheirts openglappcomponents , timer. object exists in audioprocessoreditor. call initialise() (this attach openglcontext? timer started.) addandmakevisible(&my_gl_appcomponent); called editor, telling drawn. my_gl_appcomponent.setbounds(...) called specifying size , location of gl component. the timer callback calls repaint() repeatedly, updating display. when editor closed, call shutdown(), detach openglcontext. delete my_gl_component, calling shutdownopengl() in destructor we free open editor again, goto 2. am missing anything? have things? i've been trying find cause of gl_invalid_framebuffer_operation error second day in row , i'm getting pretty frustrated.

how create windows global variables in c# winform -

(at first use c# winform , .net framework4) is there way create class library (dll) static variables , variable programs concurrent (and static variables not reset each program). more explain: for example create dll static variables , install on gac add reference of tow program. now want set variables in program1 , variables on program2. how can that? basically can accomplish storing value in storage accessible different programs using process process comunication mechanism (ipc mentioned @slaks) storages comes mind are: database, windows registry, settings file process process communication may wcf, or system.io.pipes, or others: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365574(v=vs.85).aspx it depends on needs. performace critical? need infrom other process value has changed, or other process request value? how many processes access value @ same time?

Play Framework Java 2.3.8 - JSon -

im trying json object mock. when compile got error : error: package org.json not exist in c:\workspace\tutorial\app\controllers\application.java:18 15import models.device; 16import models.task; 17 18import org(.)json.jsonarray; --> error 19import org.json.jsonexception; 20 21import play.data.form; 22import play.db.ebean.model; 23import play.mvc.controller; this code: public static result index() throws jsonexception, ioexception { jsonarray json = readjsonfromurl("http://htejera.ukelelestudio.com/mock/dmamock/devices/android"); return ok(index.render(json.tostring())); } private static string readall(reader rd) throws ioexception { stringbuilder sb = new stringbuilder(); int cp; while ((cp = rd.read()) != -1) { sb.append((char) cp); } return sb.tostring(); } public static jsonarray readjsonfromurl(string url) throws ioexception, jsonexception { inputstream = new url(url).openstream(); try { ...

asp.net - Why my DevExpress v14.1 doesn't have the GridViewEdittingMode component? -

according official document of devexpress : https://documentation.devexpress.com/#aspnet/devexpresswebgridvieweditingmodeenumtopic , assembly contains gridvieweditingmode component should devexpress.web.v14.1.dll. however, tried add reference, still said gridvieweditingmode not exist. hash code of devexpress.web.v14.1.dll sha256 cfde95612ba9d4a771dd0236d95a8a1881be983dc72985205e36134ca37d1075. worse still, don't have project converter in computer, nor devexpress provide v14.1 trial anymore. is there 1 knows how make gridvieweditingmode component available in devexpress v14.1 based project? looks faced breaking change ( some classes related devexpress asp.net controls have been moved devexpress.web namespace ). so, namespace gridvieweditingmode enumeration implemented changed devexpress.web.aspxgridview devexpress.web. following code should work you. var grid = html.devexpress().gridview(settings => { settings.name = "gridview"; // code s...

java - Hibernate: Unable to load class -

caused by: org.hibernate.boot.registry.classloading.spi.classloadingexception: unable load class [com.mysql.jdbc.driver] http://www.tutorialspoint.com/hibernate/hibernate_quick_guide.htm i'm following hibernate guide , i'm getting error knows why? thanks help. you need grab mysql connector jar here , add classpath. perhaps /lib folder if using maven, try including <dependency> <groupid>mysql</groupid> <artifactid>mysql-connector-java</artifactid> <version>5.1.6</version> </dependency> in pom.xml

python - Storing MD5 digest in Postgres -

i'm generating md5 digests python so: import hashlib m = hashlib.m5() md5 = m.update('some_string') return md5.digest() now, looking @ a similar question , see should use bytea type. however, plan using above snippet generate these digests, although i'm open modifying it. there should aware of being sending off db assuming have field of type bytea? proper way of storing digests? might redundant question, wanted sure. i'm storing md5s of files , planning on using hash unique identifier; nothing mission critical.

linux - docker container started in Detached mode stopped after process execution -

i create docker container in detached mode following command: docker run [options] --name="my_image" -d container_name /bin/bash -c "/opt/init.sh" so need "/opt/init.sh" executed @ container created. saw container stopped after scripts finish executed. how keep container started in detached script/services execution @ container creation ? there 2 modes of running docker container detached mode - mode execute command , terminate container after command done foreground mode - mode run bash shell, terminate container after exit shell what need background mode. not given in parameters there many ways this. run infinite command in detached mode command never ends , container never stops. use "tail -f /dev/null" because quite light weight , /dev/null present in linux images docker run -d --name=name container tail -f /dev/null then can bash in running container this: docker exec -it name /bin/bash -l if...

SQL Server Stored Procedure Multiple Condtions -

i have linq in c#, have convert sql query. , not sure how multiple filtering based on conditions: var geofencereport = companycontext.geofencesimplereports.where(x => x.entertime != null && x.exittime != null && x.minutesingeofence != null).asqueryable(); if (model.geofenceid != -1) { geofencereport = geofencereport.where(x => x.igeofenceid == model.geofenceid).asqueryable(); } if (model.assetid != -1) { geofencereport = geofencereport.where(x => x.iassetid == model.assetid).asqueryable(); } if (model.categoryid != -1) { geofencereport = geofencereport.where(x => x.icategoryid == model.categoryid).asqueryable(); } if (model.siteid != -1) { geofencereport = geofencereport.where(x => x.isiteid == model.siteid).asqueryable(); } geofencereport = geofencereport .where(x => x.entertime >= model.startdatetime && x.entertime <= model.enddatetime) .asquery...

jQuery FileUpload with Laravel and NOT autoupload -

i'm having lot of problems jquery fileupload autoload turned off. need submitted in 1 request--not multiple. have had 3 days of fighting , lots of research. have feeling i'm missing 1 thing. here's got: jquery: $(function(){ var ul = $('#upload ul'); // initialize jquery file upload plugin $('#entry_form_doc').fileupload({ type: 'post', url: 'leadresources/submitdoc', limitmultifileuploads: 5, autoupload: false, dropzone: $('#drop'), add: function (e, data) { //fired click of button. $("#submit_doc").unbind('click').on('click', function(){ data.formdata = {files: data.originalfiles}; data.submit(); }); }, fail:function(e, data){ // has gone wrong! data.context.addclass('error'); } }); }); this laravel gets when print_r() log: [2015-03-16 14:27:27] production.info: array ( [lb_id] => ...

android - Minko - getElementById causes runtime exception to be thrown: TypeError: Minko.tmpElement is null -

i using minko , html-overlay feature. in overlay onload()->connect() method have following statements: ... gameinterfacedom = dom; but1 = gameinterfacedom->getelementbyid("id_but1"); //trouble here ! but2 = gameinterfacedom->getelementbyid("id_but2"); log_info("going bind onclick events..."); if( but1 != nullptr ) { onbut1 = but1->onclick()->connect( [](dom::abstractdommouseevent::ptr event) { // something... log_info("clicked button 1"); }); } if( but2 != nullptr ) { onbut2 = but2->onclick()->connect( [](dom::abstractdommouseevent::ptr event) { // something... log_info("clicked button 2"); }); } ... compiling , running under linux64 works if loaded html not contain but1 , but2 ids, however, same code crashes android , web / html5 (if expected ids not found) following error : exception thrown: typeerror: minko.tmpelement null is ther...

php - Additional fields in ORM-ManyToMany relation -

i have following tables data: users , groups. in database relation between 2 entities manytomany, because many users can in many groups , many groups can have many users. simple. created code , works: user entity: /** * @orm\entity * @orm\table(name="users") */ class user extends baseuser { /** * @orm\id * @orm\column(type="integer") * @orm\generatedvalue(strategy="auto") */ protected $id; /** * @orm\manytomany(targetentity="group", inversedby="users") * @orm\jointable(name="users_in_groups") */ protected $groups; } group entity: /** * @orm\entity * @orm\table(name="groups") */ class group { /** * @orm\id * @orm\column(type="integer") * @orm\generatedvalue(strategy="auto") */ protected $id; /** * @orm\manytomany(targetentity="user", mappedby="groups") */ protecte...

java - Spring Boot and Spring Data application with multiple DataSources created in runtime -

i developing spring boot application uses spring data jpa , need connect many different databases e.g. postresql, mysql, ms-sql, mongodb. need create datasources in runtime i.e. user choose these data gui in started application: -driver(one of list), -source, -port, -username, -password. , after writes native sql choosen database , results. read lot of things in stack , spring forums(e.g. abstractroutingdatasource) of these tutorials show how create datasources xml configuration or static definition in java bean. possible create many datsources in runtime? how manage transactions , how create many sessionfactories? possible use @transactional annotation? best method this? can explain me how 'step step'? hope it's not late answer ;) i developed module can integrated in spring project. uses meta-datasource hold tenant-datasource connection details. tenant-datasource abstractroutingdatasource used. here find core implementation using abstractroutingdatasour...

mysql - Error 1215: Why is it happening? -

i confused why error 1215: cannot add foreign key constraint occurring in code. have ideas? the first 4 tables create fine, error thrown when try create stars table. not sure what's going wrong, keys being referenced primary keys , must unique , non-null. plus, keys exist previous tables have been created first. might stupid mistake made, better have fresh eyes @ it, right? this database simplistic because i'm doing school assignment. create table movieexec ( execname varchar(40), certnum numeric(30, 0), address varchar(50), networth real, primary key(execname), unique key(certnum) ); create table stud ( studname varchar(30), address varchar(50), prescnum numeric(30, 0), primary key(studname), foreign key (prescnum) references movieexec(certnum) ); create table moviestar( starname varchar(30), address varchar(50), gender varchar(1), birthdate date, primary key(starname) ); create table movies ( movietitle varchar(30), movieyear numeric(4,0), length numeric(...

.net - VC++ Winforms passing member function as argument to BackgroundWorker -

being beginner, struggling syntax here. making generic backgroundworker avoid making separate workers each of many tasks in application. unable figure out how pass member function runworkerasync() here dowork method's code: private: system::void backgroundworker2_dowork(system::object^ sender, system::componentmodel::doworkeventargs^ e) { func<int> ^func = (func<int>^)e->argument; e->result = func(); } let's want bg worker run function named myfunc. want this: runworkerasync(myfunc) while myfunc member of same class i.e form1 it isn't clear me hangup might be, syntax create func<> isn't different way subscribe dowork event. sample code: ref class example { backgroundworker^ worker; void ondowork(system::object ^sender, system::componentmodel::doworkeventargs ^e) { auto job = safe_cast<func<int>^>(e->argument); e->result = job(); } int myfunc() { return 42;...

Dropzone becomes inactive when used in AngularJS ng-view -

i have controller displays images via template passed through ng-view , runs smoothly. have dropzone , running , working smoothly. however, add dropzone template dropzone no longer active. displays (the zone isn't clickable unless manually add dz-clickable, still nothing). i add dropzone in ng-include above area , have hidden when template looking elsewhere have heard ng-include uses more processor ng-view prefer keep together. i have seen there dropzone angularjs directive have not managed merge controller gets placed ng-view or if successful? here directive: (function(){ angular.module('dropzone', []) .directive('dropzone', function() { return function(scope, element, attrs) { element.dropzone({ url: "/upload", maxfilesize: 100, paramname: "uploadfile", maxthumbnailfilesize: 5, init: function() { scope.files.push({file: 'added'}); // here works thi...

vb.net - How to make changes in Ribbon elements of a single excel instance, using application-level add-in? -

i'm using vsto vb.net excel 2013. i'm developing application-level add-in, can't make 2 different workbooks store different "ribbon state". example, when want enable button, use following code: globals.ribbons.ribbon1.mybutton.enable = false this makes element "mybutton" disabled on each opened workbook, want make disabled 1 workbook. the way i'm doing handle event workbookactivate, change ribbon state. problem is: way, user sees invalid state @ other workbooks not on top. there better workaround? there isn't way manage ribbon instances (and not global element doing)? thanks there better workaround? there isn't way manage ribbon instances (and not global element doing)? you need use callbacks instead. try use getenabled callback instead. moreover, when required can use iribbonui interface methods force office applications update ui controls. invalidate method invalidates cached values of controls of ribbon use...

echo a random name from a list, vbscript -

i'm new programming, , want make program randomly selects name or sentence list in vb script. here list jacob james jason caleb ashlee john so program need choose random name list if there help, appreciate it, thanks there no built-in method require in vbscript. have implement own below. also, might want check these out: randomize statement rnd function array function ubound function lbound function randomize function randomwithinrange(min, max) randomwithinrange = int((max - min + 1) * rnd() + min) end function function randitemfromarray(arr) randitemfromarray= arr(randomwithinrange(lbound(arr), ubound(arr))) end function dim names names = array("jacob", "james", "jason", "caleb", "ashlee", "john") msgbox randitemfromarray(names)

Error when send mail in java using javamail? -

i want use javamail test code public class test_mail { public static void main(string [] args) { string to="xyz@gmail.com";//change accordingly //get session object properties props = new properties(); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.socketfactory.port", "465"); props.put("mail.smtp.socketfactory.class", "javax.net.ssl.sslsocketfactory"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.port", "465"); session session = session.getdefaultinstance(props, new javax.mail.authenticator() { protected passwordauthentication getpasswordauthentication() { return new passwordauthentication("abc@gmail.com","*****"); } }); //compose message try { mimemessage message = new mimemessage(session); message.setfrom(new internetaddress("abc@gmail.com"));//change a...

opencart2.x - How to change Opencart product tooltip language? -

Image
so here mouse hover tooltip. change language. i've installed language, not change. suggestions on how change it? to change text have edit following file: catalog/language/english/english.php anyway if want change other text, of them here: catalog/language/english/ in case of want change text appeared in "best seller" module have edit: catalog/language/english/module/bestseller.php in case of want change text appeared in "latest" module have edit: catalog/language/english/module/latest.php regards,

swift - How do I align a button under a label in Xcode 6? -

Image
i'm watching stanford's cs193p lectures itunes u , first demo has been calculator. in second lecture, professor aligns buttons bottom edge of display label using black grid line appears. how enable grid line, know buttons directly below label? i'm having same issue. resize label remove previous fix , set manually height value as: 38 , blue line appears.

css - Why does the navbar change position when using the dropdown menu? -

i've troubles navigation bar website. position of navigation bar changes when dropdown menu becomes visible. when resizing browser navigation bar change. ofcource not intention. please can me? appreciated much. this css code i'm using. /*main menu*/ .nav-top {list-style:none; } ul.nav-top ul { margin-top:-40px; margin-bottom:-50px; margin-left:-21px; margin-right:-50; position: relative; display:none; } ul.nav-top li { display:inline-block; padding:40px; margin-right:19px; position:relative; } ul.nav-top li:hover> ul { display:block; } ul.nav-top li { display:block; text-decoration:none; border-bottom: 2px solid transparent; } ul.nav-top a:hover{ color:#686a6a; border-bottom:2px solid #e4e4e4; } /*sub menu*/ ul.nav-top ul ul { clear:both; border: solid 1px ffffff; } ul.nav-top li li { display:block; /* introducing padding between li , give il...

python - Multiprocessing : More processes than cpu.count -

note : "forayed" land of multiprocessing 2 days ago. understanding basic. i writing , application uploads amazon s3 buckets. in case file size larger( 100mb ), ive implemented parallel uploads using pool multiprocessing module. using machine core i7 , had cpu_count of 8 . under impression if pool = pool(process = 6) use 6 cores , file begins upload in parts , uploads first 6 parts begins simultaneously. see happens when process greater cpu_count , entered 20 (implying want use 20 cores). surprise instead of getting block of errors program began upload 20 parts simultaneously (i used smaller chunk size make sure there plenty of parts). dont understand behavior. have 8 cores, how cant program accept input of 20? when process=6 , use 6 threads?? can explanation of 20 being valid input there can 1000s of threads. can please explain me. edit: i 'borrowed' code here . have changed wherein ask user core usage choice instead of setting parallel_processe...

git - Merge from upstream with no upstream history -

i have parent repo containing project, , sub repo based off project. the parent repo has tagged releases, , sub repo based off 1 of these tags. example: parent v1.0---v2.0---v3.0 \ child---[changes] unfortunately when child repo created, parent history removed , repo reinitialised files added scratch. means none of parent repo's history contained within child repo, rather, 1 commit @ start indicate based off parent's v2.0 tag of v2.0 files git add ed. is there way use git merge upstream changes parent (eg. v3.0 tag) child despite there being no parent history? git pull tells me there no common commits, doesn't know start merging guess. need rewrite history of child add parent's history back? obviously weird scenario , not 1 allow in future :) then suggest rewrite history of child repo have full history v2.0 backwards. i assume branch called master in both repos. so first add remote parent repo , fetch it ...

asp.net mvc - How do I inject Identity classes with Ninject? -

i'm trying use usermanager in class, i'm getting error: error activating iuserstore{applicationuser} no matching bindings available, , type not self-bindable. i'm using default startup.cs, sets single instance per request: app.createperowincontext(applicationdbcontext.create); app.createperowincontext<applicationusermanager>(applicationusermanager.create); i'm able applicationdbcontext instance, believe getting injected owin (is true?): public class genericrepository<t> : igenericrepository<t> t : class { private applicationdbcontext context; public genericrepository(applicationdbcontext context) { this.context = context; } } but can't same usermanager (it throws error shown before): public class anunciosservice : ianunciosservice { private igenericrepository<anuncio> _repo; private applicationusermanager _usermanager; public anunciosservice(irepositoriogenerico<anuncio> repo, appl...

javascript - Customize Modal Height and Width in CSS Media Print Queries -

i have modal generated jquery ui library( http://jqueryui.com/dialog/#modal-form ). want print dialog using css media print queries. this code: $("#mypreview_modal").dialog({ autoopen: false, draggable: true, height: 520, modal: true, resizable: false, width: 525, buttons: { "print": function() { //initialize elements unprintable $('body').children().addclass('donotprint'); myid_print_id($('.printthis')); }, "close": function() { $( ).dialog( "close" ); } } }); html code of modal (#mypreview_modal) generated jquery ui library: <div class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-dialog-buttons ui-draggable" tabindex="-1" role="dialog" aria-describedby="mypreview_modal" aria-labelledby="u...

c++ - How to add strings to the combo box in MFC -

i working on mfc , want add strings combo box. unlike adding in data (hard coding in properties of combo box in resource view), want add them string table , c++ code has load string. please give suggestions. - add combo box dialog control - right click combo box , goto class wizard , add member variable of type ccombobox [control varable] -this add ddx_control entry - call variable_name.addstring add strings combo box @ runtime. - if want use strings string table use loadstring load string string table first. - call variable_name.addstring again ... .... have cleared doubts ???

java - Selenium Webdriver cannot choose a value in a dropdown list -

i trying implement selenium webdriver using java . basically, have website blank field. once user click on field, drop-down list 5 options appear , user should choose 1 option. the codes this <!-- language: lang-html --> <div class="default-form w-border scheduleaddfrom" style="display: block;"> <div> <div class="section frameless nopadding nomargin" data-form-element="sectionheading" style="min-width: 100%;"> <div class="section-body frameless nopadding nomargin"> <div class="default-form"> <div class="form-row required-message hidden" style="min-height: 25px;"> <div class="form-row print-avoid-page-break" data-form-element="fieldedit" style="min-height: 25px;"> <label for="">department</label> <input id="schedule-00-row136153aa-9fa8-499b-8458-2b155443223be-taskid-display" cl...

visual studio - Configuring Development Storage Account in Server Explorer -

i have changed ports azure storage emulator runs on 10000,10001,10002 10003,10004,10005 config file @ "c:\program files (x86)\microsoft sdks\azure\storage emulator\wastorageemulator.exe.config" now when try access development storage server explorer in visual studio 2013 fails access updated ports. tried manually add external storage , specify endpoints reflect updated ports following info default storage account information: defaultendpointsprotocol=http accountname=devstoreaccount1 accountkey=eby8vdm02xnocqflquwjpllmetlcdxj1ouzft50usrz6ifsufq2uvercz4i6tq/k1szfptotr/kbhbeksogmgw== blobendpoint= http://127.0.0.1:10003/devstoreaccount1 queueendpoint= http://127.0.0.1:10004/devstoreaccount1 tableendpoint= http://127.0.0.1:10005/devstoreaccount1 but still not allow connect. tried same endpoints without storage account suffix. reverts ports 10000,10001,10002 when refresh external storage. assume reading config somewhere cannot seem google answer being read fr...

javascript - How to make dynamic chain of middleware in express.js -

i working on project develop api manager control existing api. it contains list of "before" , "after" middlewares, used things security checking , logging. , "service" middleware http request existing api. problem want make order middleware being executed dynamic, meaning load configuration file change order middleaware executed every time request comes in. here previous code: 'use strict'; // loading express library var express = require('express'); var app = express(); var service = require('./routes/index'); // testing configurable middleware var confirguration = { before1: { priority: 100, enable: true }, before2: { priority: 80, enable: true }, service: { priority: 50, enable: true }, after1: { priority: 30, enable: true }, after2: { priority: 10, enable: true } } var before1 = require('./exa...

c++ - Node-gyp build and rebuild error on centos -

getting below error when trying build node-gyp build node-gyp build gyp info worked if ends ok gyp info using node-gyp@1.0.2 gyp info using node@0.10.35 | linux | x64 gyp info spawn make gyp info spawn args [ 'buildtype=release', '-c', 'build' ] make: entering directory /root/node-latest-install/build' cxx(target) release/obj.target/binding/binding.o ../binding.cc:5: error: iso c++ forbids declaration of ‘functioncallbackinfo’ no type ../binding.cc:5: error: expected ‘,’ or ‘...’ before ‘<’ token ../binding.cc: in function ‘void add(int)’: ../binding.cc:7: error: no matching function call ‘v8::handlescope::handlescope(v8::isolate *&)’ /root/.node-gyp/0.10.35/deps/v8/include/v8.h:473: note: candidates are: v8::handlescope::handlesco pe(const v8::handlescope&) /root/.node-gyp/0.10.35/deps/v8/include/v8.h:448: note: v8::handlescope::handlesco pe() ../binding.cc:9: error: ‘args’ not de...

git - Is there an alternative to a "push" hook? -

bitbucket, github , other services tend have "push" hook, when push code repository, service can hit url (possible on production server), telling pull latest code. the problem is, if have number of servers in cloud (which come in , out based on load), not have way of knowing how many servers in cloud @ given time, cannot configure urls "push" to. there alternative way? is there way instead have production servers hit url on github, bitbucket etc, , check if need update ? not specific 1 service, because imagine if 1 service has of them will. don't know "feature" called. the push event of github webhook allows repository server (github) contact repository clients (your servers in cloud) but if doesn't work, have 2 approaches: have 1 dedicated repo client (one dedicated server of yours) contacted github webhook, , know servers on cloud available , need contacted. or switch pull approach server on cloud periodically git pull , ...

c# - htmlAgilityPack parse table to datatable or array -

i have these tables: <table> <tbody> <tr><th>header 1</th></tr> </tbody> </table> <table> <tbody> <tr> <th>header 1</th> <th>header 2</th> <th>header 3</th> <th>header 4</th> <th>header 5</th> </tr> <tr> <td>text 1</td> <td>text 2</td> <td>text 3</td> <td>text 4</td> <td>text 5</td> </tr> </tbody> </table> i trying transform array or list using code: var query = table in doc.documentnode.selectnodes("//table").cast<htmlnode>() row in table.selectnodes("tr").cast<htmlnode>() header in row.selectnodes("th").cast<htmlnode>() cell in row.selectnodes("td").cast<htmlnode>() select new { ...

html - Open a tabbed window in Chrome using javascript -

Image
is there way open tabbed window(a window tabs) in chrome using javascript? when open new window following: window.open( "http://google.com", "google", "width=800,height=600" ); the window has no tabs, so: sadly no, if call window.open event callback act same way link target "_blank" opening new tab or window depending on user settings of browser. if call anywhere else open new window non-editable address bar , not respect of settings pass it. not sure if it's bug or feature there isn't documentation on can find explaining reasoning.

ios - Resize UIImage is inverting the orientation -

i'm trying resize uiimage when this, uiimage changing orientation. original image in vertical when resize image's orientation horizontal - (uiimage *)resizeimage:(uiimage*)image newsize:(cgsize)newsize { cgrect newrect = cgrectintegral(cgrectmake(0, 0, newsize.width, newsize.height)); cgimageref imageref = image.cgimage; uigraphicsbeginimagecontextwithoptions(newsize, no, 0); cgcontextref context = uigraphicsgetcurrentcontext(); // set quality level use when rescaling cgcontextsetinterpolationquality(context, kcginterpolationhigh); cgaffinetransform flipvertical = cgaffinetransformmake(1, 0, 0, -1, 0, newsize.height); cgcontextconcatctm(context, flipvertical); // draw context; scales image cgcontextdrawimage(context, newrect, imageref); // resized image context , uiimage cgimageref newimageref = cgbitmapcontextcreateimage(context); uiimage *newimage = [uiimage imagewithcgimage:newimageref]; cgimagerelease(newim...

c# - How can I open a Microsoft Word document from within a winforms .exe app? -

i have winforms app utilizes dll (docx) create .docx document stringbuilder. i'm trying open document microsoft word (the default program) button click. tried folowing code keep getting errors. can point me in right direction accomplish this? private void button3_click(object sender, eventargs e) { var x = ""; using (docx document = docx.create("testdocx.docx")) { document.margintop = 25f; document.marginbottom = 25f; document.marginleft = 25f; document.marginright = 25f; paragraph p = document.insertparagraph(); fontfamily fontfamily = new fontfamily("courier new"); p.append(sb.tostring()).font(fontfamily).fontsize(8); //where "sb" stringbuilder document.save(); x = environment.currentdirectory; } processstartinfo startinfo = new processstartinfo(); startinfo.filename = @"...

wpf - C# "Controls" Does Not Exist in The Current Context -

error in application i'm trying use "controls.add", visual studio keeps giving me error: "error 1 name 'controls' not exist in current context c:\users\admin\desktop\demo\demo\mainwindow.xaml.cs 42 13 demo" using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using system.windows; using system.windows.controls; using system.windows.data; using system.windows.documents; using system.windows.input; using system.windows.media; using system.windows.media.imaging; using system.windows.navigation; using system.windows.shapes; namespace demo { /// <summary> /// interaction logic mainwindow.xaml /// </summary> public partial class mainwindow : window { public mainwindow() { initializecomponent(); } private void button_click(object sender, routedeventargs e) { window1 window = new wi...

user interface - Vaadin: How to Limit length of ComboBox filtering value -

suppose have combo-box allowed input. want limit input, example user can enter 10 characters . how can it? thanks. current combobox maxlength support this feature not supported combobox, in same way available childrean of abstracttextfield abstracttextfield.setmaxlength(int) however issue recognized shortcoming of vaadin combobox , there ticket created in vaadin trac issue management system: when combobox.setnewitemsallowed(true), there not method set maxlength input (like textfield.setmaxlength(int)). suggested method: combobox.setmaxlength(int maxlength); if company has vaadin support subscription, can vote issue implemented. implementing custom solution since combobox not support functionality out of box, need implement yourself, if need it. way use vaadin extensions extend existing combobox component functionality required. here resources start extensions: vaadin blog - extending components in vaadin 7 vaadin wiki - creating ui extension...

Creating a Function Representation for Environments in SML -

okay, working on creating function representation environments in sml: type name = string type 'a fenv = name -> 'a i'm little stuck on how proceed this. first thing need define value fenvempty of type 'a fenv, represents empty environment (the environment not bind names). far, have this: val fenvempty = let fun empty (name) = ??? in empty end i'm not sure if i'm on right track or anything. supposed return function empty? putting in 0, null, or none won't work. later, have write functions returns data associated particular name in environment (a find function), , function binds data particular name in environment ( bind function), i'm stuck on fenvempty part. i presume teacher wants raise exception when attempting unbound value: type name = string type 'a fenv = name -> 'a exception unboundname of name fun fenvempty name = raise unboundname name but think more if first try use versi...

Get and display data from server using ajax -

i'm trying learn ajax i'm having difficult time. i have java servlet give me data db, , i'm trying make simple web page continuously asks update every 5 seconds, , displays without having reload page. don't want on ready state change, once every 5 seconds. // xmlhttp = xmlhttprequest object function process() { try { if (xmlhttp.readystate==4 || xmlhttp.readystate==0) { xmlhttp.open("get",'localhost:8080',true); //handleserverresponse(); // data server. not on ready state change, ? setinterval('process()', 5000); } else { settimeout('process()', 5000); } } catch (e) { alert('main process did not work'); alert(e.tostring()); } } i unsure of how accomplish this. what's missing ? the following steps involved getting data server. make ajax request object , open connection and send request server the serve...