Posts

Showing posts from February, 2012

vb.net - Using VB as automation, I want to tick the PowerPoint option box "Do not compress images in file" -

i'm adding feature program copies file surfer , pastes powerpoint slide. surfer image large, , need have small portion of surfer file visible in framing of powerpoint slide. the problem i'm having when open powerpoint, default have copied , pasted images compressed. whatever showing in powerpoint slide blurry because of compression. when without automation , turn off image compression, looks perfect. please note program not me, it's distributed others within company, can't expect other people want use program change default settings. want figure out how turn off compression. here's have far: 'opens surfer objsurferapp = createobject("surfer.application") 'open powerpoint objpptapp = createobject("powerpoint.application") objpptmapseries = objpptapp.presentations.add 'copies image surfer objsurfermap.shapes.selectall() objsurfermap.selection.copy()

c - Using cuda thrust::max_element to find max element in array returns incorrect sometimes -

i have 2^20 element array being filled on device; these numbers should same every time. move array on host , search max element in array, technique works 2^10 element array once begin larger begin random answers not sure if thrust messing or device calculations. the answer max_element should return 0.094479 first time program run code output correct answer answer randomly show every few times gpu tesla k20 running 5.0 tested on 780gtx; same issue both times //host code int main( void ) { float h_c[total]; float *d_c; cudamalloc((void**)&d_c, sizeof(float)*total); cudaevent_t start, stop; cudaeventcreate(&start); cudaeventcreate(&stop); cudaeventrecord(start); //number of threads kernel<<<blocks,threads>>>(d_c); cudaeventrecord(stop); cudaeventsynchronize(stop); float mil = 0; cudaeventelapsedtime(&mil, start, stop); cudamemcpy(h_c, d_c, sizeof(float)*total, cudamemcpydevicetohost); for(int y = 0; y < total; y++){ printf(&qu

java - Permutations of 4 integers in an array? -

