Posts

Showing posts from May, 2014

c# - Correct encoding to read net flow protocol -

i trying figure out how correctly encode data received net flow. have listener on net flow port , able read data, see destination ip, nothing else. how can correctly interpret net flow data? using c# , have tried encoding such unicode, utf8, utf37, , utf7 none of encoding readable interpret data. cannot seem find answer online, or guidance appreciated. possibly when encoded in utf8 need start filtering. example of short data read found below: received broadcast *.*.*.1:5557 : # ?,0y??? ? v?? : ?$? ? ?? ?*? w??@ ? h h . ?p ?*? when utf 8, can pick out identifiers such ack, bel, , soh. need work with? example snippet of encoding read: console.writeline("waiting broadcast"); byte[] bytes = listener.receive(ref groupep); console.writeline("received broadcast {0} :\n {1}\n", groupep.tostring(), encoding.utf8.getstring(bytes, 0, bytes.length)); file.write

Variables are not getting replaced in powershell cmdlet -

this question has answer here: expand variable inside single quotes 2 answers i using start-process cmdlet in powershell as start-process -filepath "$installer_path" -args '/s /v"/qb setuptype=\"$setup_type\" username=$user_name password=$password server=$sql_server installdir=\"$transfer_path\\\" sharepath=\"$transfer_path\\\""' –wait in above command variable not getting replaced except $installer_path. believe issue because of variables located inside ' " " '. 1 me variable substitution? thanks. the problem using single quotes , not double quotes. in order variables expand need use double quotes. if have use double quotes inside of can escape them preceding them backtick ` or doubling them "". start-process -filepath "$installer_path" -args "/s /v`

Django all-auth app, how to modify /account/profile page to display custom view -

