Posts

Showing posts from June, 2012

xcode - Parse stack to second view -

im creating rpn calculator in swift. need code view calculations when tape button pressed segue secondvc. when tape button pressed display calculations entered.the functionality in second view controller. im knew programming. have implemented prepareforsegue in first vc. not know how pass stack numberofrowsinsection calculator engine class calculatorengine :nsobject { var operandstack = array<double>() func updatestackwithvalue(value: double) { self.operandstack.append(value) } func operate(operation: string) ->double { switch operation { case "×": if operandstack.count >= 2 { return self.operandstack.removelast() * self.operandstack.removelast() second view class secondvcviewcontroller: uiviewcontroller, uitableviewdelegate, uitableviewdatasource { var array = [""] func tableview(tableview: uitableview, numberofrowsinsection section: int) -> in...

c# - Libgit2sharp can't find git2-*.dll when built in Xamarin studio on Windows -

i'm attempting build c# desktop application on windows xamarin studio. after importing libgit2sharp package (and consequently libgit2sharp.nativebinaries package), attempt use library results in 1 of these: exception in gtk# callback delegate note: applications can use glib.exceptionmanager.unhandledexception handle exception. system.reflection.targetinvocationexception: exception has been thrown target of invocation. ---> system.dllnotfoundexception: git2-785d8c4 @ (wrapper managed-to-native) libgit2sharp.core.nativemethods:git_config_find_xdg (libgit2sharp.core.handles.gitbuf) @ libgit2sharp.core.proxy.convertpath (system.func`2 pathretriever) [0x00006] in <filename unknown>:0 @ libgit2sharp.core.proxy.git_config_find_xdg () [0x00000] in <filename unknown>:0 @ libgit2sharp.configuration..ctor (libgit2sharp.repository repository, system.string repositoryconfigurationfilelocation, system.string globalconfigurationfilelocation, system.string xdgconfi...

c# - Choose my method name for delegate without reflection -

my delegate... private delegate double calculatedelegate(double x, double y); code declareing delegate... private calculatedelegate calculate; my methods use in delegates... private double add(double x, double y) { return x + y; } private double subtract(double x, double y) { return x - y; } how execute desired method... calculate = new calculatedelegate(add); or... calculate = new calculatedelegate(subtract); this works actual code contains many more 'functions' avoid using switch/if statement. need write new method send in. the calc method (i usied action here thinking might work, not) public double calc(action methodname, double x, double y) { calculate = new calculatedelegate(methodname); return calculate(x,y); } how execute desired method. public void go() { calc(add, 5,4); } is possible without reflection? what solution , use dictionary of delegates keys equal names of delegates, @ example.: public del...

c# - Step in through referenced assemblies code in Visual Studio -

Image
i've several visual studio solutions. each solution has several projects generating assembly. all of these assemblies generated these projects. so, these assemblies loaded dinamically using 2 ways: referenced browsing assembly location (for example debug folder of each project). ninject (loading classes of whichever assembly containing classes implements interface). currently, when need debug code of these referenced or loaded assemblies, need generate exception of whichever assembly i'd step in, , visual studio, automatically shows me code. i figure out there way able navigate through code assemblies, i've absolutly no idea how that. you may open solutions @ once in several visual studio instances. then may start main process. in other vs instances select "attach process ... ctrl+alt+p" find process , attach then may set breakpoint in instance of vs.

javascript - NodeJS + mysql: Select query returning individual objects -

i have been using mysql npm package many months , have not faced issues. code acting strange. using(connectionpool.getsqlconnection(), function(connection) { return connection.queryasync('select * table_name'); }).spread(function(rows, fields) { console.log('rows: %j', rows); console.log('fields: %j', fields); res.json(rows); }).error(function(err) { console.log(err); }); i know there 50 rows in table. getting 1 in rows . also, strangely fields has 2nd row. idea why happening? have used same query elsewhere no problems. edit i fiddled around little bit , found each row coming separate object. if change code following: using(connectionpool.getsqlconnection(), function(connection) { return connection.queryasync('select * table_name'); }).spread(function(r1, r2, r3, r4) { console.log('rows: %j', r1); console.log('rows: %j', r2); console....

python - Read text from TextBuffer in pyGtk using TextMarks -

i using multiline text view , text buffer manipulate text in pygtk. want read input position insert pressed last time, , current position insert pressed again. def markit(self, pos): mark = self.create_mark(mark_name = 'startinsert', = pos, left_gravity = true) mark.set_visible = true return mark def keypress(widget, event): if event.keyval == 65293: buff = termwindow.get_buffer() # read command. ### how this????? print command # delete previous created mark. buff.delete_mark_by_name('startinsert') buff.markit(current_pos) return true return false this mark create every time in enter key callback function. initially, position can zero. also, though did set visibility true, not visible.

angularjs - How to access Angular attribute via Javascript injection -

for instance, let's have <div class="row costbreakdown__shipping"> <div class="small-8 medium-7 large-7 columns">shipping:</div> <div class="small-4 medium-5 large-5 columns text-right" ng-switch="cart.israted"> <!-- ngswitchwhen: true --><div ng-switch-when="true" class="ng-binding ng-scope">$8.48</div><!-- end ngswitchwhen: --> <!-- ngswitchwhen: false --> </div> </div> how 1 access value $8.48 in class costbreakdown__shipping? i've have var x = $(".costbreakdown__shipping").eq(2).children().eq(1).children().eq(1) which gives me <!-- ngswitchwhen: true --><div ng-switch-when="true" class="ng-binding ng-scope">$8.48</div> but how go accessing value inside? have tried using .innerhtml @ end of assignment va...

How to write clojure documentation for a single function in a protocol? -

let's have protocol this: (defprotocol x (y [this z])) how write documentation targeted function y ? the normal way doing be: (defn y "some documentation" []) but if do: (defprotocol x (y "some documentation" [this z])) i following exception: java.lang.illegalargumentexception: parameter declaration missing so how add kind of documentation? (defprotocol x (y [this z] "some documentation"))

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -

i have excel workbook used generate quotations customers. there main page user inputs data, , there buttons generate various pdfs , send them customer. however, 1 user consistently getting error preventing generating , sending pdfs. i beleive "microsoft windows common controls 6.0 (sp6)". it's installed on users' computers. on mine, location "c:\windows\syswow64\mscomctl.ocx" on others "c:\windows\system32\mscomctl.ocx" the user experiencing issues on 32-bit machine, "mscomctl.ocx" file should in system32. have manually put in there, , pointed common controls reference in vba it. issue seems keep reverting looking in syswow64. since folder doesn't exist, can't find it, , can't produce pdfs. i thought perhaps issue user running older version of office (2007) there users on 2013 , 2016. thought perhaps mixture of 64-bit , 32-bit users. user gets sent workbook other users (as quotation process goes further, gets passed ...

javascript - Insert $index into name attribute in an ng-repeat angularJS -

in order asp.net mvc correctly bind list of items on form post, name attribute has along lines of name='show.days[0].openhour' name='show.days[1].openhour' the user can enter number of days show form field, updates model , ng-repeat. i'd able insert appropriate index name field, like name='show.days[$index].openhour' is possible angular? use name="show.days[{{$index}}].openhour" . this, angularjs evaluates $index , replaces correct value.

php - Contact form validation and email send. Works. How to do things better? -

this code works , works although know there redundancies , better ways things. one, instead of using form action=mypage.php, have php html code. when tried have in mypage.php, none of variables found in $_post. though isset result true on $_post. so... weird, , screw it, put in html. trying wamp, wouldn't work on server either. another issue, refresh of page after submission send email well, might resolved if solve form action issue above. how's validation? recommended improve process or security? <h1><div class="titlewrapper"><div class="titlecontact">contact</div></div></h1> <div class="contact"> <ul class="contactcolumn"> <li> <div class="fields"> <form method='post'> <input type="text" name="name" placeholder="your name" maxlen...

jquery - How can I call script inside script to refresh my Partial View in JavaScript with Ajax MVC asp.net -

how can call script inside ajax script refresh partial view or maybe there way refresh div=itemstable. first script in section scripts display div=itemstable data webservice , database. second script buying item shop when user click buy. after user purchase item, script should run first script refresh data. more information in code below. my view: list <div id="itemstable"> loading data... </div> @section scripts { <script> $(document).ready(function webservicescript() { if ("webservice" in window) { var ws = new webservice("ws://some_webservice"); ws.onmessage = function (evt) { var receivedmsg = evt.data; $.ajax({ url: '/store/listpartial', data: receivedmsg, type: 'post', ...

Java: How check if two arrays are in same order? -

this question has answer here: how compare strings in java? 23 answers for example, have 2 arrays: string [] arr1 ={"you", "book"}; string [] arr2 ={"do", "you", "like","book" }; i want check if arr1 match arr2 in terms of same order. if arr1 {"book", "you"} , arr1 not match arr2 . alright, think code wrong, anyway: for (int = 0; i<arr1.length; i++){ (int j=0; j<arr2.length; j++){ if (arr1[i] != arr2[j]){ return null; } } } but when run it, return null arr1 match arr2 . you can filter elements in array 1 aren't in array 2. result should match array 1. public static boolean withinandinorder(string[] a, string[] b) { return arrays.equals(a, arrays.stream(b) .parallel() .filter(...

python - Slicing a NumPy array within a loop -

this question has answer here: what difference between = + 1 , += 1 in 'for' loop? [duplicate] 6 answers i need explanation (reference) explain numpy slicing within (for) loops. have 3 cases. def example1(array): row in array: row = row + 1 return array def example2(array): row in array: row += 1 return array def example3(array): row in array: row[:] = row + 1 return array a simple case: ex1 = np.arange(9).reshape(3, 3) ex2 = ex1.copy() ex3 = ex1.copy() returns: >>> example1(ex1) array([[0, 1, 2], [3, 4, 5], [6, 7, 8]]) >>> example2(ex2) array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) >>> example3(ex3) array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) it can seen first result differs second , third. first example: you extract row , a...

Google Cloud Messaging iOS library doesn't have armv7s slice -

i setup google cloud messaging ios library following official site(below), , built app. https://developers.google.com/cloud-messaging/ios/client?ver=swift#set_up_your_cocoapods_dependencies then found module inside doesn't have armv7s slice. file universal (4 slices) not contain a(n) armv7s slice: /users/.../pods/googleutilities/libraries/libgtm_nsdata+zlib.a' architecture armv7s i think there no way use library if app supports armv7s, appreciate if knows workaround.

java - my server resultset is taking long time while looping through -

i facing performance issue sql server when trying connect using java application. sqljdbc4-4.0 driver version. looks latest available this. the issue comes when use preparedstatemnt set paramerter option , when looping trough result set after specific number of iterations execution stops amost 5min , start iterating again. stopping occuring on fixed iterations. this behavior occurs simple query below. preparedstatemnt ps = null; resultset rs = null; ps = con.preparestatemnt("select id,name,phone table1 name = ?"); ps.setstring(1, "raj"); rs = ps.executequery(); // ok here int i=0; while(rs.next()){ // hangs here system.out.println(i++); } however, works fine if not set parameter , concatenate parameter query this, preparedstatemnt ps = null; resultset rs = null; ps = con.preparestatemnt("select id,name,phone table1 name = 'bob' "); rs = ps.executequery(); // ok here int i=0; while(rs.next()){ // ok s...

How to match specific length of occurrences in RegEx/JavaScript? -

i have following variable: var arg = '--test'; the value of arg can start 1 or 2 hypens: - or -- , not more. i want handle , figured should regex problem. so far, code is: if(arg.substr(0, 2).match(/-{1,2}/gi)) { // doing stuff here... } what slice first 2 characters of string , try test hypen occourence in sliced string, regex not strong side that's i'm stuck. basically, want test if there's @ least 1 or maximum 2 - hypens in string/argument. you can restrict number of hyphens (?!-) negative lookahead after ^-{1,2} : /^-{1,2}(?!-)/ see regex demo pattern breakdown: ^ - start of string -{1,2} - 1 or 2 hyphens (?!-) - fail match if there hyphen after 2 hyphens @ start. note check if regex matches given string or not in js, you'd better use regexp#test() method, see demo below. function tst() { var arg = document.getelementbyid("test").value; if (/^-{1,2}(?!-)/.test(arg)) { // <====...

php - Schedule job in laravel time interval -

i have 3 schedule job every hour in kernel.php below: $schedule->command('get:twitter')->cron('* 1 * * * *'); $schedule->command('get:facebook')->cron('* 1 * * * *'); $schedule->command('get:googleplus')->cron('* 1 * * * *'); i want run 3 schedule in time interval below: $schedule->command('get:twitter')->cron('* 1 * * * *');//after 1 hour $schedule->command('get:facebook')->cron('30 1 * * * *');//after 1.30 hour $schedule->command('get:googleplus')->cron('45 1 * * * *');//after 1.45 hour is possible in laravel 5.1 there no out of box can this: // every hour $schedule->command('get:twitter')->hourly(); // every 1 , half hours $schedule->command('get:facebook')->cron('0 0,3,6,9,12,15,18,21 * * * *'); $schedule->command('get:facebook')->cron('30 1,4,7,10,13,16,19,22 * * * *'); ...

Excel table to XML Vba converter is putting all my data rows into one tag as attributes? -

i asked question yesterday , got no answers. trying transform , excel table xml. below have (number of children reduced overall format repeated). issue have when increase number of rows, gives me this. <root> <random> <random1 a="a2" b="b2" <random1 a='a3' b="b3" > <cookie> <orange c="c2" d="d2" <orange c="c3" d="d3"/> </cookie> </random1> <random> <root> i format. <root> <random> <random1 a="a2" b="b2"> <cookie> <orange c="c2" d="d2"/> </cookie> </random1> <random1 a='a3' b="b3" > <cookie> <orange c="c3" d="d3"/> </cookie> </random1> <random> <root> basically, how data appear consecutively instead of in 1 line? code below. ...

jquery - Number appearing in Perl-generated JavaScript code instead of "$(" -

on site i'm working on there random numbers appearing in simple bit of jquery. instead of what's meant appear, these numbers —  48 , etc. — appear @ beginning. this: <script type="text/javascript"> 48 48document).ready(function () { 48 48".closed").click(function () { 48 48this).find("div.but").toggleclass('plus').toggleclass('minus'); 48 48this).toggleclass('closed').toggleclass('open'); }); }); </script> i can't begin imagine why spit out when hard-coded site , there's no external file or anything. ok, since it's perl need escape $( , how? took @ perl documentation , felt i'd been punched. do use single quotes instead of double quotes? <script type="text/javascript"> $(document).ready(function () { $('.closed').click(function () { $(this).fi...

vb.net - Visual C++ 2005 merged modules not installing -

i've written crystal report viewer in vb .net (vs 2013). it works fine part, found on pcs faced error: the type initializer 'crystaldecisions.crystalreports.engine.crpe threw , exception so after long trial , error (and incredible degree of google searching) found out crystalreports vb has dependency visual c++ 2005 redistribution. so got merged modules , incorporated them installer. find out need specific '8.0.50727.762' versions came atl security update. not '8.0.50727.42' had. had install service pack 1 visual studio 2005 in order these new updated merged modules! only find i'm faced same error. the merged modules follows: visual c++ 8.0 openmp visual c++ 8.0 mfc visual c++ 8.0 mfcloc visual c++ 8.0 crt visual c++ 8.0 atl sap crystal reports runtime engine .net framework 4 (crruntime_12_0_16.msm) (i have corresponding policy .msm's) after run installer , run program, error. if install microsoft visual c++ 2005 service pack 1...

ms word - Easiest way to make a wizard that takes input and generates a document -

in our project have lot of people generating many plans , report (word , pdf) documents. problem don't follow same standards after sharing template. what wish. making program/solution following; 1- select type of document u want (e.g. status report or test plan) 2- based on report u chose, offers u text box write ur text 3- next next , after keep filling necessary fields - generates word document input so opinion on how , tool use achieve in quickest way possible? im not developer have basic programming skills , knowledge i used ms access. made table fields interested in having using form wizard, connected them interactive form generated document in formats using report wizard of ms access

java - onCreateView for tab being called whenever selecting adjacent tab? -

i having weird issue oncreateview being called every time navigate adjacent tab in tablayout . here code: news_feed.java: private static tablayout tablayout; @override public void oncreate(bundle savedinstancestate) { tablayout = (tablayout) findviewbyid(r.id.tab_layout); tablayout.addtab(tablayout.newtab().settext("public")); tablayout.addtab(tablayout.newtab().settext("friends")); tablayout.addtab(tablayout.newtab().settext("my tabs")); tablayout.settabgravity(tablayout.gravity_fill); final viewpager viewpager = (viewpager) findviewbyid(r.id.pager); final pageradapter adapter = new pageradapter (getsupportfragmentmanager(), tablayout.gettabcount()); viewpager.setadapter(adapter); viewpager.addonpagechangelistener(new tablayout.tablayoutonpagechangelistener(tablayout)); tablayout.setontabselectedlistener(new tablayout.ontabselectedlistener() { @override public void ontabselecte...

python - Get related objects from a queryset, preserving the ordering -

i have model, looks this: class agent(models.model): class meta: ordering = ['first_name', 'last_name', ] first_name = models.charfield(max_length=100) last_name = models.charfield(max_length=100) ... other fields ... class point(models.model): agent = models.foreignkey(agent) ... other fields ... when select points want them ordered agent names, this: points = point.objects.filter(...smth...).order_by(-agent) so resulting queryset ordered agent names, z a or points = point.objects.filter(...smth...).order_by(agent) or without ordering the question is: how queryset or list of unique agent objects points queryset, preserving ordering? preferrably, without more order_by() statements, because view may or may not explicitly aware of ordering type something set(points.values_list('agent', flat=true)) , objects instead of pk-s? you can use own idea , nest (where points queryset of point ): agent.o...

how can i use variable in Google Chart Javascript -

below code: <div id="chart_div"></div> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript"> var data12 = '<%= globalvariable.data99 %>'; // load visualization api , corechart package. google.charts.load('current', { 'packages': ['corechart'] }); // set callback run when google visualization api loaded. google.charts.setonloadcallback(drawchart); function drawchart() { // create data table. ...

Toolbar not showing menu when minsdk set to 21 or lolipop 5.0 -

i testing toolbar in android 5.0 lolipop show menu configurations min sdk 21 , target sdk 23 using default toolbar sdk 21 i.e android 5.0 lolipop not using appcompact v7 support earlier version android 5.0 lolipop stuck @ menu not showing tried lots of no luck.please me rid of that.thanks in advance. following code. public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar); textview mtitle = (textview) toolbar.findviewbyid(r.id.text); mtitle.settextcolor(color.parsecolor("#636161")); mtitle.settextsize(25); toolbar.setnavigationicon(r.drawable.ic_launcher); toolbar.settitle(r.string.app_name); toolbar.settitletextcolor(color.parsecolor("#eea9b8")); toolbar.settextalignment(view.text_alignment_gravity); } ...

php - Search query shows all results when clicking search button -

i got simple search query works, shows results when search button clicked without search input. it shows results parent_id 26 or cattid 26 want prevent in query. why still showing results id's , how can prevent every result appearing on result page when there no search input? how build: html: <li> <div class="mn-wrap"> <form method="post" class="form" action="zoeken/"> <div class="search-wrap"> <button class="search-button animate" type="submit" title="start zoeken"> <i class="fa fa-search"></i> </button> <input type="text" name="zoekterm" class="form-control search-field" placeholder="zoek..."> </div> </form> </div> </li> .htaccess: rewriterule ...

JSON validation against JSON schemas: Why is this obvious JSON data not failing validation -

this json file should fail validation not. tell me why. plug below json data , schema web site, validate, http://json-schema-validator.herokuapp.com , same results in mule validate json schema. not comply schema (i added fields, misspelled fields, date-time value not real date time) yet not fail it. can tell me why? json schema: { "$schema": "http://json-schema.org/draft-04/schema#", "id": "http://hud.gov/ocio/xsd/esb/serviceauditingframework/2.0#", "definitions": { "serviceauditlogdata": { "type": "object", "title": "serviceauditlogdata", "required": [ "servicerequesttimestamp", "sourcesystem" ], "properties": { "auditid": { "type": "string" }, "servicerequesttimestamp": { "type": ...

c# - finding points along a vector in 3d -

Image
i have 2 points in 3d space, , want list of points between them located "r" distance each other. how can using unity functions? vector3[] getpointsinbetween(vector3 a, vector3 b, float offset){ int count = (int)((b - a).magnitude / offset); vector3[] result = new vector3[count]; vector3 delta = (b - a).normalized * offset; (int = 0; < count; i++) { result[i] = + delta * i; debug.log(result[i]); } return result; } but .magnitude , .normalized expensive operations, try avoid using in update()

c# - Activator.CreateInstance, : Constructor on type 'Pastel.Evolution.PurchaseOrder' not found -

i have gotten point trying create instance of class in assembly have loaded. object obj= activator.createinstance(purchaseorder, bindingflags.nonpublic | bindingflags.instance, null, new object[] { purchaseorderdocumentbase }, null); i keep getting error : an unhandled exception of type 'system.missingmethodexception' occurred in mscorlib.dll additional information: constructor on type 'pastel.evolution.purchaseorder' not found. what read already: most of people referring constructors being private. type loading has 4 constructors public. refer type not having default constructor, thing problem. i have tried invoke first constructor has no parameters : constractor.invoke(purchaseorder, null); i following error. an unhandled exception of type 'system.reflection.targetexception' occurred in mscorlib.dll additi...

Drupal 6: Access Denied on custom module -

i have module, admin users can access module normally. when add permission other roles (and saved), other users have permimssion couldn't access it. please me. here code: <?php include_once(drupal_get_path('module', 'tb') .'/tb.menu.inc'); include_once(drupal_get_path('module', 'tb') .'/tb.inc'); function tb_perm() { global $user; return array('trial_balance'); } function tb_menu() { global $user; $items = array(); $items['akuntansi/tb'] = array( 'title' => 'trial balance', 'type' => menu_normal_item, 'page callback' => 'tb_neracapage', 'file' => 'tb.inc', 'access arguments' => array('akuntansi'), 'access callback' => true, //'type' => menu_callback, ); $items['akuntansi/tb/pdf'] = array( 'page callback' => 'tb_neracapage_pdf',...

node.js - How to configure Hystrixjs in a node app? -

i trying configure hystrixjs 1 of nodejs app. want wrap couple of external dependencies app making. https://www.npmjs.com/package/hystrixjs i read readme still couldn't how can wrap dependency call hystrix , how configure dashboard this. if tried before please give me directions. thanks. you can find sample in example app in repo. feel free submit question on bitbucket , try provide more examples. in general can wrap function returns promise, not have http request, although common use case. the dashboard not part of hystrix itself. way works, can run dashboard locally, see instructions here , add endpoint application expose metrics. example app shows how it: function hystrixstreamresponse(request, response) { response.append('content-type', 'text/event-stream;charset=utf-8'); response.append('cache-control', 'no-cache, no-store, max-age=0, must-revalidate'); response.append('pragma', 'no-cache')...

angularjs - Uglify Js Creating forloop bug -

i have loop uglified and for (var row = 0; row < dbrows.length; row++) { dbrows[row].dayslist[day].taskid = dbrows[row].taskid; dbrows[row].dayslist[day].activityid = dbrows[row].activityid; } } } after uglification becomes this for (var h = 0; h < b.length; h++) b[h].dayslist[g].taskid = b[h].taskid, b[h].dayslist[g].activityid = b[h].activityid, so first line after loop start executing other not working @ all. i'm pretty sure wrong. comma operator can used put multiple expressions 1 expression. for reference can @ mdn page. also, here's example try out: for(var h = 0; h<2;h++) alert("first line"), alert("second line");

python - importing user defined library in redshift UDF -

here trying import library inside user defined python function in redshift i have created library called nltk follows [create or replace library nltk language plpythonu 's3://nltk.zip' credentials 'aws_access_key_id=*****;aws_secret_access_key=****';] once created tried import in function as create or replace function f_function (sentence varchar) returns varchar stable $$ nltk import tokenize token = nltk.word_tokenize(sentence) return token $$ language plpythonu; tokenize sub directory inside nltk library but when try run function calling on table as select f_function(text) table_txt; i getting error such amazon invalid operation: importerror: no module named nltk. please @ svl_udf_log more information details: ----------------------------------------------- error: importerror: no module named nltk. please @ svl_udf_log more information code: 10000 context: udf query: 69145 location: ...

linux - How can I create a fake device file to mimic dev/mem? -

i want control access dev/mem. in order so, thinking of creating fake dev/mem, processes access instead of actual dev/mem. my process modify dev/mem depending on changes in fake one. is possible? if so, how do this? look @ drivers/char/mem.c, in chr_dev_init(), remove register, class_create, device_create calls. move these calls driver , driver's read/write calls, directly call ones in mem.c

osx - How the OS X generate the icon phash? -

i have tried use wireshark sniff airdrop function in os x, found there element call phash. txt: phash=uphaxlrunb0icgy2udupw6cv5fi= when using airdrop, appearance icon user icon if have set it. have tried change icon lot of time , open airdrop , using wireshark capture phash value, because phash value generated os x itself, correct, can use scapy change phash value record , resend it, appear icon on airdrop. think os x have method generate value, want know don't need repeat change icon , capture it.

django - Nginx password authentication keeps prompting for password -

i want upload development branch of website can show clients , make tests in environment close production possible (with code may not ready production). password protect site. i'm developing website using django , use nginx serving website (with uwsgi). manage prompted password applying following directives: auth_basic "restricted content"; # tried "private property" auth_basic_user_file /etc/nginx/.htpasswd; but problem after entering first password properly, keeps prompting me user & password again; if every api call need authenticated. i think issue might configuration file, here's site.conf file: server { listen 80; server_name panel.mysite.dev; root /path/to/my/app/front/dist; ### i've tried 'auth_basic' here location / { root /path/to/my/app/front/dist; index index.html; auth_basic "private property"; auth_basic_user_file /etc/nginx/.htpasswd; } loc...

java - Is using DynamoDBMapper a bad idea? -

i've started on dynamodb , came across instruction on dynamodbmapper http://aws.amazon.com/articles/0802321832592496 let have user pojo, dynamodb annotations added like: @dynamodbtable(tablename = "users") public class user { private integer id; private set<string> friends; private string status; @dynamodbhashkey public integer getid() { return id; } public void setid(integer id) { this.id = id; } @dynamodbattribute public set<string> getfriends() { return friends; } public void setfriends(set<string> friends) { this.friends = friends; } @dynamodbattribute public string getstatus() { return status; } public void setstatus(string status) { this.status = status; } } since pojo used carry data across layers in typical application, e.g persistence layer api layer ... sound bad idea tie specific database technology. in relational realm, 1 use java persistence api annotation, database agnostic. ...

c++ - Does the use of an anonymous pipe introduce a memory barrier for interthread communication? -

for example, allocate struct new , write pointer write end of anonymous pipe. if read pointer corresponding read end, guaranteed see 'correct' contents on struct? also of of interest whether results of socketpair() on unix & self connecting on tcp loopback on windows have same guarantees. the context server design centralizes event dispatch select/epoll for example, allocate struct new , write pointer write end of anonymous pipe. if read pointer corresponding read end, guaranteed see 'correct' contents on struct? no. there no guarantee writing cpu have flushed write out of cache , made visible other cpu might read. also of of interest whether results of socketpair() on unix & self connecting on tcp loopback on windows have same guarantees. no.

c++ - Qt Designer (creator) widget box like widget -

Image
is there example or complete code qt designer (creator) widget box widget qwidget or qframe within? should work qtoolbox or qtabwidget expandable: possible view few pages (widgets) @ time, not single 1 qtoolbox or qtabwidget or qstackedwidget provide. or need write myself using qtreewidget example? need same , feel same root decoration on category button (or panel) in in qt creator or line following: + ——- category 1 ———— widgets widgets + ——- category 2 ———— widgets widgets etc if exists plugin qt creator - better. created sample widget , plugin qt designer, put on github if else need , want improve: https://github.com/akontsevich/widgetbox . ready using points have improved: style category button (or panel) closer qt creator (designer) or libreoffice writer properties tool box on right side fix ispageexpanded propery change in qt designer hope community participation or suggestions on these improvements. sample screenshots of current state:

visual studio - LNK2005 error because I have two c++ windows running parallel -

i working on uni project multiple tasks, , trying debug simple program, getting error "lnk2005 main defined in task 1". i realise because have used "int(main)" both tasks (i have code task 1 , code task 2). not want have create new project folder every task. there way around ? while advisable have project each executable build, can away having single project multiple executables if manage somehow rid of undesired duplicate mains. have quite few options available you: have 1 main. have test own executable name, , take specific action depending on name finds. in post-build rules, set rules creating each (specifically named) executable base executable. allows build executables @ same time in efficient manner. have multiple mains, hide them using #ifdefs. add #define project settings or somewhere above main(), , compile needed. ok if don't want build executables time. just bite bullet , set multiple projects. whatever do, consider being able b...

wso2 das - DAS 3.0.1 Event Publisher gives an error while trying to publish Output Event rdbms to API Manager 1.10 -

[2016-03-17 15:46:52,955] error {org.wso2.carbon.event.output.adapter.core.internal.outputadapterruntime} - event dropped @ output adapter 'request_summary' tenant id '-1234', null java.lang.nullpointerexception @ org.wso2.carbon.event.output.adapter.rdbms.rdbmseventadapter.initializedatabaseexecutioninfo(rdbmseventadapter.java:226) @ org.wso2.carbon.event.output.adapter.rdbms.rdbmseventadapter.publish(rdbmseventadapter.java:132) @ org.wso2.carbon.event.output.adapter.core.internal.outputadapterruntime.publish(outputadapterruntime.java:69) @ org.wso2.carbon.event.output.adapter.core.internal.carbonoutputeventadapterservice.publish(carbonoutputeventadapterservice.java:143) @ org.wso2.carbon.event.publisher.core.internal.eventpublisher.process(eventpublisher.java:361) @ org.wso2.carbon.event.publisher.core.internal.eventpublisher.sendevent(eventpublisher.java:209) @ org.wso2.carbon.event.publisher.core.internal.eventpublisher.consumeeven...

ios - how to set tableview accordion in swift? -

i new ios , trying design accordion menu.i got stucked..first made ui having static contents (labels in 3 rows in table view , views..).while trying set accordion..didnt show response.. here viewcontroller.swift func tableview(tableview: uitableview, didselectrowatindexpath indexpath: nsindexpath) { let previndexpath = selectedindexpath if indexpath == selectedindexpath { selectedindexpath = nil } else { selectedindexpath = indexpath } var indexpaths:array <nsindexpath> = [] if let previous = previndexpath { indexpaths += [previous] } if let current = selectedindexpath { indexpaths += [current] } if indexpaths.count > 0 { tableview.reloadrowsatindexpaths(indexpaths, withrowanimation:uitableviewrowanimation.automatic) } } func tableview(tableview: uitableview, willdisplaycell cell: uitableviewcell, forrowatindexpath indexpath: nsindexpath) { (cell as! tab...

jsf - Why does ${bean.property} auto-creates a bean in JSP? -

i know jsp has been deprecated. here , mentioned that in jsp, ${} won't autocreate managed bean when it's not in scope yet. can use if can guarantee #{} on same managed bean been used somewhere before in component tree , take view build time vs view render time lifecycle account. just check whether true or not, came this: a simple jsp page this, <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <html> <head> </head> <body> ${myplayersbean.playername} here </body> </html> where @managedbean(name = "myplayersbean") @requestscoped public class playersbean { private string playername = "rafael"; // getters & setters } it outputs on hitting http://localhost:8080/leonard/faces/create.jsp : rafael here please suggest? this statement, in jsp, ${} won't auto...

java - File management with BufferedInput/OutputStream -

i'm using bufferedinputstream , bufferedoutputstream copy mp4 video programatically. it's being correctly copied, except because lose audio! code: fileinputstream fi = null; fileoutputstream fo = null; try { file f = new file("c:\\users\\zerok\\videos\\v.mp4"); fi = new fileinputstream(f); fo = new fileoutputstream("video.mp4"); bufferedinputstream buffin = new bufferedinputstream(fi); bufferedoutputstream buffout = new bufferedoutputstream(fo); int read; while((read = buffin.read()) != -1){ buffout.write(read); } } catch (filenotfoundexception ex) { logger.getlogger(javaapplication13.class.getname()).log(level.severe, null, ex); } catch (ioexception ex) { logger.getlogger(javaapplication13.class.getname()).log(level.severe, null, ex); } { try { fi.close(); } catch (ioexception ex) { logger.getlog...

How to get correct MQTT tcp ? project in Android Studio -

here code @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); try { //xxx.xxx.xxx.xx:xx problem mqttclient client = new mqttclient("tcp://xxx.xxx.xxx.xx:xx", mqttclient.generateclientid()); } catch (mqttexception e) { e.getmessage(); // client null } what correct tcp address ? computer tcp ? or phone tcp ? how ? i try computer tcp , phone ip , "client null "