Posts

Showing posts from August, 2011

java - Sort List Student by Grade -

i have exercise oop. define abstract class human first name , last name. define new class student derived human , has new field – grade. define class worker derived human new property weeksalary , workhoursperday , method moneyperhour() returns money earned hour worker. define proper constructors , properties hierarchy. initialize list of 10 students , sort them grade in ascending order. initialize list of 10 workers , sort them money per hour in descending order. merge lists , sort them first name , last name. i have create classes: human, student, , worker. want sort list student grade. should code in java ? package exercise2; import java.util.*; public class main { public static void main(string[] args) { list<student> students = arrays.aslist( new student("tam","le trung ngoc ", "2011"), new student("thai","le hoang thai ", "2012"), new student

ios - Importing file is stopping the ability to insert data into database -

in application, user can ask question , can see question , post response. have the questions shown in table view , can push detail view see specific question , post response. detail view, can enter view see other answers. have create segue carries on question id. have import file allows view responses. problem whenever import file, can no longer post response question. when file isn't imported, can post response. causing problem? tableview file: -(void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { if([[segue identifier] isequaltostring:@"showdetails"]){ detailviewcontroller *detailviewcontroller = [segue destinationviewcontroller]; nsindexpath *myindexpath = [self->tableview indexpathforselectedrow]; //int row = [myindexpath row]; nsdictionary *info = [json objectatindex:myindexpath.row]; detailviewcontroller.titledetailmodal = [info objectforkey:@"title"]; detailviewcontroller.bodydetailmodal = [info objectf

Sql Server Alias name in Row_Number function -

select tmp.id, tmp.portfolio, row_number() over(order tmp.id desc) rownum (select r.portfolio, r.id research r r.created_by = 'adam cohen' ) tmp rownum between 5 , 10; i not able refer rownum in condition, shows invalid column name 'rownum'. kindly me use right syntax result. edit - changed requirement select * ( select id, portfolio, case when l.posted_on null convert(varchar(40),l.created_on,120) else convert(varchar(40),l.posted_on,120) end sort_by, row_number() over(order sort_by desc) rownum research created_by = 'adam cohen' ) x x.rownum between 5 , 10 i tried include row_number function above got sort_by invalid column. you need nest row_number in derived table: select tmp.id, tmp.portfolio, tmp.rownum (select r.portfolio, r.id, row_number() over(order r.id desc) rownum research r r.created_by = 'adam cohen' ) tmp rownum betwee

where can I download source code for asp.net mvc 5.2.2 version (alone) -

if go https://github.com/aspnet/mvc , shows latest. neither here: https://aspnetwebstack.codeplex.com/sourcecontrol/latest if need source code asp.net mvc version, find (especially downloading/debugging). here can download git clone https://git01.codeplex.com/aspnetwebstack.git

c++11 - Why auto iteration in C++ cannot perform operation on the element it points to? -

i spent ~2 on trying figure out bug introduced code due usage of auto iteration containers. started using couple of days ago, without doing background check, because found easier write. i have following map: std::map<int, vectorlist> , vectorlist typedef std::vector<double> vectorlist . i wanted perform .clear() operation on std::vector<double> of vectorlist . i tried following: std::map<int, vectorlist> map; for(auto elem : map) { elem.second.clear(); } and did not work. clear operation not being performed on vectorlist . when performing .empty() check on it, return true . then went approach: for(std::map<int, vectorlist>::iterator elem = map.begin(); elem != map.end(); ++elem) { elem->second.clear(); } and worked expected. question: why auto iteration not perform .clear() operation expected? can achieved auto iteration @ all? because elem created by value . if want modify value in loop loop using re

javascript - jquery design after dynamically loading -

i have simple javascript app, gives out information of bles. everything working fine, have problems jquery mobile library. i want whole app in simple jquery data-theme="b". since list-view created dynamically through adddevice function, it's not working jquery. when try without .append() command, it's working - there no problem jquery mobile library. tried add data-theme attribute .append() command, this: $devices.attr("data-theme" , "b"); but still not working.. below out-takes html , javascript files. html: <ul data-role="listview" class="devices" id="myresult" data-theme="b"></ul> <div data-role="content" id="result"> <script type="text/template" id="device"> <ul data-role="listview" data-theme="b"> <li data-address="{0}">

Nested conditional statements in Ruby -

my issues two-fold: i didn't realize nest multiple conditionals this. seems pretty nasty. think know what's going on here, gets explain can concept? since don't understand nested conditionals well, i'm bit lost on refactor, area pretty weak in begin with. y'all kind present possible refactor solutions explanations? limited understanding greatly. def valid_triangle?(a, b, c, sum) if != 0 || b != 0 || c != 0 if >= b largest = sum += b else largest = b sum += end if c > largest sum += largest largest = c else sum += c end if sum > largest return "true" else return "false" end else return false end end you can trim down considerably doing more ruby-like way: def valid_triangle?(*sides) case (sides.length) when 3 sides.sort! sides[0] + sides[1] >= sides[2] else false end end whenever possible, try , express logic se

c++ - Access Violation trying to read vector filled with objects -

edit: made changes , updated code in post based on comments of kyle , dieter, fixed clone()function , added assignment-operator fulfil rule of three. while fixes sure badly needed, same error prevails. maybe assignment operator wrong? i'm using library jsonplus found online bigger project. need save objects of class cjsonarray in vector. cjsonarray comes no copy-constructor has pointer attribute, tried make 1 myself (first time made copy-constructor, i'm new c++). here relevant part of cjsonarray: cjsonarray.h class cjsonarray : public cjsonvalue { private: std::vector <cjsonvalue*> members; public: lib_pre cjsonarray(); lib_pre cjsonarray(const cjsonarray * value); lib_pre cjsonarray(const cjsonarray &); //the added copy constructor lib_pre cjsonarray& operator=(const cjsonarray&); lib_pre ~cjsonarray(); cjsonarray.cpp cjsonarray::cjsonarray(const cjsonarray& ori) :

sql - Stop returning multiple similar rows on joins -

i have following scenario in sqlite. tablea id ----- 1 | 2 | 3 | table b id | aid |tag ---------------- 1 | 1 | hide 2 | 1 | show 3 | 2 | null 4 | 3 | show table b has column aid ids of table a. in example above table id: '1' has -> table b id of '1' , '2' , tags 'hide' , 'show' attached it. i looking sql return, in example above, table ids: '2' , '3'. basically, tablea id: '1' has 'hide' tag attached it, don't return (even though has show tag attached it) the sql using (excuses names, quick example) select a.id a_id, b.id b_id, b.tag tag table left join table b on a.id = b.aid , b.tag != 'hide' the problem sql it's still returning a_id | b_id | tag ------------------------------- 1 | 2 | show i'm tad stuck , appreciated. i'm not 100% sure ho

java - libusb_open_device_with_vid_pid failed when trying to access USB device -

Image
i trying usb device connect android 5.1.1 device. had been using regular libusb kitkat, lollipop has increased security , no longer works. this documented, requiring root set selinux level. not want have root device usb device connect it. having looked around, came across this answer , have tried this libusb fork , getting new error libusb_open_device_with_vid_pid (29c2) failed. failed setup usb usb_setup: -1 i have not changed of code, library. is still permission issue, or there i'm missing make work? the following steps can used solve issues mentioned. the process of mounting device usb mass storage inconsistent across devices , manufacturer-specific. devices nexus s offer "turn on usb storage" when connect device desktop via usb cable. other devices galaxy s3 require app launch device mass storage. either way, android devices typically offer such feature, , you’ll have create file matches device's manufacturer specification. you need ad

Launch4J splash file -

i trying use launch4j , found following example splash image. allowed image format, other *.bmp? <splash> <file>${project.basedir}/src/main/build/splash.bmp</file> <waitforwindow>true</waitforwindow> <timeout>60</timeout> <timeouterr>true</timeouterr> </splash>

python - Django: call index function on page reload -

i wondering how call index(request) function thats in views.py upon every page reload. index(request) gets called when app loads. every other page reload after calls function in views.py called filter_report(request) . problem running 85% of code in filter_report(request) in index(request) , understanding don't want 2 functions lot of same stuff. take 15% of code isn't in index(request) in filter_report(request) , split different methods , have index(request) call other methods based on conditionals. well, not how works. each view separate , called urls map it. if have shared code, want either factor out separate functions can call each view, or use template tag or context processor add relevant information template automatically.

python - Replacing elements in a list with the indices of a list containing all unique elements -

assume have list contains unique nodes a - d of graph: list1 = [a, b, c, d] and list, contains edges of graph pairs of elements: list2 = [[c, d], [b, a], [d, a], [c, b]] how can write fast , economic way replace elements of list2 indices of elements in list1 , get: list3 = [(2, 3), (1, 0), (3, 0), (2, 1)] my current way of doing is: for in range(len(list2)): list3[i] = (list1.index(list2[i][0]), list1.index(list2[i][1])) however, takes long time large list, , trying find potentially faster way this. you can create dict letters indices want >>> indices = {key: index index, key in enumerate(list1)} >>> indices {'b': 1, 'd': 3, 'a': 0, 'c': 2} then use nested list comprehension >>> [[indices[i] in sub] sub in list2] [[2, 3], [1, 0], [3, 0], [2, 1]] edit list of tuple >>> [tuple(indices[i] in sub) sub in list2] [(2, 3), (1, 0), (3, 0), (2, 1)]

html - Possible Chrome bug: Docking a div outside the body makes the scrollbar inaccessible -

i'm writing chrome extension involves appending iframe sibling of existing page's body, reducing height of body stay above iframe, , setting overflow of html , body tags "scroll". example here: http://output.jsbin.com/cetobu/1 creates 2 vertical scrollbars: 1 html tag (the longer one) , 1 body. however, scrolltop property of "body" reports value "html" scrollbar, , none of elements reflect "body" scrollbar. huge problem because extension needs able set scrolltop value of body, scrollbar can "html" one. how access "body" scrollbar? (in firefox, html.scrolltop , body.scrolltop reflect correct scrollbars.) alternatively, if knows different way insert element on existing page , have else move out of way, great. (i've tried wrapping whole content of body in new div , putting iframe in sibling, caused lot of different complications on different sites.)

point cloud library - Visualizing a (XYZRGBL) .pcd file -

i have 'xyzrgbl' point cloud in .pcd file. want visualize it, used code: boost::shared_ptr<pcl::visualization::pclvisualizer> viewer (new pcl::visualization::pclvisualizer ("3d viewer")); viewer->setbackgroundcolor (0, 0, 0); viewer->addpointcloud<pcl::pointxyzrgb> (cloud1, "sample cloud"); viewer->setpointcloudrenderingproperties (pcl::visualization::pcl_visualizer_point_size, 1, "sample cloud"); viewer->addcoordinatesystem (1.0); viewer->initcameraparameters (); but received error: no matching function call ‘pcl::visualization::pclvisualizer::addpointcloud(pcl::pointcloud::ptr&, const char [13]) i tried: viewer->addpointcloud<pcl::pointxyzrgbl> instead of viewer->addpointcloud<pcl::pointxyzrgb> but still same problem. 1 know fault? in advance at end have add: while (!viewer->wasstopped ()) { viewer->spinonce (100); boost::this_thread::sleep

Elasticsearch - Limit docs count used for sum aggregation -

i know it's not supposed work way, there way force sum aggregations limit sum based on size set in query? like in query: { "size" : 10, "query":{ "filtered":{ "query":{ "match_all":{} }, "filter": { // filter } } }, "aggs": { "value" : { "sum" :{ "field":"value" } } } } if have 100 docs, i'd retrieve 10 docs , sum of these 10 docs. in nutshell: need select sum(value) table limit 10, regardless score. do guys know if can es? the limit filter seems want. here simple example. i set simple index , gave docs: put /test_index { "settings": { "number_of_shards": 1 } } post /test_index/doc/_bulk {"index":{"_id":1}} {"

javascript - Debugging in devtools with Webpack -

with require.js easy debug module in chrome's devtools, entering: require('my-module').callthisfunction() with webpack not possible anymore, because compiles modules via cli , not export require . window.webpackjsonp globally exposed, thought find module id , call this: webpackjsonp([1],[]) , unfortunately returns undefined . are there workarounds still able debug require.js? add code module in bundle require.ensure([], function() { window.require = function(smth) { return require('./' + smth); }; }); now can use 'require' chrome console require('app').dosmth()

html - Trying to get a website to zoom 120% when screen resolution is greater than 1600px -

i'm working on website, , asked me if possible zoom entire website when has screen width of 1600px or greater. now i've tried css3 , media queries, , i've read lot on internet, can't seem work. this media query i've created in css. @media screen , (min-width:1600px) { * { zoom: 500%; } anybody got idea? try this: @media screen , (min-width: 1600px) { body { /* webkit browsers */ zoom: 120%; /* moz browsers , since there no support "zoom" */ -moz-transform: scale(1.2); -moz-transform-origin: 0 0 } } here snippet: @media screen , (min-width: 1600px) { body { /* webkit browsers */ zoom: 120%; /* moz browsers , since there no support "zoom" */ -moz-transform: scale(1.2); -moz-transform-origin: 0 0 } } <div>this going big when width minimum 1600px</div>

recursion - Simplify a recursive function from 3 to 2 clauses -

i doing exercises on f#, have function calculate alternate sum: let rec altsum = function | [] -> 0 | [x] -> x | x0::x1::xs -> x0 - x1 + altsum xs;; val altsum : int list -> int the exercise consist in declare same function 2 clauses...but how this? the answer of mydogisbox correct , work! but after attempts found smallest , readable solution of problem. let rec altsum2 = function | [] -> 0 | x0::xs -> x0 - altsum2 xs example altsum2 [1;2;3] this: 1 - (2 - (3 - 0) it's bit tricky work! off topic: another elegant way solve problem, using f# list library is: let altsum3 list = list.foldback (fun x acc -> x - acc) list 0;; after comment of phoog started trying solve problem tail recursive function: let tail_altsum4 list = let pl l = list.length l % 2 = 0 let rec rt = function | ([],acc) -> if pl list -acc else acc | (x0::xs,acc) -> rt (xs, x0 - acc) rt (list

vba - Outlook 2013: select multiple emails and autoreply using template -

i trying code work. i want select multiple emails inbox , send auto reply using template. i getting run-time error: object variable or block variable not set. any appreciated. add msg box telling me how many items sent. option explicit sub replywithtemplate() dim item outlook.mailitem dim orespond outlook.mailitem each item in activeexplorer.selection ' sends response using template set orespond = application.createitemfromtemplate("c:\users\accounting\appdata\roaming\microsoft\templates\scautoreply.oft") orespond .recipients.add item.senderemailaddress .subject = item.subject ' includes original message attachment .attachments.add item ' use testing, change .send once have working desired .display end on error resume next next set orespond = nothing end sub i have noticed following lines of code: each orespond in activeexplorer.selection ' sends respons

r - How to modify ggplot2 scater plot -

Image
here sample dataset: df1 = data.frame(count.amp = c(8,8,1,2,2,5,8), count.amp.1 = c(4,4,2,3,2,5,4)) i tried library(ggplot2) qplot(count.amp,count.amp.1, data=df1) is there ways plot in such way size of dot proportional number of elements in each dots? yes, broadly speaking looking @ creating bubble plot, code: df1 = data.frame(count.amp = c(8,8,1,2,2,5,8), count.amp.1 = c(4,4,2,3,2,5,4)) df1$sum <- df1$count.amp + df1$count.amp.1 ggplot(df1, aes(x=count.amp, y=count.amp.1, size=sum),guide=false)+ geom_point(colour="white", fill="red", shape=21)+ scale_size_area(max_size = 15)+ theme_bw() would give that: wasn't clear me yo mean number of elements on principle can pass figures size= desired result.

android - mkey of a File on AWS -

i trying download file aws using transfermanager. can please suggest how can 1 find mkey(required 1 of parameters in download() function) of file. in aws s3 document( http://awsdocs.s3.amazonaws.com/mobile/sdkforandroid-dev.pdf ), says mkey key of file. not sure how can value obtained. thanks, code: download download = transfermanager.download(bucket_name, mkey, file); mkey identifier of object stored under bucket. it's equivalent file name on local storage. since want upload file, have give name (mkey in s3), want name it. address file on s3 bucket name , key name. see s3's documentation more details. http://docs.aws.amazon.com/amazons3/latest/dev/introduction.html#basicskeys

xml - Solr filters are them good? -

do think filters french search? <fieldtype name="text" class="solr.textfield" positionincrementgap="100"> <analyzer type="index"> <tokenizer class="solr.whitespacetokenizerfactory"/> <!-- in example, use synonyms @ query time <filter class="solr.synonymfilterfactory" synonyms="index_synonyms.txt" ignorecase="true" expand="false"/> --> <!-- case insensitive stop word removal. add enablepositionincrements=true in both index , query analyzers leave 'gap' more accurate phrase queries. --> <filter class="solr.stopfilterfactory" ignorecase="true" words="stopwords.txt" enablepositionincrements="true"/> <filter class="solr.worddelimiterfilterfactory" generatewordparts="1" generatenumberparts="1"

android - Change ActionBar title color and background using appCompat v7:22.1.1 -

i have read other stack overflow answers question reason not work. i want change titlecolor , action bar background using version of appcompat: appcompat-v7:22.1.1 and these styles: <style name="theme.myapptheme" parent="@style/theme.appcompat.light"> <item name="actionbarstyle">@style/actionbar.solid.mystyle</item> <item name="actionbaritembackground">@drawable/selectable_background_mystyle</item> <item name="textappearancelargepopupmenu">@style/myactionmenutextappearance.large</item> <item name="textappearancesmallpopupmenu">@style/myactionmenutextappearance.small</item> <item name="colorprimary">@color/white</item> <item name="colorprimarydark">@color/black</item> <item name="coloraccent">@color/iroko_pink</item> </style> <style name=

linux - Add module to angstrom kernel -

i'm working on altera cyclone v soc fpga dev kit. i'm using gsrd 14.1 angstrom provides rocketboards.com ( http://www.rocketboards.org/foswiki/documentation/gsrd141angstromgettingstarted ) root@socfpga_cyclone5:~# uname -a linux socfpga_cyclone5 3.10.31-ltsi this kernel don't support usb serial device , think need add usbserial , maybe usbcore drivers communicate gps serial module. kernel includes insmod , modprobe can't find specifics driver board. dmesg returns: usb 1-1: new full-speed usb device number 2 using dwc2 usb 1-1: new usb device found, idvendor=10c4, idproduct=ea60 usb 1-1: new usb device strings: mfr=1, product=2, serialnumber=3 usb 1-1: product: cp2104 usb uart bridge controller usb 1-1: manufacturer: silicon labs usb 1-1: serialnumber: 006fa62e is there solution add module ? if have rebuild , customize kernel, i'm looking advise :) thanks in advance. edit the solution add serial driver support in menuconfig , update kernel.

payment - Pay by cash magento backend -

hi guys have problem, sometimes go events , there sell our products. want add transactions magento store. when create new order can add out payment method. try add protected $_canusecheckout = false; protected $_canuseformultishipping = false; to checkmo.php file , protected $_canuseinternal = true; protected $_canusecheckout = false; into purchaseorder.php file it still doesn't work, how should now? want add pay in cash method or this. help in system > config > sales > payment methods activate check / money order . (you might want deactivate afterwards if don't want appear on frontend. or hide it.)

Python: Is there a better way to combine the values of a list -

this question has answer here: how possible combinations of list’s elements? 15 answers i'm doing little project class @ university. in 1 of functions have list, like: x = ["q0", "q1", "q2", "q3", "q4"] what want list create dictionary, i'll use store values , values searching in matrix, combine values of list, this: dic = {("q0", "q1"): "", ("q0", "q2"): "", ... ("q3", "q4"): ""} i did way: part1 = x[1:] part2 = x[:-1] dic = {} v in part1: r in part2: if v != r , (r, v) not in dic.keys(): dic[(v, r)] = "" i used if because don't want repeated values, like: ("q1", "q1") and don't want opposed values, like: ("q2", "q3"), (&q

android - BLE Device Name irretrievable -

i have project scanning beacons run on ble. i can scan beacon , list them in nice custom listview fine. retrieving names seems not work. in onlescan callback use device.getname() appears returning null? furthermore, when attempt parse scanrecord byte[] array data in concordance this post - still not having luck. ideas/tips? should retrieving local name bluetoothdevice class? should retrieve parsing scanrecord/scanresult class? here onlescan looks like: public void onlescan(final bluetoothdevice device, int rssi, final byte[] scanrecord) { runonuithread(new runnable() { @override public void run() { log.v(device.getname(),device.getname()); mledevicelistadapter.adddevice(device); mledevicelistadapter.notifydatasetchanged(); } } }); } edit: i attempted m

linux - Performance tuning via sysctl, what is the difference between setting net.core.rmem_default (r/w) / net.ipv4.tcp_mem / net.ipv4.udp_mem -

what difference between setting read/write mem default via net/core , setting protocol min/max/default net/ipv4 in sysctl? detailed explanation or resource request net.core.wmem_default net.core.rmem_default net.ipv4.tcp_mem net.ipv4.udp_mem thanks take @ https://www.kernel.org/doc/documentation/networking/ip-sysctl.txt https://www.kernel.org/doc/documentation/sysctl/net.txt net.ipv4.tcp_mem , net.ipv4.udp_mem limit total kernel memory tcp , udp respectively, others control per socket buffer space

ruby on rails - Unable to update attribute - undefined method -

missing fundamental here. unable update items_loaded once rest client done fetching items api. live app can run on fly : http://runnable.com/vw9rqx-kiiffmpii/ajax-affiliates undefined method `items_loaded=' #<class:0x000000037cce20> app/models/affiliate.rb:17:in `set_items_loaded' app/controllers/main_controller.rb:8:in `index' main_controller.rb class maincontroller < applicationcontroller def index # delay fetching # @products = affiliate.fetch @products = affiliate.delay.fetch # let know when fetching done affiliate.set_items_loaded end def check_items_loaded @items_status = affiliate.items_loaded respond_to |wants| wants.js end end end affiliate.rb require "rest_client" class affiliate < activerecord::base def self.fetch response = restclient::request.execute( :method => :get, :url => "http://api.shopstyle.com/api/v2/products?pid=uid7849-6112293-28&f

regex - .htaccess Manipulating the Query String -

as per wiki - https://wiki.apache.org/httpd/rewritepathinfo - shows how change url path query string: rewriteengine on rewriterule ^/blah/?([^/]*)/?([^/]*)/?([^/]*)/?([^/]*)/? \ /blah.php?arg1=$1&arg2=$2&arg3=$3&arg4=$4 [pt] this method requires predict exact amount, if there 5 levels 5 values: /blah/1/2/3/4/5/ translating blah.php?var1=1&var2=2&var3=3&var4=4&var5=5 is there way without pre knowing number of variables, being dynamic? for example, 1 day user might enter 7, day 1, day 9 , rewrite regex being able handle them all? to make dynamic should not bother breaking path info multiple query parameters. pass after blah/ php file , let php split on / . can use rule: options -multiviews rewriteengine on rewriterule ^/?(blah)/(.+)$ $1.php?path=$2 [l,qsa,nc]

javascript - how to parse json data in html page -

how parse json data,i need display each , every data inside div element. using world weather online api service access weather data <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> </head> <body> <input type="text" id="in"></input> <input type="hidden" id="keys" value="api"></input> <input type="hidden" value="json" id="format"></input> <button id="go">search</button> <script> $(document).ready(function(){ $("#go").click(function(){ var apikey = $("#keys").val(); var q = $("#in").val(); var format = $("#format").val(); jquery.ajax({ url: 'http:/

email - Configure settings for testing mail sending with localhost and orchard -

i have installed , enabled email module in orchard, , used settings given in orchard documentation set up(someemail@email.com, host name: 127.0.0.1 , port number 25). yet, no email sent. have searched correct way it. if has managed orchard cms work sending email testing on localhost, please shear. thank in advance.

AJAX passing secret variable to php -

i have script counts number of clicks done on specific part of map. every 10 seconds through ajax send these numbers php page insert them in database. every 10 seconds specific cell of map can clicked 1 time. the problem if client modifies script reducing number of seconds of ajax request, can potentially infinite number of clicks. so need pass .php secret variable cannot modified client, , .php checking if same secret variable has done in less 10 seconds insert. possible, considering fact session id , cookie can potentially modified client??

Erlang Common Test coverage specification file - Relative paths -

i using common test code coverage analysis in erlang project. file structure myproject/ ebin/ src/ test/ myproject.coverspec the .beam-files source code located in ebin/ , tests in test/ test sources. i using absolute paths .beam files in .coverspec-file. myproject.coverspec: {level,details}. {incl_dirs, ["/home/user/myproject/ebin", "/home/user/myproject/test"]}. this works, far optimal project development distributed. ct_run called base of project, myproject, paths don't seem relative myproject somewhere else. i've tried paths relative both myproject , myproject/test w/o success. my question is, paths in myproject.coverspec relative to? in last erlang project have used ct , cover setup looked this: cover.spec in project root directory: {incl_dirs, ["apps/application_manager/ebin", "apps/session_counter/ebin", "apps/session_heartbeat/ebin", "apps/session_api/ebin

javascript - How to call a scope function based on an attribute value -

i have several 'save , close' links in app, each button has unique function run when clicked, defined directive ng-really-click . directive confirms closing, runs close function, e.g. <a ng-really-click="someclosefunction(p1, p2)" /> now elsewhere in app, want 'pretend' user has clicked save button, bypass confirmation. @ given moment, don't know close function should called, , have find out finding close link , inspecting ng-really-click attribute. once have function call expression defined in attribute, call function against scope have in variable currentscope . how can this? i gueess angularish way use different controllers per link. then, have scope , rootscope pointers ng-really-click function. i.e: cntrl1: $scope.funcpointer = $rootscope.funcpointer = function() {console.log('yo1');} cntrl2: $scope.funcpointer = $rootscope.funcpointer = function() {console.log('yo2');} on views, use func pointer:

asp.net mvc - Having issue with multiple controllers of the same name in my project -

i running following error asp.net mvc 3 project: multiple types found match controller named 'home'. can happen if route services request ('home/{action}/{id}') not specify namespaces search controller matches request. if case, register route calling overload of 'maproute' method takes 'namespaces' parameter. the request 'home' has found following matching controllers: mycompany.myproject.webmvc.controllers.homecontroller mycompany.myproject.webmvc.areas.company.controllers.homecontroller i have homecontroller in default controller folder, class name of mycompany.myproject.webmvc.controllers.homecontroller. my registerroutes method, in global.asax, looks like: public static void registerroutes(routecollection routes) { routes.ignoreroute("{resource}.axd/{*pathinfo}"); routes.maproute( "default", // route name "{controller}/{act

android - Should I use StringRequest or JsonObjectRequest -

i little confused supposed use. the api trying hit accepts regular text post parameters although response json string . which should use ? you can use json object request this.

angularjs - AngularUI modal custom scope -

i wanted define custom scope modal (i don't want use dependency injection reasons) using in project, i'm getting error whenever define scope in $modal.open . here plunk created example on angularui's website: http://plnkr.co/edit/rbtbpyqg7l39q1qydhns i tried debugging , saw (modaloptions.scope || $rootscope) returns true custom scope , since true (obviously) doesn't have $new() function defined, exception thrown. any thoughts? you'll have pass scope instance: var modalinstance = $modal.open({ animation: $scope.animationsenabled, templateurl: 'mymodalcontent.html', controller: 'modalinstancectrl', size: size, resolve: { items: function () { return $scope.items; } }, scope: $scope }); you can pass own custom scope if don't want use controller's scope, working plnkr: http://plnkr.co/edit/1gjtuvn45fgpc3jigyhv?p=preview

html - CsQuery - Unwrap element with whitespace character between -

i'm trying unwrap string in csquery. functionality works, want add whitespace char between each tag. dim fragment = csquery.cq.create(<div>some text</div><div>more text</div>) dim unwraptags = new list(of string) {"div"} each s in unwraptags fragment(s).contents.unwrap() 'here want add whitespace between every tag next ' should outprint "some text more text ", not "some textmore text" return fragment.render(csquery.outputformatters.htmlencodingminimum) what best way achieve effect? i figured out! iterate through elements , add whitespace before unwrap. public function sanitizestring() each s in unwraptags fragment.each(addressof addwhitespace) fragment(s).contents.unwrap() next end function private shared sub addwhitespace(obj idomobject) obj.innertext &= " " end sub

android - Fragment returning Null context -

i've been trying fix past 2 hours. tried lot of things. the fragment seems passing null context adapter. have tried initialize context variable in oncreate , oncreateview , onactivitycreated. same result. here fragment: public class activebookingsfragment extends fragment { context con; arraylist<booking> bookings; listview activebookings_lv; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); } @override public void onactivitycreated(bundle savedinstancestate) { super.onactivitycreated(savedinstancestate); con = this.getactivity(); } @override public view oncreateview(layoutinflater inflater, @nullable viewgroup container, @nullable bundle savedinstancestate) { view v =inflater.inflate(r.layout.tab_activebookings,container,false); activebookings_lv = (listview) v.findviewbyid(r.id.lv_activebookings); bookings =

ruby - Collecting array of records from DB using Rails 3 -

i want access array of value db using different ids rails 3 got following error. error: nomethoderror in payments#download_pdf showing c:/site/swargadwara_puri1/app/views/payments/download_pdf.html.erb line #110 raised: undefined method `each' #<paymentvendor:0x329e9f8> extracted source (around line #110): 107: <td style="width:50%; border-right: 1px solid black;">item</td> 108: <td style="width:20%; text-align:right; border-right: 1px solid black;">amount</td> 109: </tr> 110: <% @pdf_vendor_details.each |details| %> 111: <% @count=@count+1 %> 112: <tr style="border: 1px solid black;"> 113: <td style="border-right:

android - Preview ringtone on selection in preferences -

i have in settings menu picking notification sound: <ringtonepreference android:key="notifications_new_message_ringtone" android:title="@string/pref_title_ringtone" android:ringtonetype="notification" android:defaultvalue="content://settings/system/notification_sound" /> it works fine, when pick sound doesn't play preview, , don't know if it's possible done. suggestions?

javascript - Click button show div and hide same div after 5 seconds -

i have email submitting form , when user submits, show confirmation text below input. after 5 seconds confirmation text has fade-out again. this code <div class="input-group newsletter-group"> <input type="text" class="form-control" id="email-to-submit"> <div id="submit-email" class="input-group-addon">go!</div> </div> <div id="email-submit-form">thanks!</div> <div id="invalid-email-warning" style="color: red; display: none;">not email address</div> $(function() { settimeout(function() { $("#email-submit-form").fadeout(1500); }, 5000) $('#submit-email').click(function() { var emailaddress = $('#email-to-submit').val(); if (validateemail(emailaddress)){ $('#email-to-submit').val(''); $('#email-submit-form&