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