Posts

Showing posts from May, 2010

Rails belongs_to one of two models -

i'm working 2 different models person , organization . among many other attributes, both person , organization can contractor . if working person model , wanted store contractor information contractor belongs_to :person , done it. seems contractor belongs 2 other models. i searched around on google , found lot of info how assign ownership 2 different models @ once. (for example sale must belong both buyer , seller .) in situation contractor either person or organization . there way elegantly store contractor information both models in same table? if not, figure can make 2 different contractor tables, figured might opportunity learn something. many in advance. maybe can try this. rails provide polymorphic-associtions . can try build 1 model named contractorinfo belongs contractable(use polymorphic: true), person has_one contractorinfo contractable, organization has_one contractorinfo contractable.

parse.com - How to delete all objects (rows) in Parse using c# -

basically, want clear table (or class parse names it) , repopulate new values. repopulation not issue, cannot figure out how delete objects in class. coding in c#. edit: have tried accomplish parseobject question = new parseobject("questions"); await question.deleteasync(); await question.saveasync(); i have tried grasp query, no avail. (think i) can run query, dont know how perform delete operation on data. parsequery<parseobject> query = new parsequery<parseobject>(); await query.findasync(); solved: ienumerable<parseobject> query = await parseobject.getquery(q_parse_table_name).whereequalto(q_parse_column_qset, qsetno).findasync(); foreach (parseobject po in query) await po.deleteasync(); well documentation not can give algorithmic steps can try. first, objects using query. once have got objects, can use destroy method delete data. execute save method. let me know if works. edit: try await myobject.deleteasync(); on

liferay - How to add SELECT ALL function in Search Container? -

Image
i want have select all function in search container this: this code of search container : <liferay-ui:search-container delta="5"> <%-- <c:choose> <c:when test=""> </c:when> <c:otherwise> </c:otherwise> </c:choose> --%> <liferay-ui:search-container-results results="<%= reguseraccountlocalserviceutil.getreguseraccounts(searchcontainer.getstart(), searchcontainer.getend()) %>" total="<%= reguseraccountlocalserviceutil.getreguseraccountscount() %>" /> <liferay-ui:search-container-row classname="com.pmti.bir.triu.model.reguseraccount" keyproperty="acctid" modelvar="areguseraccount" > <liferay-ui:search-container-column-text> <input name="rowchecker" type="checkbox" value="<%=areguseraccount.getacctid()%>" /> </liferay-ui:search-container-column-text> <liferay-ui:search-container

cordova - Windows phone dropdownlist choose options not showing current selected option -

i working on windows phone 8.1 universal app using cordova. getting weird issue while working dropdownlist. when tap on dropdownlist open choose item screen can select item. screen shows options start not selected option. for example have year dropdownlist start option 2001 2050. , have selected year 2025 whenever open dropdownlist shows 2001 not 2025. you need save selected option in local settings , read when open "choose item" screen. this: windows.storage.applicationdata.current.localsettings.values["year"] = "2002";

android - Disable dragging in MPAndroidChart PieChart -

how can disable dragging gesture in piechart . want chart static image. try chart.settouchenabled(false); more details can found here .

dart - Autostart chrome app on wake up mainly on chromebook to update its data in background -

i new in dart , want create chrome app should work on chromebook. i need data updated @ particular interval if app in background or chromebook has booted/woke up. is there setting or need kind of programming? if want background page active it's more complicated... first have add in permissions "background" else window background page inactive ( declare permissions ) after need keep background page alive , should @ chrome.alarms api , when alarms fired can call server retrieve information

python - How can i use a function with "variable" constants in scipy.optimize? -

how can use "variable" constants in scipy.optimize functions? trying create iterative optimisation algorithm, updates parameters in objective function after each optimisation run. to use simple example of want do: from scipy import optimize opt def f(x, r): return r * (x[0]**2 + x[1]**3) r = 0.1 # initial r value y = [] y.append([2,2]) # initial point in range(0,10): y.append(opt.fmin(f, y[i])) # how can include 'r' in line?? r = some_function_to_update_r(r) any appreciated edit: re-declare objective function each time optimise? make loop instead? for in range(0,10): def f_temp(x_temp): return f(x_temp,r) y.append(opt.fmin(f_temp, y[i])) r = some_function_to_update_r(r) or there better way? fmin supports optional args argument, representing tuple of additional arguments passed function you're trying optimize: y.append(opt.fmin(f, y[i], args=(r,))) this explained in documentation fmin ; should habi

regex - Regular expression to get only the first word from each line -

Image
i have text file @sp_id int, @sp_name varchar(120), @sp_gender varchar(10), @sp_date_of_birth varchar(10), @sp_address varchar(120), @sp_is_active int, @sp_role int here, want first word each line. how can this? spaces between words may space or tab etc. here suggest: find what : ^([^ \t]+).* replace with : $1 explanation : ^ matches start of line, ([^ \t]+) matches 1 or more (due + ) characters other space , tab (due [^ \t] ), , number of characters end of line .* . see settings: in case might have leading whitespace, might want use ^\s*([^ \t]+).*

