Friday 15 April 2011

ios - Am I able to use recordID.recordName in a CKQuery? -



ios - Am I able to use recordID.recordName in a CKQuery? -

ckquery doc says: key names used in predicates correspond fields in evaluated record. key names may include names of record’s metadata properties such "creationdate” or info fields added record.

what else metadata can utilize in ckquery? able utilize record.recordid.recordname, if yes, key it?

yes, create ckquery searching recordid this:

var query = ckquery(recordtype: recordtype, predicate: nspredicate(format: "%k == %@", "creatoruserrecordid" ,ckreference(recordid: thesearchrecordid, action: ckreferenceaction.none)))

where thesearchrecordid recordid.recordname looking for

metadata fields recordid, recordtype, creationdate, creatoruserrecordid, modificationdate, lastmodifieduserrecordid, recordchangetag

see https://developer.apple.com/library/ios/documentation/cloudkit/reference/ckrecord_class/index.html#//apple_ref/doc/uid/tp40014044-ch1-sw14

ios cloudkit ckquery ckrecord

c++ - How to initialize linked list whose node is matrix? -



c++ - How to initialize linked list whose node is matrix? -

in c++, can initialize linked list nodes matrix? can utilize std::list< double[2][2]> mylist, means every node in linked list 2*2 matrix?

if cannot initialize this, how can accomplish it?

you need wrap matrix in struct or class, e.g.

#include <list> struct d { double a[2][2]; }; int main() { std::list<d> mylist; d d = { 1.0, 2.0, 3.0, 4.0 }; mylist.push_back(d); }

live demo

c++ linked-list

java - My App wont compile and when it throws an error all my resource files are gone -



java - My App wont compile and when it throws an error all my resource files are gone -

for reason whenver seek compile android studio project, keeps saying image "default" invalid. doesn't create sense because in xml file has no issue displaying when alter view design mode view. after compile, gradle throws issue , "r." turn symbol not found. i.e. whever did r.id.textview, r's turn reddish , can't alter back.

my errors:

error:error: invalid symbol: 'default' error:execution failed task ':app:processdebugresources'. > com.android.ide.common.internal.loggederrorexception: failed run command: /applications/android studio.app/sdk/build-tools/android-4.4w/aapt bundle -f --no-crunch -i /applications/android studio.app/sdk/platforms/android-20/android.jar -m /users/anuraag/androidstudioprojects/weather/app/build/intermediates/manifests/debug/androidmanifest.xml -s /users/anuraag/androidstudioprojects/weather/app/build/intermediates/res/debug -a /users/anuraag/androidstudioprojects/weather/app/build/intermediates/assets/debug -m -j /users/anuraag/androidstudioprojects/weather/app/build/generated/source/r/debug -f /users/anuraag/androidstudioprojects/weather/app/build/intermediates/libs/app-debug.ap_ --debug-mode --custom-package com.anuraagy.weather -0 apk error code: 1 output: res/drawable-hdpi-v4/default.png:0: error: invalid symbol: 'default'

main activity

