Posts

Showing posts from February, 2013

unit test using typescript and karma -

i using karma, jasmine, typescript write unit test helloworld application https://angular.io/docs/js/latest/quickstart.html . below test code: ///<reference path="../typings/jasmine/jasmine.d.ts"/> import { myappcomponent } '../spray1'; describe("name alice", () => { var comp = new myappcomponent(); it("verify name", () => { expect(comp.name).tobe("alice"); }); }); tsc (with "--module commonjs") transpiles test code into: ///<reference path="../typings/jasmine/jasmine.d.ts"/> var spray1_1 = require('../spray1'); describe("name alice", function () { var comp = new myappcomponent_1.myappcomponent(); it("verify name", function () { expect(comp.name).tobe("alice"); }); }); karma fails run unit test: uncaught error: module name "../myappcomponent" has not been loaded yet context: _. use requir

ios - testflight external status active but nothing to test -

Image
my ios application in prerelease testing process. last day sended application itunesconnect , send invites external test group, works fine. able test application. i’m doing process other (10+) applications. but today, clicked send invites button till no e-mail , no application test in testflight app. know solution/workaround problem? thank you. another interesting detail when click on build number there "test information" , "testers" tabs. i'm able see external testers there, time says "internal , external testers can added in app’s prerelease section." after few hours apple sended push notification , e-mail it. able test application. change nothing in itunesconnect site. i'm able see external tester under tester tab. (instead of writing "internal , external testers can added in app’s prerelease section") if face same issue in future, problem @ apple side. means, patience , don't worry. thank you.

toolbar - Error inflating class in Android -

i had application using actionbaractivity , made mistake of upgrading android studio version 22. i'm trying appcompatactivity work, getting error caused by: android.view.inflateexception: binary xml file line #2: error inflating class android.support.v7.widget.toolbar my activity @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_user_prefs); toolbar = (toolbar) findviewbyid(r.id.app_bar); setsupportactionbar(toolbar); getsupportactionbar().sethomebuttonenabled(true); getsupportactionbar().setdisplayhomeasupenabled(true); getfragmentmanager().begintransaction() .replace(r.id.content_frame, new userprefsfragment()) .commit(); } my app_bar.xml <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.toolbar xmlns:android="http://schemas.android.com/apk/res/android" andr

php - Warning: mysqli_connect(): php_network_getaddresses: getaddrinfo failed: No such host is known. Yet I clearly have to host there -

i have site written in php i'm creating. i'm having issue when connect database. when load page, top: warning: mysqli_connect(): php_network_getaddresses: getaddrinfo failed: no such host known. in c:\program files\apache software foundation\apache2.2\htdocs\socialtest\inc\connect.inc.php on line 7 warning: mysqli_connect(): (hy000/2002): php_network_getaddresses: getaddrinfo failed: no such host known. in c:\program files\apache software foundation\apache2.2\htdocs\socialtest\inc\connect.inc.php on line 7 this connect.inc.php. file establishes connect mysql database: $dbc = mysqli_connect('user','password','server','database'); #or die('captian, have failed' . # mysqli_connect_error()); ?> the server name 'localhost' , never had problem until recently. please let me know how can solve issue i've tried can think of , i'm out of options. i'm using apache2.2, php .5.6.9 , mysql56 on wi

android - Strange behaviours of responsive menu -

Image
i created website responsive menu pc-browser , android-browser samsung s5 using @media screen , (device-width: 360px) , (device-height: 640px) , (-webkit-device-pixel-ratio: 3) menu works on pc. when website running on mobile browser (native , chrome also) .menu block seems wanted size still invisible, although there no display: none. i used z-index solving problem nothing happend , still can't find bug. when .content display set on hide, .menu looks ok. div .menu seems underside(?) of .content if does, why z-index doesn't work correctly? this site website . can check issue? i found problem. height of .navigator set on 3em . div .menu inside .navitagor

sql server - sum(DATALENGTH) returning an "Arithmetic overflow" error -

i new sql server please accept apologies if question seems easy. tried finding solution, far couldn't see use in query. i trying find length of biggest columns in table , i'm using following query. select sum(datalength([insdetails])) [insdetails] dbo.contractors the table contractors on 8gb , has on 30mln rows. insdetails column varchar(2048) the query above works other columns of other tables in database, when run on contractors table returns error msg 8115, level 16, state 2, line 26 arithmetic overflow error converting expression data type int. i understand error message appears when try convert value of datatype datatype, value large second datatype. could please me rewrite query or suggest alternative approach output? i read suggested using cast big int solve issue, i'm not sure how can incorporated in query. any suggestions appreciated. thank in advance. select sum(cast(len([insdetails]) bigint))

