Posts

Showing posts from May, 2012

java - How to edit a resource file from within an android app? (Android Studio) -

i'm creating android app utilizes log. i've placed file entitled "log.txt" in "raw" resource folder. have figured out how open inputstream using openrawresource , not sure how open can use printwriter it. i have tried accessing file pre-created on target device, have not succeeded. if explain me either how open resource file printwriter, i'd appreciate it. however not sure how open can use printwriter it. you can't. resources read-only @ runtime. welcome use inputstream write copy of resource's contents file on filesystem (e.g., on internal storage ), though.

fortran - Floating point numbers equality -

i using gfortran in mingw under windows 7 (32bit) compile fortran 77 code. here minimal code contained in testequal.f file: program testequal real*8 a1, a2 a1 = 0.3d0 a2 = 0.7d0 write(*,*) 1.d0 write(*,*) a1+a2 write(*,*) a1+a2.eq.1.0 write(*,*) a1+a2.eq.1.d0 end compile with gfortran testequal.f -std=legacy the output is: 1.0000000000000000 1.0000000000000000 f f but expect 2 booleans both t. problem here? with rare exceptions, don't compare floating point numbers exact equality. rules of finite-precision floating point arithmetic not same rules of real number arithmetic. compare numbers tolerance, e.g., sum = a1 + a2 if ( abs (sum - 1.0) < 1.0d-5 ) ...

windows services - How can I give SQL Server permission to read my SSL Key? -

Image
i created self-signed certificate , turned encryption on in sql server 2014: the problem sql server service won't start: this article 2010 identifies problem permissions issue: sql server service not have necessary permission read ssl cert's private key. the problem stuck on step 4 of solution proposed in article: there no group or user name matching proposed format when bring window shown in article. is there way can determine account sql server service runs under, can give permissions read ssl cert? an entirely different solution welcome too. if specify certificate, should used tls sql server, sql server windows service have read certificate and private key (the file folder %programdata%\microsoft\crypto\rsa\machinekeys ), corresponds certificate. problem is: the sql server configuration manager in not comfortable , makes not required work . thus first of 1 should localize account used sql server. 1 should start services.msc , find account

java - unable to send messages on chat program -

i writing chat program in java. can't seem able send messages. clientconnectionhandler handles instance of each client import java.io.*; import java.net.*; import java.text.*; import java.util.*; public class clientconnectionhandler extends thread { private socket socket; string username; private uuid id; //= uuid.randomuuid(); bufferedreader reader; printwriter writer; private final hashmap<uuid, clientconnectionhandler> clients = new hashmap<>(); volatile boolean messageloop = true; servergui servergui; public clientconnectionhandler(socket socket){ this.socket = socket; try{ this.socket.setsotimeout(1000); } catch (socketexception e) { system.out.println(e); } try { reader = new bufferedreader(new inputstreamreader(socket.getinputstream())); writer = new printwriter(new outputstreamwriter(socket.getoutputstream())); } catch (exception e){ e.printstacktrace(); } } public vo

python - Writing a standard deviation function -

