Posts

javascript - Object passed through ng-click function loses reference -

when passing object ng-click function, object seems lose reference. what reason? codepen example <div ng-app="app" ng-controller="controller"> <p> <u>object</u> : {{ obj | json }} </p> <p> <button ng-click="obj = {}">obj = {}</button> <!-- works --> <button ng-click="voidit(obj)">voidit(obj)</button> <!-- doesn't work --> </p> <p> <button ng-click="reset()">reset obj</button> </p> </div> angular.module('app', []).controller('controller', function($scope) { $scope.voidit = function(object) { object = {} } $scope.reset = function() { $scope.obj = { prop: "value" } } $scope.reset(); }); what nested $scope refers can become confusing, it's better use controlleras syntax. explanation, read angularjs 'controlleras' vs. '...

java - How can I display images and different variables depends on some conditions in this code? -

i learning java , pretty new it. trying create static profile window using swing. also, avatar picture should change depending on user , user information should read text file. code doesnt give error because of avatarpath . think program thinks non-static. import java.io.*; import java.io.ioexception; import java.util.scanner; import java.util.logging.level; import java.util.logging.logger; import javax.swing.joptionpane; /** * * @author b_ali */ public class profilepanel extends javax.swing.jframe { public static string avatarpath; public static int x; public static class usersinfo{ public int userid; public string username; public string usersurname; public string usergender; usersinfo(string name, string surname, string gender){ userid = x; username = name; usersurname = surname; usergender = gender; } } static usersinfo permiteduser[]; public static void inforeader()throws ioexception{ @su...

c# - .Net api for generating entity framework models from database -

does entity framework provides api .net (c#) generate models existing database? don't want use edmgen.exe , because direct integration nice. maybe code used edmgen.exe provides information, because have use api functionality. this needed, because want compile models dynamicaly roslyn @ runtime, working pretty demo models. thank you.

android - Need help! How to get info from another class and use on a Google Mark -

i have class called cadactivity define tittle mark using edittext. how can use information inside onmaplongclick? any great :) public class mapaactivity extends fragmentactivity implements googlemap.onmaplongclicklistener { googlemap map; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.mapa); android.support.v4.app.fragmentmanager myfragment = getsupportfragmentmanager(); supportmapfragment meusupfragment = (supportmapfragment)myfragment.findfragmentbyid(r.id.map); map = meusupfragment.getmap(); map.setmylocationenabled(true); map.setonmaplongclicklistener(this); } @override public void onmaplongclick(latlng coord) { //intent cadmap = new intent(this,cadastraractivity.class); //startactivity(cadmap); map.addmarker(new markeroptions() .position(coord) .title("") .icon(bitmapdescriptorfactory.defaultmarker(bitma...

sql - Access SCOPE_IDENTITY() in CodeBehind C# TSQL -

i'm trying retrieve scope_identity() , place in parameter can access in codebehind. .aspx: <asp:sqldatasource id="sqldatasource1" runat="server" connectionstring="<%$ connectionstrings:mystring %>" insertcommand="insert [countyhelp](county,city) values (@county,@city) ;select @id = scope_identity()"> <insertparameters> <asp:formparameter name="county" formfield="county" /> <asp:formparameter name="city" formfield="city" /> <asp:parameter direction="output" name="id" type="int32" /> </insertparameters> then access in code behind: protected void btn_send_click(object sender, sqldatasourcestatuseventargs e) { string sid = e.command.parameters["@id"].value.tostring(); sqldatasource1.insert(); response.redirect("d...

css - How can I get overflow:scroll inside a flex box -

i have buildt layout: <!doctype html> <html> <head> <meta charset="utf-8"> <title>test</title> <style type="text/css"> html, body{ margin:0; padding:0; height:100%; } .flex{ display:flex; flex-direction:column; min-height:50%; width:33.3333%; float:left; border:1px solid #c8c7cc; box-sizing:border-box; overflow:scroll; } .flex:last-child{ width:66.6666%; } </style> </head> <body> <div class="flex"> <ul> <li>1</li> <li>2</li> <li>3</li> <li>4</li> <li>5</li> <li>6</li> <li>7</li> <li>8</li> <li>9</li> <li>10</li> <li>11</li> <li>12</li> <li>13</li> <li>14</li> <li...

ios - add prefix to UITextField -

i want add prefix of uitextfield text. uitextfield text length less 7. how many characters less 7, replace zeros. if text "1234", add prefix "0001234". if text "12345", add prefix "0012345". if text "123", add prefix "0000123". can 1 suggest me, how implement. it sounds want numbers-only string 7-characters long, left-most characters filled in padded zeros user has not entered, correct? so, need handful of methods make easy possible. first, 1 doesn't make sense right now, want method remove zeros padded @ front (it'll make sense later). so, borrowing stack overflow answer ... - (nsstring *)stringbyremovingpaddedzeros:(nsstring *)string { nsrange range = [string rangeofstring:@"^0*" options:nsregularexpressionsearch]; return [string stringbyreplacingcharactersinrange:range withstring:@""]; } and we'll borrow ilesh's answer adding padded zeros: - (nsstr...