Posts

Showing posts from April, 2015

Create VM in Microsoft Azure using JAVA -

i want create vms in microsoft azure using java rest api. this, getting access token using microsoft login credentials passing below values: grant_type: client_credentials, client_id: {my_client}, client_secret: {my_client_secret}, resource:{http://localhost} then getting big access key. calling create vm rest api using access key. unauthorised error below. "code": "invalidauthenticationtokenaudience", "message": "the access token has been obtained wrong audience or resource 'http://localhost'. it should match (including forward slash) 1 of allowed audiences ' http://localhost ',' http://localhost '." how correctly call microsoft azure authentication , create vm using java? there way achieve authorization through certificate? steps? it seems might use incorrect urls azure resource management. according the offical example in java create vm , can see urls below in code comment requesting access tok...

uwp - Is there any way to customize the template of tile? -

Image
now implement live tile on uwp application. i found tile template on msdn( https://msdn.microsoft.com/en-us/library/windows/apps/hh761491.aspx?f=255&mspperror=-2147217396#versions ) i want change style of template such text size. in investigation, didn't find way change template of tile. there way change that? or there way use custom template? string tilexmlstring = "<tile>" + "<visual>" + "<binding template='tilewide310x150smallimageandtext04'>" + "<image id='1' src='ms-appx:///images/tile-sdk.png'/>" + "<text id='1'>text id 1</text>" + "<text id='2'>text id 2</text>" + "</binding>" + "</visual>...

Undecimated discrete wavelet transform using Matlab and Python -

Image
loosely based on above figure: i need make array this: array = [(image),(1,ll),(1,lh),(1,hl),(2,ll),(2,lh),(2,hl)] here, image numpy 2d array, , rest other array items components obtained undecimated discrete wavelet transform, 2d arrays. for eg, (1,ll) level 1 component,channel low-high (2,hl) level 2 component, channel high-low with python 2.7, simple. udwt = np.asarray(pywt.swt2(image, 'haar',2)) array = [image, udwt[0][0] , #1,ll udwt[0][1][0], #1,lh udwt[0][1][1], #1,hl udwt[1][0] , #2,ll udwt[1][1][0], #2,lh udwt[1][1][1]] #2,hl however, unable in matlab. udwt = ndwt2(image,2,'haar'); components found in udwt.dec ( dec field of udwt structure), 1 7 . creating parallels python code: python matlab udwt[0][0] question udwt[0][1][0] udwt.dec{5} udwt[0][1][1] udwt.dec{6} udwt[1][0]...

Enable resolutions not exposed by display programmatically on NVIDIA GPUs -

i'm working on solution there need set custom resolution particular connected displays on set of systems. have works fine, long "enable resolutions not exposed display" option has been checked manually through nvidia control panel (found under display -> change resolution > customize... > enable resolutions not exposed display). is there way enable option programmatically, preferably through nvidia's core sdk - nvapi . setting custom resolutions can enabled through changedisplaysettingsex function, exposed windows api, passing in cds_enable_unsafe_modes fourth parameter dwflags . (to disable, use cds_disable_unsafe_modes .) code extract exemplifying usage: dword deviceindex = 0; display_device displaydevice = { 0 }; displaydevice.cb = sizeof(display_device); while (enumdisplaydevices(null, deviceindex, &displaydevice, 0)) { deviceindex++; devmode devicemode = { 0 }; devicemode.dmsize = sizeof(devmode); if (!enumdisp...

javascript - Delay inside for loop not working -

i want make delay inside for loop, won't work. i've tried ways on stackoverflow, none of them work want. this i've got right now: var iframetimeout; var _length = $scope.iframes.src.length; (var = 0; < _length; i++) { // create closure preserve value of "i" (function (i) { $scope.iframevideo = false; $scope.iframes.current = $scope.iframes.src[i]; $timeout(function () { if ((i + 1) == $scope.iframes.src.length) { $interval.cancel(iframeinterval); /*change right animation class*/ $rootscope.classess = { pageclass: 'nextslide' } currentid++; /*more information resetloop @ function itself*/ resetloop(); } else { i++; $scope.iframes.current = $scope.iframes.src[i]; } }, $scope.iframes.durationvalue[i]); }(...

javascript - Comparing two dates Angularjs -

i'm working on piece i'm required calculate difference in time, e.g event has occurred on 22 jan , today 27th jan, want compare 2 dates , display "5 days ago". i'm getting event date json data in timestamp format. clue in how compare todays date , display 'days ago' logic you can use momentjs , it's diff function. usage: moment().diff(moment|string|number|date|array); example: var = moment([2007, 0, 29]); var b = moment([2007, 0, 28]); var difference = a.diff(b, 'days') just include script in index.html (or else include them), include moment in controller using regular dependency injection.

javascript - Plotly.js adds top-margin to graphs inconsistently, how to prevent it -

Image
with plotly.js i'm getting top-margin added (not consistently), total height of graph 300px, graph 150px high. svg container stretched , actual graph smaller. can prevent white-space, , why show selectively? plotly matlab syntax results in 300px div instead of 300px graph: `% plot mean movement data = {... struct(... 'x', nscan, ... 'y',fastmotion, ... 'type', 'scatter')... }; if max(fastmotion) < 0.3 yminval = 0.3; else yminval = round(max(fastmotion) + 1); end layout = struct(... 'yaxis', struct(... 'title', 'movement (mm)', ... 'range', [0, yminval])); header{3} = 'absolute movement'; layout.width = 800; layout.height = 300; p = plotlyfig; p.data = data; p.layout = layout; p.plotoptions.filename = 'plot_5'; html_file = plotlyoffline(p); html_file;` so app...

xml - Integration test DBUnit NoSuchTableException Java -

when start test have nosuchtableexception . need set same name of in-memory data base in production ? @runwith(springjunit4classrunner.class) @contextconfiguration @testexecutionlisteners({ dependencyinjectiontestexecutionlistener.class, dirtiescontexttestexecutionlistener.class, transactionaltestexecutionlistener.class, dbunittestexecutionlistener.class }) @databasesetup(type = databaseoperation.clean_insert, value = "login.xml") public class logincontrollertest { private mockmvc mockmvc; @before public void setup() { mockmvc = mockmvcbuilders.xmlconfigsetup("logincontrollertest-context.xml").build(); } @test @expecteddatabase("login.xml") public void testshowform() throws exception { mockmvc.perform(get("/login")).andexpect(status().isok()).andexpect(view().name("/login")) .andexpect(forwardedurl(...

http headers - gwan v7.12.2 mime type handlers not work -

i made handler html.c in folder of handlers #include "gwan.h" // g-wan exported functions #include <stdio.h> int main(int argc, char *argv[ ]) { char header[ ] = //"content-type:text/html; charset=utf-8\r\n" "access-control-allow-origin: *\r\n" "cache-control:private, max-age=600000000\r\n" "expires: thu, 31 dec 2037 23:55:55 gmt\r\n" ; http_header(head_add, header, sizeof(header) - 1, argv); char *req = (char*)get_env(argv, request); // query: "start=200000" printf("req: %s\n", req); return 200; } please help. what's wrong of code, since gwan won't generate additional headers accordingly. edit: did try cache.c example. won't generate "expires" headers too. there's subtil issue caused system api replacement in recent releases excludes one content-type handler if h...

jquery - TinyMCE - Adding Event Listeners Issue -

i'm stuck on understanding how setup event handlers tinymce editors. post may long, apologies. i'm reading on this post , want do: i may instantiating tinymce editor instances in way confusing me extending it's power. on sites, have editors doing simple, bare-bones work. , i'm on page want reflect onkeyup changes displayed in <div id="displayhtml"> (similar sof doing) here typically have in pages: <html> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="tinymce_configs.js"></script> </head> <body> <div id="displayhtml"></div> <textarea name="notecomments" id="notecomments" tinymce="tinymce_basic" style="width:650px;height:555px;"></textarea> <script language="javascript" type="text/javascript"> $(doc...

ssh - Send UI to bakcground and get back UI of an application in linux -

i'm running linux vm, os rhel 6.5, i'll access machine via putty(ssh) , i'll use export display option run gui app's. i've java application , have jar's, run application i'll use below command in putty. java -dcms.console.available=false -dcms.user="username" -dcms.password="password" -jar launcher.jar when launch application in command prompt, i'll ui(if want run app background process i'm using '&' @ end of command, in case i'll ui), after getting ui i'll select options in ui ui load full components. requirement: i want send ui in background , should ui back(foreground ui) when ever want, there way achieve this? i've tried nohup & screen didn't worked, , googled no hlep found. please me in this. thanks in advance. fg , bg this: the posix standard specifies 2 commands resuming suspended jobs in background , foreground, respectively bg , fg. these modeled afte...

javascript - Throttle my page scroll so it only skips one slide -

seems such easy fix cant seem it. need throttle or debounce scroll in javascript slide skips next slide. @ moment counting number of times scroll clicks , scrolls many slides. using revolution slider on wordpress site. i have current code make slide use on mouse scroll skip next slide. (function() { // change "revapi1" here whatever api name slider uses (see notes below) var slider = revapi1; slider.parent().on('mousewheel dommousescroll', function(event) { if(event.originalevent.wheeldelta > 0 || event.originalevent.detail < 0) { slider.revprev(); } else { slider.revnext(); } }); })() but can see problem on www.bladeworks.co.za/blade_website_new skips slides dependent on mouse scrolls done. is there anyway can edit code make skip 1 slide , go next one? i appreciate help. function throttle(fn, threshhold, scope) { threshhold || (threshhold ...

saving array of images with UIImagePNGRepresentation memory warning swift -

i'm capturing randomly-sized/shaped sections of uiview , saving disk using uiimagepngrepresentation. files save expected, when run on device, dreaded "received memory warning", though i'm doing saving files in loop , not displaying them: uigraphicsbeginimagecontextwithoptions(bbox.size, false, 0) cgcontextsetfillcolorwithcolor(uigraphicsgetcurrentcontext(), uicolor(red: 1.0, green: 0.0, blue: 0.0, alpha: 0.25).cgcolor) cgcontextaddrect(uigraphicsgetcurrentcontext(), cgrectmake(0, 0, bbox.width, bbox.height)) cgcontextfillpath(uigraphicsgetcurrentcontext()) let strokeimage = uigraphicsgetimagefromcurrentimagecontext() let strokefile = "stroke_\(strokebezierarraymemory.count).png" let datapng = uiimagepngrepresentation(strokeimage) let fileurl = folderurl!.urlbyappendingpathcomponent(strokefile) //println("\(fileurl)") if (datapng.writetourl(fileurl, options: .atomicwrite, error: &error) ) { //println ("wrote \(fileurl)") } e...

c# - An entity can only be attached as modified without original state if it declares a version member or does not have an update check policy -

i hope can me. issue have been battling days now, , struggling resolve it. i have read quite bit on specific error, , seems there couple ways resolve it. have unfortunately not been able to. my error lies on line: sourcecontext.projectmasters.attach(project, true); i error: entity can attached modified without original state if declares version member or not have update check policy. i have read , tried (where possible) following solutions: entity attachment issues in linq update check' issue when updating entity using datacontext attach method system.invalidoperationexception: entity can attached modified and more ... it seems problem lies in this; not updating unchanged record. however, far can see , understand, record changed. i sure simple doing wrong, , perhaps need set of new eyes on it. please remember; newbie :) thank patience. private class projectmastersidentifier { public int id { get; set; } pub...

java - spring 4 enums as controller parameters -

later edit the case described works properly. problem appears when have on controller's method: @restcontroller public class mycontroller { @requestmapping(...) public void mymethod(@requestbody myform myform) { ... } } public class myform { private x x; //setters , getters } cause given requestbody, spring use httpmessageconverter deserialize request body instance of given type. in case, use mappingjackson2httpmessageconverter json. converter not involve propertyeditorsupport @ all. any alternatives? need use @requestbody in case or find way put x myform . i want put enum parameters inside rest controller's method. this i've got far. the enum: public enum x { a("a"),b("b"),c("c"); ... methods , constructors ... } the controller: @restcontroller public class mycontroller { @requestmapping(...) public void mymethod(@pathvariable("x") x x) { ... } } the configuration: @controlle...

javascript - Division produces NaN -

i'm trying divide variable number 100 , nan . i'm new jquery, can me understand i'm doing wrong? $.each(data.products, function (i, data) { var div_data = "<p>" + data.title + "<br/>" + data.description + "</p>"; div_data += '<img src="' + data.imageurl + '" title="loading..." alt="loading...">'; div_data += '<p><a href="' + data.url + '">buy</a></p>'; $(div_data).appendto("#testjson"); number = '<div class="number">' + data.price + '</div>'; $('#myelement').text((number / 100)); }); first you're setting number string: number = '<div class="number">'+ data.price + '</div>'; then dividing string 100 in javascript results in nan short not number . specified in spec . a possibl...

php - How to login in magento site from CI site and vice versa? -

i have 2 site on same(ci , magento) domain , placed magento site in ci root. want login both site @ time i.e. when try login ci site login magento site , vice versa. you shouldn't place 2 sites in same root, ci , magento 2 different entities need own space work fine. now if want behaviour (logging ci logs in magento , vice versa), have make specific development achieve it. you need locate function called in magento logs in , add piece of code logs in ci site. then need locate function called in ci site logs in , add piece of code logs in magento site. it should hard achieve, might contain security holes , in end, might not viable solution @ all.

database - Delete and refresh a record in DBgrid where u maintain the same position -

i have small database i'm using dbgo, have dbgrid displaying records, need know how delete record , refresh database index arrow stays in same position or @ least go next? index arrow jump start form beginning each time refresh ! just keep , reset recno var i:integer; ....... := ads.recno; ads.delete; ads.recno := i; an example implementation usage dbnavigator be procedure deleteandkeeprecno(ads: tcustomadodataset); var rn: integer; begin rn := ads.recno; ads.delete; ads.recno := rn; end; procedure tform4.dbnavigator1click(sender: tobject; button: tnavigatebtn); begin if button = nbdelete begin deleteandkeeprecno (tcustomadodataset(tdbnavigator(sender).datasource.dataset)); abort; end; end;

jquery - Bootstrap popover title option do not override the html element title -

i'm initializing bootstrap's popovers this: $(document).on("click", ".print-barcode", function () { $(this).popover({ html: true, container: 'body', title: '<strong>some other title</strong>', content: '<div class="form-group per60">' + '<div class="input-group">' + '<input class="form-control print-quantity" type="text" placeholder="бр" value="1" >' + '<div class="input-group-btn">' + '<button class="btn btn-default print-barcode-send" >' + '<span class="glyphicon glyphicon-print"></span>' + '</button>' + '</div>' + '</div>' + '</d...

javascript - no attribute '_meta' error when trying to run method to delete a row from a URL called by .get() -

it's part of project in django framework. in javascript file i'm writing code segment .get() url e.g. /delete/student/<id_of_student> . . . $.get($(this).attr('href'), location.reload(true), function(data){ alert("put in bin !!"); }); . . when called , urls.py mapped function put row in trash_bin , page row deleted after reload. but in runserver console it's throwing error like: concrete_model = model._meta.concrete_model attributeerror: type object 'builtin_function_or_method' has no attribute '_meta' but in console.log showing correct url, /delete/student/123. here's trash part models.py : class trashaction(models.model): user = models.foreignkey(user) timestamp = models.datetimefield() def __unicode__(self): return "%d items %s on %s" % (self.trashitem_set.count(), self.user, self.timestamp.strftime('%y-%m-%d %h:%m')) class trashitem(models.model): j...

express - What makes my information get deleted from `memcached` -

currently using memcached + connect-memcached + express-session have user information stored temporarily during lifecycle. but found user information got delete fast have no idea why? happened following: login username , password, user info should stored 7 days due express-session config cookie: { maxage: 86400000 * 7 } after login, leave mouse , keyboard while(may 1 minute) try click on webpage requires user info while digging node code, have sessionid cause set in cookie, , memcached returned nothing key kill me. i didn't find document behavior, can help? i'd know why information deleted it's not expired? i've given 2000 -m option memcached could't find documentation described it(i thought should memory usage).

internationalization - What is the best method/tool to merge two .po translation files one old and one new with replace? -

i want merge 2 .po files , produce new .po file. assume many people deliver different translation need merge one. first want replace old translation in .po file new 1 other .po file , produce new merge file use batch or gui. how it? second want merge 2 .po files , decide manually in gui translation best if conflict , add new translation on empty translation. how it? please solution since question trivial spend many time find suitable tool without result. you can use translate toolkit pomerge

Pinterest style layout iOS storyboards -

Image
i want create design :- i using storyboards , cannot make thing work. have simple collection view of , works fine except cells show twice. there way can achieve not using library , having random heights cells? this storyboard :- mycollectioncontroller public mycollectioncontroller(intptr handle) : base(handle) { } public override void viewdidload () { base.viewdidload (); data = makedataforrecyclerview(pageindex); } public override nint numberofsections (uicollectionview collectionview) { return 1; } public override nint getitemscount(uicollectionview collectionview, nint section) { return data.length; } public override void itemselected (uicollectionview collectionview, nsindexpath indexpath) { var message = string.format ("you clicked on {0}!", cell.title); new uialertview ("clicked", message, null, "okay", null).show (); } public override uicollectionviewcell getcell (uicollectionview collectionview, nsind...

c - How to get product information from remote controller ir(infrared) data? -

i have remote controller of aircon , have succeed in extracting ir data of power button. ir data following: 0x26 0x00 0xf8 0x00 0x00 0x01 0x13 0x89 0x12 0x11 0x12 0x34 0x13 0x33 0x13 0x10 0x13 0x33 0x13 0x11 0x11 0x34 0x14 0x11 0x11 0x35 0x12 0x10 0x13 0x10 0x13 0x11 0x11 0x35 0x13 0x33 0x13 0x34 0x13 0x10 ..... on , on. want make c program of getting product information of remote controller ir data of power button. , want other buttons' ir datas also. more specifically, want make program find out information of product , infrared code of other buttons power button's ir datacode only. if possible, how can it? thanks. you may search irmp ir multi protocol decoder. micro controllers has command line tool can take decoded ir strings (you may record more , reformat them) , shows details detected protocol (and data (ids , keycode)). however - information product not retreived. never searched if there database in web collects such data. edit: eng...

android - How to determine if one of my activities is in the foreground -

i have implemented broadcastreceiver triggered alarmmanager. alarmmanager initialized on boot_completed. have declare receiver in manifest. my problem want broadcastreceiver when none of own activities in foreground (aka user not interacting application). pull information remote server , don't want notify user if in application anyways. so far have not managed find way determine if application in foreground. there way such thing? activitymanager tells me if application running not whether in foreground. the problem pretty same described here: inform activity broadcastreceiver if in foreground solution: after evaluating several solutions want outline think best method deal activities in background/foreground. the preferred way register broadcast receiver in onresume method of activity , deregister on activities on onpause. service or other background element need send broadcast intent specific action activity intercept. if activity in foreground have intent receive...

windows - win32_shadowcopy Unsupported shadow copy context -

the result of entering get-wmiobject -list win32_shadowcopy).create("c:\","backup") command powershell is returnvalue : 5 shadowid : {00000000-0000-0000-0000-000000000000} however clientaccessible type of win32_shadowcopy available creation , accessible in file system after mklink /d . makes me feel confused. , need non-persistent, auto-release type of shadow copy full read/write capabilities created during operation... backup type satisfyingly meets these requirements. reason .create() job end such error? creating shadow copy using "backup" context in powershell not helpful while trying figure out roots of issue. a return value of 5 means access denied. running administrator?

base64 encode PHP generated image without writing the image to disk -

i'm generating image in php use in users avatar. i start hashing username , doing hexdec() conversion on various substrings of hash build set of rgb colours. //create image $avatarimage = imagecreate(250, 250); // first call imagecolorallocate sets background colour $background = imagecolorallocate($avatarimage, hexdec(substr($hash, 0, 2)), hexdec(substr($hash, 2, 2)), hexdec(substr($hash, 4, 2))); //write image file $imagefile = 'image.png'; imagepng($avatarimage, $imagefile); //load file contents , base64 encode $imagedata = base64_encode(file_get_contents($imagefile)); //build $src datauri. $src = 'data: ' . mime_content_type($imagefile) . ';base64,' . $imagedata; ideally i'd not use intermediate step , skip writing image out onto disk, although i'm not sure how best implement this? i've tried passing $avatarimage directly base64_encode() expects string doesn't work. any ideas? you can use output buffering cap...

types - How to fix constraint on a collection of case class in Scala -

is there way have constraint on collection of case class. in case, want ensure elements in collection have same value first property. here sample of code express mean case class in[t](values : set[t]) trait case object a1 extends case object a2 extends case class element(k: a, v: string) in(set(element(a1, "xxx"), element(a1, "xxx"))) // should compile in(set(element(a1, "xxx"), element(a2, "xxx"))) // should not compile is acceptable solution you? case class in[t](values : set[t]) trait case object a1 extends case object a2 extends case class element[t <: a](k: t, v: string) in(set[element[a1.type]](element(a1, "xxx"), element(a1, "xxx"))) // should compile in(set[element[a1.type]](element(a1, "xxx"), element(a2, "xxx"))) // should not compile

Preventing Firebase deletions -

i've written small single page javascript application (for internal company use) hosted on s3 , uses firebase datastore. i'm aware devious hacker find way delete data in firebase if determined enough using javascript console. none of data in application should ever deleted. what firebase rules can use ensure data cannot deleted authorised user? possible? thanks yup, that's simple: ".write": "!data.exists() || newdata.exists()" so can write if there's either no data @ location or if you're writing new data.

algorithm - What does stack[-1] mean in a pseudocode? -

def _all_simple_paths_graph(g, source, target, cutoff=none): if cutoff < 1: return visited = [source] stack = [iter(g[source])] while stack: children = stack[-1] child = next(children, none) if child none: stack.pop() visited.pop() elif len(visited) < cutoff: if child == target: yield visited + [target] elif child not in visited: visited.append(child) stack.append(iter(g[child])) else: #len(visited) == cutoff: if child == target or target in children: yield visited + [target] stack.pop() visited.pop() i find code on link . but did not understand statements, following children = stack[-1] // stack[-1] mean? child = next(children, none) // child list or children list? stack = [iter(g[source])] // iter ? if child none: // guess if child empty (child list). visited = [source] // that? yield visited + [target] // yield? can ex...

c# - x64 application is not attaching to Visual studio isolated shell -

i have sample c# application, when attach application vs isolated shell 2013 debugging, working fine when application platform target x86. but failing attach vs isolated shell when application platform target x64 error message showing when attaching x64 application unable attach process. debugger not installed. run setup install or repair debugger does vs isolataed shell support x64 application debugging? if how can fix issue?

css - Background image doesn't work after assets precompile in RAILS4 production environment -

i have following mixin in application.css.scss file : @mixin inputwithicon($iconname) { padding: 4px 4px 4px 20px; border:1px solid #ccc; text-indent: 0.30em; font-size:15px; font-weight:100; background: #ffffff url(assets/input/#{$iconname}.png) no-repeat; background-position: 2% center; } this mixin works on development after precompiling assets , running in production stops working (background isn't set). i tried using image-url instead of url , didn't work. background: #ffffff asset-url("assets/input/#{$iconname}.png") no-repeat; -- in sass, use asset-url ; scss asset_url . either way, need use above helper when assets fingerprinted through precompilation , correct file being referenced pre-processor. the problem have url calls static filename. whilst not problem on own, when deploy app, , precompilation occurs, need make sure css referencing correct filename, hence helper.

java - apache poi add table in word document -

Image
i have java code create table , text word document using apache poi adds table in last document. want write text, add table , write text again. currently adds table first , last document add 2 test (hi & bye) my code : public static void main(string[] args)throws exception { //blank document xwpfdocument document= new xwpfdocument(); //write document in file system fileoutputstream out = new fileoutputstream( new file("create_table.docx")); //create table xwpftable table = document.createtable(); xwpfparagraph para = document.createparagraph(); xwpfrun run = para.createrun(); run.settext("hi"); //create first row xwpftablerow tablerowone = table.getrow(0); tablerowone.getcell(0).settext("col one, row one"); tablerowone.addnewtablecell().settext("col two, row one"); tablerowone.addnewtablecell().settext...

php - How to update joinData in cakephp 3 the correct way -

trainers belongstomany customers both trainerstable , customerstable use user entity class. i want able update _joindata between 1 trainer , customers. users +----+-------+--------------------+ | id | level | email | +----+-------+--------------------+ | 1 | 30 | trainer@site.com | | 2 | 10 | customer@site.com | | 3 | 10 | customer2@site.com | +----+-------+--------------------+ trainers_users +----+------------+-------------+--------------------------+ | id | trainer_id | customer_id | trainer_note | +----+------------+-------------+--------------------------+ | 1 | 1 | 2 | customer | | 1 | 1 | 3 | | +----+------------+-------------+--------------------------+ trainerstable below <?php namespace app\model\table; use app\model\entity\user; class trainerstable extends table { public function initialize(array $config) { $this->table('user...

ios - How to show MenuController of UICollectionViewCell? -

how reproduce copy paste function of say, messages on iphone, if long press on message, message cell goes gray-ish , little pop-up "copy" shows up. how can show same menu on uicollectionviewcells? as turns out functionality built in , simple implementing 3 collectionview: delegate methods. created protocol copyablecell property called copyableproperty , string cell wants copy clipboard, cells can copy must follow. straightforward on: func collectionview(collectionview: uicollectionview, shouldshowmenuforitematindexpath indexpath: nsindexpath) -> bool { if let _ = collectionview.cellforitematindexpath(indexpath) as? copyablecell { return true } return false } func collectionview(collectionview: uicollectionview, canperformaction action: selector, foritematindexpath indexpath: nsindexpath, withsender sender: anyobject?) -> bool { if action.description == "copy:" { return true } return false } func ...

html - Horizontally & Vertically centering 2 divs within two side by side 50% width columns -

having trouble getting 2 divs center horizontally & vertically within respective parents side side 50% width , 100% height. here's i've got (codepen ease). codepen link *** html *** <div class="parent"> <div class="left"> <div class="info"> <h1>this div should centered <br>within left 50%</h1> <h2>get in touch:</h2> <h1> +44 (0)1323 567 891<br> +44 (0)1323 132 363<br> info@somecompany.co.uk<br> </h1> </div> </div> <div class="right"> <div class="img-wrapper"> <img src="http://placehold.it/210x210/fe5000/fff"/> </div> </div> </div *** css *** .parent { height: 100%; width: 100%; } .parent:before, .parent:after { display: table; content: " "; } .parent:after { clear: both; } .left, .r...

How to add nodes at dynamic positions in Cytoscape.js? -

i using cytoscape draw group based diagram, have choose 'preset' layout came know need define positions in this, json dynamic database, how should generate positions , attached every single node. please show me correct path.. thanks define node.position each node, if want use preset layout (i.e. predefined positions). refer json spec . or, if want automatic positioning, use 1 of included layouts or layout extensions .

image - How to keep and remove multiple graphic objects in java swing applications? -

i have image , use pre-defined positions on create graphic objects colors . mouse click try create ovals on colors . couldn't achieve objective. because , when click on pre-defined position create oval on when click on pre-defined position first oval has gone. an oval can removed click on twice. have @ , public class printdialog extends javax.swing.jdialog{ private int count = 0; private int count_1 = 0; /** * creates new form printfeetdialog */ public printdialog(java.awt.frame parent, boolean modal) { super(parent, modal); initcomponents(); imagepanel panel = new imagepanel("areas.jpg"); this.getcontentpane().add(panel); this.setresizable(false); this.setlocationrelativeto(panel); this.pack(); } private void formmouseclicked(java.awt.event.mouseevent evt) { // todo add handling code here: system.out.println("print y - " + evt.gety()); ...

javascript - Set image in an input value -

i trying include img tag inside input's value attribute. using jquery: <input type="text" value="lorem impsum <img src='...'/>" /> i tried this: jquery(document).ready(function() { productinput = jquery('input[value=product]'); productinput.val(data.selecteddata.value + '<img style="width:128px" src="' + data.selecteddata.imagesrc + '" />'); }); but it's not working. so, know how can this? note: image inside value. you can set image putting image background of element for example html <input type="text" value="lorem impsum" class="default" /> css input.default{ background: url('../images/any.jpg') 0 0 no-repeat; } you can set css of element using jquery on document ready.

c++ - How to map to overload Qt slot -

i want overload qt slot either react emitted clicked() signal qpushbutton or statechanged(int) signal qcheckbox (since there no signal emits when checkbox checked only). so these 2 slots. void widget::sendcom(qstring data) { std::cout << "in scope of sendcom"<< std::endl; } void widget::sendcom(qstring data, int state) { std::cout << "in scope of overloaded sendcom: " << std::endl; } with widget->createbutton(slot(sendcom(qstring), data); call following , mapping works fine. void widget::createbutton(const char *member, qstring &data) { qpushbutton *button = new qpushbutton(this); signalmapper = new qsignalmapper(this); signalmapper->setmapping(button, data); connect(signalmapper, signal(mapped(qstring)), this, member); connect(button, signal(clicked()), signalmapper, slot(map())); ... } void widget::createcheckbox(const char *member, qstring &data) { } with widget->create...

c# - XAML - Changing the background image deletes the textbox -

i making windows 8 universal app. in order make hover effect, want change background image of stackpanel. stackpanel contains textblock, disappears change background image. here c# //creating background image var brush = new imagebrush(); brush.imagesource = new bitmapimage(new uri("ms-appx:/assets/newprojectblue.png")); //adding background panel panel.background = brush; //changing color of text paneltext.foreground = new solidcolorbrush(windows.ui.color.fromargb(1, 255, 255, 255)); and here xaml <stackpanel x:name="panel" horizontalalignment="left" height="90" margin="177,250,0,0" verticalalignment="top" width="355" background="#ffebeffe" rendertransformorigin="0.5,0.5" pointerentered="panel_pointerentered" pointerexited="panel_pointerexited"> <textblock x:name="paneltext" textwrapping="wrap" text="textblock" hor...

java - Action not found, why not? -

i have created action method below: public class nomenclatureaction extends actionsupport { // ... @actions({ @action(value = "ajaxdostuff", results = { @result(name = actionsupport.success, location = "success.jsp"), @result(name = actionsupport.input, location = "fail.jsp") }), @action(value = "index.action", results = { @result(name = actionsupport.success, location = "success.jsp"), @result(name = actionsupport.input, location = "fail.jsp") }) }) public final string dostuff() { // ... return actionsupport.success; } } i want call same method dostuff 1 of urls below: http://my-server.com/public/namespace/ajaxdostuff http://my-server.com/public/namespace/ajaxdostuff.action http://my-server.com/public/namespace/index http://m...

css - Why use an attribute selector to match classes? -

i have found an example of responsive email templates there such css selectors such following: a[class="btn"] why syntax used if it's totally same as: a.btn does have impact on mobile browsers or else? the [] syntax attribute selector . a[class="btn"] this select <a> tag class="btn" . however, not select <a> has class="btn btn_red" , example (whereas a.btn would). exactly matches attribute. you may want read the 30 css selectors must memorize . it's invaluable up-and-coming web developer.