i have dictionary of words keys , ints value. outputs such: print (word_ratings_dict) {'hate': [1, 2, 2, 1, 1, 3, 0, 2, 3, 2, 0, 4, 1, 1], 'joy': [3, 4, 3, 3, 2, 4, 1]} for each key word in dictionary, need calculate standard deviation without using statistics module. heres have far: def menu_validate(prompt, min_val, max_val): """ produces prompt, gets input, validates input , returns value. """ while true: try: menu = int(input(prompt)) if menu >= min_val , menu <= max_val: return menu break elif menu.lower == "quit" or menu.lower == "q": quit() print("you must enter number value {} {}.".format(min_val, max_val)) except valueerror: print("you must enter number value {} {}.".format(min_val, max_val)) def open_file(prompt): """ opens

ractivejs - Ractive computed attributes returned in get() -

ref this jsfiddle html: <main /> <div id='result' /> code: window.ractive = new ractive({ el: 'main', template: '<p>a thing called {{thing}}</p>', computed: { thing : function(){return "kablooie"} } }); $('#result').html(json.stringify(ractive.get())) the ractive.get() here does return value of attribute "thing". though docs computed attributes not returned get(). is intentional behaviour or bug? in edge ractive (will 0.8) using, added computed , mapped properties root via ractive.get() feature request. see this issue current proposal able root data object via ractive.get('.') , mean: window.ractive = new ractive({ el: 'main', data: { foo: 'foo' }, template: '<p>a thing called {{thing}}</p>', computed: { thing : function(){return "kablooie"} } }); console.log( json.stringify( ractive.get() ) ); // { foo: 

python - Adding attachements to slacker chat message -

i'm trying post message using slacker python api slack messages i'm not able attach link messages code below : attachments = [title, link_to_events, "more details"] print type(attachments) # list slack = slacker(slack_api_token) # send message #general channel slack.chat.post_message(slack_channel, message, attachments=attachments) in slacker code, looks looking "list" type of variable: https://github.com/os/slacker/blob/master/slacker/ init .py line 241: # ensure attachments json encoded if attachments: if isinstance(attachments, list): attachments = json.dumps(attachments) return self.post('chat.postmessage', data={ 'channel': channel, 'text': text, 'username': username, 'as_user': as_user, 'parse

javascript - how to make a button on a popup window that closes that popup window -

i have made popup window button that's supposed close window. however, not work. here code: winpopup.document.write(<input type = "button" value = "close window" onclick = "closewindow();">) function closewindow(){ winpopup.close(); } winpopup doesn't have closewindow() method. use opener's. function closewindow(){ opener.winpopup.close(); }

android - How do I save a textView -

how save textview when close , relaunch activity text still there? protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_current_homework); intent intent = getintent(); string message = intent.getstringextra(addnewhomework.extra_message); textview textview = (textview) findviewbyid(r.id.textview99); textview.settext(message); save text textview.gettext() using sharedpreference or other in ondestroy .then read in oncreate . @override public void oncreate(bundle savedinstancestate, persistablebundle persistentstate) { super.oncreate(savedinstancestate, persistentstate); setcontentview(r.layout.main); //todo initialization sharedpreferences preferences = getapplicationcontext()// .getsharedpreferences("file_name", context.mode_private); mtextview.settext(preferences.getstring("key_name","")); } @override protected v

python - What does the outer for loop do in my program? -

can please tell me functionality of outer for loop in program below: mylist = [4,67,3,7,65,3,56,] maxlengthlist = 7 print ('the number buble sort is:', mylist) in range(len(mylist)-1,0,-1): j in range(i): if mylist[j]>mylist[j+1]: temp = mylist[j] mylist[j] = mylist[j+1] mylist[j+1] = temp print('after buble sort number are:',mylist) the loop step backward ( -1 ) starting @ 6 ( len(mylist)-1 ) , stopping @ 1, last value before stop ( 0 ). see range documentation range(start, stop, step) >>> range(len(mylist)-1, 0, -1) [6, 5, 4, 3, 2, 1]

file - how to get int with fstream get() in c++ -

i newer c++, going creating file, , write int values want int values function!(here excepted type of return int ) index file, going put int values! found both fstream.put , fstream.get operate char values. there me, how job. , here code vector<int> tra1; vector<int> tra2; int last_capa = 0; for(int i=1;i<97;i++){ output.put(tra1[i-1] * 5 + tra2[i-1] + last_capa); last_capa += (tra1[i-1] - 1) * 5 + tra2[i - 1]; } below code read int here try int number operate vector<int> tra4 output.seekg(100); unsigned int n = output.get() + tra4[2]; thanks help haoran alternatively instead of get, can use fstream's operator >> read value file int. fstream fs("input.txt", std::fstream::in); //input file int k; while(fs >> k) { //do k } fs.close();

laravel 5 - Failed to listen on localhost:8000 (reason: Cannot assign requested address) -

when run on ubuntu php artisan serve laravel development server started on http://localhost:8000/ [mon apr 25 10:28:08 2016] failed listen on localhost:8000 (reason: cannot assign requested address) my hosts file /etc/hosts/ 1 27.0.0.1 localhost anyone used face same problem , how can solve this? that's because it's in use, or not available on current host. you can use command run php artisan serve --port=8080

java - Format of thousands to export Excel - DynamicReports -

i'm using dynamicreports 4.0 , i'm having 1 problem export number , decimal values in excel. values appears in text format , need values appears in numbers format , decimals in format "#,###.##". i need values in title , not working: horizontallistbuilder hlb = cmp.horizontallist(); hlb.newrow().add( cmp.text(1000).setpattern("#,###.##") ); componentbuilder<?, ?> componentbuilder = hlb; i hope can me. thanks lot hlb.newrow().add( cmp.text("1000").setpattern("#,###.##") );

windows - Simple Listbox Databinding in IronPython and WPF -

Image
bear me, i'm new gui programming, ironpython, wpf , .net. however, familiar python. have read through many tutorials regarding databinding such devhawk these advanced me. issue: i'd display in listbox control file paths python list can modified, add or remove entries. first part have accomplished following tutorials. however, when update file list, listbox control not update new files , when attempt manipulate listbox app excepts following debug message vs2012: add file click ['c:\test\employment_law_alert_03_28_2012.pdf', 'c:\test\graph paper .10in cartesian c-i-110.pdf', 'c:\test\greek alphabet symbol.pdf', 'c:\test\cnn money tipping guide - how tip.pdf'] traceback (most recent call last): file "", line 1, in systemerror: itemscontrol inconsistent items source. see inner exception more information. obviously, listbox.itemsource out of sync python list. how 1 update two? below sample codes...

Force XCode file to stay in place -

i'm in xcode 7 (though has been issue since prob xcode 4) 2 files open, 1 on left, 1 on right. i'm not using assistant editor. rather opened them each in own tab?? within single xcode shell, side-by-side. the feature find insanely annoying scenario... have filea open on left pane, , fileb open on right pane. run project, , if there's debug breakpoint set, or other issue causes xcode pause, automatically replaces filea on left pane, whatever file causing issue. i don't want filea replaced. put windows in arrangement wanted them. there xcode option won't automatic replacement of filea.

php - how to pass id in url -

i trying send id in url , getting url this: edittruck.php?truck_id=%2715%27 i need : edittruck.php?truck_id=15 idea please after want truck_id in edittruck.php page update. yes, using single quotes. i.e. edittruck.php?truck_id='27' you can use this, $truck_id = str_replace('%20',' ',$truck_id); now can pass $truck_id in single quotes also. for getting $truck_id in 'edittruck.php' file use, if(isset($_get['truck_id'])) { $truck_id = $_get['truck_id']; } ?> or use $_request instead of $_get.

xml - Is it possible to call a single XSLT Template for two or more nodes having different XPATH? -

i kind of not sure if possible or not hope is. want goes this: i have xml structured follows: <rootnode> <node1> <dataset1> <!--some xml tags here not necessary--> </dataset1> <dataset2> <!--some xml tags here not necessary--> </dataset2> <dataset3> <!--some xml tags here not necessary--> </dataset3> </node1> <node2> <dataset1> <!--some xml tags here not necessary--> </dataset1> <dataset2> <!--some xml tags here not necessary--> </dataset2> <dataset3> <!--some xml tags here not necessary--> </dataset3> </node2> <node3> <dataset1> <!--some xml tags here not necessary--> </dataset1> <dataset2> <!--some xml tags here not necessary--> </dataset2> <dataset3> <!--some xml tags here not necessary--> <

android - simple way to convert View to Matcher<View> in espresso -

for ins, following example, hope first set listener , them work espresso, how implement tomatcher @test public void testspinner2() throws exception { r.launchactivity(null); spinner sp = (spinner) r.getactivity().findviewbyid(r.id.spinner); sp.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { //do smth } }); onview(tomatcher(sp)); } i guess following code can work: public static matcher<view> tomatcher(final view v) { return new typesafematcher<view>() { @override protected boolean matchessafely(view item) { return item == v; } @override public void describeto(description description) { description.appendtext(v.tostring()); } }; }

caching - How to use redis for number of micro-services? -

i new redis. have been investigating on redis past few days.i read documentation on cache management(lru cache), commands ,etc. want know how implement caching multiple microservice(s) data . have few questions: can microservices data(cached) kept under single instance of redis server? should every microservice have own cache database in redis? how refresh cache data without setting expire? since consume more memory. some more information on best practices on redis microservices helpful. it's possible use same redis multiple microservices, make sur prefix redis cache key avoid conflict between microservices. you can use multi db in same redis instance (i.e 1 each microservice) it's discouraged because redis single threaded. the best way use 1 redis each microservices, can flush 1 of them without touch others. from personal experience redis cache in production (with 2 millions keys), there no problem using expire. encourage use it.

How to write an array of non primitive objects to Arduino EEPROM then read the array into memory each time the program starts -

i developing pill reminder electronics final year project. need store name of pill, number of times taken, hours taken during , whether active or not. created class pill below, , stored pills in array: class pill{ public: string pillname = "nothing"; boolean pilltaken = true; int hours[6]; boolean active = false; int count = 0; }; pill pills[6]; now want persist data in arduino eeprom, how can write array of pills eeprom , read data memory each time program starts. also, need update array each time command modify pill received, putting new values. @galarzaa90 has pointed right information, however, eeprom lib not work string class. why? because actual string data not stored in objects memory space, contains pointer dynamic memory elsewhere. if save string object save length, buffer size , pointer data. however, when restart duino , load string eeprom, pointer pointing to... anywhere expect. you'll nee

How to set the default font size on vim? -

i trying configure default settings gui vim. made research on web, solutions found , tried did not working. here of things tried (in .vimrc file) : set guifont = monaco:h20 set guifont=monospace 20 actually don't care monaco font. for first 1 remove spaces. whitespace matters set command. set guifont=monaco:h20 for second 1 should (the h specifies height) set guifont=monospace:h20 my recommendation setting font (if version supports it) set guifont=* this pop menu allows select font. after type set guifont? to show current guifont set to. after copy line vimrc or gvimrc. if there spaces in font add \ escape space. set guifont=monospace\ 20

flyway - Completely auto DB upgradable Spring boot application -

i trying use flyway db migrations , spring boot's flyway support auto-upgrading db upon application start-up , subsequently database used jpa layer however requires schema present in db primary datasource initialization successful. options available run sql script create required schema before flyway migrations happen. note if use flyway gradle plugin (and give url jdbc:mysql://localhost/mysql . create schema me. wondering if make happen java code on application startup. flyway not support full installation when schema empty, migration-by-migration execution. though add schema/user creation scripts in first migration, though migration scripts need executed sysdba/root/admin user , need set current schema @ beginning of each migration. if using flyway, least problematic way install schema first time manually , baseline flyway task (also manually). ready next migrations done automatically. although flyway great tool database migrations not cover particular use ca

c++ - How to let GCC compiler turn variable-division into mul(if faster) -

int a, b; scanf("%d %d", &a, &b); printf("%d\n", (unsigned int)a/(unsigned char)b); when compiling, got ... ::00401c1e:: c70424 24304000 mov dword ptr [esp],403024 %d %d ::00401c25:: e8 36ffffff call 00401b60 scanf ::00401c2a:: 0fb64c24 1c movzx ecx,byte ptr [esp+1c] ::00401c2f:: 8b4424 18 mov eax,[esp+18] ::00401c33:: 31d2 xor edx,edx ::00401c35:: f7f1 div ecx ::00401c37:: 894424 04 mov [esp+4],eax ::00401c3b:: c70424 2a304000 mov dword ptr [esp],40302a %d\x0a ::00401c42:: e8 21ffffff call 00401b68 printf will faster if div turn mul , use array store mulvalue? if so, how let compiler optimization? int main() { uint a, s=0, i, t;

entity framework - Best practices for returning a Color.FromArgb when given an int that may be null C# -

i curious best practices solution given current situation. have database storing colors in argb integer form, allow nullable since color may not need specified. using entity framework, have generated class colorargb property accessing column returns , int, expected. i've manually added property, color, returns system.drawing.color object. color property pretty go between can interact generated class in more natural fashion. setting simple as: colorargb = value.toargb(); however, getting little more interesting. here's have far: return colorargb == null ? color.empty : color.fromargb(colorargb ?? 0); as can see, want maintain idea color not necessary class, return color.empty when underlying argb value null, right hand side of null coalescing operator never reached. have guaranteed value not null, don't know how explicitly tell compiler in best practices form. not serious issue, learn. such, appreciated. edit: colorargb of type system.nullable<int>

module - Using Napp Drawer Alloy Widget for TabGroup -

could please guide me on how use napp drawer widget in tabgroup (i using 3 tabs currently)? though have not tried yet before trying out, want advises. thanks. it's not possible. drawerlayout issue nappdrawer issue

speech to text - DataRecognitionClient returns duplicated results -

i using microsoft (oxford) cognitive services speech api client sdk. the following test result after running sample code stock audio samples , without changing code (as is) --- ondatashortphraseresponsereceivedhandler --- ********* final n-best results ********* confidence=high, text="what's weather like?" confidence=high, text="what's weather like?" as can see, getting 2 identical results. wonder if can shed light why (duplicated results)? this might due fact underlying phoeneme structure might different text recognition. not common can happen.

ruby on rails - how to test that service object is initialized with the correct params? -

in rails app have background job calls service object class myjob < activejob::base def perform( obj_id ) return unless object = object.find(obj_id) myserviceobject.new(object).call end end i can test job calls service object follows: describe myjob, type: :job let(:object) { create :object } 'calls myserviceobject' expect_any_instance_of(myserviceobject).to receive(:call) myjob.new.perform(object) end end but how test job initializes service object correct params? describe myjob, type: :job let(:object) { create :object } 'initializes myserviceobject object' expect( myserviceobject.new(object) ).to receive(:call) myjob.new.perform(object) end end i want achieve above, fails expects 1 received 0 . what correct way test class initialized correctly? apparently fix adilbiy's answer turned down, here's updated answer: describe myjob, type: :job let(:object) { create :object } 'initialize

sql server - To add offset with the UTC date in SQL -

dates in database(sql) in utc. want dates based on timezone. example if it's ist (utc+05:30) want ist date , time in database. if knows, please guide me operation in database (i have date , offset of particular timezone). you've tagged sql server 2008 able use datetimeoffset .

"Could not find service for user" while setting up dreamfactory on laravel? -

while try setup dream factory in laravel.it gives error as: could not find service user also in browser console shows error as: xmlhttprequest on main thread deprecated because of detrimental effects end user's experience .please body me. looks have 2 issues going on. might able dreamfactory one. try making sure (in admin console) authorized user has default role assigned. (tap application in "apps" tab , there drop down default role on right). then ensure user role has access services (in roles tab, tap role , go access tab). this "cannot find service" error can happen when user role making request not have needed permission service. the second error way making request. looks need execute xmlhttprequest on background thread. seems second error not preventing dreamfactory api request. warning it's not ideal way make it. hope info helps.

c# - Who can help me write a regular expression? -

i find multi-line text beginning of string cc kk end, , must include string c3 , c4 , can not include string dd or ee , following test data: t1 b1 cc c3 c4 z1 t3 dd kk t4 b2 cc c4 c3 z2 t6 ee kk t7 b3 cc c3 c4 z3 t9 ff kk t7 b3 cc c4 c3 z3 t9 ff kk expected results , only: cc c3 c4 z3 t9 ff kk cc c4 c3 z3 t9 ff kk i wrote regular expression(c#), result not expected. you need make regex engine check condition before matching each single character. @"(?s)\bcc\b(?:(?!dd|ee).)*?\bkk\b" demo (?:(?!dd|ee).)*? should match character not of dd or ee , 0 or more times ( non-greedily ). \ update: (?s)\bcc\b(?:(?!\bdd\b|\bee\b).)*?\bc3\b(?:(?!\bdd\b|\bee\b).)*?\bkk\b

reactjs - react-router: change route based on scroll position of body -

i have layout fixed sidebar on left, , content on right. the content divided sections, sections listed in sidebar. ------------------------ | #sidebar | #content | | | | | - | - | | - b | ... | | - c | ... | | | - b | | | ... | | | ... | | | - c | | | ... | | | ... | ------------------------ the sidebar, being fixed, scrolls page. my current router is: <router history={browserhistory}> <route path='/:category' component={app}> <route path='/:category/:section' component={content} /> </route> </router> i'd make :section segment change when page scrolled header of section inside #content . my attempt was: componentdidupdate() { let scrolltop = this.props.scrolltop let activeitem = this.refs[0] let found = _.values(this.refs).find(function(element) { return fi

How to Change swipe Tab Title color in java Android -

by default, view pager(swipe tabs) tab title color white want change orange. can 1 me please or share if have tutorial. thanks... use style in styles.xml , assign style tab layout. <style name="mymaterialtheme.tablayout" parent="widget.design.tablayout"> <item name="tabindicatorcolor">@android:color/white</item> <item name="tabindicatorheight">3dp</item> <item name="tabtextappearance">@style/mymaterialtheme.tablayout.textappearance</item> <item name="tabselectedtextcolor">@android:color/white</item> <item name="android:background">@color/colorprimary</item> </style> <style name="mymaterialtheme.tablayout.textappearance" parent="textappearance.design.tab"> <item name="android:textsize">14sp</item> <item name="android:textcolor">@color/tab_text_inactive</item> &

geometry - LAPACK: Solving large periodic banded system of equations -

i have solve large number of simultaneous equations (~1000s) solve @ every time step general mean curvature flow problem. problem defined on closed manifolds boundary condition periodic. i using successive-over-relaxation algorithm right solve this, slow. tried dgbtrf -> dgbtrs (without periodicity condition), , quite faster. the coefficient matrix looks this ⎛c₁ d₁ e₁ a₁ b₁⎞ ^ ⎢b₂ c₂ d₂ e₂ 0 a₂⎥ | ⎢a₃ b₃ c₃ d₃ . 0 ⎥ | ← ⎢ a₄ b₄ c₄ . . ⎥ ~1000 ⎢ 0 . . . . en₋₂⎥ | ⎢en₋₁ 0 . . . dn₋₁⎥ | ⎝dn en bn cn ⎠ v i need solve pentadiagonal systems, not symmetric , not known positive definite. is there way solve cyclic/periodic banded systems in lapack? or have use general solvers, such dgetrs ?

openldap - adding group using python-ldap -

i need add group several members. use code below import ldap import ldap.modlist modlist # open connection l = ldap.initialize("ldap://localhost:389/") # bind/authenticate user apropriate rights add objects l.simple_bind_s("cn=manager,dc=maxcrc,dc=com","secret") # dn of our new entry/object dn="cn=semuafk,ou=group,dc=maxcrc,dc=com" # dict build "body" of object attrs = {} attrs['objectclass'] = ['top','groupofnames'] attrs['member'] = 'cn=user1,ou=people,dc=maxcrc,dc=com' attrs['member'] = 'cn=user2,ou=people,dc=maxcrc,dc=com' attrs['description'] = 'ini group untuk semua dosen dokter' # convert our dict nice syntax add-function using modlist-module ldif = modlist.addmodlist(attrs) # actual synchronous add-operation ldapserver l.add_s(dn,ldif) # nice server disconnect , free resources when done l.unbind_s() adding member group attrs['member'

c++ - How to show constructor declaration with Visual studio 2012? -

Image
when hover cursor on function called in code in visual studio 2012, small box pops show declaration. how let work constructors? function(1, 2); // hover on function myclass a(1, 2); // hover on or myclass or use shortcut key the problem c++'s syntax constructor calls. works fine normal methods because method calls. constructor calls mixed object declaration, , when hover on them, vs gives tooltip object's declaration because assumes that's want. hovering on text gets same tooltip if had invoked "display quick info" command ( ctrl + k , ctrl + i ). but there "display parameter info" command, invoked ctrl + shift + space , display information you're interested in constructors. the trick have invoke command caret inside of parentheses. won't work when caret somewhere within identifier.

google oauth - Java - GMail API - Authorization code -

i trying code below. console prints out url (after pasting in address bar on browser) sends me google's user-consent page , asks permission access account. redirects me html page - far good. now, i'm not sure if receive token or authorization code. obtain from? , have send http rest call web application go along gmail api request, or can via java? public class people { public void setup() throws ioexception { httptransport httptransport = new nethttptransport(); jacksonfactory jsonfactory = new jacksonfactory(); string clientid = "client_id"; string clientsecret = "secret"; string redirecturl = "http://localhost:8080/testinggmailmail/webapps/login.html"; string scope = "https://www.googleapis.com/auth/contacts.readonly"; string authorizationurl = new googlebrowserclientrequesturl(clientid,redirecturl,arrays.aslist(scope)).build(); // point or redirect user aut

Azure AD application adding a key via Powershell -

i'm trying add key in azure ad application using powershell. unfortunately try first azure cli, after research , stackoverflow answers figure out, cannot done. i'm trying automate task link below via powershell: http://blog.davidebbo.com/2014/12/azure-service-principal.html i'm following these steps: https://blogs.technet.microsoft.com/kv/2015/06/02/azure-key-vault-step-by-step/ is there way create/retrieve following things in powershell: vaulturl, authclientid, authclientsecret. the way find create aad application in powershell , keep record of key use graph api. way, generate key value myself , pass in explicitly, rather try capture in output. script here: https://gist.github.com/bjh1977/0953b96e7148d6a845f5d331cb7206a5#file-createaadapplication-ps1

laravel - Ip not ping for vagrant homestead -

i getting problem when open project app url in browser getting timeout. if open ip address also timeout. have installed vagrat , virtual box on mac machine. following these steps first clone project in tony/project cd project composer install vagrant init laravel/homestead php vendor/bin/homestead make vagrant up when run vagrant ssh goes ubantu i have include homestead.yaml file ip or app name in /etc/hosts. when open app name project.app or ip 92.168.10.10 not run. when open virtual machine , there box running project_default_44443334_2323. please le me know issue . wrong. please help reboot computer , try again in browser: 192.168.10.10 192.168.10.10:8000 if still doesn't work, try temporarily turn off firewall , antivirus software, including windows built in firewall , try again.

How to preserve user-uploaded files on WebDeploy in Azure -

in azure release definition publish build artifact uat webapp using azure web deploy. deletes user-uploaded files (e.g. images). how can release uat , preserve user uploaded files? do somehow need perform equivalent of extracting .zip file on existing files rather replacing entire website directory contents of .zip? you can add following msbuild property build /p:skipextrafilesonserver=true or add msdeploy provider flag: -enablerule:donotdelete https://dotnetcatch.com/2016/02/01/webdeploymsdeploy-quick-tip-keep-existing-files-during-deployment/

java - Example on using ldap authentication for apache http client to make rest api calls -

can 1 give example on how configure apache http client use ldap authentication instead of basic authentication. basic authentication,following code. httpclient client = httpclientbuilder.create().build(); httpget = new httpget(get_taskstatus_url); string authdata = username + ":" + username; string encoded = new sun.misc.base64encoder().encode(authdata .getbytes()); get.setheader("content-type", "application/xml"); get.setheader("authorization", "basic " + encoded); get.setheader("accept", "application/xml"); httpresponse cgresponse = client.execute(get); what changes need perform in order make ldap authentication instead of basic authentication. any appreciated. thanks.

sql - Transactional replication using articles filters and delete operations -

i have problem transactional replication when use articles filters , delete operation. when insert new data publisher data meet specified filter inserted subscriber - works fine. when delete data publisher not data meet specified filter deleted subscriber , don't know why. i have 3 servers: – publisher (microsoft sql server 2012), b – distributor (microsoft sql server 2012), c – subscriber (microsoft sql server 2012). there 6 tables in publisher database. each table has primary key , of them have foreign key shown in attached picture: database diagram only first manufacturer (manufacturer id=1) data want replicate publisher subscriber, use these filters: select <published_columns> [dbo].[manufacturer] [dbo].[manufacturer].id in (select m.id [dbo].[manufacturer] m m.id = 1) select <published_columns> [dbo].[catalog] [dbo].[catalog].id in (select c.id [dbo].[catalog] c inner join [dbo].[manufacturer] m on m.id = c.mid m.id = 1) select <published_colu

apache - Disable show path with htaccess -

how can disable output title shows name of folder path if put code in .htaccess options -indexes i access forbidden! want cancel title showing location of folder example: index of /script/upload-master/ within folder have image files still have yet see them i think this article might helpful. of - step 4: accessing , modifying markup . add htaccess file: # set index options indexoptions suppresshtmlpreamble # specify header file headername header.html then in same directory of htaccess file create header.html code: <html> <head> </head> <body> it should work. options -indexes directive, have used before, disables directory listings, shouldn't use it.

git - Unable To Add My Android Studio Project to Github -

Image
i searched lot on , other links still hang up. using android studio 1.3.2. trying add existing android studio project github facing few problems. i've done far: downloaded git windows cloned git. enter image description here after opening setting->version control enter image description here unable find git option. i tried these unable find git option. vcs-> import version control vcs-> unable version control integration but didn't find git option. in advance. please ask me if getting anything. just go settings select plugins have plugins select git integration select it. have 2 options browse repositories , install plugin disk if click browse repositories have window open can install plugin , after studio restart , see git in version control . can add stuff.

javascript - Trying to draw a pattern divided to a few parts with html5 canvas -

Image
i need draw html5 canvas shape, i'm able draw 1 canvas. i need handle each part of unique object - listen mouse on each part, determine on of parts user hovering mouse on, , let user option fill relevant part of shape. var canvas = document.getelementbyid('shape'); var context = canvas.getcontext('2d'), width = $('#shape').width(), part_width = width / parts_num; context.beginpath(); var start_x = 17, end_x = 17 + part_width; (var = 0; < parts_num; i++) { context.moveto(start_x, 0); context.lineto(end_x,0); context.moveto(start_x, 0); context.beziercurveto(50+start_x, 30, 40+start_x, 45, 13+start_x, 89); context.moveto(13+start_x, 89); context.beziercurveto(0+start_x, 110, 0+start_x, 126, 27+start_x, 174); context.moveto(28+start_x, 174); context.lineto(85+start_x,174); start_x += part_width;//80 x starting point }; context.linewidth = 5; context.strokestyle = "red"; context.stroke(); i suggest using createjs . make life w

c++ - Udp_client_server_using Multi-threading -

i implented basic udp client server application using multi threading thread not invoking...can body me.. class uu_frameworksocket { protected: struct sockaddr_in modulemysocketaddress; uu_int32 modulehostportk; uu_char* modulehostnamek; uu_int32 modulesockflagk; uu_int32* modulesockoptvaluep; public: uu_void uu_moduleinitsocket(uu_int32,uu_int32); uu_void uu_modulesetsocketoptions(uu_int32); uu_void sethostname(uu_char* ); uu_void setportnumber(uu_int32 ); uu_void uu_moduleclosesocket(uu_int32 ); uu_frameworksocket(){ modulehostportk = 3232; modulehostnamek = (uu_char*) malloc(20); strcpy(modulehostnamek,"127.0.0.1"); } }; uu_void uu_frameworksocket :: sethostname(uu_char *pshostname){ modulehostnamek = (uu_char*) malloc(20); strcpy(modulehostnamek,pshostname); } uu_void uu_frameworksocket :: setportnumber(uu_int32 iportnumber){ modulehostportk=iportnumber; } uu_void uu_frameworksocket :: uu_moduleclosesocket(uu_int32 isocketfd){ clo

Deserialization failed: Error when trying to open cube designer in Visual Studio (SSAS) -

Image
i received following error when trying open cube in designer view. due fact reorganizing measure groups , there must duplicate measure somewhere. how can re-open cube designer? can see dsv. i managed solve issue right clicking on .cube project , opening view code. i made sure measures had different names , saved cube project. <name>measure name</name> the error message disappeared , can use cube designer again.

java - Drawing function messes up, when creating connection between server and client -

Image
i'm working a tcpclient class, , tcpserver class. i've created drawing program in tcpclient, , sending point(drawing) information server, , vice-versa, make clients running on server work on "same" canvas. tcpserver: public class tcpserver { private static final int serverport = 9000; public static void main(string argv[]) throws exception { serversocket welcomesocket = new serversocket(serverport); arraylist<point> completedrawing = new arraylist<>(); arraylist<point> receivedlist = new arraylist<>(); while (true) { socket connectionsocket = welcomesocket.accept(); objectinputstream infromclient = new objectinputstream(connectionsocket.getinputstream()); objectoutputstream outtoclient = new objectoutputstream(connectionsocket.getoutputstream()); receivedlist.addall((arraylist<point>) infromclient.readobject()); completedraw

blend - WPF Attach VisualState to Object Property -

Image
i working on expression blend vs2015, have a listbox binded observablecollection of custom objects. objects expose properties arise notifypropertychanged , , works nice. i can bind parts if itemtemplate properties , list work nice want set visualstate according bool (already configured or not). created events (configured, conflost) , tried target events in triggers panel .. nothing worked. how bind visualstates members of bound object ?? itemtemplate property works other dependencyproperty , can set/reset anytime , it's visual impact reflected on ui . see below example have bound bool value togglebutton state , itemcontrol's itemtemplate changed accordingly rendering different visual . update: designed device class has device name , it's state make similar situation. , class myvisualstatemanager create bindable property. cause visualstatemanager class doesn't expose property bind directly. code below: xmal <window x:class="

PHP HTML Form Encode + Sign? -

i have api based search tool created in php , running inside of iframe on wordpress powered site. users fill out search form , using .post function upon click submit information passed second page populated url , returns json results. for reason form no longer treats spaces plus signs. i've search high , low , i'm not sure if it's wordpress or server itself. code or else @ play. i'm wondering if there way force or direct browser treat spaces + signs? ultimate problem search criteria needs pass + signs onto next page fboresults.php , not. here's form... <form name="search action="fboresults.php" method="post"> <div style="float:left;"> <lable for="searchterm">search criteria: </label> <input type="text" name="searchterm"/></br></br> </div> <div style="float:right;"> <lable for="

How do I convert .txt file to a list in python? -

i have file called movies.txt , contains list of 1000 different movie titles. e.g a nous la liberte (1932) schmidt (2002) absence of malice (1981) adam's rib (1949) .... .... i extract these movie titles in .txt file , add them list in python program getting type error. here code. note: "file name: " input 'movies.txt' . file = open((input("file name: ")), "r") movies_list = file.readlines() movies_list = [movie.strip() movie in movies_list] file.close() print(movies_list[0,1]) this error get traceback (most recent call last): file "/users/liamemery/pycharmprojects/assignmenttwo/questiontwo.py", line 40, in <module> load() file "/users/liamemery/pycharmprojects/assignmenttwo/questiontwo.py", line 6, in load print(movies_list[0,1]) typeerror: list indices must integers or slices, not tuple your problem appears displaying results. when selecting list, can either select

mule - JmsTemplate.convertAndSend throws Uncategorized exception occured during JMS processing; javax.jms.JMSException: java.io.InterruptedIOException -

i getting below exception when tried send message activemq queue in mule component using spring jms. java.io.interruptedioexception @ org.apache.activemq.transport.wireformatnegotiator.oneway(wireformatnegotiator.java:102) @ org.apache.activemq.transport.mutextransport.oneway(mutextransport.java:68) @ org.apache.activemq.transport.responsecorrelator.asyncrequest(responsecorrelator.java:81) @ org.apache.activemq.transport.responsecorrelator.request(responsecorrelator.java:86) @ org.apache.activemq.activemqconnection.syncsendpacket(activemqconnection.java:1394) @ org.apache.activemq.activemqconnection.ensureconnectioninfosent(activemqconnection.java:1510) @ org.apache.activemq.activemqconnection.createsession(activemqconnection.java:325) @ org.springframework.jms.support.jmsaccessor.createsession(jmsaccessor.java:196) @ org.springframework.jms.core.jmstemplate.execute(jmstemplate.java:457) @

c# - I get an error that says cannot implicitly convert string type to int. -

i have xml nodelist child node named "rating" rating of int type progressbar1.value = xlist[0].childnodes[1].firstchild.value; how use tostring method here? tried putting @ end of line still doesnt work progressbar.value property int xmlnode.value returns string . , error pointed, there no implicit conversation string int . if xmlnode.value value valid integer, need parse integer int32.parse method like; progressbar1.value = int32.parse(xlist[0].childnodes[1].firstchild.value);