Posts

Showing posts from January, 2013

swift - swift3 how do you use os_log to show the value of a variable in the Console app -

when use os_log("configure %@", something) see in console configure <private> . i understand default behavior (at least describe here https://developer.apple.com/documentation/os/logging?language=objc if objc.) i tried os_log("configure %{public}s", something) show configure %{public}s" . using swift 3, how make variable appear in console ?

fabric: "there was an error resending the invitation" -

apparently fabric beta can have internal error cannot resend invites. 5 minutes later (just now) when went did work. during time fails , gives flash/toast/popup error in title, there's nothing else tells user can it. guess if have question be, fabric fix ux wise?

Create Azure Resource Policy to enforce user? -

i looking option enforce user use specific image, trying modify below code use hub image . below code trying modify enforce windows hub "if": { "allof": [ { "field": "type", "in": [ "microsoft.compute/virtualmachines", "microsoft.compute/virtualmachinescalesets" ] }, { "field": "microsoft.compute/licensetype", "exists": windows_server } ] }, "then": { "effect": "deny" } } } if understanding right, firstly find hub images's sku. for windows server: ps c:\program files\> get-azurermvmimagesku -location westus -publishername microsoftwindowsserver -offer windowsserver-hub|select skus skus ---- 2008-r2-sp1-hub 2012-datacenter-hub 2012-r2-datacenter-hub 2016-datacenter-hub for windows client: ps c:\program files> get-azurermvmimagesku -location "west us" -publisher "

java - Are values returned by static method are static? -

