Posts

Showing posts from 2014

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...

java - BadPaddingException when decrypting AES with the same key -

this tester: public class cryptographysimpletests extends activitytestcase { public void testscryptographyclass_encryptanddecrypt() { final string orgval = "hi world! :d"; final string key = "key"; try { final byte[] encryptkey = cryptography.deriveaes256key(key); final byte[] decryptkey = cryptography.deriveaes256key(key); //deviation method assert.asserttrue(arrays.equals(encryptkey, decryptkey)); byte[] encrypted = cryptography.encryptaes(encryptkey, orgval.getbytes()); assert.assertfalse(arrays.equals(encrypted, orgval.getbytes())); byte[] decrypted = cryptography.decryptaes(decryptkey, encrypted); assert.asserttrue(arrays.equals(orgval.getbytes(), decrypted)); } catch (exception e) { assert.fail(e.getmessage()); } } } wich fails because of last assert:...

python - Value from browser to commandline -

i'm looking pass values browser bookmarklet command-line (os x). simplest way this? assuming bookmarklet sets value in 'window', it's possible use os x yosemite's "script editor" , javascript language , pass value along commandline. // activate script hotkey // ... function valuetocli(input){ var cli = new application("terminal"); cli.activate(); // run shellscript or whatever... cli.doscript("echo " + input) } // init (function (){ var safari = new application("safari"); safari.activate(); // json custom obj: window.cttr var browservalue = safari.dojavascript('json.stringify(window.cttr)', { in: safari.windows[0].tabs[0] }); // send values along... valuetocli(browservalue); })();

php - How can I run a function with an array of checkbox values passed as an argument? -

so i'm wanting run function every time user clicks btnchangecat button...im having trouble , i'm not sure how work! im trying run showcategory($_post['chkcat'], 1)[0]; and pass array of checked checkboxes when user clicks btnchangecat button. im not sure why isn't working?? i've literally searched everywhere working solution can't find 1 work when passing values function! $showvideos = showcategory($categories, 1)[0]; $rowlength = showcategory($categories, 1)[3]; $likes = showcategory($categories, 1)[1]; $dislikes = showcategory($categories, 1)[2]; ?> <main> <div class='controller-wrap'> <div class='content-wrap'> <h3>category: </h3>hp <form action='most-liked.php' method='post'> <?php $allcategories = ["all", "sport", "automotive", "comedy", "m...

Spring 4 @RequestMapping handling REST URL with special characters -

how spring 4 handle rest url special character, such #? for example : http://localhost:8080/#/members/browse?id=1234 the following code seems not working. because spring discards after (including) #, , returns response of http://localhost:8080 could give help? @requestmapping(value = "/#/members/browse", method = requestmethod.get, produces = "application/json") public string findmembers(@requestparam(value="id", required=false) { // code } this expected behavior. it's fragment identifier , it's not meant used routing requests on server side. in browser, clicking on anchor link #/members/browse?id=5678 in same page looks anchor within page , not send request server. i think you're using javascript framework such ember or angular, provide routing components route events on client side , render views. see the router documentation ember .

Docs on which Visual Studio version was used to build Python Windows binaries? -

this question related how check compiler used build python , what version of visual studio python on computer compiled with? . however, i'd know if there documentation available tells me version used python release, without installing it . i know print(sys.version) works once installed, after fact.

c# - Is there a nuget or Microsoft package for common libraries like System, System.Data, Microsoft.CSharp for VS 2013 -

i trying reference assemblies 1 common location (c:\packages), of assemblies use nuget packages , added in same location. system libraries system, system.data , few reference framework directory, wonder if there way other copy/paste have them @ single location. using vs2013 c# 5.

java - I am trying to create a dynamic spinner -

what want populate area spinner based on city selected first spinner. have attached necessary code. if need else please fell free ask. sorry new this. thank in advance. select_location_layout.xml <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#c51162" android:orientation="vertical" > <textview android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_margintop="80dp" android:text="@string/selectcity" android:textappearance="?android:attr/textappearancemedium" /> <spinner android:id=...

c# - Print from Structures -

using system; enum accountstate { new, active, underaudut, frozen, closed } ; struct account { public accountstate state; public string name; public string adress; public int accountnumber; public int balance; public int overdraft; } ; class bankprogram { public void printaccount(account a) { console.writeline("name: " + a.name); console.writeline("address: " + a.adress); console.writeline("balance: " + a.balance); } public static void main() { account robsaccount; robsaccount.state = accountstate.active; robsaccount.name = "rob miles"; robsaccount.adress = "his house"; robsaccount.accountnumber = 1234; robsaccount.balance = 0; ...

asp.net mvc - How to write on MVC web-page result of continuous operations -

i have continuous operation on web-server (read-write cycle sourceftp targetftp many transformation data). technology of site asp mvc 3. how may write web-page result of successful portion of operation - such response.write, page complex (master page , many controls). example function start() actionresult while true ... response.write (".") 'how this??? ... end while end function you don't use response.write() in mvc application. , definitely don't use infinite loop, since cause page never finish processing , never sent browser. if understand correctly, want display page user , have page update information server. if that's case don't want long-running process on page , want separated page. page presents ui, going contain javascript code update ui based on data received server. in order push updates server browser, take @ signalr . there couple of different ways it, depending on browser supports, , library abstract...

Appium simulator - Microsoft JScript runtime error: Object expected -

Image
when i'm trying use appium 1.1.0.0 (cygnus) - android inspector - i'm receiving error: error: object expected code: 800a138f source: microsoft jscript runtime error. here screenshot: i've changed android home, can related it, i'm not sure. solution: after performing following steps problem solved: install nodejs double check if android_home set correctly (i repasted path) update appium latest version

sql server - How to make SSIS truncate numeric field in Flat File Destination -

i'd advice handling truncation issues in ssis. have column col1 money in table. i'd output text file (fixed width, ragged right). in output file, column holds col1 must 8 characters wide. in oledb data source, col1 specified as: currency [dt_cy] in both external columns , output columns tab. in flat file connection manager's advanced tab, col1 specified as: currency [dt_cy] , inputcolumnwidth set 8. if populate col1 123456789.00 , execute task, oledb source succeeds , passes rows destination, task fails : error: 0xc02020a1 @ dft_test, ffdest_test [3955]: data conversion failed. data conversion column "col1" returned status value 4 , status text "text truncated or 1 or more characters had no match in target code page.". error: 0xc02020a0 @ dft_test, ffdest_test [3955]: cannot copy or convert flat file data column "col1". i want avoid these truncation errors. in error output of source, change truncation property c...

javascript - pass id from php while loop to jquery -

i have form has select boxes. form has table , each row has been created php while loop database. example <select name="1265483" id="1265483" class="form-control"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <select name="5894253" id="5894253" class="form-control"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> the id of each select entry's id in database. want ids make onchange function send id ajax. you can use like: $("select").change(function () { $this = $(this); $.post("some/url/dot.php", {data: $this.attr("id")}, function () { // code... }); });

python - Get previously caught exception -

is possible exception caught library in python 2.7? library this: try: something_that_throw_exception except exception, e: raise exception("error", e) and type or instance of e .

java - Different package import error -

i have java project has 2 packages 'a' , 'b'. class in 'a' depends on class in 'b', compiled class in 'b' (using javac classname.java) when try compile class in 'a' package 'b' isn't recognized. explicitly import using line this: import b.*; i read online full package name given, , that's think i'm doing in import statement given fact both packages directly under src folder. would have idea on how fix problem ? in advance what may doing compiling package folder itself. if so, need exit directory instead inside source directory, , compile following command: javac a/classina.java where "classina" name of class in "a" package.

objective c - UIViewController Animation ios? -

Image
trying create below in objective-c, available in swift. tried using bridging etc, use code objective c project it's having import issues. in objective-c tried below things , partially works uiview, guess need add transitions complete uiviewcontroller. what tried - (ibaction)menubuttonpressed:(id)sender { if ([self.delegate respondstoselector:@selector(menubuttonpressed)]) { [self.delegate menubuttonpressed]; } if (!isvertical) { [uiview animatewithduration: 0.6 delay: 0.0 usingspringwithdamping: 0.3 initialspringvelocity: .8 options: 0 animations: ^ { self.transform = cgaffinetransformtranslate(self.transform, -240, 0); self.transform = cgaffinetransformrotate(self.transform, 90 * m_pi / 180); self.transform = cgaffinetransformtranslate(self.transform, 240, 0); } ...

For loop scans one less time in c -

the user enters string of characters, before enter size of string. have read , count how many times each letter entered. here code: #include <stdio.h> char ab[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}; //size = 26 int main(void) { int i, j, size, counter[26]; char temp; for(i=0; i<26; i++) { counter[i]=0; } scanf("%d",&size); for(i=0; i<size; i++) { scanf("%c",&temp); for(j=0; j<26; j++) { if(ab[j]==temp) { counter[j]++; break; } } } for(i=0; i<26; i++) { printf("we have %d %c\n",counter[i],ab[i]); } return...

c# - Code trying to find ServiceAccountCredential.cs file while accessing Google Analytics using OAUTH 2.0 -

i trying access google analytics data ga:visits , ga:transactions using oauth 2.0 authentication. have followed following steps : enabled google analytics api on https://code.google.com/apis/console/ website.also, created client id , saved .p12 key the generated email id provided read , analyze access on analytics website. i have created windows form application , downloaded nuget package using package command:- install-package google.apis.analytics.v3 references including google.apis,google.apis.analytics.v3,google.apis.auth,google.apis.auth.platformservices,google.apis.core,google.apis.platformservices added project further, while accessing data facing error :- locating source c:\code\google.com\google-api-dotnet-client\default\tools\google.apis.release\bin\debug\test\default\src\googleapis.auth.dotnet4\oauth2\serviceaccountcredential.cs while following line of code run : var credential = new serviceaccountcredential(new serviceaccountcredential.i...

ios - How to delete WKWebview cookies -

for doing this nshttpcookie *cookie; nshttpcookiestorage *storage = [nshttpcookiestorage sharedhttpcookiestorage]; (cookie in [storage cookies]) { [storage deletecookie:cookie]; } but not working on ios 8, 64-bit device. any other way clean cookies of wkwebview? appreciated. thanks. apple released new apis ios 9 , can remove domain specific cookies stored wkwebview below code, work on devices ios version 9 or later : wkwebsitedatastore *datestore = [wkwebsitedatastore defaultdatastore]; [datestore fetchdatarecordsoftypes:[wkwebsitedatastore allwebsitedatatypes] completionhandler:^(nsarray<wkwebsitedatarecord *> * __nonnull records) { (wkwebsitedatarecord *record in records) { if ( [record.displayname containsstring:@"facebook"]) { [[wkwebsitedatastore defaultdatastore] removedatao...

c - Device not found libusb debian -

i have small problem libusb.i want open usb port, port never found. result of lsusb command : bus 001 device 001: id 1d6b:0002 linux foundation 2.0 root hub bus 002 device 001: id 1d6b:0002 linux foundation 2.0 root hub bus 003 device 001: id 1d6b:0002 linux foundation 2.0 root hub bus 004 device 001: id 1d6b:0003 linux foundation 3.0 root hub bus 001 device 002: id 8087:0024 intel corp. integrated rate matching hub bus 002 device 002: id 8087:0024 intel corp. integrated rate matching hub bus 003 device 002: id 0461:4e22 primax electronics, ltd bus 001 device 003: id 046d:c326 logitech, inc. bus 001 device 004: id 080c:0300 datalogic s.p.a. gryphon d120 barcode scanner so in main.c try open 1 usb port : libusb_open_device_with_vid_pid(null, vid, pid); so main.c : #include <stdio.h> #include <libusb-1.0/libusb.h> #include <errno.h> #define vid 0x0461 #define pid 0x4e22 static struct libusb_device_handle *devh = null; int main(int argc,char** argv) { ...

How to use replace in jQuery? -

can tell me wrong code: $("#replace").text().replace("cat","dog"); you not replacing text of element. you're getting , replacing text not updating dom . $("#replace").text($('#replace').text().replace("cat","dog")); or $("#replace").text(function() { return $(this).text().replace("cat", "dog"); });

symfony - HWIOAuthBundle : Redirecting to localhost after login -

i've installed hwioauthbundle , after login success redirect localhost. ( i've configured apache work on localhost ). instead of http://localhost/web/app_dev.php/ after login, go http://localhost edited : here config.yml hwi_oauth: http_client: verify_peer: false connect: account_connector: my_user_provider # name of firewall in bundle active, setting must set firewall_name: main fosub: username_iterations: 30 properties: # these properties used/redefined later in custom fosubuserprovider service. facebook: facebook_id google: google_id linkedin: linkedin_id resource_owners: facebook: type: facebook client_id: ******* client_secret: ****** scope: "email" paths: email: email options: display: popup google: type: google client_id: *******...

android - Crashlytics doesn't deobfuscate code -

i have mysterious problem frabric(crashlytics) service. found crashlytics doesn't de-obfuscate crashlogs automatically. io.fabric.tools version 1.19.1 , android.tools version 1.2.3 in top-level build file: dependencies { classpath 'com.android.tools.build:gradle:1.2.3' classpath 'io.fabric.tools:gradle:1.19.1' } buildtypes config: buildtypes { debug{ debuggable true jnidebuggable true } release { debuggable false jnidebuggable false minifyenabled true proguardfiles 'proguard-coda.txt', 'proguard-rules.pro' } } and dependencies: compile('com.crashlytics.sdk.android:crashlytics:2.4.0@aar') { transitive = true } the proguard config file contain: -renamesourcefileattribute sourcefile -keepattributes sourcefile,linenumbertable from gradle console see tasks related crashlytics okay :app:crashlyticsstoredeobsrelease , :app:crashlyticsuploaddeobsreleas...