excel - How to sum client totals across subsidiaries when # of subsidiaries varies? -

Image
right have client , subsidiary info in 1 column , have column filtered clients only. in column b have amount bought. want sum these amounts in column c, because each client has diff # of subsids must manually b c 1 2 client =sum(b3:b6) 3 -stuff $$$ 4 -stuff $$$ 5 -stuff $$$ 6 -stuff $$$ 7 client b =sum(b8:b43) 8 -stuff $$$ ... 43 -stuff $$$ 44 client c =sum(b45:b58) 45 -stuff $$$ ... 58 -stuff $$$ if there set distance between each client level write formula , drag down, varying number of subsidiaries means have manually. there's 150 clients don't mind doing manually it's waste of time if there's more efficient method, , have more assignments in future. my recommendation seperate client , subsidiary 2 columns data looks this: then can create pivot table. (insert > pivot table) here screenshot of pivot table finalized criteria off right:

android - Sending Sms in background through AsyncTask is not working -

on click of button want send sms numbers got database in background. if call smsmanager directly on click works. through asynctask not working. please me out. here code .. public class sendsmsactivity extends activity { button buttonsend; edittext textphoneno; spinner level; edittext textsms; private arraylist studentinfo = new arraylist(); private databasehelper mhelper; private sqlitedatabase database; private string levelselected,sms; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.send_sms); buttonsend = (button) findviewbyid(r.id.buttonsend); level = (spinner) findviewbyid(r.id.spinnersms); textsms = (edittext) findviewbyid(r.id.edittextsms); string levelselected = level.getselecteditem().tostring(); string sms = textsms.gettext().tostring(); buttonsend.setonclicklistener(new view.onclicklist

mpi understanding isend and irecv -

i have 2 processes (0 , 1), 0 gets random number, if not mod(number,2)==0 , if bigger previous ones, sends (isend) process 1. process 1 recives number (recv) , has calculate if prime number. if prime number, process 1 sends (isend) process 0. process 0 saves highest prime number (not final prime number, generates amount of random numbers have checked). so in meanwhile process 1 checking if number received prime number, process 0 on random number. point process 0 may overwrite data in isend because process 1 on own work , not receiving. , want this. program mpi_nonblocking use mpi implicit none integer :: ierr, myid ,npe, istatus(mpi_status_size), num, num_copy, best_prime=1, resto, i, n, now(3), req11 integer,parameter :: seed = 86456, numbers=200 integer :: req1(numbers), req2(numbers) logical :: flag, res call mpi_init(ierr) call mpi_comm_rank(mpi_comm_world,myid,ierr) call mpi_comm_size(mpi_comm_world,npe,ierr) if (npe/=2) write(*,*)'avviare il programma con

console - Java: System.out.println and System.err.println out of order -

my system.out.println() , system.err.println() calls aren't being printed console in order make them. public static void main(string[] args) { (int = 0; < 5; i++) { system.out.println("out"); system.err.println("err"); } } this produces: out out out out out err err err err err instead of alternating out , err . why this? they different streams , flushed @ different times. if put system.out.flush(); system.err.flush(); inside loop, work expected. to clarify, output streams cached write goes memory buffer. after period of quiet, written out. you write 2 buffers, after period of inactivity both flushed (one after other).

javascript - imgNotes mousewheel scroll change -

i used plugin https://github.com/waynegm/imgnotes in project. in project when mouse wheel rolling down , zooming image want change this. i want google maps when roll mouse wheel , zoom in image , rool mousewheel down zoom out change line in imgviewer.min.js make f.options.zoom -= b * f.options.zoomstep, f.update() f.options.zoom += b * f.options.zoomstep, f.update()

css - Trouble getting rotated text to render properly in print styles -

so have code h2 rotated <h2>an internet marketing company</h2> here css both regular , print stylesheets regular .proposal .page.cover h2 { color: #ddd; white-space: nowrap; transform: rotate(90deg); transform-origin: left top 0; text-transform: uppercase; letter-spacing: 10px; margin: 40px 0 0 20px; } print .proposal .page.cover h2 { color: #ddd !important; } so result on webpage correct looks http://gyazo.com/0e41e9e7762e1e15bfc3a6d26e1c1c1a the problem occurs when try print pdf http://gyazo.com/a3d9b58b98f08cc81dd312ec4a7afa27 there seems black outline gunk going around text. know how fix this?

Cannot access element id's in bootstrap modal using jquery, getting undefined error -

jquery , bootstrap modalbox code in same page lets index.php <div class="modal fade" id="tilemodal" tabindex="-1" role="dialog" aria- labelledby="mytilemodal" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title">select tiles</h4> </div> <div class="modal-body"> <div id="result"> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal&quo

ios - How to access class constants and variables -

why can not perform operations variable or constant @ class level? not allowed or there keyword need use access them? bad practice? controller: class viewcontroller: uiviewcontroller { let 1 = 1 let 2 = 2 var sum = 1 + 2 } error: viewcontroller.type not have member named 'one' class variables , constants must static , e.g., static let 1 = 1 . here suffices 2 let constants static them usable in initializing both class , instance variables. following works me: class myclass { static let 1 = 1 static let 2 = 2 static var sum = 1 + 2 var instanceproduct = 1 * 2 } myclass.one myclass.sum myclass().instanceproduct note in above example can myclass.sum = 5 . if meant sum constant well, change static let sum = 1 + two . the requirement constants use outside of functions , closures declared static let . implication of constant entire class. if need instance-specific constants, cannot use them outside of functions or closures

c - C99 - guarantees about ordering of floating-point rounding modes -

are there guarantees (in c99 standard and/or ieee-754) results obtained when using different rounding modes should ordered in particular way? for instance, let f(rm, x) function rm rounding mode , x argument. can consider bug-free implementation should ensure following inequality? f(fe_downward,x) <= f(fe_tonearest,x) <= f(fe_upward,x) as example, following code on machine contradicts hypothesis (even using recent glibc, version 2.21), , wonder if it's bug (worth reporting), or unfortunate consequence of rounding errors, means such behavior should never relied upon. #include <math.h> #include <stdio.h> #include <stdlib.h> #include <fenv.h> #include <gnu/libc-version.h> void set_round(int rm) { // checks rounding mode has been set if (fesetround(rm)) { perror("setround"); exit(1); } } int main() { printf("gnu libc version: %s\n", gnu_get_libc_version()); float x = 3; set_round(fe_tonearest); float r

c# - How to handle URL-encoded POST request with self-hosted WCF? -

i have self-hosted wcf service. works charm, when input data format known, it's not case. my service invoked html form posted it, don't know exact list of parameters sent. external web service send http request content "a=foo&b=bar" , yes, url-encoded. parameters in content may vary. count may vary. parameters may or may not present. i'm fine whole url-encoded string, i'll decode myself. have reply ascii string "ok". how access "a=foo&b=bar" text request? can create own encoder? how it's done? here's started with, contract: [operationcontract] [webinvoke(method = "post", uritemplate = "test", bodystyle = webmessagebodystyle.bare)] stream testpostrequest(); and here's method: public stream testpostrequest() { var maxbytesize = 16384; var messagestream = new memorystream(maxbytesize); var messagebuffer = operationcontext.current.requestcontext.requestmessage.createbuffered

c - A simple reduction program in CUDA -

in below code, trying implement simple parallel reduction blocksize , number of threads per block being 1024. however, after implementing partial reduction, wish see whether implementation going right or not , in process make program print first element of host memory (after data has been copied device memory host memory). host memory initialize '1' , copied device memory reduction. , printf statement after reduction process still gives me '1' @ first element of array. is there problem in getting print or logical in implementation of reduction? in addition printf statements in kernel not print anything. there wrong in syntax or call printf statement? code below: ifndef cudacc define cudacc endif include "cuda_runtime.h" include "device_launch_parameters.h" include include ifndef threadsperblock define threadsperblock 1024 endif ifndef numblocks define numblocks 1024 endif global void reducekernel(int *c) { extern shared int sh_arr[]; in

How to display MKSnapshot in Swift (iOS) -

i trying take snapshot of street view of location pinned in app using mksnapshotter. have code: var options: mkmapsnapshotoptions = mkmapsnapshotoptions(); options.region = self.attractiondetailmap.region; options.size = self.attractiondetailmap.frame.size; options.scale = uiscreen.mainscreen().scale; var fileurl:nsurl = nsurl(fileurlwithpath: "path/to/snapshot.png")!; var snapshotter:mkmapsnapshotter = mkmapsnapshotter(); snapshotter.startwithcompletionhandler { (snapshot:mkmapsnapshot!, error:nserror!) -> void in if(error != nil) { println("error: " + error.localizeddescription); return; } let image:uiimage = snapshot.image; var data:nsdata = uiimagepngrepresentation(image); data.writetourl(fileurl, atomically: true); var pin:mkannotationview = mkannotationview(); uigraphicsbeginimagecontextwithoptions(image.size, true, image.scale); image.dra

c# - parallel.foreach and dictionary collection -

i don't understand how code went wrong here's code piece: var filter=new dictionary<string,dictionary<string,bool>>(); //data here of type dictionary<string,bool> parallel.foreach(data,t=> { var filter1=data.where(p=>p.value).todictionary(p=>p.key,p=>p.value); filter.add(t.key,filter1); }); sometimes, final filter has null key in has never happened if had used simple loop. [this] has never happened if had used simple loop. the problem adding filter concurrently. fix using asparallel() : var filter = data.asparallel().todictionary(t => t.key , data.where(p=>p.value).todictionary(p=>p.key, p=>p.value) );

regex - Find pattern in text, Python -

right have includepat = r'^#\s*include\s+"([^"]+)"' match pattern #include "file.h" i'm having problems trying correct little. if pattern across 2 lines? so.. #include \ "file.h" how should go matching that? edit: sorry guys, more clear, string in quotations anything, not limited file.h if don't need rid of white space , want match it, have pretty close. this match #include plus following white space including new lines, , following word in quotation marks (#include\s+)"([^"]+)" example

c++ - How to tell CMake when using add_library to not include a specific object file -

i trying make static library, example my_lib.a . library depending gsoap code - file2.cpp.o , generated because of cmake instruction (and 2 custom commands): add_library(${target_name} ${src_files} ${generated_src_files} ${generated_h_files} ${generated_res_files}) file2.cpp present in generated_src_files . runs fine until moment of linking. /usr/bin/ar cr ../lib/my_lib.a cmakefiles/my_lib.dir/src/file1.cpp.o cmakefiles/my_lib.dir/src/file2.cpp.o if let make use command, library my_lib.a contain file1.cpp.o , file2.cpp.o . in fact not need file2.cpp.o in *.a library. does know how have manage case in way obtain my_lib.a contains file1.cpp.o ? i think found solution. idea compile *.o files different target not official one. in official target can put these files consider important ones. in case have 1 file not want include in *.a file.. : the first target is: add_library(gsoap_files object ${generated_src_files} ... ) and official 1 is: add_

c# - Multiple Inheritance - want to extend a class that extends Panel, but I also want to extend StackPanel -

i have control, shrinkingtabpanel, proportionally resizes tabs they're added fit (like chrome). however, extends panel, , doesn't work functionality i'm trying achieve - width of shrinkingtabpanel doesn't increase number of items should. when changed class extend stackpanel instead, exact functionality needed. however, shrinkingtabpanel control part of library bought, , it's discouraged change imported source code. i know multiple inheritance isn't allowed in c#, there way can "effectively" extend shrinkingtabpanel , stackpanel in 1 class? the first solution thought of make new class extended stackpanel, , call shrinkingtabpanel.arrangeoverride() , shrinkingtabpanel.measureoverride() within respective methods, extending shrinkingtabpanel. i'm not sure if that's smartest idea.

c++ - 'Input' does not name a type error. Can't figure out why? -

when compile, error: 'input' not name type on line 17 #ifndef game_h #define game_h #include "input.h" // can forward declare "class input(glfwwindow*);" here still // gives same error. class game { public: game(input* input); ~game(); void input(); void update(); void render(); private: input* mpinput; //error here. }; #endif // game_h input.h looks this. #ifndef input_h #define input_h #include <glfw/glfw3.h> #include <vector> class input { public: input(glfwwindow* window); ~input(); bool getkey(int keycode); bool getkeydown(int keycode); bool getkeyup(int keycode); void update(); private: glfwwindow* mpwindow; std::vector<bool> mcurrentkeys; std::vector<bool> mdownkeys; std::vector<bool> mupkeys; const int num_keycodes = 256; }; #endif // input_h i h

javascript - Numbering every number -

i want put number every number using jquery or javascript: if input number: 1, 1, 1, 2, 3, 4, 5, 5, 5, 6, 7, 8, 8, 9, 10 , on then expected output is: 1.1, 1.2, 1.3, 2.1, 3.1, 4.1, 5.1, 5.2, 5.3, 6.1, 7.1, 8.1, 8.2, 9.3, 10.1 , on var arr = [1, 1, 1, 2, 3, 4, 5, 5, 5, 6, 7, 8, 8, 9, 10]; var newarr = [arr[0] + ".1"]; var n = 1; (var = 1; < arr.length; i++) { if (arr[i] == arr[i - 1]) { n++; } else { n = 1; } newarr.push(arr[i] + "." + n); } console.info(newarr);

c - static variable scope inside and outside the function -

please notice static variable selection . testing if selection assigned correct char string within different scope. #include <stdio.h> #include <stdlib.h> #include <string.h> static char* selection; static char* sel_item(char* text) { char* pch; char buf[80]; strcpy(buf, text); pch = strtok(buf, " "); return pch; } static int display_ecnt_codes(char* text) { char buf[80]; strcpy(buf, text); selection = sel_item(buf); // why if output selection here, selection random char, not correct char "srfpro". // printf("display_ecnt_codes: %s\n", selection); } int acode_prockey() { char text[] = "srfpro - surface protection (dealerproduct)"; display_ecnt_codes(text); // why if output selection here, prints correct char string "srfpro". // what's difference between scope , above scope? printf("acode_prockey: %s\n", selection); } int main ()

sql - select records having all null values in a specific temporal window -

i have table: code | instant | val inside of temporal window, based on instant column value, val can null or not null. have this: 'a',2015-06-29 08:00:01,null 'a',2015-06-29 08:30:01,5 'a',2015-06-29 09:00:00,null 'b',2015-06-29 08:00:01,null 'b',2015-06-29 08:30:01,null 'b',2015-06-29 09:00:00,null now, given temporal window: 2015-06-29 08:00:00 <--> 2015-06-29 09:00:00 i'd code of records all null in temporal window. in example answer "b", records code "a" have @ least 1 entry, 5, not null specified temporal window. if understand correctly, want codes null records within range of values. if so, can use aggregation , having clause, this: select t.code table t t.instant >= window_start , t.instant <= window_end group t.code having max(val) null; and equivalent having clause is: having count(val) = 0

ruby on rails - How to implement i18n in the Simple Form gem for a collection's "priority:" option -

integrating i18n simple form gem simple_form accommodates i18n well, , docs pretty thorough on i18n, don't address solution "priority:" option collection field. i've tried applying idea/structure use "hints:" , "prompts:" isn't working. must missing something. excerpt yml: simple_form: hints: location: website: must enter leading http:// short_desc: general information, not review. prompts: location: state: select state # tried this, doesn't seem work priority: location: country: united states of america here's snippet form: # works prompt per spec. <%= f.input :state, collection: us_states, prompt: :translate %> # tried this. nope. missing translation error. <%= f.input :country, priority: [ t('.country') ] %> # tried this. nope. missing translation error. <%= f.input :country, priority: :translate %>

objective c - How to add slide navigation in ios in nib file -

i facing problem add slide navigation in nib file. please me i have example story board , want use in nib can open menu form left side [slidenavigationcontroller sharedinstance].rightmenu = rightmenu; [slidenavigationcontroller sharedinstance].menurevealanimationduration = .18; // creating custom bar button right menu uibutton *button = [[uibutton alloc] initwithframe:cgrectmake(0, 0, 30, 30)]; [button setimage:[uiimage imagenamed:@"gear"] forstate:uicontrolstatenormal]; [button addtarget:[slidenavigationcontroller sharedinstance] action:@selector(togglerightmenu) forcontrolevents:uicontroleventtouchupinside]; uibarbuttonitem *rightbarbuttonitem = [[uibarbuttonitem alloc] initwithcustomview:button]; [slidenavigationcontroller sharedinstance].rightbarbuttonitem = rightbarbuttonitem; slidenavigationcontroller *nav = [[slidenavigationcontroller alloc] initwithrootviewcontroller:viewcon]; nav.navigationbarhidden=yes; self.window.rootviewcontroller=nav;

java - Is WebView "embeddable" in TextFlow? -

Image
it says on openjdk samples textflow can have arbitrary nodes children, e.g. button. wondering if webview can possible child? if so, must doing wrong. when add textflow, webview takes space, displays nothing. content i've tried range simple html pages, videos services youtube. since control new, unable find existing use case online. in case you're wondering why want this. have listview displays rich content. if textflow capable of displaying node, save me creating multiple extension classes different types want display on listview (e.g. video, formatted text, html - these did, , work fine), , can manage content managing textflow's children. thanks. yes, can. note web view layout out using baselineoffset , not going appropriate use in textflow (i think happens it's bottom edge aligned bottom edge of text, , gets clipped height of text row.) can around wrapping in group : import javafx.application.application; import javafx.scene.group; import javafx.

c++ - Does using -parallel or (and) -vec will make our program run faster? -

i'm using linux & intel compiler (c/c++). my code not use cilkplus or openmp. read following article : auto-parallelization overview and i'm confused: if i'm not using openmp (or cilkplus) , compile program "-parallel" (auto-parallelizer) , "-vec" (auto-vectorization), program run faster (because compiler break serial code parallel code ?) if (it run faster), why not default option ? (why not use flags ) ? thanks intel uses such techniques loop unwinding, task decomposition & etc parallel code. these techniques make program run faster problem may occurred when program faces race condition , deadlock , tasks done priority , .... can not used default.

asp.net - Find and Call Sub from Master.vb in ASP VB.NET -

i need find , call sub below in master.vb separate file (about.vb). reason need i'm showing count of values in cookie on every page need change cookie values , count in about.aspx.vb file. fall 1 number behind when master sub checks cookie it's changed after master loads. below sub need call about.aspx.vb: sub favsidetab() if request.cookies("favourites") isnot nothing dim favcookieval string = request.cookies("favourites").value favouritessidetab.visible = true dim cnt integer = favcookieval.count(function(ch) ch = ","c) favouritescount.text = cnt else favouritessidetab.visible = false end if end sub in masterpage use code public sub favsidetab() if request.cookies("favourites") isnot nothing dim favcookieval string = request.cookies("favourites").value favouritessidetab.visible = true dim cnt integer = favcookieval.count(function(ch) ch = &q

Find strings following a pattern in a text file using C# -

i'm looking way search through huge text file , extract couple of strings follow pattern, write each of strings individual lines in text file. is there equivalent of linux grep command, combined * , - , ^ , [] , etc. symbols in c# ? i hope place type of open questions. thank ! firstly, if it's large file, use file.readlines() scan lazy loads small amounts of data @ time, giving 1 line @ time process. then match items, use c#'s regular expression functionality . you'll end like: var regex = new regex(-- match expression --); foreach (var line in file.readlines("somefile").where(line => regex.match(line).success)) { file.appendalltext("file write to", line + environment.newline); }

Setting up WNS service for windows phone 8 get error after add <Identity> tag -

Image
i setting windows phone 8.1 push notification urbanairship. have sid , secret key app. when following step mentioned in dev.windows wns-->live service site: to set application's identity values manually, open appmanifest.xml file in text editor , set these attributes of element using values shown here. my application stop working. 1 provide me steps set wns in windows phone 8.1 helps me lot, spend on week on , frustrating. i got success push notification in windows phone 8.1/ windows apps (universal apps). have implemented sending push notification devices our own web service. step 1 : client secret , package sid dev.windows.com >> services >> live services. you'll need these later in web service. step 2 : in windows app, have associate app store. that, right click on project >> store >> associate app store. log in dev account , associate app. step 3 you'll need channel uri. in mainpage.xaml, add button , textblo

jquery - Destroy the effect when I scrolling down -

$( window ).load(function() { if ($(window).scrolltop() == 0) { $('#girl').delay(4000).fadeout(4000); $('#new_girl').fadein(500); } else{ } }); when load page , scroll down after 4s function works fine when load page , start scrolling when page load works again. want that, if scroll down without waiting 4 seconds , destroy function.may logic should set in else statement. thanks... $( window ).load(function() { indicates code inside execute when window loaded so must have wait. what can write code if ($(window).scrolltop() == 0) { $('#girl').delay(4000).fadeout(4000); $('#new_girl').fadein(500); } else{ } and make sure jquery included before code maybe js error if elements id #girl , #new_girl not loaded dom

c# - Mono equivalent of ClientConnectionId -

i run function under mono ( current version 4.0.2) public object getconnectionproperty(sqlconnection _conn, string prop) { if (_conn.state == connectionstate.closed & prop == "serverversion") return string.empty; if (prop == "clientconnectionid") { guid guid = _conn.clientconnectionid; return guid.tostring(); } return _conn.gettype().getproperty(prop).getvalue(_conn); } but fails error : error cs1061: type `system.data.sqlclient.sqlconnection' not contain definition `clientconnectionid' , no extension method `clientconnectionid' of type `system.data.sqlclient.sqlconnection' found. missing assembly reference? what mono equivalent of clientconnectionid ? or how can fix it? clientconnectionid not implemented in mono sqlconnection class. if want have unique identifier each instance, can having id constructed hashcode example:

objective c - iOS 8.3 storyboard side menu -

1) in app have tried implement side menu using swrevealviewcontroller downloaded https://github.com/john-lluch/swrevealviewcontroller . 2) reveal view controller storyboard file class of swrevealviewcontroller, have imported in project swrevealviewcontroller.h , .m. 3)reveal view controller storyboard file tableviewcontroller & navigation controller there segue name reveal view controller set controller. 4)last view controller storyboard file class of view controller with uibarbuttonitem *barbutton here code in viewcontroller.m #import "swrevealviewcontroller.h" - (void)viewdidload { [super viewdidload]; swrevealviewcontroller *revealviewcontroller = self.revealviewcontroller; if ( revealviewcontroller ) { _barbutton.target = self.revealviewcontroller; _barbutton.action = @selector(revealtoggle:); [self.view addgesturerecognizer:self.revealviewcontroller.pangesturerecognizer]; } } 5) when running app, there black screen in simulator

canvas - Rotating a rectangle based on Mouse X and Y position -

i've been working on , trying work pretty stumped. i want rectangle follow mouse position , rotate correctly. it's following mouse angle rotate seems off. or guidance, i'm not sure doing wrong here. here's code has angle in it: function createboat() { var angle = math.atan2( boat.y - mousepos.y, boat.x - mousepos.x ) * 180 / math.pi; ship_context.rotate(angle); ship_context.fillrect(boat.x, boat.y, boat.width, boat.height); // create shape, there nothing on canvas yet } here's loop function loop() { ship_context.clearrect(0, 0, window.innerwidth, window.innerheight); moveboat(); time = date.now(); createboat(); settimeout(loop, 1000/60); } here's demo: http://staging.interactivemechanics.com/chop/row3.html also, sidenote, working basic shapes right now. plan translate images. rectangle boat , have separate page have leaves in pond moving. have part working collision detection to

python - Average Iterating through list -

i'm new python coming excel. want average list each new item. list: x = [-3.2, 2.7, -8.5, -1.4] i've tried: avg = sum(col)/len(col) and gives result of -2.6, whole column divided whole count. want return average @ each iteration. i've tried use loop: def avg2(x): ttl = 0 in x: ttl += res = ttl / len(x) return res same result, whole sum / whole column. going through whole list, not totals @ each value. reference excel formula (for numbers in column a): =average(a$1:a4) when drag formula down a5, result @ iteration. perhaps using enumerate or loop within loop? you're not saving result anywhere during loop. returning @ end that's why getting these results: def avg2(x): res = [] total = 0 in x: total += res.append(total / len(x)) return res will result in: >>> x = [-3.2, 2.7, -8.5, -1.4] >>> avg2(x) [-0.8, -0.125, -2.25, -2.6] note averages total on len

How do I use old membership system of ASP.NET 2 instead of ASP.NET Identity in ASP.NET 4.5? -

i working on web application , need use legacy membership system. can me know how should have database , how implement membership system in web application uses .net 4.5? let me explain it, know nowadays using asp.net identity if remember in past using asp.net membership in .net 2, can remember old membership , authentication system? want use system instead of asp.net identity. old tables , structure. here history - membership provider universal providers simple membership asp.net identity (current version 2) asp.net universal providers last version of old asp.net membership provider. uses entity framework code first under hood. if have use asp.net 2.0 membership provider , need use aspnet_regsql.exe generate schema , store procedures. pain in neck. here step-by-step instruction @ 4guysfromrolla - examining asp.net's membership, roles, , profile

ios - _hideForKeyboardAppearance error when clicking on UITextView -

i have uitextview , , whenever click on it, app crashes following error: -[__nssetm _hideforkeyboardappearance]: unrecognized selector sent instance 0x7fb8aa76cd60 if run app multiple times, crashes @ same place, intercepting object throwing "unrecoginzed selector" can different. uiimage instead of nssetm , sometimes, uiconstraint , etc. even if don't assign uitextview specific outlet in class, or have assigned delegate, same behavior. happens on both simulator , hardware. any ideas going on? p.s. ios 8. crash happens on both iphone , ipad. edit: note happens though the uitextview calls no code . removed outlet connections in storyboard, , made class doesn't implement uitextviewdelegate . still crashes. why puzzled , wondered if has ever encountered this. 1 thing note view controller having issue buried several screens deep within uisplitviewcontroller . not sure if ui elements buried deep in nav stack somehow intercepting keyboard call?

c# - Task update on Windows Forms -

i trying design application creates new employee data organization. requirement when new employee record being created existing user there main form of application on need show existing user has created new user. example, if existing user , new user b message on main form should mentioned below: a has created new user b. i stuck in place not able understand how display message on main form. for need keep listening database , in case new row created, display message accordingly or there other way not want application keep hitting database unnecessarily. i new c# , stuck here , need help. regards vineet more if want pass data 1 form another, can either: 1) use dependency injection pass mainform createform , populate mainform createform (not idea). 2) show createform dialog form , return dialogresult when closing createform.

spring - What is BeanNameViewResolver? -

i read documentation here , think spring documentation complex , hard understand, need little explanation beannameviewresolver. can code example? as explained in documentation,beannameviewresolver resolves views declared beans. of time need special-purpose views. for example, need render excel spreadsheet. excel generation apache poi <dependency> <groupid>org.apache.poi</groupid> <artifactid>poi</artifactid> <version>3.6</version> </dependency> so, subclass abstractexcelview and implement custom logic render spreadsheet based on model values. public class customexcelview extends abstractexcelview { @override protected void buildexceldocument(map model, hssfworkbook workbook, httpservletrequest request, httpservletresponse response) throws exception { map<string,string> revenuedata = (map<string,string>) model.get("revenuedata"); //create wor

C# Code Contracts: Array operations -

for university must learn how deal code contracts in c#. i want use method should return smallest element in array: public int minarray(int[] minarray) here got have no idea whether correct: public int minarray(int[] minarray) { //neither array should empty nor null contract.requires(minarray != null && minarray.length != 0); //save result... int result = contract.result<int>(); //...and check: contract.ensures(contract.forall(0, minarray.length, => minarray[i] >= result)); } can tell me if right or if wrote nonesense? i'd thankful. beyond that, next task says: public int[] posnegarray(int[] posneg) this should change sign of elements in method (e.g (1, -2,3) (-1,2, -3). public int[] posnegarray(int[] posneg) { //neither array should empty nor null contract.requires(posneg != null && posneg.length != 0); //save result... int resarray = contract.result<int[]>(); //...and check: c

javascript - Simple authentication of REST get call with request interceptors of an Angular service -

i want pass in username , password combination needed make rest call api. controller.js var app = angular.module('myapp', []); //the service put interceptor configuration on (not on $http method calls) app.factory('getcallsapi', ['$http', function($http) { return { get: function(callback) { $http.get(/* rest uri */).success(function(data) { callback(data); }); } } }]); var interceptor = function($q) { return { request: function(config) { //todo: pass in username , password (hardcoded) through authentication }, requesterror: function(rejection) { }, response: function(config) { //todo: add cross origin headers }, responseerror: function(rejection) { } } } app.config(['$httpprovider', function($httpprovider) { $httpprovider.interceptors.push(interceptor); }]); myapp.controlle

java - Jackson custom serializer with conditionally hidden members produces invalid JSON -

i need create custom serializer conditionally skips fields. in contrast case described in skip objects conditionally when serializing jackson class contains pojo member. personalinfo has address member. in case address hidden resulting json still has "address" tag, without value. not figure out how fix this. creating custom serializer on objectmapper (see 3. @ http://www.baeldung.com/jackson-custom-serialization ) leads exact same result. here adapted code referenced question shows problem: public class jacksonhide { @jsonignoreproperties("hidden") public static interface ihideable { boolean ishidden(); } public static class address implements ihideable { public final string city; public final string street; public final boolean hidden; public address(string city, string street, boolean hidden) { this.city = city; this.street = street; this.hidden = hidden;