objective c - IOS UIButton with AttributedTitle ios -

i have attributed title button in view controller, want button change it's title when clicked example : "add favorite" (clicked change to) "remove favorite" . - (ibaction)addtofav:(id)sender { nsmutableattributedstring *string,*string2; string = [[nsmutableattributedstring alloc] initwithstring:@"add favorite"]; string2 = [[nsmutableattributedstring alloc] initwithstring:@"remove favorite"]; if([_btnfav.currentattributedtitle isequaltoattributedstring:string]){ nsattributedstring *attributedtitle = [_btnfav attributedtitleforstate:uicontrolstatenormal]; nsmutableattributedstring *mas = [[nsmutableattributedstring alloc] initwithattributedstring:attributedtitle]; [mas.mutablestring setstring:@"add favorite"]; } else { nsattributedstring *attributedtitle = [_btnfav attributedtitleforstate:uicontrolstatenormal]; nsmutableattributedstring *mas = [[nsmutableattributedstring alloc] initwithattributedst

class - Trouble accessing variables from different Java classes -

i trying figure out how variable linearequation class main class. have been trying replicate results instructor's notes, hasn't been working. have seen examples close instructor did, mine still doesn't want work. right goal simple, want declare double = 1 in linear equation class , return main class , output there. main class linearequation class i see couple problems. (as mentioned @kishorekumarkorada) linearequation constructor expecting multiple arguments linearequation le = new linearequation(1,2,3,4,5,6); when call method need include parentheses system.out.print(le.geta()); your geta method should refer this.a rather a public double geta() { this.a = 1; return this.a; }

xml - How to count preceding sibling count until certain condition is fullfilled? -

