Posts

Showing posts from September, 2015

database - How many Observations in SAS Sample Data Output -

i have sample sas output , need find out how many observations , compute t-statistic beta1. can me started on how go doing this? sample sas output to number of obs in dataset can run code. data _null_; put nobs=; stop; set sashelp.class nobs=nobs; run; a proc reg give summary statistics need, namely, t-value, beta1 , beta null, intercepts of regression equation. here simple easy follow example http://support.sas.com/documentation/cdl/en/statug/63962/html/default/viewer.htm#statug_reg_sect003.htm

ios - how to query based on pfobject/pfuser associated with another pfobject in parse.com? -

i have parse class called friendrelation. class has 2 users, 1 friend other user. i want of messages posted of friends of user. attempting following query: pfquery *innerquery = [pfquery querywithclassname:@"friendrelation"]; [innerquery wherekey:@"user" equalto:currentuser]; pfquery *query = [pfquery querywithclassname:@"message"]; [query wherekey:@"usermessage" matchesquery:innerquery]; [query findobjectsinbackgroundwithblock:^(nsarray *comments, nserror *error) { }]; this query comes no results. i believe occurring because of line: [query wherekey:@"usermessage" matchesquery:innerquery]; the key needs friendrelation match. correct? how can make results of inner query user intern match matching query? thanks! you can try using - (void)wherekey:(nsstring *)key matcheskey:(nsstring *)otherkey inquery:(pfquery *)query something like: pfqu

javascript - Feed FileReader from server side files -

