Posts

Showing posts from September, 2013

dart - In AngularDart, how should I reference my templates in templateUrl so they work for both Dartium and dart2js? -

i have directory layout: project web app.html main.dart templates app.html alerts.html menu.html components appcomponent.dart alertscomponent.dart menucomponent.dart resources css bootstrap.css my components like: @component( selector: 'app', templateurl: 'templates/app.html' ) class appcomponent { ... } my application's index.html (in project) served /client , , project/web served /project . above works in dartium, errors pub build : [warning _serial on project|web/main.dart input project|web/components/appcomponent.dart]: line 3, column 1 of web/components/appcomponent.dart: unable find templates/app.html @ project|templates/app.html @component( ^^^^^^^^^^^ and [warning _serial]: unable find webatara|web/main.dart html_files in pubspec.yaml. and [warning templatecachegenerator]: can't fin

javascript - React-bootstrap accordion not working properly -

i'm trying learn react. giving go, experimenting react-bootstrap , trying implement accordion using react-bootstrap accordion. first tried using buttontoolbar, worked fine. var buttontoolbar = reactbootstrap.buttontoolbar; var button = reactbootstrap.button; var buttonsinstance = ( <buttontoolbar> <button>submit</button> <button>cancel</button> </buttontoolbar> ); react.rendercomponent( buttonsinstance, document.getelementbyid('app') ); but, react-bootstrap's accordion code wasn't working. showing contents not we've in case of accordion. here's code: var accordion = reactbootstrap.accordion; var panel = reactbootstrap.panel; var accordioninstance = ( <accordion> <panel header="collapsible group item #1" key={1}> content1 </panel> <panel header="collapsible group item #2" key={2}> content2 </pan

c# - resx files - remove default file with no language -

i've got app_globalresources folder different resource file per culture: resource.en-gb.resx resource.fr-fr.resx . . resource.resx it looks last resource.resx "default" file no language associated has exist there design. is there way rid of last default file without breaking code? yes, design. asp.net uses the thread.currentthread.currentculture , thread.currentthread.currentuiculture to identify present culture. looks resource file has associated culture in above property. if associated file not found then, fallback default language's resource. make sure file part of installer. good luck...

java - Using getPixel and setPixel to convert image into grayscale -

