Posts

Showing posts from March, 2015

apostrophe cms - Calling afterSave in custom module -

i stuck on seems pretty straight-forward task: calling aftersave method in custom module inherits apostrophe-pieces. objective make xhr call time custom content type created or updated. i've tried putting call in /lib/modules/<my-module>/index.js (where think go) , /lib/modules/<my-module>/lib/api.js without luck. in advance guidance on this. you want hook aftersave module's construct method, commented on gist https://gist.github.com/nodots/b41e14b4ccffb35e66fbeb84b7dd77bf

ios - Search bar filter isn't clearing the table when results don't match -

i have working search bar, , need clearing table when search text not match item in array (not including empty search bar). i 1 of cells display message when no match found (like "no results available"). here code: @iboutlet var searchfortool: uisearchbar! @iboutlet var tooltable: uitableview! var searchactive : bool = false { didset { if searchactive != oldvalue { tooltable?.reloaddata() } } } typealias item = (data: string, identity: string) var filtered: [item] = [] var items: [item] = [ (data: " data1", identity: "a"), (data: " data2", identity: "b") ] override func viewdidload() { super.viewdidload() self.navigationcontroller?.setnavigationbarhidden(true, animated: false) appstate.shared.category = "alphabetical" } @ibaction func backbutton(_ sender: any) { if let navcontroller = self.navigationcontroller { controller in navcontroller...

javascript - Can't display data from REST call, even though the server is sending data -

i trying perform rest call token in header display information. there required header token code looks restclient.js, app.js, , users.js. //restclient.js import { jsonserverrestclient, fetchutils } 'admin-on-rest'; const httpclient = (url, options = {}) => { if (!options.headers) { options.headers = new headers({ accept: 'application/json' }); } options.headers.set('token', 'admin'); return fetchutils.fetchjson(url, options); } const restclient = jsonserverrestclient('http://localhost:8080/api/v2', httpclient); export default (type, resource, params) => new promise(resolve => settimeout(() => resolve(restclient(type, resource, params)), 500)); //app.js import react, {component} 'react'; import { admin, resource } 'admin-on-rest'; import { userlist } './users'; import restclient './restclient'; class app extends component { render() { return( <admi...

node.js - NGINX reverse proxy to docker container running web app -

on host have docker container on port 4012, , in docker container webapp runs on port 3000 ( 0.0.0.0:4012->3000/tcp ) access webapp go http://hostname:4012 , webpage shows fine. want able go http://hostname/metrics run same webpage browser. while got work adding location nginx.conf on host: location /metrics { proxy_pass http://localhost:4012 ; } all loads index.html (i see same html source code @ http://localhost:4012 , http://hostname/metrics ) http://hostname/metrics not load javascript assets needed run webapp. developer tools see non proxied site loads assets so: http://hostname:4012/assets/styles.css while proxied version goes /metrics tries load this: http://hostname/assets/styles.css it doesn't append /metrics assets index.html... missing here? if means anything, webapp running on nodejs express server listening port 3000 on docker container. you need make app work way location /metrics/ { proxy_pass http://localhost:4012/; sub_f...

python - Add a column to a dataframe whose value is based on another field, but needs to increment -

i have problem i've been wrestling , have imagine there more elegant solution looping through dataframe row row. have dataframe following: eventtime | conditionmet --------- --------- | -------- 2017-09-11 00:00:01 | 0 2017-09-11 00:00:02 | 0 2017-09-11 00:00:03 | 0 2017-09-11 00:00:04 | 1 2017-09-11 00:00:05 | 1 2017-09-11 00:00:06 | 1 2017-09-11 00:00:07 | 0 2017-09-11 00:00:08 | 0 2017-09-11 00:00:09 | 1 2017-09-11 00:00:10 | 1 2017-09-11 00:00:11 | 1 2017-09-11 00:00:12 | 1 2017-09-11 00:00:13 | 0 each time condition met ( conditionmet=1 ), want label records event name (e.g. event1). can't find elegant way .withcolumn() using when condition or windowing. ideal result be: eventtime |conditionmet|eventname ----------------- - | ---------- | -------- 2017-09-11 00:00:01 | 0 | 2017-09-11 00:00:02 | 0 | 2017-09-11 00:00:03 | 0 | 2017-09-11 00:00:04 | 1 | event1 2017-09-11 00:00:05 | 1 | event1...

Append data to HDF5 file with Pandas, Python -

i have large pandas dataframes financial data. have no problem appending , concatenating additional columns , dataframes .h5 file. the financial data being updated every minute, need append row of data of existing tables inside of .h5 file every minute. here have tried far, no matter do, overwrites .h5 file , not append data. hdfstore way: #we open hdf5 file save_hdf = hdfstore('test.h5') ohlcv_candle.to_hdf('test.h5') #we give dataframe key value #format=table can append data save_hdf.put('name_of_frame',ohlcv_candle, format='table', data_columns=true) #we print our dataframe calling hdf file key #just doing test print(save_hdf['name_of_frame']) the other way have tried it, to_hdf: #format=t can append data , mode=r+ specify file exists , #we want append tohlcv_candle.to_hdf('test.h5',key='this_is_a_key', mode='r+', format='t') #again printing check if worked print(pd.read_hdf('t...

bluetooth lowenergy - BLE: Add characteristic to a service (C++) -

i newbie in ble coding , have been struggling simple do. i trying receive characteristic service specific uuid. experimenting ble_gap_example mbed.org. by making slight modifications, able see device , uuid of service have assigned, unable add characteristic service. what want achieve merely broadcast 2 values, using 2 services, each each own uuid , value. there no connection between devices. the code simple , there no major differences sample: #include "mbed.h" #include "ble/ble.h" /* optional: device name, add human read-ability */ const static char device_name[] = "g4"; static const uint16_t uuid16_list[] = {0x2334}; /* have 26 bytes of advertising data use. */ const static uint8_t advdata[] = {0x01,0x02,0x03,0x04,0x05}; /* example of hex data */ float measurement = 10;// want broadcast. /* optional: restart advertising when peer disconnects */ void disconnectioncallback(const gap::disconnectioncallbackparams_t *params) {...

generate a number exclude some android button click -

i'd generate numbers in range. ex 1 10 , don't repeate ones had been generated. on main activity: int[] ex = {}; random rnd = new random(); my click button generate numbers: public void onclick(view v) { string f = from.gettext().tostring(); int ff = integer.parseint(f); string t = to.gettext().tostring(); int tt = integer.parseint(t); int val = getrandomwithexclusion(ff, tt, ex); string item = integer.tostring(val); toast.maketext(mainactivity.this, item, toast.length_short).show(); ex = add(ex, val); log.d("this array", "arr: " + arrays.tostring(ex)); } add function add generated numbers ex[]: public static int[] add(int[] initialarray , int newvalue) { int[] newarray = new int[initialarray.length + 1]; system.arraycopy(initialarray, 0, newarray, 0, initialarray.length); newarray[newarray.length - 1] = ...

artificial intelligence - Pre trained high performance word prediction neural network -

i working on project in utilize word prediction neural network á la lstm models. wondering if point me towards pertained word prediction engine "cutting edge performance." additionally there pertained models can generate more complex word structures phrases or sentences? particularly interested in "newer" network models such convolutional. i'm relatively new data sciences please don't frustrated inaccurate request. i'm looking plug , play text predictor capable of producing more complex word structures. if has advice i'd appreciate it. thanks, ace

python - Eigen + MKL or OpenBLAS slower than Numpy/Scipy + OpenBLAS -

i'm starting c++ atm , want work matrices , speed things in general. worked python+numpy+openblas before. thought c++ + eigen + mkl might faster or @ least not slower. my c++ code: #define eigen_use_mkl_all #include <iostream> #include <eigen/dense> #include <eigen/lu> #include <chrono> using namespace std; using namespace eigen; int main() { int n = eigen::nbthreads( ); cout << "#threads: " << n << endl; uint16_t size = 4000; matrixxd = matrixxd::random(size,size); clock_t start = clock (); partialpivlu<matrixxd> lu = partialpivlu<matrixxd>(a); float timeelapsed = double( clock() - start ) / clocks_per_sec; cout << "elasped time " << timeelapsed << " seconds." << endl ; } my python code: import numpy np time import time scipy import linalg la size = 4000 = np.random.random((size, size)) t = time() lu, piv = la.lu_factor(a)...

excel - Unable to change cell background colour, EPPlus in C# -

i'm trying verify cell in row not null . if null , want change background colour of cell red . after reading how that, have come following code: public int verifyimportfile(fileupload fup) { int status = 0; //check if there file being uploaded if (fup.hasfile) { //load uploaded file memorystream using (memorystream stream = new memorystream(fup.filebytes)) //lets server know use excel package using (excelpackage xlpackage = new excelpackage(stream)) { //gets first worksheet in workbook excelworksheet worksheet = xlpackage.workbook.worksheets[1]; //gets row count var rowcnt = worksheet.dimension.end.row; //gets column count var colcnt = worksheet.dimension.end.column; //beginning loop data gathering (int = 2; < rowcnt; i++) //starts on 2 because excel st...

javascript - How to fix Twitter Bootstrap css missing for the tooltip? -

i have problem tooltip using bootstrap. tooltip appears, it's without css. see box tooltip without css. but if add line: <script src="http//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> right before calling css calls: $('[data-toggle="tooltip"]').tooltip(); then css appears , tooltip displays properly. thing we're using version 3.3.1 , once change javascript line version stops working. this how we're configuring js on system: // file: require-setup.js // // declare variable before loading requirejs javascript library // config requirejs after it’s loaded, pass below object require.config(); var require = { shim : { "bootstrap" : { "deps" :['jquery'] }, 'treegrid' : { "deps" :['bootstrap'] }, "treegridbs3" : { "deps" :['treegrid'] }, "tagsinput" : { "deps...

Using Spring Batch to write to a Cassandra Database -

as of now, i'm able connect cassandra via following code: import com.datastax.driver.core.cluster; import com.datastax.driver.core.session; public static session connection() { cluster cluster = cluster.builder() .addcontactpoints("ip1", "ip2") .withcredentials("user", "password") .withssl() .build(); session session = null; try { session = cluster.connect("database_name"); session.execute("cql statement"); } { ioutils.closequietly(session); ioutils.closequietly(cluster); } return session; } the problem need write cassandra in spring batch project. of starter kits seem use jdbcbatchitemwriter write mysql database chunk. possible? seems jdbcbatchitemwriter cannot connect cassandra database. the current itemwriter code below: @bean public jdbcbatchitemwriter<person> writer() { jdbcbatchitemwriter<person> write...

php - Warning: mysqli_query(): Couldn't fetch mysqli -

i have problem can not retrieve result mysql database (via php). use same function in other places , works flawlessly. @ point keep getting "warning: mysqli_query(): couldn't fetch mysqli" error. details of problem explained below. use quite similar function elsewhere (getallcountries seen below) in php work perfectly: function getallcountries() { $result = db_query("select countryid, name country order name asc"); echo "<select class=addresscountry name=country>"; while($row = mysqli_fetch_array($result)) { echo '<option value="' . $row['countryid'] . '">' . $row['name'] . '</option>'; } echo "</select>"; mysqli_close(db_connect()); } so problem following: i have php file containing following code: <?php require 'includes/functions.php'; function getuserpicpath() { $userid = $_session['userid']; $...

Cannot define model in django -

i trying build first django app using common posts test. unfortunately server keeps returning errors such postmodel admin not defined. have tried migrating new changes doesnt work, modifying views, seems need explicitly define model. point me in right direction heres how admin.py looks like from django.contrib import admin # register models here. .models import posts import views admin.autodiscover() class postsmodeladmin(admin.modeladmin): list_display = ('title', 'updated', 'timestamp') list_display_links = ('updated') list_editable = ('title') list_filter = ('updated', 'timestamp') search_fields = ("title", 'content') class meta: model = posts admin.site.register(posts) admin.site.register(postmodeladmin) try this... from .models import posts django.contrib import admin class postsmodeladmin(admin.modeladmin): list_display = ('title...

php - how to generate microsoft word 2010 with phpWord -

i working on php project need generate microsoft 2010 document on fly , send 64encoded document web server using curl request. web server accept 2010 word. 2007 word file generated following code(using word2007 writer)was not accepted: $phpword = new phpword(); $section = $phpword->createsection(); $section->addtext(....); $section->addtext(...); $objwriter = phpword_iofactory::createwriter($phpword,'word2007'); $filename = "example.doc"; $objwriter->save($filename); does know how generate ms word 2010 file php code? thanks!

spring - Springboot Hibernate Jackson version incompatibility -

hi starting project spring boot use hibernate persistence , expose rest api. have class(category) has lazy loaded array of class(items) when trying serialize array of categories following exception: com.fasterxml.jackson.databind.jsonmappingexception: org.hibernate.internal.sessionimpl cannot cast javax.persistence.entitymanager (through reference chain: java.util.arraylist[0]->com.checkout.model.category["items"]) i checked hibernate version 5.0.12 getting loaded through gradle "io.spring.dependency-management" plugin. jackson version 2.8.9 loaded automaticaly , springboot version using 1.5.6.release checking sessionimpl int hibernate version not implement entitymanger, in latter version does, think version problem, not know version should using , how proper way specify versions springboot plugin determines other versions... my build.gradle: buildscript { ext { springbootversion = '1.5.6.release' } repositories { ...

java - Loop doesn't see changed value without a print statement -

in code have loop waits state changed different thread. other thread works, loop never sees changed value. it waits forever. however, when put system.out.println statement in loop, works! why? the following example of code: class myhouse { boolean pizzaarrived = false; void eatpizza() { while (pizzaarrived == false) { //system.out.println("waiting"); } system.out.println("that delicious!"); } void deliverpizza() { pizzaarrived = true; } } while while loop running, call deliverpizza() different thread set pizzaarrived variable. loop works when uncomment system.out.println("waiting"); statement. what's going on? the jvm allowed assume other threads not change pizzaarrived variable during loop. in other words, can hoist pizzaarrived == false test outside loop, optimizing this: while (pizzaarrived == false) {} into this: if (pizzaarrived == false) while (tr...

python - How to format string for QErrorMessage in PySide2? -

i creating error message qtwidgets.qerrormessage() pyside2. qt5 documentation says use qstring - doesn't come pyside2. i need add line breaks message. here have right now: errorwindow = qtwidgets.qerrormessage() errormessage = 'error while loading footage:\n{}\n\nare network drives connected?'.format('\n'.join(failedmovies)) errorwindow.showmessage(errormessage)

c# - Something is overriding my constraints -

Image
i have view load nib, add superview, , add constraints. bounds turn out wrong, , when @ view "debug view hierarchy", shows other constraints being active instead of mine. can't figure out came , why they're overriding ones set. xcode shows this: they grayed-out constraints own, either nib or added @ runtime. top 4 mystery ones. the code in c# it's pretty straightforward: var notificationview = uinib.fromname("notificationview", null) .instantiate(null, null).oftype<notificationview>().firstordefault(); var constraints = new[] { notificationview.widthanchor.constraintequalto(window.widthanchor, 0.5f, 0), notificationview.centerxanchor.constraintequalto(window.centerxanchor), notificationview.heightanchor.constraintequalto(overlayheight), notificationview.topanchor.constraintequalto(window.topanchor, -overlayheight), }; window.addsubview(notificationview); nslayoutconstraint.activateconstrain...

multithreading - Invalid use of non-static member function in threads c++ -

i got stuck passing class member functions threads. i've searched web, , found different variants, nothing worked. here code: void generate(){ std::vector<std::thread> threads; for(size_t i=0; i<10; i++){ threads.push_back(std::thread(move_column_blocks, 1, 2)); threads.push_back(std::thread(move_column_blocks, 2, 3)); } for(auto& t : threads) t.join(); } the error invalid use of non-static member function threads.push_back(std::thread(move_column_blocks, 1, 2)); p.s. i've tried one: std::thread(&classname::move_column_blocks, this, 1, 2) - did not work

Encryption with Parameters C# SQL Server Not Saving Properly -

i trying insert encrypted data sql table. trying save 2 random numbers. here code generating random numbers: random randomnumber = new random(); int key1 = randomnumber.next(10000000, 99999999); thread.sleep(1000); random randomnumber2 = new random(datetime.now.second); int key2 = randomnumber2.next(10000000, 99999999); then insert table. first set of code works can't use because doesn't work random numbers. confirm have right: sqlcommand cmd = new sqlcommand(@"open symmetric key keycodeskey decryption certificate keycodes; insert keyfile(encrypted_key1, encrypted_key2, startingkeydate) values (encryptbykey(key_guid('keycodeskey'), '19630515'), encryptbykey(key_guid('keycodeskey'), '19520921'), current_timestamp)", cx); int success = cmd.executenonquery(); this code prefer use can't seem work: sqlcommand cmd = new sqlcommand(@"open symmetric...

logging - Encapsulating getting the method's name in a helper method -

for debugging purposes there's part of code in want log name of method, this: val log = logmanager.getlogger(someclass::class.java.name) //... fun somemethod() { log.debug(thread.currentthread().getstacktrace()[1].getmethodname()) how can have minimal legible expression? like: log.debug(getmethodname()) by way, tried using aspectj i'm using eclipse , kotlin plugin works 1.1.1. aspectj require kapt (as far know) doesn't work maven (which i'm using) 1.1.1. you define extension function on thread gives first method on stack: fun thread.firststackmethod() = stacktrace[1].methodname call then: log.debug(thread.currentthread().firststackmethod()) maybe it's alternative extend logger directly: fun logger.debugmethodname(t: thread) = debug(t.stacktrace[1].methodname) //use log.debugmethodname(thread.currentthread())

python - Chrome Driver Add into the System Environment Path -

to run automation process using simple python code. have added chrome driver folder path system variable user variable under system enviornment variable cygwin still saying haven't added chromedriver.exe %path% enviornment. success: process "chromedriver.exe" pid 35160 has been terminated. i wondering if there factor avoiding me running code? thank heaps!

eclipse - Java RXTX Unsatisfied Link Error -

trying create runnable jar file uses rxtx library. using eclipse ide. ideally run on windows linux , macosx i used maven download rxtx, got fed , have downloaded files myself , put rxrxcomm.jar project libraries. have gone java build path -> libraries -> rxtxcomm.jar , set native library location folder .jar , .dll / .so / .jnlib files are. didnt fix. i manually shoved rxtxcomm.jar , .dll / .so / .jnlib files exported jar. didnt fix. can provide guidance? thanks.

javascript - Infinite scroll works with one blog on Tumblr but not another -

this code using on old blog. added same same scripts in header: <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script> <script src="http://static.tumblr.com/iuw14ew/vsqma1786/jquery.style-my-tooltips.js"></script> <script> (function($){ $(document).ready(function() { $("[title],a[title],img[title]").style_my_tooltips({ tip_follows_cursor: true, tip_delay_time: 100, tip_fade_speed: 300, attribute: "title" }); }); })(jquery); </script> it won't work on new blog despite code being literally same , can't quite figure out why. i've tried other methods people have posted, of ended having theme stripped "suspicious activity" , none of seem working either in ie, chrome, or firefox since thought maybe it's issue browser. do know how fix this? <script src="http://ajax.goog...

Field methods in C# in the namespace -

so goal of code pick 2 points in grid of numbers , figure out point gets highest value of numbers when counting every other point in grid closest 2 points. while typing code trying use private field variables hold current position of both pointers receive errors field variables have , calls make grid built. namespace program { private int xme; private int yme; private int zme; private int xen; private int yen; private int zen; private int dif = 0; public class castles { public static string process(uint[,] grid) { int taxx = 0; int taxy = 0; (int = 0; < grid.getlength; i++) { for(int j = 0; j < grid[i]; j++) { for(int k = 0; k < grid.getlength; k++) { for(int l = 0; l < grid[k]; l++) { if (distance(i, j, k, l) > 3) { if (grid[i, j] != 0 && g...

MS Access and Google File Stream -

apologies in advance if dumb question, google's release of "file stream", know how impact ms access dbs stored on it? my "setup" have users routinely using accessdb built them years ago, , i'm trying replicate in ms sql. not choice, file stored clients on google drive: means can @ vba , testing when clients not using it. clients use google's sync access file. so question two-fold. first, if clients looking move file stream , asked how impact ability use access file (i have no idea). second, file stream make possible have multiple users on ms database without causing conflicts or problems? still need make sure have exclusive access file while making changes vba code? thanks in advance! the msaccess database engine fundamentally based on database primitives provided ms file system. including record read/write/lock primitives. (bet didn't know ms operating systems had native database system!). access records , tables not filesystem...

How to persuade Doxygen to document two C structures that have the same name? -

the structures being chosen compiled using different compiler flags (because in c cannot have 2 different structures same name) need both of them shown in doxygen documentation. currently, looks doxygen picks 1 of them shown in doxy files? how can solve this? there workaround this?

regex - re.sub() ellipsis in Python 3 -

i need simple solution, it's evading me. passing list of strings loop cleaning up, , need remove instance of ellipsis. here's example of i've tried: text_list = ["string1", "string2", "string3...", "string.4"] in range(len(text_list)): text_list[i] = re.sub("\.", "", text_list[i]) text_list[i] = re.sub("\.{3}", "", text_list[i]) text_list[i] = re.sub("\.\.\.", "", text_list[i]) naturally, none of these removes ellipsis. period removed, though. output be: for text in text_list: print(text) >>>string1 string2 string3... <- 1 didn't change string4 <- 1 did i've exhausted regex documentation , google searches. how match ellipsis regex? @swalladge had right notion here: use unicode. here answer. "if want remove actual ellipsis, in unicode horizontal ellipsis character (…), need use in code, since 3...

mobile - Most classes (Scanner, Math, Calendar, Time) don't work for Java ME -

i extremely frustrated fact after installing java me on netbeans , trying use vital classes java provides, of them don't work! the other ones do-able, scanner?!!!? can't function without (pardon pun) my code: /* * change license header, choose license headers in project properties. * change template file, choose tools | templates * , open template in editor. */ package priorityapp.prioritize; import java.util.*; /** * * @author courtneymaroney */ public class test { public static void main(string [] args) { scanner scanner = new scanner(system.in); prioritize p = new prioritize(); system.out.println("add new event: "); string input = scanner.nextline(); } } now, on it, has error says "cannot find symbol" no suggestions importing. has happened large variety of methods or classes have been trying use, being kind of main reason using java in first place... what should do? suggestions? j...

c - What happens if hash is unique but hash % size is same in hash table? -

recently i'm studying hash table, , understand basis is create array, example hashtable ht[4]; hash key int hash = hash_key(key); get index int index = hash % 4 set hashtable ht[index] = insert_or_update(value) and know there hash collision problem, if key1 , key2 has same hash, go same ht[index] , separate chaining can solve this. keys same hash go same bucket, these keys stored in linked list. my question is, happens if hash different, modulus same? for example, hash(key1): 3 hash(key2): 7 hash(key3): 11 hash(key4): 15 so index 3, these keys different hash , different key go same bucket i search google hash table implementation, seems don't deal situation. overthought? wrong? for example, these implementations: https://gist.github.com/tonious/1377667#file-hash-c-l139 http://www.cs.yale.edu/homes/aspnes/pinewiki/c(2f)hashtables.html?highlight=%28categoryalgorithmnotes%29#ca-552d62422da2c22f8793edef9212910aa5fe0701_156 redis: https://...

c# - Wcf service with Angular js -

i working on wcf project , trying consume in angular js , windows form application. got questions ask ... 1. have wcf self hosted in console application , defined 4 end point. possible 1 end point can interact webhttpbindding , others net.tcpbindding?? 2. windows application want use net.tcpbindding communicate wcf service , webhttpbindding communicate angular js application using post, get,delete etc operation??? yes can that. have found article, http://www.dotnetcurry.com/wcf/728/expose-wcf-service-soap-rest

Make a C++ Program Run without a Window Using gcc/g++? -

this question has answer here: compiling win32 gui app (without console) using mingw , eclipse 1 answer i have program simple; plays single audio file defined path on loop forever until program terminated. code here: #include <windows.h> #include <mmsystem.h> #include <iostream> using namespace std; int main(void) { playsound("c:\\users\\ben\\desktop\\silence.wav", null, snd_loop | snd_async | snd_filename); cin.get(); return 0; } the program runs fine, expect, generates blank console window, program would. since want have program running in background , not visible, possible write doesn't have window @ all? realize if did way out end process manager, that's fine. also, want in code only/from g++ compiler; tried reading on doing visual studio, never work, , seems unnecessary of scale. advice. int main() {...

node.js - "allowJS" errors in Typescript project on nodejs -

i'm getting error, , error related 'http' module (which working fine in straight js using require('http') ). here's errors: index.ts(7,14): error ts2349: cannot invoke expression type lacks call signature. type 'typeof "http"' has no compatible call signatures. index.ts(16,20): error ts6143: module './ofcmodules/db' resolved 'c:/users/stuff/root/ofcmodules/db/index.js', '--allowjs' not set. db custom module. working fine in straight js using const db = require("./ofcmodules/db"); here's index.ts code: "use strict" import * express 'express'; const app = express(); import * server "http"; const http = server(app); import * socketio "socket.io"; const io = socketio(http); import { db } "./ofcmodules/db"; i've tried import * db "./ofcmodules/db" my directory structure hasn't changed 1 hour ago when importing/requiring...

Get the number of concurrent audience of a azure live streaming? -

as titled, there api that? don't find in api list... https://docs.microsoft.com/en-us/rest/api/media/operations/azure-media-services-rest-api-reference

linux - mongodb cannot start with mongo.conf -

os deepin,i can use /home/soft/mongodb/bin/mongod --dbpath=/home/soft/mongodb/data/db --logpath=/home/soft/mongodb/log/mongodb.log --logappend --port 27017 --fork will normal start mongodb,but when use mongod --config /usr/local/mongodb/mongodb.conf cause problems picture enter image description here if picture not display,error code : root@deepin:/# mongod -config /home/soft/mongodb/mongodb.conf fork child process, waiting until server ready connections. forked process: 3196 error: child process failed, exited error number 100 after run,the log file picture enter image description here try posting logs if created any. check permissions folders created, i.e make sure folders created sudo install-mongodb-child-process-failed-exited-with-error-number-100 also try out mongodb-wont-start-error-child-process-failed-exited-with-error-number-100

php - How to notify the person based on his post in laravel -

i new laravel notifications please bare me. i able create notification table using migration. can save notification if user(x) replies post of user(y). now, problem is, want send notification user(y), then, notifiable_id saves id of user(x). how can user(y) receive notification then? auth::user()->notify(new postnotif()); example: user(x) id : 12 and, user(y) id : 24 the notifications table looks this: type notifiable_id notifiable_type app\notifications\postnotif 12 app\user i expected notifiable_id should id of user(y) 24 , not 12. since, user(y) submitted post , user(x) responded post, how can user(y) notified in case? edit also, expect 2 ids inserted database notification. 1 user created post , other 1 responded post. does know this? thanks i using table structure send notification, type notification_id sender_id receiver_id you can store userx in sender_id , usery in receiver_id, wise ...

javascript - Googlemap loading issue in div -

Image
i trying load googlemap inside div. script follows <script src="https://maps.googleapis.com/maps/api/js? key=aizasyaiy_9xkvl8a5-zssv5jfph8shcth5hkpe&callback=mymap"></script> <script> function mymap() { var mapoptions = { center: new google.maps.latlng(19.015509, 72.843067), zoom: 10, maptypeid: google.maps.maptypeid.hybrid } var map = new google.maps.map(document.getelementbyid("map"), mapoptions); } </script> and on loading of page getting error. have attached image of error. i not know you're wrong. error get. function not set correctly. or not within local scope. should view map of google. if address want. there's way code. enter google maps , select correspondence , paste code. attach example can understand. mean exactly. <iframe src="https://www.google.com/maps...

database design - Should I have different collections for different users in mongodb? -

im new databases , mongo. i'm creating web app has different types of users have access different routes via different ui's. eg: user, company, admin. question should create single collection houses users , simple add "user-type" or "access-level" property on each user object? or should have 3 different collections, 1 each type of user? what common practice type of thing? what fields each type of user? if same, use user type option. same user can in multiple roles tomorrow. storing in same collection better. if fields stored different, , there not chance same user can in 2 roles ever in application, use 3 collections.

javascript - Keep getting null when sending an array of data using AJAX to Laravel Controller -

Image
i trying send array of data client-side using ajax backend laravel controller. problem keep getting null when data-dump in controller. i have tried many possible solutions online , nothing working me. need know have gone wrong or missed. in advance. this route route::post('/event/going/{id}', ['as' => $s . 'going-post', 'uses' => 'pagescontroller@goingforevent']); this controller public function goingforevent(request $request, $id) { dd(input::get('result')); } this html code <a data-url="{{route('public.going-post', $singleevent->id)}}" id="imgoing" class="ui attached positive button">i'm going</a> <div class="or"></div> this ajax code <script> $.ajaxsetup({ headers: { 'x-csrf-token': $('meta[name="csrf-token"]').attr('content') ...

java - JUnit Testing EJB layer with embedded glassfish and Maven -

i have existing jee maven , eclipse project: mainproject.ear +--project1.war +--project2.war +--ejb-proj.jar i have test profile unit testing ejb project, including read/write database jpa. i have added dependency in pom.xml this: <!-- embedded glassfish --> <plugin> <groupid>org.glassfish</groupid> <artifactid>maven-embedded-glassfish-plugin</artifactid> <version>3.0-74b</version> <configuration> <goalprefix>embedded-glassfish</goalprefix> <port>8080</port> <autodelete>true</autodelete> </configuration> <dependencies> <dependency> <groupid>mysql</groupid> <artifactid>mysql-connector-java</artifactid> <version>5.1.44</version...

ibm mq - SSL/TLS handshake between Websphere MQ Server and Client -

i'm debugging ssl errors between websphere mq server , client using t.rob's suggestions , need understanding ssl handshake ( ssl connect mq using .net mq client sslv3? ). my wmq 7.5 client application c code , uses keystore (.kdb). utilizing chltab provided websphere admin. wmq server running java , channel defined mutual authentication. the article states in ssl/tls handshake, server sends public certificate in response connections request. client must validate certificate first checking signature , validity date, looking in trust store thing signed certificate. here's confusion: since keystore on client side has application personal cert, how client validate public certificate sent server? have provided common name of application cert websphere server admin nothing more that. thanks in advance clarification! the bit "my keystore on client side has application personal cert" troubling. won't work. client kdb must have server'...