i´m starting customize/improve old audio editor project. can import audio tracks canvas via drag&drop computer. thing use audio tracks stored in server clicking on list of available tracks... instead of use <input type="file"> tags. how can read server side files filereader?ajax perhaps? in advance. this code file reader: player.prototype.loadfile = function(file, el) { //console.log(file); var reader = new filereader, filetypes = ['audio/mpeg', 'audio/mp3', 'audio/wave', 'audio/wav'], = this; if (filetypes.indexof(file.type) < 0) { throw('unsupported file format!'); } reader.onloadend = function(e) { if (e.target.readystate == filereader.done) { // done == 2 $('.progress').children().width('100%'); var onsuccess = function(audiobuffer) { $(el).trigger('audiee:fileloaded', [audiobuffer, file]);

javascript - How to get current YouTube IDs via iMacros? -

i want viewed youtube video id , save csv via imacros, gets nothing. here js code: var videoid; videoid ="code:"; videoid +="url goto=https://www.youtube.com/watch?v=dbnywxdz_pa"+"\n"; videoid +="add !extract {{!urlcurrent}}"+"\n"; videoid +="set !var1 eval(\"var s=\"{{!urlcurrent}}\"; s.match((?<=watch\\?v=|/videos/|embed\\/)[^#\\&\\?]*);s[0]; \")"+"\n"; videoid +="add !extract {{!var1}}"+"\n"; videoid +="saveas type=extract folder=* file=url.csv"+"\n"; try this: var videoid = "url goto=https://www.youtube.com/watch?v=dbnywxdz_pa" + "\n"; videoid += "set !extract {{!urlcurrent}}" + "\n"; videoid += 'set !extract eval("\'{{!extract}}\'.match(/v=(.{11})/)[1];")' + "\n"; videoid += "saveas type=extract folder=* file=url.csv" + "\n"; iimplay

c# - Maintaining a program folder in program files out of date? -

for program i'm writing in vs c# wpf need store user related information on user's computer. far knew has been done creating folder in c:\program files , adding whatever program related info folder in subfolders or whatever. after doing browsing came across lot of people saying method out of date because access may denied create folder there, works administrative accounts, etc.. 1 site suggested saving c:\users\username\appdata\roaming or c:\users\username\appdata\local. question best , date method saving program data users computer? also take @ msdn article . it uwp apps have general idea put if developing wpf app. you may need these folders: environment.specialfolder.applicationdata environment.specialfolder.localapplicationdata environment.specialfolder.commonapplicationdata

emulation - Android map show my location didn't work -

i have been struggle current location in google map, tried official map demo, not working also. shows getmylocation button on upper right, didn't show blue dot on map current location. here code , i'm using emulator target api 23, guess may emulator's problem since code download directly github. advice appreciated. [screenshot][1] package com.example.mapdemo; import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.googlemap.onmylocationbuttonclicklistener; import com.google.android.gms.maps.onmapreadycallback; import com.google.android.gms.maps.supportmapfragment; import android.manifest; import android.content.pm.packagemanager; import android.os.bundle; import android.support.annotation.nonnull; import android.support.v4.app.activitycompat; import android.support.v4.content.contextcompat; import android.support.v7.app.appcompatactivity; import android.widget.toast; /** * demo

java - Array of Bitmaps Displayed in a GridView using ArrayAdapter. Android -

i'm trying populate gridview array of bitmaps. when trying use code: public void onresultreceived_image(bitmap[] bitmaps) { arrayadapter<bitmap> adapter = new arrayadapter<bitmap>(this, android.r.layout.simple_list_item_1, bitmaps); gridview.setadapter(adapter); } i tostring exceptions, makes sense considering simple_list_item_1 attempting use text view populate grid (as understanding anyway). i've put research custom array adapters far haven't found particularly useful or relevant bits of material towards bitmaps , gridviews. there easy fix or simple implementation of custom array adapters can point me to? new android , java.

How can I cancel the default action when the 'drop' occurs using Dojo dnd -

i using dojo/dnd/source.in application, drag item source target,and under conditions,i want cancel default action when or before drop it. i tried return false in ondrop handler,but doesn't work. tried "this.emit('dndcancel')",and doesn't work neither. mytarget.on("drop",function(source,nodes,copy){ this.emit("dndcancel"); return false; } what should do?please thanks! try dojo publish: require(['dojo/topic'], function(topic) { topic.publish("/dnd/cancel"); }

javascript - jQuery keep other boxes not edited state -

Image
in code below when click edit other boxes loose edited icon until cancel clicked. is there away can have if box not being edited keeps normal state of code? the library using is: https://vitalets.github.io/x-editable/ normal state: when edit button clicked: jquery: /* x-editable */ $(function(){ $.fn.editable.defaults.mode = 'inline'; $.fn.editable.defaults.params = function (params) { params._token = $("#_token").data("token"); return params; }; var dataurl = $('.updatefield').data('url'); var inputname = $('.updatefield').attr("name"); $('.updatefield').editable({ type: 'text', url: dataurl, name: inputname, placement: 'top', title: 'enter public name', toggle:'manual', send:'always', ajaxoptions:{ datatype: 'json' } }); $('.edit').click(function(e){ var contai

how to count the total number of items for the lists contain a specific item in python -

i want count total items lists contain 'a', should 4+3 = 7 tweetword = (['a','b','c','a'],['a','e','f'],['d','g']) count_total_a = {} t in tweetword: word in tweetword: if word not in count_total_a: count_toal_a[word] = len(t) if word in count_total_a: count_total_a[word] += len(t) '''the result not correct coz counts first list twice''' really appreciate help! take sum on generator: sum(len(x) x in tweetword if 'a' in x)

php - Slim Framework : Homepage Routing without Trailing Slash -

using slim 3, want homepage url www.domain.com instead of www.domain.com/ . this routing redirect home request www.domain.com/ $app->get('/', function ($request, $response, $args) { }); but 1 gives me error. $app->get('', function ($request, $response, $args) { }); i'm using standard .htaccess : rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^ index.php [qsa,l] i think common issue. best workaround this? edit: what trick or workaround homepage url looked without trailing slash on address bar? the first / required http spec. if go https://stackoverflow.com in firefox , inspect headers sent using livehttpheaders, see this: / http/1.1 host: stackoverflow.com user-agent: mozilla/5.0 (macintosh; intel mac os x 10.11; rv:45.0) gecko/20100101 firefox/45.0 accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 accept-language: en-gb,en;q=0.5 accept-encoding: g

python - numpy recarray from CSV dtype has many columns but shape says just one row, why is that? -

my csv has mix of strings , numeric columns. nump.recfromcsv accurately inferred them (woo-hoo) giving dtype of dtype=[('null', 's7'), ('00', '<f8'), ('nsubj', 's20'), ('g', 's1'), ... so mix of strings , numbers can see. numpy.shape(csv) gives me (133433,) which confuses me, since dtype implied column aware. furthermore accesses intuitively: csv[1] > ('def', 0.0, 'prep_to', 'g', 'query_w', 'indef', 0.0, ... i error cannot perform reduce flexible type on operations .all(), when using numeric column. i'm not sure whether i'm working table-like entity (two dimensions) or 1 list of something. why dtype inconsistent shape? a recarray array of records. each record can have multiple fields. record sort of struct in c. if shape of recarray (133433,) recarray 1-dimensional array of records. the fields of recarray may accessed name

java - 1D array frequency counter for other methods -

i wanted call method prompt user enter miles driven, gallons used, calculate miles per gallon, display how many miles per gallon type of car got on trip. wanted method passes “1” add frequency counter each type of car later on. (if car honda, add “1” arrayname[1], if car toyota, add “1” arrayname[2], etc.). int[] mpglist = new int[5]; // 5 because there 4 more car types mpglist[0] = do{ prompt = double.parsedouble(joptionpane.showinputdialog(null, "enter" + "\n" + "1 honda")); if (prompt == 1) { forhonda(); }; ...... public static void forhonda(){ double miles, gallons, mpg; miles = double.parsedouble(joptionpane.showinputdialog(null,"enter miles driven ")); if (miles <= -1){ joptionpane.showmessagedialog(null,"input negative" + "\n" + "try again&qu

osx - Copy/paste issue with my .vimrc file -

when try copy in visual mode , paste it, pasting new line instead of copied line. when same thing done under root dosent use .vimrc works fine. this .vimrc using. appreciated , 1 thing note same .vimrc when used in linux works fine. since mentioned work under linux, assume error on windows or osx. mentioned @sudobangbang issue line set clipboard=unnamedplus what set default copy buffer vim + vim's alias x window clipboard used linux. not sure why it's giving new lines it's how interacts os to work windows , osx you'll want use command set clipboard=unnamed sets copy buffer * alias clipboard in windows/osx. however if remove line entirely can manually copy/paste system copy buffer doing "*y , "*p using " reference * buffer followed command

Passing parameters in url using python scripting -

my need : want pass payload in each parameter , result stored in text file. want know how pass payload parameters in url using python fyi : pulling url text file , writing output text file. need pass parameter in between = & ex url : http://apps.hello.com/appeditprofile/appeditprofileupdate.php&marital_status=1&encid=d961e7e192042c955bde7b68e38c25a72&tofeet=5-8&fromfeet=4-5& i recommend using urllib handle encodings well. building off of arshid’s example: import urllib url = 'http://example.com' params = { 'var1': 'test', 'name': 'arshid' } url = '%s?%s' % (url, urllib.urlencode(params),) you can see examples here more info.

javascript - Rails 4 - jQuery to hide initially, then toggle with click -

im having trouble resolving conflicts between jquery , javascript. one of javascript conflicts comes trying use dependent-fields gem. see outline of problem here: rails - conflicts between jquery , javascript instead of trying solve problem, i'm trying figure out how make jquery code directly manipulates forms hide , show data in way gem serves (or intended do). i have made file in app/assets/javascripts called: projects.js.coffee. has: $(document).ready(function() { $("#check_project_milestones").hide() }); im not expecting toggle part, hoping might work hide content in check_project_milestones tag. doesnt. in projects form, have: <%= f.input :has_milestones, as: :boolean, boolean_style: :inline, :label => 'does research project have identifiable milestones or decision points?', id: 'check_project_milestones' %> <%= content_tag :div, data: {'checkbox-id': 'check_project_milestones'

jenkins - Can we integrate the Allure report to Maven based TestNG project -

i have integrated allure-report maven based testng project, , report generated can see running jetty server , looking @ localhost. xml reports generated inside main project folder. now integrating jenkins test project, able build project jenkins not able see allure report in jenkins. tried adding allure-report plugin jenkins guess missing basic config allure-report , jenkins. kindly suggest if has got success in it. you have configure allure-plugin post-build action in jenkins job. there can set folder xml-results generated in project. "target/allure-results". the rest should done plugin...

msbuild - Issue with VS 2015 Project/Solution build definition in TFS 2010 Server -

i'm getting issue tfs 2010 build definition not copying dlls project in vs 2015. had issue compiler dlls putting in bin folder , i'm getting application level errors. once moved compiler dlls (csc.exe, .config, .codeanalysis.dll,...) roslyn folder inside bin folder (project\bin\roslyn), application working successfully. roslyn folder creating outside project root directory. folder structure: ......\build\roslyn ......\build\_publishedwebsite\project_folder\bin i have created post build command move roslyn inside bin , moved successfully. still copy of files under roslyn available in bin , failing application work properly. any help. please let me know if need more info. as temporary fix, have added post build command remove files , it's working successfully. if exist "$(webprojectoutputdir)\bin\microsoftcodeanalysisdll" del /f "$(webprojectoutputdir)\bin\microsoftcodeanalysisdll"

broadcastreceiver - Android: AlarmManager called my Broadcast Receiver even though the trigger time not reached yet -

i having trouble alarm manager , broadcast. code schedule task in hour. var preference = preferencemanager.getdefaultsharedpreferences (application.context); var alarmmanager = (alarmmanager)application.context.getsystemservice (application.alarmservice); var intent = new intent (application.context, typeof(scheduleusagelogreceiver)); var schedule = new logschedule (1); var serializer = new datacontractjsonserializer (typeof(logschedule)); if (preference.contains (scheduleusagelogreceiver.share_preference_usage_name)) return; using (memorystream ms = new memorystream()) { serializer.writeobject(ms, schedule); var json = encoding.default.getstring(ms.toarray()); var editor = preference.edit (); editor.putstring (scheduleusagelogreceiver.share_preference_usage_name, json); editor.commit (); } var pendingintent = pendingintent.getbroad

typescript: What to do if a typings (or tsd) is not available? -

i looking on typescript handbook , can't seem find answer. if using library no typings exist options. one create typings file, don't want do. what other options, seem remember kind of 'declare' keyword ? or maybe in tsconfig ? i assume there way of declaring variable (type) globally every time use it, work. and presume there way of declaring available in 1 file. i still confused this. of course best way include typings file won't available. any appreciated thanks if primary concern rid of errors, can write declare var myuntypedlibrary: any; above code, myuntypedlibrary name of global reference dependency. if need reference in several files , don't want repeat yourself, write in top of file, above namespaces, , available whole project. if have many untyped dependencies, idea have separate ts-file define these. note: works fine when using local modules. i'd guess might more troublesome if 1 using external modules , want

angularjs - How to test my RouteConfig and other decorators in an Angular 2 Component -

i trying write unit tests angular 2 component before go further have no idea how write test checks whether routeconfig's path set '/documents'. have test verifies template contains <router-outlet></router-outlet> inside. this component : import { component } 'angular2/core'; import { canactivate, routeconfig, router_directives } angular2/router'; import documentscomponent './documents/documents.component'; @component({ template: ` dashboard <router-outlet></router-outlet> `, directives: [ router_directives, ] }) @canactivate((next, prev) => { // check if user has access return true; }) @routeconfig([ { path: '/documents', name: 'documents', component: documentscomponent, useasdefault: true, } ]) export default class dashboardcomponent { public name: string = 'john'; sayhello(): string { retur

php - Google drive file upload API with codeigniter -

i trying use google drive api integration php application upload/get files drive without asking users login gmail while uploading. is possible drive api? tried uploading file drive basic form.it working ,but in application user should not ask login , user uploaded file must stored in drive.(i.e, using drive storing user uploaded files ). is possible? , how codeigniter? have working copy in php. it's pretty simple. instead of using access token associated user, need refresh token associated target drive account. steps here how authorise app (web or installed) without user intervention? (canonical ?)

Get Chrome tab pid from Chrome extension -

i'm trying process id associated current tab thru chrome extension. i did manage thru chrome.processes experimental api. there way tab pid standard (non-experimental) api ? if want real process id (i.e. 1 can used other programs identify processes), option chrome.processes , api available on dev channel (so not chrome stable nor beta). if need identifier uniquely identify processes, can "process id of tab" via chrome.webnavigation api. id meaningful within chrome. before delve details, let's first multiple tabs can share same process id, , 1 tab can contain multiple processes (when site isolation project enabled). so, "tab pid", assume you're referring process hosts top-level frame. can retrieve list of frames , extract process id tab follows: background.js 'use strict'; chrome.browseraction.onclicked.addlistener(function(tab) { chrome.webnavigation.getallframes({ tabid: tab.id, }, function(details)

android - Quickblox shares users across applications -

i'm using quickblox power of applications.i noticed quickblox shares users table across applications under same account.so if user registered in app (a) , won't able register in app (b), because email account registered . missing here ? or bug ? it's done design (old design) , face lot of performance issues approach (internally). at moment, can use single user login in different apps. in next version(in ~4-6 weeks), 1 user able log in single application under credentials. able create 2 users same credentials in 2 apps. you can check quickblox updates here https://quickblox.com/blog

hadoop - How Replace function in Pig works? -

my input file name words.txt below . there no space in each record of below file . hi hi how i loading file pig words = load '/user/inputs/words.txt' using pigstorage() (line:chararray); words_each = foreach words generate replace(line,'','|') ; dump words_each; i getting output |h|i| |h|i| |h|o|w| but know how replace functions treats '' second argument in replace function . there no empty space in file, how come getting | in output . well, per statement, replace function called on '' . doesn't contain whitespace. if want replace space, need give ' ' . + both different conditions given below: words_each = foreach words generate replace(line,'','|') ; // without space words_each = foreach words generate replace(line,' ','|') ; // space first condition add pipe symbol(|) after each character, while 2nd condition won't make impact because there no space in f

owasp sensitive data prevention in java -

owasp sensitive data prevention in java in code wrote following line , got a6-sensitive data exposure- heap inspection private string password; how should change code owasp sensitive data prevention in java? still not clear tool gave warning @ line (it unlikely dependency check). can guess tool wants passwords stored in char[] rather string . the reasoning can overwrite password blanks if no longer needed , therefore minimise chance shows in heap dumps.

In C, should I define (not declare/prototype) a function that takes no arguments with void or with an empty list? -

there may or may not duplicate question, although tried find 1 everyone's answer seemed referring declaration/prototype . specify definition void foo() { } same void foo(void) { } , way should use? in c89? in c99? believe should start using void foo(void); prototype declarations, there difference @ if use void or not definition ? i'll try answer , practically. practice , reference i'm familiar with, c89 , c99 should treat declaration/definition/call of functions which take no arguments , return no value equally. in case 1 omits prototype declaration (usually in header file), definition has specify number , type of arguments taken (i.e. must take form of prototype , explicitly void foo(void) taking no arguments) , should precede actual function call in source file (if used in same program). i've been advised write prototypes , decently segmented code part of programming practice. declaration: void foo (void); /*not void foo(), in order conform

ios - How to Handle Image Sequences in React Native -

Image
i have basic 1 page react native app ios (ipad 4) shows camera feed , overlays image sequence. image sequence consists of 149 frames , loops continually. i achieve image sequence loop replacing source of image component 24 times per second. here app class (without style props). class app extends component { constructor(props) { super(props); this.state = { frame: 1 }; } componentdidmount() { setinterval(() => { let frame = this.state.frame; frame++; if (frame > 149) { frame = 1; } this.setstate({frame}); }, 1000 / 24); } render() { return ( <view style={styles.container}> <camera ref={(cam) => {this.camera = cam}}> <text>frame: {this.state.frame}</text> <image source={{uri: `./gifs/${this.state.frame}.gif`}}/>

c++ - Comparing strings in qt doesn't work -

i'm trying compare 2 strings default in qt fails. it's false the statement if group == default, goes s.begingroup, group called default. don't know problem, that's weird. foreach (const qstring &group, s.childgroups()) { if(group =="default") continue; s.begingroup(group); profile *profile = new profile(); profile->setobjectname(group); profile->load(s); s.endgroup(); m_profiles << profile; } the definition of foreach in qt resolves following: # define q_foreach(variable, container) \ (qforeachcontainer<qt_foreach_decltype(container)> _container_((container)); \ _container_.control && _container_.i != _container_.e; \ ++_container_.i, _container_.control ^= 1) \ (variable = *_container_.i; _container_.control; _container_.control = 0) so can see there 2 for loops, poss

java - Why i am getting here method overriding error? -

this superclass: class superclass { int a=89; final static void m( int p){ system.out.println("inside superclass"); } static void n(){ system.out.print("superclass"); } } this subclass:: class subclass extends superclass { int a=90; static void m( int p){ system.out.println("inside subclass"); } static void n(){ system.out.print("subclass"); } } main class: class main { public static void main(string[] args) { subclass.m(89); new subclass().n(); } } the problem cannot understand why javac giving me overriding error in static method..an p.s plzz elaborate rules overriding valid hiding. like the new method definition must have same method signature (i.e., method name , parameters) , same return type. whether parameters in overriding metho

URL session is not maintaining in android -

i working on android project , using session check whether user logged in or not. have url below. http://www.mywebservice.com/app/app.asmx/isuserlogged when login, session on server have userid. using above trying check current session have userid or not, says user not logged in. below code used private void isuserlogged(){ mloading.setvisibility(view.visible); globalfunctions.disablelayout(mainlayout); log.d("executebidauction", act.getstring(r.string.isuserlogged)); stringrequest login = new stringrequest( act.getstring(r.string.isuserlogged), new response.listener<string>() { @override public void onresponse(string response) { if (response != null) { log.e("response isuserlogged",""+response.replace("\"","")); } } }, new response.errorli

wso2cep : Error - 'within' is neither a function extension nor an aggregated attribute extension in execution plan "ExecutionPlan11" -

i using wso2 cep 4.1.0 version real time event processing , writing execution plan checking whether inputted geocoordinates within polygon. getting error : 'within' neither function extension nor aggregated attribute extension in execution plan "executionplan11" my execution plan below , please me in solving error. /* enter unique executionplan */ @plan:name('executionplan11') @import('newinputstream:1.0.0') define stream instream (meta_sourceid string, meta_engoiltemp float, meta_engfuelrate float, meta_acceleratorpedalpos float, meta_engspeed float, meta_barometricpressure float, meta_receivedtime long, meta_latitude double, meta_longitude double); @export('newoutputstream:1.0.0') define stream outstream (meta_sourceid string, meta_alarmname string, meta_alarmmessage string, meta_alarmattribute string, meta_data string, meta_unit string, meta_pointid string, meta_pointname string, meta_deviceid string, meta_receivedtime long); f

sql - Count dividing by 0 -

first of all, have researched everywhere query sorted , cant find answer solved issue here is. i have query: select [report date], count(case when [total_ahr_cap] = '0' or [standing_load] = '0'then null else 1 end) [zero values], count(case when [total_ahr_cap] / [standing_load] > '12' 1 else null end) [green zone], count(case when [total_ahr_cap] / [standing_load] < '12' , [total_ahr_cap] / [standing_load] >= '10' 1 else null end) [yellow zone], count(case when [total_ahr_cap] / [standing_load] < '10' 1 else null end) [red zone], count(case when [total_ahr_cap] null or [standing_load] null 1 end)as [null values], count(case when [total_ahr_cap] / [standing_load] > '0' 1 else null end) [total] [dbo].[dc_chargers$] [report date] = 'march 2016' , sla_no not ('%south%') group [report date] bear in mind copy , paste query results several months of year.

ASP.NET MVC 4 issues with including external javascript -

i'm new in mvc , got stuck using downloaded javascript controller in partial view. downloaded treeview: http://bassistance.de/jquery-plugins/jquery-plugin-treeview/ placed treeview.js , demo.js scripts in project, css , images folder. 2 .js files in /scripts/treeview folder , css , images folder in /content folder. added these bundleconfig.cs: bundles.add(new scriptbundle("~/bundles/treeview").include( "~/scripts/treeview/jquery.treeview.js", "~/scripts/treeview/demo.js")); bundles.add(new stylebundle("~/content/css/treewiew").include("~/content/jquery.treeview.css")); my partial view looks this: <ul id="browser" class="treeview"> <li><span class="folder">folder 1</span> <ul> <li><span class="file">item 1.1</span></li> </ul> <

android - Manually add @Required to the primary field to maintain the same behavior as 0.88.3 (upgrade to 0.89.0) -

i updated realm 0.88.3 0.89.0. in changelog says primarykey fields no longer automatically marked @required. can null if type of field can null. change throw realmmigrationneededexception. either manually add @required primary field maintain same behavior 0.88.3 , below, or change nullability in migration step. what tried: 1. add @required object throws "error:(542, 114) error: incompatible types: string cannot converted long" public class migration{ . . . schema.get("retailer") .setrequired("id", true); . . } @realmclass public class retailer extends realmobject { @primarykey @required private string id; . . . } how correct? thanks beeender, updated newer version 0.89.1 , working now. just add @required existing primary key , no migration needed. @realmclass public class retailer extends realmobject { @primarykey @required private string id; } if add new realmobject proj

UILabel display regular updates whilst loop is being executed -

i have long loop calculation. in order give user idea of progress prefer update of output data displayed in uilabels user can view interim output. // run activity year (int day = 1; day < 366; day++) { (int hour = 1; hour < 25; hour++) { (int minute = 1; minute < 61; minute++) { display = (day*10000)+(hour*100)+minute; self.displaytest.text = [[nsstring alloc] initwithformat: @"%d", display]; } } } obviously self.display.text won't updated until -(void) viewdidappear:(bool)animated has completed. how refresh data, whenever hour loop completed? put in phantom button , refresh it. strikes me little crude. don't want have resort using activity indicator or progress view. thanks. why not perform logic on separate nsthread , run ui updates on main thread occasionally? example, each time "hour" iterations finished (reached 24, after each "day"),

android - TouchImageView Is not Showing Image After Downloading form Volley -

<com.example.util.touchimageview android:id="@+id/imageviewrc" android:layout_width="match_parent" android:layout_height="450dp" android:layout_alignparenttop="true" android:layout_centerhorizontal="true" android:padding="2dp" android:layout_marginright="3dp" android:src="@drawable/placeholder_background" android:scaletype="fitxy" /> below code wiring up: private void setimagewithpicaso(string imageurl) { if (!(imageurl == null)) { picasso.with(getactivity()).load(imageurl).into(imageview, new callback() { @override public void onsuccess() { spinner.setvisibility(view.gone); } @override public void onerror() { spinner.setvisibility(view.gone); applog.showtoastmessage(getactivity(), "rate card loading failed!");

ruby on rails - Nokogiri XML file output is located where? -

i need generate xml file ruby and/or rails , have nokogiri installed. in file ruby code go generate xml file? how tell nokogiri generate xml , put file? where xml output located? here code controller file: class monkeytalkcontroller < applicationcontroller require 'rubygems' require 'nokogiri' def edit end def update #debugger render :text => monkeytalk.new(params).build_xml builder = nokogiri::xml::builder.new(:encoding => 'utf-8') |xml| xml.root { xml.products{ xml.widget { xml.id_ "10" xml.name "awesome widget" } } } doc = nokogiri::xml.parse(params) file.open('xml.out', 'w') |fo| fo.print doc.to_s end end puts builder.to_xml end end i need basic understanding of structure of ruby , rails applications , how nokogiri works. to generate xml file not need rails. ruby (and nokogi

php - Extra Custom field add for success page. in Paypal -

i have need multiple field add on return page. 1 field passing , getting . code is:- <form class="validate" id="paypalform" method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr"> <h3>amount :- $5.99</h3> <p class="mc-field-group clearfix"> email : <input required class="required email mce_inline_error" id="mce-email" name="custom" type="email" value="" aria-required="true" aria-invalid="true"> </p> <input type="hidden" name="business" value="er.xxx@gmail.com"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden"

.net - Proper or optimized test way within asp.net web api application -

we have asp.net web api application, in used architecture: presentation layer bll layer dal layer we discussed, me , colleges, tdd , how can used in our project : my approach i see have test bll layer adding full unit tests list, then test presentation layer other opinion we have test services(presentation layer). if test failed then, test methods(in bll) have relation service so discussion proper vs optimized way so need know what best approach between them? can size , type of project interfers in comparison? thanks, in bl, dal should injected dependencies , should using dependency injection container unity. reason being, unit tests shld have no dependency databases. when bl tests isolated databases tests can run fast too

SQL Server Update with Join / Active Column -

Image
i think code better show, want do: update set a.[changed] = 1 [dbo].[table1] inner join [table2] e on [a].[part] = [e].[activepart] update [dbo].[table1] [range] = [range] [partgroup] = [partgroup] , [changed] > 0 before update: after update: please help. thank much. greetz vegeta_77 yes, first part looks better (even if think isn't needed, since concerns same column joining on). nevertheless, second update shouldn't produce changes: update [dbo].[superliste_000] set [plan-tgrp-spanne_stfl1] = [plan-tgrp-spanne_stfl1], [plan-tgrp-spanne_stfl2] = [plan-tgrp-spanne_stfl2], [plan-tgrp-spanne_stfl3] = [plan-tgrp-spanne_stfl3], [plan-tgrp-spanne_stfl4] = [plan-tgrp-spanne_stfl4] [teilegruppe] = [teilegruppe] , [date_change] > 0 again update [plan-tgrp-spanne_stfl1] [plan-tgrp-spanne_stfl1] - same value... either tired , misinterprete code or there little bug in update. ;-)

javascript - square shape won't disappear when clicked on -

i don't know why shape won't disappear when clicked. wrote correct code down disappearing function. wrote code displays green square , should disappear when clicked not. here is: <html> <head> <title>javascript</title> <style type="text/css"> #shape{ width:200px; height:200px; background-color:green; } </style> </head> <body> <div id ="shape"> oo </div> <script type="text/javascript"> var start=new date().gettime(); document.getelementbyid("shape").onclick=function(){ document.getelementbyid("shape").style.display="none"; var end=new date().gettime(); var time=end-start; alert(time); } </script> &l

android - ListView checkbox issue after check -

my issue when check checkbox turns checked duplicates checked state next listview item isn't on visible list (e.g. when can see item on positions 0-5/6 on 1 screen element on position 7-8)... this onclick method: viewholder.messageselectbox.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { if (viewholder.messageselectbox.ischecked()) { log.i("itemid", string.valueof(getitemid(position))); log.i("position", string.valueof(position)); mlistofitemstodelete.add(position); collections.sort(mlistofitemstodelete); collections.reverse(mlistofitemstodelete); } else { (int = 0; < mlistofitemstodelete.size(); i++) { int pos = mlistofitemstodelete.get(i); if (pos == position) {

ios - Swift / MotionKit.framework / how to update label -

i'm trying exploit motion data. i've created test app using motionkit framework . print(teststring) prints x variables correctly console in 1 second interval. testlabel not updated once. import uikit import motionkit class viewcontroller: uiviewcontroller { @iboutlet weak var testlabel: uilabel! let motionkit = motionkit() override func viewdidload() { super.viewdidload() motionkit.getaccelerometervalues(1.0) { (x, y, z) -> () in let teststring = string(x) self.testlabel.text = teststring print(teststring) } } override func didreceivememorywarning() { super.didreceivememorywarning() } } what missing? appreciated. just wrap textfield text code in dispatch_async dispatch_async(dispatch_get_main_queue(), ^{ self.testlabel.text = teststring });

eclipse - Selenium Java - How To Find Element That Dynamically Changes Type? -

i'm writing tests login page using selenium webdriver in eclipse. password field on login page first loaded text field (passwordtext) security reasons. when user places cursor username or password field password field type changed password (password) using javascript. the problem selenium test cannot find password field. comes error 'org.openqa.selenium.nosuchelementexception: unable locate element: {"method":"id","selector":"password"}' code using: driver.get(baseurl + "/login"); driver.findelement(by.id("username")).clear(); driver.findelement(by.id("username")).sendkeys("username1"); driver.findelement(by.id("password")).clear(); driver.findelement(by.id("password")).sendkeys("mypassword"); how can write code correctly find password field? i have worked out answer , add here else similar issue. the resolution first find field first id - pass

c++ - Creating successfully console window but cout doesn't print anything on it ( visual studio enterprise 2015 ) -

i've created dynamic dll. interesting thing same code i'll build in visual studio 2010 works fine while building code on visual studio 2015, doesn't work. #include <windows.h> #include <stdio.h> #include <fcntl.h> #include <io.h> #include <iostream> #include <fstream> #include <string> #include <vector> #define exp __declspec(dllexport) __stdcall using namespace std; void spgoconsole(int status); void exp ttest(int in) { spgoconsole(1); cout << "hello world!" << endl; } void spgoconsole(int status) { if (status == 0) { freeconsole(); return; } int hconhandle; long lstdhandle; console_screen_buffer_info coninfo; file *fp; allocconsole(); getconsolescreenbufferinfo(getstdhandle(std_output_handle), &coninfo); coninfo.dwsize.y = 1000; coninfo.dwsize.x = 1000; setconsolescreenbuffersize(getstdhandle(std_output_handle), coninf

To Speed up the Digital signing process in multithread appliaction in WPF c# -

here code: int threadcount = filteredviewtable.count; int chunksize = threadcount + 1; int lastbatch = 0; int batchcount = 0; if (threadcount > chunksize) { batchcount = threadcount / chunksize; lastbatch = threadcount % chunksize; } else lastbatch = threadcount; if (lastbatch > 0) batchcount++; int endthread = 0; int counter = 0; while (counter < batchcount) { int startpos = counter == 0 ? 0 : (endthread * counter); counter++; if (counter == batchcount && lastbatch != 0) endthread = lastbatch; else endthread = chunksize; int endpos = endthread; observablecollection<manualsendingdata> dttempfiltereddata

Eclipse Git : auto-synchronising 2 branches -

Image
i working on project mates. yesterday cloned project intention add functionality. have 2 local branches develop (the main branch) , pagecontent (my feature branch). the problem encountering when edit on feature branch, automatically edits on developp branch (i did not commit anything). i checked out on developp branch delete edition , when checked out on feature branch, edition deleted ... the branches seem auto-synchronised. i checked out on develop branch delete edition , when checked out on feature branch, edition deleted ... this how git works . in following diagram can see 3 states . git has 3 main states files can reside in. they shared between branches. when checkout branch change head end staging area && working directory shared between repository when checkout branches. since did not commit (i assume happened) when switch branches see changes following new branch. if don't want changes follow you need commit (or stas

javascript - I want to add a css class selector to an onclick function in a vimeo-video slider/carousel plugin that came with a Timber template I bought -

Image
want achieve: thumbnail gallery of video selections work playlist. each thumbnail clickable link load & play respective video in central screen above gallery. gallery player/slider above and here's bit of js plugin, (i think) function clicking next: (demo link below) var z = a('<a href="#" />').attr("id", "tms-prev").addclass("tms-arrow-nav").appendto(b), c = a('<a href="#" />').attr("id", "tms-next").addclass("tms-arrow-nav").appendto(b); z.each(function() { a(this).on("click", function(a) { a.preventdefault(), p.autoadvance && b.data("loaded") && y.resetslideshow(), y.prevslide() }) }), c.each(function() { a(this).on("click", function(a) {