package com.anuraagy.weather; import android.app.activity; import android.app.actionbar; import android.app.fragment; import android.os.asynctask; import android.os.bundle; import android.util.log; import android.view.layoutinflater; import android.view.menu; import android.view.menuitem; import android.view.view; import android.view.viewgroup; import android.os.build; import org.apache.http.httpresponse; import org.apache.http.httpstatus; import org.apache.http.statusline; import org.apache.http.client.clientprotocolexception; import org.apache.http.client.httpclient; import org.apache.http.client.methods.httpget; import org.apache.http.impl.client.defaulthttpclient; import java.io.bytearrayoutputstream; import java.io.ioexception; public class myactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_my); if (savedinstancestate == null) { getfragmentmanager().begintransaction() .add(r.id.container, new placeholderfragment()) .commit(); } } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.my, menu); homecoming true; } @override public boolean onoptionsitemselected(menuitem item) { // handle action bar item clicks here. action bar // automatically handle clicks on home/up button, long // specify parent activity in androidmanifest.xml. int id = item.getitemid(); if (id == r.id.action_settings) { homecoming true; } homecoming super.onoptionsitemselected(item); } /** * placeholder fragment containing simple view. */ public static class placeholderfragment extends fragment { public placeholderfragment() { } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.fragment_my, container, false); requesttask task = new requesttask(); task.execute(new string[]{"http://stackoverflow.com"}); homecoming rootview; } } public static class requesttask extends asynctask<string, string, string> { @override protected string doinbackground(string... uri) { httpclient httpclient = new defaulthttpclient(); httpresponse response; string responsestring = null; seek { response = httpclient.execute(new httpget(uri[0])); statusline statusline = response.getstatusline(); if(statusline.getstatuscode() == httpstatus.sc_ok){ bytearrayoutputstream out = new bytearrayoutputstream(); response.getentity().writeto(out); out.close(); responsestring = out.tostring(); } else{ //closes connection. response.getentity().getcontent().close(); throw new ioexception(statusline.getreasonphrase()); } } grab (clientprotocolexception e) { //todo handle problems.. } grab (ioexception e) { //todo handle problems.. } log.i("",responsestring); homecoming responsestring; } @override protected void onpostexecute(string result) { super.onpostexecute(result); //do response.. } } }

my xml

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin" tools:context=".myactivity$placeholderfragment"> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageview" android:src="@drawable/default" android:layout_alignparenttop="true" android:layout_alignparentleft="true" android:layout_alignparentstart="true" /> <!--<textview--> <!--android:layout_width="wrap_content"--> <!--android:layout_height="wrap_content"--> <!--android:textappearance="?android:attr/textappearancelarge"--> <!--android:text="80&#xb0;f"--> <!--android:id="@+id/textview2"--> <!--android:textsize="90sp"--> <!--android:layout_aligntop="@+id/imageview"--> <!--android:layout_alignright="@+id/textview3"--> <!--android:layout_alignend="@+id/textview3" />--> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancelarge" android:text="it's sunny. now." android:textstyle="bold" android:id="@+id/textview3" android:textsize="70sp" android:layout_above="@+id/textview4" android:layout_alignleft="@+id/textview4" android:layout_alignstart="@+id/textview4" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancelarge" android:text="stop beingness lazy , outside bruh >.>" android:textsize="14sp" android:textcolor="#7f8c8d" android:id="@+id/textview4" android:layout_alignparentbottom="true" android:layout_alignparentleft="true" android:layout_alignparentstart="true" /> </relativelayout>

fixed it, issue named image default, not allowed in android. screw resources class.

java android xml android-fragments build.gradle

visual studio 2013 - s2013 multi device hybrid apps and deploy to both android emulator and device -



visual studio 2013 - s2013 multi device hybrid apps and deploy to both android emulator and device -

iam tring run in vs2013 multi device hybrid apps , deploy both android emulator , device. maintain getting next errors.

i have added apk , modified environment settings. created emulutor in avd manger

error 14 g:\developement\windowsphone\wp8test\test20\test20\bld\debug\platforms\android\cordova\node_modules\q\q.js:126 test20 error 15 throw e; test20 error 16 ^ test20 error 17 error: failed launch application on device: error: failed install apk device: error: failed deploy device, no devices found. test20

the error appears when not have right set of drivers device installed on machine.

to prepare this, visit:

device-specific oem driver, or

google usb driver google nexus devices

once done, ensure go device manager in settings , update drivers device pointing location of download.

once done, should able deploy device seamlessly.

note: take allow usb debugging if prompted on android device.

*taken official documentation.

android visual-studio-2013 multi-device-hybrid-apps

json - Override how Data.Aeson handles only one field of my record -



json - Override how Data.Aeson handles only one field of my record -

i making rest api university courses:

data course of study = course of study { id :: maybe text, name :: text, deleted :: bool } deriving(show, generic) instance fromjson course of study instance tojson course of study

i allow deleted optional in serialized json structure, not in application. want set deleted false if isn't specified when parsing.

i write manual instance fromjson, don't want have write out fields. want declare how deleted handled , allow automatic instance handle else.

how this?

to knowledge there not way customize generic instance, construction type bit differently:

data course of study = course of study { courseid :: maybe text -- don't utilize `id`, it's function , name :: text } deriving (show, generic) info deletable = deletable { deleted :: bool , item :: } deriving (show) instance fromjson course of study instance tojson course of study instance fromjson => fromjson (deletable a) parsejson (object v) = <- parsejson (object v) d <- v .:? "deleted" .!= false homecoming $ deletable d parsejson _ = mzero

now can do

> allow nodeleted = "{\"name\":\"math\",\"courseid\":\"12345\"}" :: text > allow withdeleted = "{\"name\":\"math\",\"courseid\":\"12345\",\"deleted\":true}" :: text > decode nodeleted :: maybe (deletable course) (deletable {deleted = false, item = course of study {courseid = "12345", name = "math"}}) > decode nodeleted :: maybe course of study (course {courseid = "12345", name = "math"}) > decode withdeleted :: maybe (deletable course) (deletable {deleted = true, item = course of study {courseid = "12345", name = "math"}}) > decode withdeleted :: maybe course of study (course {courseid = "12345", name = "math"})

and can optionally tag course of study deletable when need it, , fromjson instances take care of everything.

json haskell aeson

ios - Add button only in Code? -



ios - Add button only in Code? -

i'm trying add together button in code. in xcode simulator works not on device :

fatal error: unexpectedly found nil while unwrapping optional value

my code:

@iboutlet weak var playbutton: uibutton! override func viewdidload() { super.viewdidload() allow image = uiimage(named: "playbutton.png") uiimage playbutton = uibutton.buttonwithtype(uibuttontype.system) uibutton playbutton.frame = cgrectmake(10, 10, 100, 100) // crash here playbutton.center = cgpointmake(self.frame.width/2, self.frame.height/1.7) playbutton.addtarget(self, action: "transition:", forcontrolevents: uicontrolevents.touchupinside) playbutton .setbackgroundimage(image, forstate: uicontrolstate.normal) self.view?.addsubview(playbutton) }

someone can help me?

that makes no sense - if using @iboutlet means button created in storyboard, hence not need initialize it:

let image = uiimage(named: "playbutton.png") uiimage playbutton = uibutton.buttonwithtype(uibuttontype.system) uibutton playbutton.frame = cgrectmake(10, 10, 100, 100) // crash here playbutton.center = cgpointmake(self.frame.width/2, self.frame.height/1.7) playbutton.addtarget(self, action: "transition:", forcontrolevents: uicontrolevents.touchupinside) playbutton .setbackgroundimage(image, forstate: uicontrolstate.normal) self.view?.addsubview(playbutton)

remove of above code , set in storyboard instead. @ibaction should separate method hooked touchupinside of button in storyboard.

ios iphone swift uibutton

ios - iAd enabled app not receiving any requests -



ios - iAd enabled app not receiving any requests -

the lastly iad enabled app released started generating requests appeared in app store, did not generate impressions 3-4 days until started receiving ads apple (that behavior normal)

yesterday released iad enabled app , has not generated single request allow lone impression. https://itunes.apple.com/us/app/barograph/id926055907?mt=8

the app not listed kids. app generate test ads when running beta builds before submitting it. apps shows in iad.apple.com dashboard greenish lite , says recieving ads, has not generated single request yet. contracts in itc date.

is there might have done wrong, or have forgotten preventing me getting advertisement requests?

the reply is, appears normal. though apps generate requests immediately, others take few days (in both cases takes few days generate actual impressions). latest app started receiving requests on 24 hours after release date , started generating impressions @ same time. dapp before started generating requests did not impressions 3-4 days.

ios cocoa-touch ios8 iad

bash - Replace a string in the last 100 records on a file using awk -



bash - Replace a string in the last 100 records on a file using awk -

so got around processing lastly 100 records of file declaring variable using wc -l i'm having hard time getting sub portion of awk want.

the text below illustration helps me point across table

gold 1 1986 usa american eagle gold 1 1908 austro-hungarian empire franz josef 100 korona silver 10 1981 usa ingot gold 1 1984 switzerland ingot gold 1 1979 rsa krugerrand gold 0.5 1981 rsa krugerrand gold 0.1 1986 prc panda silver 1 1986 usa liberty dollar gold 0.25 1986 usa liberty 5-dollar piece

let's phone call file coins , assume there's on 400 records

awk -v v1=$(wc -l < coins) 'nr > v1-100 {gsub /gold/magic/; print}' coins

it doesn't work me, it'll work if want print first field can't seem around specifying number of records , processing them. i'd know how go on replacing string , if needed, printing fields off of processed text after replacing string awk , print entire file including records have been replaced

give try:

awk -v v1="$(wc -l < coins)" 'nr>(v1-100){gsub(/gold/,"magic")}7' coins

this output 400 lines (say file has 400lines), substitution done on lastly 100 lines.

or line number reading file twice awk:

awk 'nr==fnr{num=nr;next}fnr>(num-100){gsub(/gold/,"magic")}7' coins coins edit

op wants lastly 100 lines in output:

awk 'nr==fnr{num=nr;next}fnr>(num-100){gsub(/gold/,"magic");print}' coins coins

or can utilize tail:

tail -100 coins|awk 'gsub(/gold/,"magic")+7'

bash awk gsub

c# - MVC Foolproof Validation RequiredIfFalse returning error incorrectly -



c# - MVC Foolproof Validation RequiredIfFalse returning error incorrectly -

i'm using mvc foolproof validation library create dependent requirements:

public bool isrequired { get; set; } [requirediftrue("isrequired", errormessage = "this field required")] public int requirediftrueselectid { get; set; }

this works on client side, allowing me submit form without requirediftrueselectid value (i.e. value 0), on [httppost] modelstate.isvalid returns false, , next result in immediate window:

myviewmodel.isrequired true modelstate["requirediftrueselectid"].errors[0] {system.web.mvc.modelerror} errormessage: "a value required." exception: null

i'm ensuring i'm posting value of requirediftrueselectid (as can see in first immediate window query above). why getting "a value required" message, , how can suppress error?

by way, i'm in mvc5. maybe modelstate implementation has changed since foolproof's lastly update 2 years ago? else know of more recently-published library functions foolproof?

controller method:

[httppost] public virtual actionresult validationtest(testviewmodel vm) { //breakpoint here check modelstate.isvalid homecoming view(vm); }

oh, duh. field value type.

value types required. need create type nullable if want optional.

notice error message not same error message used in validator, that's first clue.

c# asp.net-mvc foolproof-validation

git - Check if a commit is merged to another branch, and if so, what is the merge commit? -



git - Check if a commit is merged to another branch, and if so, what is the merge commit? -

suppose git repo has 2 branches, master , test. commita made on test branch. want check:

whether commita has been merged master branch? if so, sha of merge commit?

i want check these programmatically (not using gitk).

by example, branch test @ commit commita. can check commita has been merged master command:

git branch --contains test

this should list branches contains commita, check see if master in list.

for getting sha of commita type:

git rev-parse test

the sha of merge commit , commita same.

git merge

ios - Difference between implicit and explicit return from single-expression Closure in Swift -



ios - Difference between implicit and explicit return from single-expression Closure in Swift -

i encountered unusual problem swift compiler.

this code failed compile:

let str = "012345,abc,officer" allow components = split(str, { homecoming $0 == "," }) // ^ error: 'nsstring' not subtype of 'string'

while (without return) compiles , works expected:

let components = split(str, { $0 == "," }) // -> ["012345", "abc", "officer"]

i don't understand why first 1 failed. understanding the doc, { look } syntax sugar of { homecoming look }.

is kind of bug, or missing something?

if create own func split, works regardless of return.

func mysplit(seq: string, isseparator: ((character) -> booleantype)) -> [string]{ var ret:[string] = [] var startidx = seq.startindex; var idx = seq.startindex; idx < seq.endindex; idx = idx.successor() { if isseparator(seq[idx]) { ret.append(seq[startidx ..< idx]) startidx = idx.successor() } } if(startidx <= seq.endindex) { ret.append(seq[startidx ..< seq.endindex]) } homecoming ret; } allow result1 = mysplit(str, { $0 == "," }) allow result2 = mysplit(str, { homecoming $0 == "," })

edit: found of these work.

split(str, { (chr:character) -> bool in homecoming chr == "," }) split(str, { (chr:character) -> bool in chr == "," }) split(str, { chr -> bool in homecoming chr == "," }) split(str, { chr -> bool in chr == "," }) split(str, { (chr:character) in chr == "," }) split(str, { chr in chr == "," }) split(str, { $0 == "," })

but these fail:

split(str, { (chr:character) in homecoming chr == "," }) split(str, { chr in homecoming chr == "," }) split(str, { homecoming $0 == "," })

edit2:

making mysplit reproduces problem.

func mysplit<r:booleantype>(seq: string, isseparator:(character) -> r) -> [string] {

ios swift swift-playground

html - Rearrange divs through css -



html - Rearrange divs through css -

i have 3 3 kid div's class span2, span7 , span3 respectively. when browser width below 763px want in order span2, span3 , span7. how through css?

here initial code:

<div class="row-fluid"> <div class="span2"> </div> <div class="span7"> </div> <div class="span3"> </div> </div>

you accomplish using flexible boxes layout , flex order this:

jsfiddle - demo

class="snippet-code-css lang-css prettyprint-override">.row-fluid > div { width: 100px; height: 100px; border: 1px solid red; } @media (max-width: 763px) { .row-fluid { display: flex; flex-wrap: wrap; flex-direction: column; } .span2 { order: 1; } .span7 { order: 3; } .span3 { order: 2; } } class="snippet-code-html lang-html prettyprint-override"><div class="row-fluid"> <div class="span2">span2</div> <div class="span7">span7</div> <div class="span3">span3</div> </div>

html css

php - Exported Database is Empty -



php - Exported Database is Empty -

i have code backup database using mysqldump. however, output file blank info inside. below script.

$command = "mysqldump -u root -p vti_ctes_demo > db/backupfile.sql"; system($command);

mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql

it looks forgetting type password

php mysql database mysqldump

c# - How do you specify command line arguments in a .csproj's StartProgram setting? -



c# - How do you specify command line arguments in a .csproj's StartProgram setting? -

i'm trying specify command line arguments executable in <startprogram> value of <propertygroup> looks this

<propertygroup> <startaction>program</startaction> <startprogram>$(solutiondir)\edge.express\node.exe</startprogram> </propertygroup>

i'm trying automate steps involved in attaching library running process team can straight debug library without additional ceremony (they're not familiar visual studio yet)

i copied node executable edge.express folder , express server configuration in server.js @ location. want this:

<propertygroup> <startaction>program</startaction> <startprogram>$(solutiondir)\edge.express\node.exe server</startprogram> </propertygroup>

but throws next exception

removing "server" arg fires instance of node.

how give "server" argument node.exe within <startprogram> setting?

alternatively there way set startaction run batch script , force server startup script?

a quick search did not homecoming documentation on available startactions are

as hans pointed out: if want specify arguments <startaction> program, have utilize <startarguments> element:

class="lang-xml prettyprint-override"><startaction>program</startaction> <startprogram>$(solutiondir)\edge.express\node.exe</startprogram> <startarguments>server</startarguments>

c# visual-studio-2013 msbuild

svn - How to get user name instead of user ID in Author column in TortoiseSVN -



svn - How to get user name instead of user ID in Author column in TortoiseSVN -

our organization uses numeric user ids (ldap authenticated) ab12345. in tortoise svn under author column shows numeric user ids , it's hard identify user.

is there way alter user id username in author column?

svn tortoisesvn username userid author

python - How to create sound of ball bouncing off of bar -



python - How to create sound of ball bouncing off of bar -

i working on little pong game, wondering on how add together sound game when ball bounces off of 1 of paddles, create sound want.

this code, , sound file have called "blop.wav".

import pygame pygame.locals import * sys import exit import random pygame.init() screen=pygame.display.set_mode((640,480),0,32) pygame.display.set_caption("pong pong!") #creating 2 bars, ball , background. = pygame.surface((640,480)) background = back.convert() background.fill((0,0,0)) bar = pygame.surface((10,50)) bar1 = bar.convert() bar1.fill((0,0,255)) bar2 = bar.convert() bar2.fill((255,0,0)) circ_sur = pygame.surface((15,15)) circ = pygame.draw.circle(circ_sur,(0,255,0),(15/2,15/2),15/2) circle = circ_sur.convert() circle.set_colorkey((0,0,0)) # definitions bar1_x, bar2_x = 10. , 620. bar1_y, bar2_y = 215. , 215. circle_x, circle_y = 307.5, 232.5 bar1_move, bar2_move = 0. , 0. speed_x, speed_y, speed_circ = 250., 250., 250. bar1_score, bar2_score = 0,0 #clock , font objects clock = pygame.time.clock() font = pygame.font.sysfont("calibri",40) while true: event in pygame.event.get(): if event.type == quit: exit() if event.type == keydown: if event.key == k_up: bar1_move = -ai_speed elif event.key == k_down: bar1_move = ai_speed elif event.type == keyup: if event.key == k_up: bar1_move = 0. elif event.key == k_down: bar1_move = 0. score1 = font.render(str(bar1_score), true,(255,255,255)) score2 = font.render(str(bar2_score), true,(255,255,255)) screen.blit(background,(0,0)) frame = pygame.draw.rect(screen,(255,255,255),rect((5,5),(630,470)),2) middle_line = pygame.draw.aaline(screen,(255,255,255),(330,5),(330,475)) screen.blit(bar1,(bar1_x,bar1_y)) screen.blit(bar2,(bar2_x,bar2_y)) screen.blit(circle,(circle_x,circle_y)) screen.blit(score1,(250.,210.)) screen.blit(score2,(380.,210.)) bar1_y += bar1_move # motion of circle time_passed = clock.tick(30) time_sec = time_passed / 1000.0 circle_x += speed_x * time_sec circle_y += speed_y * time_sec ai_speed = speed_circ * time_sec #ai of computer. if circle_x >= 305.: if not bar2_y == circle_y + 7.5: if bar2_y < circle_y + 7.5: bar2_y += ai_speed if bar2_y > circle_y - 42.5: bar2_y -= ai_speed else: bar2_y == circle_y + 7.5 if bar1_y >= 420.: bar1_y = 420. elif bar1_y <= 10. : bar1_y = 10. if bar2_y >= 420.: bar2_y = 420. elif bar2_y <= 10.: bar2_y = 10. #since don't know collision, ball hitting bars goes this. if circle_x <= bar1_x + 10.: if circle_y >= bar1_y - 7.5 , circle_y <= bar1_y + 42.5: circle_x = 20. speed_x = -speed_x if circle_x >= bar2_x - 15.: if circle_y >= bar2_y - 7.5 , circle_y <= bar2_y + 42.5: circle_x = 605. speed_x = -speed_x if circle_x < 5.: bar2_score += 1 circle_x, circle_y = 320., 232.5 bar1_y,bar_2_y = 215., 215. elif circle_x > 620.: bar1_score += 1 circle_x, circle_y = 307.5, 232.5 bar1_y, bar2_y = 215., 215. if circle_y <= 10.: speed_y = -speed_y circle_y = 10. elif circle_y >= 457.5: speed_y = -speed_y circle_y = 457.5 pygame.display.update()

since you're doing in pygame, want utilize pygame.mixer.

see docs, , linked examples, total details, basically, key points are:

call pygame.mixer.init() construct pygame.mixer.sound(file=path_to_wavfile) each wavfile. every time want play sound, phone call thesound.play().

by default, 8 channels; if seek play 9 simultaneous sounds, 1 of them fail play. if want things like, say, stop background loop temporarily free channel sound effect, can handle manually, or can reserve of channels different purposes, etc. usually, basics enough.

which formats pygame.mixer.sound can handle depend on libraries compiled pygame/sdl build. .wav format should there, if don't want rely on that, can utilize stdlib's wave module read file, sound(buffer=…) constructor.

python python-2.7 audio pygame pong

Substitute R values -



Substitute R values -

is there faster way next r substitution

for(i in 1:545082) { index = i*33 a[index,]$pred = b[index,]$pred }

this loop seems take forever in r. thanks

assuming have data.frame can utilize data.table's set function replace values reference. should fast since there no copies beingness made.

library(data.table) set(a, i=1:545082*33, j="pred", b[i:545082*33, "pred"])

r

exception handling - C#/Java "Try/Finally/Catch" equivalent construct in Delphi -



exception handling - C#/Java "Try/Finally/Catch" equivalent construct in Delphi -

in delphi, how can utilize try, finally, , grab together? java/c# equivalent like:

try { // open db connection, start transaction } grab (exception e) { // roll db transaction } { // close db connection, commit transaction }

if seek in delphi, can either utilize try/finally or try/except; never 3 together. code next (which doesn't compile):

try // open db connection, start transaction except on e: exception begin // roll transaction end // compiler error: expected "end" not "finally" begin // commit transaction end

in delphi can utilize next pattern:

// initialize / allocate resource (create objects etc.) ... seek seek // utilize resource ... except // handle exception ... end; // free resource / cleanup ... end

delphi exception-handling

angularjs - Ionic list: swipe to remove? -



angularjs - Ionic list: swipe to remove? -

is there possibility implement "swipe-to-remove" (like in android task-screen) functionality "ion-list"?

i have found "can-swipe" directive allows add together buttons appear under partly-swiped item, that's not i'm looking for. need swipe item (both sides) , remove when becomes swiped end of screen.

ok, seems "ion-list" doesn't have built in "swipe-to-delete" functionality.

nevertheless implemented using hammer plugin angular.js , custom directives , logic. allowed create list-items swipeable. , used that technology actual elements removal.

angularjs angularjs-directive angular-ui ionic-framework

php - Using annotations to get a ChoiceList of Entity constatnts -



php - Using annotations to get a ChoiceList of Entity constatnts -

is possible utilize annotations choicelist or array of specific type of class/entity constants?

i mean this:

class user{ /** * @item(things,'label 1') */ const some_thing1=1; /** * @item(things,'label 2') */ const some_thing2=2; /** * @item(things,'label 3') */ const some_thing3=3; /** * @item(otherthings,'label 1') */ const some_other_thing1=1; /** * @item(otherthings,'label 2') */ const some_other_thing2=2; ... }

and then:

$builder->add('thing', 'choice', array( 'choice_list' => getchoicelistfromconsts('user','things') ));

and expect getchoicelistfromconsts('user','things') homecoming like:

array( 'label 1' => 1, 'label 2' => 2, 'label 3' => 3 );

is there build-in feature in symfony2 or there bundle provide such service?

php symfony2 annotations

c# - How to query sub document in mongodb -



c# - How to query sub document in mongodb -

i having next collection contains list of programme , each programme containing list of sessions:

{ "_id" : objectid("543f6fd8a4490a19b42c84eb"), "name" : "program1", "tags" : "tag1,tag2", "sessions" : [{ "_id" : objectid("544a00716c6d791820c2d1ae"), "name" : "session1", "tags" : "tag1,tag2" },{ "_id" : objectid("544e426dbb63bc0d94d7ad81"), "name" : "session2", "tags" : "tag1,tag2" }] }, { "_id" : objectid("544e42a1bb63bc0d94d7ad82"), "name" : "program2", "tags" : "tag1,tag2", "sessions" : [{ "_id" : objectid("543f6fd8a4490a19b42c84eb"), "name" : "session1", "tags" : "tag1,tag2" },{ "_id" : objectid("544e4cb1bb63bc0d24333b04"), "name" : "session2", "tags" : "tag1,tag2" }] }

now querying programme following:

var programme = _db.getcollection<program>("program"); imongoquery _query = query<program>.where(e => e.name.contains("program")); programcursor = mongocursor program.find(_query).setsortorder(sortby.ascending("name")).setlimit(itemsperpage).setskip(itemsperpage * (pageno - 1));

now if want query sessions sub document. assuming i've programme id , session name, how query sub document in mongodb c#. didn't found much help on scenario that's why posting so.

you can use

imongoquery _query1 = query<program>.elemmatch(e => e.sessions, builder => builder.matches(session => session.name, "/.*" + search_phrase + ".*/"));

or

imongoquery _query2 = query<program>.elemmatch(e => e.sessions, builder => builder.where(session => session.name.contains(search_phrase)));

and can and , or queries

var query = query.or(new bindinglist<imongoquery> { _query, _query1, .... });

var result = program.find(query);

c# mongodb

php - Yii Framework 2.0 Role Based Access Control RBAC -



php - Yii Framework 2.0 Role Based Access Control RBAC -

learning yii framework 2.0 have tried utilize role bases access command documentation of yii 2.0. guide documentation short me cannot finish learning. have added next code config file.

'components' => [ 'authmanager' => [ 'class' => 'yii\rbac\dbmanager', ], ],

i have create database tables next sql script.

drop table [auth_assignment]; drop table [auth_item_child]; drop table [auth_item]; drop table [auth_rule]; create table [auth_rule] ( [name] varchar(64) not null, [data] text, [created_at] integer, [updated_at] integer, primary key ([name]) ); create table [auth_item] ( [name] varchar(64) not null, [type] integer not null, [description] text, [rule_name] varchar(64), [data] text, [created_at] integer, [updated_at] integer, primary key ([name]), foreign key ([rule_name]) references [auth_rule] ([name]) on delete set null on update cascade ); create index [idx-auth_item-type] on [auth_item] ([type]); create table [auth_item_child] ( [parent] varchar(64) not null, [child] varchar(64) not null, primary key ([parent],[child]), foreign key ([parent]) references [auth_item] ([name]) on delete cascade on update cascade, foreign key ([child]) references [auth_item] ([name]) on delete cascade on update cascade ); create table [auth_assignment] ( [item_name] varchar(64) not null, [user_id] varchar(64) not null, [created_at] integer, primary key ([item_name], [user_id]), foreign key ([item_name]) references [auth_item] ([name]) on delete cascade on update cascade );

i have built authentication info following.

class rbaccontroller extends controller { public function actioninit() { $auth = yii::$app->authmanager; // add together "createpost" permission $createpost = $auth->createpermission('createpost'); $createpost->description = 'create post'; $auth->add($createpost); // add together "updatepost" permission $updatepost = $auth->createpermission('updatepost'); $updatepost->description = 'update post'; $auth->add($updatepost); // add together "author" role , give role "createpost" permission $author = $auth->createrole('author'); $auth->add($author); $auth->addchild($author, $createpost); // add together "admin" role , give role "updatepost" permission // permissions of "author" role $admin = $auth->createrole('admin'); $auth->add($admin); $auth->addchild($admin, $updatepost); $auth->addchild($admin, $author); // assign roles users. 1 , 2 ids returned identityinterface::getid() // implemented in user model. $auth->assign($author, 2); $auth->assign($admin, 1); } }

when access actioninit() method via controller, above database tables have been filled info based on above code. furthermore, in user's table have 2 users, admin user has id number 1 , author user has id number 2. utilize next code create user.

public function create() { if ($this->validate()) { $user = new user(); $user->username = $this->username; $user->email = $this->email; $user->setpassword($this->password); $user->generateauthkey(); $user->save(false); // next 3 lines added: $auth = yii::$app->authmanager; $authorrole = $auth->getrole('author'); $auth->assign($authorrole, $user->getid()); homecoming $user; } homecoming null; }

with above code new inserted users author. if-statements below can grant or deny access.

if (\yii::$app->user->can('createpost')) { // create post } if (\yii::$app->user->can('updatepost')) { // update post }

so far good. works fine. scenario of above code normal author can create post, cannot update post. admin can update post , can author can do. want normal author able update his/her own post. don't know how go farther here. have followed yii guide documentation/secury/authorization paragraph role based access command (rbac). have never used yii 1. that's why not figure out such short explanation of yii 2.0 documentation rbac.

you need access rule , docs clear create like

namespace app\rbac; utilize yii\rbac\rule; /** * checks if authorid matches user passed via params */ class authorrule extends rule { public $name = 'isauthor'; /** * @param string|integer $user user id. * @param item $item role or permission rule associated * @param array $params parameters passed managerinterface::checkaccess(). * @return boolean value indicating whether rule permits role or permission associated with. */ public function execute($user, $item, $params) { homecoming isset($params['post']) ? $params['post']->createdby == $user : false; } }

then, add together in rbac role

$auth = yii::$app->authmanager; // add together rule $rule = new \app\rbac\authorrule; $auth->add($rule); // add together "updateownpost" permission , associate rule it. $updateownpost = $auth->createpermission('updateownpost'); $updateownpost->description = 'update own post'; $updateownpost->rulename = $rule->name; $auth->add($updateownpost); // "updateownpost" used "updatepost" $auth->addchild($updateownpost, $updatepost); // allow "author" update own posts $auth->addchild($author, $updateownpost);

finally asign role user in signup

$auth = yii::$app->authmanager; $authorrole = $auth->getrole('author'); $auth->assign($authorrole, $userid_here);

to check if user have ability edit utilize code below $post model posts

if (\yii::$app->user->can('updatepost', ['post' => $post])) { // update post }

all these taken guide. allow me know if have problem

php yii2 rbac role-based-access-control

c# - How to pass data between web pages MVC -



c# - How to pass data between web pages MVC -

i’m developing first web application using c# mvc/javascript , wondering how handle authentication .

my accountcontroller uses this.

[httppost] [allowanonymous] [validateantiforgerytoken] public actionresult login(loginmodel model) { if (modelstate.isvalid) {

i store username , email in cookie

now need pull info database authenticated user…. utilize cookie values

i sense wrong way pass current user info between web pages several reasons:

for illustration if user disabled cookies in browser. or there risk of exposing sensitive cookie info in cookies.

my question is:

what’s best way passing user authentication info between web pages?

what industry standards?

c# asp.net-mvc-3

python - How to filter rows with pandas without using the column name - loop filter -



python - How to filter rows with pandas without using the column name - loop filter -

i trying filter rows in dataframe using pandas instead of using:

df[(df.columna == 1)]

i want able this:

i = 'a' x = 'column'+'i' df[(df.x == 1)]

my aim loop in columns filters. improve if this:

i = x = 'column'+'i' y = 1 df[(df.x == y)]

allowing me loop in columns , loop in filter types:

thanks!

if trying grab series dataframe, having problem because . notation won't allow variable, utilize brackets instead:

i = 'a' column = 'column' + df = df[df[column] == 1]

you create mask in loop , apply @ once:

column_base = 'column' suffixes = ['a','b','c','d'] mask = none in suffixes: column = column_base + if mask none: mask = df[column] == 1 else: mask &= df[column] == 1 df = df[mask]

python pandas dataframes

c++ - Constructor is not working properly -



c++ - Constructor is not working properly -

i need help building constructor initialized respective info when instantiated within main().

#include <iostream> using namespace std; class entity{ public: int x, int y, char icon; }; int main(){ entity pdata; pdata.x=4; pdata.y=3, pdata.icon='1'; cout<<pdata.x<<'\n'\; cout<<pdata.y<<'\n'\; cout<<pdata.icon<<\'n'\; }

i included illustration of need only... there no need include program. anyways need constructor initialized info in main instance(pdata) of entity created: know constructor has like

entity::entity(int x, int y, char icon){};

and 1 time instantiated in main like

entity pdata{3,4,'1'};

but isn't working me

oh way need constructor because that's assignment asking in first place here go copied right off doc file

"write parameterized constructor entity class sets x, y, , icon, , utilize when creating instance"

actually u have not defined constructor class entity(but compiler have defined allocate memory fellow member variable of entity).

class entity { public: int x,y; char icon; entity(int _x, int _y,char _icon) { x=_x; y=_y icon=_icon; } };

int main() { entity obj(4,3,'i'); homecoming 0; }

`

c++ visual-c++

HTML Onmouseover Help Changing Image -



HTML Onmouseover Help Changing Image -

i need help changing image when moused over. not work. please help?

<a href="#" onmouseover="document.getelementbyid('gotosite'). src='b.png';" onmouseout="document.getelementbyid('myimage1'src='bmo.png';"> <img src="b.png" id="gotosite" /></a>

try this:

<img src="image.png" onmouseover="this.src='image.png'" onmouseout="this.src='image.png'" width="70" height="70" alt="">

html onmouseover

java - Spring CrudRepository .orElseThrow() -



java - Spring CrudRepository .orElseThrow() -

what proper way throw exception if database query returns empty? i'm trying utilize .orelsethrow() method won't compile :

meeting meeting = meetingrepository.findbymeetingid(meetingid).orelsethrow(new meetingdoesnotexistexception(meetingid));

the compiler saying :

"he method orelsethrow(supplier) in type optional not applicable arguments (meetingrestcontroller.meetingdoesnotexistexception)

is possible lambda expressions?

crudrepository :

import java.util.optional; import org.springframework.data.repository.crudrepository; public interface meetingrepository extends crudrepository<meeting, long>{ optional<meeting> findbymeetingid(long id); }

exception :

@responsestatus(httpstatus.conflict) // 409 class meetingdoesnotexistexception extends runtimeexception{ public meetingdoesnotexistexception(long meetingid){ super("meeting " + meetingid + " not exist."); } }

try passing lambda look of type supplier<meetingdoesnotexistexception> :

meeting meeting = meetingrepository.findbymeetingid(meetingid) .orelsethrow(() -> new meetingdoesnotexistexception(meetingid));

java spring java-8 crud spring-boot

javascript - how can I show my loading icon after my ajax is finished -



javascript - how can I show my loading icon after my ajax is finished -

i have simple javascript function so:

function showhint() { var xmlhttp = new xmlhttprequest(); xmlhttp.onreadystatechange = function () { if (xmlhttp.readystate == 4 && xmlhttp.status == 200) { //extract info here } } xmlhttp.open("get", "articles.php?q=" + cat + "&year1=" + start_year + "&year2=" + end_year, true); xmlhttp.send(); }

i want able show loading icon after ajax finishes. show loading icon @ origin of js using:

$.mobile.loading("show");

which shows icon nicely (using jquery mobile). however, need hide icon after ajax finished. i've attempted utilize .done() in jquery don't think i'm using properly:

xmlhttp.onreadystatechange.done(function(){ $.mobile.loading("hide"); });

you need utilize onreadystatechange callback function.

xmlhttp.onreadystatechange = function () { if (xmlhttp.readystate == 4) { $.mobile.loading("hide"); } }

as using jquery. can utilize jquery.get() like

$.mobile.loading("show"); $.get("articles.php?q=" + cat + "&year1=" + start_year + "&year2=" + end_year, function(data) { //do }).done(function() { $.mobile.loading("hide"); });

javascript jquery ajax jquery-mobile

animation - Infinite horizontal background ios using SKAaction -



animation - Infinite horizontal background ios using SKAaction -

i have long image want set "rollable" background . i'm trying utilize 2 instance of sprite , 1 time image reached (frame - imageheight) add together sec 1 above , maintain smooth movement.

however, i'm getting unexpected behaviour - @ lastly part of animation screen overlapped - sec screen overlapping first one.

this code:

- (void) repositionbackground{ skspritenode *currentbackground = self.backgroundarray[self.currentbackgoundindex]; if(!currentbackground.parent && !self.currentbackgoundindex) //first time running { skaction *imageminusframeanimation = [skaction movetoy:-currentbackground.size.height+self.frame.size.height/2.0f duration:self.backgroundanimationlength]; skaction *sequence = [skaction sequence:@[imageminusframeanimation, [skaction runblock:^{ [self repositionbackground]; }]]]; [currentbackground runaction:sequence]; [self addchild:currentbackground]; nslog(@"calling reposition first time"); } else { self.currentbackgoundindex = (self.currentbackgoundindex + 1) % [self.backgroundarray count]; skspritenode *newbackground = self.backgroundarray[self.currentbackgoundindex]; //reposition th enew backfround on top of current 1 [newbackground setposition:cgpointmake(0, self.frame.size.height/2.0f)]; //add actions backfround - top backgound vanished screen , new 1 appear , start scrolling downwards skaction *imageminusframeanimation = [skaction movetoy:-currentbackground.size.height+self.frame.size.height/2.0f duration:self.backgroundanimationlength]; skaction *sequence = [skaction sequence:@[imageminusframeanimation, [skaction runblock:^{ [self repositionbackground]; }]]]; [newbackground runaction:sequence]; if(!newbackground.parent) { [self addchild:newbackground]; } float newbackgroundanimationlength = self.frame.size.height / background_animation_velocity; skaction *framelengthanimation = [skaction movebyx:0 y:-self.frame.size.height duration:newbackgroundanimationlength]; [currentbackground runaction:framelengthanimation]; }

}

i figure out myself. aa error in algorithm. post here solution: (spritekit)

//creating 2 background - positioning 1 above screen , 1 stand on (0.5,0} axis skspritenode *firstbackground = [skspritenode spritenodewithimagenamed:@"mtimage.jpeg"]; firstbackground.anchorpoint = cgpointmake(0.5f,0); firstbackground.zposition = 1; skspritenode *secondbackground =[firstbackground copy]; self.backgroundarray = @[firstbackground,secondbackground]; [firstbackground setposition:cgpointmake(0, -self.frame.size.height/2)]; [secondbackground setposition:cgpointmake(0, self.frame.size.height/2)]; self.currentbackgoundindex = 0; self.backgroundanimationlength = firstbackground.size.height / background_animation_velocity; [self repositionbackground]; - (void) repositionbackground{ skspritenode *currentbackground = self.backgroundarray[self.currentbackgoundindex]; skaction *majorpartanimation; //first time running if(!currentbackground.parent && !self.currentbackgoundindex) { float firstanimationduration = (currentbackground.size.height - self.frame.size.height) / background_animation_velocity; majorpartanimation = [skaction movetoy:-currentbackground.size.height+self.frame.size.height/2.0f duration:firstanimationduration]; skaction *sequence = [skaction sequence:@[majorpartanimation, [skaction runblock:^{ [self repositionbackground]; }]]]; [currentbackground runaction:sequence]; [self addchild:currentbackground]; } else { //current background needs move frameheight , new 1 has set above him , start animation majorpartanimation = [skaction movetoy:-currentbackground.size.height+self.frame.size.height/2.0f duration:self.backgroundanimationlength]; self.currentbackgoundindex = (self.currentbackgoundindex + 1) % [self.backgroundarray count]; skspritenode *newbackground = self.backgroundarray[self.currentbackgoundindex]; //reposition th enew backfround on top of current 1 [newbackground setposition:cgpointmake(0, self.frame.size.height/2.0f)]; //add actions backfround - top backgound vanished screen , new 1 appear , start scrolling downwards skaction *sequence = [skaction sequence:@[majorpartanimation, [skaction runblock:^{ [self repositionbackground]; }]]]; [newbackground runaction:sequence]; if(!newbackground.parent) { [self addchild:newbackground]; } float currentbackgroundanimationlength = self.frame.size.height / background_animation_velocity; skaction *minorpartaniamiton = [skaction movebyx:0 y:-self.frame.size.height duration:currentbackgroundanimationlength]; [currentbackground runaction:minorpartaniamiton]; }

}

ios animation sprite-kit skaction

tsql - unable to transfer file to ftp server using xp_cmdshell -



tsql - unable to transfer file to ftp server using xp_cmdshell -

i'am using code transfer file local scheme ftp (i have read , write rights ftp).

if exists (select * sysobjects id = object_id(n'[dbo].[s_ftp_putfile]') , objectproperty(id, n'isprocedure') = 1) drop procedure [dbo].[s_ftp_putfile] go create procedure s_ftp_putfile @ftpserver varchar(128) , @ftpuser varchar(128) , @ftppwd varchar(128) , @ftppath varchar(128) , @ftpfilename varchar(128) , @sourcepath varchar(128) , @sourcefile varchar(128) , @workdir varchar(128) /* exec s_ftp_putfile @ftpserver = '172.*****' , @ftpuser = 'username' , @ftppwd = 'password' , @ftppath = '/dir1/' , @ftpfilename = 'test2.txt' , @sourcepath = 'c:\vss\mywebsite\' , @sourcefile = 'test2.txt' , @workdir = 'c:\temp\' */ declare @cmd varchar(1000) declare @workfilename varchar(128) select @workfilename = 'ftpcmd.txt' -- deal special characters echo commands select @ftpserver = replace(replace(replace(@ftpserver, '|', '^|'),'<','^<'),'>','^>') select @ftpuser = replace(replace(replace(@ftpuser, '|', '^|'),'<','^<'),'>','^>') select @ftppwd = replace(replace(replace(@ftppwd, '|', '^|'),'<','^<'),'>','^>') select @ftppath = replace(replace(replace(@ftppath, '|', '^|'),'<','^<'),'>','^>') select @cmd = 'echo ' + 'open ' + @ftpserver + ' > ' + @workdir + @workfilename exec master..xp_cmdshell @cmd select @cmd = 'echo ' + @ftpuser + '>> ' + @workdir + @workfilename exec master..xp_cmdshell @cmd select @cmd = 'echo ' + @ftppwd + '>> ' + @workdir + @workfilename exec master..xp_cmdshell @cmd select @cmd = 'echo ' + 'put ' + @sourcepath + @sourcefile + ' ' + @ftppath + @ftpfilename + ' >> ' + @workdir + @workfilename exec master..xp_cmdshell @cmd select @cmd = 'echo ' + 'quit' + ' >> ' + @workdir + @workfilename exec master..xp_cmdshell @cmd select @cmd = 'ftp -s:' + @workdir + @workfilename create table #a (id int identity(1,1), s varchar(1000)) insert #a exec master..xp_cmdshell @cmd select id, ouputtmp = s #a go

i unable transfer file , getting error

1 user (172.******:(none)): open 172.******

2 null

3 null

4 set c:\vss\mywebsite\test2.txt /dir1/test2.txt

5 c:\vss\mywebsite\test2.txt: file not found

6 quit

7 null

however able transfer through cmd prompt.

can sql other things command line?

also, uid ss using on command line, have rights talk ss machine destination? many enterprises don't allow "service" ids talk willy nilly on network wants to. may need rights create connection.

sql-server-2008 tsql ftp file-transfer xp-cmdshell

css - django stylesheet donot link with the image file -



css - django stylesheet donot link with the image file -

in settings.py have static setting this:

static_root = ' ' static_url = '/static/' staticfiles_dirs = ( os.path.join(base_dir, 'static'), ) staticfiles_finders = ( 'django.contrib.staticfiles.finders.filesystemfinder', 'django.contrib.staticfiles.finders.appdirectoriesfinder', #'django.contrib.staticfiles.finders.defaultstoragefinder', )

and project construction :

projectname app1 app2 projectname static css js images

and have written css in named style.css :

input.search { width: 279px; border: none; background: #fff url(../images/input.gif) no-repeat; padding: 6px 10px; color: #1e67a8; font-weight: bold; }

when didnt display image have assigned in style.css..

whats problem ??

you may need in settings.py

staticfiles_dirs = ( 'static', os.path.join(os.path.dirname(__file__), '..', 'static'),)

css django templates static

android - CursorAdapter with two row layouts -



android - CursorAdapter with two row layouts -

okey so, since i've not found consistent way of doing when searched, decided maybe putting code elses eyes see might help.

i'm creating game utilize cards. these cards can either locked or unlocked depending on different factors. of import thing is, want check sqlite db whether locked, display different row layouts 2 possible outcomes.

here's code:

public class allcardsadapter extends cursoradapter { lockedholder viewlocked; unlockedholder viewunlocked; private layoutinflater minflater; public static final int locked = 0; public static final int unlocked = 1; public allcardsadapter(context context, cursor cursor) { super(context, cursor); minflater = (layoutinflater) context.getsystemservice(context.layout_inflater_service); } @override public void bindview(view view, context context, cursor cursor) { final int type; int viewtype = this.getitemviewtype(cursor.getint(cursor.getcolumnindex("unlocked"))); if (viewtype == 1){ type = unlocked; } else { type = locked; } if (type == locked){ viewlocked = (lockedholder) view.gettag(); viewlocked.nameholder.settext(cursor.getstring(cursor.getcolumnindex("name"))); viewlocked.awardedatholder.settext("awarded @ level:"); viewlocked.reqlvlholder.settext(cursor.getstring(cursor.getcolumnindex("reqlvl"))); string imagepath = cursor.getstring(cursor.getcolumnindex("image")); if (imagepath.equals("card_obj_plus_1")){ picasso.with(context).load(r.drawable.card_obj_plus_1).placeholder(r.drawable.card_placeholder).into(viewlocked.imageholder); } if (imagepath.equals("card_obj_plus_2")){ picasso.with(context).load(r.drawable.card_obj_plus_2).placeholder(r.drawable.card_placeholder).into(viewlocked.imageholder); } if (imagepath.equals("card_obj_plus_3")){ picasso.with(context).load(r.drawable.card_obj_plus_3).placeholder(r.drawable.card_placeholder).into(viewlocked.imageholder); } if (imagepath.equals("card_slowdown")){ picasso.with(context).load(r.drawable.card_slowdown).placeholder(r.drawable.card_placeholder).into(viewlocked.imageholder); } if (imagepath.equals("card_speed_up")){ picasso.with(context).load(r.drawable.card_speed_up).placeholder(r.drawable.card_placeholder).into(viewlocked.imageholder); } } else { viewunlocked = (unlockedholder) view.gettag(); viewunlocked.nameholder.settext(cursor.getstring(cursor.getcolumnindex("name"))); string imagepath = cursor.getstring(cursor.getcolumnindex("image")); if (imagepath.equals("card_obj_plus_1")){ picasso.with(context).load(r.drawable.card_obj_plus_1).placeholder(r.drawable.card_placeholder).into(viewunlocked.imageholder); } if (imagepath.equals("card_obj_plus_2")){ picasso.with(context).load(r.drawable.card_obj_plus_2).placeholder(r.drawable.card_placeholder).into(viewunlocked.imageholder); } if (imagepath.equals("card_obj_plus_3")){ picasso.with(context).load(r.drawable.card_obj_plus_3).placeholder(r.drawable.card_placeholder).into(viewunlocked.imageholder); } if (imagepath.equals("card_slowdown")){ picasso.with(context).load(r.drawable.card_slowdown).placeholder(r.drawable.card_placeholder).into(viewunlocked.imageholder); } if (imagepath.equals("card_speed_up")){ picasso.with(context).load(r.drawable.card_speed_up).placeholder(r.drawable.card_placeholder).into(viewunlocked.imageholder); } } } @override public view newview(context context, cursor cursor, viewgroup parent) { viewlocked = new lockedholder(); viewunlocked = new unlockedholder(); final int type; int viewtype = this.getitemviewtype(cursor.getint(cursor.getcolumnindex("unlocked"))); if (viewtype == 1){ type = unlocked; } else { type = locked; } system.out.println(viewtype); system.out.println(type); if (type == locked){ view lockedview; lockedview = minflater.inflate(r.layout.card_list_row_disabled, parent, false); viewlocked.nameholder = (textview) lockedview.findviewbyid(r.id.txttitle); viewlocked.imageholder = (imageview) lockedview.findviewbyid(r.id.imgthumbnail); viewlocked.reqlvlholder = (textview) lockedview.findviewbyid(r.id.tvlevelnr); viewlocked.awardedatholder = (textview) lockedview.findviewbyid(r.id.tvawardedat); lockedview.settag(viewlocked); homecoming lockedview; } else { view unlockedview; unlockedview = minflater.inflate(r.layout.card_list_row, parent, false); viewunlocked.nameholder = (textview) unlockedview.findviewbyid(r.id.txttitle); viewunlocked.imageholder = (imageview) unlockedview.findviewbyid(r.id.imgthumbnail); unlockedview.settag(viewunlocked); homecoming unlockedview; } } @override public int getviewtypecount() { homecoming 2; } @override public int getitemviewtype(int position) { homecoming position % 2; } public class lockedholder { public textview nameholder; public imageview imageholder; public textview awardedatholder; public textview reqlvlholder; } public class unlockedholder { public textview nameholder; public imageview imageholder; } }

the error i'm getting on row "viewlocked = (lockedholder) view.gettag();"

allcardsadapter$unlockedholder cannot cast allcardsadapter$lockedholder

the error shows when have list containing cards both locked , unlocked.

see know it's trying do, don't know why. also, if i'm overcomplicating things no reason, or missing obvious, i'd much appreciated if find it..

getitemviewtype implementation not right (type not depend on item position) should following

private int getitemviewtype(cursor cursor) { homecoming cursor.getint(cursor.getcolumnindex("unlocked")) % 2; } @override public int getitemviewtype(int position) { cursor cursor = (cursor) getitem(position); homecoming getitemviewtype(cursor); }

you need update bindview , newview

int viewtype = this.getitemviewtype(cursor);

android android-cursoradapter

java - Portable maven project -



java - Portable maven project -

i'm working on web-related project.at moment, seek combine frameworks together(hibernate, apache shiro , on).ofc, in nearest future might need addons via maven dependencies. possible pack together, emergency situation pack maven. it's necessary because i'm locating - pc have little configurations (java 1.8 / no maven(no chances install due policy restrictions)).

is possible import maven web - project jar?

thanks suggestions,

good luck! ;)

it seems want maintain entire project directory if i'm understanding correctly.

are sure cannot install maven? if you'd want bundle maven project.

could give me more details environment you'd using?

you import jar maven web project. under modules section web projects pom.xml specify directory if in same project. if not, you'll have add together dependency. you'll need grouping , artifact id of jar want add. can find pointers here.

an illustration project directory structure:

<modules> <module>the web part</module> <module>the backed part</module> </modules>

each different module sub module of master project.

this should help setting classpath. take @ this:

http://stackoverflow.com/questions/364114/can-i-add-jars-to-maven-2-build-classpath-without-installing-them

java hibernate maven import dependencies

package - Move PHP binaries to another server -



package - Move PHP binaries to another server -

i have php installation did compiling sources on rhel6 server. fine , working.

my question is:

can re-create "php installation" server , have run without compiling on other server ?

*i did, however, it's missing libraries in /usr/lib64, etc... re-create them 1 1 on ? or re-download mcrypt modules , on yum.... (il not , juste have php bundle of own deploy on other servers...)

or in house php (my own compiled one) packaged in rpm ?

thanks !

php package libraries binaries rhel6

c# - ASP.NET self host error -



c# - ASP.NET self host error -

i'm trying asp.net web api self host running. maintain getting error.

how resolve this?

assuming assembly reference microsoft.owin, version=2.0.2.0, culture=neutral, publickeytoken=31bf3856ad364e35' matches assemblymicrosoft.owin, version=3.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35'. may need supply runtime policy (cs1701)

here simple start script.

static void main(string[] args) { using (webapp.start<testapi> ("http://*:9090/")) { console.writeline ("server started"); } }

the 2 assemblies differ in release and/or version number. unification occur, must specify directives in application's .config file, , must provide right strong name of assembly, demonstrated in next illustration code:

using system.reflection; [assembly:assemblyversion("1.0")] public class { public void m1() {} }

or:

perhaps need binding redirect in .config

<configuration> <runtime> <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentassembly> <assemblyidentity name="microsoft.owin" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-2.0.2.0" newversion="2.0.2.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="microsoft.owin.security" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-2.0.2.0" newversion="2.0.2.0" /> </dependentassembly> </assemblybinding> </runtime> </configuration>

c# asp.net asp.net-web-api self-hosting

javascript - Max-width is changing position:fixed margin -



javascript - Max-width is changing position:fixed margin -

i having problem aligning div on right side of browser after viewport has reached max-width.

this codepen shows issue.

the problem div .rghtlogo, while browser viewport less 1200px (the body max-width) positioned right:4%

however, when browser viewport gets bigger 1200px pushes margin in 4% of inner right border of body container rather browser.

i tried wrapping in absolute positioned div no luck, tried floating .rghtlogo no luck , have resorted sloppy undesired workaround using multiple media queries alter margin browser gets bigger. action not fluid.

@media (min-width:1201px){.rghtlogo{margin-right:3% !important}} @media (min-width:1216px){.rghtlogo{margin-right:1.5% !important}} @media (min-width:1230px){.rghtlogo{margin-right:.75% !important}} @media (min-width:1251px){.rghtlogo{margin-right:0% !important}} @media (min-width:1256px){.rghtlogo{margin-right:-1% !important}}

i have searched no avail how prepare this. help appreciated.

change position:fixed position:relative in .rghthdr , alter top , right in .rghtlogo -250px , 0 respectively.

so .rghtlogo positioned relative .rghthdr. see updated codepen : http://codepen.io/yogeshkhatri/pen/npkqzg

javascript css css3

php - How to get access to the variables in Visual Composer extended WordPress plugin? -



php - How to get access to the variables in Visual Composer extended WordPress plugin? -

i'm trying extend client's page backend visual composer extended plugin. i've been next instructions given here: http://kb.wpbakery.com/index.php?title=visual_composer_tutorial.

the plugin shows @ wp backend , fields have created shown:

array( "type" => "textfield", "holder" => "div", "class" => "", "param_name" => "fourth_quote", "value" => __("", 'vc_extend'), "description" => __('fourth testimonial quote', 'vc_extend') )

however, don't understand how i'm supposed access 'fourth_quote' later on:

public function rendermybartag( $atts, $content = null) { extract( shortcode_atts( array( 'faa' => 'something', 'color' => '#ff0000' ), $atts ) ); $content = wpb_js_remove_wpautop($content, true); // prepare unclosed/unwanted paragraph tags in $content $output = '<div>{$fourth_quote}</div>'; error_log(date('[ d.m.y h:i:s ] ') . $output . php_eol, 3, "my-errors.log"); homecoming $output; }

this, doesn't output there content stored.

how access content user have created @ backend i'd able render page based on that? how variables?

from http://kb.wpbakery.com/index.php?title=visual_composer_tutorial:

this list represents shortcode tag base of operations , params list editable settings form within js_composer constructor.

you must add together fourth_quote attribute shortcode. example:

public function rendermybartag( $atts, $content = null) { # also, avoid using extract() # http://stackoverflow.com/questions/829407/what-is-so-wrong-with-extract # http://codex.wordpress.org/shortcode_api $a = shortcode_atts( array( 'faa' => 'something', 'color' => '#ff0000', 'fourth_quote' => false, // default value ), $atts ); $content = wpb_js_remove_wpautop($content, true); $output = $a['fourth_quote']; error_log(date('[ d.m.y h:i:s ] ') . $output . php_eol, 3, "my-errors.log"); homecoming $output; }

php wordpress wordpress-plugin backend

javascript - Using a Google Apps API key with Distance Matrix -



javascript - Using a Google Apps API key with Distance Matrix -

i using google distance matrix api , documentation tells me need api key (but can utilize without one.) i'd able monitor utilize i'm stumped how set up.

i have valid browser application api key google developers console, it's new i'm assuming it's version 3 key.

i have added valid referers in console

i have <script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script> on page

i'm using code this

function callback(response, status) { if (status!==google.maps.distancematrixstatus.ok) { _googleerror('error was: ' + status); } else { var origins = response.originaddresses; (var = 0; < origins.length; i++) { var results = response.rows[i].elements; (var j = 0; j < results.length; j++) { $("#calcdistance").val(results[j].distance.text); //other stuff works here } } } } function calculatedistances(start, end) { var service = new google.maps.distancematrixservice(); service.getdistancematrix( { origins: [start], destinations: [end], travelmode: google.maps.travelmode.driving, unitsystem: google.maps.unitsystem.imperial, avoidhighways: false, avoidtolls: false }, callback); }

as things work fine. when seek add together key in things go south. i've tried

<script src="https://maps.googleapis.com/maps/api/js?key={my_key}&v=3.exp"></script>

and

<script src="https://maps.googleapis.com/maps/api/js?key={my_key}"></script>

with no luck. when either of error invalid url, similar question.

i've tried adding key: {my_key}, calculatedistances() - no luck either.

am missing obvious? (i sense am)

update:

@dr.molle's reply got me looking for. turned on "google maps javascript api v3" , changed <script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script> <script src="https://maps.googleapis.com/maps/api/js?key={my_key}&v=3.exp"></script> can view activity in developer console wanted.

when utilize key when loading maps-javascript-api must enable api "google maps javascript api v3" within console.

the linked documentation webservice, key-related part of documentation irrelevant when request distancematrixservice via javascript-api.

the right documentation you'll find @ https://developers.google.com/maps/documentation/javascript/distancematrix

javascript api google-maps google-maps-api-3

c# - Navigation property fixup for unit testing with EntityFramework 6 -



c# - Navigation property fixup for unit testing with EntityFramework 6 -

after switching entity framework 6, automatic fixup navigation properties has been removed. has wreaked havoc in our unit tests, work under assumption setting 1 side of relation, automatically update other side well.

everything works fine when running code, because detectchanges method on dbcontext automatically synchronizes relationships, when unit testing prefer not having create dbcontext synchronizaton.

i found blog explaining it's possible reuse t4 template entityframework6, doesn't work spatial info types, have moved different namespace.

so solution modify entityframework 4 t4 template file, , prepare work entityframework 6. have posted answer, still know if else has improve solution this.

generally t4 template file entityframework4 can used straight entityframework6 also, generate poco objects relationship fixup. when using spatial info types, couple of modifications necessary:

replace utility file include ef6 utilities. import right spatial name space (and others well):

<#@ include file="ef6.utility.cs.ttinclude"#>

now create ef4 template file work ef6 utilities:

replace ef4 metadata loader looks (separated :

metadataloader loader = new metadataloader(this); ... edmitemcollection itemcollection = loader.createedmitemcollection(inputfile);

with this:

var texttransform = dynamictexttransformation.create(this); edmitemcollection itemcollection = new edmmetadataloader(texttransform.host, texttransform.errors).createedmitemcollection(inputfile) edmitemcollection;

and add together missing argumentnotnull method @ bottom, before final #> tag:

public static void argumentnotnull<t>(t arg, string name) t : class { if (arg == null) { throw new argumentnullexception(name); } }

c# unit-testing entity-framework-6

wordpress - wooCommerce call function in checkout page -



wordpress - wooCommerce call function in checkout page -

i have function in themes functions.php file displays info product. on checkout page below billing address want out set info there.

here function in themes functions.php

function wc_checkout_description_so_1( $other_data, $cart_item ) { $post_data = get_post( $cart_item['product_id'] ); echo '<div>html output here</div>'; }

i have tried utilize add_filter below billing address doesnt not work:

add_filter( 'woocommerce_before_checkout_shipping_form', 'wc_checkout_description_so_1', 10, 2 );

all need output below shipping info , above think should work?

thanks

j

woocommerce_after_checkout_shipping_form might more appropriate displaying after shipping address. either way, variable passed woocommerce_after_checkout_shipping_form hook $checkout variable. can var_dump variable see available.

add_action( 'woocommerce_after_checkout_shipping_form', 'wc_checkout_description_so_1' ); function wc_checkout_description_so_1( $checkout ) { var_dump( $checkout ); }

wordpress woocommerce

android - Google Play Uploading new APK file -



android - Google Play Uploading new APK file -

i uploaded apk alpha version 1.0 , published alpha. made changes in application , want alter previous apk says 1.0 exists. tried upload 1.0.1 says same. should do?

old manifist file

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.urlconnectionclass" android:versioncode="1" android:versionname="1.0.0" >

new manifest file

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.urlconnectionclass" android:versioncode="2" android:versionname="1.1.0" >

always increse value of versioncode , versionname while uploding apk of same production

android version apk publish

Version Control System for Dynamics CRM 2011/2013 -



Version Control System for Dynamics CRM 2011/2013 -

i have started using git other development projects (php, html, javascript, etc.) , can see how beneficial is, i've been unable find similar dynamics crm 2011/2013 lot of solution development done within web interface.

i'm guessing not possible, more experience me please confirm or allow me know tools should looking into?

thanks

you can utilize visual studio developer toolkit available in sdk version command plugins , web resources initially. i'd recommend first step.

if take take farther can @ using solutionpackager tool version command solutions. split out solution zip file separate version controllable files each component. works best when follow developer workflow outlined in linked msdn article

version-control dynamics-crm-2011 crm dynamics-crm-2013

How to send a file to Desktop with bash script? -



How to send a file to Desktop with bash script? -

i trying send file or folder desktop linux command prompt don't know how. please tell me command can utilize this?

the move command mv. utilize man mv more information, command lot more complex seems. cd desktop/ should able find desktop on variations of linux mint or ubuntu. find nowadays working directory, in current path terminal, type pwd. give directory similar /home/desktop.

bash

objective c - How to hide masterView for UISplitViewcontroller in IOS8 -



objective c - How to hide masterView for UISplitViewcontroller in IOS8 -

all,

i have met problem new uisplitviewcontroller in ios8 ipad. have uitableview in storyboard in detailviewcontroller , on clicking cell, should go view called "detailinfo". current using "show" segue.

however, current segue force on right part. wanna show fullscreen , dont know how create it, tried using preferreddisplaymode property of splitviewcontroller , result hide master view didnt resize detailview. dont wanna using nowadays modal.

current way doing

- (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { if([[segue identifier]isequaltostring:@"showstudentdetail"]){ if(self.traitcollection.horizontalsizeclass != uiuserinterfacesizeclasscompact){ uisplitviewcontroller *splitviewcontroller = (uisplitviewcontroller *)self.navigationcontroller.parentviewcontroller; splitviewcontroller.preferreddisplaymode = uisplitviewcontrollerdisplaymodeprimaryhidden; } } }

and in viewdidappear, using

- (void)viewdidappear:(bool)animated { if(self.traitcollection.horizontalsizeclass != uiuserinterfacesizeclasscompact){ uisplitviewcontroller *splitviewcontroller = (uisplitviewcontroller *)self.navigationcontroller.parentviewcontroller; splitviewcontroller.preferreddisplaymode = uisplitviewcontrollerdisplaymodeautomatic; } }

this work , masterviewcontroller "jump out" has bad visual effect. hope can help , give thanks you

uisplitviewcontroller complex view controller consists of 2 kid view controllers. when utilize segue added of kid view controller inquire kid view controller perform segue. , kid view controller has partial command of active window.

in case need inquire split view controller perform segue. should add together segue split view controller handles active window. way have fullscreen option.

update

if dont wanna using nowadays modal , want avoid "jump out" effect can hide master using animation

uisplitviewcontroller *splitviewcontroller = [self splitviewcontroller]; [uiview animatewithduration:0.25 animations:^{ splitviewcontroller.preferreddisplaymode = uisplitviewcontrollerdisplaymodeprimaryhidden; } completion:^(bool finished) { [splitviewcontroller showdetailviewcontroller:vc sender:nil]; }];

objective-c ipad ios8 uisplitviewcontroller

java - JDOM Xml Adding Member Objects to XML -



java - JDOM Xml Adding Member Objects to XML -

i have slight of problem. doing simple fellow member scheme on club. in system, should able register new user, , register users boats. save .xml file using jdom. have followed guide in next site: http://www.journaldev.com/1211/jdom-write-xml-file-example-from-object

the problem when phone call method adds fellow member in xml file, writes new file. yes 1 time isn't problem, able add together members after members after turning application off, overwritten , new fellow member takes place. not want.

i want somehow every time add together new fellow member member gets added @ end of lastly added element in existing xml file, no file, creates file or something. appreciate help more experienced guys you;)

class="lang-xml prettyprint-override"> <?xml version="1.0" encoding="utf-8"?> <members xmlns="boatclubsystem members"> <member xmlns="" memberid="null"> <name>jakob wångö</name> <personalid>199107270077</personalid> <boat> <boattype>sailingboat</boattype> <boatlenght>30m</boatlenght> </boat> </member> <member> xmlns ="memberid="null"> <name>john doe</name> </member> </members> class="lang-java prettyprint-override">public class controller{ view theview; fellow member membermodel; boat boatmodel; static string file = "boatclubsystem.xml"; static list<member> memberlist = new arraylist<member>(); static list<boat> boatlist = new arraylist<boat>(); public static void main(string[]args) throws ioexception{ fellow member m = new member(); fellow member m2 = new member(); boat b = new boat(); boat b2 = new boat(); m.setname("jakob wangoe"); m.setpersonid("19910727****"); memberlist.add(m); b.setboattype(1); b.setboatlength(30); boatlist.add(b); createxmlsystem(memberlist, boatlist); } public static void createxmlsystem(list<member> memberlist, list<boat> boatlist) throws ioexception{ document doc = new document(); doc.setrootelement(new element("members", namespace.getnamespace("boatclubsystem members"))); (member memb : memberlist){ element fellow member = new element("member"); member.addcontent(new element("memberid").settext(memb.getmemberid())); member.addcontent(new element("name").settext(""+memb.getname())); member.addcontent(new element("personalid").settext(memb.getpersonid())); for(boat boat : boatlist){ element boats = new element("boat"); boats.addcontent(new element("boattype").settext(boat.getboattype())); boats.addcontent(new element("boatlenght").settext(boat.getboatlenght()+"m")); member.addcontent(boats); } doc.getrootelement().addcontent(member); } //jdom document ready, write file xmloutputter xmloutputter = new xmloutputter(format.getprettyformat()); xmloutputter.output(doc, new fileoutputstream(file)); } }

jdom in-memory model xml representation, , xmloutputter code dumps in-memory model output (the file on disk).

what need first load xml in memory. if file exists on disk, load file. if file not exist, have build empty one.

the code can become quite complicated manually build empty jdom document. have trick that, basic code block should be:

document doc = null; saxbuilder builder = new saxbuilder(); if (file.exists()) { doc = builder.build(file); } else { // build fresh document .... } // build new member.... .... // add together document element members = doc.getrootelement(); members.addcontent(newmember); xmloutputter xmlout = new xmloutputter(format.getprettyformat()); seek (fileoutputstream fos = new fileoutputstream(file)) { xmlout.output(fos, doc); } grab (ioexception ...) { }

a trick utilize creating empty documents utilize jar resource.... , utilize input stream seed:

doc = builder.build(classloader.getsystemresource("my/package/emptymembers.xml"));

using above allows edit empty document text, instead of building components.

java xml jdom

How to change image next and previous using button clicklistener in android? -



How to change image next and previous using button clicklistener in android? -

i have next , previous button changing image. when activity launch, image comes previous activity. utilize bundle object getting image on current activity. 2 images utilize pass on bundle(image_a_inner , image_a_outer). 1 image overlap on sec image , set on custom view. want when image comes bundle press next button or previous button according position image change. example, images a_z alphabet. when press on d image display on activity using bundle , when press next button e image shown or when press previous button c image shown. below code.

private drawingview mdrawingview; bundle extras = getintent().getextras(); int imageres1 = extras.getint("picture1"); int imageres2 = extras.getint("picture2"); mdrawingview = (drawingview) findviewbyid(r.id.drawing_view); mdrawingview.setshape(imageres1, imageres2); btn_next = (button) findviewbyid(r.id.btn_next); // btn_next.setonclicklistener(this); btn_next.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub initializemp(); playsound.start(); if(imageres1==r.drawable.img_a_inner||imageres2==r.drawable.img_a){ mdrawingview.setshape(r.drawable.img_b_inner, r.drawable.img_b); index++; } else if(imageres1==r.drawable.img_b_inner||imageres2==r.drawable.img_b){ mdrawingview.setshape(r.drawable.img_c_inner, r.drawable.img_c); index++; } else if(imageres1==r.drawable.img_c_inner||imageres2==r.drawable.img_c){ mdrawingview.setshape(r.drawable.img_d_inner, r.drawable.img_d); index++; } else if(imageres1==r.drawable.img_d_inner||imageres2==r.drawable.img_d){ mdrawingview.setshape(r.drawable.img_e_inner, r.drawable.img_e); index++; } } }); btn_prev = (button) findviewbyid(r.id.btn_prev); // btn_prev.setonclicklistener(this); btn_prev.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub initializemp(); playsound.start(); if(imageres1==r.drawable.img_b_inner||imageres2==r.drawable.img_b){ mdrawingview.setshape(r.drawable.img_a_inner, r.drawable.img_a); index--; } else if(imageres1==r.drawable.img_c_inner||imageres2==r.drawable.img_c){ mdrawingview.setshape(r.drawable.img_b_inner, r.drawable.img_b); index--; } else if(imageres1==r.drawable.img_d_inner||imageres2==r.drawable.img_d){ mdrawingview.setshape(r.drawable.img_c_inner, r.drawable.img_c); index--; } }); }

if have lists images in advance, declare them arrays.

otherwise, can pass them using bundle getintarray() , putintarray().

now, have lists of images this,

// these can declared fellow member or static variables. int[] innerpictures = {r.drawable.image_a_inner, r.drawable.image_b_inner, ...} int[] pictures = {r.drawable.image_a, r.drawable.image_b, ...}

or

int[] innerpictures = extras.getintarray("innerpictures"); int[] pictures = extras.getintarray("pictures");

and need index of image displayed @ first time, can passed extra

int displayingindex = extra.getint("pictureindex"); // has fellow member variable utilize within of listener

so code below,

class="snippet-code-html lang-html prettyprint-override">private drawingview mdrawingview; bundle extras = getintent().getextras(); int[] innerpictures = ... int[] pictures = ... displayingindex = extra.getint("pictureindex"); mdrawingview = (drawingview) findviewbyid(r.id.drawing_view); mdrawingview.setshape(innerpictures[displayingindex], pictures[displayingindex]); btn_next = (button) findviewbyid(r.id.btn_next); btn_next.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { initializemp(); playsound.start(); if (displayingindex + 1 == innerpictures.length) return; displayingindex++; mdrawingview.setshape(innerpictures[displayingindex], pictures[displayingindex]); } }); btn_prev = (button) findviewbyid(r.id.btn_prev); btn_prev.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { initializemp(); playsound.start(); if (displayingindex == 0) return; displayingindex--; mdrawingview.setshape(innerpictures[displayingindex], pictures[displayingindex]); }); }

sorry bad indentation.

android button view

android - Working of INSTALL_REFERRER Broadcast -



android - Working of INSTALL_REFERRER Broadcast -

i want know right working of install_referrer broadcast referrals. ensure not possible 'exploit' apps.

so far, have understood:

user gets referral link of app user downloads on device just after installation, broadcast sent google play app this broadcast received app tracking referral.

will broadcast fired 1 time again if:

user downloads app same account, device uninstalls app , installs 1 time again (on same device)

in general, far know, should fire in both of cases. if want create sure count once, should check flag of sort have on own server.

here documentation back upwards this: https://developer.android.com/reference/com/google/android/gms/tagmanager/installreferrerreceiver.html --

"the google play com.android.vending.install_referrer intent broadcast when app installed google play store. broadcastreceiver listens intent, passing install referrer info gtm mobile apps , google analytics."

android android-intent google-play android-broadcast

java - Tabhost- Android ViewBadger badge issue -



java - Tabhost- Android ViewBadger badge issue -

in application want show badges on 1 tab. used android-viewbadger.jar file android viewbadger setting badge on tab-2 means notification tab , setting badge

view target = findviewbyid(r.id.tab2); badge1 = new badgeview(this, target); badge1.settext("0"); badge1.setbadgeposition(badgeview.position_bottom_right); badge1.toggle();

when set badge show on right side

i have tried alter tabs number

view target = findviewbyid(r.id.tab1); view target = findviewbyid(r.id.tab2); view target = findviewbyid(r.id.tab3); view target = findviewbyid(r.id.tab4);

but show on right side here code using

@override protected void oncreate(bundle arg0) { // todo auto-generated method stub getactionbar().hide(); super.oncreate(arg0); setcontentview(r.layout.fr_tabs); mainactivity_context = mainactivity.this; mtabhost=(tabhost)findviewbyid(android.r.id.tabhost); mtabhost.setup();/// starts tabs mtabhost.setontabchangedlistener(this); mtabhost.addtab(newtab(tab_home,r.string.home,r.id.tab1,r.drawable.people_icon_dark)); mtabhost.addtab(newtab(tab_inbox, r.string.inbox, r.id.tab2, r.drawable.main_profile_icon)); mtabhost.addtab(newtab(tab_profile, r.string.profile, r.id.tab3, r.drawable.notification_icon_ark)); mtabhost.addtab(newtab(tab_setting, r.string.setting, r.id.tab4, r.drawable.messages_icon_dark)); mtabhost.addtab(newtab(tab_videos, r.string.video, r.id.tab5, r.drawable.more_icon_dark)); } private tabspec newtab(string tag, int label_id, int tab_content_id, int res) { // todo auto-generated method stub view indicator=layoutinflater.from(this).inflate(r.layout.tab_sample, null,false); ((textview) indicator.findviewbyid(r.id.tex)).settext(label_id); ((imageview) indicator.findviewbyid(r.id.img)).setimageresource(res); ///we utilize tabspec tabspec tabspec=mtabhost.newtabspec(tag); tabspec.setindicator(indicator); tabspec.setcontent(tab_content_id); view target = findviewbyid(r.id.tab2); badge1 = new badgeview(this, target); badge1.settext("0"); badge1.setbadgeposition(badgeview.position_bottom_right); badge1.toggle(); homecoming tabspec; } @override public void ontabchanged(string tabid) { // todo auto-generated method stub if(tab_home.equals(tabid)){ people frg=new people(); bundle b=new bundle(); b.putstring("tag", tabid); frg.setarguments(b); updatetab(frg,r.id.tab1,true); current_tab=1; return; } if(tab_inbox.equals(tabid)){ profile frg=new profile(); bundle b=new bundle(); b.putstring("tag", tabid); frg.setarguments(b); updatetab(frg,r.id.tab2,true); current_tab=1; return; } if(tab_videos.equals(tabid)){ more frg=new more(); bundle b=new bundle(); b.putstring("tag", tabid); frg.setarguments(b); updatetab(frg,r.id.tab5,true); current_tab=4; return; } if(tab_profile.equals(tabid)){ intent intent = new intent(this, notifications.class); startactivity(intent); } } private void updatetab(fragment frg, int place_holder, boolean addtobackstack) { // todo auto-generated method stub fragmenttransaction ft=getfragmentmanager().begintransaction(); ft.replace(place_holder, frg); if(addtobackstack) ft.addtobackstack(null); ft.commit(); } public void launchnewfragment(fragment frg1, int containerid) { updatetab(frg1, containerid,true); } public void launchfinishfragment(fragment frg1, int containerid,boolean b) { updatetab(frg1, containerid,true); } }

checking enable layout bound alternative setting=>developer alternative => layout bound

when utilize public view getchildtabviewat (int index); method tabwidget documentation

view target = findviewbyid(r.id.tab2); target = mtabhost.gettabwidget().getchildtabviewat(2); output

java android