Posts

Showing posts from May, 2014

rx java - RxJava - add new Observable at top of the chain -

is possible add new observable on top of observable chain merged? or whenever create new observable , have build new observable ? assume have merged observable like val trackable1: publishsubject[jsonobject] = publishsubject.create() val flushable: publishsubject[jsonobject] = publishsubject.create() val merged = flushable .mergedwith(trackable) .map(json -> { if (storage.size > 50) // send http request }); val trackable2: publishsubject[jsonobject] = publishsubject.create() // add trackable2 event source trackable1 // without rebuilding `merged` observable. thanks.

<?php echo "HTML" ?> -

this question has answer here: double quotes within php script echo 5 answers i new php , have got issue dynamically loaded html-content. i've designed price label, want stored in 1 php-file, make changes apply every position on website: <?php $preisschild_a = "<div class="centered"><h3>komplett ab</h3></div><div class="preisschild redbg"><div class="preis">"; $preis_neo = "1.000,- €"; $preis_vision55 = "1.000,- €"; $preis_vision80 = "1.000,- €"; $preis_pult = "3.699,- €"; $preis_ultra = "1.000,- €"; $preis_beamcase = "1.000,- €"; $preisschild_b = "</div><div class="preis-subline">zzgl. mwst</div></div><div class="centered"><h3>infos und bestellung:</h3><

c++ - Include string in file on compilation -

i work on team project using teensy , matlab, , avoid version differences (e.g 1 person loads teensy version a, , person using matlab has version b of code), i'd send version string on pairing. however, want version string sit in shared file between matlab code , teensy, , every time program loaded teensy, have included on compilation constant. sort of like: const string version = "<included file content>"; the matlab on part can read @ runtime. i thought of using file contents assignment variable name shared both teensy , matlab, prefer more elegant solution if such exists, 1 doesn't include executing code external file @ runtime. one way have simple setup so: version.inc: "1.0.0rc1"; main.cpp: const string version = #include "version.inc" ... note newline between = , #include in place keep compiler happy. also, if don't want include semicolon in .inc file, can this: main.cpp: const string versi

How to get a sub-array from an existing array in C# without copying? -

my question similar getting sub-array existing array although little different notion important in case - can't use memory copying. let's have array x of 10000 elements, need array y contains 9000 elements x , starting x 's index 500. but don't want copy part of x new array y , don't want use array.copy, array.clone, system.block.copy, ienumerables etc. want y reference x - y[0] in fact x[500] , y[1] corresponds x[501] , ..., y[9000] x[9500] . thus, example changing value of x[100] @ same time change value of y[600] . how can achieve in c#? you wrap in object this: class view<t> { private t[] _array; private long _start; private long _length; public view(t[] array, long start, long length) { ... } public t this[long index] { { if (/*do bounds check here*/) { return _array[_start + index]; } } } } this won&

asp.net - SSIS package using excel source failing on IIS server -

i have simple ssis package has excel source dumping data in sql table. works fine in bids when run manually. works when called asp.net application on local. when same asp.net application deployed on iis server giving me following error: the acquireconnection method call connection manager "10.xxx.xx.xxx.<db>.<user>" failed error code 0xc0202009 note: run64bitruntime set false suggested in many posts similar issue. what issue? error log sql job running package: ssis error code dts_e_oledb_noprovider_error. requested ole db provider microsoft.ace.oledb.12.0 not registered. error code: 0x00000000. ole db record available. source: "microsoft ole db service components" hresult: 0x80040154 description: "class not registered". end error error: 2015-06-02 14:26:22.79 code: 0xc020801c source: data flow task excel source [1] description: ssis error code dts_e_cannotacquireconnectionfromconnectionmanager. acquireconnect

android - Make ontouchListener work when two buttons are pressed -

i have 2 buttons,btn1 , btn2. want play animation while 2 buttons kept in pressed state , animation stopped when either 1 of button gets unpressed or both of them action_up state (unpressed). here code: final animation animation = animationutils.loadanimation(this, r.anim.aim); animation.reset(); final imageview maxname = (imageview) findviewbyid(r.id.imageview1); button btn1 = (button)findviewbyid(r.id.button3); button btn2 = (button)findviewbyid(r.id.button2); btn1.setontouchlistener(new ontouchlistener() { @override public boolean ontouch(view v, motionevent event) { int action = event.getactionmasked(); if (action == motionevent.action_down) { maxname.startanimation(animation); } else if (action == motionevent.action_up || action == motionevent.action_cancel) { maxname.clearanimation(); } // todo

sql - how to compare value of new calculated column in postgresql -

i runnning query select case when "payment collection fee" = 0 round(("comm (incl. s.tax)" - ((("marketing fee" *16)/100)+"marketing fee"+0+"courier fee")),2) when "web sale price" < 0 round(("comm (incl. s.tax)" - ((("marketing fee" *16)/100)+"marketing fee"-20+"courier fee")),2) else round(("comm (incl. s.tax)" - ((("marketing fee" *16)/100)+"marketing fee"+20+"courier fee")),2) end diff meta.sd_payment_error now want add condition diff > 10 but giving error diff column not exist how can add condition above query ? you can use common table expression : with diffs ( select case when "payment collection fee" = 0 round(("comm (incl. s.tax)" - ((("marketing fee" *16)/100)+"marketing fee"+0+"courier fee")),2

arrays - Maximum sum of all subarrays of size k for each k=1..n -

given array of size n, for each k 1 n , find maximum sum of contiguous subarray of size k. this problem has obvious solution time complexity o(n 2 ) , o(1) space. lua code: array = {7, 1, 3, 1, 4, 5, 1, 3, 6} n = #array function maxarray(k) ksum = 0 = 1, k ksum = ksum + array[i] end max_ksum = ksum = k + 1, n add_index = sub_index = - k ksum = ksum + array[add_index] - array[sub_index] max_ksum = math.max(ksum, max_ksum) end return max_ksum end k = 1, n print(k, maxarray(k)) end is there algorithm lower time complexity? example, o(n log n) + additional memory. related topics: kadane's algorithm below process might you 1) pick first k elements , create self-balancing binary search tree (bst) of size k. 2) run loop = 0 n – k …..a) maximum element bst, , print it. …..b) search arr[i] in bst , delete bst. …..c) insert arr[i+k] bst. time complexity: time complexity of step 1 o

OOPS Concepts: What is the difference in passing object reference to interface and creating class object in C#? -

i have class, customernew , , interface, icustomer : public class customernew : icustomer { public void a() { messagebox.show("class method"); } void icustomer.a() { messagebox.show("interface method"); } public void b() { messagebox.show("class method"); } } public interface icustomer { void a(); } i confused between these 2 code of lines. icustomer objnew = new customernew(); customernew objcustomernew = new customernew(); objnew.b(); // why wrong? objcustomernew.b(); // correct because using object of class the first line of code means passing object reference of customernew class in objnew , correct? if yes, why can not access method b() of class interface objnew ? can explain these 2 in detail. actually interface type (you can't create instances of interfaces since they'are metadata). since customernew implements icustomer , instance of customernew c

javascript - Syncing Audio With Video -

i have little problem syncing audio track video, problem when seeking, when video not buffered, audio still play heres code var video_preview = document.getelementbyid("video-preview"); var song_preview = document.getelementbyid("song"); video_preview.onplay = function() { song_preview.currenttime = video_preview.currenttime; song_preview.play(); }; video_preview.onpause = function() { video_preview.pause(); song_preview.pause(); }; video_preview.onseeking = function() { song_preview.currenttime = video_preview.currenttime; song_preview.play(); };

java - Accessing emails from gmail using IMAP in Spring Boot -

i trying access emails gmail accounts through imap of javamail api. i able access inbox folder of both email accounts. want view not read message, , number of it, possible ? thank in advance. here code: // retrieve messages folder in array , print message[] messages = emailfolder.getmessages(); system.out.println("messages.length---" + messages.length); (int = 0, n = messages.length; < n; i++) { message message = messages[i]; system.out.println("---------------------------------"); system.out.println("email number " + (i + 1)); system.out.println("subject: " + message.getsubject()); system.out.println("from: " + message.getfrom()[0]); system.out.println("text: " + message.getcontent().tostring()); } the following line give unread messages count system.out.println("unread count - " + folder.getunreadmessagecount()); and following line give unread mes

c# - WCF mixing XML and JSON in one object -

i have object sent via wcf using datacontracts , xml. would possible receive json encoded element inside xml object using datacontract , related attributes? something like <xmlroot> <someelement>1</someelement> <cuckoojson>{"foo" : "bar" }</cuckoojson> </xmlroot> i know quite ugly , assume answer no wanted ask anyway. as codecaster commented, there seems no solution achieve via datacontract attributes without using json serializer.

c# - prevent static library from being initialized -

i have class need connect few other classes , libraries. 1 of these libs requires webcam. problem requirement done in static (i suspect constructor of static) , library in binairy form cannot edit it. if no webcam pressent don't want use library if present want use library. have tried far setting interface between 2 (like except lot more complete) interface caminterface { void dostuff();//executes lib function } class cam{ void dostuff(); } class main{ private caminterface; void start(){ if(haswebcam()) caminterface=new cam(); } } note 3 of these classes/interface in own files. did not work , variables kept on loading. a more full example this: namespace projection { using system.diagnostics.codeanalysis; using unityengine; /// <summary> /// marks marker used basis of level meta 1 /// </summary> public class baseforlevel : monobehaviour { private metamarkerinterface metamarker; p

python - Implementing API exception flask-restful -

i trying catch exception raised when url provided messy , wrong url , return error response json. did implement logic. the exception raised inside analysis class when key_id not valid key s3. def url_error(status_code, message, reason): response = jsonify({ 'status': status_code, 'message': message, 'reason': reason }) response.status_code = status_code return response class rowcolumncount(resource): def get(self, key_id): try: rc = analysis(key_id=key_id) except s3responseerror e: return url_error(e.status, e.message, e.reason) json_response = json.loads(rc.count_rows_columns()) return json_response the above code works fine kinda getting repetitive 50 different resource classes. each resource class should handle specific error. how make decorator, such code repetitiveness reduced. i using flask, flask-restful, python 3.4.3 there couple of

c++ - Building directed weighted graph and shortest path algorithm -

hey have graph in c++ described code. problem set in university. #include <iostream> using namespace std; const int n = 10; struct elem { char key; elem *next; } *g[n]; void init(elem *g[n]) { (int = 0; < n; i++) g[i] = null; } int search_node(char c, elem *g[n]) { (int = 0; < n; i++) if (g[i]) if (g[i]->key == c) return 1; return 0; } int search_arc(char from, char to, elem *g[n]) { if (search_node(from, g) && search_node(to, g)) { int = 0; while (g[i] == null || g[i]->key != from) i++; elem *p = g[i]; while (p->key != && p->next) if (p->key == to) return 1; } return 0; } void add_node(char c, elem *g[n]) { if (search_node(c, g)) cout << "node exists.\n"; int = 0; while (g[i] && (i < n)) i++; if (g[i] == null) { g[i] = new el

Ruby keyword as named hash parameter -

is possible access hash holding keyword arguments using new ruby 2.0 syntax? class list::node attr_accessor :data, :next def initialize data: nil, next: nil self.data = data self.next = next # error! end end old syntax works fine: class list::node attr_accessor :data, :next def initialize options = { data: nil, next: nil } self.data = options[:data] self.next = options[:next] end end ----- edit ----- i realize next reserved word i'm guessing keyword attributes stored internally in hash , i'm wondering whether it's possible access it, e.g. via self.args , self.parameters , self.options , etc. this work: class list::node attr_accessor :data, :next def initialize data: nil, _next: nil self.data = data self.next = _next end end next ruby reserved word. use names not ruby's reserved keyword. edit: yes, possible, not idea. class list::node attr_accessor :data, :next def initialize data: nil, next

ios - In swift, why true && false = 16? -

Image
this question has answer here: corrupted stack/heap under debugger when simulating? 1 answer i have seen swift spec, says the logical , operator ( a && b ) creates logical expressions both values must true overall expression true. if either value false, overall expression false. in fact, if first value false, second value won’t evaluated, because can’t possibly make overall expression equate true. known short-circuit evaluation. this example considers 2 bool values , allows access if both values true: let entereddoorcode = true let passedretinascan = false if entereddoorcode && passedretinascan { println("welcome!") } else { println("access denied") } // prints "access denied" it has nothing problem, bug ? you hit breakpoint before line evaluated (at least screenshot suggests so). go 1

unit testing - How to refactor tests in tdd? -

i'm performing tdd kata excercise: http://osherove.com/tdd-kata-1 i produced following code (points 1 5 in excercise - have unit tests it): public class stringcalculator { private readonly string[] _defaultseparators = { ",", "\n" }; public int add(string numbers) { // parser section (string list of ints) var separators = _defaultseparators; var isseparatordefinitionspecified = numbers.startswith("//"); if (isseparatordefinitionspecified) { var endofseparatordefinition = numbers.indexof('\n'); var separator = numbers.substring(2, endofseparatordefinition - 2); numbers = numbers.substring(endofseparatordefinition); separators = new[] { separator }; } var numbersarray = numbers.split(separators, stringsplitoptions.removeemptyentries); var numbersarrayasints = numbersarray.select(int.parse).toarray(); //

zshrc - Using ANSI escape sequences in zsh prompt -

i'm trying use ansi escape sequences set color of zsh prompt, escape character ( \e ) seems being escaped when displaying prompt. here's example of i'm running , output i'm getting: > autoload promptinit && promptinit > autoload colors && colors > echo "not sure if 2 lines required" > /dev/null > prompt="\e[32mhi> " \e[32mhi> echo "note escape character wasn't interpreted correctly" > /dev/null \e[32mhi> print -p "$prompt" hi> \e[32mhi> echo "the hi> printed in green, want" > /dev/null the zsh print documentation seems -p flag makes print if in prompt, doesn't match actual prompt behavior. know why escape character doesn't work? i tried using $fg_no_bold , , things $fg_no_bold[red] work, i'd use more 8 standard colors, $fg_no_bold[32] doesn't work (for number, not 32). if getting 256 colors working $fg_no_bold easier, i'd ok doi

javascript - nodejs: Error: Module version mismatch. Expected 13, got 11 at bindings.js -

i trying use netroute module in project. when test in test.js file , write node test.js works expected. when try load big project error: {"stack":"error: module version mismatch. expected 13, got 11.\n @ module.load (module.js:352:32)\n @ function.module._load (module.js:308:12)\n @ module.require (module.js:360:17)\n @ require (module.js:376:17)\n @ bindings (~/node_modules/netroute/node_modules/bindings/bindings.js:74:15)\n @ object.eval (~/node_modules/netroute/lib/netroute.js:3:19)\n @ module._compile (module.js:452:26)\n @ object.module._extensions..js (module.js:470:10)\n @ module.load (module.js:352:32)\n @ function.module._load (module.js:308:12)"} i tried running npm update, tried every possible release version of netroute , bindings.js, tried reinstalling modules no success. i have not updated nodejs, , have checked there 1 version of npm , nodejs in apt-cache. what can problem? why works standalone , don't w

objective c - How to Override NSScrollView's -tile When Using AutoLayout -

what i'm doing i have nsscrollview subclass. in it, override tile method drop contentview's frame height 1 can custom drawing of top border (as explained here: nsscrollview: fade in top-border messages.app ) - (void) tile { id contentview = [self contentview]; [super tile]; nsrect newrect = [contentview frame]; newrect.size.height -= 1.0f; newrect.origin.y += 1.0f; [contentview setframe:newrect]; } when autolayout enabled, message: layout still needs update after calling -[lpautoborderscrollview layout]. lpautoborderscrollview or 1 of superclasses may have overridden -layout without calling super. or, may have dirtied layout in middle of updating it. both programming errors in cocoa autolayout. former pretty arise if pre-cocoa autolayout class had method called layout, should fixed. and scrollview not scroll properly. attempting causes bit of flickering (as if clipview moving content , snapping back) the issue obviously, [supe

lotus domino - Convert Type "String" to type "Name" -

here problem: import lotus.domino.document; import lotus.domino.name; import lotus.domino.notesexception; import lotus.domino.session; import de.bcode.utils.utils; public class example { int x; name n = (name)x.tostring(); // want this. } i trying convert above , did "typecasting" , has been failing. thank reading question :-) the api documentation of ibm notes explains name object can obtained session. "to create new name object, use createname in session. " see this page session s = notesfactory.createsession(); name n = s.getusernameobject();

ruby on rails - assigning parent_id from an existing attribute -

i have database imported csv file , assign hierarchy based on assembly level below. not sure approach take. can write if statements long. sorry new this, , don't know begin. appreciated. assembly_level assembly_tree description uniq_id 0 0 level "zero level" d9s64 1 level 1 assembly "level one" c9633 2 level 2 assembly "level two" 11197 3 level 3 assembly "level three" e271f 4 level 4 assembly "level four" 552da 4 level 4 assembly "level four" 4568a 3 level 3 assembly "level three" b72bd how can assign assembly_level parent_id during import? @item = item.new(:assembly_level=> params[:parent_id]) assuming importing content csv file reading line line , little inf

vba - Macro from excel to individual word document -

i try make first mail merge macro don´t know how. can me? need generate individual document excel word document, save name of value in cell "a2" , close word. possible? the word template path is: c:\users\admin\desktop\new folder (2)\all1.docx excel file path is: c:\users\admin\desktop\new folder (2)\source.xlsm source mail merge sheet mailmerge if understand correctly, save worksheet ms word file? if yes, use saveas function in excel-vba. record macro save worksheet , viola, have code :) edit it..

asp.net - Redirect to login page after session timeout without postback -

in application can redirect user login page after 5 minutes of inactivity. happened after postback. wanted user redirect page after 5 minutes of inactivity without doing postback. long didn't click (e.g. sorting) after 5 minutes redirected. by way, i'm using update panel on pages. thank you. please help. you can use javascript detect inactivity. if you're using jquery, there's plugin called jquery.idle probably you'll need this. $(document).idle({ onidle: function(){ // todo: redirect logout page. }, onactive: function(){ // todo: maybe don't need it. }, idle: 300000 // 5 minutes onindle function called. }) you need register script update panel using scriptmanager.registerclientscriptblock or scriptmanager.registerstartupscript. somehting this .

java - Why my editor doesnt work with theme of my web page? -

why editor not work bootstrap style website (editor destroys web page theme). think there problem in bootstrap.min.css in different folders, have 1 editor , other web page. code this. <%@page import="unimb.praktikum.baza"%> <%@page import="java.util.arraylist"%> <%@ page language="java" contenttype="text/html; charset=utf-8" pageencoding="utf-8"%> <!doctype html> <html> <head> <!-- editor --> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="editor/lib/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" type="text/css" href="editor/lib/cs

xml - Removing navigation buttons for SCO package -

the lms automatically displays prev, next , close buttons. can hide these buttons , here tells it. didn't find example of how do. approach handle this? edit: ... other source indicates pieces job. adding these bits manifest file; <sequencing> <controlmode choice="false" choiceexit="false" flow="true" /> </sequencing> will solve problem. i posted answer did not go well. seems choice property lms still show these. flash content goes , forward , not want display buttons. how can hide nav buttons? try out on item after title. <adlnav:presentation> <adlnav:navigationinterface> <adlnav:hidelmsui>continue</adlnav:hidelmsui> <adlnav:hidelmsui>previous</adlnav:hidelmsui> </adlnav:navigationinterface> </adlnav:presentation>

ios - How to pass a value from a delegate to another one in swift? -

i want pass url in documentpicker previewcontroller. since of them delegates, can't return because violate protocol. how pass data view view? thanks! func previewcontroller(controller: qlpreviewcontroller!, previewitematindex index: int) -> qlpreviewitem! { //var doc = nsurl(fileurlwithpath: url) return doc } func documentpicker(controller: uidocumentpickerviewcontroller, didpickdocumentaturl url: nsurl) { println("\(url)") var quickview = qlpreviewcontroller() quickview.datasource = self presentviewcontroller(quickview, animated: true, completion: nil) } ~~~~~~~~~~~update~~~~~~~~~6.2~~~~~~~~~~~~~~ follow idea of answer follow func documentpicker(controller: uidocumentpickerviewcontroller, didpickdocumentaturl url: nsurl) { println("\(url)") var a: string = "\(url)" nsuserdefaults.standarduserdefaults().setobject(a, forkey: "url") var quickview = qlpreviewcontroller() quickview.dat

angularjs - Trying Session management at Client side -

i made little application using angularjs , nodejs. application running fine problem encountering whenever refresh page, current user automatically logs out , authentication process has repeated again. how correct ? want user must logout when clicking on logout , not whenever refreshing page.below code using. kindly help... index.html <html> <head> <title>chirp</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular-route.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular-resource.js"></script> <script src="javascripts/chirpapp.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"

javascript - Cursor is not place at end of custom element -

p code { padding: 1px 5px 1px 5px; } code { white-space: pre-wrap; padding: 1px 5px; font-family: consolas, menlo, monaco, lucida console, liberation mono, dejavu sans mono, bitstream vera sans mono, courier new, monospace, sans-serif; background-color: #eee; } <div class="" contenteditable="true" spellcheck="false" style="height: 350px;"><p>efiwefwpei&nbsp;<code>fowef</code>&nbsp;wefwefwefwefweff</p></div> why cursor not place @ ending of code element when want continuos typing i want typing @ beginning of code element, can't it how fix (in way of user experience , code element that)

python - Using urllib2 to fetch internet resources, get http 402 error -

i tried use urllib2 fetch zip file subtitle website. the example website http://sub.makedie.me , tried download file http://sub.makedie.me/download/601943/game%20of%20thrones%20-%2005x08%20-%20hardhome.killers.english.hi.c.orig.addic7ed.com.zip i tested in script , print url. url fine. copied , pasted in web browser , download successfully. at first, script looked this: try: f = urllib2.urlopen(example_url) f.read() something... except urlerror, e: print e.code but got 403 error code. after searching, tried change header {'user-agent': 'mozilla/5.0'}. code changed to: try: req = urllib2.request(example_url,headers={'user-agent': 'mozilla/5.0'}) f = urllib2.urlopen(req) something... except urlerror, e: print e.code then got 402 error. wondering because of website setting or because error in code? i try with: urllib.urlretrieve(url, outname) as t

c++ - How may I remove "1.#QNAN" and "INF" error in gradient (float type) with image in case of inf or 0? -

in code extract text image (stroke width transform), using gradients @ specific pixels. in following code: gradientx , gradienty mat images. g_x , g_y gradients @ (row, col) pixel. getting error because g_x , g_y becoming out of bounds (1.#qnan 1.inf) in many cases. in cases, both become such mag becomes inf or 1.#qnan . please suggest change code such problem can mitigated? normalize them 1 in case of inf , make changes similarly. float g_x = gradientx.ptr<float>(row)[col]; float g_y = gradienty.ptr<float>(row)[col]; // normalize gradient double mag = sqrt( (g_x * g_x) + (g_y * g_y) ); if (dark_on_light){ g_x = -g_x/mag; g_y = -g_y/mag; } else { g_x = g_x/mag; g_y = g_y/mag; }

maven - Error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher -

i have installed latest maven-3.2.5 on linux mint throgh cli installation details follows: export java_home=/usr/lib/jvm/java-7-openjdk-amd64/ export m2_home=/home/mani/apache-maven-3.2.5/bin/ in command shows this: mani@manithullimilli ~/apache-maven-3.2.5/bin $ ./mvn version error: not find or load main class org.codehaus.plexus.classworlds.launcher.launcher mani@manithullimilli ~/apache-maven-3.2.5/bin $ i have setted path you mentioned m2_home environment variable incorrectly.m2_home environment variable should " /home/mani/apache-maven-3.2.5 " export m2_home=/home/mani/apache-maven-3.2.5 and add $m2_home/bin directory path.

r - Getting glmnet coefficients at 'best' lambda -

Image
i using following code glmnet: > library(glmnet) > fit = glmnet(as.matrix(mtcars[-1]), mtcars[,1]) > plot(fit, xvar='lambda') however, want print out coefficients @ best lambda, done in ridge regression. see following structure of fit: > str(fit) list of 12 $ a0 : named num [1:79] 20.1 21.6 23.2 24.7 26 ... ..- attr(*, "names")= chr [1:79] "s0" "s1" "s2" "s3" ... $ beta :formal class 'dgcmatrix' [package "matrix"] 6 slots .. ..@ : int [1:561] 0 4 0 4 0 4 0 4 0 4 ... .. ..@ p : int [1:80] 0 0 2 4 6 8 10 12 14 16 ... .. ..@ dim : int [1:2] 10 79 .. ..@ dimnames:list of 2 .. .. ..$ : chr [1:10] "cyl" "disp" "hp" "drat" ... .. .. ..$ : chr [1:79] "s0" "s1" "s2" "s3" ... .. ..@ x : num [1:561] -0.0119 -0.4578 -0.1448 -0.7006 -0.2659 ... .. ..@ factors : list() $

android - SSLException due uploading item for Amazon service -

i upload file aws service android. configured this: awsmetadata awsmetadata = resultdata.getparcelable(params.commandmessage.extra_message); awscredentials awscredentials = new basicawscredentials( awsmetadata.getaccountid(), awsmetadata.getsecretkey() ); // set region transfermanager transfermanager = new transfermanager(awscredentials); region region = region.getregion(regions.fromname(awsmetadata.getregionendpoint())); transfermanager.getamazons3client().setregion(region); final mediaitem mediaitem = datasource.get(0); log.d(app.tag, "file exists: " + mediaitem.getcontenturi() + " " + new file(mediaitem.getcontenturi()).exists()); // prepare file upload putobjectrequest putobjectrequest = new putobjectrequest( awsmetadata.getbucketname(), awsmetadata.getsecretkey(),

ios - How to get CAShapeLayer to work with constraints with swift? -

i got in viewdidload rectshape1 = cashapelayer() rectshape1.fillcolor = uicolor.bluecolor().cgcolor rectshape1.path = uibezierpath(roundedrect: rectshape1.bounds, byroundingcorners: .bottomleft | .topright, cornerradii: cgsize(width: 20, height: 20)).cgpath redview.layer.addsublayer(rectshape1) var consttop = nslayoutconstraint(item: redview, attribute: nslayoutattribute.centerx, relatedby: nslayoutrelation.equal, toitem: view, attribute: nslayoutattribute.centerx, multiplier: 1, constant: 0) view.addconstraint(consttop) var consth = nslayoutconstraint(item: redview, attribute: nslayoutattribute.height, relatedby: nslayoutrelation.equal, toitem: nil, attribute: nslayoutattribute.notanattribute, multiplier: 1, constant: 50) redview.addconstraint(consth) var constw = nslayoutconstraint(item: redview, attribute: nslayoutattribute.width, relatedby: nslayoutrelation.equal, toitem: nil, attribute: nslayoutattribute.notanattribute, multiplier: 1, constant: 50) redview.addconstrai

android - Eclipse: please check aapt is present at "..\sdk\build-tools\23.0.0_rc1\aapt.exe" -

recently, upgraded android-sdk android m (api 22, mnc preview) . after this, every project reported errors when eclipse opened. the error said: "error executing aapt. please check aapt present @ ..\sdk\build-tools\23.0.0_rc1\aapt.exe" . after checking *.exe file, found "aapt.exe" of 23.0.0_rc1 @ ..\23.0.0_rc1\bin\aapt.exe not of 22.0.1 @ ..\22.0.1\aapt.exe . so, location of aapt.exe changed, eclipse can't realize that. so, did android on purpose or carelessly? how solve problem in case of no changing original file structure? i use eclipse android studio. so, want make sure android sdk ok first, eclipse, don't change structure of sdk any tips appreciated. in advance. p.s.: my os windows 7 , mac os x ; the version of adt plugin eclipse 23.0.6 , date now; also, there error reported popup window when eclipse starts: error: error parsing ...\sdk\system-images\android-22\android-wear\armeabi-v7a\devices.xml cvc-complex-type.2.4.d: fo

python - Break bytes object into n equally sized blocks based on index -

i'm working on writing script break repeating-key xor (vigenère) cipher. this involves determining number (0 < n < maybe 50) splitting bytes object n smaller blocks, first block contains (from original object) indexes n, 2n, 3n, next 1 contains n+1, 2n+1, 3n+1... n+y, 2n+y, 3n+y y < n. if n = 3, bytes [0, 2, 5, 8 etc] should in 1 block, bytes [1,3,6,9] in next block, , bytes [2,4,7,10] in final block. i implement strings, don't know how make work bytes objects. searched , found , adapted code: blocks = [ciphertext[i:i+most_likely_keylength] in range(0, len(ciphertext)+1, most_likely_keylength)] transposedblocks = list(zip_longest(*blocks, fillvalue=0)) ##ciphertext bytes object resulting following line: ##ciphertext = base64.b64decode(open('q6.txt', 'r').read()) this returns list of tuples filled integers, , don't know how 'join' integers again they'll long binary objects before. (so can run nice crypto.util.strxor_c on e

machine learning - Finding Gaussian Probabilities from predefined clusters -

i given set of defined clusters , vectors belong in these clusters. wish find gaussian probabilities every point wrt each defined cluster. best way find density functions of defined clusters or gaussian mixture parameters each cluster? parameters of density functions computed through em algorithm given clusters , points. if have clusters, let mean , variance of each density function mean , variance of points in each cluster, , let mixing weight (number of points in cluster)/(total number of points).

excel - If C6/2 is less than .5, then E6 will be .5 otherwise the answer is C6/2 -

i have formula answer following: if c6/2 less .5, e6 .5 otherwise answer c6/2. i go equivalent (but smaller) statement =if(c6<1,.5,c6/2) what you're doing has name it's called max function. =max(c6/2,.5) produce same result easier read.

swift - Instance ID in iOS? -

which library should integrated in project in order use instance id api in ios/swift app? this page instance id api shows how implement such api, gives no indication of library import.... i think you're supposed use cocoapods install it. https://cocoapods.org/pods/gglinstanceid

Connecting to Oracle database from Python -

trying connect oracle database python using cx-oracle. followed steps mentioned in link: https://gist.github.com/thom-nic/6011715 i running python 2.7.8. on yosemite(10.10.2).after unzip instant client path on machine: /users/ayada/library/share/oracle set oracle_home , have set both dyld_library_path, ld_library_path oracle_home. use pip(env archflags="-arch $arch" pip install cx_oracle) install cx_oracle encountering following error: distutils.errors.distutilssetuperror: oracle home (/users/ayada/library/share/oracle) not refer 9i, 10g, 11g or 12c installation. cleaning up... command python setup.py egg_info failed error code 1 in /private/var/folders/22/78xh65wd3xq232p4zd18l8800013hw/t/pip_build_ayada/cx-oracle storing debug log failure in /users/ayada/.pip/pip.log to give context, don't have oracle database installed on machine trying connect remote server. i relatively newbie working on mac , doing these kind of setups. please advice. have done

javascript - Why does this code need a second if statement? -

i'm trying understand why 1 version of code works , 1 not. hope i've included enough information. i'm taking online tutorial no longer supported. in tutorial, instructions write code this: $(document).ready(function(){ $("form").submit(function() { var input = $("#command_line").val(); console.log(input) console.log("submit") if (input === "help") { $("#message_help").clone().insertbefore("placeholder").fadein(1000); } }); $("#command_line").val(""); }); there no error messages in console, expected happen in browser doesn't execute. in working code, there if statement above original: $(document).ready(function(){ $("form").submit(function() { var input = $("#command_line").val(); console.log(input); if (input.indexof("help") > -1) { if (input == "help") { $("

dependency injection - SAS Base Dataset as email body output -

i have 2 large sas datasets 65000 id's. want send 1 email ',' delimiter. sasdatasetname.id_processed id 1 2 3 . . 65000 sasdatasetname.id_not_processed id b output in 1 email body needs number of id's processed=65000 1,2,3,4.. . . 65000 number of id's not processed=2 a,b data b; length one_char $ 1; i=1 100000; one_char=byte(int(25*ranuni(0)+65)); *** return uppercase character; output; end; run; data b; length one_char $ 1; i=1 100000; one_char=byte(int(25*ranuni(0)+65)); *** give me uppercase character; output; end; run; data c; length one_char $ 1; i=1 100000; one_char=byte(int(25*ranuni(0)+65)); *** give me uppercase character; output; end; run; /*** assuming have smtp server available , sas configured use */ filename mymail email "your.name@somesite.com" subject="whatever you'd put in subject line"; data _null_; length concatenated $ 32676; retain _linelength 200; file mymail; if _n_ = 1

Browsing csv file and then import it on android sqlite -

im new android. im still need learn lot of things. know might report duplicate guess different. want select files first import on android sqlite. have code can select files , works properly, after selected file goes selected file : "/path/file.csv" that. i've seen code import csv file files stored assets folder of project. want select file , execute import saved on database. please help. i figured out doing wrong. way import .csv file sqlite in android if example different, should provide more details/code highlighting differences.

mysql query getting current date -

i have mysql query gets , display data within current month. this condition used where month(date) = month(now()) but doesn't seem work because june 1 in country code getting data may. problem this?

html - from an input field to an output div- javascript -

<script> function func() { document.getelementbyid("demo").innerhtml = document.getelementbyid("demo").innerhtml + "drew"; } </script> with code of mine intended add word "drew" @ end of whole text in <div> id="demo" on button click appeared before <div> in html code. desired output showed fraction of second , again value in <div> restored before function call. have got no clue how solve issue, yet, guess happened because div appears again in code, after button clicked, , changes value initial one.so seek here. this works fine. may need call way. check if using right way? function func() { document.getelementbyid("demo").innerhtml = document.getelementbyid("demo").innerhtml + "drew"; } <div id="demo">you </div> <button onclick="func()">check</button>

Why when I import CSV file into MySQL rows are cut off after keywords? -

i trying import csv file following sample row: //,/dona paula estate malbec/,/malbec argentina, south america/, into mysql database, after "from" skipped in table. think because sql keyword. enclosing fields '/' not help. can me this? appresiate it! table wine (wineid, winename, winedescription); wineid primary key (autonmber). my sql statement is: load data local infile 'wines.csv' table wines fields terminated ',' enclosed '/' lines terminated '\r\n' ignore 1 lines (wineid, winename, winedescription);

python - Raise an exception with traceback starting from caller -

i'm trying make automated test framework side-project , use creating assertion checks. running in python... assert(false) gives this... traceback (most recent call last): file "test.py", line 1, in <module> assert(false) assertionerror as can see traceback lowest level assert(false) . made custom assert prints when assert succeeds. def custom_assert(condition): if condition: print("yay! werks!") else: raise exception("nay, don't werks...") custom_assert(false) but instead of assert gives, custom_assert gives me this. traceback (most recent call last): file "test.py", line 14, in <module> custom_assert(false) file "test.py", line 12, in custom_assert raise exception("nay, don't werks...") exception: nay, don't werks... which of course default behavior. useful 99.9999% of time, 1 time improved. it's not useful know method called ra

xcode - What is the difference between "Multiple" and "Single" for View Controller Presentation? -

Image
i've been working on os x app in xcode. option perplexes me "presentation", 2 options "single" , "multiple" attribute do? so, "obvious" once used it. basically, feature causes window displayed once, or multiple times if corresponding segue in storyboard has been triggered multiple times. to see in action, add create storyboard view controller in it. place button on view, , additional window controller. create segue between button , window controller "show" window controller. click on window controller , toggle between 2 presentation options. when run it, find 1 case create multiple instances of window, while other create single instance of window. like said, obvious, had use figure out.

Android default printscreen override -

hi totaly new in creating android app. installed android studio. on phone (nexus 5) , when press power button , volume, printscreen made. possible override action ? make printscreen add postprocessing of ? is possible override action ? no, sorry. like make printscreen add postprocessing of ? on android 5.0 , higher, you can take own screenshot (with user permission), post-process that, if like.

ios - Parse Log In <Use of unresolved identifier 'PFLogInFieldsUsernameAndPassword'> -

i've been having 1 huge issue tying entire app because keeps killing builds. bridging header below: #import <parse/parse.h> #import <parseui/parseui.h> #import <bolts/bolts.h> frameworks have been downloaded properly. in view controller tried: self.loginviewcontroller.fields = pfloginfieldsusernameandpassword.value | pfloginfieldsloginbutton.value | pfloginfieldssignupbutton.value | pfloginfieldspasswordforgotten.value | pfloginfieldsdismissbutton.value to create custom login page. however, met error use of unresolved identifier 'all fields'. tried: loginviewcontroller.fields = pfloginfields( pfloginfieldsusernameandpassword.value | pfloginfieldsloginbutton.value | pfloginfieldssignupbutton.value | pfloginfieldsfacebook.value | pfloginfieldstwitter.value | pfloginfieldspasswordforgotten.value ) per advice of https://www.parse.com/questions/parse-swift-error-with-login-view-controller-fields didn't work. please help. thanks,

python - How to verify dynamic element present in Selenium WebDriver -

i'm writing scripts in python using selenium webdriver test web application. the web application allows users ask questions, added div asked. each question div has own "upvote" , "downvote" link/image. image changes when "upvote" icon clicked, active inactive, or vice versa. know xpath upvote icon is: "//div[@id='recent-questions-container']/div/div/div/div/div[2]/div/ul/li/a/i" this "i" @ end of path class, , either <i class="fa fa-2x fa-thumbs-o-up"></i> or <i class="fa fa-2x fa-thumbs-up clicked"></i> depending on whether or not clicked. want verify correct image in place upon being clicked. how can that? ideally, i'd perform verification using assertions, la: self.asserttrue(self.is_element_present( ... )) here html i'm talking about <div id="recent-questions-container"> <div question_id="randomly generated blah"