Posts

Showing posts from July, 2014

python - Initial node's ids when creating graph from edge list -

i wonder, function read_edgelist store original id's the edge list? or under attribute name? assume reading edge list like: 1 2 2 1 1 3 where numbers 1,2,3 ids (or names) of nodes. igraph (python version) stores these ids? tried retrieving these ids attribute name or id did not work, 2 attributes, seemingly, must explicitly defined. read_edgelist assumes node ids consecutive integers 0 m, m maximum integer in edge list. there "no need store node ids." for example, if edgelist.txt 1 3 , code import igraph ig g = ig.graph.read_edgelist("edgelist.txt") print g.get_adjacency() creates graph 4 nodes (0, 1, 2, 3) , prints [[0, 0, 0, 0] [0, 0, 0, 1] [0, 0, 0, 0] [0, 0, 0, 0]] see answer if not want "intermediate" nodes created. while following unnecessary graph consecutive node ids starting 0, 1 access node ids using vertexseq , vertex : for v in g.vs: print v.index # node id

javascript - jsPDF low quality image exporting -

so using cool tool called cropit crop images. trying cropped image exported in pdf file, using jspdf. you can check editor here: http://code.reloado.com/ecagos3/edit#html,live (the pdf downloading part wont work, downloading code trying out in localhost should fine guess) the pdf file gets generated, quality of image awful. can check out here: https://www.docdroid.net/kgjbyjk/test.pdf.html here original image: http://imgur.com/a/ztme1 does know solution getting normal output, or why issue happened? in advance! i've found solution via php library. it's called - mpdf

java - Android Studio 2.1 Gradle sync error after implemented AAR library -

i have added aar library file project. after added, after implementing aar library main code, while gradle sync , getting these exception.. error:error converting bytecode dex: cause: java.lang.runtimeexception: exception parsing classes error:1 error; aborting error:execution failed task ':app:transformclasseswithdexfordebug'. > com.android.build.api.transform.transformexception: java.lang.runtimeexception: com.android.ide.common.process.processexception: java.util.concurrent.executionexception: com.android.ide.common.process.processexception: return code 1 dex process i have tried build clean, rebuild, restart studio, many times gradle sync,and multidex enabled true getting above mentioned error. anyone me solve problem. finally cleared problem. i have followed steps in android studio 2.1: file-settings-build,execution,deployment select - instant run - uncheck first option "enable instant run hot swap code/resource changes on deploy(default enable...

tooltip - Foundation 6, plugin destroy -

