Posts

Showing posts from August, 2013

Python OpenCV - Update camera index of live webcam view -

i viewing webcam camera live feed. incorporate tkinter gui , have dropdown selection allows 1 change camera index, , therefore webcam being used, on fly. how can achieved? example code: import cv2 def show_webcam(mirror=false): cam = cv2.videocapture(0) while true: ret_val, img = cam.read() if mirror: img = cv2.flip(img, 1) cv2.imshow('my webcam', img) if cv2.waitkey(1) == 27: break # esc quit cv2.destroyallwindows() def main(): show_webcam(mirror=true) if __name__ == '__main__': main() to change camera @ run time need change index pass in cv2.videocapture(index) . find out how many camera using app , 3 cameras, can change through changing index 0 or 1 or 2. add 1 more parameter index show_webcam(mirror=true, index) in function side can use this def show_webcam(mirror=false,index): cam = cv2.videocapture(index) while true: ret_val, img = cam.read()...

reactjs - React/Rebase/Firebase warning: Permission Denied - How do I add user authentication? -

please excuse simplicity of question can't rebase/firebase work due permission errors (rebase similar firebase https://github.com/tylermcginnis/re-base ) i building simple website part of react.js tutorial , want persist state on page. this, want firebase database, without user authentication, when set database, permission errors user authentication must mandatory. this have @ top of main.js: var rebase = require('re-base'); var base = rebase.createclass('https://fishmonger-f3761.firebaseio.com/'); and in main app component, added this: componentdidmount : function() { base.syncstate(this.props.params.storeid + '/fishes', { context : this, state : 'fishes' }); i following warning in console: firebase warning: set @ /(*my custom store name*)/fishes/fish1/name failed: permission_denied how add in anonymous browser-session based user authentication disregard error? firebase db default rules require au...

ruby on rails - ActionView::Template::Error (Failed to open TCP connection to localhost:9292 (Connection refused - connect(2) for "localhost" port 9292)) -

