Posts

Complex animations on android -

Image
im trying make animations , feel lost. i have screen 3 buttons, when click 1 want translateanimation move top , 3 more buttons appears behind, im having trouble make animations. i explain more pictures. so, initial image , final image, on button 1 click want translate above of button 1-1 , button 1-1 1-2 , 1-3 have slide form right. most animations i´ve used before sliding elements out of screen, how can slide position new position? and how can without buttons 1-1 1-2 1-3 on screen, im using relativelayout button 1 above button 2 , have change above button 1-1 button 1-1 not created yet. im lost, appreciated.

split - String splitting in the D language -

i learning d , trying split strings: import std.stdio; import std.string; auto file = file(path, "r"); foreach (line; file.byline) { string[] parts = split(line); this fails compile with: error: cannot implicitly convert expression (split(line)) of type char[][] string[] this works: auto file = file(path, "r"); foreach (line; file.byline) { char[][] parts = split(line); but why have use char[][] ? far understand documentation, says split returns string[] , prefer. use split(line.idup) ; split template function, return type depends on argument. file.byline.front returns char[] reused performance reasons. if need parts after current loop iteration have dup or idup , whatever need.

java - How to specify a default value for an enum using avro IDL? -

i haven't found in documentation this, generic bla default values. assumption should work this: enum myenum { unspecified, specified } record test { myenum e = "unspecified"; } the genericdatumreader in java unfortunately complains finding string expects myenum. can confirm correct way use enum default value using avro idl? in case have bug elsewhere. can confirm not way , correct me? input appreciated! update: in real world version of this, seems newly added enum record causing issue though has default value. means reader schema expects enum, whereas record not contain one. schema evolution should able resolve this, seems fail. more detail: working pig here, not direct java. ok, turns out indeed correct way specify default value enum in avro idl. in case union {null, string} had been replaced enum causing trouble. remember: do not change type of field in avro !

android - Why my ViewPager's Fragments are retained by FragmentActivity -

in fragmentactivity , have fragment (let's call hubfrag) has viewpager using fragmentstatepageradapter (which create fragments, let's call them 'itemfrag'). when replace hubfrag new fragment ,hubfrag destroyed expected it's not case itemfrags objects. using eclipse mat see itemfrags objects retained fragmentmanagerimpl of fragmentactivity ... why???? i explain why don't want them still in memory: each itemfrag launch picture download , downloader (which has weakreference of itemfrag imageview )don't want process bitmap if weak reference null(to reduce memory use). but downloader decode bitmap weak reference never null... thanks! i found cause problem: populate hubfrag's viewpager using getsupportfragmentmanager , using getchildfragmentmanager resolved problem.

Arrays with same element and grab one in php -

i have array consist of further sub arrays like array ( [0] => mm [1] => cm [2] => inch ) array ( [0] => mm [1] => cm [2] => inch ) since both arrays have same elements try fetch 1 that.i try array_unique(),merge function didn't succeed.i can remove 1 array using foreach loop want know if possible single statement, bulitin function or 1 line code not more that.hopes got point.i trying reduce code if question, trying remove duplicate subarrays. try this $input = array_map("unserialize", array_unique(array_map("serialize", $input))); array_unique removes duplicates array. array_map takes 2 arguments array_map ( callable $callback , array $arr1 [, array $... ] ) it recursively runs callback on array basically code serializes array's content (each sub-array in case), removes duplicates unserialize content recreate original array more here: how remove duplicate values array in php ...

django - permission_required not working on view -

i have problem permissions on view of django. my code on view.py: @login_required(login_url='/kullanicigirisi/') @permission_required('reservationapp.change_reservation', login_url='/') def rezervasyonduzenle(request, id): there 2 app: app1: userlogin, app2: reservationapp i assigned permissions on userlogin , used permission_required on reservationapp assignments: username = request.post['username'] password = request.post['password'] user = authenticate(username=username, password=password) pr = permission.objects.get(codename='change_reservation') group = group.objects.get(name='rol1') group.permissions.add(pr) usern = user.objects.get(username=username) usern.groups.add(group) permission_required not working, everytime return login_url :/ have idea problem? if you're being redirected login_url , either user not logged in, or user doesn't have permission reservationapp.change_r...

tsql - Sql server - recursive delete -

i'm trying delete user's data , it's related data located in different tables. tables have foreign keys without cascade delete. i investigated options: enable cascade delete on fk, delete , remove cascade delete. delete bottom up, loop leaves delete , repeat operation till root. are there more smart option or other techniques? i'm using microsoft sql server 2012 (sp1) oracle solution: how generate delete statements in pl/sql, based on tables fk relations? sql server solution: generate delete statement foreign key relationships in sql 2008? hope helps