i have write code takes input of 4 integers between 1 , 9 scanner object , combines them in way equal 24. although solution not elegant have managed compile number of if statements using variables, b, c, d , hoping store numbers entered user in array , swap values of a, b, c, d generate each possible combination of numbers for example 1 paring might (a+b*c) - d = 24. i'd want switch values of a, b, c, d possible combinations , life of me can't figure out how this. have public static void dagame(int a, int b, int c, int d) { int[] basearray = {a, b, c, d}; int [] keyarray = basearray.clone(); if(a > 9 || b > 9 || c > 9 || d > 9 || == 0 || b == 0 || c == 0 || d == 0){ system.out.println("you entered number greater 9 or enterered 0:"); main(null); system.exit(0); } for(int = 0; < 2; i++){ for(int j = 0; j < basearray.length; j++){ if(i == 1){ basearray = keyarray.clon

python - How to stream CSV from Flask via sqlalchemy query? -

i'd stream csv flask using technique they describe here : from flask import response @app.route('/large.csv') def generate_large_csv(): def generate(): row in iter_all_rows(): yield ','.join(row) + '\n' return response(generate(), mimetype='text/csv') i have query sqlalchemy returns list of purchase objects. i'd write csv, ideally customization on attributes output file. unfortunately, i'm getting blank csv output currently: @app.route('/sales_export.csv') @login_required def sales_export(): """ export csv of sales data """ def generate(): count = 0 fieldnames = [ 'uuid', 'recipient_name', 'recipient_email', 'shipping_street_address_1', 'shipping_street_address_2', 'shipping_city', 'shipping_state',

visual studio - Expanding media capabilities of Win Embedded CE 6.0 -

i have embedded device wince 6.0 os. manufacturer provides ide 3rd party development it. ide pretty allows nothing else than .net 3.5 compact framework scripting that's invoked various events main application adding files device. the included mediaplayer seems using directshow , os has media codec mpeg-1 encoded video playback. my goal to able play media encoded other codecs well inside main application. i've managed use directshownetcf (directshow wrapper .net compact framework) , playback mpeg-1 encoded video. i'm totally new stuff , have tons of (stupid) questions. i'll try narrow them down: the os based on wince, far i've understood, it's customized version of (via platform builder). "correct way" of developing afterwards use sdk manufacturer provides. right? in case, sdk extremely limited , tightly integrated ide noted above. however, .net cf 3.5 capable interop possible call native libraries -as long compiled correct platform.

c# - Convert Image to Bytes and save in Xml -

i need convert byte [] of image format can saved in xml. tried convert string not worked. xml file after 5 images saved size of 50mb! need convert simpler format xml file can not heavy. consider using base64 format - lose efficiency data encapsulated. example <image name="myphoto.jpg">wfuiglzigrpc3rpbmd1axnozwqsig5vdcbvbm</image> you can convert base64 using convert.tobase64

c# - Why should I use glTranslate? -

what's purpose of pushing/popping matrix translate shape when can sort of position math myself? can understand using said aforementioned matrices more difficult operations (rotation example), why translating specifically? public void render() { positionx++; gl.pushmatrix(); gl.translate(positionx, positiony, 0); gl.matrixmode(matrixmode.modelview); gl.loadidentity(); gl.begin(primitivetype.quads); gl.vertex2(0, 0); gl.vertex2(0 + widthx, 0); gl.vertex2(0 + widthx, 0 + widthy); gl.vertex2(0, 0 + widthy); gl.popmatrix(); gl.end(); } versus public void render() { positionx++; gl.matrixmode(matrixmode.modelview); gl.loadidentity(); gl.begin(primitivetype.quads); gl.vertex2(positionx, positiony); gl.vertex2(positionx + widthx, positi

Catching ValueError: unknown url type: urllib2 Python -

i'm getting following exception when enter invalid url: valueerror: unknown url type: blob i'm trying catch error following code it's not working: try: req = urllib2.request(url) conn = urllib2.urlopen(req) content = conn.read() except urllib2.urlerror, e: print 'error: invalid url' if notice, base error valueerror , so import urllib2 url = 'blob' try: req = urllib2.request(url) conn = urllib2.urlopen(req) content = conn.read() except valueerror, e: print 'error: invalid url'

javascript - How can I use a cookie? What's wrong? -

i want make code saving cookies. <script> var user_name; var expires = new date(); if((document.cookie=="")==false){ var lenght = document.cookie.lenght-1; var message=document.cookie.sbstr(5,lenght); document.write(document.cookie); } function check(){ user_name=document.getelementbyid("name").value; expires.setfullyear(expires.getfullyear()+1); document.cookie=escape("name")+"="+escape(user_name) + "; expires = " + expires.togmtstring(); alert(document.cookie); } </script> name: <input type="text" id="name" /> <input type="button" value="enter" onclick="check()" /> but problem on expires. when execute it, show message on alert: name=lucas; __utma=1.1375427537.1415045152.1415051179.1415230828.3; __utmz=1.1415045152.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); vtexrcmacidv7=1f3e4180-6545-11e4-92a5-dd43cc28da42; _ga=ga1.1.1375427537.1415045152

Android detect position of ViewGroup Child -

so have 2 related questions on viewgroups : is linearlayout , instance of viewgroup ? meaning, can call getchildat(index) when using linearlayout ? can detect when viewgroup child @ "top" of screen (right below action bar) after scrolling? example, when 3rd child scrolled top i'm working on app utilizes parallax scrolling , i'm using open source library has custom view linearlayout child , 4 textviews linearlayouts children. in custom view class calling getchildat can't seem find documentation on related linearlayouts wanted check. , want check if 1 of these textviews @ top of screen. clairfication appreciated question 1 { is linearlayout , instance of viewgroup? meaning, can call getchildat(index) when using linearlayout? } answer = yes... a viewgroup special view can contain other views (called children.) view group base class layouts , views containers .. linear layout view because extends view, , if contains other sub view

Ionic Framework: GridLayout with multiple rows and column on which buttons placed for an arrayItem -

on page, using ng-repeat, try place buttons on grid layout. iterating through array defined in controller $scope.btnnames[]. buttons place on total number of buttons equal array size of $scope.btnnames[] i put 4 buttons per row. $scope.btnnames[] size 20, place 20 buttons on 5 rows, each row have 4 buttons. 1) on controller : - have array button names $scope.btnnames['aa', 'bb', 'cc','dd', 'ee', 'ff'....] size 20. 2) on page: - using ng-repeat, iterate throught the $scope.btnnames[] , put buttons per follwoing code <body ng-controller="popupctrl"> <div class="row responsive-sm"> <div ng-repeat="btnname in btnnames"> <button id={{$index}} class="button button-dark col" >{{btnname}}</button> </div> </div> please me defining class="row" , class="col" , such way that, during ng-repate, after 4th

templates - C++: Deleting a node in the middle of a singly linked list? -

here code: template<class l> node<l>* linkedlist<l>::deletenode(l todelete) { node<l>* current; node<l>* trail; if(head == null) { cout << "\n\ncannot delete empty list.\n\n"; } else { if(head->next == null) { if(head->data == todelete) { current = head; delete current; head = current; tail = current; cout << "\nobject found. list empty.\n"; } else { cout << "\nobject not found.\n"; } } else { current = head; while(current->data != todelete && current->next != null) { t

javascript - if I rotate the cylinder in x, then y and then z in different theta. What will be the height in y axis for the final cylinder? -

i new three.js , in three.js when created cylinder parallel y axis default, give height in y axis value a. and if rotate cylinder in x, y , z in different theta. height in y axis final cylinder (like code below)? i tried cannot find answer. answers. :) cylinder.rotation.x = theta1; cylinder.rotation.y = theta2; cylinder.rotation.z = theta3; you ask question on mathematics stack exchange, or execute following code (plug in x, y, , z values). in example, our cylinder 1.0 height along positive y axis: var x = 0.0; var y = 1.0; var z = 0.0; var e = new three.euler(theta1, theta2, theta3); var p = new three.vector3(x, y, z); p.applyeuler(e); console.log(e);

c# - What could cause slowness when calling methods from a separate app domain? -

i setup appdomain ironpython run in: var appdomainsetup = new appdomainsetup { applicationbase = sandboxpath }; var sandbox = appdomain.createdomain("sandbox", evidence, appdomainsetup, permissionset); when sandboxpath set exe directory, calls made scripts "fast." when sandboxpath set folder containing necessary dlls (basically classes scripts call , relevant ironpython dlls) scripts' calls "slow." important note these calls crossing main appdomain sandbox appdomain. issue brought number of questions due lack of understanding of how ironpython works , searching has led me in few circles. my main question how , when ironpython load assemblies , how having using separate directory base decrease performance? : do assemblies loaded on appdomain construction? can read how appdomain goes loading assemblies , assembly loader? this article mentions setting applicationbase property determines "where assembly loader begins probing assemblies

javascript - How do I get the properties and destination values of a running Jquery animation? -

given element $myelement actively being animated, how can determine properties affected animation, , final destination, without interfering running animation? example: $myelement.css('height','200px').slidedown(2000); $myelement.getanimationproperties(); // return `{'height':'200px'}` obviously, call getanimationproperties() in different scope code starts animation (mutation observer). allow second autonomous plugin needs know final animation property value (like height) work properly, without interfering original plug-in.

Fiddler JSON plugin (other than JSON Viewer) -

does have recommendations offline json viewer fiddler2 plugin aside example talk below? i enjoy ability of json viewer's ability act plugin fiddler 2, have run problems program don't like. example, can't handle unexpected ends this online viewer can. additionally, while it's "copy value" function allows me convert object polluted escape characters readable json, seems take far long. example of might encounter: {"args":"[[{\"method\":\"someservermethod\",\"request\":\"{\\\"somestufftorequest\\\",[],[],{\\\"somepropertiesofstuff\\\":{\\\"exampleitem\\\":\\\"examplevalue\\\"}},[{\\\"moreproperties\\\":\\\"objectname\\\",\\\"property\\\":value}]]\"}]]","id":"someidvalue","method":"otherstuff"} you can try jsoneditor inspector: http://jsoneditor.codeplex.com/

javascript - AJAX pagination refreshes page every other link -

in rails app i'm using will_paginate , partials make can click through pages of list without page refreshing. js use call partials , all: $(function () { $('.pagination a').on("click", function () { $.get(this.href, null, null, 'script'); return false; }); }); for reason, however, works fine when click link first time; replaces partial updated one. after that, click next pagination anchor link , page full refresh. idea why? thinking js executes when dom loaded , when partial replaced 1 containing new links aren't wired code. if correct, how go fixing it? looks might have use event delegation... pagination ajax request might replacing .pagination a elements also, means newly created elements not have click handler registered. so try $(function () { $(document).on("click", '.pagination a', function () { $.get(this.href, null, null, 'script'); ret

Java Compilation Error with Method overloading -

what best way achieve testcall2 below without doing explicit parsing (sub1) in ? class super { } class sub1 extends super { } class sub2 extends super { } public void testcall2(super in) { testcall(in); // <~~~ compilation error } public void testcall(sub1 sub) { } public void testcall(sub2 sub) { } you'd have refactor , use polymorphism. declare testcall method in super class super { public void testcall() {} } and implement in subclasses. then invoke it public void testcall2(super in) { in.testcall(); } otherwise you'll have use cast transform value's type type expected either of methods.

excel vba - Evaluate Corresponding Elements in Two Arrays and Increment Counter if Conditions Are Met -

in vba setting array1 equal range in worksheet. passing different array2 worksheet vba. want simultaneously iterate through elements in arrays , check if 2 conditions simultaneously met: array1 contains string "sat pad" , array2 contains blank. if conditions met, increment counter , return value function call. note below array2 same size array1. example, array2 range u5:u28. here failed code: function countsatpads(byref array2() range) integer dim integer, count integer dim array1() count = 0 array1 = sheets("summary").range("b5:b28") = lbound(array1) ubound(array1) if array1(i) = "sat pad" , array2(i) <> "" count = count + 1 end if next countsatpads = count end function

c# - How can I solve this System.ComponentModel.Win32Exception in panel? -

i have panel loads 257 user control. when reached 191 return system.componentmodel.win32exception. i've red many articles solving exception. i've used gc.collect() inside , after loop release memory because everytime loop executed, memory consumption increased. have tried .dispose before , after loop none of them worked. my code written in c#. one user control loads 36 controls , program needed load more 191 user controls. have run process explorer or windows task manager @ gdi objects, handles, threads , user objects ? if not, select columns viewed (task manager choose view->select columns... run app , take @ columns app , see if 1 of growing large. the windows handle limit application 10,000 handles. it might you've got ui components think cleaned haven't been disposed . probably program creating many handles. you'll need find memory leak using memory profile r. use ants memory profiler. also, make sure you're calling dispose method o

html - How do I calculate the width of each element as a percentage if the elements have margins? -

in example below, how calculate width percentage each of li elements fit on 1 line? understand it's not 25% since have account new margins, set to? html ( jsfiddle ) * { margin: 0; padding: 0; } div { width: 100%; } li { display: inline-block; float: left; list-style: none; margin-right: 1.25em; width: 25%; } li:last-child { margin-right: 0; } img { width: 100px; } <div> <ul> <li><img src="http://static.comicvine.com/uploads/original/2/29462/582674-kenny.png" /></li> <li><img src="http://static.comicvine.com/uploads/original/2/29462/582674-kenny.png" /></li> <li><img src="http://static.comicvine.com/uploads/original/2/29462/582674-kenny.png" /></li> <li><img src="http://static.comicvine.com/uploads/original/2/29462/582674-kenny.png" /></li> </ul> </div>

How do I access an updated variable between two scripts in Unity with C#? -

hopefully isn't detail, i'm not used asking programming questions. i'm attempting 3d video game development unity 3d course that's on udemy, though using c# instead of javascript. finished tutorial involves creating space shooter game. in it, shield created user when pressing button. shield has "number of uses" variable not used time tutorial has finished. i'm trying add in, , have managed implement each use, decrease number of uses remaining, , no longer able instantiate shield once number <=0. this variable stored on player, , if print player, returns value expect. however, i'm using separate scenemanager.cs (this tutorial placed lives, , score, , timer variables ) print numbers gui. problem cannot number of uses variable stay current when try print scene manager... registers initial value, doesn't update after that. here player script using unityengine; using system.collections; public class player_script : monobehaviour {

How to set up different document roots on OpenShift for Yii2 advanced template -

after use yii2 advance template ( https://github.com/yiisoft/yii2-app-advanced ) needs different documents roots frontend , backend. set document roots of web server: frontend /path/to/yii-application/frontend/web/ , using url http://frontend/ backend /path/to/yii-application/backend/web/ , using url http://backend/ in local machine have set apache , configured virtual host have alias point backend. <virtualhost ..:80> serveradmin .. servername . documentroot "...\frontend\web" <directory "...\frontend\web"> require granted </directory> alias /backend "...d\backend\web" <directory "...\backend\web"> require granted </directory> </virtualhost> but can't figure out how in openshift. please let me know if there's solution on openshift? according release blog post in march ( https://blog.openshift.com/openshift-online-march-2014-release-b

Macro to remove duplicate values from an excel cell -

i have duplicate email ids in excel cell. (each cell has around 5 6 emails repeated below). there macro remove unique ones cell ? have given example below reference, appreciate assistance. cell 1 abc@cc.com cde@bb.com abc@cc.com lmn@nn.com cde@bb.com cell 2 jjj@cc.com kk@dd.com jjj@cc.com auro i used data in blank worksheet in column a, , output gets put in column b. can change loops , cell references suit needs. i've assumed want email addresses contained in cell remain grouped (once duplicates have been removed) in output. this code assumes email addresses separated 'carriage return' sub removeduplicate() 'references: http://stackoverflow.com/questions/3017852/vba-get-unique-values-from-array dim wks worksheet dim rng range dim wordcount integer dim d object dim integer dim j integer dim v variant dim outtext string set wks = worksheets("sheet1") '<- change sheet suit needs j = 1 2 &

matlab - find the edge based on normals -

i have 480*640 depth image, , got normals (a 480*640*3 matrix) of each pixel depth image. know how find edge based on normal information? thanks lot! an intuitive definition of edge in depth image surface normal faces away viewer. assuming viewing direction [0 0 -1] (into xy plane) normal has vanishing z component can characterized edge. e = abs( depth(:,:,3) ) < 1e-3; %// nice starting point you need set threshold based on data. after might consider applying non-maximal suppression or other morphological cleaning operations.

python - Using Pandas GroupBy and size()/count() to generate an aggregated DataFrame -

so have dataframe called df goes: date tag 2011-02-18 12:57:00-07:00 2011-02-19 12:57:00-07:00 2011-03-18 12:57:00-07:00 b 2011-04-01 12:57:00-07:00 c 2011-05-19 12:57:00-07:00 z 2011-06-03 12:57:00-07:00 2011-06-05 12:57:00-07:00 ... i'm trying groupby tag, , date (yr/month), looks like: date b c z 2011-02 2 0 0 0 2011-03 0 1 0 0 2011-04 0 0 1 0 2011-05 0 0 0 1 2011-06 2 0 0 0 ... i've tried following, doesn't quite give me want. grouped_series = df.groupby([["%s-%s" % (d.year, d.month) d in df.date], df.tag]).size() i know tag exists etc. appreciated. update (for people looking in future): ended keeping datetime, instead of string format. trust me, better when plotting: grouped_df = df.groupby([[ datetime.datetime(d.year, d.month, 1, 0, 0) d in df.date], df.name]).size() grouped_df = grouped_df.unstack().fillna(0) you use unstack() , fillna() methods: >>> g = df.

repeat - Repeating a block of text element by element in Excel -

Image
i wondering if copy in excel allows block of text (each new text element in different cell) repeat element element. currently 1 can repeat block of text clicking , dragging such abc can become abcabcabcabc repeated 4 times. element element 4 times yield aaaabbbbcccc . i'm doing rather large block of text manually not option. this because wish have 2 columns, 1 abcabcabcabc , aaaabbbbcccc in 'to' , 'from' situation such possible journeys between points recorded. could use cell-reference floor/ceiling rounding? thank you. a pedestrian approach formulas. put order of series column e, starting in e1. copy cells in column e column a, starting in cell a2. drag down far desired, repeating pattern set in column e. place first value of pattern in cell b1. in cell b2 put formula , copy down far required =if(countif($b$1:b1,a2)<counta(e:e),b1,index(e:e,roundup((row()-1)/counta(e:e),0))) copy column b. paste special values.

api - python-instagram can create new account in Instagram? -

i talking library https://github.com/instagram/python-instagram is possible registered there of python library? so can create new accounts in instagram out using android/ios device or simulator looking answer thanks since there isn't any endpoint lets create user, don't think wrapper library does

php - working with joomla 2.5 users component -

i developing component in joomla 2.5 has total 2 pages, after first page user redirected login page if not logged in. data got first page needs saved temporarily , saves database after successful login. so in order did code changes inside site_root/components/com_users/views/login/tmpl and modified default.php recive our ajax call , send temp data after succeful login.. now need upgrade joomla 3.0 , what right way deal these kind of problems? there other way can work joomla login component fulfill abvove requirements(by not messing core joomla code)?? plese valuable suggestions.... you should not modify joomla core files. to make kind of change should using plugins , events onafterlogin etc. there pretty documentation here: http://docs.joomla.org/plugin and can recommend book plugin development if understand power of plugins. https://www.yireo.com/books/programming-joomla-plugins-book

sql - Top 3 rows per country -

Image
i've produced report of "which , how many of products been sold in each country". i'm using northwind database, sql server 2012. the following code: select o.shipcountry 'country',od.productid, p.productname, p.unitprice, sum(od.quantity) 'number of units sold' products p inner join [order details] od on od.productid = p.productid inner join orders o on o.orderid = od.orderid group p.productname, od.productid, p.unitprice, o.shipcountry order o.shipcountry, 'number of units sold' desc the result shows on 900 rows, each country has 10 20 rows: but want take notch, , want produce "top 3 products sold per country" tried row_number() on (partition by i'm clumsy @ using row_number() the below wrong code: with cte ( select o.shipcountry 'country',od.productid, p.productname, p.unitprice, sum(od.quantity) 'number of units sold', row_numb

c++ - Variable keep getting re- initialized inside loop? -

i'm total beginner , i'm self studying c++, there exercise in jumping c++ in asks write tic tac toe game, half way through program stuck problem inside while loop. not put current code here part of irrelevant question wrote code below similar problem facing in tic tac toe game: **no matter character give of -char test- variables keep getting re- initialized initial chars because of while loop in main(), way know out of problem change variable's scope global don't want that. ??so how can stop variables getting re-initialized ? can't move while loop main() affect other functions in tic tac toe game... please consider i'm beginner , know loops, conditional statements , bools, not understand big programming words. thank you #include <iostream> int show(int choice, char x_o); int main(){ int i=0; int choice; char x_o=' '; while(i<2){ //enter 2 , x first time example //enter 3 , o second time example

tabs - Java code indentation -

for 'case 1' below, console prints text intended. case 1: system.out.println ("text text text text text text text text text text text text text text text text text text text text text text "); break; however, want format code that, when reading code, second line of text aligned first: s in 'system' aligned t of 'text' @ start of second line of text. if use tab indent second line, tab appears in text printed console. there way around this? java has "+" operator strings concat multiple strings together. however, string concat using "+" known cause performance issues . hence, better save entire string single string instead of splitting readability. case 1: system.out.println ("text text text text" + " text text text text" + " text text text text text "); break; if particular, can consider stringbuffer or stringbuilde

Parsing Date from database in javascript -

this can small problem getting confused how understand date format stored in database. in mysql database have date stored 2014-12-02t01:15:00z now looks me 01:15:00 but on javascript coming 12:15pm m = moment('2014-12-02t01:15:00z') m.format('yyyy-mm-dd hh:mm a') "2014-15-02 12:15 pm" i want know how 01:15 becomes 12:15pm may missing basic bit not find it the time based on computer believe. conversion. for instance: var t = '2014-12-02t01:15:00z'; console.log(new date(t)); then get: mon dec 01 2014 17:15:00 gmt-0800 (pst) what's being stored in mysql based on gmt.

jquery - up and down button should work only if either one item is selected or in case of multiple items only if consequtive items are selected -

this code used move item , down list using 2 buttons. in case of multiple select need move items , down list if 2 or more items selected consecutive. should treat elements selected single entity , should not change order. am not able figure out how that. please help. <!doctype html> <html> <head> <title>ms profile</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script> <script > $(function() { $("#buttonmoveup").click(function() { $("select[id='selectobjchosen'] option:selected").each(function () { itemlist=$('#selectobjchosen'); selected=$(this).index(); if(selected>2) { jquery($(itemlist).children().eq(selected-1)).before(jquery($(itemlist).children().eq(selected))); selected=selected-1; } }); }); $("#buttonmovedown").c

java - Compile time error when adding an Integer to a generic ArrayList of String -

i know question has been asked multiple times before i'm looking answer based on type erasure. why compiler give error on adding integer arraylist<string> ? want understand type erasure , byte code of add method in arraylist . this has nothing type erasure or byte code. compiler gives error before erases generic type parameters , generates byte code. when adding integer arraylist<string> , compiler gives error because integer not sub-class of string . generics add layer of type safety in compile time. if use raw arraylist instead of arraylist<string> , able add both string s , integer s arraylist . however, generated byte code same regardless of whether used arraylist or arraylist<string> .

ruby on rails - Unable to use GEM_HOME in radrails -

i have setup radrails on linux machine. dont have root privileges on machine , cant edit ruby installation folder. have set gem_home , gem_path location have privileges. running radrails terminal have set these variables. radrails recognize gem location? also not able start webrick server using radrails. server in stopped state , console output blank. not able fix since dont see errors. thank you! use rvm or rbenv change ruby , gem space one. if begin usage of them following: install rvm ruby: $ \curl -ssl https://get.rvm.io | bash -s stable --ruby or install rbenv , , install ruby, , make global: $ \curl https://raw.githubusercontent.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash $ rbenv install 2.1.4 $ rbenv global 2.1.4 install rails without documentation general gem space: $ gem install rails --no-ri --no-rdoc enter project, create 2 files .ruby-version installed version of ruby (in example 2.1.4 ), , .ruby-gemset name of p

html - how do i put the header static in aspx page without having css? because it always goes to bottom. -

<tr> <td class="table-header2"<width="200">doctor name</td> <td class="table-header2" <width="35">segment</td> <td class="table-header2"><width="35">jan</td> <td class="table-header2"><width="35">feb</td> <td class="table-header2"><width="35">mar</td> <td class="table-header2"><width="35">apr</td> <td class="table-header2"><width="35">may</td> <td class="table-header2"><width="35">jun</td> <td class="table-header2"><width="35">jul</td> <td class="table-header2"><

android - Relative Layouts - long Textview overlaps -

Image
i have relative layout includes 2 textviews: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context="com.example.pris.viewactivity" tools:ignore="mergerootframe"> <textview android:id="@+id/description" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/mydes" /> <textview android:id="@+id/tex" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/description" android:text="@string/mytext" /> <autocompletetextview android:id="@+id/text

php - Long live access token granting permissions and scopes -

Image
i obtained access token facebook app using graph api explorer , long lived access token server side. unable edit permission , scopes obtained long lived access tokens. have uploaded screen shots of access token debugger both access tokens obtained graph api explorer long lived access token obtained sever side .please on how edit scopes of long lived access tokens server side. as seen in screen shot in scopes , has many permissions. access token obtained server side has 1 scope "public_profile". how should grant permissions long lived access token obtained server side? please my code login <?php $a=$_get["query"]; $app_id = "xxxxxx"; $app_secret = "xxxxxxxxxx"; $redirect_uri = "http://localhost/url_encode.php/"."?"."f=".$a; // echo $my_url; $dialog_url = "http://www.facebook.com/dialog/oauth?client_id=" . $app_id . "&redirect_uri=" .$redirect_uri;

operating system - Interrupt routing for PCIe slot directly connected to the CPUs -

Image
if @ haswell architectural diagram today can see there pcie lanes directly connected cpu (for graphics) of them routed the platform controller hub (southbridge replacement): if intel 8 series data-sheet (the specification of c222) find intel c222 contains i/o apic used route legacy intx interrupts (chapter 5.10). question happens if legacy intx interupt requests arrives directly @ cpu (over pcie 3.0 lanes). have forwarded c222 first or there i/o apic in system agent have program in case? also, intel virtualization technology directed i/o there additional indirection, interrupt remapping table. table in system agent (former northbridge) on cpu or on c222 , mean interrupts pcie 3.0 lanes need routed c222 first in case remapping enabled?

vb.net - Trying to delete a record from my access database in visual basic studio 2010 -

private function createplayeradapter(byval playerdbconnection oledbconnection) oledbdataadapter // initiating instances function dim dataadapter oledbdataadapter = new oledbdataadapter() dim mycommand oledbcommand dim parameter oledbparameter // establishing string tell delete record , how find record want. // playeridtextbox.text text on form populated database after selecting list of name (this works correctly) // connection open , directed correct place dim sql string = "delete * players id ='" & cint(playeridtextbox.text) & "'" mycommand = new oledbcommand(sql, playerdbconnection) parameter = mycommand.parameters.add("id", oledbtype.char, 3, "id") parameter.sourceversion = datarowversion.original dataadapter.deletecommand = mycommand return dataadapter end function // call function after executing button click. //listplayercombobox.text populated names , needs name fill play

sequence - A for loop with strsplit in R error -

i'd preface post new r , bioinformatics coding, , i'd appreciate input knowledgable community. goal code posted below generate pie charts show amino acid abundance per protein blast results. uploaded csv file uniprot, converted matrix, , wrote out code below. keep getting error: in aas[i] = table(strsplit(blast_aa_seqs[i], "", usebytes = true)) :number of items replace not multiple of replacement length. column 8 output column contains amino acid sequences. in advance! mydata=read.table("cdpkbeta_blast_results.csv",header=true,sep=",") mydata=as.matrix(mydata) aas=c() blast_aa_seqs=c() for(i in 1:nrow(mydata)){ print(i) blast_aa_seqs[i]=mydata[i,8] aas[i]=table(strsplit(blast_aa_seqs[i],"", usebytes=true)) pie(aas, col=rainbow(length(aas)), main="residue abundance") } lal<-c() lal[1]=table(strsplit("", "", usebytes = t)) empty string problem (blast_aa_seqs[i] empty string)

html - Dropdown menu - links dim when selected (Safari Only) -

having frustrating time trying solve this. have dropdown menu in navbar , when it's selected other links dim significantly, in safari (looks fine in chrome , firefox). went original , unmodified bootstrap 3.3 template (sticky footer fixed navbar) , issue present. might there work around css this. assistance appreciated. in advance. link site http://www.futureyouthrecords.org/indexalt.html

Scala Future with Option() -

i'm creating 3 actor tasks using future, , trying collect 3 when finished. current code following: implicit val timeout = timeout(5.seconds) val result1 = actor1 ? dataforactor(data) val result2 = actor2 ? dataforactor(data) val result3 = actor3 ? dataforactor(data) val answer = { <- result1.mapto[list[resultdata]] b <- result2.mapto[list[resultdata]] c <- result3.mapto[list[resultdata]] } yield (a ++ b ++ c).sorted answer oncomplete { case success(resultdata) => log.debug("all actors completed succesffully") successactor ! successdata(resultdata.take(2)) case failure(resultdata) => log.info("actors failed") } each of actors (actor1, actor2, actor3) manipulates data , returns either none or option(list(resultdata)), shown in following code: val resultdata = if(data.size == 0) none else { data.map { ... try { ... //manipulation on resultdata option(resultdata) }

javascript - Async function depends on a external module in Protractor test -

i want save image file in remote web server, , upload it server in protractor test. // depend on external module var fs = require('fs'); // save remote file(url) local(dest) var download = function (url, dest) { // let function async browser.executeasyncscript(function (url, dest, done) { var file = fs.createwritestream(dest); var request = http.get(url, function (response) { response.pipe(file); file.on('finish', function () { file.close(done); }); }); }, url, dest); }; describe('', function () { it('', function () { browser.get('http://...'); download('http://.../foo.jpg', 'foo.jpg'); /*** doesn't work! ***/ var absolutepath = path.resolve(__dirname, 'foo.jpg'); $('input[type=file]').sendkeys(absolutepath); $('#uploadbutton').click(); ... bu

ios - ReactiveCocoa subscribeCompleted in command never executes -

i new reactivecocoa , mvvm. trying simple login screen. view controller in storyboard has 2 textfields (username, password) , 1 button. when button clicked should send post request username , password server , receive secure token. when response received, should execute sendcompleted. subscribecompleted in raccommand executionsignals block never gets executed , can't go next screen. viewcontroller.m // viewcontroller.m #import "viewcontroller.h" #import <reactivecocoa/reactivecocoa.h> #import <reactivecocoa/racextscope.h> #import "viewmodel.h" @interface viewcontroller () @property (strong, nonatomic) viewmodel *viewmodel; @property (weak, nonatomic) iboutlet uibutton *button; @property (weak, nonatomic) iboutlet uitextfield *usernametextfield; @property (weak, nonatomic) iboutlet uitextfield *passwordtextfield; @end @implementation viewcontroller - (instancetype)initwithcoder:(nscoder *)adecoder { self = [super initwithcoder:ade

Java find URL in string and create HTML link tag -

in string have result: content = "hello world, visit link: www.stackoverflow.com"; or content = "hello world, visit link: http://www.stackoverflow.com"; or content = "hello world, visit link: http://stackoverflow.com"; now want find url in string , finaly create html link tag result: htmlcontent = "hello world, visit link: <a href="http://stackoverflow.com">http://stackoverflow.com </a> "; how result? htmlcontent = "hello world, visit link: <a href="[http://|www.] stackoverflow.com">[http://|www.]stackoverflow.com </a> "; you can try this: string content = "hello world, visit link: www.stackoverflow.com"; string[] splitted = content.split(" "); (int = 0; < splitted.length; i++) { if ((splitted[i]).contains("www.")) { // use more statements // http:// etc..

java - how to return HashSet from a method? -

i struggling how recall data stored in hashmap , hashset , method return values stored in them , size data? public hashset <room> getoccupiedrooms(){ return occupiedrooms.size(); } and not compile not sure. , wound return data stored. cheers you need iterate on hashset, check every room if it's occupied , add room diffferent hashset. public hashset<room> getoccupiedrooms(){ hashset<room> tempset = new hashset<room>(); // iterate start // if room occupied, add room tempset // iterate end // return tempset

python - Qt Designer - clickable area to generate map -

Image
using python 2.7.3 , qt designer 4.8.2: i'm new qt, how may create simple grid area clickable generate map? image below illustrates intend. in essence main issue grid area, i'm unable see 'off shelf' within qt. one (clunky?) solution draw map image using label widget pixmap set. can achieve click-ability listening mousepressevent on widget, upon can qmouseevent object contains mouse x, y position (both global , relative clicked widget). can used determine on image clicked.

java - How to open JCombobox in a addPropertyChangeListener -

in jdatechooser, have added addpropertychangelistener detects if date chosen. if chosen, want open jcombobox. (date) string detected when select, can't open jcombobox. here code: datechoosercal.getdateeditor().addpropertychangelistener(new propertychangelistener() { public void propertychange(propertychangeevent evt) { date = datechoosercal.getdate(); if ("date".equals(evt.getpropertyname())) { dates = evt.getnewvalue(); datestring = string.format("%1$td-%1$tm-%1$ty", date); if (datestring != null) { system.out.print(datestring); choosetimebox = new jcombobox(controllerapp.gettime()); choosetimebox.setbounds(215, 261, 282, 22); add(choosetimebox); choosetimebox.setvisible(true); } } } }); well fact combo box isn't contained within displayable