i have following xml .. want count of 'step' nodes current 'step' node preceding step has node event value 'doubleclick'. <?xml version="1.0" encoding="utf-8"?> <gps> <step> <event>doubleclick</event> </step> <step> <event>click</event> </step> <step> <event>click</event> </step> <step> <event>click</event> </step> <step> <event>doubleclick</event> </step> <step> <event>click</event> </step> <step> <event>click</event> </step> <step> <event>click</event> </step> <step> <event>doubleclick</event> </step> </gps> you can use following xpath when current node step : count(

java - Exception in main thread. Do not know the reason -

package examples; import java.util.scanner; public class matrixmultiplication { public static void main(string[] args) { the below 4 sections identifies user input rows , columns of 2 matrices. scanner userrows1 = new scanner(system.in); system.out.println("enter number of rows matrix 1: "); int rows1 = userrows1.nextint(); scanner usercolumns1 = new scanner(system.in); system.out.println("enter number of columns matrix 2"); int columns1 = usercolumns1.nextint(); scanner userrows2 = new scanner(system.in); system.out.println("enter number of rows matrix 2: "); int rows2 = userrows2.nextint(); scanner usercolumns2 = new scanner(system.in); system.out.println("enter number of columns matrix 2"); int columns2 = usercolumns2.nextint(); this sets objects matrix1 , matrix2 belonging class matrix matrix matrix1 = new matrix(rows1

mysql - Insert query is not working in my php file -

i getting values csv file , inserting them sql tables. trying insert(or replace). not working. when use update query works fine , updates values correctly. not sure wrong in script. $query_insert = " insert `ps_product` ( `id_product` ,`id_supplier` ,`id_manufacturer` ,`id_category_default` ,`id_shop_default` ,`id_tax_rules_group` ,`on_sale` ,`online_only` ,`ean13` ,`upc` ,`ecotax` ,`quantity` ,`minimal_quantity` ,`price` ,`wholesale_price` ,`unity` ,`unit_price_ratio` ,`additional_shipping_cost` ,`reference` ,`supplier_reference` ,`location` ,`width` ,`height` ,`depth` ,`weight` ,`out_of_stock` ,`quantity_discount` ,`customizable` ,`uploadable_files` ,`text_fields` ,`active` ,`redirect_type` ,`id_produc

android - referencing a textview in a fragment gives a null value -

i have 2 xml files, 1 containing recyclerview(main_fragment.xml) , containing items render on recyclerview(main_item.xml). fragment(mainfragment.java) extends fragment. main_item contains textview. in mainfragment.java inflating main_fragment.xml. want reference textview in main_item.xml listen click. null pointer. because in mainfragment.java inflating main_fragment.xml , not main_item.xml. pls should should setup onclicklistener textview in main_item.xml. thanks this needs done in recyclerview.adapter , more in viewholder of adapter. there many post on that. recyclerview onclick

sql server - How can I store my Microsoft SQL Database_Diagram inside SSDT project? -

Image
i'm using microsoft sql server data tools (ssdt), in projects try keep in order. wondering if know how store database diagram ssdt project, in order don't lose work , keep model updated team? i tryed compare using schema, didn't exists. couldn't find database diagram in visual studio 2013. am wrong try use model type? there better ways it? also, possible create jobs throught ssdt? thank much, the database diagrams stored in internal tables add definitions , include data in post deploy script but end deploying environments unusual (i don't know circumstance won't wrong!). unless particularly needed diagrams in ssms else, redgate have database diagramming tool, prefer keep copy of visio 2010 pro generate them, vsd files can added project , shared between team. i assume document databases if wanted editing , designer support diagrams other ways ssdt. re: jobs, there no native object can create them in pre/post deploy scripts.

excel 2007 - Creating Pivot table and chart with multiple worksheets -

i'm facing problem regarding creating pivot table , chart multiple worksheets. i have created pivot table , chart using microsoft query. followed steps blog: http://www.ashishmathur.com/create-a-pivot-table-from-multiple-worksheets-in-the-same-workbook/ right now, i'm figuring out how can add new data pivot table. is possible add new worksheets of data created query , pivot table? or need create on again everytime add new worksheet of data? fyi: i'm using excel 2007 , data contains same no. of columns , same column names. looks need add 1 more block of unionall select * dummy2 . if you'd need weekly or daily recommend getting know basic macro editing enable pull data numerous sheets summary 1 , base sql on single sheet. sub loop_through_sheets() dim ws worksheet 'define worksheet each ws in activeworkbook.worksheets 'for each worksheet if ws.name "yourstring" 'make sure don't consolidate summary sheet call datagrab(ws) end if

javascript - Need some help scraping with CasperJS -

this have: var casper = require('casper').create(); var fs = require('fs'); var foldername = 'card_data'; var filename = 'championdecks.txt'; var save = fs.pathjoin(fs.workingdirectory, foldername, filename); // init jquery var casper = require('casper').create({ clientscripts: ['jquery.min.js'] }); // parse url var parseurl = 'http://magic.wizards.com/en/events/coverage/mtgochamp14'; // scrape function getdeckdata() { var meta = $('.deck-meta h4').text(); var event = $('.deck-meta h5').text().trim(); return [meta, event]; } casper.start(parseurl, function() { var data = this.evaluate(getdeckdata); fs.write(save, data + '\n', 'w'); }); casper.run(); i'm trying scrape http://magic.wizards.com/en/events/coverage/mtgochamp14 in format looks similar this: { "event": "2014 magic online championship", "deckname": "(

sql - How to manage orders and time zones related issues? -

in ecommerce app, scenario 1 assume server in ny, usa , client in tokyo, japan. client makes order , needs delivered in 10 days. in scenario there 2 times zones ny, usa , tokyo, japan , there 10-day promise. when client makes order how many time zone details entered database? i told colleague have consider utc how fits in this? when calculate 10 days, based on time zone 10 days needs calculated? could 1 give me link shows how handled? to reasonably sane implementation, should store dates utc. linear time independent of time zones , daylight savings time. when read time database , display user, should convert local time zone. in .net can use timezoneinfo object convert date specific time zone. when client makes order how many time zone details entered database? you need store utc time in database. exact point in time, can later convert local time. when calculate 10 days, based on time zone 10 days needs calculated? that depends on how 10 da

php - Replace letters on the whole page, but not within the tags -

i've been searching days.. no result. i want replace latin letters cyrillic ones using php. want exclude words , letters within specific tag <notranslate> so if have: <p><b>ovo je neki tekst</b> ovo sigurno <notranslate>nece preci u cirilicu</translate>, hvala !</p> i want become: <p><b>Ово је неки текст</b> и ово сигурно <notranslate>nece preci u cirilicu</translate>, хвала !</p> how this, using regex ? there 2 problems in question: 1) how transliterate latin characters cyrillic character? 2) how preserve parts enclosed between "notranslate" tags? for first question, haven't found way iconv . so, solution use strtr associative array latin characters associated cyrillic characters. note i'm not expert in cyrillic, feel free edit array fit needs. the second problem easy solve using xpath query selects text nodes haven't tag "notranslate" anc

Reading a text file in Python that has English and Arabic text -

i trying read text file has instagram public posted images , meta-data. each line has 1 complete post along meta-data. part of image post written in arabic. when using python read file, arabic text not show after printing line. arabic text appear etc. \xd9\x8a\xd8 this code snipped using read .txt file test_file = codecs.open('instagram_info.txt', mode='r', encoding='utf-8') print ("reading images urls file") counter = 0 line in test_file: print("line: ", line.encode("utf-8")) counter += 1 print(counter) if counter == 50: break test_file.close() this line example text file 100158441 25.256887893 51.507485363 centerpoint 4f09c7a6e4b090ef234993e3 http://scontent.cdninstagram.com/hphotos-xpa1/outbound-distilleryimage9/t0.0-17/obpth/9ecde7ecac7811e3b87a12bcaa646ac5_8.jpg sarrah80 25.256887893 51.507485363 2014-03-15 19:37:45 1394912265 16144 ولا راضي يوقف ي

Try/Catch with if conditions in Java/Android -

i trying catch exception , not allow app force close. hence put try , catch blow: try { string[] words = message.split(" "); strbuilder.setlength(0); numberstring = words[8]; if (numberstring.length() > 4) { numberstring = numberstring.substring((numberstring.length() - 4)); } if ((message.contains("return"))) { amountstring = words[0]; amountstring = amountstring.replace(",", ""); amountstring = getfilter(message); } else { (int = 12; < words.length; i++) { text = words[i]; strbuilder.append(text + " "); str = strbuilder.tostring(); } amountstring = words[1]; amountstring = amountstring.replace(",", ""); namestring = str; } log.e("value","= " + amountstring + namestring + numberstring); } catch (notfoundexception e) { log.e("error","

c# - The model item passed into the dictionary is of type , but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable -

i'm getting following error when trying view index view: the model item passed dictionary of type 'system.collections.generic.list1[grcwebapp.models.membershiptype]', dictionary requires model item of type 'system.collections.generic.ienumerable1[grcwebapp.viewmodels.listmembershiptypeviewmodel]'. the controller is: public actionresult listclubmembershiptype(listmembershiptypeviewmodel model, int clubid) { var types = s in db.membershiptypes (s.clubid == clubid) orderby s.type select s; return view(types.tolist()); } and view model is: public class listmembershiptypeviewmodel { [display(name = "type")] public string type { get; set; } public int clubid { get; set; } } the view is: @model ienumerable<grcwebapp.viewmodels.listmembershiptypeviewmodel> @{ viewbag.title = "club membership types"; } <h2>club m

asp.net - Cannot hide Panel in Grdivew - Object reference not set to an instance of an object -

i trying hide panel in gridview object reference not set instance of object. here code using: protected sub gvtally_rowdatabound(sender object, e system.web.ui.webcontrols.gridviewroweventargs) handles gvtally.rowdatabound if e.row.cells(2).text = "incomplete" dim panelhide panel = ctype(e.row.findcontrol("panel1"), panel) panelhide.visible = false else dim panelhide panel = ctype(e.row.findcontrol("panel1"), panel) panelhide.visible = true end if end sub and here gridview: <asp:gridview id="gvtally" runat="server" enablemodelvalidation="true" allowsorting="true" onrowdatabound="gvtally_rowdatabound" class="table table-condensed table-striped table-bordered table-hover no-margin" autogeneratecolumns="false" font-size="small"> <columns>

Get angle of view of android camera device -

i want know angle of view camera, in this question using android.hardware.camera2. how can reproduce next code using new camera2 library. camera.parameters p = camera.getparameters(); double thetav = math.toradians(p.getverticalviewangle()); double thetah = math.toradians(p.gethorizontalviewangle()); is there way same thing? as far research has gone answer no. camera2 api there no call can give vertical , horizontal viewing angle. however, don't need use camera2 api values. can use original camera api vertical , horizontal view angle , use camera2 api rest of app. as far know actual image capture firmware hasn't changed between camera , camera2 apis.

c# - How to count all digits after 2 digits, but before the decimal? -

decimal n = str.split('.')[0].substring(2).where(d => d == '0').count(s => s == '0'); displaylabel5.text = n.tostring(); this code works, counts zeros after first 2 digits input. after enter, let's say, 5360000. output 4 because there 4 zeroes. want count 6 because isnt apart of first 2 numbers. the following code takes characters before decimal mark '.' skips first 2 , counts remaing ones. var test = "335434553.23434"; var result = test.takewhile(d => d != '.').skip(2).count(); note code assumes dealing string represents valid number.

ios - Cannot use Parse library in WatchKit Extension (CocoaPods) -

Image
i'm attempting use parse in watchkit extension. started new project (objective-c) , installed latest parse (1.7.5) through cocoapods. here podfile. # uncomment line define global platform project platform :ios, '8.3' target 'watchbumptesting' pod 'parse', '~> 1.7.5' end target 'watchbumptesting watchkit app' end target 'watchbumptesting watchkit extension' end i began following tutorial on site. described how enable local data sharing, keychain sharing, , app groups. here began encounter issues... i enabled data sharing in ios app no problem. imported <parse/parse.h> in appdelegate.h file , able complete setup following code. // enable data sharing in main app. [parse enabledatasharingwithapplicationgroupidentifier:@”group.com.parse.parseuidemo”]; // setup parse [parse setapplicationid:@”<parseappid>” clientkey:@”<clientkey>”]; next, went on enable data sharing on watchkit extensi

parsing - Handling identifiers that begin with a reserved word -

i presently writing own lexer , wondering how correctly handle situation identifier begins reserved word. presently the lexer matches whole first part reserved word , rest separately because reserved word longest match ('self' vs 's' in example below). for example rules: reserved_word := self identifier_char := [a-z]|[a-z] applied to: selfidentifier 'self' matched reserved_word , 'i' , onwards matched identifier_char when whole string should matched identifier_char s the standard answer in lexer generators regex matches longest sequence wins. break tie between 2 regexes match exact same amount, prefer first regex in order in appear in definitions file. you can simulate effect in lexer. "selfidentifier" treated identifier. if writing efficient lexer, you'll have single finite state machine branches 1 state based on current character class. in case, you'll have several states can terminal states, , are te

asp.net web api - WebApi 2 and OData controller - cast exception during route configuration, GetEdmModel not understood -

i have controller i've built (extending system.web.http.odata.odatacontroller) , think it's going work fine - it's based on pure scaffolding provided visual studio ide. the application build, but, errors out during application start-up. when goes perform initial route configuration, fails on last line of webapiconfig class in app_start folder - call config.mapodataserviceroute throws invalidcastexception because value of builder.getedmmodel() isn't understood: imports system.web.http imports system.web.http.cors imports system.web.http.odata.builder imports system.web.odata.extensions public class webapiconfig public shared sub register(byval config httpconfiguration) ' web api configuration , services 'enable cross orgin scripting 'cors' dim cors = new enablecorsattribute("*", "*", "*") config.enablecors(cors) ' web api routes config.maphttpattributeroutes() config.routes.m

python - KeyError in for loop of dataframe in pandas -

i putting data bokeh layout of heat map, getting keyerror: '1'. occurs right @ line num_calls = pivot_table[m][y] know why be? the pivot table using below: pivot_table.head() out[101]: month 1 2 3 4 5 6 7 8 9 companyname company 1 182 270 278 314 180 152 110 127 129 company 2 163 147 192 142 186 231 214 130 112 company 3 126 88 99 139 97 97 96 37 79 company 4 84 89 71 95 80 89 83 88 104 company 5 91 96 94 66 81 77 87 83 68 month 10 11 12 companyname company 1 117 127 81 company 2 117 93 101 company 3 116 111 95 company 4 93 78 64 company 5 83 95 65 below section of code leading error: pivot_table

php - need explanation for wordpress plugin error message -

i'm trying make plugin work on site. can explain error message means?: warning: fopen( http://example.com/wp-content/plugins/zoomsearch/zoomsearch.css ): failed open stream: http request failed! http/1.1 404 not found in /home/me/example.com/wp-content/plugins/zoomsearch_wpplugin/zoomsearch.php on line 197

ios - Remove separator line for only one cell -

i'm trying remove separator 1 uitableviewcell . did following: - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { uitableviewcell *cell; cell = [super tableview:tableview cellforrowatindexpath:indexpath]; if (indexpath.row == 1) cell.separatorinset = uiedgeinsetszero; return cell; } (it's static cells .) when run app. separator line still there. how can remove separator line 1 cell ? on ios 8 need use: cell.layoutmargins = uiedgeinsetszero if want compatible ios 7 should following: if ([cell respondstoselector:@selector(setseparatorinset:)]) { [cell setseparatorinset:uiedgeinsetszero]; } if ([cell respondstoselector:@selector(setlayoutmargins:)]) { [cell setlayoutmargins:uiedgeinsetszero]; } add: if previous didn't work - use this. (from answer below) cell.separatorinset = uiedgeinsetsmake(0, 1000, 0, 0);

Coldfusion webservice inserting extra namespaces in SOAP response -

i have webservice in coldusion putting in namespaces/nodes in response. have tried several ways rid of namespaces nothing works. there way remove these namespaces/nodes( ) ?? <ns1:getinventorylevelsresponse> <getinventorylevelsreturn> <s:envelope> <s:header/> <s:body> ...valid nodes... </s:body> </s:envelope> </getinventorylevelsreturn> </ns1:getinventorylevelsresponse>

unix - How to create multiple directories in a fortran program -

this question has answer here: writing multiple output files in fortran 1 answer i trying design fortran77 program creates 17 directories in unix various other things, creating directories has been biggest problem that's i'd focus on @ moment. for example: do i=1,17 cmd="mkdir" ,i call system(cmd) call chdir("i") end from portion of code want command "mkdir" create 17 separate directories in unix named 1-17, when try compile program error says "invalid radix specifier" focusing on second line of code listed. another error produced focusing on same line of code. "concatenation operator @ (^) must operate on 2 sub expressions of character type, sub expression @ (^) not of character type. is there way convert integers strings? all appreciated thanks. to answer 1 of questions, can convert integer

angularjs - Refresh/Reinitialize Home Page - Angular JS -

Image
i have video plays on home page , when navigate other pages no longer shows (which want). when click on link go home page, want video start playing again or show up. want refresh page/state of home page when redirect it. have attempted few ways try , happen, no luck! here code have (this not include have tried). what want happen when click away home page , click on link (shown in index.html snippet) want page go it's original state of when video showed , played. no longer see video. assumption when move away , come home page, controller doesn't reinit, since it's created. want try , refresh or reinit home page index.html homectrl homesvc app.js i appreciate help!! the function on event $routechangestart make issue. because when leave home page, player stopped , removed dom. when come home page, he's removed. are obliged remove player stopping ? keep playing when go other page if don't delete ? try removing part below , tell witho

c++ - Ubuntu Illegal Instruction opencv -

i installed opencv on ubuntu 12.04.5 repository using command. sudo apt-get install libopencv-dev python-opencv when try run following code confirm works illegal instruction (it compiled fine). #include "opencv2/core/core.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/highgui/highgui.hpp" #include<iostream> using namespace std; int main(){ cv::mat img; img = cv::imread("ro.ppm"); cout << img.size() << endl; return 0; } i compiled using command (due undefined reference errors). g++ -o test test.cpp $(pkg-config opencv --cflags --libs) update: commenting out cout line not change result , i've triple checked ro.ppm exists in directory (even if didn't imread doesn't throw error illegal or not found input in experience). guess question two-fold causes illegal instruction errors , how fix it? you can't cout cv::size directly without overloading '<<

r - Using a for loop to extract coefficients from multiple models -

i have multiple cox models (with 1 variable static in models) , trying extract coefficient variable. in models coefficient indexed follows: example in model1 model1[[8]][1] ; model2 model2[[8]][1] etc. attempted create loop r shown below not working. could me why getting error when running following code for (i in 1:5) { coef[i] <- exp(summary(model[i])[[8]][1]) } i following error "object 'model' not found". many in advance a here example of meant in comment data(iris) model1 <- lm(data = iris, sepal.length ~ sepal.width + species) model2 <- lm(data = iris, sepal.length ~ sepal.width) you can don't have type models. model.list<-mget(grep("model[0-9]+$", ls(),value=t)) ls() lists object have , grep() taking objects have names "model" followed number. coefs<-lapply(model.list,function(x)coef(x)[2]) unlist(coefs) sepal.width sepal.width 0.8035609 -0.2233611

How to use EF Core (EF7) with Mysql server? -

i developing asp.net 5 (now called asp.net core) on linux. cannot connect between ef7 (now called ef core) , mysql server. please tell me solution knew. thanks. all available providers listed @ https://docs.microsoft.com/en-us/ef/core/providers/ . @ time of writing, there 3 different ef core providers, 2 community versions , 1 official version. update sept 15, 2016 mysql released first version of official provider ef core. https://www.nuget.org/packages/mysql.data.entityframeworkcore there community version of mysql provider https://www.nuget.org/packages/pomelo.entityframeworkcore.mysql update may 23, 2016 mysql has announced (quietly) building ef core 1.0 provider. there no details yet on availability. see https://docs.efproject.net/en/latest/providers/mysql/index.html also, devart announced month ago (proprietary, not-free) providers support ef 7 on .net framework only, including mysql provider. no news yet intention support .net core. http://blog.deva

How to run Matlab code on an Android device? -

i run matlab code on android device. there java builder in matlab, can create java classes m-files. requires matlabruntime installed on target machine. use matlab on windows, java builder creates matlabruntime *. is there way run m-files on android smartphone? it's not possible use of deployment products (including matlab compiler , matlab builder java) run matlab code on android. deployed components of products depend on matlab compiler runtime, has larger footprint android device handle. you consider either writing app connects, @oli suggested, matlab code (or deployed matlab code) running somewhere on server using matlab coder, can convert subset of matlab language c code integrated app.

java - Inversion Count using Divide And Conquer -

i trying implement program counts number of inversions, not working big input size(100,000). the unsorted numbers picked txt file. program works small input size 10 or 15 or 20. but when copy input link: http://spark-public.s3.amazonaws.com/algo1/programming_prob/integerarray.txt program keeps running several seconds without producing output. i have used divide , conquer algorithm based on merge sort , implemented in bluej. here code. import java.util.*; import java.io.*; class inversion { private static linkedlist<integer>arr; private static scanner s; private static long count=0; public static void count_inv(int low,int high) { if(high<=low) return ; else { int mid= low + (high-low)/2; count_inv(low,mid); count_inv(mid+1,high); split_inv(low,high); } } public static void split_inv(int low,int high) { int mid=low+ (high-low)/2; int i=low,j=mid+1; int k=0; int []aa=new int

sql server 2008 r2 - Working on .mdf and .sdf at the same time -

is possible open .mdf , .sdf database types in same sql sever management studio session? i have tried, , did not work. guessing either have configured wrong or not compatible. can open each separately of course using appropriate database provider when opening ssms. i hoping there way or maybe other ms tool, plug in or app don't have allow them work together. i hoping use tsql populate compact db appears need code app or this. suggestions on porting data compact? use free visual studio add-in "sql server compact toolbox", lets move data , schema sql server compact in single click

c - HTTP Server Not Sending Complete File To WGET, Firefox. Connection reset by peer? -

i'm writing http server, , having trouble sending larger files. if grab them netcat, output seems perfect. if use browser or wget, complete file sometimes. wget keeps getting "connection reset peer" errors, see output below. firefox says "the connection reset". here's relevant procedure sends data client: int handle_request(int sockfd, struct cached_file content) { char buffer[1024]; // fixme hardcoded arbitrary buffer size header unsigned int sent_bytes; unsigned int total = 0; unsigned int bytes_left = content.size; printf("i have send %u bytes of content.\n", content.size); snprintf(buffer, 1024, "http/1.1 %s\ncontent-type: %s\ncontent-length: %s\n\n", content.statuscode, content.contenttype, content.sizestring); sent_bytes = send(sockfd, buffer, strlen(buffer), msg_more); printf("i wanted send %u bytes of header, , sent %u.\n", strlen(buffer), sent_bytes); while (total < byt

css - Responsive E-mail -

i'm making responsive email. code works everywhere except outlook 7 & 10. know has padding , margin, , tried fix this, it's still not working. has solution ? tried said : https://litmus.com/help/email-clients/outlookcom-margins/ so changed margin tags : margin-left:5%; margin:0 0 0 5%; i hope can me this. thanks in advance can paste code? depending on trying add margin , padding to, there number of ways insure works across email clients, dreaded outlook. if trying add padding images, don't bother. outlook 2007 , 2010 strip padding images. if think margins trick, consider outlook.com doesn't support margin. for images best way insure have space around images add faux margins adding transparency around image before save it. for <td> use padding. padding in <td> supported on email clients. <td style="padding-top:12px;padding-right:12px;padding-bottom:12px;padding-left:12px;">

c# - InternalsVisibleTo attribute ignored when compiling solution via Roslyn -

so developing roslyn-based frontend compiler parses c# solution, performs rewriting on syntax trees desugar constructs of dsl, , uses roslyn apis compile , emit executables/dlls. last part, given compilation, done (some details omitted clarity): var compilation = project.getcompilationasync().result; var compilationoptions = new csharpcompilationoptions(outputkind, compilation.options.modulename, compilation.options.maintypename, compilation.options.scriptclassname, null, compilation.options.optimizationlevel, compilation.options.checkoverflow, false, compilation.options.cryptokeycontainer, compilation.options.cryptokeyfile, compilation.options.cryptopublickey, compilation.options.delaysign, platform.anycpu, compilation.options.generaldiagnosticoption, compilation.options.warninglevel, compilation.options.specificdiagnosticoptions, compilation.options.concurrentbuild, compilation.options.xmlreferenceresolver, compilation.options.sourcereferenceresol

regex - Extracting each unique data from a string -

i have been trying set regex extraction process following no avail. i have set of date values in formats follow. need able extract these unique individual dates. if there single value, standard simple format of mm/dd/yyyy. 1 easy. if there more 1 date value, can in format follows: feb 5, 12, 19, 26, mar 4, 11 2016 i need turn these 02/05/2016, 02/12/2016, etc. eventually inserting these dates database. am going in wrong way? advice. assuming there no deviations or anomalies in data you're regexing, following regex can applied case-sensitivity set , allow access information need. regexs, it's important "know data" because variable can alter construction of regex -- balance between specificity , clarity important since regexs can become unwieldy , cryptic. save months as: ([a-z][a-z][a-z]) // can $1 variable (useful later) save day values as: \s*(?:([0-9]?[0-9]),\s)* // $2 variable should work access list of values save year values as: (

php - Regex to replace tags content -

i have problem code: $message='<ha>hello</ha>'; $message = str_replace('<ha>(.*?)</ha>', '<ha>bye</ha>', $message); echo $message; the output still hello although want bye..it might simple using regex first time. in advance use preg_replace function: $message='<ha>hello</ha>'; $message = preg_replace('/<ha>(.*?)<\/ha>/', '<ha>bye</ha>', $message); echo $message; // gives: <ha>bye</ha> demo: http://sandbox.onlinephpfunctions.com/code/9b0a2239a891223472e93f8a362e5946e5719df0

visual studio 2013 - How do I configure a solution in VS2013 to use a project branch? -

i have solution includes multiple projects. making changes database require different schema , connection string while i'm working on this. the solution explorer window looks like: solution - bll project - website project - dal project - console project - second website project the actual directory structure looks like: \source\workspaces\teamname\bll \source\workspaces\teamname\website \source\workspaces\teamname\dal \source\workspaces\teamname\console \source\workspaces\teamname\secondwebsite \source\workspaces\teamname\solutionfiles i can branch individual projects being changed enough. it's @ point stuck. of have found on , other online resources not explain how switch projects within solution branched version. do need create new solution file branch , replace projects within branched versions? branch entire teamname directory including solution , projects.

excel - VBA TimeValue() and Spreadsheet Formula TimeValue() -

Image
good morning all, i have on 20,000 time inputs in column such 6/23/2015 1:05:37.7 pm , need transfer in time value excel can manage. i managed find workaround: set wrtb = worksheets("test bench data") wrtb.usedrange lastrowtb = wrtb.usedrange.rows.count lastcolumntb = wrtb.usedrange.columns.count if lastrowtb > 1 'makes sure there data on worksheet if wrtb.cells(7, lastcolumntb) <> "" 'makes sure time has not been formated dim atempstb variant, tempstb() string redim tempstb(lastrowtb - 7, 1) atempstb = wrtb.range(wrtb.cells(8, 2), wrtb.cells(lastrowtb, 2)) = 1 lastrowtb - 7 tempstb(i - 1, 0) = right(atempstb(i, 1), 13) next wrtb.range(wrtb.cells(8, lastcolumntb + 2), wrtb.cells(lastrowtb, lastcolumntb + 2)).numberformat = "[h]:mm:ss.000" wrtb.cells(8, lastcolumntb + 2).formular1c1 = "=timevalue(rc[-1])" wrtb.cells(8, lastcolumntb + 2).aut

php - Why does COALESCE order results in this way? -

Image
i have table 3 columns, id, comment, , parent. if parent id null, comment root comment, , if not, means comment reply another. use following query: select * `comment` order coalesce( parent, id ) desc limit 0 , 30 this query orders last inserted comment it's replies, don't understand logic. why ordered way? the coalesce() function returns first non-null argument received. so, if go through each row , compare parent/id column, you'll see ordered this: 7 (because parent null) 2 (because parent null) 2 (parent not null, used) 1 (because parent null) 1 (parent not null, used) 1 (parent not null, used) which in descending order, specified. i suspect there may confusion here. let me reiterate. coalesce(parent, id) return first value out of 2 not null . if parent not null, returned. if null, falls on id , returns that. if @ list of rows side side , see return values, may more clear: | parent | id | return_value | +--------+----+--------------+ |

google analytics core api results sampling level -

Image
i have script pulling data google analytics core api. since using results of data populate sheet in gsheets know data pull success. i'm reading documentation here . in particular, table: however, logger.log() sampling level of query: // check sampling each report if(!results.containssampleddata) { logger.log('sampling: none'); } else { logger.log('sampling: ' + results.query.samplinglevel); } when view logs 'sampling: undefined'. how sampling results results object? here generates results object, though don;t think it's relavant (but may wrong): // ga data core api function getreportdataforprofile(profile, len_results, start_num) { var startdate = getlastndays(30); // set date range here var enddate = getlastndays(0); var optargs = { 'dimensions': 'ga:dimension5, ga:dimension4', // comma separated list of dimensions. 'start-index': start_num, 'max-results': len

sql server 2008 - how to verify DPFP finger print from MS SQL in C# -

i have saved dpfp template in varbinary(max), retireivng database , converting in byte[] deserilizing it, , putting in verify() method, error occcruing exception hresult: 0xfffffff8 how getting data given below sqlconnection cn = new sqlconnection(@"data source=windows\me;initial catalog=enroll;persist security info=true;user id=sa ; password=sa123"); cn.open(); sqldataadapter adp = new sqldataadapter("select varb employee employeeid='127'", cn); datatable dt = new datatable(); adp.fill(dt); bytes= convertdatasettobytearray(dt); template = new dpfp.template(); template.deserialize(bytes); <b>verificator.verify(features, template, ref result);</b> updatestatus(result.farachieved); if (result.verified) makereport("the fingerprint verified."); else makereport("the fingerprint not verified."); this verify() not verifying data coming db> where doing mistake? in conversion? or in not getting data properly

classloader - Get list of all loaded classes through JMX -

i have little java program makes jmx connection remote weblogic server. want list of loaded classes. i have objectname object "java.lang:type=classloading" . (how) possible? thanks it not possible. default jvm platform mxbeans don't publish information.

directx - ScreenCapture of the presently running application on Monitor -

i want make standalone application can capture screen run-time , display on external monitor. know duplicating monitor works interested in making app it. i went through various forum questions solution , inclined on doing directx way. turns out directx way can capture screen of app running through d3d. not possible create standalone screencapturer using directx. correct me if wrong. made conclusion based on question asked here it suggested using dxgi approach in same thread. please me out here. i mention again want create standalone screenrecording application casts content running on main desktop onto external monitor. i new directx programming don't know intricacies involved. amount of advice on creating best (fastest) standalone screen capture application appreciated. actually directx can capture not window painted d3d whole screen this: http://imgur.com/fojhnwa i finished program yesterday :p on computer, using gdi+ (bitblt) costs 60ms take 1080p sc

javascript - Unable to serve.terrain files in cesium sandcastle -

i learning 3d terrain generation using cesiumjs. generated .terrain files usind cesium terrain builder , kept them in 'cesium/apps' directory testing purposes , avoid cors issues. whenever, try generate terrain error tile @ x:0 y:0 level 0 tile @ x:1 y:0 level 0 not found though added empty files @ specified locations. this older question, stumbled upon throughout research i'll detail bit. after you've managed generate terrain tiles, obvious @ time option serve them https://github.com/geo-data/cesium-terrain-server . server written in go requires go present on system. build intention ease development , testing of terrain tiles created cesium terrain builder tools . my own objective serve .terrain tiles apache server , turned out pretty easy, after inspecting in fiddler cesium-terrain-server serving , after finding exchange of messages (look kevin ring's reply). besides cors , terrain files need have mime type application/octet-stream , if gz