please give me solution following error. this chat application.... , code , error follows:: conversations_controller.rb def create if conversation.between(params[:sender_id],params[:recipient_id]).present? @conversation = conversation.between(params[:sender_id],params[:recipient_id]).first else @conversation = conversation.create!(conversation_params) end render json: { conversation_id: @conversation.id } end create.js.erb <% publish_to @path %> alert(@path); var id = "<%= @conversation.id %>"; var chatbox = $("#chatbox_" + id + " .chatboxcontent"); var sender_id = "<%= @message.user.id %>"; var reciever_id = $('meta[name=user-id]').attr("content"); chatbox.append("<%= j render( partial: @message ) %>"); chatbox.scrolltop(chatbox[0].scrollheight); if (sender_id != reciever_id) { chatbox.chatwith(id);...

vba - Array + Loop for Month and Year combination -

i trying create array months jan - dec , want have year "j14" january. want increase run move next month , after 12 runs year change "j15". run macro once month why want month , increase 1 each time run it. below have far, please excuse if wrong never used arrays before sub test() dim myarray(1 12) integer myarray(1) = j myarray(2) = f myarray(3) = m myarray(4) = myarray(5) = m myarray(6) = j myarray(7) = j myarray(8) = myarray(9) = s myarray(10) = o myarray(11) = n myarray(12) = d = 1 ubound(myarray) cells(i, 1).value = myarray(i) next end sub this how work, if write "14" in range a13. idea learn data types first comment has proposed. furthermore, there many better ways it. still: option explicit sub test() dim long dim myarray(1 12) string myarray(1) = "j" myarray(2) = "f" myarray(3) = "m" myarray(4) = "a" myarray(5) = "m" myarra...

c++ - how to display class data members stored in multimap -

here code class student { int num; string name; float marks; public: void add() { cout << "enter num name , marks:" << endl; cin >> num >> name >> marks; } void display() { cout << num << endl; cout << name << endl; cout << marks << endl; } }; void main() { student ss; multimap<int,student> st; multimap<int,student>::iterator itr; ss.add(); st.insert(make_pair(1000, ss)); (itr = st.begin(); itr != st.end(); itr++) { cout << itr->second; // showing error } } the error error c2679 binary '<<': no operator found takes right-hand operand of type 'student' (or there no acceptable conversion) firstmultimap how fix this to display student object need overload << operator. i have made operator overloading function friend of student class called without creating object. also, check example on msdn . examp...

Write file with original character using batch script -

i need write line .txt file 連携データの取得に失敗しました。 this code echo 連携データの取得に失敗しました。>>%file_name% and result 連携デーモフ取得に失敗しました。 4th , 5th character had change, have no idea this. can explain me what's happen?

android - How to start Google API - ActivityRecognitionAPI using BroadcastRecievers on device boot? -

i have used api using activities , works. tried starting mainactivity using broadcastreciever , works. when try this, crashes app. do need add flags intent? how in case? i tried these codes app crashes on boot: 1) broadcastreciever class: public class startreciever extends broadcastreceiver implements googleapiclient.connectioncallbacks, googleapiclient.onconnectionfailedlistener { public context appcontext; public googleapiclient mapiclient; @override public void onreceive(context context, intent intent) { appcontext = context; mapiclient = new googleapiclient.builder(context) .addapi(activityrecognition.api) .addconnectioncallbacks((googleapiclient.connectioncallbacks) context) .addonconnectionfailedlistener((googleapiclient.onconnectionfailedlistener) context) .build(); mapiclient.connect(); } @override public void onconnected(@nullable bundle bundle) { intent intent = new intent(appcontext, activit...

mysql - data replication and master -

i have web based system in php works locally in multiple places , in each place has local database in mysqli. also system in every place connect remotely database of information specific tables of local systems example when insert record in place,this record insert remote database ,too. , on ,to tell summary sync information local remote database. schema of system now know replication can idea this. but don't know when remote database has problem , system can't connected remote database how apply changes in local database remote database?

JQuery: Validation on Disabled Option in Select Field -

i'm trying detection on select field. default first item selected disabled , acts prompt user "select option". i want check if "disabled" item still selected when form submitted , if ask user select 1 of options in field. reason validation error throws when option selected. doing wrong? html <select name="purchasableid" id="metreselect" class="metre" required> <option disabled selected>select option</option> <option value="dynamic options">dynamic options</option> </select> jquery $('#add').click(function(){ if ($(".metre").children('option').attr('disabled')) { $('.metrevalidation').html("<span class='flash'>please select number of metres</span>"); $('.metre').addclass("errorborder"); var errormessage = 'true'; } }); your query $(".metre...

amazon web services - ssh : Connect to host <myPublicIP> port 22: connection refused -

i started learning amazon web services documentation ( https://aws.amazon.com/getting-started/tutorials/launch-a-virtual-machine/ ) set instance, ssh key, public ip, , try ssh instance through command line on machine mentioned in documentation ( stuck @ step -3 of documentation ) chmod 400 /path/my-key-pair.pem this worked fine.. ssh -i /path/my-key-pair.pem ec2-user@my-public-ip-address but when try error: ssh : connect host <mypublicip> port 22: connection refused i researched of answers, there 2 possible solutions: either reinstall ssh ( did too) or asked ssh -v here result : openssh_6.9p1 ubuntu-2ubuntu0.2, openssl 1.0.2d 9 jul 2015 debug1: reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: applying options * debug1: connecting <mypublicip> [<mypublicip>] port 22. debug1: connect address <mypublicip> port 22: connection refused ssh: connect host <mypublicip> port 22: connection refused and nothing....

xamarin.android - xamarin android development debugging error -

i see error while building xamarin.android: severity code description project file line suppression state error exception while loading assemblies: system.io.filenotfoundexception: not load assembly 'xamarin.android.support.v7.recyclerview, version=1.0.0.0, culture=neutral, publickeytoken='. perhaps doesn't exist in mono android profile? file name: 'xamarin.android.support.v7.recyclerview.dll' @ xamarin.android.tuner.directoryassemblyresolver.resolve(assemblynamereference reference, readerparameters parameters) @ xamarin.android.tasks.resolveassemblies.addassemblyreferences(icollection`1 assemblies, assemblydefinition assembly, boolean toplevel) @ xamarin.android.tasks.resolveassemblies.execute() app3.droid? it appears if version of android.support either missing or unusable. can resolved clearing out packages , downloading them again. to this, please follow steps below: remove packages android app (including forms) add xamarin.forms n...

alfresco 5 and solr4 in different linux boxes -

we planning upgrade alfresco 4.2 alfresco 5.0.currently in prod env,alfresco 4.2 , solr4 in different boxes i.e tomcat servers.i dont know how have deployed these instances @ time. now how install alfresco 5.0 , solr4 in different boxes?do need use same installer file alfresco 5 & solr4 , install in different boxes? when installed in local windows,both alfresco , solr4 comes in same tomcat instance.but in linux , how install in different boxes? the documentation resource this. you can run installer on alfresco server , run again on solr server. on alfresco server, delete solr4 war. , on solr server, delete solr4 war. in alf_data, there keystore directory needs identical on both servers. you'll need edit alfresco-global.properties on alfresco box point solr host. and, you'll need edit alfresco-global.properties on solr box point solr indices. between docs , these tips should able figure out.

sql - How to split a string based on delimiter? -

i have column of variable length character strings end in . i.e. eu... eu eu. eeu. eeu... and want select entire string . not present, or string before first . get: eu eu eu eeu eeu i aware of substr() function requires fixed positions given paramaters. can see not possible. can insert regex sql db2 statement? you can try this: db2 "select * test" test eu... eu eu. eeu. eeu... 5 record(s) selected. db2 "select replace(test, '.', '') test test" 1 eu eu eu eeu eeu 5 record(s) selected.

ios - Change UINavigationBar's color -

Image
i'm using objective-c. here need change background color of uinavigationbar. , tried code below: self.navigationcontroller.navigationbar.backgroundcolor = [uicolor greencolor]; but result is: what want change color of navigationbar green color below instead of blurry green now. please me. do select naigation bar on storyboard , change property of bar tint in directly in inspector

Compute within sum of squares from PAM cluster analysis in R -

i working on cluster analysis pam in r. computed gower distance data vegdist() , computing cluster variable pam() works well. need measure determine right k. method know visually compare within sum of squares different ks. how can fetch wss series of pam iterations compare sums in plot, analogously example kmeans? http://rstudio-pubs-static.s3.amazonaws.com/137758_a80b40255fdd440ab76b41a646a6c482.html#loops pam not optimize wss. wss k-means objective. instead, use pam objective (maybe called td in literature?) see ?[pam.object][1] objective field: objective the objective function after first , second step of pam algorithm. beware similar wss, objective supposed decrease increasing k. can't choose minimum, should knee in plot. because pam randomized, may want run each k multiple times, , keep best result only.

jmeter - Jmeter_ Response Error Like :http response code: 405 Method not allowed -

when trying upload image in web application using post method of http using jmeter ,its throwing error below sampler request: size in bytes: 436 headers size in bytes: 335 body size in bytes: 101 sample count: 1 error count: 1 data type ("text"|"bin"|""): text response code: 405 response message: method not allowed response headers: http/1.1 405 method not allowed allow: get, head, options, trace content-length: 101 content-type: text/html server: microsoft-iis/8.0 x-powered-by: asp.net set-cookie: arraffinity=a1634f39ccba9517317254d32be7078bb62c2877a947d85cab990f2708382045;path=/;domain=revflexsit.azurewebsites.net date: tue, 28 jun 2016 10:04:41 gmt httpsampleresult fields: contenttype: text/html dataencoding: null request: post http://revflexsit.azurewebsites.net/#//testerprofile post data: --8wpdqrxy5gld81_9cclhn-xfotrwvh4dh4srjx content-disposition: form-data; name="profileuploadphoto"; filename="tulips.jpg" conte...

Android shows error "Cannot resolve symbol R" -

before mark question duplicate, please know have tried this , this . i getting following error in messages: information:gradle tasks [:app:generatedebugsources, :app:generatedebugandroidtestsources] :app:prebuild up-to-date :app:predebugbuild up-to-date :app:checkdebugmanifest :app:prereleasebuild up-to-date :app:preparecomandroidsupportappcompatv72311library up-to-date :app:preparecomandroidsupportdesign2311library up-to-date :app:preparecomandroidsupportrecyclerviewv72311library up-to-date :app:preparecomandroidsupportsupportv42311library up-to-date :app:preparedebugdependencies :app:compiledebugaidl up-to-date :app:compiledebugrenderscript up-to-date :app:generatedebugbuildconfig up-to-date :app:generatedebugassets up-to-date :app:mergedebugassets up-to-date :app:generatedebugresvalues up-to-date :app:generatedebugresources up-to-date :app:mergedebugresources up-to-date :app:processdebugmanifest up-to-date :app:processdebugresources d:\androidstudioproject\bluealert\app\src...

To add all the values of a specific subkey for a dictionary python -

so consider dictionary. { "b0:47:bf:af:c1:42": { "no. of visits": 10, "cities": { "mumbai": {"count": 5,"last_visited": "5/22/2016"}, "kolkata": {"count": 2,"last_visited": "5/22/2016"}, "amritsar":{"count": 3,"last_visited": "5/22/2016"} } }, "c0:ee:fb:71:be:0d": { "no. of visits": 24, "cities": { "mumbai": {"count": 2,"last_visited": "5/22/2016"}, "kolkata": {"count": 20,"last_visited": "5/22/2016"}, "amritsar":{"count": 2,"last_visited": "5/22/2016"} } } } so want sum "count" "cities" output have same value "no. of visits" , asking question not context. using python2.7 well iteratin...

html - Break text on the left before breaking float on the next line -

i have code this: https://jsfiddle.net/qchtngzf/1/ and now, when browser narrow, div.right (the text on right) jumps onto next line. to, however, if div.left (the text on left) smaller , text inside break onto next line , div.right stay in same place instead. i found similar issue here: making div float left, not "fall" if text long it's little different , doesn't work me changes tried. thank you. you should set width both of them right , left class: html, body, header, nav, footer, div, p, ul, li, { margin: 0; padding: 0; text-decoration: none; font-family: sans-serif; font-size: 18px; } .left { width: 80%; float: left; position: relative; } .right { width: 10%; } .clearfix:after { content: ""; display: block; clear: both; } hr { border: 0; height: 1px; background-color: #e9e9e9; margin: 16px 0; } section.body { max-width: 960px; min-width: 272px; } div.left { color...

java - Generating unique random number is increasing complexity and might cause performance overhead? -

implementation : private static list<integer> getrandomdistribution(list<string> unsortedlist, int max) { random random = new random(); list<integer> indexcontainer = new arraylist<>(); (int = 0; < max; i++) { int index = random.nextint(max); // below don't like, if (indexcontainer.contains(index)) { i--; } else { indexcontainer.add(index); } } return indexcontainer; } so saying that, until don't find required unique random number. continue loop, happen might keep looping long time increasing overhead. problems : int index = random.next(max) should decide randomness, have maintain ordering. why have used list secondly, i-- stuck, because frankly don't implementation. note: have maintain order within indexcontainer . since generating permutation of numbers 0 max-1 , make more sense populate list numbers 0 max-1 , call collections.shu...

c - Getting error while compiling in keil? -

i working mk60n512md100 (twr-k60n512 tower kit) trying extract freescale_usb_stack_v4.1.1 , creating own project, getting following error after copied related files. ***********************error log ************************ > main_kinetis.c: 5 warnings, 0 errors linking... .\usb_dev.axf: > warning: l6304w: duplicate input file .\startup_mk60n512md100.o > ignored. .\usb_dev.axf: error: l6320w: ignoring --entry command. > cannot find argument 'reset_handler'. .\usb_dev.axf: warning: l6320w: > ignoring --first command. cannot find argument '__vectors'. not enough > information list image symbols. not enough information list > image map. finished: 2 information, 2 warning , 1 error messages. > ".\usb_dev.axf" - 1 error(s), 7 warning(s). target not created please me in resolving issue.

omnet++ - Error in module (Mac1609_4) Model error: ASSERT: condition useSCH false in function handleUpperMsg -

i use veins-4a2 , have modified scenario of demo example. have added new wsm ack when node reveives message, sends ack message source node. have add line in ondata() function: sendwsm(preparewsm("ack", acklengthbits, type_sch, ackpriority, sourcenode.idnode, 2)); and changed preparewsm , handlelowermsg() functions in basewaveappllayer.cc, when execute simulation, crashes after 10 seconds. error message: error in module (mac1609_4) rsuexamplescenario.node[2].nic.mac1609_4 (id=240) @ event #1196, t=9.210177776741: model error: assert: condition usesch false in function handleuppermsg, veins/modules/mac/ieee80211p/mac1609_4.cc line 259. is not have right reuse sch channel ack message? how can correct problem please? the 1609.4 mac layer of veins 4a2 can used in 1 of 2 operation modes: single channel , multi channel. behavior can configured setting parameter of .ned file: // cycle between sch , cch (or stay on cch time) bool useservicechannel = default(tr...

bash - How to set result of command to variable -

i'm trying display line number of first 'string' occurence long string variable , set result other variable. to display line of first 'string" occurence use: grep -n -m 1 string filename.csv |cut -f1 -d: it works fine. 'string' value array variable , filename.csv switch long string. example: string[0]='column2' query="select column1, column2, column3 dual" and now: line_number=$(grep -n -m 1 ${string[0]} "$query" |cut -f1 -d:) echo $line_number result should : 2 not display: grep: "select column1, column2, column3 dual " no such file or directory what's wrong? change script : string[0]='column2' query="select column1,\n column2,\n column3\n dual" line_number=$(echo $query | grep -n -m 1 ${string[0]} |cut -f1 -d:) echo $line_number and see...

jquery - How to go next img element by javascript -

i have many images in page.i want when click on images,image displayed on other large img tag(it's right work).then,i show next image when click next button , show previous image when click prev button.i tried ,but doesn't work properly.can me?thanks. please see code in below css code : <style> .slideshow { position: relative; } .slideshow img { position: absolute; } .show{}/*complete in future*/ </style> html code : <div class="slideshow"> <img src="http://placekitten.com/200/300" width="100" height="100" alt="first image"> <img src="http://placekitten.com/200/287" width="100" height="100" alt="second image"> <img src="http://placekitten.com/200/285" width="100" height="100" alt="third image"> <img src="http://placekitten.com/200/286" width="100" h...

Adding Custom icon to HTML Page -

i found way add default icons html page using element : w3.css icons can use same way have custom icon same way adding image? adding markup after changes : <li class="treeview"> <a href="#"><span class="icon"></span><span>main itmes</span> <i class="fa fa-angle-left pull-right"></i></a> <ul class="treeview-menu"> <li> <a href="/page1.aspx">item1</a> </li> <li> <a href="/page2.aspx">item2</a> </li> <li> <a href="/pagee3.aspx">item3</a> </li> ...

ios - Segue without the tab bar -

i have app has tab bar @ bottom. i trying segue new view controller via button has code: @ibaction func moveover(sender: uibutton) { self.performseguewithidentifier("to-image-select", sender: sender) } this works , segues new view, tab bar still @ bottom. how make tab bar not @ bottom? there way of doing segue doesnt carry tab bar? edit 1 i not want tab bar, prefer have clean ui new view. have button take user previous page in corner. looking modally segues right now. will need tab bar further in navigation ? if yes , might want play hidden bool property display or not. if no , set segue presentmodally instead of regular push. hope helps, don't hesitate provide more information trying achieve

java - How to add enters and use a custom font in a JLabel? -

recently, have attempted create textbox uses custom font. problem had though, requires enters in several places. @ first, tried using \n or \r\n, didn't work. lead me using html, gave me problem of font not loading in. tried fix using several methods, including change style of html body, this: <html><body style="font-family: pixelmix">text</body></html> the font in question, pixelmix imported font, not installed on pc. is, however, known program , can used without html. don't know if html can work uninstalled fonts, if had idea on how enters , custom font, please let me know.

How to Create a DLL in Xamarin Studio (C#) -

how can export codes external library file (dll) in xamarin studio. use c#. please explain how define functions , export them?! (this main confusion) thanks :) right click project, select options . under build -> general see group code generation . set compilation target library , in order tell xamarin studio generate dll instead of executable file. technically, there not big difference between .net executable , class library both assemblies containing compiled classes. executable file additionally contains main method, called when file executed. both types can referenced other .net code use classes , methods of assembly.

Google analytics : Import independent data ( Website tracking ) -

is there way include (import) data google analytics without having common column ? p.s : have gone through data import , helps in related data . no. can send data via measurement protocol, in realtime, 1 hit time (technically 20 hits @ time, never got batched requests work). but cannot create new hits via data import, same can amend existing data, , need key field relates new data existing data (as have found out).

java - Android app unable to launch an activity after splash activity -

my app unable move 2nd activity that's startingpoint after launching splash activity. app closes saying "unfortunately thenewboston has stopped working." i attaching relevant files. hope can me this. startingpoint.java package com.example.thenewboston; import android.app.activity; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.button; import android.widget.textview; public class startingpoint extends activity { int counter; button add,sub; textview display; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_starting_point); counter=0; add=(button)findviewbyid(r.id.addbutton); sub=(button)findviewbyid(r.id.subbutton); display=(textview) findviewbyid(r.id.display); add.setonclicklistener(new view.onclicklistener() { ...

java - SSL not working with IBM MQ 8 client jars -

ssl works ibm mq 6 client jars same code doesn't work ibm 8 jars.did faced issue ibm 8 client jars. code: com.ibm.mq.mqqueuemanager qmrequest = null; com.ibm.mq.mqqueue qrequest = null; com.ibm.mq.mqmessage reqmsg = new com.ibm.mq.mqmessage(); reqmsg.writestring(new string("first mq ssl message test")); reqmsg.messageid = "1".getbytes(); reqmsg.correlationid = "2".getbytes(); system.setproperty("javax.net.ssl.truststore", "d:/keystore/testks.jks"); system.setproperty("javax.net.ssl.truststorepassword", "12345678"); system.setproperty("javax.net.ssl.keystore", "d:/keystore/testks.jks"); system.setproperty("javax.net.ssl.keystorepassword", "12345678"); hashtable<string,object> propmap = new hashtable<string,object>(); ...

ruby on rails - delete dash character which is at the end of the string -

so have table items in db. want in item.name replace - character @ end of item.name try this: items = item.all items.each |it| it.name=it.name.gsub('/\-$/','') it.save end but doesn't work. do? upd: managed this: i = item.all i.each |it| it.name=it.name.chomp('-') it.save end but still don't why first variant didn't work try below 1 definatly work you. items = item.all items.each |item| item.name = item.name.gsub('-','') it.save end

How to change default browser of cordova browser platform? -

i don't have chrome installed , use other browsers development (opera, yandex etc). command: cordova run browser uses chrome default, fails " system can not find file chrome.". can change browser cordova uses? the way change default chrome browser using --target option . as can see chrome default browser run command . internally, cordovaserve.launchbrowser function called cli arguments. this function is defined in cordova-serve/serve.js file , can find body in cordova-serve/src/browser.js file can find complete list of supported browsers each platform: var browsers = { 'win32': { 'ie': 'iexplore', 'chrome': 'chrome --user-data-dir=%temp%\\' + datadir, 'safari': 'safari', 'opera': 'opera', 'firefox': 'firefox', 'edge': 'microsoft-edge' }, 'darwin': { 'chrome...

c# - WPF bubbling mouseenter and mouseleave events for animation purposes -

in application there control, contains amount of cards, on each of them togglebutton placed. apply effects on mouseenter card, , apply effect on button, when mouse if on it, not declining effect of card. mouseenter , mouseleave events not bubble events, catchs in control , disapears. simpliest way resolve collision? this simplified xaml code. xaml <grid> <image source="{binding path=posterpath, converter={staticresource imageconverter}}" opacity="1.0"> <image.effect> <dropshadoweffect ... /> </image.effect> <image.triggers> <eventtrigger routedevent="image.mouseenter"> <beginstoryboard storyboard="{staticresource showmenuanimation}"/> </eventtrigger> <eventtrigger routedevent="image.mouseleave"> <beginstoryboard storyboard="{staticresource hidemenuanimatio...

powershell - Check if folder is inactive based on last write time and read only attribute of it's files -

i trying recursively check if folder not contain files have been edited in last year. inactive in case , of it's files made read only. therefore need perform check checks if files in folder, not inactive ones, read only, because in case "been marked" , not need included in list of inactive folders. currently have: function folderinactive{ param([string]$path) $date = (get-date).adddays(-365) get-childitem $path -recurse -file | foreach-object { if ($_.lastwritetime -ge $date -or $_.isreadonly -eq $false) { $false } } $true } this makes sense file last edited part, doesn't seem correct in read part. should true or false? should -or or -and? if files active, 1 of them read or not still marked inactive. doesn't seem right. can't wrap head around doing in 1 loop. i can of course in 2 loops, dealing big file systems , therefore in 1 loop if possible.

excel - Calculate distance between point and rectangle -

Image
i have rectangles width, height, , coordinates of center. need calculate shortest distance between point , rectangle. rectangle can rotated angle x-axis. in other word, rectangle not aligned x-axis or y-axis: is there easy formula or function calculate this? there resources on problem?

c# - Mapping in Entity Framework -

i have existing db schema (cant change ..) . need ef mapping student table: id name courseid ------------------------ 1 name1 100023 2 name2 100023 3 name3 100024 4 name4 null course table: id courseid coursename -------------------------- 1 100023 course1 2 100022 course2 3 100024 course3 4 100023 course1 id primary key in both tables. courseid column relationships. there no explicit relationship in database (sql server) also. when try mapping in ef specifying courseid key required mapping throws error telling not defined key property. cannot add key property null-able field. is there way mapping? that's pretty rough schema work with. however, might able use composite key courses table. haven't tested it, should work. public class course { [key, column(order = 0)] public int id { get; set; } [key, column(order = 1)] public int? courseid {...

python - ImportError: cannot import name write_dot -

# load required modules import textwrap, os time import strftime networkx import write_dot networkx import connected_components error: traceback (most recent call last): file "multi_dendrix_pipeline.py", line 36, in <module> import multi_dendrix multi file "/home/shruti/toolkit/multi-dendrix-master/multi_dendrix/__init__.py", line 5, in <module> import output file "/home/shruti/toolkit/multi-dendrix-master/multi_dendrix/output/__init__.py", line 1, in <module> output_functions import * file "/home/shruti/toolkit/multi-dendrix-master/multi_dendrix/output/output_functions.py", line 6, in <module> networkx import write_dot importerror: cannot import name write_dot system info: ubuntu 14.04 lts os type 64bit python : python 2.7.6 other info installed networkx , can locate files under usr/local/lib/pyton2.7/dist-packages

c# - Not getting user with correct credentials with asp.net identity and owin -

i doing custom authentication in mvc using asp.net identity , owin framework unfortunately not getting user correct credentials below method: var user = usermanager.find(email, hashednewpassword); i have stored email , password below in database table: id emailadress password 1 abc@yahoo.com 123456 right doing later on hash password , store in table.this testing microsoft owin framework. but not getting user credentials: emaild id:abc@yahoo.com password:123456. this code: controller: [authorize] public class authenticationcontroller : controller { public authenticationcontroller() : this(new usermanager<usermodel>(new userstore(new myentities()))) { } public authenticationcontroller(usermanager<usermodel> usermanager) { usermanager = usermanager; } public usermanager<usermodel> usermanager { ...

ruby on rails - How select users where with paid is true and paid_subscriptions expirence_at current date? -

i have model user has_many: paid_subscriptions model paidsubscription belongs_to :user how me write active record query select users, paid true , paid_subscriptions expirence_at < current day? edit: user.includes(:paid_subscriptions).where("year(created_at) = ? , active = ?", 2011, true).where('paid_subscriptions.expirence_at < ?', date.today) you can try following: user.includes(:paid_subscriptions) .where('year(users.created_at) = ? , users.active = ? , paid_subscriptions.expirence_at < ?', 2011, true, date.today)

Json response in Codeigniter -

below code user list webservice's json response. <?php if ( ! defined('basepath')) exit('no direct script access allowed'); class webservice extends ci_controller { function list_user() { $result_login = $this->db->get('user_registration')->result(); $response = array(); $response ["success"] = 1; $response ["message"] = "user list."; foreach($result_login $row) { $data = array(); $data['user id'] = $row->user_id; $data['name'] = $row->name; $data['email'] = $row->email; $data['mobile_number'] = $row->mobile_number; $data['password'] = $row->password; $output2 = json_...

sql server - SQL insert parameter value bit or datetime getting error syntax near @variablename -

ok i'm having connection sql server. have spent couple of hours looking through questions asked , have tried pretty everything. string.format query , have come conclusion need parametrize query multiple comments. have tested nvarchar type variable , works. problem have when add types bit , datetime. don't know 1 problem. bit 1 since error message : incorrect syntax near @afficher which of bit parameter here code : using(sqlconnection conn = new sqlconnection(connexion)) { conn.open(); sqlcommand cmd = new sqlcommand( "insert actualite (titre, sous_titre, contenu, image, vignette, video, date_publication, afficher) " + "values (@titre, @sous_titre, @contenu, @image, @vignette, @video, @date_publication, @afficher", conn); cmd.parameters.add(new sqlparameter("@titre", "ceci est un test")); cmd.parameters.add(new sqlparamet...

javascript - use LESS in webpack and es6 -

i'm following lecture on angular webpack . trying add less loader , keep getting error. error in ./src/app.js module not found: error: cannot resolve 'file' or 'directory' ../style.less in d:\projects\dev\webpack-angular-demo/src @ ./src/app.js 3:0-24 my webpack.config.js : module.exports = { context: __dirname + '/src', entry:'./app.js', module:{ loaders:[ { //create working environment es6 need npm babel-loader babel-core babel-preset-es2015 -d //https://github.com/babel/babel-loader test:/\.js$/, exclude:'/node_modules', loader:'babel', query: { presets: ['es2015'] } }, { //take less convert css , inject style tag need to: npm css-loader less-loader less style-loader -d //https://github...

android - Set orientation fixed for all activities -

i know there 2 ways set activity 's orientation landscape, either programmatically setrequestedorientation(activityinfo.screen_orientation_landscape); or in manifest: android:orientation="landscape" currently, use first 1 in superclass, because have many (child) activities want in landscape. however, make oncreate being called twice, leads other issues. when using manifest-route, have apply activities separately, undoubtedly lead 1 being missed out in future (not mention code copying). is there way apply android:orientation="landscape" activities in app? in manifest, set activities: <activity android:name=".youractivity" android:configchanges="orientation" android:screenorientation="portrait"/> let me explain: with android:configchanges="orientation" tell android responsible of changes of orientation. android:screenorientation="portrait" set default orientation mode.

java - How to convert URI to real path in marshmallow? -

i have image uri , want convert uri real path. i've looked @ lot of of answers none worked me. i'm using marshmallow 6.0.1. image uri content://com.android.providers.media.documents/document/image%3a52530 . code: sendimagefromfolder.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { intent intent = new intent(); intent.settype("image/*"); intent.putextra(intent.extra_allow_multiple, true); intent.setaction(intent.action_get_content); startactivityforresult(intent.createchooser(intent,"select picture"), 1); } }); protected void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); if(requestcode==1) { uri uri = data.getdata();//how convert uri real pat...

javascript - Check the content of an input field using jquery -

i new javascript , have form, when try retrieve user information, not work correctly. <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <body> <form method="post" action=""> <div class="form-row"> <label> <span>register</span> <select name="register_as" id="dropdown"> <option value="none">select one</option> <option value="user">user</option> <option value="designer">designer</option> </select> </label> </div> <div> <label><span>gender</span></label> <div class="form-radio-buttons"> ...

angularjs - Access-Control-Allow-Origin while accessing -

i facing problem of access-control-allow-origin while accessing angular js, how should fix error post request. please provide me solution access or insert data post request in angular js, m fine request access cross domain not post request backend developed in python django ask backend(python django) developer configure django-cors-headers a django app adds cors (cross-origin resource sharing) headers responses. it's best solution have got far. it'll allow cross origin requests.