please consider code public class utilities { public static myclass getmyclass() { myclass cls = new myclass(); return cls; } } will static method return new instance of myclass every time called? or going return reference same instance on , over? declaring method static means class method , can called on class without instance (and can't access instance members because there's no object in context use - no this ). look @ code below. expected output: [1] different [2] same if want variable have lifetime of class , return same object every time declare variable static in class: public static string getthing(){ string r=new string("abc");//created every time method invoked. return r; } private static string sr=new string("abc");//static member - 1 whole class. public static string getstaticthing(){ return sr; } public static void main (string[] args) throws java.lang.exception {

javascript - WinJS appendTextAsync producing scheduler errors -

im trying implement logger in uwp app (windows 10) following code in both this , this answers. i'm afraid in both cases end getting scheduler ( winjs.utilities.scheduler ) errors @ random times (couldn't establish pattern). main problem the application freezes sometimes , suspect due log implementation because final line reads transitioning job (1) from: running to: blocked when happens. i messages like transitioning job (1) from: blocked_waiting to: cooperative_yield transitioning job (1) from: cooperative_yield to: scheduled in middle of execution, varying states. initialization method this.init = function () { let logger = new winjs.promise(function (complete) { let = new date(); let logfilename = `log-${now.getdate()}-${now.getmonth() + 1}-${now.getfullyear()}.log`; localfolder .createfolderasync("logs", windows.storage.creationcollisionoption.openifexists) .then(fun

python - Bengali font is broken on Idle and Tkinter app -

i want display bengali text in tkinter label or message widget showing box things instead of text. have tried installing different font in system , applying them on code nothing working. should display text in bengali font. system detail- ubuntu 16.04, python 3.5 from tkinter import * tkinter import ttk root = tk() msg=message(root,text='আনন্দবাজার') msg.config(font=('lohit bengali', 54)) msg.pack() root.mainloop() app screenshot output you first need determine whether tcl/tk knows , can access 'lohit bengali'. run idle , click options => configure idle , @ font list. or run import tkinter tk root = tk.tk() tkinter import font fams = font.families() print('lohit bengali' in fams) # answer question above print() fam in sorted(fams): # see tcl know print(fam) edit: add parens families call

Adding Firebase to Android Application -

i followed this tutorial . i've done quite of bit of research trying fix problem. updated google services , google repository in sdk manager. iv'e tried suggested still can't sync android project , can't build or run project since first tried sync. here screen shot of project. went until point. error the build.gradle file posted project-level file. remove last line: apply plugin: 'com.google.gms.google-services' and instead, place last line of app module build.gradle file (the 1 under app ).

Generating Variable in Stata? -

i have categorical variable , trying calculate new variable multiplies each response frequency. ex: total | freq. ------------+--------------- 1 | 6 2 | 12 3 | 9 5 | 5 6 | 10 i have variable presents sum n each response (i.e. 1=6, 2=24, 3=27, etc.). tried few calculations using egen, did not seem work. please let me know if has insight. i think example should show general tactic: sysuse auto, clear bysort rep78: egen count_rep78 = count(rep78) gen freq_x_val = rep78*count_rep78 browse rep78 count_rep78 freq_x_val in example rep78 categorical variable. essentially, create count variable category's frequency in bysort step. multiply new count variable categorical variable , you're done.

regex - Parse Values from String Using Javascript -

trying find efficient way extract values large string. ext-x-daterange:id="preroll_ident_open",start-date="2016-12-14t120000.000z",duration=3,x-playheadstart="0.000",x-adid="aa-1qpn49m9h2112",x-transaction-vprn-id="1486060788",x-trackingdefault="1",x-trackingdefaulturi="http,//606ca.v.fwmrm.net/ad/l/1?s=g015&n=394953%3b394953&t=1485791181366184015&f=&r=394953&adid=15914070&reid=5469372&arid=0&auid=&cn=defaultimpression&et=i&_cc=15914070,5469372,,,1485791181,1&tpos=0&iw=&uxnw=394953&uxss=sg579054&uxct=4&metr=1031&init=1&vcid2=394953%3a466c5842-0cce-4a16-9f8b-a428e479b875&cr="s=0&iw=&uxnw=394953&uxss=sg579054&uxct=4&metr=1031&init=1&vcid2=394953%3a466c5842-0cce-4a16-9f8b-a428e479b875&cr=" i have above example. idea extract caps string before : object key, , in between quotes until next comma val

bash - How to combine multiple commands when piped through xargs? -

i have following command: !nohup fswatch -o ~/notes -e "\\.git.*" | xargs -n 1 -i {} sh ~/auto_commit.sh > /dev/null 2>&1 & i want inline what's in auto_commit.sh file: cd ~/notes git add -a git commit --allow-empty-message -am "" is there way this? the solution ended was: nohup fswatch -o ~/notes -e "\\.git.*" | xargs -n 1 -i {} sh -c 'cd ~/notes; git add -a; git commit --allow-empty-message -m ""' > /dev/null 2>&1 &' thanks barnwell , whjm help. also, vim script, formatting had different (in case others looking solution similar problem): autocmd bufwinenter *.note silent! execute '!nohup fswatch -o . -e "\\.git.*" | xargs -n 1 -i {} sh -c ''git add -a; git commit --allow-empty-message -m ""'' > /dev/null 2>&1 &' note barnwell wrong {..} not subshell, , sh -c command expects string. curly braces unnecessary, , i

php - WordPress update_user_meta on form submit -

i have simple form , want edit user meta field on submit. i'm not php, found sample code thought might useful. however, once form submitted, user meta field won't update. here code: <?php $user_id = get_current_user_id(); ?> <?php if(isset($_post['value'])) { update_user_meta( $user_id, '_meta_value_val', $_post['value'] ); } ?> <form method="post" action="" id="val_edit"> <input type="text" value="44" name="value"> <button value="done" type="submit" form="val_edit">invia</button </form> thanks

Access LinkedIn API for a user authenticated with Azure AD B2C? -

a user logs in via azure ad b2c in mobile app using azure mobile services , approves linkedin app, is there way linkedin api fetch users image? i don't seem info azure ad b2c. can somehow token linkedin via azure ad b2c use in app? at time, azure ad b2c not support requesting scopes or information social identity providers. azure ad b2c unable provide social idp's token can query social idp information. you can request former in azure ad b2c feedback forum or vote existing ask on latter: return social idp's native access tokens app that being said, you might able implement retrieve user's linkedin picture via custom policies . include profile-picture in claimsendpoint value of policy (see post reference: azure ad b2c linkedin claims provider ) , map picture-url claim linkedin custom claim in azure ad b2c.

ruby on rails - ActiveRecord::RecordNotFound in ArticlesController#show Couldn't find Article with 'id'=edit -

Image
i getting error when got articles/edit. i getting error: when should getting error: my code: articles_controller: class articlescontroller < applicationcontroller def new @article = article.new end def edit @article = article.find(params[:id]) end def create @article = article.new(article_params) if @article.save flash[:notice] = "article submitted succsefully" redirect_to (@article) else render :new end end def show @article = article.find(params[:id]) end private def article_params params.require(:article).permit(:title, :description) end end my edit.html.erb : <h1>edit existing article</h1> <% if @article.errors.any? %> <h2>the following errors informing if don't these articles not edited</h2> <ul> <% @article.errors.full_messages.each |msg| %> <li> <%= msg %> </li> <% end %> <

excel - Exce 2013l: Transpose header and count matrix -

Image
is possible generate dynamically total-matrix table? have students list courses marked (with "1" symbol): i need transpose header, , count how many students have 2 courses @ same time, each course, this: is possible dynamically? step 1 copy headers. assuming first table in range a1:n25 can start generating our header row basic of formulas , copying right far required. in example placed formula below in cell q1. =b1 step 2 transpose headers. there transpose function, copy paste function, opted go simple index function. in p2 placed following formula , copy down far needed. =index($q$1:$ac$1,row(a1)) the row(a1) part acts counter formula copied down , increases column in reference range q1:ac1 read from. step 3 count number occurrences there 1 in column matches header top, , 1 in column matches header on left. place following formula in q2 , copied down , right far required. =if(match(q$1,$q$1:$ac$1,0)>match($p2,$q$1:$ac$1,0),&quo

python 2.7 - How to pass system command line arguments to the Scrapy CrawlerProcess? -

i have single scrapy spider pass system arguments using scrapy crawl command. trying run spider using crawlerprocess instead of command line. how can pass same command line arguments crawler process ? scrapy crawl example -o data.jl -t jsonlines -s jobdir=/crawlstate from scrapy.crawler import crawlerprocess scrapy.utils.project import get_project_settings process = crawlerprocess(get_project_settings()) process.crawl(#how pass arguments -o data.jl -t jsonlines -s jobdir=/crawlstate here?) process.start() you can modify project settings before pass them crawlerprocess constructor: ... settings = get_project_settings() settings.set('feed_uri', 'data.jl', priority='cmdline') settings.set('feed_format', 'jsonlines', priority='cmdline') settings.set('jobdir', '/crawlstate', priority='cmdline') process = crawlerprocess(settings) ...

javascript - JS - Not accessing classes by their class name -

i working on to-do list app firebase, code supposed access element class name of 'close' not access any. if console log it, returns: {}; i using loop add onclick event, cannot add of elements if arry emtpy. var config = { apikey: "aizasybiv0dppiwuzadvgfmkipf7gsykivt8n4m", authdomain: "to-do-332c9.firebaseapp.com", databaseurl: "https://to-do-332c9.firebaseio.com", projectid: "to-do-332c9", storagebucket: "to-do-332c9.appspot.com", messagingsenderid: "281739919235" }; firebase.initializeapp(config); const txtemail = document.getelementbyid('txtemail'); const txtpassword = document.getelementbyid('txtpassword'); const btnlogin = document.getelementbyid('btnlogin'); const btnsignup = document.getelementbyid('btnsignup'); const btnlogout = document.getelementbyid('btnlogout'); const addtodo = document.getelementbyid('addtodo'); var t

python - Use JSON to create Model objects - Django -

i have external url containing json. so question is: how save json data django admin page if created following model matches keys of json? from django.db import models class person(models.model): name = models.charfield(max_length=254) image_url = models.imagefield(blank=true) title = models.charfield(max_length=254) bio = models.charfield(max_length=20000) vote = models.integerfield() my goal able create voting app lets vote each individual person defined json. here longer version of question: https://stackoverflow.com/questions/46149309/create-object-models-from-external-json-link-django if understand question correctly can use model serializers end. class personserializer(serializers.modelserializer): class meta: model = person and can use personserializer populate model person_json objects (in case in array of json objects) rest api. personsaver = personserializer(data=person_json, many=true) if personsaver.is_valid():

neural network - tensorflow tf getting error cross entropy in built function -

i have 2 functions below, come andrew ng deep learning course on coursera. first function runs, second doesn't. logits , labels variables have same shape per document requirements changed cost [0.0,0.0,1.0,1.0] , didn't :( in case of first function directly passing variables function call function 1) def one_hot_matrix(labels, c): """ creates matrix i-th row corresponds ith class number , jth column corresponds jth training example. if example j had label i. entry (i,j) 1. arguments: labels -- vector containing labels c -- number of classes, depth of 1 hot dimension returns: one_hot -- 1 hot matrix """ ### start code here ### # create tf.constant equal c (depth), name 'c'. (approx. 1 line) #c = tf.constant(c, name = 'c') #c = tf.placeholder(tf.int32, name = 'c') #labels = tf.placeholder(tf.int32, name = 'label

javascript - jQuery select option validation -

in question page, have list of questions in type of text , select , checkbox , radio , date , upload . except select , options can written in input. doing validation input , select now. stuck in select validation. here validation script: $(document).ready(function() { //validate $('form.confirm').on('click', function(e) { e.preventdefault(); // adding rules inputs $('input').each(function() { $(this).rules("add", { required: true }); }); $('select').each(function() { console.log('1111111'); $(this).rules("add", { selectcheck: true }); }); jquery.validator.addmethod('selectcheck', function (value) { return (value != '-1'); }, "required"); }) }); here php select: <select name='awi

.net - Managed driver for MS Access -

ms access files can read using jet or newer ace. both of these native drivers, i.e. have installed. oracle databases can queried using native drivers (oracle client) or managed .net drivers (odp.net). there such thing managed .net driver ms access? there managed provider called odbc.net, , been tested sql server, oracle, , access/jet. however despite being “managed” .net provider, still requires access odbc provider has installed. (so don’t around issue – @ least in case of access). un-managed code driver assumed exist on windows in case of jet. of course in windows, both sql server , jet providers installed default out of box. in theory not have install additional. so keep in mind windows includes jet provider can read “mdb” files, not accdb files require install ace database engine. the above .net “managed” driver works because windows includes un-managed access drivers default. i not 100% sure of in regards sql server, again suggests managed sql driver works b

How do I find who created a GCE VM instance in Google Cloud? -

background in our current google cloud project seems it's common people create vm, start it, of stuff , leave there without turning off or deleting vm. i'm trying write automated script pulls list of vm instances every day , send e-mail vm owners , see if forgot turn off vms. question so there easy way find out created gce vm instance using google cloud api? you can view information in stackdriver -> logging -> logs. log json file, actor field looking for. can export logs analysis. see https://cloud.google.com/logging/docs/

Template type check parameter C++, different type execution paths -

i'd different logic in template based on template parameter. how might type check template parameter? i have following surprised not work: class bar { bar() {} } template <typename t> void foo(const &t a) { if (!std::is_same<t, bar>::value) { // things fail type bar e.g. a.fail(); } } i do not wish use template specialization in reality template specialization ends sharing lot of code specific purpose (currently working code using template specialization) currently fails during compile: "no member "fail" in "bar" each branch should valid every type. in c++17, use if constexpr change that: template <typename t> void foo(const &t a) { if constexpr (!std::is_same<t, bar>::value) { // things fail type bar e.g. a.fail(); } } before, have rely on specialization or overload. example template <typename t> void fail(const t& t) { t.fail(); } void fail(const bar&) {

android - Best Architecture to implement different logic and UI, based on the user privileges -

i trying implement feature based flows, in android app: some users able win points , spend them, others not. not able win points, should not see point related ui , logic should not triggered. some users able see offers, other users not. same above.... so basically, each user have list of privileges, , views show/hide based on those, other logic should run user , not other (if user.haspointsfeature -> server call , update points, if not, show him message) i looking @ best way implement architectural point of view, other developers working on project in future, , want make solid , clean possible. here's i'm thinking of far: for ui elements: implement custom layout called: "featurewrapperlayout", have custom attributes app:features="points" for example. , in when initiating it, check it's feature user features , show/hide accordingly. for code, can't settle on 1 approach need most 1. use if/else everywhere this basic solution.

Stop Script on Null Value in GSheets -

Image
i trying send verification email on status change, can send based on column content, can't make stop once sees null value. puts in email confirmation tag regardless. need know how make stop on null if cell in column g blank. screenshot of sheet var confirmation_sent = "confirmation_sent"; function sendconfirmation(e){ var sheet = spreadsheetapp.getactivesheet(); // fetch range of cells a1:range var datarange = sheet.getdatarange (); // fetch values each row in range. var data = datarange.getvalues(); (var = 1; < data.length; ++i) { var row = data[i]; var emailaddress = row[2]; var completemessage = "all set! accoutn associate " + emailaddress + " has been deactivated"; // confrim account deactive var cancelmessage = "per request, account associated " + emailaddress + " has not been deactivated."; // request cancelled var invalidmessage = "the email address of " + emailaddress

multithreading - Java FX Path Transition Control Transition Speed -

i trying slow down transition on mouse click event. want 2 things on mouse click event: change color of node (which circle) slow down speed of transition. below have done in mouse click event //creating mouse event handler eventhandler<mouseevent> eventhandler = new eventhandler<mouseevent>() { @override public void handle(mouseevent e) { system.out.println("hello world"); circleone.setfill(color.darkslateblue); try { thread.sleep(500); } catch (interruptedexception ex) { logger.getlogger(sequentialtransitionexample.class.getname()).log(level.severe, null, ex); } } }; my problem node ciricle 1 not slowing down, color changes without problem. how can achieve controlling of transition speed? thanks ( quite new java fx)

java - GUI Stackoverflowerror -

i trying create ui java swing studying purpose. running on autobahn until tried separate main.java file , panel components. trying here separately create classes different assignments keep main.java file short , easy modify independent assignment files. post anticipated result works when put in single file, , decoupled codes. main.java package gui; import java.awt.cardlayout; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.jframe; import javax.swing.jmenu; import javax.swing.jmenubar; import javax.swing.jmenuitem; import javax.swing.jpanel; public class main { //basic components jframe frame = new jframe(); jmenubar menubar = new jmenubar(); jmenu menupanels = new jmenu("assignments"); jmenuitem assign_1 = new jmenuitem("assignment 1"); jmenuitem assign_2 = new jmenuitem("assignment 2"); jmenuitem assign_3 = new jmenuitem("assignment 3"

php - Vritual host in windows 8 apache xampp -

i trying config virtual host in windows 8 ,i installed apache in port 8080 below config files far tried,still getting 404 error httpd-vhost conf <virtualhost *:8080> servername design.com serveralias www.design.com documentroot "c:/xampp/htdocs/proj_des/public/" <directory c:/xampp/htdocs/proj_des> allowoverride require granted </directory> </virtualhost> <virtualhost *:8080> documentroot "c:/xampp/htdocs" servername localhost </virtualhost> httpd.conf listen 8080 host in system32 127.0.0.1 localhost 127.0.0.1 www.design.com your server spawned on port 8080 , , therefore available access on port 8080 . default, if don't specify port, browser try connect on port 80 , http port. why don't response when go localhost , not localhost:8080 to change port server listening on, replace 808

macos sierra - Programmatically adding a NSTableView to a NSStackView -

i wondering programmatically adding nstableview inside nsstackview using swift 3/macos sierra. the idea have 2 nstextfields aligned via centery axis in .leading gravity space, tableview in .center gravity space, 2 more nstextfields aligned via centery axis in .trailing gravity space. stack view span width of nsview -- header. is idea or should avoid doing this? has been difficult correct -- table has large of width despite adding constraints try pin fixed width. any insight appreciated. i'm new programming macos. thanks, here output in interface builder: output of headerview here code of nsview i'm using: view controller elsewhere i'm not having problems view controller -- it's displaying data in table correctly. it's sizing/positioning of tableview (which i'm trying in nsview via nsstackview) wrong. should have width of 650 instead has width of 907 , same error time in debug console: 2017-09-12 17:43:36.041062-0500 raceprogram[795:3695

javascript - Removing white space and blank line from local text file -

showowi g exsu n sierouz nicee99 this content extracted image screenshot , saved text file called b&w1.txt i trying remove blank spaces in line append these list using following js code var filename="../static/r6scoreex/extract/b&w1.txt" $.get(filename,function(txt){ var lines = txt.responsetext.split("\n"); len = lines.length; (var j = 0 ; j < len; j++) { //save(lines[i]); if((lines[j]!='') && ( lines[j]!='undefined')){ $('#text'+i).append("<li>"+lines[j]+"</li>"); } }); but still empty string getting inserted change this: if((lines[j]!='') && ( lines[j]!='undefined')); $('#text'+i).append("<li>"+lines[j]+"</li>"); to: if((lines[j]!='

r - how to call a shiny module in another shiny module (reactive function from one module to the other) -

Image
i'd know how access reactive functions in 1 module module. if have more 1 reactive function in module can access them each in module? so how call/pass reactive function in 1 shiny module shiny module (reactive function 1 module other) thanks module1ui <- function(id) { ns <- ns(id) wellpanel( selectinput( ns('cars'), "cars:", list("select" = "", "a" = "mazda", "b" = "ford")) ) } module1<-function(input, output, session){ dataone = reactive({ if(input$cars=="mazda"){ mtcars$mpg} else( mtcars$hp) }) } module2<-function(input, output, session){ dataone() #here want dataone above module1 # tried use callmodule(module1,_) didnt understand id in case? } library(shiny) ui <- fluidpage( sliderinput("slider","how cars?", 1, 10, 1, width

flowtype - How to represent a common Object type in Flow? -

var obj: object; seems work, couldn't find syntax in docs. or should see class type object? ps: common object type, mean value of type should satisfy: value && typeof value === 'object'

yaml - Return an array of object in Swaggerhub -

i defining api specification in swaggerhub. /contacts request returns array of contacts. definition below: /contacts: get: tags: - contacts summary: contacts description: displays contacts present user. operationid: getcontact produces: - application/json - application/xml responses: 200: description: successful operation schema: $ref: '#/definitions/allcontacts' 400: description: invalid id supplied 404: description: contact not found 500: description: server error definitions: allcontacts: type: array items: - $ref: '#/definitions/contactmodel1' - $ref: '#/definitions/contactmodel2' contactmodel1: type: object properties: id: type: integer example: 1 firstname: type: string example: 'somevalue' lastname: type: string example: 'somevalue' contactmodel2: type: object propert

Laravel Responsable - Get Output Attribute -

class transformresponse implements responsable { public $name; public function __construct($name) { $this->name = $name; } public function toresponse($request) { $this->name = 'mr. ' . $this->name; return response(['name' => $this->name]); } } - $res = new \transformresponse('orocimaru'); return $res; // output { "name": "mr. orocimaru" } return $res->name; // output "orocimaru" # expected output "mr. orochimaru" - how expected output? whether right mutation inside toresponse()? i follow https://laravel-news.com/laravel-5-5-responsable

How Jump to with collections of data in laravel -

i'm implementing jump to... functionality in project. want is: if user in first item left button not included. if user in last item right button not included. the left button should have link same link before current/selected item. the right button should have link same link after current/selected item. please see code below: controller $course = course::with([ 'assignments' => $undeleted, 'quizzes' => $undeleted, 'add_links' => $undeleted ])->findorfail($id); $course_items = collect($course->assignments); $course_items = $course_items->merge(collect($course->quizzes)); $course_items = $course_items->merge(collect($course->add_links)); $course_items = $course_items->sortby('item_number'); view <div class="jump-to"> <div class="pull-right"> <div class="btn-group" role="group"> @foreach($course->topics $top

swift3 - how to get selected text of textfield on button click? pickerview is set as an inputview to the textfield. Swift -

Image
currently output displaying selected values pickerview inside textfields. now question want access these values on submit button , want display in view controller how this?. let me explain scenario first vc set collectionview 1 of collectionviewcell m redirecting page. note: know how pass data between 2 view controller. not working in case.please help. code @ibaction func staffatten_action(_ sender: any) { // let secondvc = self.storyboard?.instantiateviewcontroller(withidentifier: "staffattendence_secondpage") as! staffattendence_secondpage // // secondvc.a = active_text.text! // secondvc.b = active_text.text! // secondvc.c = active_text.text! // secondvc.savedata.append(year.text!) // secondvc.savedata.append(month.text!) // secondvc.savedata.append(institute.text!) } } the problem having instantiating brand new vc , passing data it. vc presented not 1 created. since have segue connecting 2 v

java - Should annotation based JPA Entity Manager be closed? -

i have used annotation using entity manager instead of using entitymanagerfactory. @persistencecontext entitymanager entitymanager; i searched lot regd closing of entitymanager. in places entitymanager being used entitymanager em = emf.get().createentitymanager(); and im not sure how closing varies annotation based. use use normal jdbc connection? eg: connection conn=databaseconnection.getconnection(); preparedstatement stmt; resultset result; stmt=conn.preparestatement("select * table id = ? "); stmt.setstring(1,id); result=stmt.executequery(); conn.close(); so, need add begin tran entitymanager, commit , close each method use? or annotation take care of all? public class someclass{ public somemethod1(){ //use entitymanager - need close each method? } public somemethod2(){ //use entitymanager } } or getting entirely wrong? please advice.

javascript - Angular JS data response undefined -

this question has answer here: how access correct `this` inside callback? 5 answers i new angular js, , trying call rest api using json data. when run http-server , not getting response data. function contacts(contactsdata) { contactsdata.getcontacts().then(function(data) { this.contactsinfo = data; }); } (function(){ var mod = angular.module('myapp'); mod.controller("contacts", contacts); mod.service("contactsdata", function($http) { this.getcontacts = function(){ var execute1 = $http.get('http://localhost:3000/contacts'); var execute2 = execute1.then(function(response) { return response.data; }) return execute2; } }); })(); you can try in service this.getcontacts = function(){ return

api - hbase rest decripted when running thru java code -

i need on hbase rest api. when write "http:/xxx.xxx.xxx:9090/table/* in postman, required data shown below: sensortempvalues:jwttokenvalue�נ�+"suresh1'sensortempvalues:sensorid��נ�+"144> sensortempvalues:sensortimestamp��ؠ�+"2017-01-01 00:02:01,sensortempvalues:sensortype��ՠ�+"float1)sensortempvalues:sensorvalid��֠�+"11 in case when wrtting java code , requesting same url "http:/xxx.xxx.xxx:9090/table/* , data shown below {"row":[{"key":"mg==","cell":[{"column":"c2vuc29ydgvtchzhbhvlczpkv1rub2tlbnzhbhvl","timestamp":1505186140001,"$":"c3vyzxnomq=="},{"column":"c2vuc29ydgvtchzhbhvlczpzzw5zb3jpza==","timestamp":1505186148860,"$":"mtq0"},{"column":"c2vuc29ydgvtchzhbhvlczpzzw5zb3j0aw1lc3rhbxa=","timestamp":1505186159245,"$":"mjaxny0wms0wm

c++ - how to correctly use libpng -

edit: i'm using libpng 1.6 on windows 7 i'm convinced usage of libpng causing memory leak (edit: confirmed) loading images using function causes spike in memory when unload images , reload them memory usage sky rockets. instead of being few meg in memory app using hundreds. i'm unable see problem code, i've done best free resources. i'd second opinion memory leak didn't exist when using different method load textures. here function: #define png_sig_bytes (8) /* bytes in png file signature. */ gluint loadpngtexturergba(const string filename, int &width, int &height) { file* fp = null; #ifdef __linux__ fp = fopen(filename.c_str(), "rb"); #elif defined(_win32) fopen_s(&fp, filename.c_str(), "rb"); #endif if (fp == null) { #ifdef __linux std::cout << "unable load png texture file" << std::endl; #else messagebox(0, l"unable load texture", l"error",