Posts

Showing posts from May, 2013

database - Why is a union mysql query over three tables faster than join on impossible where clauses? -

my schema set such have 3 tables player coach , manager 3 have foreign key table employee contains not more single auto-incrementing id , string type representing type of employee ie. 'player' or 'coach' or 'manager'. however, different employees have different ids based on team work for. have lookup table team_x_lookup each team (where x team number or name) maps team id global id. also, have generated column within each player coach , manager table each team contains team id, column indexed. column null if employee not on team. to fetch employee team id have 2 select statements select * employee e left join player p on (e.`type` = 'player' , p.employee_id = e.id) left join coach c on (e.`type` = 'coach' , c.employee_id = e.id) left join manager m on (e.`type` = 'manager' , m.employee_id = e.id) e.id = ( select employee_id team_x_lookup t t.team_id = 6 ); select * ( select * player team_id = 6 ...

python - pandas dataframe: meaning of .index -

i trying understand meaning of output of following code: import pandas pd index = ['index1','index2','index3'] columns = ['col1','col2','col3'] df = pd.dataframe([[1,2,3],[1,2,3],[1,2,3]], index=index, columns=columns) print df.index i expect list containing index of dataframe: ['index1, 'index2', 'index3'] however output is: index([u'index1', u'index2', u'index3'], dtype='object') this pretty output of pandas.index object, if @ type shows class type: in [45]: index = ['index1','index2','index3'] columns = ['col1','col2','col3'] df = pd.dataframe([[1,2,3],[1,2,3],[1,2,3]], index=index, columns=columns) df.index out[45]: index(['index1', 'index2', 'index3'], dtype='object') in [46]: type(df.index) out[46]: pandas.indexes.base.index so shows have index type elements 'index1...

python - Make a list of dicts by iterating over two lists (list comprehensions) -

the lists have same number of elements, , names unique. wonder, how can make dict in 1 action. this current code: fees = [fee fee in fees] names = [name name in names] mdict = [ {'fees': fee[i], 'names': names[i]} i, val in enumerate(fees)] you can use zip on both lists in list comprehension : mdict = [{'fees': f, 'names': n} f, n in zip(fees, names)]

c# - Convert SQL to LINQ with date -

i trying convert below sql command linq confused possibility convert same ouput. select * [a].[dbo].[sometable] lossdate >= dateadd(m, datediff(m, 0, getdate()) - 1, 0) , lossdate < dateadd(m, datediff(m, 0, getdate()), 0) thanks the sqlfunctions class has methods translate sql server functions when used in query. (if using .net 3.5 use this version bundled entity framework instead) your query directly translated to db.sometable.where(x => x.lossdate >= sqlfunctions.dateadd("m", sqlfunctions.datediff("m", "0", sqlfunctions.getdate()) - 1, 0) && x.lossdate < sqlfunctions.dateadd("m", sqlfunctions.datediff("m", "0", sqlfunctions.getdate()), 0));

Phylogenetics in R: collapsing descendant tips of an internal node -

Image
i have several thousand gene trees trying ready analysis codeml. tree below typical example. want automate collapsing of tips or nodes appear duplicates. instance, descendants of node 56 tips 26, 27, 28 etc way 36. of these other tip 26 appear duplicates. how can collapse them single tip, leaving tips 28 , 1 representative of other tips descendants of node 56? i know how manually 1 one, trying automate process function can identify tips need collapsed , reduce them single representative tip. far have been looking @ cophenetic function calculates distances between tips. however, not sure how use information collapse tips. here newick string below tree: ((((11:0.00201426,12:5e-08,(9:1e-08,10:1e-08,8:1e-08)40:0.00403036)41:0.00099978,7:5e-08)42:0.01717066,(3:0.00191517,(4:0.00196859,(5:1e-08,6:1e-08)71:0.00205168)70:0.00112995)69:0.01796015)43:0.042592645,((1:0.00136179,2:0.00267375)44:0.05586907,(((13:0.00093161,14:0.00532243)47:0.01252989,((15:1e-08,16:1e-08)49:0.00123243,(17:...

asterisk - How can we handle outgoing fax calls? -

we have server "elastix". there way make this? if calls on fax machine, write behavior in database , hangup immediately. i heard amd application , read lot of information, still don't quite understand, how make need. can me solution, please? thank in advance!

React Native - How to see what's stored in AsyncStorage? -

Image
i save items asyncstorage in react native , using chrome debugger , ios simulator. without react native, using regular web development localstorage , able see stored localstorage items under chrome debugger > resources > local storage any idea how can view react native asyncstorage stored items? you can use reactotron think has async storage explorer ;) https://github.com/infinitered/reactotron

c# - Xamarin Forms Portable Application MonoAndroid Build Error - Framework not found -

Image
i've made fresh xamarin forms portable project cross platform templates in visual studio 2015. haven't touched or modified of project files. when try build it, following build error: c:\program files (x86)\msbuild\14.0\bin\microsoft.common.currentversion.targets(1098,5): error msb3644: reference assemblies framework "monoandroid,version=v6.0" not found. resolve this, install sdk or targeting pack framework version or retarget application version of framework have sdk or targeting pack installed. note assemblies resolved global assembly cache (gac) , used in place of reference assemblies. therefore assembly may not correctly targeted framework intend. my project defaults are: looking @ similar questions, seem that, indeed, version of framework not installed. seems be. android sdk manager shows following: what going on here? how can resolve this. when these type of errors, 'out there' , hint of system configuration problems, it'...

java - Creating Apache JCS cache confilicts when using in a library -

long story short, have created library using apache jcs manage own objects. using compositecachemanager ccm compositecachemanager.getunconfiguredinstance(); properties props = new properties(); props.load(fis); ccm.configure(props); compositecache<serializable, serializable> cache = ccm.getcache(cache_name); above, reads configuration file , loads cache manager , works when testing library test application. but in real application, using jcs manage application related objects , problem occurs. when application booting up, first instantiates application cache manager , loads configurations , create intended. but library's cache manager, not use configurations @ , sounds instantiates default cache instance. example in library's configuration have: jcs.region.myregion=dcache jcs.region.myregion.cacheattributes=org.apache.commons.jcs.engine.compositecacheattributes jcs.region.myregion.cacheattributes.maxobjects=1200 jcs.region.myregion.cacheattributes.memory...

HTML Submit Button does not execute PHP code upon press -

i attempting run piece of code via php create table in values can inputted table , updated via ajax call. latter part not problem. however, despite similar style of program working in document, submit button doesn't @ all. attempted add hidden field button, nothing registered. below code on pages: original button, linked on include , posting main page: <form action="main.php" method="post"> <input type="hidden" name="hidden" value="13timesasecond"/> <input type="button" id="clicky" value="create" name="create"/> </form> main homepage, validations' sake. if (isset($_post['hidden'])) { include_once $includepath."module.inc.php"; echo $_post['hidden']; } else { echo "the button broke :("; } the actual module: echo "<div class=dataset> <p><u>new dataset</u></p>...

ios - Textfield placeholder font creates issue -

Image
i have added button rightview textfield. i have set attributed text custom font placeholder text. my textfield's placeholder , text font different. but when textfield's text large , if select whole text , remove not shows me placeholder text in font. shows in textfield's text font. detail explanation : my textfield's text font : opensans bold 18.0 my textfield's placeholder text font : opensans 18.0 (regular) but when select hole text (large) , delete text shows place holder text in: opensans bold 18.0 but should shows place holder text in: opensans 18.0 (regular) i think have set font every time placeholder appears/disappears. set textfield delegate , add code... func textfield(textfield: uitextfield, shouldchangecharactersinrange range: nsrange, replacementstring string: string) -> bool { let length = (textfield.text?.characters.count)! + (string.characters.count - range.length) // if there text in text field if...

javascript - Strapi.io Controller.find().exec(...) -

i try use controller.find().exec(...) method , under exec callback function try create body content. have no idea should do. think have use yield keyword there drops error if try use yield in callback function. code looks this: let value; firstcontroller.find().exec(function (error, result) { value = yield result; }); this.body = value; i tried yield , without, let , without. , of options. please let me share if have idea. have use exec because have use result , pass different find method. please try this: // retrieve value const value = yield firstcontroller.find(); // set value body this.body = value;

php - Displaying correct difference between 2 times -

Image
i'm having bit of issue getting hours worked display correct hours worked. here code using: <?php while($row = $approvedtimes->fetch()){ ?> <tr> <td><?php echo $row['userfirst'] . " ". $row['userlast']; ?></td> <td><?php echo $row['companyname']; ?></td> <td><?php echo date('y-m-d',strtotime($row['timedate'])); ?></td> <td><?php echo date("h:i a",strtotime($row['timestart'])); $start = $row['timestart']; ?></td> <td><?php echo date("h:i a",strtotime($row['timeend'])); $end = $row['timeend'] ; ?></td> <td><?php echo $row['timebreak'] . " min."; $break = $row['timebreak']; ?></td> <td><?php $hours = strtotime($end) - strtotime($start) -($break*60) ; echo number_format($...

android - Reset location provider to use actual GPS after mocking location -

as coding newbie, first question apologies if it's little rough around edges , code less epic. i'm mocking locations in android , able mock gps_provider. when mocking app not running, location not return user's actual position. there way stop mocking locations real gps position returns , updates normal? the code using mock locations (extract activity): try { lm = (locationmanager) getsystemservice(context.location_service); lm.requestlocationupdates(locationmanager.gps_provider, 50, 0, lis); lm.addtestprovider(locationmanager.gps_provider, false, false, false, false, true, true, true, criteria.power_low, criteria.accuracy_fine); loc = new location(locationmanager.gps_provider); loc.setlatitude(51.5219145); loc.setlongitude(-0.1285495); loc.settime(system.currenttimemillis()); loc.setaccuracy(10); loc.setelapsedrealtimenanos(systemclock.elapsedrealtimenanos()); t = new timer(); ...

Python requests function: url formatting unexpected ascii output -

i getting unexpected ascii characters while using requests library in python 3. search_terms = ["ö", "é", "ä"] url = "http://www.domain.com/search" in search_terms: r = requests.get(url, i) which returns: http://www.domain.com/search?%c3%b6 http://www.domain.com/search?%c3%a9 http://www.domain.com/search?%c3%a4 although expected: http://www.domain.com/search?%f6 http://www.domain.com/search?%e9 http://www.domain.com/search?%e4 can explain happened , hint @ me how desired results? i assume requests first encode unicode strings utf-8 , quote them. >>> urllib.quote(u'ö'.encode('utf-8')) %c3%b6

php - Run a command as command line from a symfony function -

how run command command line symfony function? e.g. c:\symfonyproject> php app/console my-command --option=my-option i want run command function. command export files database , place files in app/resource/translations folder symfony project. i.e. public function exportfiles(){ // want run command here. } thanks! :) you use symfony process component that. code this: private function process(outputinterface $output) { $cmd = 'php app/console my-command --option=my-option'; $process = new process($cmd); $process->settimeout(60); $process->run( function ($type, $buffer) use ($output) { $output->write((process::err === $type) ? 'err:' . $buffer : $buffer); } );

c# - Object cannot be cast from DBNull to other types in Grid view Controll -

i trying achieve code printing grand total in gridview footer using rowdatabound method. declared 2 variables inside rowdatabound method . 1 money in , money out.gridview has empty rows.i have 2 table in database 1 call deposit , call withdraw. merging 2 table using sqldataadapter.i declared 2 data table dt , dt1.inside sqldataadapter of each data table passed 2 sql query retrieve data database using 1 key coming textbox. merging 2 data table using merge method , displaying in grid view. works when trying grand total of columns having error object cannot cast dbnull other types. here sql code. sqlconnection cn = new sqlconnection(@"data source=khundokarnirjor\khundokernirjor;initial catalog=login;integrated security=true"); sqldataadapter sdr = new sqldataadapter(@"select account_number [account number],amount as[money in] deposit deposit.account_number='" + textbox1.text + "'", cn); datatable dt = new datatab...

github - Git merge during checkout with GUI tool -

i trying merge 1 file repo , found slides working want git merge single file repository own and command using is: git checkout -p other/target-branch target-file.ext but issue met asked below (probably due conflict merge?) --- b/xxxx/test.pl +++ a/xxxx/test.pl @@ -46,9 +46,6 @@ push( @inc, $1 ); -$xxxxxxxxxxxxxxxxxxxx; - &main; apply hunk index , worktree [y,n,q,a,d,/,j,j,g,e,?]? those 2 test.pl 99% same before , a/xxxx/test.pl has been updated, thought shall merge own test.pl keeps history of a/xxxx/test.pl. problem don't know how use [y,n,q,a,d..] handle conflicted merge, , know there gui tool "git mergetool" trigger kdiff3 make easier, how may use merge gui checkout command? i quite new git. doing in correct way?(using checkout merge, olnly find checkout way works me proberbly. or shall use git merge command)?

html - Gap between header and navbar -

i having problems gap between header , navbar . have no idea how rid of gap. grateful if here know how repair issue. <!doctype html> <html lang=en> <html> <head> <script src=java.js"></script> <link rel="stylesheet" type="text/css" href="style.css"> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <link rel="icon" type="image/jpg" href="link"> <!--browser icon--> <!-- latest compiled , minified css --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.c...

angular - How to specify auxiliary component for child route in angular2 router3 -

i using new route3 , know url syntax specify auxiliary component child route. i have following child route definition: const router: routerconfig = [ { path: 'component-c', component: componentc, children: [ { path: 'auxpath', component: componentaux, outlet: 'aux'}, { path: 'c1', component: componentc1 } ] } ]; and template componentc like @component({ selector: 'component-c', template: ` <div>child route component</div> <router-outlet></router-outlet> <router-outlet name="aux"></router-outlet> `, directives: [router_directives] }) url /component-c/c1 displays componentc1; however, i've tried many combinations /component-c(aux:auxpath)/c1 , /component-c/c1(aux:auxpath) , etc. , still can't figure out how componentaux displayed... you should try forming url below. this.router.navigatebyurl('/component-c/(c1//aux:auxpath)...

javascript - Set image width and height with jquery -

i upload image ck editor. when select , upload file, editor automatic write image width , height. if dont write in 2 field manualy 100% , 100%, how can edit jquery? code, writes width , height 100%, ck editor add these features style attr. $('div.content img').attr('width', '100%'); $('div.content img').attr('height', '100%'); how can modify img-s style attr jquery, , set width , height 100%? thank you! you can use jquery 's css - $('div.content img').css({ 'width' : '100%', 'height' : '100%' }); http://api.jquery.com/css/

bash - for loop output formatting: add newline with a description and space -

i'm running through list of files cat , redirecting of output single file using loop. loop works i'm looking way add descriptor line before each file's contents dumped , add space before each new file entry. here script. #!/bin/bash files=$(ls -l /home/user/*.txt | awk 'nr>=2 {print $9}') in $files; /bin/cat "$i" >> "/home/user/catfiles.txt" done my output looks this: spawn ssh user@x.x.x.x run $command quit spawn ssh user@x.x.x.x run $command quit i this: "description first file here" spawn ssh user@x.x.x.x run $command quit <space> "description second file here" spawn ssh user@x.x.x.x run $command quit <space> update: file description name need vary file using actual file name. "this $file1" "this $file2" etc,etc.. this merge them require it: for f in /home/user/*.txt;do echo "this ${f##*/}" >> /home/user/catfiles.tx...

android - Button.OnClickListener() gives error -

am new in android programming making app in when click button text gonna change... here code.. protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); button himanshubutton = (button) findviewbyid(r.id.himanshubutton); himanshubutton.setonclicklistener( new button.onclicklistener() { public void onclick(view v){ textview himanshutext = (textview)findviewbyid(r.id.himanshutext); himanshutext.settext("great himanshu rahi"); in button.onclicklistener gives me error red under line.. a better , neat way using method, ask implement setonclicklistener interface once himanshubutton.setonclicklistener(this); protected void oncreate(bundle savedinstancestate) { button himanshubutton = (button) findviewbyid(r.id.himanshubutton); himanshubutton.setonclicklistener(this); } @override public void onclick(){...

image - Deciding between lossless and lossy compression? -

i have bunch of images need store in memory, they're taking quite bit of room, want reduce. they're being stored bitmaps, hence large amount of required space. i want instead store them in sort of compressed format. want store either jpeg or png. images don't contain fine details (i.e. rough shapes, basic colours), want store these jpegs since, lossy behaviour of format won't make of difference because there isn't lot of detailed information in first place. however, images contain fine details (i.e text, subtle colours , small detailed shapes/textures), want store these pngs, because don't want fine details lost. i've done fair bit of research wasn't able find answers questions. me out these please? a) seem reasonable approach? don't have lot of experience compression. b) decide, whether store png or jpeg, thinking calculate entropy of image, , threshold it. i'm hoping "low entropy images" correspond images without fine deta...

java - Hibernate/Spring JPA findOne() calling update command -

i have method return object array. catalogversion variable tied oecatver entity. reason cannot understand, when return object[], code calls update query on oecatver. can't see cause , appears happen after object returned. queries see performed in method findone(id). shouldn't cause update, should it? public object[] getprefixcatalogversion(string itemprefix, int itembusinessunit) { catalogversion catalogversion = null; string prefixreplacementreason = null; object[] versionandreason = new object[2]; catalogprefixkey prefixkey = new catalogprefixkey(); prefixkey.setbusinessunit(itembusinessunit); prefixkey.setcatalogprefix(itemprefix); catalogprefix catprefix = catalogprefixrepository.findone(prefixkey); catalogversionkey versionkey = new catalogversionkey(); versionkey.setbusinessunit(catprefix.getkey().getbusinessunit()); versionkey.setcatalognumber(catprefix.getcatalognumber()); versionkey.setcatalogversion(catprefix.get...

javascript - advice to fix the following code with jquery -

at time selected file <input id="chunked_upload" type="file" name="the_file"> the following code handles file upload in different parts automatically runs var md5 = "", csrf = $("input[name='csrfmiddlewaretoken']")[0].value, form_data = [{"name": "csrfmiddlewaretoken", "value": csrf}]; function calculate_md5(file, chunk_size) { var slice = file.prototype.slice || file.prototype.mozslice || file.prototype.webkitslice, chunks = chunks = math.ceil(file.size / chunk_size), current_chunk = 0, spark = new sparkmd5.arraybuffer(); function onload(e) { spark.append(e.target.result); // append chunk current_chunk++; if (current_chunk < chunks) { read_next_chunk(); } else { md5 = spark.end(); } ...

c# - AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt -

i'm getting error when trying reference particular dll in asp.net c# project (wavelibmixer.dll). other users @ workplace not experience error running exact same project same configurations leads me suspect it's specific computer. target platform x64. wasn't getting error before using target platform x86 or cpu need target x64 because of new sdk using. i'm using visual studio 2015 ultimate , suppress jit optimization unchecked. also, i'm using .net framework 4.5.2 , running visual studio admin. i've gone through countless articles , forums , have tried suggested solutions no avail. appreciate provided. in advance.

java - No error in my app of finding nearby places from my application. but not showing nearby places -

i new android working on google map , google places api. have been searching last 1 month. not success. m developing app can find nearest hospitals/laboratories his/her location. please me identify problem. i'll grateful. here manifest <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.naqvi.myapplication"> <!-- access_coarse/fine_location permissions not required use google maps android api v2, must specify either coarse or fine location permissions 'mylocation' functionality. --> <uses-permission android:name="android.permission.access_fine_location" /> <uses-permission android:name="in.wptrafficanalyzer.locationgeocodingv2.permission.maps_receive" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permiss...

javascript - Fastest way to check if substring is at specific position of another string -

i have string (length 50-2000) , potential substring (length 2-8) can start @ specific position (it may occur elsewhere don't care). need test large number of strings speed key here. there faster way then: var q = basestring.indexof(searchstring, assumedindex) === assumedindex; or var q = basestring.substr(assumedindex, searchstring.length) === searchstring; keeping in mind amit said in comments, thought might add alternative (probably) faster @ least substr method: var q = basestring.startswith(searchstring, assumedindex); from mdn : the startswith() method determines whether string begins characters of string, returning true or false appropriate. small example: > "hello world!".startswith("world!",6) < true the reason argue may faster because polyfill (shown below) directly implemented substr , except browser implementations implemented natively , without string copying. should @ least fast suggested. polyfil...

pyspark - Spark randomly drop rows -

i'm testing classifier on missing data , want randomly delete rows in spark. i want every nth row, delete 20 rows. what best way this? if random can use sample method lets take fraction of dataframe . however, if idea split data training , validation can use randomsplit . another option less elegant convert dataframe rdd , use zipwithindex , filter index , maybe like: df.rdd.zipwithindex().filter(lambda x: x[-1] % 20 != 0)

.net - IdentityServer3, Identityserver3.MembershipReboot in asp core -

can use identityserver3 , identityserver3.membershipreboot in .net core? or better use https://github.com/identityserver/identityserver4 identityserver3 not written in .core , not sure if work correctly .net core projects only identity server 4 targets .net core. identity server 3 targets .net framework. see https://leastprivilege.com/2016/01/11/announcing-identityserver-for-asp-net-5-and-net-core/ initial announcement.

oracle - Selecting dynamically on a materialized view -

i have strange request client dynamically select on different materialized views. view name parameter in stored procedure. example i_materialized_view_name parameter: select * i_materialized_view_name can done? syntax?

regex - Logstash Ruby Filter to match email addresses -

this question has answer here: extract email addresses bulk text using jquery 5 answers i have ruby filter match email address in log message, remove it, , pass through anonymization filter, this... ruby { code => " begin if !event['log_message'].nil? if match = event['log_message'].match(/(\b[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}\b)/i) event['user_email'] = match[1] end else puts 'oddity parsing message: log_message nil' puts event.to_yaml end rescue exception => e puts 'exception parsing user email:' puts e.message end " } if [user_email] { anonymize { algorithm => "sha1" fields => ["user_email"] key => "mysupersecretpassword" } ruby { code => ...

SQL Server 2008 : SELECT min(date) -

i'm trying simple select statement i'm having hard time doing it. i have table these columns: companyid, companydept, dateadded i'm trying select statement this... select companyid, companydept min(dateadded) so there multiple dates dateadded - i'm trying select companydept , companyid earliest dateadded . edit: select companyid, companydept dateadded=min because there might 3 or more dates such 10/1/2015, 11/12/2015, 1/4/2016 -(rows of data mean) i'm trying select date looking @ earliest possible date (10/1/2016) you can try getting first record using top 1 , ordering date. select top 1 companyid, companydept table order dateadded

sql - ROW_NUMBER vs IDENTITY and ORDER BY -

is there difference (in terms of result set, performance or semantic meaning) between using row_number , using identity order statement in ms sql server? instance, given table column "firstname" there difference between select firstname, row_number() on (order firstname) position #mytemptable mytable and select firstname, identity(bigint) position #mytemptable mytable order firstname the semantic meaning different. first example creates integer column sequential value. the second example, using identity() creates identity column. means subsequent inserts increment. for instance, run code: select 'a' x, identity(int, 1, 1) id #t; insert #t(x) values('b'); select * #t; as processing, 2 should same in case, because firstname needs sorted. if rows wider, wouldn't surprised if row_number() version edged out other in performance. row_number() 1 column sorted , mapped original data. identity() entire row needs sorted. dif...

How to change the brightness of screen on ubuntu 16.04 -

i've move system (ubuntu 16.04) computer intel cpu computer amd cpu. i've found there no single file or directory under /sys/class/backlight/ , echo 30 > /sys/class/backlight/intel_backlight/brightness not working(but command worked in computer intel cpu). when try create folder under /sys/class/backlight/ root permission, got error operation not permitted . i've tried xbacklight , not work well. how can change brightness of screen in such situation. thanks. type command ls /sys/class/backlight/ . list driver(s) controlling backlight. you might have resort writing .conf file similar this .

How to set access permissions of google cloud storage bucket folder -

how set access permissions entire folder in storage bucket? example; have 2 folders (containing many subfolders/objects) in single bucket (let's call them folder 'a' , 'b') , 4 members in project team. 4 members can have read/edit access folder 2 of members allowed have access folder 'b'. there simple way set these permissions each folder? there hundreds/thousands of files within each folder , time consuming set permissions each individual file. help. it's poorly documented, search "folder" in gsutil acl ch manpage : grant user specified canonical id read access objects in example-bucket begin folder/: gsutil acl ch -r \ -u 84fac329bcesample777d5d22b8sample785ac2sample2dfcf7c4adf34da46:r \ gs://example-bucket/folder/

javascript - How to change the route when an element is hovered over? -

i know ng-mouse=ng-href... not proper syntax, it's trying do. how can change href when mouse hovers on element? <ul id="optionslist"> <li ng-repeat="link in links"> <a ng-mouse=ng-href="#/{{link.linkname}}" /> <div class="hvr-bubble-right">{{link.linkname}}</div> </a> </li> </ul> one way like: ng-mouseover="yourfunction(link.linkname)" and in controller: $scope.yourfunction=function(where){ $window.location.href = where; //or $state.go('some.state'); if use states. } remember include '$window' or '$state' in controller depending on use.

ruby on rails - Method definition gets 'syntax error, unexpected '=', expecting keyword_then or ';' or '\n' -

i trying define method in model , on last elsif line syntax error stating "/app/models/purchase.rb:23: syntax error, unexpected '=', expecting ')' elsif (self.invoices.sum(:current_balance) = 0 ^ ". def payment_status if self.invoices.blank? self.payment_status = "no invoices" else if self.invoices.sum(:current_balance) > 0 self.payment_status = "open" elsif self.invoices.sum(:current_balance) < 0 self.payment_status = "overpaid" elsif self.invoices.sum(:current_balance) = 0 self.payment_status = "paid" end end end i mean use equals sign there, i'm lost problem is. ideas? elsif self.invoices.sum(:current_balance) = 0 ^--- that's assignment operation. want equality test, == .

c# - Binding string property to textblock and apply custom date format -

i have textblock in wpf application binding string property displays date , time. there way apply stringformat on string property format date content. tried follows dosent work. please help. in model property public string alerttimestamp { get; set; } in view trying <textblock grid.row="0" grid.column="2" horizontalalignment="right" margin="25,5,0,0" text="{binding alerttimestamp, stringformat=0:dd mmm yyyy hh:mm:ss tt}"></textblock> the output still 7/25/2016 12:20:23 pm you need add ivalueconverter change string object datetime . this. public class stringtodatevalueconverter : ivalueconverter { public object convert(object value, type targettype, object parameter, system.globalization.cultureinfo culture) { return datetime.parse(value.tostring()); } public object convertback(object value, type targettype, object parameter, system.globalization.c...

android - mFirebaseRemoteConfig.fetch() doesn't return -

mfirebaseremoteconfig.fetch(0) .addoncompletelistener(new oncompletelistener<void>() { @override public void oncomplete(@nonnull task<void> task) { if (task.issuccessful()) { system.out.println("fetch succeeded"); // once config fetched must // values returned. mfirebaseremoteconfig.activatefetched(); } else { system.out.println("fetch failed"); } } }); i added remote config server. able values couple of times. updated remote config conditions after , fetch doesnt return anything. tried lot of approaches including moving call after on onresume , calling separate thread. updating 9.2.1 didnt worked me else can done config?

Can't install Azure WebApp Application Insights without Visual Studio -

i have wordpress installed , running in microsoft azure webapp. when created webapp, system automatically created application insights, tried enable, unlike on other webapps, server side tracking wasn't working , couldn't fix it, tried delete , added new application insights resource... unfortunately can't figure out, how running, sice dont have "deploy" button, make work, nor have visual studio - every guide recommends use , bit annoying. what need install somehow system monitor app insights in app can't find out how. (without vs) any appreciated. thanks edit (solved) :: justins comment solution problem. use application insights plugin wordpress. set of necessary things server side tracking. http://github.com/microsoft/applicationinsights-wordpress

c# - Why does this method return double.PositiveInfinity not DivideByZeroException? -

i ran following snippet in vs2015 c# interactive , got weird behavior. > double divide(double a, double b) . { . try . { . return / b; . } . catch (dividebyzeroexception exception) . { . throw new argumentexception("argument b must non zero.", exception); . } . } > divide(3,0) infinity > 3 / 0 (1,1): error cs0020: division constant 0 > var b = 0; > 3 / b attempted divide zero. > why did method return infinity while 3 / 0 threw error , 3 / b threw formated error? can force division have thrown error instead of returning infinity? if reformat method to double divide(double a, double b) { if ( b == 0 ) { throw new argumentexception("argument b must non zero.", new dividebyzeroexception()); } return / b; } would new dividebyzeroexception contain same information , structure caught exception would? it's because use system.double. as stated msdn divideb...

python - Checking if a user has been assigned a token in Django Restframework -

i setting token authentication site using django restframework , need able have user download token, catch able download token once (similar amazon aws model). in other words; there native way check if user has been assigned token in restframework? you can this: from rest_framework.authtoken.models import token django.conf import settings token = token.objects.create(user=settings.auth_user_model) now can check if given user has token: user_with_token = token.objects.get(user=user) if wanna see if user has token: is_tokened = token.objects.filter(user=user).exist() # returns boolean if entry exists means user has token assigned it. reference: here follow documentation there make sure database migrated.

javascript - Current Anchor has Different Colour and scrolls? -

i curious on how set current anchor href elements different colour others. so if there element href #home , current anchor #home should red , others should white. i'd prefer html, css, jquery, javascript. the anchors have scroll correct element. thanks in advance, blazzike. i think looking css :target() selector. you can find more details here: http://www.w3schools.com/cssref/sel_target.asp hope looking for. ;)

AngularJs Simple Edit -

i following tutorial basic understanding of angularjs. in case edit link not load object properties textbox. please let me know doing wrong here code , fiddle <body> <div class="scope" data-ng-app="mymodule" data-ng-controller="mycontroller"> <h3>angularjs filter data sample </h3> <br /> name:<br /> <input type="text" data-ng-model="name" /><br /> <input type="text" data-ng-model="position" /><br /> <button data-ng-click="addfriend()"> add friend</button> <br /> <input type="text" data-ng-model="namesearch" /><br /> <ul> <li class="li" data-ng-repeat="element in friendlist | filter:namesearch | orderby:'name'"> <strong> [{{$index + 1}}] {{ element.name | uppercase}} working {{ element.positio...

ansible - Kill own ssh connections -

i have question on ansible. want disconnect ansible session using task , after time ansible should reconnect. checked ansible galaxy. there module ssh reconnect: usage:- name: kill own ssh connections ssh-reconnect: which has python module library. added py module library folder ansible disconnect ssh sessions. but following error: fatal: [127.0.0.1]: failed! => {"changed": false, "failed": true, "invocation": {"module_name": "ssh-reconnect"}, "module_stderr": "openssh_6.6.1, openssl 1.0.1f 6 jan 2014\r\ndebug1: reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: applying options *\r\ndebug1: auto-mux: trying existing master\r\ndebug2: fd 3 setting o_nonblock\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive:...

javascript - Using call on a jquery function for multiple elements -

i have following code is, inserts after div specific id attribute when clicked on button. , increments counter used specify div inserted after. it works, want know is? how can change code around, can create object properties , create method can used insert after, lastly call specific jquery elements , job gets done. the reason enquiry want use method on other objects follows same principles has different object properties, can use single method call different objects different properties , make call insert after different divs. $(document).ready(function() { counter = 0; $("#addmeasurement").on("click", function() {++counter; //create variables insert after var container = '<div id="measurement_container' + counter + '" class="col-12 object">' var icon = '<span id="measurement_icon' + counter + '" class="flaticon-glass-of-water-with-drop" title="measurement"...