Posts

Showing posts from September, 2013

linux - Pass param to USB ioctl -

i have problem read/write data usb mass storage device, 'device or resource busy' error below command: ioctl(usbfd, usbdevfs_claiminterface, &interface_num) so need release interface before. don't know how can pass interface_num correctly command: ioctl(usbfd, usbdevfs_releaseinterface, &interface_num), if it's not defined, there function found interface number. please me! thanks. the documentation states: usbdevfs_releaseinterface this used release claim usbfs made on interface, either implicitly or because of usbdevfs_claiminterface call, before file descriptor closed. ioctl parameter integer holding number of interface ( binterfacenumber descriptor); file modification time not updated request. but seems here "parameter integer" still means pointer integer should passed, you're showing. if have descriptor, can find interface number.

C++ Spaces are not being read in my input file? -

input txt file: joe smith mary jones hamid namdar desired output txt file: smith joe jones mary namdar hamid output file receive: smitjoejonesmarynamdarhamid #include <iostream> #include <string> #include <fstream> using namespace std; int main() { ofstream output; ifstream input; string firstname, lastname; output.open("lastname.txt"); input.open("firstname.txt"); cout << "processing data..." << endl; input >> firstname >> lastname; cout << firstname << lastname << endl; output << lastname << firstname; cout << lastname << firstname << endl; input >> firstname >> lastname; cout << firstname << lastname << endl; output << lastname << firstname; cout << lastname << firstname << endl; input >> firstname >

scala - How to married scalajs-react and autowire on a client side? -

