Posts

Showing posts from February, 2012

c - Why can't I type a string with space? -

i'm practicing on struct, , here simple code. i'm having problem here couldn't find answer. code asks me type song's name, artist , duration of song. typed "my lightning speed", word "my" fills song's name. word "lightning" fill artist , speed fills duration. why? how can fix it? #define _crt_secure_no_warnings #include <string.h> #include <stdio.h> #define size 20 typedef struct { char name[size]; char artist[size]; int duration; } songname; songname fillsong(); int main() { songname songnumb1, songnumb2, songnumb3; songnumb1 = fillsong(); songnumb2 = fillsong(); return 0; } songname fillsong() { songname tempc; printf("\n"); printf("enter name of song: "); scanf(" %s", tempc.name); printf("name: %s\n", tempc.name); printf("who artist? "); scanf(" %s", tempc.artist); printf("artist: %s\n...

android - Cannot resolve method 'settext(java.lang.String)' -

something weird that's happening on here, on item.settext(name); i' getting cannot resolve method 'settext(java.lang.string)' . i' creating app list view dynamically generated database results. layout <?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:orientation="horizontal" > <listview android:id="@+id/lvitems" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="study cursors" android:textappearance="?android:attr/textappearancelarge" /> </linearlayout> method public void bindview(view view, context context, cursor cursor) { listview item = (listview) view....

javascript - Firebase function is letting Invalid emails to be allowed -

i new firebase, sorry if seems basic i wrote segment of code should register user. , that, but, can fill in email not exist. this not full code, function responsible this window.createuser = function (email, password) { firebase.auth().createuserwithemailandpassword(email, password).then(function () { location.reload(); }).catch(function (error) { if (document.getelementbyid("lemail").value == "" && document.getelementbyid("lpassword").value == "") { $("#lalert").html("<strong>oh no! </strong> looks email or password inputs not filled out!"); $("#lalert").show(); } else { $("#lalert").html("<strong>oh no! </strong>" + atranslate(error.code)); $("#lalert").show(); } }); } atranslate() function gets error code , changes customized message if email doesn't exist email not real , m...

Create tuple of multiple items n Times in Python -

a list can created n times: a = [['x', 'y']]*3 # output = [['x', 'y'], ['x', 'y'], ['x', 'y']] but want make tuple in such way not returning similar result in list. doing following: a = (('x','y'))*4 # output = ('x', 'y', 'x', 'y', 'x', 'y', 'x', 'y') expected_output = (('x', 'y'), ('x', 'y'), ('x', 'y'), ('x', 'y')) any suggestions ? thanks. the outer parentheses grouping parentheses. need add comma make outer enclosure tuple: a = (('x','y'),)*4 print(a) # (('x', 'y'), ('x', 'y'), ('x', 'y'), ('x', 'y')) for context, wouldn't make sense tuple while doing f = (x + y) , example. in order define singleton tuple, comma required: a = (5) # integer = (5,) # tuple = 5, # ...

amazon web services - AWS S3 Policy wildcard ("*") works, but "s3:GetObject", "s3:PutObject", etc does not -

