Posts

Showing posts from February, 2012

c# - How to run 2 async functions simultaneously -

i need know how run 2 async functions simultaneously, example check following code: public async task<responsedatamodel> datadownload() { responsedatamodel responsemodel1 = await requestmanager.createrequest(postdata); responsedatamodel responsemodel2 = await requestmanager.createrequest(postdata); //wait here till both tasks complete. return result. } here have 2 createrequest() methods runs sequentially. run these 2 functions parallel , @ end of both functions want return result. how achieve this? if need first result out of 2 operations can calling 2 methods, , awaiting both tasks `task.whenany: public async task<responsedatamodel> datadownloadasync() { var completedtask = await task.whenany( requestmanager.createrequest(postdata), requestmanager.createrequest(postdata)); return await completedtask; } task.whenany creates task complete when first task of of supplied tasks completed. returns 1 task completed can resu...

php - mysql query AND with OR not work -

in query want write logic , operation or . query not work. select * `data` `city`='mycity' , performdate='4' , (curtime() >= `valid_from` or curtime() <= `valid_to`) , perform_type='ptype' i think (curtime() >= `valid_from` or curtime() <= `valid_to`) this logic not work untested --- $time = curtime(); select * data city = 'mycity' , performdate = '4' , perform_type = 'ptype' , ($time >= 'valid_from' or $time <= 'valid to'); source: http://www.techonthenet.com/mysql/and_or.php

ruby - Rails 4 HABTM has_many :through -

team, looking specific (newbie) situation on rails 4 association. have 3 models: class brand < activerecord::base has_many :lines, dependent: :destroy has_many :products, through: :lines, dependent: :destroy end class line < activerecord::base belongs_to :brand has_and_belongs_to_many :products end class product < activerecord::base has_and_belongs_to_many :lines has_many :brands, through: :lines end this configuration works when trying check products under specific brand (or line ) , viceversa: different brands (or lines ) available specific product . however, when comes delete/destroy there issue. getting rspec error: activerecord::hasmanythroughcantassociatethroughhasoneormanyreflection: cannot modify association 'brand#products' because source reflection class 'product' associated 'line' via :has_and_belongs_to_many. we have made research on exception, checked rails api, no luck, examples found showing different model configu...

python call a function with kwargs -

i have function: def myfunc(): kwargs = {} = 1 b = 2 kwargs.update(a=a, b=b) newfunc(**kwargs) and newfunc def newfunc(**kwargs): print its not giving value of 1 whats wrong ? two things. first, kwargs argument in myfunc empty dict, won't pass parameters. if want pass value of a , b newfunc , can either use kwargs = {'a':1, 'b':2} newfunc(**kwargs) or newfunc(a=1, b=2) in both cases, 'a' , 'b' in kwargs dict of newfunc function. second, should extract argument kwargs dict in newfunc . print kwargs.get('a') should suffice.

Crashlytics : Android Studio Gradle Error related to XML -

i getting error while building app crashlytics error:(2) error parsing xml: prefix must not bound 1 of reserved >namespace names there com_crashlytics_export_strings.xml added crashlytics automatically. mind file added module project inside main project . main project doesn't have file. use android studio plugin. has following content. <?xml version="1.0" encoding="utf-8" standalone="no"?> <resources > <!-- file automatically generated crashlytics uniquely identify individual builds of android application. not modify, delete, or commit source control! --> <string xmlns:ns0="http://schemas.android.com/tools" name="com.crashlytics.android.build_id" ns0:ignore="unusedresources,typographydashes" translatable="false">0acfc26a-32c4-4a2e-b19b-fullkey</string> </resources> while building following file generated. @ xmlns:ns0 turn xmlns:ns1 in generated ones ...

c# - In repository pattern, should I use database model as my View model or should I create separate ViewModel for that? -

self explanatory, have model map 1:1 db example: public class user { [key] public int userid { get; set; } public string firstname { get; set; } public string lastname { get; set; } } is there downside if use in view cshtml example : @model user or should create viewmodel this public class userviewmodel { [required] public string firstname { get; set; } [required] public string lastname { get; set; } } and bind view @model userviewmodel the idea of programming view should not know data comes ... using database model in view breaks sign . the best use viewmodel , , in future pleased choice example, view might 1:1 database table, imagine designer wants add recent "messages", that's new table call based on user... with viewmodel can add , edit view , controller, if use 1:1 need create brand new viewmodel... then, views have viewmodels , don't... messy! to out, can use automapper viewmodels construction, a...

SQL server 2012 - return variable value from a dynamic script -

i'm trying run dynamic script return variable can pass in rest of script. i've couple of ways of google, think still haven't got syntax correct, therefore getting error or null value returned. can please advise i've gone wrong. for example: return value variable @table_name asia database , set variable appended table name retrieved table , t5148 id table turn table name variable. have set variables script sits when other scripts loops thank you declare @table_name nvarchar(50) declare @database nvarchar(50) declare @id nvarchar(50) declare @sql nvarchar(max) set @database = 'asia' set @id = 't5178' set @sql = n'select @table_name = ''@database''+table_name ''@database''+tables (nolock) id = ''@id''' exec sp_executesql @sql, n'@table_name nvarchar(50) output', @table_name output select @tran_table if not wrong, need : declare @table_name nvarchar(50) decl...

reactjs - React Native - Call Function of child from NavigatorIOS -

i trying call child function right button on parent navigator. a basic code example of need follows: main.js <navigatorios style={styles.container} initialroute={{ title: 'test', component: test, rightbuttontitle: 'change string', onrightbuttonpress: () => ***i want call miscfunction here*** , passprops: { fbid: this.state.fbidprop, favspage: true } }}/> test.js class test extends react.component{ constructor(props){ super(props); this.state = { variable: 'some string' }; } miscfunction(){ this.setstate({ variable: 'new string' }; } render(){ return( <text> {variable} </text> ) } } this covered in following github issue: https://github.com/facebook/react-native/issues/31 eric vicenti comments describe how faceb...

c# - How to select an attribute value in an XML and concatenate it with a string and use it as an attribute value in a new XML using XSLT -

i need transform existing xml xml using xslt. the problem facing need use "typename" attribute ecclass , concatenate http://www.semanticweb.org/aman.prasad/ontologies/2015/5/untitled-ontology-1# the xml working - <ecschema> <ecclass typename="abc"> <baseclass>pqr</baseclass> <baseclass>xyz</baseclass> </ecclass> <ecclass typename="ijk"> <baseclass>mno</baseclass> <baseclass>def</baseclass> </ecclass> <ecschema> for example concatenated result should - http://www.semanticweb.org/aman.prasad/ontologies/2015/5/untitled-ontology-1#abc first ecclass i need set string attribute value of rdf:about in owl:class tag in new xml structure. the new xml structure - <owl:ontology rdf:about="http://www.semanticweb.org/aman.prasad/ontologies/2015/5/untitled-ontology-1"> <owl:class rdf:about="ht...

php - MS SQL, invalid object name -

okay, let me make short, can delete whole row database using code: $sql = "delete [master].[dbo].[testtbl] agent_id = '{$_session["agentid"]}' "; but when try: $sql = "delete username [master].[dbo].[testtbl] agent_id = '{$_session["agentid"]}' "; i tried make [name], still invalid object name username... i want delete username of agent_id appreciated. :d delete username [tablename] ^ you cant delete 1 column using delete command. have delete whole row delete [tablename] want delete username of agent_id you can use update command change information update [tablename] set username=null agent_id=1 // or whatever value

c# - Deserializing an array of objects with Json.Net -

Image
the received data this: inside each item, there object, customer , have identical class that. how can convert them using json.net? i have tried followings: var data = jsonconvert.deserializeobject<list<customer>>(val); and adding class: public class customerjson { public customer customer{ get; set; } } and trying deserialize it: var data = jsonconvert.deserializeobject<list<customerjson>>(val); with both of them exception: cannot deserialize current json object (e.g. {"name":"value"}) type 'system.collections.generic.list`1[customer]' because type requires json array (e.g. [1,2,3]) deserialize correctly. fix error either change json json array (e.g. [1,2,3]) or change deserialized type normal .net type (e.g. not primitive type integer, not collection type array or list) can deserialized json object. jsonobjectattribute can added type force deserialize json object. path 'rows', line 1, positi...

javascript - Onclick in dropdown toggle is not working -

i have toggle-dropdown , trying call function read(); upon clicking dropdown. not working, have tried using ondrop , onchange , others.. <a data-toggle="dropdown" class="dropdown-toggle" onclick="read();"> <i class="fa fa-globe"></i> <span class="badge"> <%=unread%> </span> </a>

What is netbeans doing now? -

this getting tedious. created test project, simple java hello, test problem have in project. having created project, run , build jar. then added ivy stuff , tried build did not work. ivy stuff consisted of ivy.xml ivysettings.xml , 2 tasks added otherwise default netbeans build.xml. so removed ivy files , ivy sections build.xml. did diff on , previous unedited build.xml file , identical. so why after clean build error? /home/tester/workspace/netbeans/foo/nbproject/build-impl.xml:63: source resource not exist: /home/tester/workspace/netbeans/foo/lib/nblibraries.properties correct file not exist , not exist in other project have access whether use ivy or not. i have reset did yet netbeans cannot continue. have tried work out how hell nb builds project got lost. don't know say. i guess nb , myself differ on clean means , on whether task should able produce exact same results everytime given same input, nb not seem able do. or cannot recover real world or documentatio...

javascript - Click-triggered scrollTop takes random amount of time to fire -

i have comment section automatically scrolls view when scroll (using jquery scrolltop ), , button scrolls when click it. first scrolling action runs perfectly, second scrolling action takes seemingly random amount of time occur after button pressed. a live demonstration can found here: www.rouvou.com/kanyewest . go down comment section, , scroll fire first jquery scroll. click "back" button fire second scroll. might work instantly first few times try it, if enough, should delayed eventually. html <div id="comment-section"> <div id="comment-background-up">back</div> <div id="good_comments"><!--content--></div> <div id="bad_comments"><!--content--></div> </div> jquery $("#good_comments").scroll(function() { $('html, body').animate({ scrolltop: $("#good_comments").offset().top }, 700); $("#comment-background-up...

Getting duplicate items when querying a collection with Spring Data Rest -

i'm having duplicate results on collection simple model: entity module , entity page . module has set of pages, , page belongs module. this set spring boot spring data jpa , spring data rest . the full code accessible on github entities here's code entities. setters removed brevity: module.java @entity @table(name = "dt_module") public class module { private long id; private string label; private string displayname; private set<page> pages; @id public long getid() { return id; } public string getlabel() { return label; } public string getdisplayname() { return displayname; } @onetomany(mappedby = "module") public set<page> getpages() { return pages; } public void addpage(page page) { if (pages == null) { pages = new hashset<>(); } pages.add(page); if (page.getmodule() != this) { page.setmodule(this); } } @override public boolean eq...

docker - What does the DOCKER_TLS_VERIFY and DOCKER_CERT_PATH variable do? -

i new docker, using boot2docker on windows 7. while trying configure docker build through spotify maven plugin, asked set below env variables : docker_host docker_cert_path docker_tls_verify configuration successful not sure docker_tls_verify , docker_cert_path variables ? as mentioned in readme : by default, boot2docker runs docker tls enabled . auto-generates certificates , stores them in /home/docker/.docker inside vm. boot2docker up command copy them ~/.boot2docker/certs on host machine once vm has started, , output correct values docker_cert_path , docker_tls_verify environment variables. eval "$(boot2docker shellinit)" set them correctly. we recommend against running boot2docker unencrypted docker socket security reasons, if have tools cannot switched, can disable adding docker_tls=no /var/lib/boot2docker/profile file. in more dynamic environment, boot2docker ip can change, see issue 944 .

javascript - How to use draw:deletestart in leaflet -

i want perform operation when user clicks on delete button in leaflet. how doing : map.on('draw:deletestart', function(e) { alert("started"); }); but not triggering when click delete button. kindly suggest. i doing in internet explorer. ran same code in mozilla firefox , chrome , it's working fine.

sql - How to convert SSRS report to .svc file using a scheduled job? -

i in need of fetching data sql server 2012, create file (e.g. excel) , export file shared location. how achieve using ssrs? have been suggested convert ssrs report file .svc file type using job schedule. sounds bit peculiar me. suggest, please? thanks in advance. you can achieve using subscriptions (if not running sql server express). take @ this: https://msdn.microsoft.com/en-us/library/ms156307.aspx i think that's far easiest solution - few clicks , you're done ;-)

python - Simple explanation of security issues related to input() vs raw_input() -

i reading python 2.7 tutorial , they're going on raw_input() , , mentions that: the input() function try convert things enter if python code, has security problems should avoid it. i tried googling explanations this, still bit unclear me; what's simple explanation of alleged inherent security issues input() vs raw_input() ? the input() function in python 2.x evaluates things before returning. so example can take @ - >>> input("enter : ") enter : exit() this cause program exit (as evaluate exit()). another example - >>> input("enter else :") enter else :__import__("os").listdir('.') ['.gtkrc-1.2-gnome2', ...] this list out contents of current directory , can use functions such os.chdir() , os.remove() , os.removedirs() , os.rmdir()

javascript - Form value not passing in angularjs -

here app.js, want send value of email file handler.php $scope.doforget={email:''}; $scope.doforget = function (customer) { //email = $scope.forget.email; testing hardcoding value email = 'abc@xyz.com'; data.post('handler.php', { email: email }).then(function (results) { console.log(results); }); }; in inspect element -> networks can see form values {email: "abc@xyz.com"} in handler.php use print values print_r($_post); , print_r($_get); getting empty array i.e., array ( ) how can values ? update : i tried 1 $scope.doforget={email:''}; $scope.doforget = function (email) { email = 'abc@xyz.com'; data.post('eloquent.php', { email: email }).then(function (results) { console.log(results); }); }; just use in angular's controller : var emailnew = "demo@demo.com"; $http({ method : 'post', ...

c++11 - Defining a Discrete Probability Distribution in C++ -

i have been trying create own discrete distribution in visual studio (c++). kept getting same error. tried example code from: http://www.cplusplus.com/reference/random/discrete_distribution/discrete_distribution/ . again, same error appeared example code. the line of code (from link) giving me error is: std::discrete_distribution second(init.begin(), init.end()); particularly, init.begin() underlined in red. the 2 errors follows: error c2661: 'std::discrete_distribution::discrete_distribution' : no overloaded function takes 2 arguments intellisense: no instance of constructor "std::discrete_distribution<_ty>::discrete_distribution [with _ty=int]" matches argument list argument types are: (std::_array_iterator, std::_array_iterator) why compiler not work? wondering if other people getting same errors? updated version of visual studio make sure wasn't old bug the problem due bug in vs express 2013. installing vs community 2015, er...

PHP print files in directory to printer -

i'm trying print files directly html button called print , code: if($handle = printer_open("\\\\servername\\printername")){ printer_set_option($handle, printer_mode, "raw"); $output = "file.pdf"; printer_write($handle,$output); printer_close($handle); } but, code doesn't work, did miss something? if put echo "test" inside if statement, echoed, , means printer path correct, right? the function printer_open not native php call. exists in specific packages available online, not work without recompiling php package installed. useful script others, including myself, have used in past hand directly system call. system("lp $filename"); there many options can add in system call; 1 option needed destination printer. can check man page lp details.

javascript - Create a JSON object dynamically Angular -

i have json object of below format. currently, hard coded. however, dynamically create json. i have object need loop through , form json object [ { name: "test1", enable: true, unit: 24350, unit_price: 1.0368, composition: [ { asset: "asset1", percentage: 15 }, { asset: "asset2", percentage: 10 }, { asset: "asset3", percentage: 5 }, { ...

r - Using vectors as inputs in new variables -

my data frame spdata, includes date, open price, closing price , volume s&p500 last 25 years (~ 250 days per year). additionally, have spdata$year , vector year date column stored numerically, 1990 - 2015. library(dplyr) spdata1990 <- filter(spdata, year == 1990) results in data frame ~250 observations, 1 each trading day in 1990. did 25 years already. is there way create formula save other data corresponding each year new data frame (spdata1991, spdata 1992, spdata1993, etc.)? trying think through for(i in years) loop corresponding formula, years <- unique(spdata$year, false) , not familiar enough programming in general figure out. thanks with @user20650... # reproducible example! set.seed(123) year_range = 1990:2014 spdata <- data.frame(year=sample(year_range,1000,replace=true), sales=runif(1000,min=100,max=200) ) # split list data frames on "spdatayyyy" , store in global environment list2env(split(spdata, paste0(...

javascript - Deferring google charts -

i have google charts code works fine: <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript" async> google.load("visualization", "1", {packages:["corechart"]}); var t1 = 'indextitle' var t2 = 'indicatortitle' google.setonloadcallback(function(){drawchart1(t1)}); google.setonloadcallback(function(){drawchart2(t2)}); function drawchart1(t){ var data = new google.visualization.datatable(); data.addcolumn('string','date'); data.addcolumn('number','close'); data.addcolumn({type: 'string', role: 'tooltip'}); data.addrows([chartindexdata...........]); var options = { title: t, colors:['black'], legend: {position: 'none'}, chartarea:{left:60,top:20,width:'90%',height:'90%'} }; var chart = new google.visualization.linechart(document.getelemen...

Android SDK - camera2 - Draw rectangle over TextureView -

im new android development, , i'm finding hard find examples on camera2 api. im working way through issues, on 1 stuck. in default camera, when touch screen focus, shows rectangle of focus area moment. want similar (or in case, exact same thing start off can figure out). i read somewhere (i think textureview page in sdk docs) cant draw on textureview while being used camera preview - , calling lock method return null rather canvas. i found online: https://github.com/commonsguy/vidtry/ cant work. either errors saying my main view cant cast drawable view, or vice versa - or drawable view on top , makes screen black - or on bottom , wont respond touch events (and trying force performclick view above casues crashes.) im stuck! can give me explanation or example of how can draw rectangle on event position few sconds? thanks! first example of camera2 api android there open source google sample code. https://github.com/googlesamples/android-camera2basic second pa...

sql - Select top N from group records -

i need list frist record when price changed. using below example. invoice table records (group customer price , sorted date) index customer date price 01 may-01-2016 $12.00 02 may-11-2016 $12.00 03 may-21-2016 $13.00 04 may-22-2016 $13.00 05 may-23-2016 $13.00 06 may-24-2016 $13.00 07 jun-01-2016 $14.00 08 jun-11-2016 $14.00 09 jun-21-2016 $14.00 10 jun-25-2016 $14.00 11 b may-02-2016 $12.50 12 b may-12-2016 $12.50 13 b may-22-2016 $13.50 14 b may-24-2016 $13.80 15 b may-26-2016 $13.80 16 b may-28-2016 $13.80 17 b jun-02-2016 $14.60 18 b jun-12-2016 $14.60 19 b jun-22-2016 $14.60 20 b jun-26-2016 $14.60 i need first record when price changed. result be: 01 may-01-2016 $12.00 03 may-21-2016 $13.00 ...

SQL Server : function to display previous Friday's date if @date is not a Friday -

i newbie advanced sql, need write svf in sql server return previous friday's date if parameter date entered not friday. for example, today wednesday, 7/1/2015, function should return previous friday 6/26/2015. suppose today friday 7/3/2015, function return 7/3/2015 (no change). ask if can edit following code: create function fndatecheck (@date datetime) returns @fridaydate date begin declare @fridaydate if return else if return end go i found reference post, quite similar asking it's not function: get last friday's date unless today friday using t-sql declare @date datetime; set @date = '2012-08-10' select case when datepart(weekday, @date) > 5 dateadd(day, +4, dateadd(week, datediff(week, 0, @date), 0)) else dateadd(day, -3, dateadd(week, datediff(week, 0, @date), 0)) end thanks much!! the script found works fine. need write function. create function fndatecheck ( ...

php - How to safely chain methods? -

is there way "safely" chain methods in php , return null if previous method returns null ? otherwise, error thrown: trying property on non-object ; for example, following code checks whether customer's phone number has changed using quickbooks sdk. don't have control on these methods. $customer->getprimaryphone() return object since form wouldn't have been submitted otherwise, $old->getprimaryphone() may return null if no phone number existed previously. the following required phone number: $old->getprimaryphone()->getfreeformnumber() if getprimaryphone() returns null, error thrown. my question is: how avoid code repition in following case? if (!empty($old->getprimaryphone())) { if ($customer->getprimaryphone()->getfreeformnumber() !== $old->getprimaryphone()->getfreeformnumber()) { // repetive code here } } else { // repetive code here } i'd inclined implement equals metho...

python 2.7 - `TypeError: invalid type promotion` when appending to a heterogeneous numpy array -

i have created array with: ticket_data = np.empty((0,7), dtype='str,datetime64[m],datetime64[m],str,str,str,str') and trying append data with: lineitem = [str(data[0][0]), opendt, closedt, str(data[0][11]), str(data[0][12]), str(data[0][13]), str(data[0][14])] where opendt , closedt created np.datetime64(dtstring, 'm') i getting error: traceback (most recent call last): file "daily report.py", line 25, in <module> np.append(ticket_data, np.array([lineitem]), axis=0) file "c:\python27\lib\site-packages\numpy\lib\function_base.py", line 3884, in append return concatenate((arr, values), axis=axis) typeerror: invalid type promotion edit: print np.array([lineitem]) outputs [['21539' '2015-06-30t10:46-0700' '2015-06-30t10:55-0700' 'testtext' 'testtext2' 'testtext3' 'testtext5']] and print np.array([lineitem], dtype=t...

TCP Inbound Endpoint - Mule ESB - multithreading -

i have tcp inbound endpoint references tcp connector. request-response endpoint. tcp client 3rd party application sends requests on 1 socket. how have set tcp endpoint. endpoint: <tcp:inbound-endpoint exchange-pattern="request-response" responsetimeout="10000" doc:name="tcp" address="${endpoint}" encoding="iso-8859-1" connector-ref="tcp"/> connector: <tcp:connector name="tcp" doc:name="tcp connector" clientsotimeout="${client_so_timeout}" receivebacklog="0" receivebuffersize="0" sendbuffersize="0" serversotimeout="${server_so_timeout}" socketsolinger="0" validateconnections="true" keepalive="true" sendtcpnodelay="true"> <receiver-threading-profile maxthreadsactive="${tcp_maxthreadsactive}" maxthreadsidle = "${tcp_maxthreadsidle}" /> ...

c - Remove Bootloader on Arduinos -

i trying move arduinos avr c. know how remove arduino bootloader microcontroller? there different process different atmega microcontrollers 32u4, 328, or 2560? thanks. you can use avr dude erase flash. thread might http://www.avrfreaks.net/forum/how-can-i-erase-chip-using-avrdude

R: Why I cannot delete rows with NA elements in a data frame? -

i trying delete rows na elements in data frame doing following: cleaned_data <- data[complete.cases(data),] however, still getting same data frame without row being removed. running 3.2.1 r version os x 10.10.3. here data: > dput(data) structure(list(`1` = structure(c(1l, 1l, 6l, 3l, 3l), .label = c("1", "2", "3", "4", "5", "na"), class = "factor"), `2` = structure(c(5l, 5l, 7l, 2l, 2l), .label = c("1", "2", "3", "4", "5", "6", "na" ), class = "factor"), `3` = structure(c(34l, 46l, 66l, 51l, 28l ), .label = c("0", "1", "10", "100", "105", "11", "110", "112", "12", "120", "14", "15", "16", "168", "18", "2", "20", "200", "21", "2...

apache - Remove dots from url via .htaccess -

i'm working on server status , works fine, except can't .htaccess file put out url ark.kazuto.de/312142448.png because grabs ip. rewriteengine on rewritecond %{the_request} \ /+status\.php\?ip=([^&\ ]+) rewriterule ^ /%1.png? [l,r] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^([^/\.]+)\.png$ /status.php?ip=$1 [l,qsa] can me real quick? you can use rule: rewriteengine on rewritecond %{the_request} \ /+status\.php\?ip=([^&\s]+) rewriterule ^ /%1.png? [l,r] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.+?)\.png$ status.php?ip=$1 [l,qsa,nc]

angularjs - connecting angular bootstrap ui paginate to table -

i working on setting angular pagination on table creating. i have worked through docs. however, not seeing how connect pagination table. pagination size matching array size. right number of button links page page length. however, table still @ full length making impossible me test pagination. here table body <tbody> <tr ng-repeat="drink in editabledrinklist | orderby:'-date'"> <td>[[drink.name]]</td> <td>[[drink.date |date: format :timezone]]</td> <td>[[drink.caffeinelevel]]</td> <td> <a ng-click="delete(drink._id)"> <i style="font-size:18px; margin-right:5%" class="fa fa-times"></i> </a> <a href="" ng-click="update(drink)"...

subset - Drop out observations by conditioning on other data in R -

i have 2 data sets below. want remove 1st data observations matched id, v1 , user 2nd data sets. how should that? id v1 user v2 v3 v4 ... 1 1 10 1 2 b 15 1 3 c 13 2 1 11 2 1 b 13 3 1 c 15 3 2 b 20 4 1 d 11 4 2 15 4 3 b 11 4 3 c 12 id v1 user 1 3 c 2 1 b 3 2 b 4 3 c this should work: merged_df <- merge(data dataframe_1,data dataframe2, by=c("id","v1","user"), all.x=true) this should exclude observations matched.

git - Can gitattributes filters remove or add files? -

git attributes can used set filters per file make content of working directory transformed version of repository content. wondering if used clean .srcinfo files have dealt in archlinux' new aur version 4 . essentially, there 2 files called pkgbuild , .srcinfo both have stored in repository. case can safely assumed .srcinfo generated running program called mksrcinfo on pkgbuild . want both show in repository, pkgbuild in local tree. how can set filter pair that smudge removes .srcinfo , or better not create begin and clean adds .srcinfo , generated running mksrcinfo pkgbuild ?

ruby on rails - How do I use BrowserSync in conjunction with OAuth App? -

in case have rails app uses facebook oauth. since facebook not allow localhost domains registered oauth callback url required use workaround in development mode. run app in development running app on port 80 , inserting following mapping in /etc/hosts : 127.0.0.1 my-website.com facebook redirercts my-website.com/callback allowing me authenticate users locally. so challenge allow browsersync livereload js/css @ my-website.com . tried configuring gulp , browsersync, following proxy: 'my-webite.com' browsersync creates proxy , runs app on localhost:3000 . however, upon logging in redirected my-website.com , browsersync url localhost:3000 remains in session , unable "login" app. any suggestions? (also tried running app on port 8000 , browser sync on port 80, facebook login redirected me localhost:8000/callback not valid redirect uri).

Can Common Lisp type annotations result in unsound behavior? -

i know if safety setting low, common lisp can use type annotations optimization aids , not checked. example, program runs , prints both number , string without type errors. (i type error in sbcl, when safety >= 1) (declaim (optimize (speed 3) (safety 0))) (defun f (x) (declare (type fixnum x)) x) (format t "1 ~a~%" (f 17)) (format t "2 ~a~%" (f "asd")) i wonder if possible create program nasty things if safety set 0 , type annotations not respected. things casting 1 type (like c type casts) , other kinds of undefined behavior. so far, haven't managed find out example that. tried variations of example uses typed arrays none of them resulted in typecasting behavior. (declaim (optimize (speed 3) (safety 0) )) (defun f () (let ((arr (make-array '(5) :element-type 'fixnum :initial-contents (list 1 2 3 4 5)))) (declare (type (vector fixnum 5) arr)) ...

jsf - How to invoke @SessionScoped managed bean method on each page reload? -

my managed bean used @viewscoped , used @postconstruct annotated method situate various functions wanted performed each time page refreshed via browser url. however, page requires query string parameter processing , needed use ajax , redirect same page after ajax so, avoid reconcatenating query string params cache url string, changed scope @sessionscoped can do facescontext.getcurrentinstance().getexternalcontext().redirect("mypage.jsf"); and session parameters need reloaded query string if @viewscoped stay there. however, problem @postconstruct method, among other things ok done @ start of session, make ejb call should executed on each page reload, regardless of scope. form submissions easy because call ejb method in managed bean method form submission calls problem doesn't run if user hits refresh in browser did in @viewscoped. is there way me keep best of both scopes, iow retain processed query string params in cache without having reprocess them, @sess...

How to properly Delete fields of an Entity? -

i having trouble when trying delete field of entity using entity framework (version 6.1.3). let's have 2 entities: person , work . can change work of person without issue, when try express person unemployed not work properly: person.work = null; db.savechanges(); after running code person still have previous work, if use debugger , check work property of person before running person.work = null; , behave expected. can please explain why reading value first makes code work , how correctly delete field? var work = person.work; \\ line here works expected person.work = null; db.savechanges(); two things contributing issue: entity framework determines needs updated during savechanges tracking changes property values. you have lazy loading enabled (both in general , work property), means if person has associated work , associated entity doesn't loaded until first time access property. putting together, when set person.work = null without ...

c# - Access to the path '...\email@gmail.coml.jpg' is denied -

i have hosted aspx website contains registration page. when trying upload image showing following error: description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code. exception details: system.unauthorizedaccessexception: access path 'd:\inetpub\vhosts\example.org\httpdocs\alumni\uploadimage\email@gmail.coml.jpg' denied. asp.net not authorized access requested resource. consider granting access rights resource asp.net request identity. asp.net has base process identity (typically {machine}\aspnet on iis 5 or network service on iis 6 , iis 7, , configured application pool identity on iis 7.5) used if application not impersonating. if application impersonating via , identity anonymous user (typically iusr_machinename) or authenticated request user. to grant asp.net access file, right-click file in file explorer, choose "properties" , select security tab...

I'm trying to create a tkinter (python 3) application on raspbian, but won't repeat drawing -

my code below; should draw random colour , size circles repeatedly, draws one. have tried countless combinations of mainloop() , window1.update() have same problem. #!/usr/bin/env python3 tkinter import * random import * width = 1024/2 height = 720/2 window1 = tk() c1 = canvas(window1, width=width, height=height, bg='#ffffff') c1.pack() colours = ('#ff0000', '#00ff00', '#0000ff', '#ffff00', '#ff00ff') while 3 == 3: colchose = choice(colours) x0 = randint(0, width) y0 = randint(0, height) c1.create_oval(x0, y0, x0+d, y0+d, fill=colchose) mainloop() the problem mainloop() call in last line. call end, once whole program has terminated. suggest @ threading facilities of python. create thread draws onto canvas while mainloop executing.

C# Word copy style from one paragraph to another -

in word have 2 paragraphs, , i'm trying copy formatting 1 other. i've tried: word.style style = activedocument.paragraphs[2].get_style() word.style; activedocument.paragraphs[1].set_style(style); and word.style style = activedocument.paragraphs[2].range.characterstyle word.style; activedocument.paragraphs[1].range.set_style(style); this doesn't copy style though, , first paragraphs style set default text styling. how proper styling information? i think paragraph[2].get_style() return normal style (default text) because of paragraph[2] style normal (default text) !! you change formatting text not save style! style of paragraph[2] not change default value. see style name in msword , create new style apply it, 1 variant work fine.

html - Apply an SVG filter to a div's background-color -

Image
i have <div> has background-color sitting in front of image. i'm trying apply multiply effect using svg background image behind div comes through: <svg> <filter id="multiply"> <feblend mode="multiply"/> </filter> </svg> unfortunately, solid background color being changed, , no transparency through background. here's fiddle: https://jsfiddle.net/0p58bxsp/1/ the effect i'm expecting this: i know visual effect fudged using rgba value background color, i'm looking combination of solid color having multiply filter applied it. is limitation of current svg implementation? here's definition of multiply blend: multiply blend mode multiplies numbers each pixel of top layer corresponding pixel bottom layer. result darker picture. , base layer value , b top layer value. as such, using opacity or alpha doesn't give me exact result i'm looking for. this supposed ...

html - CSS selector select by div class attributes -

<div class="thumbnail-popular" style="background: url('http://images.gogoanime.tv/images/upload/go!.princess.precure.full.1812487.jpg');"></div> i trying url component of div class seem unable fetch specific data in div class. i have looked making use of attributes attempts have been unsuccessful far. usage of css selector through kimonolabs. div.thumbnail-popular should element you're looking — unless there more 1 such element, in case need narrow down selector. for example need find out if particular element belongs specific parent, or first, second, ... nth child, or other information surrounding elements in page you're working with. the background url in style attribute on element, need extract attribute described here . still need parse declarations inside style value in order url; not sure if possible through kimono not familiar (i'm not sure advanced mode does, , it's difficult tell lone screenshot...

c# - Setting TabIndex at runtime based on criteria -

i've got asp.net app c# code-behind. query table based on series of dropdownlists, , based on choices there 10 possible fields might displayed. it's little complicated, 2 separate instances, might see these fields: txteffdate txtepro tbaccountnum ddlbustype chkescalated and these fields: tbaccountnum txtclientid txtepro ddlbustype chkrework chkescalated it's table driven logic fine, wanted give background. the problem is, when we're determining controls make visible tab order goes wonky. i'm trying set tab index when i'm checking controls. i've got this: if (reader.getbyte(0) == 1) { txteffdate.visible = true; lbleffdate.visible = true; txteffdate.tabindex = 9; } if (reader.getbyte(0) == 2) { txtclientid.visible = true; lblclientid.visible = true; txtclientid.tabindex = 7; } etc... index isn't changing. anyone know i'm doing wrong?