Posts

Showing posts from January, 2010

typescript - Header files for Mongoose' 'plugin' method (extending via .methods and .statics) -

i'm trying create typescript header files script extends mongoose-model using .plugin method. current signature mongoose header-files : export class schema { // ... plugin(plugin: (schema: schema, options?: object) => void, options?: object): schema; // ... } some actual code mongoose-lib : /** * registers plugin schema. * * @param {function} plugin callback * @param {object} [opts] * @see plugins * @api public */ schema.prototype.plugin = function (fn, opts) { fn(this, opts); return this; }; then own model, extending plugin ; import passportlocalmongoose = require('passport-local-mongoose') // ... var userschema = new mongoose.schema({ email: string, password: string, }); // ... userschema.plugin(passportlocalmongoose, { usernamefield: "email", usernamelowercase: true }); snippet passport-local-mongoose source: module.exports = function(schema, options) { // ... schema.method

javascript - Custom HTML tags and CSS -

Image
i using custom html tag <spin-loader> encapsulates css styles , few div s form windows 8 loading spinner: it uses shadowdom (as seen in image) hide div s client , allow them use 1 tag complex element (no additional js, css or html). happen able use css on element change styles/features in controlled manner; background-color , example, change background of circles ( div s), , increasing width increase size of circles too. possible? edit: forgot mention css styles (such background shown in picture) don't work anyway. here's link spinner: http://cryptolight.cf/curve.html explanation your spin-loader tag has 0 sizing due root div child having no children give size. remember, gave div s position: absolute property. therefore, looking @ flying div s outside of spin-loader tag. try, <spin-loader style="display:inline-block; overflow:hidden; position:relative;"> and you'll see mean. solution here's how style them,

javascript - Kendo MVVM Grid export all pages in pdf -