after setting all-auth app, when user logs in, gets redirected to: accounts/profile/ page tells view doesn't exist. i'm trying figure out kind of thing include there, , decided allow user change basic information. i have users app teacher model, set follows: class teacher(models.model): user = models.foreignkey(user, unique=true) rate = models.charfield(max_length=200) availability = models.booleanfield(default=false) verified = models.booleanfield(default=false) i want accounts/profile/ page show form, containing information. user can edit these fields , edit firstname, lastname , email, belong different model - user . i can't seem started on this. when created detailed view profile page, error saying: no pk or slug provided i want django change current users info, not based on primary key in url. need custom view? i've looked @ [other solutions 1 seem utilising private key parameter. what need working view function, similar

apache spark - Where is the reference for options for writing or reading per format? -

i use spark 1.6.1. we trying write orc file hdfs using hivecontext , dataframewriter. while can use df.write().orc(<path>) we rather like df.write().options(map("format" -> "orc", "path" -> "/some_path") this have flexibility change format or root path depending on application uses helper library. can find reference options can passed dataframewriter? found nothing in docs here https://spark.apache.org/docs/1.6.0/api/java/org/apache/spark/sql/dataframewriter.html#options(java.util.map) where can find reference options can passed dataframewriter? the definitive , authoritative answer sources : csvoptions jdbcoptions jsonoptions parquetoptions textoptions orcoptions ... some description may find in docs, there no single page (that possibly auto-generated sources stay up-to-date most). the reason being options separated format implementation on purpose have flexibility want offer per use case

powershell - Extract list from Sharepoint without using Get-SPWeb -

i don't have access sharepoint server , can't use remoting, , therefore don't have access microsoft.sharepoint.powershell contains sharepoint commandlets. i can't use 3rd party libraries means have access built in powershell commandlets, or .net class. how can access sharepoint list using built in powershell commandlets or .net classes? well if using sharepoint 2010 , don't have access server , must interact remotely have 3 options: https://msdn.microsoft.com/en-us/library/office/hh313619(v=office.14).aspx you can use: client side object model - gives structured sharepoint classes approach enumerating, viewing , interacting sharepoint site artifacts soap web services - sounds like...a set of xml soap end points let interact sharepoint site rest web services - set of endpoints follow rest principles fwiw, csom libraries use rest endpoints under covers.

footer - Flutter: Trying to bottom-center an item in a Column, but it keeps left-aligning -

i'm trying bottom-center widget @ bottom of column, keeps aligning left. return new column( new stack( new positioned( bottom: 0.0, new center( new container(), ), ), ), ); the existence of positioned forces container left, instead of centering. removing positioned, however, puts container in middle-center. 1) can use align widget, fractionaloffset.bottomcenter. 2) can set left: 0.0 , right: 0.0 in positioned.

jar - Different cert finger prints when signing on different machines -

the problem: copied .keystore machine machine b had sources, created , signed jar. when putting jar again machine a, fail authenticate. after that, created jar on machine , signed on machine a, , time worked , jar able authenticate. what missing?? the details: after coping keystore , keystorepassword packaged jar using: jarsigner -keystore good.keystore -storepass $(cat good.keystorepassword) my_jar.jar my_certificate i printed certs of signed jar using: keytool -printcert -jarfile my_jar.jar and got certificate fingerprints: md5: 01:... i printed certs of keystore jar using: keytool -printcert -jarfile my_jar.jar and got keystore cert using: keytool -exportcert -alias my_certificate -keystore good.keystore -storepass $(cat good.keystorepassword) > good.cert , got certificate fingerprints: md5: 40:... they don't match. worked doing same commands on original machine (from took keystore) , finger prints matched. all through p

python - how to match and exclude regex? -

i have unstructured text need match each td city , whatever text has next city, not include last td city, last 1 next , on: example: (i need text starting <tr><td class="city" till before next <tr><td class="city") <tr><td class="city" colspan="6"><p><a href="#home">top</a><br /><br /><a name="bloomington"><h2>bloomington</h2></a></p></td></tr><tr><td class="blank">&nbsp;</td><td class="day" colspan="5">monday</td>rwerjlkrw</tr> <tr><td class="city" colspan="6"><p><a href="#home">top</a><br /><br /><a name="abb"><h2>abb</h2></a></p></td></tr><tr><td class="blank">&nbsp;</td><td class="day&q

ruby on rails - How do I update User object at scale? -

my ruby on rails application has 100,000,000 users. have column on model called 'data' json field contains small json object backup saving new field. if had 1,000 users run: users = user.all users.each |user| user.data_backup = user.data user.save end and save existing data new column. however, potentially take forever many users. what's proper and/or efficient way update field on model @ scale when have 100,000,000+ users? for large number of records, try use find_in_batchs method user.find_in_batches(batch_size: 1000) |users| users.each |user| user.data_backup = user.data user.save end end

runtime error - Buffers not working in vim -

my buffers not working reason. when click <leader>b says not editor command: buffers this .vimrc file: set nocompatible " required filetype off " required set rtp+=~/.vim/bundle/vundle.vim call vundle#begin() " required plugin 'vundlevim/vundle.vim' " general plugin 'scrooloose/nerdtree' plugin 'kien/ctrlp.vim' plugin 'scrooloose/syntastic' plugin 'tpope/vim-commentary' " user interface plugin 'altercation/vim-colors-solarized' plugin 'jarrodctaylor/vim-256-color-schemes' plugin 'jarrodctaylor/vim-reflection' plugin 'vim-airline/vim-airline-themes' plugin 'bling/vim-airline' " programming plugin 'mattn/emmet-vim' plugin 'tpope/vim-surround' plugin 'leafgarland/typescript-vim' " languages plugin 'pangloss/vim-javascript' plugin 'davidhalter/jedi-vim' " plugins must above l

unity3d - Custom Build Configurations with Unity and Visual Studio -

[i'm using versions 2017 of both unity , visual studio, don't think bears on problem because same issue existed in visual studio 2015 , unity 5.5] i have created build configuration (staging) via visualstudio/build/configuration manager/active solution configurations/[new] i have created publish profile wcf service application pairs staging build configuration web.staging.config transform file. the problem whenever unity syncs solution file removes build configuration breaks publish profile , results in web.debug.config transformation being used rather web.staging.config. so, question is, how unity leave build configuration in .sln file?

php - Mysqli multi query not working, despite appearing correctly formed -

i'm working on php function interacts database add specializations particular user. figured using mysqli multi query best way go accomplishing this. unfortunately none of code queries executing correctly. db connection working without hitch, , individual queries when typed databases web app work. function assign_specialties($id, $specialties) { $conn = new mysqli($globals['servername'], $globals['username'], $globals['password'], 'visio'); if ($conn->connect_error) { die("$conn->connect_errno: $conn->connect_error"); } $query = ""; $id = mysqli_real_escape_string($conn, $id); foreach ($specialties $specialty) { $specialty = mysqli_real_escape_string($conn, $specialty); $query .= " insert member_specialization (member_id, specialization_name) values ('$id', '$specialty');"; } //$query = mysqli_real_escape_string($conn, $query); if ($

javascript - Display pdf content in a tab in firefox -

i use spring boot, jquery , itext. when user click on button, pdf file genereated. @getmapping(value = "/members/{memberid}/contract/{contractid}/generalcontracts", produces = "application/pdf") public responseentity<byte[]> getmembercontract(@pathvariable("memberid") long memberid, @pathvariable("contractid") long contractid) throws ioexception { byte[] content = reportservice.generatemembercontractreport(contractid); return preparereport(content); } private responseentity<byte[]> preparereport(byte[] content) throws ioexception { httpheaders headers = new httpheaders(); headers.setcontenttype(mediatype.parsemediatype("application/pdf")); string filename = "report.pdf"; headers.setcontentdispositionformdata(filename, filename); headers.setcachecontrol("must-revalidate, post-check=0, pre-check=0"); responseentity<byte[]> response = new responseentity<>(

javascript - How to make the ball respond to the paddle thickness? -

hey guys! finished couse @ udemy, , how make game using js. question related small part of game. the game in question pong. want know way can make ball respond thickness of paddle. when paddle @ x position bigger 0, ball won't go though it. here code. i'm sorry if little bit messy: <html> <canvas id="gamecanvas" width ="800" height="600"></canvas> <script> var canvas; var canvascontext; var ballx = 0; var bally = 0; var ballspeedx = 10; var ballspeedy = 4; var player1 = 0; var player2 = 0; const winning_score = 3; var winscreen = false; var paddle1y = 250; var paddle2y = 250; const paddle_height = 100; const paddle_thicknes = 10; function calculatemouseposition(event){ var rect = canvas.getboundingclientrect(); var root = document.documentelement; var mousex = event.clientx - rect.left - root.scrollleft; var mousey = event.clienty - r

php - codeigniter Internal Server Error when move to real server -

i have problem when move codeigniter app real server error: php fatal error: call member function result_array() on boolean in /helper/application/models/team_model.php on line 41 code: return $this->db->get()->result_array(); whole code : function __construct(){ $this->load->database(); } function select_data($field , $table , $where = '' , $join_array = '' , $limit = '' , $order = ''){ $this->db->select($field); $this->db->from($table); if($where != ""){ $this->db->where($where); } if($join_array != ''){ if(in_array('multiple',$join_array)){ foreach($join_array['1'] $joinarray){ $this->db->join($joinarray[0], $joinarray[1]); } }else{ $this->db->join($join_array[0], $join_array[1]); } } if($limit != ""){

c++ - QT console application that show video in a QT GUI -

i coding qt console application similar next code int main() { videocapture cap(0); if(!cap.isopened()) return; namedwindow("webcam"); mat frame; for(;;) { cap >> frame; imshow("webcam", frame); if(waitkey(1) >= 0) break; } return; } i have problem because camera runs 200 fps , function waitkey(1) make application slow , runs 60 fps, if eliminate function waitkey application runs 200 fps image not show. i wonder if possible show images in qt gui, still runs in loop in console application. thanks advance.

c++ - std::ifstream closed for some reason? -

i'm trying open ifstreams contain file data, can read later on. i'm trying pass vector of ifstreams constructor, reason when loop through vector, references closed. but, other variables (data stream , meta stream) remain open. what missing here? i'm coming heavy java background, i'm still learning c++ filestore.h // // created tom on 8/16/2017. // #ifndef cfs_filestore_h #define cfs_filestore_h #include <fstream> #include <list> #include "bytebuffer.h" class filestore { private: std::ifstream *data_stream; std::vector<std::ifstream *> index_streams; std::ifstream *meta_stream; public: filestore(std::ifstream *data, std::vector<std::ifstream *> indexes, std::ifstream *meta); ~filestore() = default; int get_type_count(); bytebuffer read(int type, int id); int get_file_count(int type); static filestore open(std::string &root); }; #endif //cfs_filestore_h filestore.cpp // // cre

reactjs - How do I access Redux items using selectors after I've normalized my store? -

i'm bit confused on how i'm supposed use selectors after i've normalized redux store. i have following setup store: const default_state = { allid: [], locations: {} }; with following reducer: handleactions({ ['update']: (state, action) => { let newid = state.allid.length; const allid = [...state.allid, newid]; const locations = { ...state.locations, [newid]: action.payload }; return {allid, locations}; } }), ... i figured want component: function mapstatetoprops(state) { return { share: callmyselector(state) }; } but don't see how selector except return location associated recent id. i'm thinking normalizing not great here - because wouldn't end searching id in regular case. the power of selectors moves filtering logic away component consuming data, , away actions/reducer reusable functions. mentioned getting recent location. update logic in reducer, we'd make selector gr

Create tar files using nested forloop in R -

i have bunch of files. named follows: bnt_20170301131740322_123456.csv, bnt_20170301131740322_7891011.csv in filename, starting 5th character 12th character date , 13th , 14th character hour. rest dynamically generated , keep changing. in above example date 1st march 2017 , hour 13. task 1: have create tar files zipping files match specific date , hour. depending on date , hour files gets generated, have multiple tar files output. task 2: next task name tar files in specific pattern. each tar file should named in following pattern: bnt_2017030111_2.tar in above name can see "bnt_" retained followed date , hour , 2 after _ (underscore) indicates number of files inside tar matches date , time. in above example, name indicates files date 1st march 2017 , hour parameter 11 tarred , tar has 2 files inside it. what have done far: #set working directory setwd("/home/mycomp/documents/filestotar/") #list files files <- list.files(pattern = &q

node.js - React Native Expo: No App Configuration Data -

Image
i tried open project on expo after making changes backend code, getting no app configuration data message , unable anything. not seeing errors in console, warnings. change made backend shouldn't impact app's configuration. added values model , updated controller values. "reset content , settings" on simulator , did npm install update packages , still having issue.

amazon web services - Setting permissions to WordPress to install plugins is preventing access through SSH -

i have read several ways solve problem of permissions in wordpress install themes , plugins wordpress administration. as understand problem owner of folder wordpress installed must user manages web server (read postdata) . in case apache , aws, www-data. however, changing owner www-data (even changing group user), lose ssh access server. in case had ask administrator of entire server access user , restore owner , permissions of folder. i using amazon web services ubuntu 16.0.4 lts have access main user , installation of wordpress located @ root of user, i.e. /home/myuser/ i accessing via ssh .pem key , myuser@publicdns what can do? thank much. pd: wordpress in this guide says owner has ftp web server owner (i.e. myuser) , never webserver, agree. i hate having answer own question maybe can others solve problems , fast. worked me: before doing of should take note of permissions, owners , groups of folders & files changing here because website may fail

edit - How do I update a single value in a nested array of objects in a json document using jq? -

i have json document looks following. note simplified example of real json, included @ bottom of question: { "some_array": [ { "k1": "a", "k2": "xxx" }, { "k1": "b", "k2": "yyy" } ] } i change value of k2 keys in some_array array value of k1 key "b". is possible using jq ? for reference actual json document, environment variable file use in postman / newman tool. attempting conversion using jq because tool not yet support command line overrides of specific environment variables actual json { "name": "local-stack-env-config", "values": [ { "enabled": true, "key": "kc_master_host", "type": "text", "value": "http://localhost:8087" }, { "enabled": true, "key"

javascript - Tessel 2 - i2c.read not logging buffer -

i'm attempting use tessel 2 read data co2 sensor not having success. from sensor's data sheet: to read current co2 concentration sensor need read memory locations 0x08 (hi byte) , 0x09 (low byte). to need send sequence of 2 i2c frames: first send i2c write frame containing sensor address, command number , how many bytes read, ram address read from, , checksum. send i2c read frame read status, data , checksum. in our case want read 2 bytes starting address 0x08. give data address 0x08 , 0x09, contains current co2 reading. sensor address 0x68 (default factory setting, configurable in eeprom). so, first frame should like: start | 0xd0 | 0x22 | 0x00 | 0x08 | 0x2a | stop --a. 0xd0 sensor address , read/write bit. 0x68 shifted 1 bit left , r/w bit 0 (write). --b. 0x22 command number 2(readram), , 2 bytes read --c. checksum 0x2a calculated sum of byte 2, 3 , 4. the next frame read actual data: start | 0x

java - How to unify date format using DateTimeFormatter -

i need parse different time format basic_iso_date . right now, there 4 types of date format: 2016-10-01 (iso_local_date) 2016t 201610t 2016-02-07t22:03:39.937z (iso 8601) need parse 20161001 , print out, default day 01 , default month jan . examples: 2016t -> 20160101 201610t -> 20161001 how can use datetimeformatter achieve this? just complement @flown's answer (which works btw), can use optional patterns (delimited [] ): datetimeformatter parser = new datetimeformatterbuilder() // optional iso8601 date/time , offset .appendoptional(datetimeformatter.iso_offset_date_time) // optional yyyy-mm-dd or yyyyt or yyyymmt .appendpattern("[yyyy-mm-dd][yyyy't'][yyyymm't']") // default day 1 .parsedefaulting(chronofield.day_of_month, 1l) // default month january .parsedefaulting(chronofield.month_of_year, 1l) // create formatter .toformatter(); this works same way. can choose 1 cle

Using scrapyd to deploy scrapy, run the scrapyd - deploy localhost - p test and always report the error of "environment can only contain strings" -

os: win7 x64bit scrapy: 1.4.0 python: 2.7.13, anaconda: 4.4 the scrapyd debug is: f:\python_work\test_scrapy\src>scrapyd 2017-08-18t10:49:07+0800 [-] loading d:\anaconda2\lib\site-packages\scrapyd\txapp.py... 2017-08-18t10:49:09+0800 [-] scrapyd web console available @ http://127.0.0.1:6800/ 2017-08-18t10:49:09+0800 [-] loaded. 2017-08-18t10:49:09+0800 [twisted.application.app.applogger#info] twistd 17.5.0 (d:\anaconda2\pyth .exe 2.7.13) starting up. 2017-08-18t10:49:09+0800 [twisted.application.app.applogger#info] reactor class: twisted.internet. lectreactor.selectreactor. 2017-08-18t10:49:09+0800 [-] site starting on 6800 2017-08-18t10:49:09+0800 [twisted.web.server.site#info] starting factory <twisted.web.server.site stance @ 0x0000000003972cc8> 2017-08-18t10:49:09+0800 [launcher] scrapyd 1.2.0 started: max_proc=32, runner=u'scrapyd.runner' 2017-08-18t10:49:24+0800 [_generichttpchannelprotocol,0,127.0.0.1] unhandled error traceback (most recent ca

java 8 - How to use Lombok with cucumber and guice -

this code. using cucumber , guice. want use lombok. using java 8 @scenarioscoped public class volumecreateteststeps { private final volumesummarypage volumesummarypage; private final volumecreatetabs volumecreatetabs; private final volumecreatepropertytab volumecreatepropertytab; @inject public volumecreateteststeps(volumesummarypage volumesummarypage, volumecreatetabs volumecreatetabs, volumecreatepropertytab volumecreatepropertytab) { this.volumesummarypage = volumesummarypage; this.volumecreatetabs = volumecreatetabs; this.volumecreatepropertytab = volumecreatepropertytab; } no idea cucumber, lombok+guice work together. syntax pretty hacky: @scenarioscoped @requiredargsconstructor(onconstructor=@__(@inject)) public class volumecreateteststeps { private final volumesummarypage volumesummarypage; private final volumecreatetabs volumecreatetabs; private final volumecreatepropertytab volu

Generate an API key for VSTS package manager -

i use paket dependency management tool , starting use visual studio online (vso) host source , building. when paket restore (or try upload nupkg) 401. vsts uses credential manager seems generate unique password each time it's run. suppose write powershell script execute credential manager.exe , pull out password/username set paket before doing restore ideally i'd create specific user (and password) feed only, or generate api key. know if possible? paket supports provide username , password in paket.dependencies file, can create personal access token packaging scope (e.g. packaging (read , write)), specify in paket.dependencies file, example: source [your feed url] username: "[anything, such test]" password: "[personal access token]" nuget [library] more information: plaintext-credentials

javascript - Adding custom field to DocumentInfoValidators -

i want use custom field in pdf metadata. when pdf loads pdf.js , examine contents of getmetadata() field missing, because isn't included in list of valid fields documentinfovalidators . if add field directly in pdf.js source can see field - there proper way add custom field name, or usual modify , build own version? i'm using pdfjs@1.7.312. i can see definition in pdf.worker.js around line 39125, in definition of pdfdocument; gets used later in documentinfo() var documentinfovalidators = { entries() { return shadow(this, 'entries', { title: isstring, author: isstring, subject: isstring, keywords: isstring, creator: isstring, producer: isstring, creationdate: isstring, moddate: isstring, trapped: isname }); } };

html - Any downsides to using image src without protocol? -

basically, wanting switch ssl, , maybe 1 day site might not have ssl, need downgrade using http: protocol if needed without trouble. wondering if use approach images ok? , if there downsides this? <img src="//path/to/image.jpg" /> and <img src="//another.site.com/images/path/to/image.jpg" /> this seems work fine, wondering if there downsides images without protocols in browsers, or otherwise? thanks

Possible to Use C# to Simulate AngularJS login submission like Post? -

i see web page has <form name="formname" ng-submit=... , curious if there way log site c# .net. i familiar using c# send "post" data including httpclient postasync, it's hard me search because every article talks angularjs controller or going angularjs page other page. getting pointed in right direction helpful! post example found var client = new httpclient(); var pairs = new list<keyvaluepair<string, string>> { new keyvaluepair<string, string>("pqpusername", "admin"), new keyvaluepair<string, string>("password", "test@123") }; var content = new formurlencodedcontent(pairs); var response = client.postasync("youruri", content).result; if (response.issuccessstatuscode) { } first of, wrap classes implement idisposible interface using statement. it's great feature , makes sure resource dispose method get's called when code done. to mak

Why is the XSLT ecosystem not widely associated with data visualization? -

in 2011, mike bostock, 1 of creators of d3.js remarked on xslt: xslt’s approach elegant, simple transformations: without high-level visual abstractions, nor flexibility of imperative programming, xslt cumbersome math-heavy visualization task (e.g., interpolation, geographic projection or statistical methods). at time of writing question, xslt has gone through 2 major revisions, yet still not associated term 'data visualization'. why? top few concise , concrete reasons, please, perhaps supported line or 2 of code. want better understand shortfalls central it's lack of appeal. 2 or 3 should suffice. if mike's comments still valid, please so. again, example or 2 helpful. should prefer little more context answers: thanks tight, local bindings between data , presentation, d3.js has raised expectation quality data-driven applications can made respond dynamically , changes in data set. may think xslt ecosystem characteristics directly impede kin

jquery - IIS 10.0 Detailed Errr - 404.15 - NOT found -

i got error when tried add large value in text box , tried save . using ajax method. controller public actionresult updatedatasetdetails(int workitemid, string datasetdatestamp, int cycle, string reference, string feed, string source, string target, int linestart, string extension, string note, int? filecontentid, string datafixes, int oldworkitemid) { editdatasetvm editdatasetvm = new editdatasetvm(); //abandoning current work item, , logging error if there any. if (oldworkitemid != 0) { actionerrors = _datasetservice.processdataset(new int[] { oldworkitemid }, 99, user.username); // 99 assigned in _state (static data marked) table processing abandoned tempdata["message"] = actionerrors.tolist(); } editdatasetvm.successmessage = this._datasetservice.updatedataset(workitemid, datasetdatestamp, cycle, reference, feed, source, target, user.identity.name, linestart, extension.tolower(), note, filecontentid, datafixes, oldworkitemi

javascript - Cannot get two objects united with Json.parse and Json.stringify -

i have doubt how unite objects , give them in express response in node js. the object this: { "idp": 1, "pasaportenum": 787643682, "fidp": 1, "fid_p": 1 } the other 1 also: { "idp": 1, "pasaportenum": 827348, "fidp": 1, "fid_p": 75683475 } so code like: var = json.stringify(context.instance[0].datavalues) var b = json.stringify(context.instance[2].datavalues) res.send('{'+json.parse(a+','+b)+'}') why receive error? "unexpected token , in json @ position 53" at end need like: { "idp": 1, "pasaportenum": 787643682, "fidp": 1, "fid_p": 1 }, { "idp": 4, "pasaportenum": 456789, "fidp": 2, "fid_p": 2 } regards seeing have 2 objects same properties, want add array before stringifying var arr = [contex

php - Requested json parse failed:: For My SQL and MSSQL db Reporting Application -

requested json parse failed. php error encountered severity: notice message: undefined variable: q filename: models/dashboard_model.php line number: 50 fatal error: call member function num_rows() on null in c:\xampp\htdocs\biostaraccess\application\controllers\dashboard.php on line 29 here code class dashboard_model extends ci_model{ function list_events() { if($this->db->dbdriver=="mssql"){ $q = $this->db->query(" select (convert(varchar, dateadd(ss, ndatetime,'01/01/1970 00:00:00'), 105) + ' ' + convert(varchar, dateadd(ss, ndatetime,'01/01/1970 00:00:00'), 108)) dt, cast(cast(tb_event_log.nuserid binary) bigint) id, susername name, tb_user_dept.sname dept, tb_door_dept.sdepartment doorgroup, tb_door.sname door, tb_event_log.nreaderidn ndeviceid, case when tb_door_reader.ninout = '

Marklogic Custom Replacement Constructors via Javascript -

is possible write custom replacement constructor in marklogic via server side javascript? so far find examples/documentation uses xquery: https://docs.marklogic.com/guide/node-dev/partial-update#id_80429 as of marklogic 8.0-7 / 9.0-2, not supported. i'll report bug.

python - How to get valid json resp from Flask app with jsonapi version 1.0, "Content-type"="application/vnd.api+json" -

i have failed resp code below. have tried different "content-type", tried building json in different ways possible. please help. @app.route('/api/v1/client', methods={'get', 'post'}) def client(): if request=='post': req = request.get_data() data = req.json user_id = data["data"]["attributes"]["user_id"] redirect_uri = data["data"]["attributes"]["_redirect_uris"] default_scopes = data["data"]["attributes"]["_default_scopes"] item = client( client_id=gen_salt(40), client_secret=gen_salt(55), _redirect_uris=' '.join(redirect_uri), _default_scopes=' '.join(default_scopes), user_id=user_id, allowed_grant_types=' '.join(['implicit', ]), allowd_response_types=' '.join(['token', ]) ) db.session.add(i

Webpack handlebars loader - is there a way to inject context/parameters? -

i'm trying setup webpack-dev-middleware (the middleware used in webpack-dev-server, hosted in own node application). one of requirements have able parse application "index.hbs" through handlebars & inject html-webpack-plugin injects. (a couple scripts built bundle) i found option use handlebars-loader , prepared configuration (according this ) { test: /\.hbs$/, loader: "handlebars-loader" } this works.. 'almost' part used render index.hbs (the snippet node+express app): app.get(`${access_path}/index`, (req, res) => { res.render('index', { query: req.query }); }); that means parsing template based on query parameters. after lengthy explanation question is: is there way can pass "context"/parameters using webpack handlebars-loader achieve same behavior using webpack serving file? please note that development setup.

Spring 4 REST application using Java configuration (no xml) IllegalArgumentException -

this question has answer here: java.lang.illegalargumentexception: failed register servlet name 'dispatcher'.check if there servlet registered under same name 1 answer this driving me crazy. i've done bit of spring coding first time i'm trying configuration in java. i've searched on stackoverflow , other places, , while others have seen problem, none of solutions have worked me. here source files: initializer: public class enhancedcandidateinfoinitializer extends abstractannotationconfigdispatcherservletinitializer { private static final logger logger = loggerfactory.getlogger(enhancedcandidateinfoinitializer.class); @override protected class<?>[] getrootconfigclasses() { logger.info("@@@@@ getrootconfigclasses called - returning null @@@@@"); return null; } @override protected class

Android unable to create files directory -

on samsung galaxy s5 (android 4.4.2), after installing, click app, , crashes. crash stack is 08-18 13:58:48.191 10816-10851/com.example.galina.demo w/contextimpl: unable create files directory /data/data/com.example.galina.demo/files 08-18 13:58:48.191 10816-10816/com.example.galina.demo e/androidruntime: fatal exception: main process: com.example.galina.demo, pid: 10816 java.lang.runtimeexception: unable create application com.example.galina.demo.mainapplication: java.lang.nullpointerexception @ android.app.activitythread.handlebindapplication(activitythread.java:4752) @ android.app.activitythread.access$1600(activitythread.java:172) @ android.app.activitythread$h.handlemessage(activitythread.java:1368) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:146) @ android.app.activitythread.main(activitythread.java:5653) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.i

c# - Shopping cart displays records twice -

problem when same item added cart again display same record of same product twice, here want when press add cart button twice or 3 time should increment quantity of same item. protected void addtocartbutton_click(object sender, eventargs e) { if (con.state == connectionstate.open) { con.close(); } con.open(); sqlcommand cmd = con.createcommand(); cmd.commandtype = commandtype.text; book_id = convert.toint32(request.querystring["book_id"].tostring()); cmd.commandtext = "select * book book_id = " + book_id + ""; cmd.executenonquery(); datatable dt = new datatable(); sqldataadapter sda = new sqldataadapter(cmd); sda.fill(dt); foreach (datarow dr in dt.rows) { //book_id =convert.toint32(dr["book_id"]); title = dr["title"].tostring(); //quantity = dr["quantity"].tostring(); quantity = quantitytxt.text; pric