i new programming , need know how use getpixels convert image have grayscale.pls me: ( need image gallery, convert bitmap , start doing image processing. have 2 days left submission. need using getpixels. public class selectimageactivity extends activity implements onclicklistener { // image loading result pass startactivityforresult method. private static int load_image_results = 1; // gui components private button button; // button private imageview image;// imageview @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_select_image); // find references gui objects button = (button)findviewbyid(r.id.button); image = (imageview)findviewbyid(r.id.image); // set button's onclick listener object. button.setonclicklistener(this); } @override protected void onactivityresult(int requestcode, int resul

eclipse rcp - find matching 'begin' - 'end' and highlight them -

i newbie in developing dsl in xtext. add feature of highlighting matching start , end of code block. in language every function must start 'begin' , end 'end' , same if conditions , loops. need highlight matching/corresponding 'end' when cursor on 'begin'. example below, need highlight corresponding first 'end' when cursor on second 'begin': function x begin if a>b begin a=b; end end any please? thanks i dont think support good. if can live minor solution try following the grammar model: greetings+=greeting*; greeting: 'if' name=id 'endif'; in uimodule @override public icharacterpairmatcher bindicharacterpairmatcher() { return new mydslcharacterpairmatcher(new char[] { '(', ')', '{', '}', '[', ']' }); } with public class mydslcharacterpairmatcher extends defaultcharacterpairmatcher { public

jquery - How to Show selected value on textbox using javascript? -

how can show value of selected items in textbox using javascript? // list <select id="list" class="form-control" multiple=""> <option value="2014">your cute</option> <option value="2013">your ugly</option> <option value="2011">your awesome</option> </select> // button , textbox <button onclick="show_value();" type="button" value="get value">get value</button> <input type="text" id="selectedvalue" class="text" name="selectedvalue" /> i came javascript code function showgroup_id () { $('#selectedvalue').val(selectedvalue); var mylist = document.getelementbyid('list'); var selected-value = selecteditem; var selectedgroupids = []; (var = 0; < mylist.length; i++) { if (mylist[i].selected) { selectedselecteditem.push(myli

java - Getting NullPointerException calling methods on null values unmarshalled by JAXB -

i have xml file containing many tags. out of can missing. while reading such unmarshalled file using jaxb getting nullpointerexception missing tags. i know 1 solution can check whether object null or not. it's not convenient check null condition each , every tag because there many tags. if handle nullpointerexception handle exception not read xml further. is there efficient way handle situation(especially how rid of checking null each , every tag ?) request rqstr = binfo.getrequest(); system.out.println("requester comment : "+rqstr.getcomment()); system.out.println("requester request date : "+rqstr.getdate()); system.out.println("requetser doc id :"+rqstr.getdocid()); system.out.println("requetser response date : "+rqstr.getrespondbydate()); system.out.println("supplier check box : "+rqstr.issuppliercheckbox()); contact rqstrcontact = rqstr.getcontact(); **system.out.println("rqstr contact name : &q

php - Refresh time on via javascript (systemtime) -

i have own php loginsystem. users logged out after 5 min of inactivity. want show timer in right top corner display countdown. at moment using javascript. like (pseudo, haven't code here @ moment): var mytime = <?php echo time(); ?>; window.setinterval(mytime = mytime - 1; $("#timertext").text(mytime), 1000); but don't solution. use current system time (php) , subtract time, user active @ last. i found solution current system time via ajax. idea? what think realize counter? there smart solution? maybe other way?

c# - Constraints on parameter to implement two interfaces -

i'm trying understand workings of abap- oo . in c# possible restrict type type conform @ least (multiple) interfaces through constraints in generics doing: where t : iaminterfacea, iaminterfaceb is possible archive same in abap-oo? want pass in object parameter method conforms 2 interfaces. for example want have 2 interfaces: ivalidate isaveable i not want have interface combining methods 2 provide separately. for example there manager class wants save objects if they're valid: manager.save(/* <object conforms both interfaces ivalidate , isaveable> */ ); so if got simple class simpledata : ivalidate, isaveable objects of class passed method object class implements isaveable cannot passed in. in c# define save method generic method: static bool save<t>(t dataobject) t : ivalidate, isaveable { /* ... */ } how in abap-oo, if possible? in abap, have either create combining interface or check condition @ run-time (which not ad

join - SQL group by and sum on different tables/views -

i have 2 views, , b: +--------------+------------------+ | field | type | +--------------+------------------+ | id | int(11) unsigned | | vat_perc | numeric | | vat_amount | numeric | | project_id | numeric | | ... | +--------------+------------------+ i want third view c should have similar structure in vat_amount field should contain sum of vat_amounts grouped vat_perc , project_id 2 previous views. c: +--------------+------------------+ | field | type | +--------------+------------------+ | id | int(11) unsigned | | vat_perc | numeric | | vat_amount | numeric | | project_id | numeric | | ... | +--------------+------------------+ for example, let's contains +--------------+------------------+------------------+ | project_id | vat_perc | vat_amount | +--------------+--

Get underlying linq query for FirstOrDefault with Entity Framework 5 (Code First) -

i can log underlying query of linq query using tostring() method. string raw = query.where(..whatever..).tostring(); i need exact underlying query firstordefault() method query.firstordefault().tostring() because bad performance query , want analyze it. here tostring() method returns class name. is there possibility underlying query?

ruby - getting value of hash from params -

i know better way extract hash value params. params looks below (remember params name params[:ad_template]): {"name"=>"name", "description"=>"description", "tag_list"=>"software development", "objective"=>"video_view", "ad_creative_templates_attributes"=>{ "0"=>{"creative_template_id"=>"2430", "_destroy"=>"false"} }, "ad_target_templates_attributes"=>{ "0"=>{"target_template_id"=>"1526", "_destroy"=>"false"} } } now value of "creative_template_id" params. i being able value executing below code: params[:ad_template][:ad_creative_templates_attributes].first.second[:creative_template_id] which gives me value 2430 correct don't approach. know better solution extract value params. thanks. how about:

Can Vim apply shiftround to a block as a whole instead of linewise? -

i shiftround option in vim, there couple of situations doesn't work well. instance, take example: f(x, y) selecting 2 lines , shifting > , 2 lines selected gives me (and shiftwidth set 4): f(x, y) when wanted: f(x, y) in other words, vim advanced each line of block next tabstop, when wanted insert same amount of inserted on each line--but want least indented line end on next tabstop. is there easy way behavior in vim? goal have work < , > (with visual selection) rather other workarounds. ctrl+v , select vertical column before text need shift ( j in case of 2 lines), shift+i , insert needed number of tabs or spaces, esc . you can use method insert arbitrary text, example can insert # or // comment code. more info in :help blockwise-operators .

How to write rightclick method in selenium testng -

how rightclick on webelement selenium testng? have given example doubleclick, likewise need rightclick method.please give me best one. public static void doubleclickon(string objlocator1){ try { findwebelement(objlocator1); actions actions = new actions(driver); org.openqa.selenium.interactions.action action = actions.doubleclick(webelement).build(); action.perform(); app_logs.debug("double clicked on "+locatordescription); //system.out.println(locator); } catch(exception e) { e.printstacktrace(); app_logs.debug("fail : locator "+locator+" of description "+locatordescription+": not exists in webpage:"); reporting.fail("fail : locator "+locator+" of description "+locatordescription+": not exists in webpage:");

c++ - how to get glLookAt's values once rotated -

so if have code glulookat(0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); //set point looking @ glrotatef(-90, 0.0,1.0,0.0); how can each value of new gllookat you need go route of using glgetdoublev gl_modelview , gl_projection matrixes.

ios - unrecognized selector sent to instance XCODE -

i have dynamic table , when try start emulator, can't. exapmple , don't repair it. escarabajofeodoc *bug1 = [[escarabajofeodoc alloc] initwithtitle:@"escarabajo patatero" rating:4 thumbimage:[uiimage imagenamed:@"potatobugthumb.png"] fullimage:[uiimage imagenamed:@"potatobug.png"]]; escarabajofeodoc *bug2 = [[escarabajofeodoc alloc] initwithtitle:@"cienpiés" rating:3 thumbimage:[uiimage imagenamed:@"centipedethumb.png"] fullimage:[uiimage imagenamed:@"centipede.png"]]; escarabajofeodoc *bug3 = [[escarabajofeodoc alloc] initwithtitle:@"araña lobo" rating:5 thumbimage:[uiimage imagenamed:@"wolfspiderthumb.png"] fullimage:[uiimage imagenamed:@"wolfspider.png"]]; escarabajofeodoc *bug4 = [[escarabajofeodoc alloc] initwithtitle:@"mariquita" rating:1 thumbimage:[uiimage imagenamed:@"ladybugthumb.png"] fullimage:[uiimage imagenamed:@"ladybug.png"]]

windows - MFMEDIASOURCE_HAS_MULTIPLE_PRESENTATIONS MediaSource Characteristics -

i have implemented media source characteristics mfmediasource_can_pause | mfmediasource_can_seek. this working fine.seek , pause file working. now have added characteristic mfmediasource_has_multiple_presentations, after adding characteristic seek , pause not working. there other thing have take care? my current characteristic variable looks like, *pdwcharacteristics = mfmediasource_can_pause | mfmediasource_can_seek | mfmediasource_has_multiple_presentations; please give suggestion. best regards, sharad

jquery - popup windows doesn't open again when closed -

i've used popup window website.the popup window change password.. when fill data change password, works perfectly... given link popup as: <div id="abc"></div> <div> <a href="#" class="passwordlink" data-id=" model.profileview.password">change password</a> </div> the moment close popup using close button on right top [x], without filling data (suppose when mistakenly opened), , try once again open it, nothing happens..the popup stops working.. hash[#] appended in url when happens, when manually remove every time, popup works, else doesn't.. idea how should go about, if remove # href, instead of removing url, popup lasts few seconds , closes itself... my complete code: change password <script src="~/scripts/app-password.js/passwordupdate.js"></script> in script folder: 1)to open popup-containing partial view(called passwordupdate) change passw

Loop autohotkey script moving mouse down each time -

i trying automate workflow using autohotkey. i want move mouse position down 200px each iteration @ 2 positions marked below; , apologies formatting. edit: answer below have learnt think of other ways make repeating action. ended using tinytask solve this. you can use variable x coordinate , use += 200 add variables value. maybe simpler use keyboard send, {down 3}{f2} also autohotkey 1.1+ http://ahkscript.org has com built-in excel can controled vba

c# - How to rebind datasource to a winform DataGridView Combobox column? -

Image
i have datagridview in winform 2 combo box columns: 1) companies, 2) accounts. want update accounts combo box according selected company. have code: void recipientsdatagrid_editingcontrolshowing(object sender, datagridvieweditingcontrolshowingeventargs e) { try { combobox cb = e.control combobox; if (cb != null) { cb.selectedvaluechanged -= new eventhandler(companycombobox_selectedvaluechanged); cb.selectedvaluechanged += new eventhandler(companycombobox_selectedvaluechanged); } } catch (exception ex) { } } private void companycombobox_selectedvaluechanged(object sender, eventargs e) { try { var currentcell = recipientsdatagrid.currentcelladdress; if (currentcell.x == 3) { var sendingcb = sender datagridviewcomboboxeditingcontrol; int companyid = sending

Generating Google Documents from Google spreadsheet data source -

i'm wondering what's right way create google document using google spreadsheet data source. googled while , resource found explanation ( http://opensourcehacker.com/2013/01/21/script-for-generating-google-documents-from-google-spreadsheet-data-source/ ), of google app script. there (easy) way? easy, no programming required. check out google docs add-ons, such documentmerge , smartsheet merge, or ultradox .

listview - Creating a listvliew which has drag-drop feature in Android -

simply how can create listvliew has drag-drop feature remove items. drag-drop listviews available not allow create own custom adapter. scenario: there listview showing flower image , name on each row. want remove each flower list dragging? there many custom libraries available in guthub drag , drop listview: https://github.com/bauerca/drag-sort-listview https://github.com/mtparet/drag-and-drop-android https://github.com/willnewii/listview-draganddrop these some. or go www.github.com, search drag , drop listview android , select 1 best suites need (and 1 has tutorial available :p )

angularjs - angular edit each post in array -

i have array of posts: .factory('posts', [function(){ var o = { posts: [ {title: 'post 1', upvotes: 5}, {title: 'post 2', upvotes: 2}, {title: 'post 3', upvotes: 15} ] }; return o; }]) and controller. edit upvotes when clicking button, have following. angular.foreach($scope.posts, function(title){ $scope.posts.push({ title: "ja" }); }); but creating new posts. knows how edit existing ones? thanks to update upvotes value of posts on clicking button have change foreach to: angular.foreach($scope.posts, function(post){ post.upvotes++; }); but if specifc 1 called 'ja' need this: angular.foreach($scope.posts, function(post){ if (post.title === 'ja') { post.upvotes++; } });

postgresql - Creating a postgres user -

i want make typical user in postgres used web application. the web application require access tables. the user should able read/write tables (select, update, delete, insert) all tables belong public schema what best practise creating user? database name: acmeinc user: acmeuser i tried far , not able update table (permission error on relation): create user acmeuser grant privileges on database acmeinc acmeuser alter schema public owner acmeuser alter default privileges in schema public grant select, insert, update, delete on tables acmeuser update : i running above like: psql acmeinc -c "create user acmeuser" should creating role , associating user acmeuser role? i think issue stems 2 misunderstandings around grant : granting on database doesn't grant on tables within it, grants rights on database object self; and alter default privileges affects tables created after run, doesn't change existing tables. you want grant ...

javascript - is it valid for a subscribe callback function to make use of a computed observable -

i have made jsfiddle illustrate problem having: http://jsfiddle.net/gt8d2mub/ var model = { a: ko.observable(false), b: ko.observable(false), c: ko.observable(false), data: ko.observable(''), isvalid: function () { return this.a() && this.b() && this.c(); } }; model.alltrue = ko.computed(function () { return this.a() && this.b() && this.c(); }, model); model.query = ko.computed(function () { return 'a = ' + this.a() + '; b = ' + this.b() + '; c = ' + this.c() + ';'; }, model); model.query.subscribe(function () { if (this.isvalid()) { // load data... this.data(this.query()); } else { this.data('no value'); } }, model); ko.applybindings(model); the model has 3 boolean observables; a, b , c. computed observable (alltrue) calculates if true. computed observable (query) summary of a, b, , c. if manually su

objective c - (iOS 7) cellForRowAtIndexPath not get called, but heightForRowAtIndexPath get called -

i tried optimize uitableview, should display end of list on startup. after storing database calls [tableview reloaddata] out of background thread , afterwards on main thread [tableview scrolltorowatindexpath:lastindexpath atscrollpositionbottom animated:no] . work estimatedrowheight, heightforrowatindexpath called visible items. (but doesn't make difference issue if deactivate it) running on ios 8 device (iphone 6, iphone 5s) works fine. bottom (last item) last visible item on screen cellforrowatindexpath , heightforrowatindexpath called. on ios 7 device (iphone 4s) heightforrowatindexpath called , no item on tableview visible. if scroll 2 times cellforrowatindexpath called , items appear. setting scrolltorowatindexpath animated:yes doesn't make difference. any suggestions? edit: without scrolltorowatindexpath works fine well, list @ top. (missed goal) edit 2: after returning (cgfloat)100 estimatedheightforrowatindexpath works. depending on height of ite

AngularJS Data Binding with Getter and Setter Service Method -

i'm struggling understand how data binding , service works togheter in angularjs. i've 1 controller , 1 service. my service: myappservices.factory('shareddata',['$http',function($http){ var _data = { "first_prop" :{ "name": "first_prop", "info": "infofirst_prop" }, "second_prop" :{ "name": "second_prop", "info": "infosecond_prop" } }; return { getprop: function (name) { return _data[name]; }, setprop: function (name,value) { _data[name] = value; } }; }]) my controller code: webappcontrollers.controller('firstctrl', ['$scope', '$http','shareddata', function ($scope, $http,shareddata) { $scope.data = angular.copy(shareddata.getprop("fir

Sonata admin, use text filter for date filter -

i'm using sonataadminbundle , have question filters. when have text field in entity, in filter can see 3 types of filters : contains not contains is equal when have date field in entity, can see these filters : = >= < ... how can use text filters instead of date filters (or math filters) when have date field ?

html5 - How to create Kendo controls with security markup -

i developing mvc web application , on razor views intent use kendo controls or html5 controls , assign role-based security html5/kendo controls within tag , not in c# code or javascript code. how can 1 this?. i pasted sample code developed in asp.net page, need in mvc razor views. thanks, - vijaya. code below: <abcd123:abcd123securitycontext id="msc" runat="server" abcd123security-entity="centergroup" abcd123security-accesslevel="compose" abcd123security-accesslevelifqs="edit" abcd123security-qsparameters="groupid" abcd123security-showmode="plaintext" /> <abcd123:abcd123securitypageaccess id="mspa" abcd123security-accesslevel="read" runat="server" abcdtx-qsparameters="groupid" /> i can think of 3 ways off of top of head. if converting razor , want to, example, apply 'data-attribute' @ configuration time can set use htmlattri

c++ - Get elapsed time as a formatted string -

i looking simplest way calculate , display execution time of function in qt . result should string / qstring in format mm:ss . i know can int of milliseconds qtime there built-in function formatting? if have elapsed time in milliseconds ( ms ), can print time in mm:ss format in following way: qstring out = qstring("%1:%2").arg( ms / 60000 , 2, 10, qchar('0')) .arg((ms % 60000) / 1000, 2, 10, qchar('0'));

javascript - Event tracking similar to Google event tracking -

i implement own event tracking (client , server) similar google analytic. use java script this: ... _gaq.push(['_setaccount', 'ua-xxxxx-x']); _gaq.push(['_trackevent', 'button3', 'clicked']) ... this code sends data google analytics url. instead of _gaq implement own function send requests server result. many websites using code snippet. but can see request , make robot or similar act same way user doing on website , triggering tracking event. is there way can detect if user has clicked something, or request sent spammer? how google analytics event tracking protecting spam event tracks ? ga doesn't protect anything, can send crap data known account id. ga has implemented list of (spam)bots , crawlers can filter out. that's pretty thing can when using clientside code, blacklist known combinations of ip/user agent/etc. not against actual people sending spam data, though. adservers employ statistical models judge call

Is neo4j compatible with websockets out-of-the-box? -

i trying improve neo4j reading capabilities not going through rest api. looks like improve performances using websockets. looks article working on improving performance in embeded databases. is similar endpoint available in server version (can't find on it) ? may not have access neo4j server per --> why need out of box or extension. i did experiments using websockets & cypher pretty straightforward: https://github.com/jexp/cypher_websocket_endpoint and instance http://structr.org supports websockets on top of neo4j out of box.

javascript - Node JS fs module inside browser -

i have scenario want export data csv client-side. have textbox/area or whatever user can input data , ideally 1 click, local csv file updated data. this achievable nodejs server interaction, , core modules (specifically fs module), apparently not browser. i found out node modules (for example underscore ), support requirejs's method of making particular module work in browser. underscore did this: methods.js define(['underscore'],function(_) { var methods = { dosomething: function() { var x = _.size({one: 1, two: 2, three: 3, xuz: 3}); alert(x); } }; return methods; }); common.js requirejs.config({ baseurl: 'node_modules', paths: { underscore: 'underscore/underscore', } }); require(['methods'], function(y){ y.dosomething(); }); index.html <script data-main="common" src="require.js"></script> <script> require([

javascript - Google Maps v3 with MarkerClustererer not working with createmarker -

i'm trying cluster markers because site slow, markerclusterer not working on site: http://www.estoestalca.cl the code map this: function initialize() { var styles = [ /* styles */ ]; var styledmap = new google.maps.styledmaptype(styles, {name: "styled map"}); var mapoptions = { zoom: 14, center: new google.maps.latlng(-35.4292213, -71.6561387), streetviewcontrol: false, maptypecontroloptions: { maptypeids: [google.maps.maptypeid.roadmap, 'map_style'] } }; var map = new google.maps.map(document.getelementbyid('map_canvas'), mapoptions); var infowindow; var markercluster = new markerclusterer(map); map.maptypes.set('map_style', styledmap); map.setmaptypeid('map_style'); downloadurl("http://estoestalca.cl/?page_id=22", function(data) { var markers = data.documentelement.getelementsbytagname("marker"); (var = 0; < markers.length; i++) {

c++ - Does this cause undefined behavior? -

address sanitizer complaining. struct x { iterator begin(); iterator end(); }; x foo(); const x& bar(const x& x) { return x; } boost_foreach(const auto& xitem, bar(foo())) { //use xitem } yes. foreach happening on reference struct has been created foo call, , gone out of scope after being passed through bar()

issue with comparison between php and select mysql -

i've been looking answer problems few hours, seems don't @ right place, or i'm first have twisted programing style. i have in php code, input inside, put every informations in database. after that, have form, others input allows me make research in db. here troubles comes. if want find in aprticular, have fill inputs, "name", "nickname", "computer name", , finds well, "select * db name=name , nickname=nickname etc...". but if want find every computers 1 person have, put name, , want shows me every row contain name. in other words, want mysql query ignore variables not completed in form, set them null default, have feeling mysql think value, , compare data in db. if fill 1 input, shows nothing, have complete fields.. code incoming, don't rude, i'm pretty beegining... , sorry english. :( in advance, thank help. <html> <head> <link rel="stylesheet" href="index.css" type=&q

c# - Is there a Method to edit certain subkeys of a subkey in the Registry without declaring them all? -

so far had deal single edits, have edit few subkeys bundled in subkey. is there way edit values of subkeys of registry key declared (e.g. declare registrykey key = .... (@"software\beep), , in beep subkey find meep1,meep2,meep3 etc, want edit in end), or have declare every subkey want edit values in on own? thanks in advance i'm guessing 1 way of doing using same method of declaring them, instead giving them different values? since if declare subkey not there yet, it's going create , put in value gave method parameter. if there, it's going change value new value give method. basically, same way created subkeys in first place. don't beat me if i'm wrong, wild guess, never worked registry edits before in c#.

php - ZF2 events for multiple modules -

currently have zf2 application configured single module "application". bootstrap application attach event way: namespace application; use zend\mvc\moduleroutelistener; use zend\mvc\mvcevent; class module { public function onbootstrap( mvcevent $e) { $eventmanager = $e->getapplication()->geteventmanager(); $moduleroutelistener = new moduleroutelistener(); $moduleroutelistener->attach( $eventmanager); $this->inittracking( $e); } /** * initialises user tracking check * @param mvcevent $e */ public function inittracking( mvcevent $e) { $eventmanager = $e->getapplication()->geteventmanager(); $eventmanager->attach( 'dispatch', function( $e){ $objtracking = new \application\event\tracking( $e); }, 200); } } now need create new module "api", should process urls starting domain.com/api (i configure router in "a

Android, to save into internal Storage -

i'm testing on divice, false in line boolean issdpresent = android.os.environment.getexternalstoragestate().equals(android.os.environment.media_mounted); so, don't have external storage in device, correct?, how can save image on internal storage? if put line... fileoutputstream fos = context.openfileoutput(filename, context.mode_private); the class complete public class imagestorage { public static string savefile(bitmap bitmap, string filename) { try { fileoutputstream out = context.openfileoutput(filename, context.mode_private); bitmap.compress(bitmap.compressformat.jpeg, 90, out); out.flush(); out.close(); } catch (exception e) { e.printstacktrace(); } } public static file getimage(string imagename) { file mediaimage = null; try { string root = environment.getexternalstoragedirectory().tostring(); file mydir = new file(root); if (!mydir.exists()) return n

sql server - Database cursor + while loop within -

this function have created return recorded stock numbers in table "contributordeeds" table contains start number of stocks , end number of stocks (e.g, number - number) need numbers between within range. the function works fine, however, tasks several minutes return result :(. is there better sql query same result? function [dbo].[stocknumbers] () returns @sequencenumbersofshares table (stocknumber nvarchar(50)) begin declare @deeddocumentid bigint declare @min nvarchar(50) declare @max nvarchar(50) --create table #localtemptable(stocknumber nvarchar(50)) declare db_cursor cursor select contributordeedsid dbo.contributordeeds deedfromshare not null , deedtoshare not null open db_cursor fetch next db_cursor @deeddocumentid while @@fetch_status = 0 begin set @min = (select deedfromshare contributordeeds contributordeedsid = @deeddocumentid) set @max = (select deedtoshare contributordeeds contributordeedsid = @deeddocumentid) while dbo.insertsp(@min, 20) <= dbo

javascript - get Json Key based on Json Value of an Object which resides in an Json Array -

how key of json resides within array based on value, if value valueb should return mainb var app = angular.module('myapp', []); app.controller('arraycontroller', function ($scope) { $scope.mydatas = [ { "test1": "value1", "maina": "" }, { "test1": "value2", "maina": "valueb" }, { "test1": "", "maina": "valuec" } ]; $scope.getjsonkey = function(jsonarray, jsonvalue) { angular.foreach(jsonarray, function(value, index) { if (value.test1 === jsonvalue) { return "test1"; } if (value.maina === jsonvalue) { return "maina"; } }); }; console.log($scope.getjsonkey($scope.mydatas, "valueb"))

Composite keys in MyBatis <collection> mappings -

i unable pass composite key mybatis <collection> element (using version 3.2.7). mybatis documentation states: note: deal composite keys, can specify multiple column names pass nested select statement using syntax column="{prop1=col1,prop2=col2}". cause prop1 , prop2 set against parameter object target nested select statement. however, attempts implement produce exception org.mybatis.spring.mybatissystemexception: nested exception org.apache.ibatis.reflection.reflectionexception: error instantiating class java.lang.integer invalid types () or values (). cause: java.lang.nosuchmethodexception: java.lang.integer.<init>() the collection (which resides in resultsmap) is: <collection property="foos" oftype="fooobject" column="{param1=user_id,param2=foo_id}" select="getfoosbyuser" > <id property="userid" column="user_id" /> <id property="foo" colum

mouseevent - Create a model window for comment in javascript -

i created comment button. want when user click on button model window open. model window should contain keyboard writing comment. this might little bit. can't code entire keyboard you. html: <input type="button" value="show keyboard!"> <!-- button --> <div id="wrapper"> <!-- keyboard --> <!-- type code here, make sure it's css textarea below, display:none;. copy-paste jquery line says 'textarea', , change 'textarea' whatever element added. --> <textarea></textarea> </div> css: #wrapper { position:relative; margin-top:30px; background-color:#ccc; width:400px; height:0px; } textarea { display:none; margin:0 auto; width:200px; height:160px; } jquery: $(document).ready(function() { $('input').click(function() { // when button clicked... $('#wrapper').animate({ height: '+=200px'},100); /

ios - A Framework of subclasses -

in project have subclass of uiview lets call mainview . create many subclasses of mainview , call "components". need other developers able create own components (with assets) can link them project. similar effect of plugins. copyright reasons source code needs hidden, believe framework best method, have issues this. all new components in framework need subclass of mainview . have create different 'framework x' contains mainview , link both 'new components framework' , main project? not ideal main project huge , 'framework x' need lot more classes mainview , messy. or there simpler way this? i have never created framework before , needs not frameworks designed do, unclear on best way go , use advice. thanks you can supply static library (.a) , public headers... sort of mac framework (that uses dynamic library, library headers.) ... mainview.h @interface mainview : uiview -(void) somemethods; @property int someproperty; @end

api - JSON request to create entity with existent inner object -

i develop rest api , think following task. need post vehicle entity , bind existing driver it. common approach format json such request? choose 1 of these variants, maybe there better solutions: 1. {"model":"corolla","number":"12345", "driver": {"id": 5}} 2. {"model":"corolla","number":"12345", "driver": {"id": 5, "name": "john"}} 3. {"model":"corolla","number":"12345", "driverid": 5} the question how pass information created driver entity known id. according jsonapi , format : { "model":"corolla", "number":"12345" "links": { "driver": "5" } } conventions defined in website may usefull you.

javascript - How to get CodeMirror value without defining variable? -

i'm using multiple codemirror areas on page , im defining them in js: function editor(id){ codemirror.fromtextarea(document.getelementbyid(id), { linenumbers: false, styleactiveline: true, matchbrackets: true }); } and later call function on textareas - $j = 0; while($row = mysql_fetch_array($formulas)) { echo " <textarea id='code".$j."'>;some code</textarea> --not important code-- <script>editor('code".$j."');</script>"; $j++; } and later, according solution site i'm refreshing part of codemirrors because of placing them in hidden div this settimeout(function() { $('.my-hidden-div .codemirror').each(function(i, el){ el.codemirror.refresh(); }); now need values of codemirrors blocks clicking in button in same row , send them via ajax problem appears. how can value of them using $(this).closest('tr') guys? important me not define codemirror