i found kendo grid exporting pages javascript code $("#grid").kendogrid({ toolbar: ["pdf"], pdf: { allpages: true, filename: "kendo ui grid export.pdf", //optional proxyurl: "http://demos.telerik.com/kendo-ui/service/export" //optional }, ..... it exports pages of grid how use allpages setting in mvvm grid like <div data-role="grid" data-editable="false" data-columns="[ .... ]" data-selectable="false" data-bind="source: datasource" data-row-template="row-template" data-alt-row-template="alt-row-template" data-pageable="{ refresh: true, pagesizes: [50, 100] }"

vector - Convert worldcoordinates to screen coordinates -

how can convert 3d vector 2d vector can drawn on screen? have camera position, positon of 3d point, vertical , horizontal rotation of camera, screen resolution , field of view. heard world screen function not know how use it. there way using maths? thx. in advance. mate. question not of simple answer. explain maths if remembered. it's been time since don't study linear algebra. first, methods call uses math looking for, , optimized! but, regarding questions maths behind it, here link: https://en.wikipedia.org/wiki/3d_projection this "3d vector 2d vector screen point" called projection, , referring perspective projection. explained in link. if interested in learning it, should first study linear algebra, , start studying computer graphics. (one book: http://www.amazon.com/gp/product/0321399528/ref=as_li_qf_sp_asin_tl?ie=utf8&camp=1789&creative=9325&creativeasin=0321399528&linkcode=as2&tag=casueffe06-20 )

url rewriting - How to do URL Rewrite in Zuul Proxy? -

one of request comes zuul filter of uri /hello/world want redirect /myapp/test . /myapp/test service registered in eureka. zuul: routes: xyz: path: /hello/world url: http://localhost:1234/myapp/test stripprefix: true when try above configuration, incoming uri suffixed configured url http://localhost:1234/myapp/test/world . few of links came across seem stating url rewrite feature not yet available in zuul. is there other way can done @ zuul layer ? note : @ point of time, cannot reverse proxying in webserver or other layer since, zuul filter 1 receiving request directly. have tried creating pre filter or route filter ? that way can intercept request, , change routing. see zuul filters

Webm HTML5 doesn't seem to be compatable with IOS safari -

i'm struggling understand why wouldn't supported. snippet follows: <video autobuffer="autobuffer" autoplay="autoplay" class="maskfill" loop="loop" src="/videos/maskfill.webm" type="video/webm; codecs=vp8,vorbis"></video> is there official reason this? or there recommended alternative? i've considered moving them on mp4 i'm doubtful of lack of compression. the answer simple: it not supported . reason ios can hardware decoding of few codecs (typically h.264 profiles). so, recommended alternative use h.264 .

java - Using Mockito to mock a class method inside another class -

i'm trying write unit tests mockito / junit function this: class1 { method { object1 = class2.method // method want fake return value // code still want run } } is there way in mockito stub result of class2.method? i'm trying improve code coverage class1 need call real production methods. i looked mockito api @ spy method overwrite whole method , not part want. i think understanding question. let me re-phrase, have function trying test , want mock results of function called within function, in different class. have handled in following way. public myunittest { private static final myclass2 class2 = mock(myclass2.class); @begin public void setuptests() { when(class2.get(1000)).thenreturn(new user(1000, "john")); when(class2.validateobject(anyobj()).thenreturn(true); } @test public void testfunctioncall() { string out = myclass.functioncall(); assertthat(out).isequalto("output&qu

Combining spreadsheets in python using pandas -

so, have little bit of code i'm trying work combine spreadsheets in python. here (updated/edited) code: import pandas pd import numpy np import os os.path import basename df = [] #enter file names via terminal file1 = raw_input("enter path first file(don't forget include extension (.xlsx windows)):") file2 = raw_input("enter path second file(don't forget include extension (.xlsx windows)):") #combine .xlsx files f in [file1, file2]: data = pd.read_excel(f, 'sheet1').iloc[:-2] data.index = [os.path.basename(f)] * len(data) df.append(data) #add column includes original file data.index = [basename(f)] * len(data) #set path , name of final product file final = raw_input('where want file, , want name it? format answer such: (c:\path_to_file\name_of_file.xlsx):') df = pd.concat(df) df.to_excel(final) the test inputs are: product inventory price sold banana 50 $1.00 27 grapes 100 $3.00

html - Attach div to the right of another div -

i have div container , inside of there 2 images. 1 image on left side of div , other on right. container bootstrap's container both of them wrapped div, , div's position fixed . my problem can't locate right image attached right side of conatiner. tried float , right properties not give expected result. how can attach div right of div? if i'm understanding problem correctly, have large container fixed position. left div on inside of container sticks inside left, , right div inside container sticks inside right? you can set display inline-block force them side side, , use left/right position them within container: html: <div class="container"> <div class="left-element"> left </div> <div class="right-element"> right </div> </div> your css this: .container { width:500px; position: fixed; } .left-element { background: green; dis

css - Find current domain URL for universal script PHP -

you can this? background-color: url(".<?php current domain ?>."/shop/img/test.jpg"); i want current url create universal scripts site you can use $_server['php_self']; or $_server['request_uri'];

java - Tomcat 501 on non-supported http verbs -

we getting users hitting our tomcat servers custom http verbs (like unsubscribe ). unfortunately, when tomcat encounters 1 of these, returns: 501 not implemented since it's 500 error, trips our monitor wakes system guys. we're trying figure out how change 400 level error , have ignored tomcat. tried security-constraint don't believe it's right approach (and didn't fix issue). is there fix this? using version 7.0.55 springmvc 4.0

nhibernate - Check if a session is dirty but don't flush -

i'm sure i've seen discussed, must not using right keywords because can't find on now: i have desktop application using nhibernate persistence. i'd use session's isdirty property notify user whether persistent data has been changed, showing him either close button or apply , cancel button, depending. the problem calling isdirty causes @ least data flushed database, despite fact flushmode never . i'm interested in knowing why isdirty feels has flush changes, more importantly want know how can information without flushing. as aside: since don't have transaction wrapping whole time user edits information on form, assume changes flushed there stay, whether end committing else or not. so, can tell me how functionality want without functionality don't? i did dirty state tracking within viewmodel properties. on each propertychanged call markasdirty() of viewmodelbase class. reflects property bound onto save button command. but i

c++ - Inheriting constructors w / wo their default arguments? -

c++ primer (5th edition) on page 629 states: if base class constructor has default arguments, arguments not inherited. i tried myself , me seems derived constructor generated compiler has same default arguments base constructor. here's little test: #include <iostream> struct base { base() = default; base(int x_, int y_ = 88, int z_ = 99) : x(x_), y(y_), z(z_) {} virtual void debug() const { std::cout << "\nx - " << x << ", y - " << y << ", z - " << z << '\n'; } private: int x, y, z; }; struct derived : base { using base::base; }; int main() { base b(1); b.debug(); // x - 1, y - 88, z - 99 derived d(5); d.debug(); // x - 5, y - 88, z - 99 return 0; } ( can run here - http://coliru.stacked-crooked.com/a/26cbb85757c1f021 ) so inheriting default arguments inherited constructor or not? if not, how come i'm

MediaRecorder getting a video output in android without writting to disk -

after looking @ documentation mediarecorder, , examples mediarecorder using camera2, can't seem find anywhere how not write video disk, , getting output directly in program. i need upload video directly server, , having save disk needless overhead.

javascript - Backbone.js : select option change event trigger click event also -

i have backbone view selectbox 2 events, change , click. change - additional functionality on selection. click - clear current selection. but when change option, click event getting triggered. backbone.view.extend({ events: { 'change #sort-list': 'facetaction', 'click #sort-list': 'clearselection' }, facetaction : function(){ }, clearselection: function(){ //change event getting executed. } you need make click #sort-list more specific. if use mouse change selection of #sort-list call click . if you're trying reset mention on click , create button side of or that. then, handle click #reset-button . <div class="input-group"> <span class="input-group-btn"> <button class="btn btn-default" type="button" id="reset-button">reset</button> </span> <select class="form-control" id="sort-list"></select>

ruby on rails 4 - Ember-Simple-Auth Can't verify CSRF token authenticity even when X-CSRF-Token is in header -

Image
i know there tons of questions of topic, haven't found what's causing problem. problem i message on rails server can't verify csrf token authenticity when can see on chrome header present. (as shown in picture) my setup rails 4.2 backend restful api ember.js 1.11.3 frontend devise ember-simple-auth. i followed these instructions of how setup ember-simple-auth-devise uses authentication via token. did same 1 exception, instead of putting next code inside applicationcontroller defined apicontroller class in effort separate api logic rest of site. class apicontroller < actioncontroller::base protect_from_forgery with: :null_session before_action :authenticate_user_from_token! # had comment line out in order # make authentication work # before_filter :authenticate_user! protected def configure_permitted_parameters devise_parameter_sanitizer.for(:sign_up) { |u| u.permit( :username, :first_name, :last_name, :email, :pas

Can I use load balancer for scaling Azure Service Fabric apps -

recently came know azure service fabric , seems way develop scaling applications bunch of micro services. everywhere telling need have stateless front end web services , stateful partitioned internal services. internal services scale partitioning data . but happens front end services in load? .the chances less doing nothing relying internal stateful services. still should use load balancer before front end services? if so, can host same via service fabric's stateless model using owin or other web host? the question asked in comment. didnt reply original question different. azure service fabric usage yes, you'll want distribute load across stateless services well. key difference since stateless, can handle requests in round-robin fashion. whereas stateful services have partitions, map individual chunks of service's state, stateless services have instances, identical clones of each other, on different nodes. can set number of instances in on default service

gps - Is LocationListener in android works like loop? -

i used locationlistener calculate speed of moving mobile. used location.getspeed() speed. task if device speed crosses exceeds set speed limit send sms alert- on speed other mobile number. used flag variable boolean flag; check conditions. problem if mobile travel above limited speed 10 seconds continuously has send 1 message. app sends message long device goes above speed. set flag variable no use. code is private void sendoverspeedalert() { toast.maketext(mainpage.this,"over speed alert set",toast.length_long).show(); final sharedpreferences account=getsharedpreferences("admins",mode_private); string overspeed=account.getstring("osa", ""); double overspeedkm=double.parsedouble(overspeed); final decimalformat dformat = new decimalformat("#"); string overspeedformat=dformat.format(overspeedkm); final double overspeeddouble=double.parsedouble(overspeedformat); final locationmanager locationma

windows - Using Xcopy or other to copy similar folders within directory -

i have 1 directory several folders names 'mapas_10452; mapas_21685; mapas_22731' , os on... inside every folder have several folders, want copy contents of 1 of them, folder 'novos'. is possible use xcopy, batch file or other option copy contents of folder want, evey folder 'mapas_xxxxx' have ? the result be: mapas_10452/novos mapas_21685/novos mapas_22731/novos as for /? says should put path in parentheses. add wildcard enumerate folder contents: * use name of parent folder construct new path: %%~nf check if novos subfolder exists. for flexibility use %userprofile% system variable use xcopy /s , add trailing slash second argument indicate it's folder [optional] use doubleqoutes process file/folder names spaces for %%f in ("%userprofile%\desktop\mapassaas\*") ( if exist "%%f\novos" ( xcopy /s "%%f\novos" "%userprofile%\desktop\folder\%%~nf\novos\\" ) )

Way to stop / kill any computation in R with keyboard shortcut when R gets 'stuck'? -

this question has answer here: how interrupt r? 2 answers what way stop/cancel current computation when r gets 'stuck' in demanding computation? (i'm using rx64 3.2.0 on windows 7). pressing "esc" supposed able stop current computation... times not work, intense computations. have kill r process stop , forced restart session. i find ctrl + c works me.

powershell - Copy-Item fails even when running as administrator -

i've got powershell script copy bunch of files directory in program files (x86) . script loops through list of files , calls copy-item -path $src -destination $dst -verbose -confirm:$false -force for each one, when comes overwriting file, access denied error on path. powershell script run batch file i'm running administrator, i'm not sure why failing. i've checked paths in question , they're correct. the script running on windows server 2012, , ran when last ran few months ago. no user permissions have changed since then.

c# - How to prevent a custom thread crashing the windows service in .Net 4.5? -

consider following snippet. thread spawned main windows service thread crash because tries open null path. crashing of windows service follow. namespace threadcrashservice { class program { public const string servicename = "threadcrashservicetest"; private static timer _timer = null; private static int _timerinterval = 60000; static void main(string[] args) { if (!environment.userinteractive) { // running service using (var service = new service1()) system.serviceprocess.servicebase.run(service); } else { string parameter = string.concat(args); switch (parameter) { case "--install": if (isserviceinstalled()) { uninstallservice(); } installservice(); break; case "--uninstall": if (isserviceinstalled()) {

join - Comparison of columns from two files and create new column -

i want compare first 2 columns file1.txt , file2.txt , if match found add new columns (3rd , 4th) file1.txt values found column 3 , 4 of file2.txt , "na" non-match. file1.txt ch1 100 ch1 200 ch3 100 ch4 200 file2.txt ch1 100 0.5 0.6 ch1 200 0.1 1.2 ch3 400 0.2 0.9 ch4 200 1.0 3.0 outputfile.txt ch1 100 0.5 0.6 ch1 200 0.1 1.2 ch3 100 na na ch4 200 1.0 3.0 i tried join/awk commands not giving desired output. the standard awk technique reads whole of file1.txt memory. if files big fit, considerably more effort required (but can done so). awk 'fnr == nr { k[$1,$2] = 1; next } { if (k[$1,$2] == 1) { print $0; k[$1,$2] = 2 } } end { (i in k) { if (k[i] == 1) { sub(subsep, " ", i); print i, "na", "na" } } }' \ file1.txt file2.txt the first line reads first file , records keys read. second line of processing. if key of $1, $2 in second file matches record, print $0

php - How to include ajax post into get form and exclude used inputs by ajax in get url? Laravel -

so have search form (i have written in laravel html, code self explaining; pure html answers welcome too): {!! form::model($search, ['url' => 'projects/', 'method' => 'get']) !!} //select option want include url {!! form::select('sort', array(0 => 'sort: update date', 1 => 'create date', 2 => 'follows'), null, ['id' => 'sort', 'class' => 'form-control']) !!} //a has ajax post request b options. , b shouldn't appear in url (exclude , b alone - used create mixed ab combinations). {!! form::select('a', array(...), null, ['id' => 'a', 'class' => 'form-control']) !!} {!! form::select('b', array(...), null, ['id' => 'b', 'class' => 'form-control']) !!} {!! form::button('add b combination', ['class' => 'form-control']) !!} //include , b combination

css - How to add class to all elements inside div? -

i have 100 buttons inside div: <div class="button_group"> <button> ... </button> <button> ... </button> <button> ... </button> ... </div> i want style buttons in bootstrap style. so, need change everywhere < button > < button class="btn" >. want without adding class="btn" 100 times each < button > element. so, need css rule says buttons inside div of class "btn". so, need this: .button_group button { ... add class="btn" elements ... } is possible @ all? correct syntax? thank you!! html <div class="button_group"> <button> ... </button> <button> ... </button> <button> ... </button> </div> css .button_group > button {width: 100px; height: 50px;} and fiddle https://jsfiddle.net/049lj4ll/4/ there no need ad class="btn" every button if same, add class parent

linux - xd-admin node service pid error -

we trying know status of spring-xd-admin service. executed command : gives following error: [root@hostname run]# service spring-xd-admin status xd-admin dead pid file exists then tried kill process associated spring-xd-admin in /var/run/xd-admin.pid executed : [root@hostname run]# kill 25376 -bash: kill: (25376) - no such process then tried removing xd-admin.pid file didn't work any appreciated

c# - How to add if-else statement to change BoundFields of GridView -

i trying code below: <%= if(ddlchoice.selecteditem.value ==1) { %> <asp:boundfield datafield="firstname" headertext="first name"> <headerstyle horizontalalign="left" /></asp:boundfield> <asp:boundfield datafield="lastname" headertext="last name"> <headerstyle horizontalalign="left" /></asp:boundfield> <%= } else { %>> <asp:boundfield datafield="name" headertext="name"> <headerstyle horizontalalign="left" /></asp:boundfield> <%= } %> i have gridview , want add if-else condition change available boundfield s according selected item in dropdownlist ... please guide me !!! in short: cannot place if statement between boundfield s trying do. as alternative solution, change visible property of each boundfield either code behind or setting boolean value attribute in .aspx file. an

ruby on rails - Can't call class method within another class -

i have 2 classes found within lib folder. both files found in lib/services folder. i'm loading files via method in initializer. ['account_helpers', 'facades', 'decorators', 'presenters', 'serializers', 'services', 'views', 'queries'].each |folder| dir["#{rails.root}/lib/#{folder}/*.rb"].each {|file| load file} end my 2 classes appear so... class marketingemail def self.send user.where('created_at >= ?', 15.days.ago).each |user| marketingemaildecider(user).deliver end end end class marketingemaildecider < marketingemail def init(user) @user = user end def deliver puts "delivered" end end whenever run code following error nomethoderror: undefined method `marketingemaildecider' marketingemail:class why happening , how can fix this? i'm having no other issues running other classes in of other classes (if makes sense).

c++ - CppUnit : Not able to write test cases -

i have written cppunit codes in testbmath.cc . able write test cases first 3 functions add,subtract , multiply. not able write test cases divide , swap.i don't know how handle divide 0 in test cases , how check numbers swapped or not in cppunit test cases. testmath.h #ifndef test_math_h__ #define test_math_h__ class testmath { public: int addition(int x, int y); int multiply(int x, int y); int subtraction(int x, int y); int division(int x, int y); void swap(int &x, int &y); }; #endif testmath.cc #include "testmath.h" int testmath::addition(int x, int y) { return (x + y); } int testmath::multiply(int x, int y) { return (x * y); } int testmath::subtraction(int x, int y) { return (x - y); } int testmath::division(int x, int y) { if( b == 0 ) { throw "division 0 condition!"; } return (a/b); }

ajax - Add 3 variable to Javascript-Code -

maybe kind me? because don't have knowledge in ajax / javascript!. i have onclick-event , need modify it. @ moment changes "aboutme" section. want modify it! before: onclick="loadcontent();" what want onclick="loadcontent('aboutme', '0', '0');" function loadcontent() { xmlhttpobject.open('post','_files/ajax/aboutme.php'); xmlhttpobject.onreadystatechange = upadatecontent; xmlhttpobject.send(null); return false; } function upadatecontent() {if (xmlhttpobject.readystate == 4) { document.getelementbyid('aboutme').innerhtml = xmlhttpobject.responsetext; }} what cant work: is correct? how filled variables "onclick" event? inside "loadcontent" want load file based on variables = _files/ajax/(aboutme).php?var1=(0)&var2=(0) next step: (also in "loadcontent" function) need submit first variable (aboutme) next "upadatecontent&quo

node.js - ‘node-gyp rebuild’ installation error when adding a package to meteor app in Windows 7 -

i trying add package (mizzao:turkserver) meteor application, kept getting error: mizzao:turkserver: updating npm dependencies -- request, libxmljs, validator, querystring, async, deepmerge... gypnpm err! windows_nt 6.1.7601 npm err! argv "c:\\users\\pc4all\\appdata\\local\\.meteor\\packages\\meteor-tool\\1.1.3\\mt-os .windows.x86_32\\dev_bundle\\bin\\\\node.exe" "c:\\users\\pc4all\\appdata\\local\\.meteor\\packages\\meteor-tool\\1.1.3\\mt-os .windows.x86_32\\dev_bundle\\bin\\node_modules\\npm\\bin\\npm-cli.js" "install" "libxmljs@0.8.1" npm err! node v0.10.36 npm err! npm v2.7.3 npm err! code elifecycle npm err! libxmljs@0.8.1 install: `node-gyp rebuild` npm err! exit status 7 npm err! npm err! failed @ libxmljs@0.8.1 install script 'node-gyp rebuild'. npm err! problem libxmljs package, npm err! not npm itself. npm err! tell author fails on system: npm err! node-gyp rebuild npm err! can info via

vba - Print sheetnames on separate sheet -

i have created vba code through create list of sheet names in excel. print values in sheet "blad2" in cell a1, a2, a3 etc... anybody thoughts on how can this? got code below working overwriting code in cell a2... sub namessheet() = 1 sheets.count var = sheets(i).name worksheets("blad2").range("a2") = var next end sub you have set counter cell sub namessheet() for = 1 sheets.count var = sheets(i).name worksheets("blad2").cells(i,1) = var next end sub

multithreading - .net Task Scalability Problems -

i have application launches multiple tasks (1000+) , should scale 10k+ task area. these tasks launched gradually @ rate of ~100 per minute. each task downloading data piece piece, buffering it, , saving it. i have 1 simple monitor loop (also task): while 1 console.writeline("still running! tasks:" & task_count & " threads:" process.threadcount) await task.delay(500) end while at ~3k tasks, runs fine. @ ~5k tasks, starts hitting fan. await task.delay(500) starts taking minutes execute. application thread count starts jumping 100 300 randomly. starts freezing , hanging. download speed goes 0. disk write speed goes 0. cpu usage goes 0, it's @ ~10%. so solve issue, split application 5 separate process limited 1k tasks each. if need more, spin new process. communicate have central process communicate with, using thousands of wcf named pipes stay open hours if want. but works! splitting multiple processes delivers better performance havi

c# - Update existing asp.net Project with WCF -

i have ecommerce asp.net project, project have 20 important dlls , more java script files when want update website clients have give them dlls , js files , ask them replace new files old files , many many troubles. but want create system web service update each client automatically antivirus update ! is possible ! how clickonce ? it's microsoft tool allows update client automatically. when client opens application, asks server if there updates - if there are, downloads them , updates. if not - nothing special happens , app start regulary.

java - SLF4J NoSuchMethodError at Log4JLoggerAdapter -

i having exception: org.slf4j.helpers.messageformatter.format(ljava/lang/string;ljava/lang/object;ljava/lang/object;)ljava/lang/string; java.lang.nosuchmethoderror @ org.slf4j.impl.log4jloggeradapter.info(log4jloggeradapter.java:341) @ org.mortbay.log.slf4jlog.info(slf4jlog.java:67) @ org.mortbay.log.log.<clinit>(log.java:79) @ com.goodgamestudios.icosphere.service.filereader.xlsfilereader.extractrowvaluesasstringarray(xlsfilereader.java:79) @ com.goodgamestudios.icosphere.service.filereader.xlsfilereader.extractheaders(xlsfilereader.java:84) @ com.goodgamestudios.icosphere.service.filereader.xlsfilereader.getdatafromfile(xlsfilereader.java:40) @ com.goodgamestudios.icosphere.service.filereaderandwriter.filereaderandwritertest.testreader(filereaderandwritertest.java:101) @ com.goodgamestudios.icosphere.service.filereaderandwriter.filereaderandwritertest.testexcelreader(filereaderandwritertest.java:50) @ sun.reflect.nativemethodaccessorimp

sql - Is it possible to use a returned column value as a table name in an SQLite query? -

i want write query examines tables in sqlite database piece of information in order simplify post-incident diagnostics (performance doesn't matter). i hoping write query uses the sqlite_master table list of tables , query them, in 1 query: select name sqlite_master type = 'table' , ( select count(*) name conditions ) > 0; however when attempting execute style of query, receive error no such table: name . there alternate syntax allows this, or not supported? sqlite designed embedded database, i.e., used 'real' programming language. able use such dynamic constructs, must go outside of sqlite itself: cursor.execute("select name sqlite_master") rows = cursor.fetchall() row in rows: sql = "select ... {} ...".format(row[0]) cursor.execute(sql)

java - Why is there commented-out code in native method? -

recently, i've seen lot of methods "native" keyword. seems common have, what seems like, commented out code . public native foo(arg, arg) /*-{ var foo = some.method(arg); return foo; }-*/; i don't understand what commented-out portion or why it's commented out . while i've thought commented out code . i'm starting see in more projects (for instance, it's in gwt source code). is commented-out code significant in way don't understand? i've read native keyword , , understand means , how it's used in basic sense. it's confusing see "commented-out code" often. can explain comments. comments? significant? [update] question commented out portion. starting see enough thought there significance missing. annotation, instance. wanted clear onwhy there commented out sections of code littered over. because gwt code compiled in 2 distinct part : java server part , javascript client one. the comment syntax i

error from Matlab rightCam = imaq.VideoDevice('winvideo', 1, 'MJPG_640x480'); -

when matlab r2015a: inf = imaqhwinfo ('winvideo') inf = adaptordllname: 'c:\matlab\supportpackages\r2015a\osgenericvideointerfa...' adaptordllversion: '4.9 (r2015a)' adaptorname: 'winvideo' deviceids: {[1] [2] [3]} deviceinfo: [1x3 struct] vid = videoinput('winvideo',1,'mjpg_640x480') rightcam = imaq.videodevice('winvideo', 1, 'mjpg_640x480'); i error: "attempt reference field of non-structure array." imaqhwinfo shows logitech c290 stereo webcams. the solution different way.......... there 2 different ways talk cameras in image acquisition toolbox. 1 using videoinput object, other using imaq.videodevice. have use 1 or other, not both @ same time. imaq.videodevice, simplest way. leftcam = imaq.videodevice('winvideo', 2, 'mjpg_640x480'); rightcam = imaq.videodevice('winvideo', 1, 'mjpg_640x480'); leftcam.returneddatatype = &#

javascript - WordPress not updating the js file -

i changing javascript file, not showing in browser. cleared browser cache, purged cache through wp-admin, removed deflate code .htaccess, still doesn't show up. themes/soundwave/js/prettyphoto.js?ver=4.2.3 when add other number in ver example, in url if type: themes/soundwave/js/prettyphoto.js?ver=4.2.3.1 the change shown. during development, avoid hassle of clearing browser cache passing dynamic variable file's version when enqueue it. instance, current time. wp_enqueue_script( 'prettyphoto', 'prettyphoto.js', array(), date("h:i:s") );

xml - XSD elements - adding displayname for UI display -

so have xsd schema use generate ui, create xml document conforms schema. xelements in schema, want have display name used ui, rather element name not human readable. edit: use c# , linq parse xsd , generate ui. there no tool. the original idea use annotations/appinfo add custom 'comment type' attributes every element, got extremely verbose, obfuscating core purpose of schema. wondering whether can add 'displayname' attribute xsd schema elements, not translate xml data requiring attribute. e.g. xsd before :- <xs:element name="grnbulb" type="xs:string"> <xs:annotation> <xs:appinfo> <displayname>bulbasaur</displayname> </xs:appinfo> </xs:annotation> </xs:element> xsd after :- <xs:element name="grnbulb" type="xs:string" displayname="bulbasaur" /> in either case, require xml data same :- <grnbulb>awesome</grnbulb> and dis

ios - Swift : Hide UIView from Bottom on Scroll like Twitter -

Image
i want hide uiview while scrolling down , showup when scrolling up . have tableview , like hide uiview above user scrolls down , showup when scroll up (here example below): uiview below navigation controller+embedded segmented controller in uiview. should use: scrollviewdidscroll ?

How does printf() work without variable list in its argument? -

the following code: #include<stdio.h> void main() { int i=100,j=200; printf("%d.....%d"); } gives 200.....100 output. explain how printf works without datalist it provides warning @ compile time (warning: few arguments format), and not documented , therefore it's undefined behaviour , should not used. different compilers have different behaviours , behaviour may change between versions of same compiler. try reading on wikipedia more info.

Python read from subprocess stdout and stderr separately while preserving order -

i have python subprocess i'm trying read output , error streams from. have working, i'm able read stderr after i've finished reading stdout . here's looks like: process = subprocess.popen(command, stdout=subprocess.pipe, stderr=subprocess.pipe) stdout_iterator = iter(process.stdout.readline, b"") stderr_iterator = iter(process.stderr.readline, b"") line in stdout_iterator: # stuff line print line line in stderr_iterator: # stuff line print line as can see, stderr loop can't start until stdout loop completes. how can modify able read both in correct order lines come in? to clarify: still need able tell whether line came stdout or stderr because treated differently in code. the code in question may deadlock if child process produces enough output on stderr (~100kb on linux machine). there communicate() method allows read both stdout , stderr separately: from subprocess import popen, pipe process = po

.net - What framework for learning ASP.NET -

having been working around unix , java many years , xpages wish move towards .net , asp.net using c#, have found far there seems dramatic change in .net framework after version 3.5 moved version 4.0 of framework. question in regards obtaining employment or contracting in asp.net advisable start learning @ version 3.5 of framework or version 4.0? there books can recommend? prefer apress technical book publications i don't think there dramatic change 3.5 4.0 recommend: apress beginning asp.net 4 in c sharp best regards

I want to know how to check a hyperlink text and the link exists in an URL or not using c# -

i want create tool me check whether link , text exists in webpage or not using c#...also want know if link dofollow or nofollow. example here link of wiki site https://en.wikipedia.org/wiki/main_page you can see lot of link text in article body arts,history etc .i want check if "arts" link text exists or not correct hyperlink( https://en.wikipedia.org/wiki/portal:arts ) if nofollow or dofollow. going create tool please me. the main idea of project monitor link text , link in article online ,whether or not if exists or deleted someone.also know if dofollow or nofollow. i'm not sure mean nofollow or dofollow, here quick code sample iterate through links on web page. should starting point going. if you're looking little more robust can in html agility pack . it's bit more complicated use dom view of web page. since using webbrowser control insure include system.windows.forms reference. if must use project type not allow forms object, can done

php - empty date goes into database as 1970/01/01 -

Image
so have database column date, when user leaves section blank , updates record saves in database 1970/01/01. now when make columng null = no , default = none not work. in code check see if value null (which why strtotime() function fails). if null try set value saved ''. $nicedate = $this->judgement_date; $databasedate = date("y-m-d", strtotime($nicedate)); if(is_null($databasedate)){ $databasedate == ''; } $this->judgement_date = $databasedate; is there anyway me save empty value of '' in field or date type mean has have value of date format? assuming $this->judgement_date in a valid date format , $databasedate never null in code strtotime() , date() return values (including false ). need check if $nicedate has valid value , use empty string if not. you use == instead of = assignment operator logical error php not report. $nicedate = $this->judgement