by following example here uploading photos amazon s3 browser able upload files browser s3 bucket. however, when attempt modify policy more specific addeing following statement access denied error: { "effect": "allow", "action": [ "s3:getobject", "s3:putobject", "s3:deleteobject" ], "resource": [ "arn:aws:s3:::[my_bucket]/${cognito-identity.amazonaws.com:sub}", "arn:aws:s3:::[my_bucket]/${cognito-identity.amazonaws.com:sub}*" ] } however, following statement allow me upload bucket: { "effect": "allow", "action": [ "*" ], "resource": [ "arn:aws:s3::[my_bucket]/${cognito-identity.amazonaws.com:sub}", "arn:aws:s3:::[my_bucket]/${cognito-identity.amazonaws.c...

android - c# Xamarin - Xamarin.Auth - get back to profilepage after fb login (How to use pages & NavigationPage) -

i'm having issue xamarin forms app . public app() { appid = this; if(loggedin) { getprofilepage(); } else { getsigninpage(); } } public static void getprofilepage() { appid.mainpage = new profilerpage(); } public static void getsigninpage() { appid.mainpage = new signinpage(); } my signin page empty , uses xamarin.auth create new activity , signin process . once authenticated , call app.instance.successfulloginaction.invoke(); // custom droid renderer back in app.cs public static action successfulloginaction { { return new action(() => { appid.mainpage = new masterpage(); // getprofilepage(); }); } } it not work , following errors : xamarin ja...

javascript - Userscript in inner #document elements -

this question has answer here: how exclude iframe in greasemonkey or tampermonkey? 2 answers i trying write tampermonkey script appends html body, reason, html dialog appears in ads. google chrome's inspect element shows this: #document <!doctype html> <html> <body> <!-- body tag --> ... </body> </html> as can see, there body tag, dialog appears in it, too. there way target main <body> tag, , not inside #document tag? what happening because @match quite greedy, runs on html documents on page. if want run on root page, can check if window "top" window. if (window !== window.top) { // not root, return return; } this may present problem when run on pages framesets, not common practice more, surprised if find problem.

html - Background-Size: auto not working as expected on android 6 -

i'm making little zoom-overlay components website, , far i'd tested on ios, ie, chrome, safari, android 7.0.1 chrome, without issue. however tested on old phone (android 6) , not behaving @ expected. appears root issue background-size: auto not rendering @ original size (images 4k, should appear quite zoomed in on 1080p screen) appear larger when contained in page. does know why background-size: auto not showing images @ true sizes? thank you. edit: think images hitting size limit , being auto-downscaled, background-size treating true size, while using image element avoids this, due automatic handling of original size values. if case, know actual limits? if remove background-size: auto in default take full width image background image

jira - Still seeing TO DO status from the default workflow even after assigning a custom workflow for my project -

i have created custom workflow tickets or issues submitted order of workflow steps is: review (all) business justification in progress verification (all) deployment testing done on hold (all) retired (all) i created custom workflow making copy of default workflow todo in progress, , done status when go edit issue in custom workflow still have option change status to (from default workflow) though custom workflow 1 selected scrum project. what need modify status default workflow isn't showing @ top of issues. for example if issue created using custom workflow status defaults review expected first step in workflow. when trying transition business justification step while viewing issue status of visible. how can remove option change status todo given not part of custom workflow applied project , instead part of default workflow. can remove default workflow project? achieve (i not sure how remove default workflow) far have been able assign own. this p...

php - Laravel 5.2 Eloquent multiple select preg_replace(): Parameter mismatch, pattern is string while replacement is an array -

i've seen multiple different answers question, none of keep use of form model binding. seems form submitting tags array, should string. ideas? controller: /** * save new news * * @param request $request * @return mixed */ public function store(newsrequest $request) { // create news object , save form data $news = news::create($request->all()); // rename image file , move public/images $image = $request->file('image'); $path = "/images/"; $ext = $image->getclientoriginalextension(); $name = str_random(12) . $ext; $image->move(public_path() . $path, $name); $news->image = $path . $name; // save new image path news object $news->save(); //associate sandbox, if not $news->sandboxes()->sync($request->input('sandboxes')); //populate news_tag pivot table chosen tags $news->tags()->sync($request->input('tags')); return redirect()->action('fp\newscontroller@index'); } here's tr...

scala - ScalaTest: Suites are being executed but no test cases are actually running? -

i using latest version of play framework, along following test dependencies build.sbt file: "org.scalatest" %% "scalatest" % "3.0.0", "org.scalatestplus.play" % "scalatestplus-play_2.11" % "2.0.0-m1" i have base specification of test cases extend from. return future[assertion] in each 1 of clauses, looks this: trait basespec extends asyncwordspec testsuite oneserverpersuite mustmatchers paralleltestexecution an example spec looks this: "put /v1/user/create" should { "create new user" in { wsclient .url(s"http://localhost:${port}/v1/user") .put(json.obj( "name" -> "username", "email" -> "email", "password" -> "hunter12" )).map { response => response.status must equal(201) } } } i decided rewrite current tests using asyncwordspec provided newe...

How to organize javascript on the front-end w/o using server technologies? -

i'm working on front-end javascript project follow characteristics: performance not matter lots of classes client only. the third point main reason asking question when research how organize javascript on client side answers include server-side library. not have access this. keep classes in 1 folder (maybe sub-folders), main script, , folder 3rd party libraries. haven't found way of doing nicely however. i've tried in 1 html file this: <!-- include 3rd party libraya --> <!-- include 3rd party librayb --> <!-- include classa script --> <!-- include classb script --> <!-- include main.js --> but main.js didn't seem know classes were. ideally i'd require but, again i've found similar uses server side tech can't use. here reduced form of tried: ./index.html: <!doctype html> <html> <head> <title>test</title> <script type="test/javascript" src="./classes...

c# - parameters not being passed in to api controller from $http.post -

Image
angularjs: $http.defaults.headers.post["content-type"]= "application/x-www-form-urlencoded"; $http({ url: 'http://localhost:17438/api/people/postperson/', method: "post", data: { name: vm.parent[i].name, dob: '01/15/2001', email: vm.parent[i].email, phone: vm.parent[i].cell, carriername: vm.parent[i].carrier, persontypeid: 1 } }) .then(function (response) { // success alert('sucess : ' + response); }, function (response) { // optional // failed alert('failure : ' + response); }); i've tried variation: var data = { name: vm.parent[i].name, dob: '01/15/2001', email: vm.parent[i].email, phone: vm.parent[i].cell, carriername: vm.parent[i].carrier, persontypeid: 1 }; $http.post('http://localhost:17438/api/people/postperson/', data); parameters being passed: {"name":"jv","dob":"01/15/2001","email":"j@live.com"...

php - 502 Bad Gateway on Docker, NPM, PHPFPM and Symfony -

due fact live in germany can "good morning" now. 04:18:15 , need sleep now. maybe can me this. these first steps docker , cant reach local symfony via webbrowser (calling http://myproject.dev:8080/ ). i 502 bad gateway message in browser here have i have 3 images. placed in /home/chucky/dockerimages/ - nginx/ - dockerfile - myproject.nginx.conf - fpmimage/ - dockerfile - symfony.pool.conf - symfony/ - dockerfile my symfony installation (default symfony fetched symfony installer) can found under /var/www/symfony inside folder lies file: docker-compose.yml now come file contents: nginx/dockerfile from debian:jessie run apt-get update && apt-get install -y nginx add myproject.nginx.conf /etc/nginx/sites-available/myproject run ln -s /etc/nginx/sites-available/myproject /etc/nginx/sites-enabled/myproject run rm /etc/nginx/sites-enabled/default run echo "upstream php-upstream { server phpfpm:9000; }" > /etc/nginx/conf.d...

Sort Map elements in java Map<String, List<String>> in reverseorder -

in java program, getting result like output: acre care race act cat expected: act cat acre care race now want sort map elements in reverse order. can result above. added code in below. public static void main(string args[]) { try { scanner sc = readwords(); map<string, list<string>> wordanagrampairs = new hashmap<>(); wordanagrampairs = mapanagrams(sc); comparator<list<string>> c = (l1, l2) -> { collections.sort(l1); collections.sort(l2); int in = l1.get(0).length() - l2.get(0).length(); if (in == 0) { return string.join(" ", l1).compareto(string.join(" ", l2)); } else { return in; } }; list<list<string>> sortedlist = wordanagrampairs.values() .stream() .filter(li -> li != null && li.size...

Call C function from Swift knowing only memory address -

i have simple function in c , pointer gets passed swift. void callback() { nslog(@"such pointer…"); } how can invoke in swift using only pointer? not invoking – works fine when invoked directly. tried following , different variations signature casting, crashes: let pointer: unsafepointer<@convention(c)() -> ()> = unsafepointer(bitpattern: …) let callback: @convention(c)() -> () = pointer.memory swift.print(callback) // (function) callback() // handling crash signal 11... tried defining callback type typedef void(*callback)(); – same thing: let pointer: unsafepointer<callback> = unsafepointer(bitpattern: …) let callback: callback = pointer.memory swift.print(callback) // (function) callback() // handling crash signal 11... to check works , points right address have objective-c function, works expected when invoked swift callback pointer. void invokecallback(uintptr_t callback) { ((void (*)()) callback)(); // such pointer… } ...

network programming - Connect IP Camera to computer without router -

i trying connect ip camera (with onboard web server) laptop (os 10.11 or win xp). if use router it's easy: both connect router , laptop can log camera , see image. i'd run on batteries , want away router. i've set ad hoc network on mac create network, , ip camera may logging in, have no idea @ ip address. i've tried adr -a , ping 169.254.255.255 (because subnet mask 255.255.0.0) neither seem work on ad hoc network. , nmap (169.254.asterisk.asterisk) returns nothing. the camera's setup instructions start plugging router ethernet. can mac or win xp laptop emulate router , allow both ethernet , wifi connections devices? thanks.

php - Laravel One-To-Many insertion on a Pivot table -

i using laravel 5.3 ad having issues on saving through hasmany relationship. i have tables employee , activity has one-to-many relation i.e each employee perform many activities. when adding activities against employee using associate() send me error: badmethodcallexception in builder.php line 2440: call undefined method illuminate\database\query\builder::associate() below db structure , code: database structure: employee (1st table) – employee_id – employee_name - created_at - updated_at activity (2nd table) – activity_id – activity_name - created_at - updated_at employee_activity (pivot table) – employee_activity_employee_id – employee_activity_activity_id model class employee: class employee extends model { protected $table = 'employee'; protected $primarykey = 'employee_id'; public function activity() { return $this->hasmany('app\models\activity', 'employee_activity', 'employee_activity_employee_id...

Python - how to open excel sheets at a particular time each day -

in job run 10 or reports day , have bad habit of forgetting them until few minutes before deadline. want make python program run in background automatically open particular excel program when need start looking @ it. i'm sure i'm not first 1 think of this, has seen before? i'm looking point me in right direction. i've searched stackoverflow, github , lots of google searches, no luck. you did not need python task, bash script or batch file more sufficient, can write command in scheduler but requested python code can run excel , open file: from subprocess import call call(r'c:\program files\microsoft office\office15\excel.exe d:\documents\servers.xlsx') this code opens servers.xlsx documents folder on d: drive beware of r before string passed call function, if not provided should use \\ instead of \

Hibernate/JPA : this criteria query does not contain implicit ON clause -

jpwh book says join operation in criteria query hibernate produces on clause foreign key constraint. i've added these foreign key constraints on database: alter table bid add foreign key (bidder_id) references user (id) alter table bid add foreign key (item_id) references item (id) alter table item add foreign key (seller_id) references item (id) so expected criteria query: private static void implicitjoin(entitymanager em) { criteriabuilder cb = em.getcriteriabuilder(); criteriaquery criteria = cb.createquery(); root<bid> b = criteria.from(bid.class); criteria.select(b).where( cb.equal( b.get("item").get("seller").get("username"), "johndoe") ); typedquery<item> query = em.createquery(criteria); list<item> results = query.getresultlist(); } translated like: select b.* bid b inner join item on b.item_id = i.id inner join user u on i.seller_id = u.id ...

python - finding minimum index of a list -

hi guys need creating function find minimum index of list includes both list of strings , list of integers. right can function find either minimum index of list of integers or strings not both @ same time. def find_index_of_min(l): """ parameter: list l returns: index of minimum element of list (returns none if list empty) """ if l == []: return none elif l == str: min = 'z' in range(len(l)): if l[i] < min: min = l[i] min_index = return min_index elif l == int: min = float('inf') in range(len(l)): if l[i] < min: min = l[i] min_index = return min_index import sys import math def main(): """ read , print file's contents. """ # filename = str(input('name of input file: ')) # string = readfile(file...

c# - UWP - How to prevent InputPane from showing and hiding automatically -

Image
i want manually control behavior of inputpane prevent showing or hiding automatically. in page put image top, want inputpane show user navigate page , keep showing until he/she clicks on specified button , prevent hiding if user clicks anywhere else in page. also want inputpane remain hidden if user clicks on textbox. i know there tryshow() , tryhide(), can't revent auto showing , hiding. the easy way control controlling focus of textbox . if set istabstop on textbox false - won't take focus , sip won't show up. if has focus - you'll need move out. if want display sip - focus textbox. note performance reasons , prevent user confusion - might make sense use textblock instead of textbox when control should not editable. xaml <page x:class="app18.mainpage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="usin...

javascript - node.js not working Object.keys -

var list = {"you": 100, "me": 75, "foo": 116, "bar": 15}; keyssorted = object.keys(list).sort(function(a,b){return list[a]-list[b]}) alert(keyssorted); // bar,me,you,foo from sorting javascript object property value i'm doing object sorting. above source working in javascript. not working in node.js. have error this. keyssorted = object.keys(list).sort(function(a,b){return list[a]-list[b]}) ^ typeerror: object.keys not function i don't know why. please me. most likely, using out-dated node.js version, v0.10 or v0.12. check version try running node -v . this old version doesn't support object.keys . can check supported features every node.js versions here . my advice update node.js version 6.9.1. version current lts (long-term support).

mysql-workbench does not see database changes made by other clients unless restarting connection -

i use mysql-workbench in order query database tables. use java application (with mysql-connector-java ) in order make changes database. every time java app modifies database unable see changes using mysql-workbench. query return no results. only after restart mysql connection , run query again, able see changes. i use mysql-workbench version 6.3.8 , mysql ver 14.14 distrib 5.7.16 , mysql-connector-java 5.1.38 , os ubuntu 16.04 lts . from java application use code in order modify database state: transaction transaction = session.begintransaction(); ..... session.save(myobject); transaction.commit(); is known issue? you have no auto commit enabled, hence changes not visible other client until explicitly called commit. can test command line mysql client , give same result. similar question has been asked few days ago: mysql workbench not reading records inserted through jdbc

linux - How to find the highest disk space usage mount? -

i'm looking command highest disk space usage mount shown. maximum %usage mount shown. running df -h filesystem size used avail use% mounted on /dev/vx/dsk/appdg/boom-vol 1.0g 19m 943m 2% /opt/blah99 500g 349g 152g 70% /opt/blah/data /dev/vx/dsk/isdg/boom-shared-vol 50g 1.6g 46g 4% /opt/blah99/product/shared /dev/vx/dsk/isdg/boom-bc-vol 150g 64g 81g 45% /opt/blah99/product/a_01 /dev/vx/dsk/isdg/boom-bt-vol 150g 47g 98g 33% /opt/blah99/product/a_02 output should - 500g 349g 152g 70% /opt/blah/data what looking is: df -h | grep -vw "^\/dev" | sort -k 5 -n | tail -n 2 | head -n 1 output of df -h | grep -vw "^\/dev" : filesystem size used avail use% mounted on 1.0g 19m 943m 2% /opt/blah99 500g 349g 152g 70% /o...

Add trigger to AWS Lambda Function using Java API -

how can add new trigger existing aws lambda function using java api? i add cloudwatch events - schedule trigger. it looks should use amazoncloudwatcheventsclient . how can set credentials client? any examples appreciated. thanks. it possible add event sources via aws sdk. faced same issue , please see code below solution using java. addpermissionrequest addpermissionrequest = new addpermissionrequest(); addpermissionrequest.setstatementid("12345ff"); //any unique string go addpermissionrequest.withsourcearn(rulearn); //cloudwatch rule's arn addpermissionrequest.setaction("lambda:invokefunction"); addpermissionrequest.setprincipal("events.amazonaws.com"); addpermissionrequest.setfunctionname("name of lambda function"); awslambdaasyncclient lambdaclient = new awslambdaasyncclient(); lambdaclient.withregion(reg...

javascript - Allow copy, paste and cut in textarea (Building keybord) -

i building keyboard want allow users copy, paste, cut keyboard short keys ctrl+c, ctrl+v ctrl+x. works when copy, paste or cut text in text area. later on can not type more text or edit current pasted text until refresh page. <textarea id="write"></textarea> jquery code: $write = $('#write'); $write.keydown(function (event) { if(!event.ctrlkey) { event.preventdefault(); $write.html($write.html() + ' tmp'); } }); it's working when paste or cut text textarea after not work. check console , see text adding in textarea tags not shown in textarea. here working link http://projects.imube.com/keyboard/ keyboard

java - How to store data from ResourceBundle's and switch fast between them? -

my server program supports several languages. know user language, needed phrase through map, initialized on starting hardcoded data. source sample: public class dictionary { private static map<string, map<string, string>> map = new hashmap<>(); static { map.put("stats", new hashmap<>()); map<string, string> stats = map.get("stats"); stats.put("en", "stats"); stats.put("ru", "Статистика"); stats.put("hi", "आँकड़े दिखाएँ"); stats.put("ar", "احصاء"); stats.put("zh", "游戏统计"); stats.put("es", "estadística"); stats.put("pt", "estatísticas"); stats.put("it", "statistiche"); } public static string getstats(string lang) { return map.get("stats").get(lang); } } i...

if statement in python not executing -

from random import randint proceed = "y" while(proceed == 'y' or proceed == 'y'): print("guess integer or 'exit'") number = input() x1 = randint(0, 9) if number x1 : print("you guessed right") else: print("number ", x1) print("do want continue, y or n?") proceed = input() in above code, if statement not executing. because of == operator not being used? input returns string , therefore check: if number x1 : will fail because string never same instance integer. instead convert integer , check equality: number = int(input()) x1 = randint(0, 9) if number == x1: print("you guessed right")

.htaccess - Stop hotlinking from another IP -

i have lot of domains , these hosting on 1 ip. i tried use below code in htaccess protect hotlinking, doesn't work. rewriteengine on rewritecond %{http_referer} !^$ rewritecond %{http_referer} !^http://(www\.)?103.222.219.45/.*$ [nc] rewriterule \.(jpg|jpeg|png|gif|ico|pdf|zip|js|css)$ - [f] how can protect hotlinking form ips? the referer header contains url of previous page. contain ip address if ip address used in url instead of host name. you need explicitly specify each of acceptable host names.

java - Authorization failed while wget azure REST API -

i trying collect azure metrics using rest api. have free subscription azure account. i using following wget json message. wget https://management.azure.com/subscriptions/xxxxxxx/resourcegroups/rg_south_india/providers/microsoft.compute/virtualmachinescalesets/linuxscal/metrics?api-version=2014-04-01 xxxxxxx- subscription id. i following error message. resolving management.azure.com... 13.67.231.219 connecting management.azure.com|13.67.231.219|:443... connected. http request sent, awaiting response... 401 unauthorized authorization failed. what wrong subscription/authorization?!! thanks in advance guys!! stuck!! you need include authorization header bearer token in call: get /subscriptions?api-version=2015-01-01 http/1.1 host: management.azure.com authorization: bearer your_access_token content-type: application/json take @ armclient , since really don't want this hand (or curl ): https://www.npmjs.com/package/armclient // es6 import armclient, {...

android - How to use GROUP BY in GreenDao -

i have found few questions related issue in so, did not me much.i want construct query in android using greendao library, query should grab rows containing particular phonenumber in descending order of datetime , want group them group name. query: list<activity> activities = activitydao.querybuilder().where(properties.contact_number.eq(phonenumber)).orderdesc(properties.date_time).build().list(); how include group in above query group rows group_name (i have group_name column in table)? i did not find group method in greendao,not sure if correct. group by not supported greendao. can use trick : where(new wherecondition.stringcondition(properties.contact_number.eq(phonenumber) + "group group_name")).orderdesc(properties.date_time).build().list(); it let build clause using string.

mysql - How do I assign the same id to rows having the same field -

i have mysql table containing 2553 novels information (like author, year etc.), , table containing 1059 authors (with biographical informations). now, authors in second table writers of novels in first table. i'd assign same id authors in first table second table ones. how can do? tried doing without success. this how 'novels' table should (at moment there isn't author_id column) __ _____ ______ _________ |id|title|author|author_id| |0 |xyz |john |0 | |1 |xyz2 |john |0 | |2 |abc |rob |1 | |3 |qwer |jeff |2 | |4 |zxcv |jeff |2 | |_________________________| this 'authors' table __ ____ _____ |id|name|birth| |0 |john|1956 | |1 |rob |1898 | |2 |jeff|1932 | |_____________| you can update join. update novels inner join authors set novels.author_id=authors.id novels.author=authors.name there after should want drop author column in novels table since becomes redundant (assuming of cou...

mongodb - Doctrine EventListener onFlush access to old Document -

i can access updated document in onflush eventlisterner of doctrine2. want complete old document store elsewhere old state. public function onflush(onflusheventargs $eventargs) { $dm = $eventargs->getdocumentmanager(); $uow = $dm->getunitofwork(); foreach ($uow->getscheduleddocumentupdates() $document) { // $document updated document // $changeset contains new , old values $changeset = $uow->getdocumentchangeset($document); // want whole old document object $olddocument } } how can access old document not change set? just use preupdate event . example: public function preupdate(preupdateeventargs $event) { $entity = $event->getentity(); // whole entity $changeset = $event->getentitychangeset(); // changed properties // check if password has been changed if ($event->haschangedfield('password')) { // stuff } ...

How to make images scroll from center to left in HTML? -

i have been wondering how make images scroll center left , how image in site. http://www.kiminona.com/index.html#story i've tried using <marquee> tag, scroll right left. , search how, found ways in css. need know how in html-only . you still can use the old marquee in case. loop center left , trict put marquee inside left div below .item { float:left; border: 1px solid green; height: 300px; width: 45%; } <div id="image" class="item"> <marquee>this text scroll _center_ left</marquee> </div> <div id="content" class="item"> content </div>

python - Get N maximum values and indices along an axis in a NumPy array -

i think easy question experienced numpy users. i have score matrix. raw index corresponds samples , column index corresponds items. example, score_matrix = [[ 1. , 0.3, 0.4], [ 0.2, 0.6, 0.8], [ 0.1, 0.3, 0.5]] i want top-m indices of items each samples. want top-m scores. example, top2_ind = [[0, 2], [2, 1], [2, 1]] top2_score = [[1. , 0.4], [0,8, 0.6], [0.5, 0.3]] what best way using numpy? i'd use argsort() : top2_ind = score_matrix.argsort()[:,::-1][:,:2] that is, produce array contains indices sort score_matrix : array([[1, 2, 0], [0, 1, 2], [0, 1, 2]]) then reverse columns ::-1 , take first 2 columns :2 : array([[0, 2], [2, 1], [2, 1]]) then similar regular np.sort() values: top2_score = np.sort(score_matrix)[:,::-1][:,:2] which following same mechanics above, gives you: array([[ 1. , 0.4], [ 0.8, 0.6], [ 0.5, 0.3]])

javascript - Expand a ternary statement or switch to if-else -

i have following works fine 2 conditions: var value = this.value === "foo" ? function(d) { return d.foo; } : function(d) { return d.bar; }; what doing wrong when try expand above following using if-else ? var value = if (this.value === "foo") { function(d) { return d.foo; }; } else if (this.value === "bar") { function(d) { return d.bar; }; } else { function(d) { return d.qux; }; } i'm happy stick operators or switching if-else : whatever more readable me. if cannot used on right-hand side of assignment statement (which part of why have conditional operator). instead, assign in each branch: var value; if (this.value === "foo") { value = function(d) { return d.foo; }; } else if (this.value === "bar") { value = function(d) { return d.bar; }; } else { value = function(d) { return d.qux; }; } ...

chromecast - Android: Crash when setting up media route button -

i'm having pretty same problem android: cast sdk v3 crashing in release build only . key difference project while i'm debugging , on line castbuttonfactory.setupmediaroutebutton(getapplicationcontext(), mmediaroutebutton); i have tried making variables public doesn't anything. full code is @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); mmediaroutebutton = (mediaroutebutton) findviewbyid(r.id.media_route_button); castbuttonfactory.setupmediaroutebutton(getapplicationcontext(), mmediaroutebutton); mcastcontext = castcontext.getsharedinstance(this); mselector = new mediarouteselector.builder() // these framework-supported intents .addcontrolcategory(mediacontrolintent.category_live_audio) .addcontrolcategory(mediacontrolintent.category_live_video) .addcontrolcategory(mediacontrolintent.category_remote_playb...

javascript - Firebase: snap.child(...).once is not a function -

i want listen data firebase first have check if keys leading specific data has been made. if have not yet been made there no problem don't have listen. i error message: snip.child(...).once not function i have tried followed documentation here seems if doing should legal. the .haschild(...) works fine. rootref.child('match-feed-comments').once('value', snip => { if (snip.haschild(this.props.matchid)) { // checking if child exists snip.child(this.props.matchid).once('value', snup => { // if child exists listen if (snup.haschild(this.props.feedcomponentid)) { snup.child(this.props.feedcomponentid).on('value', snap => { // want stuff data this.setstate({ comments: snap.val() }) }); } }); } });

xamarin.forms - Xamarin Form how slider write in ViewModel after n millisecond -

i ask best approach solving problem. have slider allows change value in viewmodel. <label text="{x:static resources:resource.frequency}" grid.row="1" grid.column="0" horizontaloptions="start" verticaloptions="center" grid.columnspan="2" /> <vm:sliderx maximum="{binding path=maxcyclicfrequency}" accuratevalue="{binding path=cyclicservosfrequency, mode=twoway}" grid.column="0" grid.row="2" grid.columnspan="3" x:name="sldmaxcyclicfrequency" /> <entry text="{binding path=cyclicservosfrequency, mode=oneway, stringformat='{}{0:f0}hz'}}" isenabled="true" grid.column="2" grid.row="1" keyboard="numeric" unfocused="setmaxcyclicfrequency" x:name="entmaxcyclicfrequency" ></entry> i wish slider write value in entry in real time, wrote value in viewmodel after n millisecon...

ios - Different Other Linker Flags for two sdk's -

in project have foreign sdks. first sdk work flag -objc , -all_load , second doesn't need these flags. if set 2 flags second sdk duplicate symbols messages. if remove flags first sdk give error unrecognized selector sent instance . how can fix problem ? there way flags -objc , -all_load exclude second sdk ? edit: first sdk dropbox ios sdk , installed on pod , need flags -objc , -all_load. the second sdk have .h , .m files , linked library libmtprotocol.a. if flags enabled in other linker flags, following duplicate messages : duplicate symbol _objc_class_$_mtexchangedatathermoframefactory in: duplicate symbol _objc_metaclass_$_mtexchangedatathermoframefactory in: duplicate symbol _objc_ivar_$_mtexchangedatathermoinputmessage._warninghumidity in: duplicate symbol _objc_ivar_$_mtexchangedatathermoinputmessage._warningdewpoint in: duplicate symbol _objc_ivar_$_mtexchangedatathermoinputmessage._packetnumber in: duplicate symbol _objc_ivar_$_mtexchangedatathermoinputmessag...