i have trouble mix autowire calls scalajs-react components. here simple example using scalajs-react v0.10.0 + autowire v0.2.5 case class user(name: string) class backend($: backendscope[unit, user]) { def mounted: callback = { val future: future[user] = ajaxclient[api].getuser(123).call() //fixme: how deal it? callbackto { future.foreach(user => $.modstate(_ => user)) } } } val main = reactcomponentb[unit]("main") .initialstate(user("n/a")) .backend(new backend(_)) .render { $ => val name = $.state.name <.p(s"user name $name") } .componentdidmount(_.backend.mounted) .buildu state modification doesn't work here. how can combine future , callback ? update (27/10/15) my autowire client package example import scalajs.concurrent.jsexecutioncontext.implicits.runnow import org.scalajs.dom import upickle._ import default._ import scala.concurrent.future object ajaxclient extends autowire.cl

httpwebrequest - Get Value from source code by HttpWebResponse C# -

i'm use httpwebresponse in c# response request , saves response data(string) in streamreader it's work ! need messages box text in streamreader aera : <tr><td class='left' style='width: 120px'>country</td><td class='left'><img src='images/flags/us.png' alt='united states flag' title='united states flag'> united states (us)</td></tr> this html code ! , want united states (us) --note : every request : 'images/flags/us.png' , 'united states flag' it's change others ! also , html agility pack best work ! , i'm uses regex work!

r- caret package error- createDataParition no observation -

i'm getting following error when try run createdatapartition in caret. error in createdatapartition(data1, p = 0.8, list = false) : y must have @ least 2 data points i ran same exact same code last night no errors. thoughts? predictors<- with(df, data.frame(xvar, xvar, xvar, xvar)) data1<-with(dfu2, data.frame(data1)) library(caret) set.seed(1) trainingrows<- createdatapartition(data1, p=.80, list=false) > dput(head(data1, 15)) structure(list(data1 = c(1l, 1l, 1l, 1l, 1l, 1l, 1l, 0l, 0l, 1l, 0l, 0l, 0l, 1l, 1l)), .names = "data1", row.names = c(na, 15l), class = "data.frame") the data frame data1 visible in environment , has expected observations. thought? this not work because data1 data.frame in case whereas should vector mentioned documentation of ?createdatapartition . see example: #using data data1 <- structure(list(data1 = c(1l, 1l, 1l, 1l, 1l,

How to send an email using a SendGrid template with php api? -

i have created template in sendgrid account i'd use in php application. i'm sending emails using account, have code html right inside app, doesn't provide flexibility need. i couldn't find method in api select template want use , replace variables.... any idea? thanks after digging through github found code snippet works me... hope helps you. $mail->settemplateid("xxxxxxxxxxxxxxxxxxxx"); // put template id in web console after create template

Ubuntu +Apache doesn't work on port 80 -

i have problems apache (os ubuntu). reasons apache doesn't work on port 80. for settings: etc/apache2/ports.conf listen 80 <ifmodule ssl_module> listen 443 </ifmodule> <ifmodule mod_gnutls.c> listen 443 </ifmodule> etc/apache2/000-default.conf <virtualhost *:80> serveradmin webmaster@localhost documentroot /var/www/html </virtualhost> netstat . try connect "my_server_ip" or "my_server_ip:80" browser "connection closed" if change port 8080(for example) try connect "my_server_ip:8080" it's work fine , see default apache page. settings: etc/apache2/ports.conf listen 8080 <ifmodule ssl_module> listen 443 </ifmodule> <ifmodule mod_gnutls.c> listen 443 </ifmodule> etc/apache2/000-default.conf <virtualhost *:8080> serveradmin webmaster@localhost documentroot /var/www/html </virtualhost> netstats .

Rails Undefined Method - NoMethodError -

i vaguely following http://guides.rubyonrails.org/getting_started.html , part 6. using rails v 4.1.8 sqlite db i error after adding second model: nomethoderror in pages#show showing m:/ict/rails/salacity/app/views/pages/show.html.erb line 24 raised: undefined method `links' # extracted source (around line #24) links <% @page.links.each |link| %> id: <%= link.child__id %> rails.root: m:/ict/rails/salacity application trace | framework trace | full trace app/views/pages/show.html.erb:24:in `_app_views_pages_show_html_erb___283878207_51684456' this app/views/pages/show.html.erb <p id="notice"><%= notice %></p> <p> <strong>page:</strong> <%= @page.page_id %> </p> <p> <strong>body:</strong> <%= @page.body %> </p> <p> <strong>branch:</stro

angularjs - Errors is not printed out on resolve, ui-router -

let's have in module: resolve: { user: function(userloader){ return new userloader($stateparams.userid); } } controller.. as can see, i've not injected $stateparams , hence fail load controller , view. why console not giving errors on resolve everywhere else? can pain debug if have logic in resolve. possible "turn on" console on resolve somehow? from documentation : $statechangeerror - fired when error occurs during transition. it's important note if have errors in resolve functions (javascript errors, non-existent services, etc) not throw traditionally. must listen $statechangeerror event catch errors. use event.preventdefault() prevent $urlrouter reverting url previous valid location (in case of url navigation). you must listen on '$statechangeerror' event $rootscope.$on('$statechangeerror', function(event, tostate, toparams, fromstate, fromparams, error){ // error occured, $log.error(e

python - Parsing maths expression -

so following code function: "eqn" converts string: "d" mathematical expression, list of integers , operators according reverse polish notation, "add", "subtract", "multiply" , "divide" represent +, -, * , / respectively. there "negate" operator takes positive integer , turns negative integer. example inputs , outputs: eqn("10 5 add") should produce output of [10, 5 , "add"] eqn("5 6 add 2 negate divide") should produce output of [5, 6, "add", -2, "divide"] with negative function though, if not used correctly (not after number) function should return index number of first incorrect "negate". for example: eqn("negate 2 add 2") should produce output of 0 eqn("2 4 add negate") should produce output of 3 def eqn(d): extrac = [] e in eqnstr.split(): if len(e) == 0: continue try: extrac.append(int(e)) continue

javascript - Using PHP to parse URL and provide it as variable to HTML -

since couldn't find answer question anywhere, here comes question. before that, answers/helps in anyway. the pseudo-code of index.php page is: <html> <head><script> <?php $links = parse_ini_file('links.ini'); if(isset($_get['l']) && array_key_exists($_get['l'], $links)){ $my_phpvar = $links[$_get['l']]; } else{ header('http/1.0 404 not found'); echo 'unknown link.'; } ?> var myjsvar= <?php echo $my_phpvar; ?> function go(){ document.cookie = "visited=; expires=thu, 01 jan 1970 00:00:00 gmt"; window.location.href = "myjsvar"; } </script></head> <body><a id="mya1" href="javascript:go();" target="_blank">click</a></body> </html> as evident, in abo

python - Pass clicks through Tkinter window? Mac OSX -

is there way make tkinter window unclickable? meaning input should caught handler redirected whatever window behind it? if not in tkinter, there way in pyqt or wxpython? goal have handler catch keyboard events while still letting them input windows behind. don't need catch clicks nice have if possible. my current plan: a tkinter window geometry of 10000x10000, alpha of 0 , topmost set true. frame catch keyboard & mouse events , when entered frame catch it, hide tkinter window using apple script function run terminal osascript, use autopy simulate whatever entered such click/keyboard event , unhide window again. sound viable? when have time test out idea , post if works. i'm thinking computation speed issue here.

java - install jars to a specified locaiton in maven build -

i writing osgi bundle needs third party jars. have configured user settings file central repository maven fetch jars central repository. when build goals clean install maven inturn place jars in local repository. there way redirect local repository directory bundle deployed once maven build process completes do want install artifacts remote repository ? if so, you'll have use maven-deploy-plugin .

c++ - SetWindowsHookEx succeed but callback function is never called -

dll code: lresult callback cbtnewproc(int ncode, wparam wparam, lparam lparam) { std::ofstream file; file.open("e:\\enter.txt", std::ios::out); file << ncode; file.close(); return callnexthookex(g_hhook, ncode, wparam, lparam); } extern "c" __declspec(dllexport) void installhook() { if (g_hhook != null){ unhookwindowshookex(g_hhook); g_hhook = null; } hinstance hinstance = getmodulehandle(null); g_hhook = setwindowshookex(wh_cbt, cbtnewproc, null, getcurrentthreadid()); if (g_hhook == null) { messagebox(null, l"fail!", l"caption", mb_ok); } else { messagebox(null, l"install success!", l"caption", mb_ok); } } i wrote program load dll , called installhook . message box "install success" showed callback function never called, enter.txt not found under drive e. i'm using win7 + vs2013. for hook set

css - How to add background images for jumbotron in bootstrap? -

i started bootstrap 2 days ago. the problem i'm facing i'm unable put background image whole page or jumbotron. tried directly giving path (both relative , absolute) div tag, didn't work. have tried through css, still dont see background image in output. please help! i want have background image jumbotron. this code wrote: html: <div class="row"> <div class="jumbotron"> <div class="container"> <center> <h1>avudo computers</h1> <h5>redesigning hopes.</h5> </center> </div> </div> </div> css: background-image: url(../img/jumbotronbackground.jpg); background-position: 0% 25%; background-size: cover; background-repeat: no-repeat; color: white; text-shadow: black 0.3em 0.3em 0.3em; if seems haven't declared class/id in css. you have attach .jumbotron css rules . see

powershell - Need to re-work script to use jobs for parallel transfer -

i have working script copy (via smb) few files different locations. unfortunately, taking long since copying 1 file after other. i need re-work script use jobs , transfer files in parallel. i'm relatively new powershell. how can this? the following current script: $data = import-csv -path f:\tdb_server.csv -delimiter ";" $logtime = get-date -format "yyyy-mm-dd_hh:mm:ss" function logwrite { param ([string]$logstring) add-content $log -value $logstring } logwrite ($logtime + "-------------------------------------------------------------------------------------") $copyfiles = [scriptblock] { param ($d) $dow = [int] (get-date).dayofweek $date = (get-date -format "yyyy-mm-dd") $source = "\\$($d.server)\f$\tdb\zip_sich\zip$dow" $dest = "f:\system2\$($d.tdb)" $log = "f:\logs\$date.log" copy-item "$source\datum.txt&qu

python - How to execfile an independent .py and continue on to next line of code in the original .py? -

i have 2 python files: 'old.py' , 'new.py'. execute 'new.py' 'old.py' using execfile("new.py"). however, rather waiting 'new.py' finish program before moving next line in 'old.py', both scripts continue independently (i.e., 'old.py' moves line after execfile('new.py') command immediately. for instance, if 'new.py' takes 48 seconds complete program in entirety, , 'old.py' reads: execfile("new.py") print 2+2 i "4" printed immediately, rather 48 seconds later. how recommend doing this? thank sharing knowledge , expertise. you want utilize subprocess.popen . open process in separate process. # old.py - make sure it's chmod +x #!/usr/bin/python import time time.sleep(48) # new.py #!/usr/bin/python import subprocess subprocess.popen(["./old.py"]) print(2+2) >>> python new.py 4 >>> ps pid tty time cmd 2

What is the advantage of C++ supporting native unsigned integers, while java does not? -

according https://en.wikipedia.org/wiki/comparison_of_java_and_c%2b%2b c++ supports unsigned integers while java not, advantages of that? a major difference c , c++ used low-level programming bits shifted , masked; unsigned integer behaves naturally there. and c++ there c compatibility. when c conceived larger value range may have been reason too, when ints 16 bit. a minor point (for c) may efficiency 1 wanted support unsigned chars on architectures architecture default, , there expand concept of unsigned integer types in order orthogonal; although find argument weak.

python - Static Files not being displayed in Production -

edited show updated configuration no static files being shown in production. files showing correctly in development settings.py base_dir = os.path.dirname(__file__) static_root = '/opt/soundshelter/static/' print "base dir: " + base_dir #this returns /opt/soundshelter/soundshelter/soundshelter print "static root: " + static_root #this returns /opt/soundshelter/static/ static_url = '/static/' staticfiles_dirs = ( os.path.join(base_dir, 'static'), ) #/opt/soundshelter/soundshelter/soundshelter/static files being called in applications <link href="{% static "css/portfolio-item.css" %}" rel="stylesheet"> using nginx , gunicorn. nginx config: server { server_name 46.101.56.50; access_log yes; location /static { autoindex on; alias /opt/soundshelter/static/; } location / { proxy_pass http://127.0.0.1:8001; proxy_set_header x-f

xslt - xsl take path and substring the value -

i have xsl path gives me desired value: /path/to/@value is there way combine substring? substring(/path/to/@value, 1, 5) the preceding statement not work because i'm not familiar xsl thought actually, should work fine: xml: <?xml version='1.0'?> <path> <to value='123456'/> </path> xslt: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" > <xsl:template match="/"> <out> <xsl:value-of select='substring(/path/to/@value, 1, 5)'/> </out> </xsl:template> </xsl:stylesheet> another way use intermediate variable: <xsl:variable name='t' select='/path/to/@value'/> <xsl:value-of select='substring( $t, 1, 5 )'/>

angularjs - Re-initialize angular form with dynamically generated input fields -

i have form dropdown. depending on value of dropdown compile custom directive form. directive contains form inputs. when change dropdown value, compiled directive gets removed , new compiled directive added. far works fine. have form validation whole form. problem when "switch directive" validates input fields of old directive. because $scope.form (my form) keeping field tough not on view anymore. my question, there way re-initialize form on scope form inputs shown on view in angular form? print of $scope form the red 1 no longer on form still in form object. i prefer using ng-include. make select items like [{caption: 'foo', templateurl: '/foo.html'}, {caption: 'bar', templateurl: '/bar.html'}] where templateurl points desired partial view inputs. bind selected item's template url ng-include. keep required partial on page , remove old inputs , won't have problems validation.

c++ - Why this class doesn't make error? -

Image
#include <iostream> using namespace std; class item{ private: int cnt; public: item(){} void func(item a){ a.cnt = 10; } }; int main(){ return 0; } i assume red line make error. because 'a.cnt' value private value. learned private value must modified inner of class. void func(a a){ a.cnt = 10; //valid } notice function inside class, becomes member , class member functions have access private members. note being modified inner of class item using member function,which valid

java - Callback in android(Network call in separate class) -

i have layout xml name main.xml , have main.java class in class send network call , data rest service.but want separate network call in anohther class.how can that. main.xml <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".mainactivity" > <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> <button android:id="@+id/callsubclass" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="call sub-class" /> <textview android:id="@+id/result"

What are some use cases for using elasticsearch versus standard sql queries? -

i'm getting started elasticsearch , 1 of main use cases i've seen it's scalability searches on large data sets, besides when want use on creating sql queries traditional rdms? there 2 primary elasticsearch use cases: text search you want elasticsearch when you're doing lot of text search, traditional rdbms databases not performing (poor configuration, acts black-box, poor performance). elasticsearch highly customizable, extendable through plugins. can build robust search without knowledge quite fast. logging , analysis another edge case lot people use elasticsearch store logs various sources (to centralize them), can analyze them , make sense out of it. in case, kibana becomes handy. lets connect elasticsearch cluster , create visualisations straight away. instance, loggly built using elasticsearch , kibana. keep in mind, wouldn't want use elasticsearch primary data storage. reasons here: how reliable elasticsearch primary datastore again

instagram - Instafeed not loading -

hi trying instagram feed onto website showing user photos. have put javascript @ top of page follows: <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>tomsaxby.com</title> <!-- css ------------------------------------------------------------------------------------------- --> <!-- bootstrap --><!-- latest compiled , minified css --> <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> <!-- edits --> <link rel="stylesheet" href="css/style.css"> <!-- fonts --> <link rel="stylesheet" href="fonts/neuzeit/myfontswebfontskit.css" type="text/css" /> <!-- css --------------------------------------------------------------------

mysql performance in aggregation functions -

i wonder aggregate functions of mysql. will following query: select sum(c / 1000) t; have better performance than: select sum(c) / 1000 t; when t big table? i decided test this, have no idea definition of "big table" is. for test case, used database table 1,063,527 rows of data in (again, data set may bigger) the times follows; select sum(field / 1000) table; 0.344 0.359 0.625 0.390 0.594 0.359 select sum(field) / 1000 table; 0.234 0.390 0.219 0.438 0.203 0.485 test conditions for each of calls, changed division number in hope avoid "cache" result set different. /1000,999,998 etc. i'm sure there people can far better checks , have far bigger tables query against, wanted try it. conclusion personally, don't see difference kind of ranges both produced - again, change when multiple data set (n)

javascript - decoding the response from $.post -

this javascript <script> function checkemail(email) { $.post('<?=base_url()?>checkemail',{ emailid : $('#inputemailid').val() },function(d){ cc = eval(d); alert(cc); }); } </script> part of php file contains if ($parts) { //these details exist $obj->status = 'yes'; } else { $obj->status = 'uni'; } $res[] = $obj; when print_r($res) status=>'yes' but when alert(cc) in javascript function array() { [native code] } how alert status in javascript? as mentioned in comments php part should include call json_encode if ($parts) { //these details exist $obj->status = 'yes'; } else { $obj->status = 'uni'; } // sending out $res should // can add proper json headers if content not formatted header('content-type: application/json'); print json_encode($obj); your jav

imagemagick - How to create curved text with PHP Imagick? -

how can curved text obtained using imagick (php)? did not expect not find straightforward method or group of methods this, happened... i did find imagemagick commands obtain curved text ( http://www.imagemagick.org/usage/fonts/#arch ), i'm in need imagick (pecl extension) -based script. if want curved, there demo here code below. $draw = new \imagickdraw(); $draw->setfont("../fonts/arial.ttf"); $draw->setfontsize(48); $draw->setstrokeantialias(true); $draw->settextantialias(true); $draw->setfillcolor('#ff0000'); $textonly = new \imagick(); $textonly->newimage(600, 300, "rgb(230, 230, 230)"); $textonly->setimageformat('png'); $textonly->annotateimage($draw, 30, 40, 0, 'your text here'); $textonly->trimimage(0); $textonly->setimagepage($textonly->getimagewidth(), $textonly->getimageheight(), 0, 0); $distort = array(180); $textonly->setimagevirtualpixelmethod(imagick::virtualpixelme

excel - Loop to go through a list of values -

Image
i have macro goes through column on master spreadsheet, exports rows value input @ start matches value in column. saves new worksheet value. here code have: option explicit public const l_headerrow long = 2 'the header row of data sheet public const l_distancecol long = 5 'the column containing distance values public sub exportdistance() dim ws_data worksheet, wb_export workbook, ws_export worksheet dim l_inputrow long, l_outputrow long dim l_lastcol long dim l_numberofmatches long dim s_distance string, l_distance long dim s_exportpath string, s_exportfile string, s_pathdelimiter string set ws_data = activesheet s_distance = inputbox("enter distance export new file", "enter distance") if s_distance = "" exit sub l_distance = clng(s_distance) l_numberofmatches = worksheetfunction.match(l_distance, ws_data.columns(5), 0) if l_numberofmatches <= 0 exit sub 'application.screenupdating = false 'ap

sitefinity - Can i respond to the notification POST from SagePay with a POST -

i integrating sagepay sitefinity, server low profile integration , little stuck. i have created custom offline payment provider in sitefinity, , class has relevant notification hooks (sitefinity has own dedicated notification url handles processing don't have run own). the issue have, sitefinity wants post relevant information (status, redirecturl) in integration guides notification paid seems flush , present plain text representation of required return values. is there url can post notification response too, or have plain text response? for else, speak sitefinity see if have route this, there current setup think deals situations direct point of view directly able post , receive specific responses. the current setup of server integration sagepay not that, in needs form of notification page output specific format part of response output (so response needs "rendered" page") sagepay pick , complete transation. this custom cart implementation had b

c# - Can cancellation token be used at tasks method within? -

i've started working tasks , i've come things don't quite understand calling methods within task. have started new task this: var ts = new cancellationtokensource(); var token = ts.token; task.run(() => control(), token); void control() { while(!token.iscancellationrequested) { token.throwifcancellationrequested(); switch(enum) { case something: startsomething(); break; } task.delay(50, token).wait(); } } now don't understand behavior of startsomething() once token has been cancelled. if startsomething() contains while loop, can use? !token.iscancellationrequested and token.throwifcancellationrequested(); as well, if cancellation exception being thrown inside startsomething() loop, instantly cancel task? yes, can pass same token onto startsomething , exceptions bubble control , cancel task. if don't keep runnin

mysql - Display one row for value with multiple categories -

i have table named games . each game belongs 1 or more categories. have query uses group category_id returns not desired result. example below, cod belongs 3 category_id query shows specific game , omits other games same category_id . how can achieve below desired query? query: select * games group category_id desired result: +----------------+--------------------------+ | game_name | category_id | +----------------+--------------------------+ | cod | adventure, fighting, fps | | tekken | fighting | | need speed | racing | +----------------+--------------------------+ sqlfiddle use group_concat function select game_name, group_concat(category_id) categories games group game_name; good luck!

android - Tracking installs from users outside of google play? -

i pretty new app analytics , seem have encountered quite strange. i getting "ghost" installs showing in analytics. stemming user installed app outside of play store via apk. therefore google play did not register install. however, when in app , take action or engage app in way can track user using app. cannot see installed from. i want able find users this... have installed app outside of play store. possible @ all? thanks help! you can parse sdk installs better insights of application. parse android documentation you can use user's email or if want track email or use parse installation, have enough insights track application.

tomcat - apache requests very slow after using ProxyPass -

so i'm running tomcat(8.0) behind apache(2.4) on windows server 2012 , using proxypass pass through traffic. works fine, whenever nothing 60 seconds, , hit server again, 8-20 second delay, apache creating new process handle request. my configuration pretty default comes apache haus, addition of proxy stuff, believe culprit: proxypass /static/ ! proxypass / http://localhost:8088/ proxypassreverse / http://localhost:8088/ i added /static/ ! exemption see if same problem happen on static files being served, , apparently does. further narrowed down commenting out proxypass stuff, , verifying static file loads fast. uncommented proxypass stuff, , requested static file, , again returned fast. once hit url takes me through proxy, wait minute, hit again, goes horribly wrong. below network monitor output 2 requests, first of static file being requested second time after 1 minute delay before proxy use, other after proxy had been used twice delay between

networking - Is it possible to build an arp request packet in such a way that will cause a router to forward it over subnets? -

what i'm trying ip addresses in network, , thought, assuming know address of subnets use arp requests achieve if there way forward these requests on different subnets. for example , assume had 2 hosts 192.168.0.2/24 , 192.168.1.2/24 connected via router using ip addresses 192.168.0.1/16 192.168.1.1/16. send arp request 192.168.0.2/16 192.168.1.2/16. thought maybe if arp request encapsulated in layer 3 header containing 192.168.1.2/24, or 192.168.1.255/24 dsetination work. if possible , know tool happy know tool. if isn't, know happens packet 1 described above i know happens packet 1 described above if encapsulate info standard ip-packet, then, naturally, routed ip-destination host. yet if remote host knew nothing non-standard packet, nothing happen. if want out of this, need have , running software server on remote host, able process requests. is, need proxy arp: either existing implementation, or made of own. if don't have such "an agent&

How to add elevation to transparent ImageView [android] -

Image
is implement elevation of imageview png contains transparent background? example: want add elevation shadow pic: want make this: in xml add this: android:elevation="2dp" android:background="@drawable/myrect" in drawable folder add drawable: <!-- res/drawable/myrect.xml --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="#42000000" /> <corners android:radius="5dp" /> </shape> see here more info: http://developer.android.com/training/material/shadows-clipping.html

javascript - How could Vue.js have templateUrl configure just like Angular.js do? -

i love simplicity of vue.js, don't want complexify browserify or webpack. prefer templateurl in angular, can serve partial page(usually component) nginx directly. how set this? it's not suggested officially, hard there. vue doesn't have built in far can tell you'd able use async components fake if wanted to. vue.component('example', function (resolve, reject) { $.get('templates/example.html').done(function (template) { resolve({ template: template }) }); }); you'd able in html. <div id="app"></div> <template id="example"> <div> <h1>{{ message }}</h1> </div> </template> then can like: new vue({ el: '#app', components: { example: { template: '#example', data: function () { return { message: 'yo' } } } } }); though, think taking time comfortable browseri

How to create separate DDL file for create tables and constraints in DB2 -

for db2 10.1 luw, want create ddl script contains create table statements , create ddl script contains constraints. the aim automate creation of database scripts existing database , not rely on sql guis data studio, sqldbx , razorsql. ideally trigger actions command line can generate create dll schema, insert data statements each table in schema , generate constraints ddl. insert data without dealing constraints performance , means not restricted running inserts in specific order. unfortunately cannot use db2move , thought db2look work ddl, cannot find syntax this. can db2look or there else out there help? thanks db2look generates ddl script existing db , objects. for example, 1. getting ddl db db2look -d <dbname> -a -e -l -x -o db2look.out to ddl table db2look –d dbname –e –z schema_name –t table_name -o output_file -nofed

r - unable to set names to a vector or matrix -

probably easy one, still can't work. have matrix of values: browse[2]> x [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] 48.6 83.1 21 155 63.1 47.4 49.6 59.1 17.5 20.4 0 0 0 0 and have matrix contains values i'd consider names: browse[2]> a[0,] [1] x2.000 x2001 x2002 x2003 x2004 x2005 x2006 x2007 x2008 x2009 x2010 x2011 x2012 x2013 <0 rows> (or 0-length row.names) i'm trying set names of x i'm unable to: browse[2]> colnames (x) <-a[0,] browse[2]> x numeric(0) character(0) character(0) character(0) character(0) character(0) character(0) character(0) character(0) [1,] 48.6 83.1 21 155 63.1 47.4 49.6 59.1 17.5 character(0) character(0) character(0) character(0) character(0) [1,] 20.4 0 0 0 what doing wrong? in r , index starts 1.

neo4j - How to MATCH and CREATE a node and relationship? -

learning neo4j , need getting basics right. trying find matching candidate create company , create relationship between candidate , newly created company. so, query is match (b:candidate {name:'bala'}), create (e:employer {name:'yahoo'}), create (b)-[:worked_in]->(e) return b,e; invalid input '(': expected whitespace, comment, '=', node labels, mapliteral, parameter, relationship pattern, ',', using, where, load csv, start, match, unwind, merge, create, set, delete, remove, foreach, with, return, union, ';' or end of input... i using 2.2.5 console. remove 2 commas before create . clauses in cypher not comma separated, elements within clause are. query read match (b:candidate {name:'bala'}) create (e:employer {name:'yahoo'}) create (b)-[:worked_in]->(e) return b,e;

c++ - Pass a __thiscall to a function typedef -

this question has answer here: how can pass class member function callback? 8 answers i don't know how word this, i'll try best explain in code: typedef void( *examplefn )( pvoid p1, pvoid p2, pvoid p3 ); struct example { void examplefunction( pvoid p1, pvoid p2, pvoid p3 ) { // example's members } }; example example; examplefn examplefn = example.examplefunction; so, error: error c2440 '=': cannot convert 'void (__thiscall example::* )(pvoid,pvoid,pvoid)' 'examplefn' i understand problem, example::examplefunction __thiscall , examplefn not, how can go this? how have example object examplefn-like function in can use object's members? you need define youre function-pointer correctly. it's member-function pointer, needs this: typedef void(example::*examplefn )( pvoid p1, pvoid p2, pv

ES6 Javascript Classes - define class method to an existing function -

this question has answer here: es6 - declare prototype method on class import statement 3 answers in es5 can setting prototype existing function how go es6 classes //// es5 function existingfn = function () { // }; function myclass () { // constructor stuff }; myclass.prototype.newfn = function () { // … }; myclass.prototype.existingfn = existingfn; //// es6 class myclass { constructor() {} newfn() { // … } // ??????? // existingfn = existingfn // ??????? } ecma-script 6 class syntax syntactic sugar on regular prototype system: class { } // still possible! a.prototype.dostuff = function() { }; var existingfn = function() {}; a.prototype.existingfn = existingfn; var instance = new a(); instance.existingfn();

Oracle Log Miner - size of operation -

some background information @ first: i'm analysing load on oracle database .net application make use of nservicebus. we've observed high redo logs activity when running application , hence - high amount of archivelog (we've got database in archivelog mode). we've used toad logminer find out causes it, unfortunately many of operations of type unsupported. i've assume it's because of using securefile type of lob. i've digged database logminer view: v$logmnr_contents see there lot more columns in toad's logminer. what need size of each operation in redo. here's query far: select timestamp, rbabyte, seg_owner, seg_name, table_name, seg_type, seg_type_name, table_space, row_id, operation, sql_redo v$logmnr_contents 1 = 1 , operation = 'unsupported' i'm not sure if rbabyte correct value use or maybe calculation more complicated, me looks record size including lob

neo4j filter results from collect -

my problem this, have query one: match (a:a), (a)-[:relation]-(b:b) return {name: a.name, products: collect(distinct {productname: b.name, ident: b.identifier}) } and can't find way filter result of 'products', example, having rows productname = 'pname1' contained in array 'products': row1: {name: 'name', products:[{name: 'pname1', ident: 'id1'}, {name: 'pname3', ident: 'id3'}] } row2: {name: 'name2', products:[{name: 'pname2', ident: 'id2'}] } the example above return row1 thank in advance attention the with clause interesting thing query can splitted , query results @ point can saved variables. so, first row, query match (a:a), (a)-[:relation]-(b:b) a, collect(distinct {productname: b.name, ident: b.identifier}) products {productname: "pname1", ident:"id1"} in products return {name: a.name, products: products} edit: the solution above compar

html - How do I get rid of white space on the right side? -

i have found mysterious white space on right side underneath toolbar next picture have should extend way edge. if nav bar extends far. didnt notice need scroll on right see it. have tried playing around width on photo , nav bar. same thing appears on footer, seems in alignment photo leads me believe navbar on extending. have tried deleteing few things in navbar but, nothing seems fix problem. html: <div class="row"> <nav class="navbar navbar-custom" role="navigation"> <div class="navbar-header-xs"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#collapse"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar

assembly - Best practices for Indexing an array in MIPS -

when base address of array stored in register, understanding 1 not want adjust register. trying understand when principle valid. valid practice when dealing saved registers or saved registers , argument registers, too? below example working involves converting simple c code mips instruction. attempted solution in 2 ways. in first solution, increment registers holding base address of array , array b. thoughts given base address registers, $a0 , $a1, argument registers, not saved registers. thought, perhaps, wouldn't matter adjusted. in second solution, stored base address of each array temporary registers , manipulated instead. i did find solutions online particular example, i'm trying understand basis each instruction, rather following procedural solution. advice on best mips practice appreciated! # c code: (i=0; i<=100; i=i+1) { a[i] = b[i] + c; } # $a0 = base address of array # $a1 = base address of array b # $s0 = c # attempted solution # 1 l

c# - Register context menu verbs for specific file types -

i'm registering extended verbs video file types on system doing this: foreach (var ext in filetypes.videotypes) { var progid = registry.getvalue($@"hkey_classes_root\.{ext}", null, null); if (progid == null) { continue; } registry.setvalue( $@"hkey_current_user\software\classes\{progid}\shell\dlsub", null, "download subtitle"); registry.setvalue( $@"hkey_current_user\software\classes\{progid}\shell\dlsub\command", null, @"""d:\myapp.exe"" ""%1"""); } resulting in ( mpeg_auto_file mkv ): [hkey_classes_root\mpg_auto_file\shell\dlsub] @="download subtitle" [hkey_classes_root\mpg_auto_file\shell\dlsub\command] @="\"d:\\myapp.exe\" \"%1\""

python - Broken pipe error and connection reset by peer 104 -

Image
i'm using bottle server implement own server using implementation not far away simple "hello world" here , own implementation (without routing section of course): bottleapp =bottle.app() bottleapp.run(host='0.0.0.0',port=80, debug=true) my server keep getting unresponsive time , in browser: connection reset peer , broken pipe errno 32 logs give me same stack traces such in question . here own logs: what tried far, without success: wrapping server run line try except, like, shown here answer of "mhawke". stopped error messages in logs, apparently because caught them in except clause, problem when catching exception means have been thrown out of run method context, , want catch in way not cause server fall. don't know if possible without touching inner implementations files of bottle . adding before server run line: from signal import signal, sigpipe, sig_dfl signal(sigpipe,sig_dfl) suggested here , seems didn't had i