i'm using tooltips display form errors. i'm trying display tooltips on inputs, validated ajax call. on each submission want remove these tooltips, check validations, , display new set of tooltips if needed. i'm using foundation('destroy') method on each inputs have .has-tip class. function displaytip(elt, msg){ var options = { tiptext: msg, templateclasses: 'tooltip--error', } elt.addclass('has-tip'); // <= using jquery 'cause triggerclass option seems not working... var tip = new foundation.tooltip(elt, options); } function hidetips(){ $('.has-tip').each(function(index){ $(this).removeclass('has-tip'); try { $(this).foundation('destroy'); } catch(e) { //console.info(); } }); } unfortunately doesn't work , have these console errors: foundation.js:8598 uncaught typeerror: cannot read property 'ho...

php - Items per slide responsive -

i've made logo slider using bootstrap (basically seen here http://jsfiddle.net/juddlyon/q2tyv/10/ ). within each slide there 4 logos. want make responsive, on smaller screens shows 2 logos per slide. i'm not sure best way this. i can double grid-4 width 50% media queries still show 4 per slide, in 2x2 grid. another way duplicate entire slide , hide , show correct one, seems rather inefficient appreach. so need reduce number of logos per slide loaded.. how? i'm using wp , advanced custom fields populate slider. simplified code below: php: <?php $firstslide = 0; $slide = 0; $repeater = get_field('clients', $clients); $order = array(); foreach( $repeater $i => $row ) { $order[ $i ] = $row['name']; } array_multisort($order, sort_asc, $repeater); if($repeater): foreach($repeater $i => $row): if ($firstslide == 0) { $class = "item active"; ...

node.js - AWS Lambda function never calls the callback -

i've created node lambda function simple call aurora database. when test function in console, query returns, can see results in log, callback never seems called , lambda function times out. can't figure out problem is. here can point me problem. var mysql = require("mysql"); module.exports.handler = function(event, context, cb) { console.log('start\n'); var con = mysql.createconnection({ ... }); console.log('call data\n'); con.query('select * tags', function(err, rows) { console.log('data received db:\n'); console.log(rows); console.log('calling callback'); cb(null, 'success'); console.log('callback called'); }); console.log('data called\n'); }; the resulting cloudwatch log follows... 2016-07-25t14:20:05.343z daf5cd6b-5272-11e6-9036-e73ad17006df start 2016-07-25t14:20:05.398z daf5cd6b-5272-11e6-9036-e73ad17006df call data 2016-07-25t14:2...

gtk - How Automatically Update Two or Several GtkDrawAreas in C -

Image
i'm trying develop little supervision system 2 gtkdrawarea widgets , update them simultaneously whenever toogle buttons regarded each drawarea. little example made ploting 2 sinoides. however first gtkdrawarea widget updated in did, other remains freezed until rezise gtkwindow. tried use g_timeout_add_full seens work 1 gtkdrawarea. i'm sending image of test aplication. if me thankful. ps: sorry english :-) here code: #include <stdlib.h> #include <gtk/gtk.h> #include <glib.h> #include <cairo.h> #include <math.h> #include <unistd.h> #include <stdlib.h> gtkwidget *window; gtkwidget *darea1; gtkwidget *darea2; double w_larg = 1600; double w_alt = 1200; bool toggle_stat1 = false; bool toggle_stat2 = false; int width, height; double fase1 = 2; double amp1 = 1.25; double fase2 = 4; double amp2 = 1.25; gboolean flag_amp1 = true; gboolean flag_amp2 = true; static gboolean invalidate_drawing1(gpointer...

xcode - Area boundary coordinates using Google Maps API for IOS -

sorry, english bad. is possible area boundary lat/longs draw area polygon using google maps api. using need draw overlay on mkmapview. required suggestions. thanks in advance. thanks, chaitanya yes, possible lat/lng using google places api , google places api ios provides app rich information places, including place's name , address, geographical location specified latitude/longitude coordinates. aside that, can use overlays layer content on wide portion of map. overlay object object conforms mkoverlay protocol. overlay object data object contains points needed specify shape , size of overlay , location on map. overlays can represent shapes such circles, rectangles, multi-segment lines, , simple or complex polygons. can define own custom overlays represent other shapes. note: in ios 7 , os x v10.9 , later, presentation of overlay handled overlay renderer object, instance of mkoverlayrenderer class. job of renderer draw overlay’s content onto screen...

php - Retrieving multiple queries from mysql using MySqli_fetch_array() -

so retrieving data mysqli different tables have foreign primary relation not doing getting data(selected columns) , showing in 1 html table doing this while (($ans= mysqli_fetch_array($result))&&($ans1=mysqli_fetch_array($result1))&&($ans2=mysqli_fetch_array($result2))&&($ans3=mysqli_fetch_array($result3))&&($ans4=mysqli_fetch_array($result4))) { echo " <td>".$ans['name']."</td> "; echo " <td>".$ans1['id']."</td> "; echo " <td>".$ans2['company']."</td> "; } the problem here is not fetching records because of && operator , if implementing separate while loop on every query not displaying html table people use sql union can avoid long conditions in queries example select city customers union select city ...

html - Table cell height is not maintained on page break -

i'm having dynamic table rendered on pdf using plugin dompdf. i'm trying give every cell in table constant height css styles: .shipment td { page-break-inside: avoid; border-bottom: 1px solid black; height: 28px; } the problem cells contained in first page correct height, every cell shown second page on gets height reset default value. here little example of table: https://jsfiddle.net/4axc4l56/ is there way have height want set cells in every page?

c# - Screenshot non-active external application -

i need take screenshot of non-active external application, example, teamspeak or skype. i have searched , didn't find much, know not possible screenshot minimised application, think should possible screenshot non-active application. ps : want screenshot application, if application on top of 1 want, problem? i have no code right now, have found user32 api can want forgot name.. thanks help. the api you're after printwindow : void example() { intptr hwnd = findwindow(null, "example.txt - notepad2"); capturewindow(hwnd); } [dllimport("user32.dll", setlasterror = true)] [return: marshalas(unmanagedtype.bool)] static extern bool printwindow(intptr hwnd, intptr hdc, uint nflags); [dllimport("user32.dll")] static extern bool getwindowrect(intptr handle, ref rectangle rect); [dllimport("user32.dll", setlasterror = true)] static extern intptr findwindow(string lpclassname, string lpwindowname); public void captur...

kibana - Unable to drop result bucket in terms aggregation - Elasticsearch -

i have documents in elasticsearch following structure: "mappings": { "document": { "properties": { "@timestamp": { "type": "date", "format": "strict_date_optional_time||epoch_millis" }, "@version": { "type": "string" }, "id_secuencia": { "type": "long" }, "event": { "properties": { "elapsedtime": { "type": "double" }, "requesttime": { "type": "date", "format": "strict_date_optional_time||epoch_millis" }, "error": { "properties": { "errorcode": { "type": "string", ...

Is defuse/php-encryption suitable for use in network encryption? -

i managing 2 servers have shared secret key. i able send data between servers in manner if listening in middle, data read if has secret key. requirements are: encryption authentication but also: freshness: old encrypted data has been intercepted in past not accepted if transmitted else. i wondering if defuse/php-encryption applicable scenario given provides encryption , authentication. took @ libsodium want stay away pecl if possible. thank you. i suggest use existing cipher suite can "blanket secure" entire connection between 2 parties. then, in case, use digital certificates (they can self-signed ...) secure connection. (do not use "shared secrets," a.k.a. "passwords.") tls (the successor ssl) used https secure web-sites. (be sure use current version of protocol!) vpn (as "openvpn" or "ipsec") provides "a secure router" between 2 subnets. advantage of strategy 2 parties don...

git - What does this mean from a security perspective: "Caution: This repository is private but the published site will be public." -

i've got repo contain sensitive information, in github made private. after doing so, however, message displayed: caution: repository private published site public. can me understand message means? also, since need keep these sensitive files secure, security considerations should made? thank in advance. it means information stored in gh-pages branch of repository publicly available via github pages via http://<username>.github.io/<projectname> . gh-branch special branch, content automatically published mechanism called github pages . here example. i've created private repo private_with_pages . can not see because, well, it's private. nevertheless, file index.html , stored in branch gh-pages , publicly available . now in settings of github repository see message “caution: repository private published site public.” according help page way disable feature remove gh-pages branch github. how remove remote branch described here . see ...

c# - Database is not effected and in return I get primary key as value of zero -

i want insert these primary keys in other table, or there other easy way add multiple data @ time? using(dbcontext) { list<dbtable> dbtbl = new list<dbtbl>(); list<long> retrunedprimarykeys = new list<long>(); for(int i=0; i<datafrompresentationlayer.count;i++) { dltable tbl = new dbtable(); tbl.name = datafrompresentationlayer[i].name; tbl.address = datafrompresentationlayer[i].address dbtbl.add(tbl); } dbcontext.dbtable.insertallonsubmit(); for(int i=0; i< datafrompresentationlayer.count;i++) { retrunedprimarykeys.add(dbtbl[i].primarkeycolumn); // here primary keys 0 , in database there not single entry of these record } } you have call submitchanges() method on dbcontext, before read returned values. submitchanges method writes data database.

c# - EF code-first 1:* 1:0..1 relationship between the same models -

i have 2 models public class a{ public aid { get; set; } public int? mainbid { get; set; } [foreignkey("mainbid")] public b mainb { get; set; } } public class b{ public int bid { get; set; } public int? aid { get; set; } [foreignkey("aid")] public virtual owner { get; set;} } the relationship want model has many b. may have specially designated b (main b). however way have set has hard time identifying principal , using fluent: modelbuilder .entity<a>() .hasoptional(x => x.mainb) .withoptionaldependent(); it gives me multiplicity not valid in role 'a_mainb_source' in relationship 'a_mainb'. because dependent role properties not key properties, upper bound of multiplicity of dependent role must '*'. i think trouble trying describe ef these 2 separate relationships , not same relationship described front-and-back. can guide me in this? edit: adds real life example i have...

visual studio - Set height of row of table in Qt -

Image
i want create table, code in qtcreator: ui->tablewidget->setselectionbehavior(qabstractitemview::selectrows); ui->tablewidget->setselectionmode(qabstractitemview::singleselection); ui->tablewidget->setcolumncount(5); ui->tablewidget->sethorizontalheaderlabels(qstringlist() << tr("first") << tr("second") << tr("third") << tr("fourth") << tr("fifth")); ui->tablewidget->setcolumnwidth(0, 80); ui->tablewidget->setcolumnwidth(1, 140); ui->tablewidget->setcolumnwidth(2, 80); ui->tablewidget->setcolumnwidth(3, 140); ui->tablewidget->setstylesheet("qheaderview::section { background-color: rgb(217,217,217)}"); ui->tablewidget->horizontalheader()->setstretchlastsection(true); (int c = 0; c < ui->tablewidget->horizontalheader()->count(); c++) { ui->tablewidget->horizontalheaderitem(c)->setsizehint(qsize(0, 50)); }...

c# - ATM program, can't figure out how to break down withdraw amount -

first off yes, homework assignment, i've been struggling 3 days, , can't figure out. basically problem take decimal amount entered user in text box, need take number , break down currency denominations, $50, $20, $10, $5, $1 , if amount has decimal $.25, $.10, $.05, $.01. and need break down in lowest amount of denominations possible, example $100 broken down 2 $50 bills. here have far. private void btndispense_click(object sender, eventargs e) { decimal i; = decimal.parse(txtamountreq.text); decimal totalamount = convert.todecimal(txtamountreq); int[] denombills = { 50, 20, 10, 5, 1 }; int[] numberofbills = new int[5]; decimal[] denomcoins = { .25m, .10m, .05m, .01m }; int[] numberofcoins = new int[4]; //for loop amount of bills (numberofbills[0] = 0; totalamount >= 50; numberofbills[0]++) { totalamount = totalamount - 50; } (numberofbi...

php - URL Routing to single Index File -

i have website: http://chanl.co.uk/ blog. each post has it's own permalink goes specific url on page. in projects i've worked on in past, these links routed different index files in seperate folders use same template each post , select data dependent on it's permalink. im looking way have single file posts route when accessed. link how wordpress use "single-post" template every post on website. i'm little stumped how go form of dynamic routing almost, , don't know start. route have auto-generated every post in database or there more practical way solve issue. awful diagram: (my train of thought) chanl - post1 / index.php post2 / index.php (optimal solution) chanl - posts.php (all posts directed here) you want @ how simple php framework works, every request passed index.php file in root directory , routes defined urls using (guess what!) router... some things encounter are. 1 - front controller patter 2 - mvc pattern 3 ...

git - Sourcetree detached head -

i searched on keyboard through latest commits in sourcetree , accidentally pressed something, window popped up, accidentally pressed enter, don't know said. result, ended detached head. after googling, found advice recommending use "reset current branch on commit" on latest commit fix. did that, head still detached , bunch of other peoples commits got cancelled , in uncommited changes :(. found out detached head created checking out older commit. 1) can fix in sourcetree? 2) importantly. did break repository whole team or local copy affected? all appreciated, thank you.

How to inject DbContext in a custom localization provider in ASP.NET Core? -

as explained in asp.net core docs can configure custom provider request localization. stated in docs: suppose want let customers store language , culture in databases. write provider these values user. for following code snippet provided in docs , in github sample localization.starterweb : services.configure<requestlocalizationoptions>(options => { var supportedcultures = new[] { new cultureinfo("en-us"), new cultureinfo("fr") }; options.defaultrequestculture = new requestculture(culture: "en-us", uiculture: "en-us"); options.supportedcultures = supportedcultures; options.supporteduicultures = supportedcultures; options.requestcultureproviders.insert(0, new customrequestcultureprovider(async context => { // custom request culture logic // dbcontext needed here <-- return new providercultureresult("en"); }));}); can explain me how inject dbcontext load user specific language db in above ...

visual studio - Iterate in order through a list of objects - vb.net -

i have list of objects named machines. every machine has " priority " property (uinteger). i'm trying pick machines list (i.e. add them list) in specific order (from lowest highest priority), till condition respected. thus wanted know if following method works : machinelist.sort(function(x, y) x.priority.compareto(y.priority)) each machin in machinelist machinestodisablelist.addmachine(machin) if [condition] exit end if next the goal add machines second list lowest highest priority, , stop when it's enough. i'm not sure solution if i'll iterate in correct order result expected. is ? or solution somewhere else ? why not iterate through list ordered priority. this: dim machinelist new list(of machine) dim machinestodisablelist new list(of machine) machinelist.add(new machine {.priority = 6}) machinelist.add(new machine {.priority = 2}) machinelist.add(new machine {.pri...

fortran - Array in derived type and OpenMP cause segmentation fault -

this question has answer here: why segmentation fault happening in openmp code? 2 answers i have simple code. program test_example use iso_c_binding, only: c_double, c_int implicit none integer, parameter :: nelems = 500000 integer, parameter :: np = 16, nvar = 4, nflux = 16 type mesh2d real(c_double) :: u(np, nelems) real(c_double) :: uflux(nflux, nelems) real(c_double) :: ucommon(nflux, nelems) end type mesh2d type(mesh2d) :: mesh integer(c_int) :: i, j, k !$omp parallel j = 1, nelems k = 1, np mesh%u(k, j) = j+k end end !$end parallel end program test_example i compile using gfortran -g temp.f90 -o main.exe -fopenmp and gives me segmentation fault. same code runs fine if instead of using derived type used array. is bug or doing wrong. i ran segfault conundrum on laptop, code ran w...

excel - Copying data to a new sheet only if data does not exist using a macro -

i have created simple macro filter data , copy , add specific sheet [isrisks] after last row. realize not sure how check see if data exists in [isrisks] sheet! please - column in [isrisks] contains unique riskid field check. have far: sub isriskcopy() ' dim lmaxrows long dim ws worksheet dim rng range dim lr long dim rtable range each ws in activeworkbook.worksheets if (ws.name <> "isrisks") , (ws.name <> "closed risks") , (ws.name <> "risk grading matrix ") , (ws.name <> "sheet1") , (ws.name <> "sheet2") application.displayalerts = false ws if .filtermode .autofiltermode = false sheets(ws.name).range("$a$2:$w$2").autofilter field:=5, criteria1:=array("is", "is - information security"), operator:=xlfiltervalues set rtable = sheets(ws....

domain driven design - Stream Version in Event Sourcing -

in event sourcing , store individual domain events have happened 1 aggregate instance, known event stream . along event stream store stream version . should version related each domain event , or should related transactional changes (aka commands)? example: our current state of event store is: aggregate_id | version | event -------------|---------|------ 1 | 1 | e1 1 | 2 | e2 a new command executed in aggregate 1. command produces 2 new events e3 , e4. approach 1: aggregate_id | version | event -------------|---------|------ 1 | 1 | e1 1 | 2 | e2 1 | 3 | e3 1 | 4 | e4 with approach optimistic concurrency can done storage mechanism using unique index replaying events until version 3 leave aggregate/system in inconsistent state. approach 2: aggregate_id | version | event -------------|---------|----- 1 | 1 | e1 1 | 2 | e2 1 ...

automated tests - Running swing with UI being invisible -

i work on swing based application , use jemmy write automated tests application. problem have lot of tests , running them takes lot of time. 1 of bottleneck test brings ui , performs action on ui populating test boxes,dropdowns, clicks button etc. looking way run tests ui invisible test runs if ui there doesn't show on monitor. can guide me whether such thing possible ad if yes how? ankit this doesn't work out of box - swing needs actual graphics device render to. however, may able set using virtual graphics driver or framebuffer. instance, under linux used xvfb run swing applications 'headless'. that being said, not accelerate automated ui tests. if anything, in-memory rendering of virtual framebuffer slower of actual graphics card.

html - Verticle Metrics in multiple fonts -

so having issue , dont know how fix it. building website , using different fonts i need every font optically identical other , aligned @ base. let's write hello (helvetica) hello (georgia) correct size of them beacuse 40px helvetica isn't same size 40px georgia. problem concerning baseline when see of fonts (same px , line-height) 1 next other, arent aligned horizontally. link image here! thank guys! @cameron.townsend comment correct. going want use vertical-align:baseline; on text how want. here fiddle showing off different alignments: https://jsfiddle.net/g7oqupej/1/ that being said, appears default ( vertical-align:initial; ) behavior chrome vertical-align:baseline; not sure other browsers haven't tested, fonts used in fiddle, things seems line want. i suggest creating fiddle shows problem having see if else being done.

Saiku over Solr -

i'm trying use saiku goal is: how read cube without build "ad hoc" data structure (e.g. copy existent data star schema). know pratice build star schema during night analyse data in day after. think sort of degenerate dimensions stored search engine solr. why not use real time data? maybe speedup solr search engine neutralize others bottleneck (reading csv, mondrian, mdx queries)? see there presentation tom barber @ apachecon2014 ( https://www.youtube.com/watch?v=9ch5qlngmoe ) show use of saiku on solr. there code github ( https://github.com/osbi/optiq-solr ) adapter built on top of optiq (now calcite), not find example or documentation use it. me?

c++ - How can I make models developing easier -

good evening currently i'm developing c++ mvc framework. it's education purposes right - see if can make such thing , understand , learn new things (not so) beauty language. i've got abstract class models extended make new one. registered register singleton , loaded loader class string name. so, right now, blank new modules written in manner: # mymodel.hpp class mymodel: public cinite::core::abstract::model { public: mymodel(cinite::core::loader &_loader): cinite::core::abstract::model(_loader){}; private: static cinite::core::registerclass<mymodel> __cinite_reg; }; # mymodel.cpp cinite::core::registerclass<mymodel> mymodel::__cinite_reg("mymodel"); it's quite lot of writting, decided simplify adding macros like #define cinite_model_construct(class) \ class(cinite::core::loader &_loader): cinite::core::abstract::model(_loader){}; #define cinite_define_registry(class) \ static cinite::core:...

reactjs - how should I build onClick action in my react component + Redux -

i've been through many tutorials , questions on stack can't find solution. i'm learning react/redux, trying build onclick action. i've got following error "maximum call stack size exceeded error" . got because i'm rendering function that's changing state infinitely. i'm trying deal <button onclick={displaytable(click)}>cool</button> differently nothing seems work. know action , guess reducers works since when i'm dispatching action trough console : $r.store.dispatch({type: 'set_table_data'}); , state updated properly. any advices ? here action : export const settablefilter = (click) => { return { type: 'set_table_data', click : click, }; }; here reducer : const tablefilter = (state = 0, action) => { if(action.type === 'set_table_data') { return state + 1; } return state; } and here component : const displaytable = (click) => { return (...

ios - Observer Fires Multiple Times with removeAllObervers -

i have ibaction when pressed, creates observer listener , gets snapshot data. when child node changes value, want dismiss current viewcontroller , present different viewcontroller. when viewcontroller gets dismissed, attempting remove observer handles. but when build , run, judging console output, seems firebase observer being called multiple times unknown. this being executed in observer being executed in observer being executed in observer being executed in observer being executed in observer being executed in observer 2016-07-25 14:03:06.125 ssm[636:140771] warning: attempt present <ssm.activeviewcontroller: 0x13eb3b200> on <ssm.userprofileviewcontroller: 0x13f18c400> while presentation in progress! 2016-07-25 14:03:06.125 ssm[636:140771] warning: attempt dismiss view controller <uinavigationcontroller: 0x13f24ba00> while presentation or dismiss in progress! 2016-07-25 14:03:06.125 ssm[636:140771] warning: attempt present <ssm.activeviewcontroller: 0...

parameters - How to pass a variable to an SSIS package to be used in query -

Image
i'm having issue when trying import data using ssis. have ssis package moves data 1 server / database server / database. @ moment query take rows in source db , move destination. need change select few rows moved using id filter. need pass id in parameter used filter dataset return select few rows. how 1 this? have simple ssis package 2 dataflow objects (source & destination) i've been looking @ may need change somewhat. select id, [product type], [product title] [view] id = <this should provided outside package> the package triggered tsql / stored procedure. thanks. use parameters. in ssis question mark ? being used parameter , order determines parameter name. use sql (inside source task): select id, [product type], [product title] [view] id = ? ..then click parameters button: please note preview button (if try it) won't work (it throw error) can ignore , try run package stated here . ..and change parameter name 0 (zero) , s...

javascript - Node.js application not serving static webpage without root path -

i writing simple application in node.js, reason error " typeerror: path must absolute or specify root res.sendfile " when trying serve html page. error shouldn't take place because used express middleware specifies folder file found. why getting issue? my app structure looks this myapp public login.html app.js my html page being served in app.js this var express = require("express"); var app = express(); app.use(express.static("public")); app.get('/', function(req, res){ res.sendfile("login.html"); }); app.listen(3000); i know around this, can "res.sendfile(__dirname + '/public/login.html');" instead shouldn't have since using middleware. ideas? this line app.use(express.static("public")); does not think does! it not set default folder every node function, in fact doesn't other node functions. it says if webserver receives request, in folder fir...

ruby - Rails: Query database for users with specific time value while respect individual users time zone setting -

i have background job runs every 15 minutes , generates reminder emails. create query returns users have specific time saved , respect how timezone setting effects time. so have user model stores: :time : users reminder time, eg 17:00:00 :string : timezone, eg est so if job runs @ 17:00:00 est, return users settings are: reminder_time: 17:00:00 , time_zone: est reminder_time: 13:00:00 , time_zone: pst what best way build query? can done in 1 pass, relying on postgres handle work? have stagger it, group each time zone , doing math each on in ruby? i have setup activerecord scope doesn't consider timezones, , trying add consideration now. scope :receives_reminder_at, -> (time) ready.where(reminder_time: time) end when dealing users in multiple timezones, easiest standardize on utc. so store reminder_time in utc, way don't have worry tz when querying, since normalized utc. (assuming running servers utc. work expected). use tz offset in o...

excel - Automate the process of logging PDF files with associated information -

i making database has userform automate process of logging pdf files associated information. for want have user enter in drawings information, browse folder drawings in, , have drawing files listed in excel information repeated each drawing/pdf entry. how should code this? this have (and doesn't work): sub button2_click() userform1.show end sub sub startit() dim filesystem object dim hostfolder string dim xdirect$, xfname$, initialfoldr$ initialfoldr$ = "g:\scanneddwgarchive\transportation , buildingsdrawings\rocky harbour\" application.filedialog(msofiledialogfolderpicker) .initialfilename = application.defaultfilepath & "\" .title = "please select folder list files from" .initialfilename = initialfoldr$ .show if .selecteditems.count <> 0 xdirect$ = .selecteditems(1) & "\" end if end set filesystem = createobject("scr...

REGEXP_MATCH in BigQuery Standard SQL -

although bigquery standard sql documentation mentions function regexp_match [1], seems unavailable when running query, web interface returning: error : function not found: regexp_match what alternative using it? [1] https://cloud.google.com/bigquery/sql-reference/functions-and-operators#regexp_match what alternative using it? you should use regexp_contains

asp.net mvc - Can you hard code an Azure AD login into an application? -

i'm designing application uses embedded power bi reports requires authentication token azure ad account view report. on navigating page holds report, user directed azure ad portal login, , once enter credentials redirected correct page url contains access token. token pulled url , used in displaying report. so question (seemingly) simple: can skip navigating page , somehow hard code azure login app? i'm not sure if requires of code, it's more of abstract/general question. but here redirect azure ad login portal: response.redirect(string.format("https://login.windows.net/common/oauth2/authorize?{0}", querystring)); and here fetch code resulting url after user authenticates: model.code = request.params.getvalues("code")[0]; yes. aad supports headless auth. please see example here: https://github.com/azure-samples/active-directory-dotnet-native-headless .