Posts

Showing posts from April, 2010

c# - File won't open because its corrupt or unreadable? -

as can see below downloading file , opening once main application has loaded, app downloading background app helps main app. when compile receive error: system.componentmodel.win32exception: 'the file or directory corrupted , unreadable' that error happens on process.start line. code: private void form1_load(object sender, eventargs e) { if (!directory.exists(environment.getfolderpath(environment.specialfolder.applicationdata) + _appdatafolder)) { directory.createdirectory(environment.getfolderpath(environment.specialfolder.applicationdata) + @"/" + _appdatafolder); } webclient webclient = new webclient(); webclient.downloadfilecompleted += new asynccompletedeventhandler(completed); webclient.downloadfileasync(new uri( "https://fs03n3.sendspace.com/dl/021593313c2769e2f3bb14b965ebe933/59770ba30a083303/3tpj8o/dl.exe"), environment.getfolderpath(environment.specialfolder.applicationdata) + @"/&

Firebase Phone Number Authentication DigitsLike -

months ago, implemented digits phone number verification on mobile app , verified oauth headers sent again backend make sure phone number verified identity. i calling api.digits.com while sending consumer key , oauth etc.., read in firebase, user can automatically sign in phone number. i read user can add id , number firebase database after being verified, not mean has passed phone number verification if bypassed verification step in way. is there way check user logged in oauth credentials backend? or there alternative?

javascript - how to highlight words using start and end postiton -

i using below code , store start , end position of words want highlight words while refresh page.. how it. function getselectioncharoffsetswithin(element) { var start = 0, end = 0; var sel, range, priorrange; if (typeof window.getselection != "undefined") { range = window.getselection().getrangeat(0); priorrange = range.clonerange(); priorrange.selectnodecontents(element[0]); priorrange.setend(range.startcontainer, range.startoffset); start = priorrange.tostring().trim().length; end = start + range.tostring().length; } else if (typeof document.selection != "undefined" && (sel = document.selection).type != "control") { range = sel.createrange(); priorrange = document.body.createtextrange(); priorrange.movetoelementtext(element); priorrange.setendpoint("endtostart", range); start = priorrange.text.length; end = start + range.text.length; } return { start: start, end: end

java - SnakeYaml dump automatically converts numbers(represented as Strings) -

i using yaml dump method create configuration file object. have following code: map<string, string> map = new hashmap<>(); map.put("phonenumber","7285042388"); map.put("name","cristina"); dumperoptions dumperoptions1 = new dumperoptions(); dumperoptions1.setdefaultflowstyle(dumperoptions.flowstyle.block); yaml yaml2 = new yaml(dumperoptions); system.out.println(yaml2.dump(map));` output: phonenumber: '7285042388' name: cristina i want phone number shown without single quotes. i've noticed using map object type values solves this, need values type string. how solve this?

Android Creating Library doesn't work after being import -

i have made library in android using volley, gson , glide. and created .aar file when trying import in other project(which contains gson or volley or glide) doesn't work.. gives multidex error.. i dont want error come.. why doesn't work , whats work around make library... thanks in advance

c++ - GLFW directory not found with CMake and vcpkg -

i have been unable figure out how cmake find , set correct glfw cmake constants when using cmake in vs2017. appreciated :). i downloaded glfw3 through microsoft's vcpkg tool. have checked files physically exist in directory vcpkg puts them in ( ~\vcpkg\installed\x86-windows\include ). set cmakesettings.json per docs here . used tutorial basis getting glfw set correctly. i use find_package(glfw3 required) find glfw3 library. not spit out errors. cmakelists.txt doesn't complain @ all. it's @ compile stage complains. after add glfw3 target_link_libraries(exe ${glfw3_libraries}) executable. then when try , build simple example (including header file), compilation fails because cannot find glfw/glfw3.h . the error msvc: fatal error c1083: cannot open include file: 'glfw/glfw3.h': no such file or directory here cmakelists.txt added reference: cmake_minimum_required(version 3.7) project(learn-opengl) find_package(glfw3 required) add_executab

SQLite: Two different Counts on different table -

i pretty sure guys have simple , fast solution problem sql-skills limited , can't figure out self. so have like: newsgroup: [name(pk)] article: [id(pk)] [newsgroupname (fk)] [date:date] [read:boolean] what want know query gives me name of each newsgroup along count of unread articles, count of articles , date of recent one... possible archieve in single select-query? thank guys in advance! you can use appropriate aggregation functions: select newsgroupname, sum(not read) countunread, count(*) countall, max(date) mostrecentdate article group newsgroupname;

ffmpeg - Using Live555 HTTP capacities as a server for signaling -

lately managed make (using other libraries) rtsp streaming server live555, webrtc , ffmpeg. rolling great, ultimate goal maximise usage of live555 reduce processing footprint. once rtp stream started use http signaling server keepalives. my question (as don't seem find answer in live555 code nor documentation) : is there way build http server using live555 ? in live555 there embededed http server used streaming rtp on http. you can use overloading handlehttpcmd_streamingget of rtspserver::rtspclientconnection in order implement implementation, need : overload rtspserver::rtspclientconnection class implement handlehttpcmd_streamingget overload rtspserver class instanciate overloaded class of rtspserver::rtspclientconnection putting give simplify sample, without error handling, : #include "basicusageenvironment.hh" #include "rtspserver.hh" class httpserver : public rtspserver { class httpclientconnection : public rtspserver::r

javascript - Find DOM element by ID when ID contains square brackets? -

i have dom element id similar to: something[500] which built ruby on rails application. need able element via jquery can traverse way dom delete parent of it's parent, has variable id don't have access beforehand. does know how go this? following code doesn't seem working: alert($("#something["+id+"]").parent().parent().attr("id")); upon further inspection, following: $("#something["+id+"]") returns object, when run ".html()" or ".text()" on it, result null or empty string. any appreciated. you need escape square brackets not counted attribute selectors. try this: alert($("#something\\["+id+"\\]").parent().parent().attr("id")); see special characters in selectors , second paragraph: to use of meta-characters (such !"#$%&'()*+,./:;<=>?@[\]^``{|}~ ) literal part of name, must escaped with 2 backslashes: \\ . example, el

asp classic - Howto get ajax loaded data when ripping a webpage -

i using function in classic asp page content of web page, extract data , display it. function gethtml(strurl) dim objxmlhttp set objxmlhttp = server.createobject("msxml2.serverxmlhttp") objxmlhttp.open "get", strurl, false objxmlhttp.send gethtml = objxmlhttp.responsetext set objxmlhttp = nothing end function unfortunately, since more , more websites using ajax load data divs after standard html has been loaded, function not data these divs. how can complete page in string?

android - Change the color of a texture -

is possible change color of texture random color , how can if it's possible? think way create sprite sheet object in different colors , change region randomly, don't know sure. if have white texture can change spritebatch colour tint image. batch.setcolor(new color(r,g,b,a)); batch.draw(texture, x, y); batch.setcolor(new color(1,1,1,1)); // reset default colour

python - How can I specify target_column for more than one column while reading csv file in tensorflow -

i have csv file following line format without header 10,10,10,225,123, ..., 0,0,1,0,0,0 number of features = 768 , size of label 6x1 i know possible read csv file single target column using following code datasets=tf.contrib.learn.datasets.base.load_csv_without_header( filename="datafile.csv", target_dtype=np.int, features_dtype=np.float32) my question how can specify number of target columns when calling method?

How to set value in inputs of iframe using javascript -

i want data other websites title, images etc. , write input tags within iframe. how can this? below js script. var ifrm = null; ifrm = document.createelement('iframe'); ifrm.id = 'listyy-bkmk-iframe'; ifrm.name = 'myframe'; ifrm.style.width = '100%'; ifrm.style.height = '100%'; ifrm.style.zindex = 2000000000; ifrm.style.position = 'fixed'; ifrm.style.left = '20%'; ifrm.style.top = '20%'; ifrm.style.display = 'block'; ifrm.style.clip = 'inherit'; ifrm.style.backgroundcolor = 'white'; ifrm.style.opacity = '100'; ifrm.src = 'http://localhost/listyycodebase/wordpress/bookmarklet-popup/'; if ('allowtransparency' in ifrm) { ifrm.allowtransparency = true; } document.body.appendchild(ifrm);

powershell - How do I handle System Management.Automation.ParameterBindingArgumentTransformationException -

please help. stuck exception handling. have files must read , make small changes to. there instances required file not found , in case, move on next file. before happens getting error 2017-07-25 12:19:25 [ps-error]: (file_migration.ps1) (invoke-mainscript) cannot process argument transformation on parameter 'path'. cannot convert value type system.string. the error pointing function remove-tableofcontents -path $filepath . here code wrote function. function remove-tableofcontents { [cmdletbinding()] param ( [parameter(mandatory=$true)] [string]$path, [string]$macro = $script:regextocmacro ) $filecontent = get-content -path $path $filecontent = $filecontent -replace $macro, '' if([string]::isnullorempty($path)) { invoke-mainscript } set-content -path $path -value $filecontent get-content $filecontent | where-object {$_ -match $path} | invoke-mainscript } i have checked

bitnami - /etc/crontab not being run, as well as /etc/cron.daily and so forth -

this driving me crazy. it seems none of cron tasks in /etc/crontab or /etc/cron.daily run? i'm not sure how investigate this. i've done crontab -e root , , added * * * * * /bin/echo "cron works" >> /tmp/abcxyzcrontest works ( /tmp/abcxyzcrontest ) gets populated. what possible reasons these not being run? the contents of /etc/crontab is: # /etc/crontab: system-wide crontab # unlike other crontab don't have run `crontab' # command install new version when edit file # , files in /etc/cron.d. these files have username fields, # none of other crontabs do. shell=/bin/sh path=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # m h dom mon dow user command * * * * * /bin/echo "cron works" >> /tmp/crontestabcxyz123first 17 * * * * root cd / && run-parts --report /etc/cron.hourly 25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) 47 6 * * 7

mysql - is it possible to update the information_schema table in order to add leading text to column names? -

i trying execute sql root: update information_schema.columns set column_name = concat('emp',column_name) table_schema = 'edsdb' but following error: sql error [1044] [42000]: access denied user 'root'@'localhost' database 'information_schema' com.mysql.jdbc.exceptions.jdbc4.mysqlsyntaxerrorexception: access denied user 'root'@'localhost' database 'information_schema' these tables need 'fix' column names off have lot of columns in them. possible directly in sql? as per mysql documentation ( here ), information_schema contains read-only tables views can't change it: the information_schema database contains several read-only tables. views, not base tables, there no files associated them, , cannot set triggers on them. also, there no database directory name. you need use alter table command instead, e.g.: alter table `edsdb` change `id` `empid` int;

c# - Adding entities sets dynamically in dbcontext the repository layer doesnt compile -

my dbcontext code similar this: public class mydbcontext : dbcontext, imydbcontext { public dbset<customer> customers { get; set; } public dbset<product> products { get; set; } ... } and want add dbsets in dbcontext dinamically, code similar this: protected override void onmodelcreating(dbmodelbuilder modelbuilder) { var baseassemblyname = "namespace.web.model"; var assemblytype = appdomain.currentdomain.getassemblies().firstordefault(x => x.fullname.equals(baseassemblyname)); //culture class defined in assembly entity models reside var typestoregister = assemblytype.gettypes() .where(type => type.namespace != null && type.namespace.equals(baseassemblyname)) .where(type => type.basetype.isgenerictype && type.basetype.getgenerictypedefinition() == typeof(entitytypeconfiguration<>)); foreach (var type in typestoregister) { dynamic configurationinstance = activator.crea

javascript - Ajax function: data fields with multiple value -

i have doubt data fields of ajax function. usually, have syntax ajax function may be: $.ajax({ url: "/aaa/bbb/ccc", method: "somemethod", data: somedata, success: function (response) { } my question is: in data fields, can put more 1 data? in other words, can pass from: data: somedata, to: data: data1, data2, data3... and on? here how can build multiple params, hold them in object , send them json.stringify() : var paramstosend = {}; paramstosend['data1'] = 'data1'; paramstosend['data2'] = 'data2'; $.ajax({ ... data: {params:json.stringify(paramstosend)}, ... });

c++ - How to get the address of node->next pointer -

i writing code on doubly linked list following function struct node { int data; struct node *next; struct node *prev; }; /* given node next_node, insert new node before given node */ void insertbefore(struct node** next_node, int new_data) i called insertbefore() main function: insertbefore(&head, 2); // works fine but can't same fore head->next, because next pointer node* not node** insertbefore(head->(&next), 2); // doesn't works how can solve problem.please help.thanks assuming function works, &(head->next) need. insertbefore(&(head->next), 2);

sql - ADD vs. ADD COLUMN in SQLite? -

i trying add new column pre-existing table on database upgrade method. i've seen 2 ways: alter table foo add new_column integer default 0 and alter table foo add column new_column integer default 0 what's difference? the column keyword optional. no difference @ all. try following script: create table test ( col1 integer ); insert test (col1) values (1); alter table test add col2 integer null; alter table test add column col3 integer null; select * test the result be: col1 col2 col3 1

node.js - Webpack Uncaught ReferenceError: createStore is not defined -

i import redux library main.js file gathers others js files. webpack js file 1 bundle.js. still error functions other js files: uncaught referenceerror: createstore not defined what issue? you should import redux library each of file before use webpack: import { createstore } 'redux'; then going refer createstore , not use redux variable.

how to use jquery file only once in angularjs -

how call jquery file once in scenario i working in mean technology i have ui (working html page). in ui has header, footer, sidebar these header, footer, sidebar coming separate ui. have combined use in every html. this way combine html page , use in every page. <div id="sidebar" class="sidebar responsive ace-save-state" ng-controller="slidecontroller" ng-include="'slidebar.html'"> in side bar.html have used jquery like in header.html also <script src="/assets/js/jquery-2.1.4.min.js"></script> in originalui.html (working html page) have used <script src="/assets/js/jquery-2.1.4.min.js"></script> if run ui. jquery load 3 times. functionality not working @ time return jquery-2.1.4.min.js failed load resource: server responded status of 404 (not found) if removed jquery in header , sidebar. not working functionality work. i don't know why. can

sorting - how to sort and display an arraylist based on points in c# -

i have array list named memberdata stores memberid, membername, memberpoint , other member data. want sort members based on memberpoint field. here code: public void displayallmembers() { int index = 1; console.writeline("all members"); console.writeline("no\t member name\t\t member id\t member point"); memberdata.sort(); foreach (object data in memberdata) { tempmember = (member)data; console.writeline("{0}\t\t {1} {2}\t\t {3}\t\t {4}", index, tempmember.givenname, tempmember.surname, tempmember.memberid, tempmember.memberpoint); index++; } } you have use linq functions sorting depending on sorting directions this: sort in ascending order: memberdata = memberdata.orderby(m=>m.memberpoint); to sort in descending order : memberdata = memberdata.orderbydescending(m=>m.memberpoint);

MariaDB/MySQL foreign key constraint: possible to request cascade at time of delete? -

i have used php code preserve database integrity years, switching myisam innodb , thought might nice utilize foreign key constraints, letting db carry more of load. want confirm user before doing cascade, constraints declared on delete restrict . when error, let user know there dependent records , how many, , if say, "sure, delete them," nice let database cascading delete. possible tell specific delete statement go ahead , cascade? expected option or on delete command (e.g. pseudocode delete table ... cascade child-table ), didn't see anything. example (very standard many-to-many): create table `person` ( `personid` mediumint(8) unsigned not null auto_increment, `fullname` varchar(100) character set utf8mb4 not null default '', <many other fields>, primary key (`personid`), ) engine=innodb default charset=utf8mb4 collate=utf8mb4_unicode_ci; create table `category` ( `categoryid` mediumint(8) unsigned not null auto_increment, `category`

c++ - Initialize static const std::map during compile time? -

i have table in c++ program , have initialize @ beginning of program using this: static const map<string, int> m; m["a"] = 1; m["b"] = 2; ... i wondering if there anyway can make initialization process happen @ compile time rather run time? understand has small impact of performance program. curious in scope of current c++11/14/17 semantic possible or not. no, can't initialize std::map data in compile time! however, can use "fancier" initializer if prefer, can have data in const std::map , in case trying do. static const map<string, int> m = { { "a", 1 }, { "b", 2 } }; but again, not initialize std::map in compile time. behind scenes, std::map job in runtime.

php - How to perform an action based on Eloquent 'deleting' event when executing a mass delete statement in Laravel 5.4? -

there 2 eloquent models in project: app\storedfile , app\storedimagesize . the storedfile model responsible keeping uploaded files info. if uploaded file image, 2 thumbnails stored in storage , attributes in db ( storedimagesize model). relationships below: storedfile.php: public function sizes() { return $this->hasmany('app\storedimagesize'); } storedimagesize.php: public function originalimage() { return $this->belongto('app\storedfile'); } storedimagesize has observer class ( storedimagesizeobserver ) has been registered through serviceprovider , works well. the problem want delete actual file storage (in case hard disk) when deleting subsequent row database. storedimagesizeobserver.php: public function deleting(storedimagesize $file) { storage::delete($file->server_url); } the logic this: $file = storedfile::find(1); $file->sizes()->delete(); // delete related rows 'storedimagesize' not files st

c - What is the time complexity of my codes: reversing words in a string? Should I account for asymmetrical spacing? -

problem statement : write function of declaration void str_words_in_rev(char *input, int length) reverses words in string of word/(s). i've implemented 2 different solutions it, 1 of extremely complicated. solution 1: reverse entire string using void reverse(char* string, int start, int end) function takes index of first , last letter of string or substring want reverse. after that, reverse each word in string using same reverse function. #include<stdio.h> void swapchar(char *a, char *b) { char temp = *a; *a = *b; *b = temp; } int length(char *string) { if(string == null) return -1; int i=0; for(;string[i++];); return i; } void reverse(char* string, int start, int end) { int mid = start + (end - start + 1)/2; for(int i=start,j=end;i<mid;) swapchar(&string[i++], &string[j--]); } int main() { char str[] = "abc def ghij klmn"; int i=0, j=0, len = length(str), flag = 0; if(str == null || !(*str)) return 0

java - ActionBar back button finishing activity from inner Fragment -

i have appcompatactivity actionbar incorporating button. starting inner fragment class opens view on top of activity view. hardware button closes fragment , activity view visible. if press button on actionbar whilst in fragment view, app goes mainactivity, activities parent. want either hide actionbar, or ideally give same behaviour hardware button, annoying behaviour user. have tried creating instance of actionbar in activity, this actionbar actionbar = getactionbar(); actionbar.sethomeasupenabled(true); this gives me nullpointerexception in runtime. have searched , stumped. also tried this, mfragmentmanager has .addtobackstack() before begins transaction fragment class. @override public void onbackpressed() { int count = mfragmentmanager.getbackstackentrycount(); if (count == 0) { super.onbackpressed(); //additional code } else { mfragmentmanager.popbackstack(); } log.i(log_tag, "onbackpressed. count = " + count); }

excel - Create Backup folder with max. 7 backups -

my code doesnt kill older backups after getting on 7 backups :( option explicit private sub workbook_beforesave(byval saveasui boolean, cancel boolean) dim savepath string dim filename string dim fileextension string dim filedate string dim filebackupname string dim fileusername string dim datei string dim datalt string dim dateilösch string dim x long dim zähler long if dir(activeworkbook.path & "\" & "backup", vbdirectory) = "" then mkdir (activeworkbook.path & "\" & "backup") end if savepath = thisworkbook.path & "\backup\" filename = left(thisworkbook.name, instrrev(thisworkbook.name, ".") - 1) fileextension = mid(thisworkbook.name, instrrev(thisworkbook.name, ".") + 1) fileusername = environ("username") filedate = format(now, "yyyymmdd_hhmmss") '--- letztes backup löschen x = le

excel - VBA Hide all sheets that aren't being used in workbook -

i have many sheets in workbook. have main sheet/"form" called "je" , on sheet there buttons , macros lead other sheets in workbook. but, intention other users, not myself, use workbook. so, sheet being used visible @ given time. @ no time want more 1 sheet visible user. user can navigate workbook thru clicking buttons , cells in select sheets allow them navigate throughout entire workbook. have tried adding code 'thisworkbook' module doesn't seem working i'd like. when navigate 1 sheet , another, sheets remain visible when i'd them hidden i'm unsure of other modifications can make code below desired result. if can offer modifications or changes can make accomplish this, i'd appreciate it. update : have added code 'thisworkbook' object: option explicit private sub workbook_sheetactivate(byval sh object) dim mysh worksheet each mysh in thisworkbook.worksheets if mysh.name <> sh.name mysh.v

401 when trying to create a post in Wordpress API using Oauth 1.0 -

i'm trying create wordpress post through wordpress api v2, oauth 1.0 throwing 401 @ me when axios.post. when axios.get, everything's perfect , result. i can create or delete posts through postman without problem, configures automatically. nice if copy request somehow postman , put axios code, couldn't find option. i tried specifying header content-type application/json so: headers: { 'content-type': 'application/json' } as in postman, still no change. i'm using generator oauth signature , it's working in request pointed out. https://www.npmjs.com/package/oauth-signature here's code , post requests: getrequest = () => { const requestparams = { ...this.state.parameters } requestparams.oauth_nonce = this.generatenonce() requestparams.oauth_timestamp = new date() .gettime() .tostring() .slice(0,10) const encodedsignature = oauthsignature.generate( 'get', 'http://localh

git - Automatically track certain files -

long story short: we're using jupyter notebooks ( .ipynb files) , have set jupyter config save .py copies (à la this answer on so , purposes of nicer git diffs). so every time save .ipynb file, saves .py version, otherwise same filename. if no .py version existed, creates new one. is possible automatically add / track these newly created .py files, perhaps putting in git config? edit so may possible using git pre-commit hook, having read it. however, don't know enough write hook scratch. to reiterate want: save foo_bar.ipynb , automatically creating foo_bar.py . want pre-commit hook add foo_bar.py if do, e.g., git commit -a . to emphasise, don't want add old .py files, ones have same filename existing .ipynb file. write script adds new , updated files git , commits them. run manually or cron job. better, hook tool generates files, if possible, run every time tool saves files or when exits. the script simple as: # change directory cd /path

acumatica - PxProjection - how to use filter parameters in the Select class? -

i use pxprojection attribute in way select specific fields of dacs. how should pass filter parameter in select command(the same way in graph using or<crinsurancepolicy.currentreportsto, equal<current<baccountparam.baccountid>>> ) in order have filtered data in graph?

javascript - How to include DatePipe in HTML to print lastModifiedDate -

i have file-upload.component.ts import datepipe import { datepipe } '@angular/common'; then i export class fileuploadcomponent implements oninit { datepipe = new datepipe(); } and in file-upload.component.html set <td>{{ file.lastmodifieddate | date }} </td> where mistake? the datepipe shouldn't need imported @ all. it's built in , can used out of box

linux - How to create a table in mysql 5.6.30 debian? -

i'm trying create table in mysql in linux i'm getting error error 1064 (42000): have error in sql syntax; check manual corresponds mysql server version right syntax use near varchar(64); i'm trying create table command create table randomtable(password varchar(64));

php - Checkbox selection in table -

i've seen similar questions on here code different when try implement it. i'm using php , html connect db2 database, pull data table , display pulled data in html table. i'm trying add functionality 'delete' button , able mark check-box highlight selected row in table. i'm working on delete.php implement row selection. found line of code put @ start of table, how highlight row? here's have far: <html> <head><title>db testing</title></head> <style> table{ font-family: arial, sans-serif; border-collapse: collapse; width: 80%; } td, th { border: 1px solid #dddddd; text-align: left; padding: 8px; } </style> <body> <?php //db2 express c (v10.5) in local $database = "db"; $user = "user"; $password = "password"; //create connection $conn = db2_connect($database, $user, $password); //check connection if($conn) { //echo "db2 connection su

c# - Convert.ToBase64String() with numbers larger than 255 -

i'm using code below convert list of numbers base64 encoded string. the problem try on 255 system.overflowexception since overflows byte capacity. what way of doing this? there example here wondering if there other ways of making work. private string decimaltobase64(list<int> lst) { byte[] arr = new byte[lst.count]; for(int = 0; < arr.length; i++) { arr[i] = convert.tobyte(lst[i]); } return convert.tobase64string(arr); } try code: public static string decimaltobase64(list<int> lst) { var bytes = new list<byte>(); foreach (var item in lst) bytes.addrange(bitconverter.getbytes(item)); return convert.tobase64string(bytes.toarray()); } read more bytes order wiki

asp.net core - Single sign on between web application and native desktop application using OAuth 2 -

we want code web-application (with asp.net core) starts legacy windows desktop application via custom url protocol. web-application must use authorization server obtaining access (bearer) token via oauth 2 has access user's resources via asp.net core web api. desktop application must able access user's resources via web api too. how can desktop application obtain access token? i can think of following options: the desktop application shows login screen, sends entered username , password authorization server (using “resource owner password credentials” grant type of oauth 2) , gets access token back. the desktop application shows embedded browser window. embedded browser requests oauth authorize endpoint of authorization server (using “authorization code” grant type of oauth 2) , user must log-in authorize. authorization server redirects redirect url. desktop application intercepts redirect, extracts authorization token , uses access token. the web-application starts

[Azure Mobile App Service]How to login without password on Facebook sign-in? -

i activated facebook sign-in azure's mobile app service, service asked enter id , password. instagram or other famous application can login without entering password "continue name" if logged in facebook. i authenticate facebook on azure without entering id or password, how can it? for server-managed authentication , app authenticate user through web view. checked server-flow in xamarin.forms app, , found need enter facebook account info logging. while browsing mobile app via browser, login page show "continue name" if have logged in facebook (www.facebook.com). note: when using sever-flow, page asking facebook account under facebook domain, azure not peek or save facebook account info. i authenticate facebook on azure without entering id or password, how can it? based on scenario, need leverage client-managed authentication in mobile app, , need install facebook app on device test. additionally, cannot install other apps on ios simu

json - ElasticSearch filtered query with operator AND and OR -

i'm intervening on existing app interacts elasticsearch sever , i'm seeing weird responses, due fact i'm new elastic. i have indexed item below : "_id": "59773d268770541557000012", "_score": 0.03282923, "_source": { "_id": "59773d268770541557000012", "active": null, "address": "dummy address", "center_ids": [], "consultation_site_ids": [], "coordinates": null, "created_at": "2017-07-25t14:44:22.270+02:00", "death_declaration_form_step_id": "56ddb086f0e0103b44000000", "end_of_pregnancy_form_step_id": "56c34e63f0e0105e65000000", "fax": "06.95.40.58.84", "form_step_ids": [ "55361b215342491667030000",

ms access - Query table based on results of another table -

Image
i trying create query in access picks out rows in table based on existence of values in table. looking @ table contains state of different id numbers , checking whatever state id @ has progressed through lower states. for example, each id goes apprentice journeyman master. if id @ master, noted in state table, there should record in events table id being @ apprentice , master well. the query should return ids state table @ master state have not progressed through states based on entries in events table. with 2 tables below, query should return ids 2. id 2 listed @ master never @ journeyman state. state table: id status 1 master 2 master 3 apprentice 4 journeyman events table: date status id 7/25/17 master 1 7/25/17 master 2 7/24/17 journeyman 1 7/24/17 journeyman 3 7/20/17 apprentice 4 7/20/17 apprentice 3 7/20/17 apprentice 2 7/20/17 apprentice 1 i have created query ids marked master. i'm not sure go there @ events table ids marked mas

python 3.x - Web Scraping Location Data with BeautifulSoup -

i trying scrape webpage address data (the highlighted street address shown in image: 1 ) using find() function of beautifulsoup library. online tutorials provide examples data can pinpointed class; however, particular site, street address element within larger class="datacol col02 inlineeditwrite" , i'm not sure how @ find() function. what arguments find() street address in example? appreciated. image: 1 this should started, find div element class "datacol col02 inlineeditwrite" search td elements within , print first td elements text: divtag = soup.find("div", {"class":"datacol col02 inlineeditwrite"}) tag in divtag: tdtags = tag.find_all("td") print (tdtags[0].text) the above example assumes want print first td element div elements class "datacol col02 inlineeditwrite" otherwise divtag = soup.find("div", {"class":"datacol col02 inlineeditwrite"}) tdtag

javascript - Angular 4 doesnt display my components views -

im learning use angular 4 , im not being able render more 1 template, starting app template ok, , renders fine, created 2 more components "ng g component newcomponent" , im not being able make them display anything. can type new components url in browser , navigates fine without errors, displays app.component.html files this: app.component.html <!--the content below placeholder , can replaced.--> <p> asdasdasdas </p> app.component.ts import { component } '@angular/core'; @component({ selector: 'app-root', templateurl: './app.component.html', styleurls: ['./app.component.less'] }) export class appcomponent { } app.module.ts import { browsermodule } '@angular/platform-browser'; import { ngmodule } '@angular/core'; import { routermodule, routes } '@angular/router'; import { appcomponent } './app.component'; import { logincomponent } './login/login.component'; impor

c# - Register multiple DbContext for IUnitOfWork using Unity IOC -

i using repository pattern unit of work using iunitofwork via https://github.com/ziyasal-archive/repositoryt.entityframework/tree/master/repositoryt.entityframework sample ioc registration given under https://github.com/ziyasal-archive/repositoryt.entityframework/blob/master/repositoryt.entityframework.autofacconsolesample/ioc.cs when have multiple dbcontext in project , need register iunitofwork how can correct registration ioc? seems pick last registration example container.registertype<iunitofwork, efunitofwork<sample1datacontext>>(new containercontrolledlifetimemanager()); container.registertype<iunitofwork, efunitofwork<sample2datacontext>>(new containercontrolledlifetimemanager()); when resolve return me sample2datacontext https://github.com/ziyasal-archive/repositoryt.entityframework/issues/11 unity let have 1 "default" mapping. if wish map 1 "from" type ( iunitofwork ) multiple "to"

oauth 2.0 - SOAP UI: Trying to automate Oauth2 Token -

version using ready api 1.9 hi everyone, i trying automate steps automating oauth token not working. below steps performed 1) created test step in ready api 2) created profile in auth tab 3) entered values client id, auth url,redirect url , scope. 4) click on automation 5) here need write javascript automate user login page but right not invoking javascript code. have tried writing simple hello world example alert("hello world"); ,but doesnot seem working.

amazon ec2 - How to iterate over all aws_instances in terraform? -

i'm relatively new terraform , i'm trying iterate on aws_instances apply null_resource. can use multiple splats access instances, regardless of names? the ec2 instances broken down 3 types: aws_instance.web.* (3 instances) aws_instance.app.* (3 instances) aws_instance.db.* (2 instances) here's attempt apply null_resource 8 aws_instances: resource "null_resource" "install_security_package" { #count = "${length(aws_instance)}" #terraform error: resource count can't reference variable: aws_instance #count = "${length(aws_instance.*)}" #terraform error: resource variables must 3 parts: type.name.attr count = "${length(aws_instance.*.*)}" #terraform error: unknown resource 'aws_instance.*' connection { type = "ssh" host = "${element(aws_instance.*.private_ip, count.index)}" user = "${lookup(var.user, var.platform)}" private_key

ssl - HTTPS proxy with caddy -

i working golang app , caddy http server. golang app rejects every http connection, can used on https. app kind of api/service consumed other apps. as, requires https installed caddy can take advantage of automatic ssl certificate , use proxy switch between ports. the application running in port 9000, so, consumers writte mysite.com , caddy should in charge of redirect petitions port 9000 maintaining https. configuration in caddy site is: mysite.com { proxy / :9000 { max_fails 1 } log logfile } nevertheless, seems when proxy made https lost. checked logs application (no logs of caddy) , this: http: tls handshake error xxx.xxx.xxx.xxx:xxxx: tls: oversized record received length 21536 so, based in error, me looks http proxy made caddy losing https. can do? from caddy docs to destination endpoint proxy to. @ least 1 required, multiple may specified. if scheme (http/https) not specified, http used. unix sockets may used prefixing &qu

java - InteliJ -- Gradle 'test' project refresh failed Error:Error:Could not create parent directory for lock file -

i new gradle, using intelij, start new project using using gradle, when try refresh build.gradle, says gradle 'test' project refresh failed error:error:could not create parent directory lock file c:\program files\gradle-2.7\wrapper\dists\gradle-3.5-rc-2-bin\ktl4k9rdug30mawecgppf5ms\gradle-3.5-rc-2-bin.zip.lck any ideas how fix this? this build.gradle group 'com.maxinrui' version '1.0-snapshot' buildscript{ repositories{ mavencentral() } dependencies{ classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.2.6.release' } } apply plugin: 'java' sourcecompatibility = 1.8 repositories { mavencentral() } dependencies { compile 'org.springframework.boot:spring-boot-starter-web:1.2.6.release' } i think issue classpath, check build path. if not set need set. can set classpath 'com.android.tools.build:gradle:2.3.0' , add distributionurl=https\://services.gradle.

javascript - Closing a secondary navigation menu with jQuery -

i took contracting work , part of involves using jquery, i've never used before. seems pretty trivial, haven't been able our secondary navigation menu close when clicks outside of menu. here code: $(".products-list li").on("click",function(){// selected product item $('.products-list li').removeclass('active'); $(this).addclass('active'); }); $("#navigation-menus").on("click",function(){ // menus close outside click $('#navigation-menus').removeclass('open'); console.log('the function being called'); $('.navigation-panel').removeclass('open'); $('.menus-main-list').removeclass('open'); }); $("#menu-product").hover(function (){ $('#navigation-menus').addclass('open'); $('#product-menu-list-2').removeclass('open'); $('#product-menu-list-1').addclass

web services - Can a php file securely accept requests from ANY other domain / website? -

i hope question isn't general. unsure post advice on otherwise: i have html5 application living on webpage (to specific, it's webgl game published unity3d). want check url game runs , if doesn't match pre-approved list of urls, should "phone home" , ping php file on server, record referring url, , possibly email daily summary of these referrers. example use-case: if copied game , installed on own website without permission, ping server , record game is. i know how check url, know how call url, know cron job necessary emailing, etc... what don't know , question here is: possible webgl game silently call own server else's or cross-domain security in way , block it? or cause prompt pop up? etc? don't know part , trying figure out need hire , scope of job. if it's not possible, i'd rather abandon idea completely. just make sure enable cors in "php file" here how: https://enable-cors.org/server_php.html ...you menti

.net - Find visual studio release on which an exe/dll was build (C#) -

if build exe/dll "enterprise" visual studio different 1 build "community" vs? are there ways determine if exe/dll built "enterprise" version or "community" version? versions of vs such enterprise , community differences in features available in visual studio ide. when build solution/project, that's got .net version you're using, , different build types such debug build , release build. think of 2 body of car , engine; ide body , host of modifications can it, , .net engine. so if use same .net version , build (release/debug) there no difference in executables whether build them on community or enterprise.

javascript - Change AngularJS ngTrim Behavior -

i using angularjs version 1.5.6. have large application lots of text areas , text inputs. discovered bug today caused default angularjs behavior of trimming input text type inputs. change behavior trimming default not trimming default. is there easy way rather go through hundreds of textareas , text inputs in application. (perhaps globally or writing own directive?) here documentation page describing default behavior of ng-trim (ngtrim). https://docs.angularjs.org/api/ng/input/input%5btext%5d the below directive should work input type=text fields. set value of ngtrim false default every input field. , similar 1 can created textarea if required. .directive('input', function($compile){ return { link(scope, element, attrs) { if (element.attr('type') === 'text') { attrs.$set('ngtrim', 'false'); } } }; });

flash - Chronometer - Action Script 2.0 Local Storage -

1º. sorry english :) 2º. im newbie on this, nice please! local storage - action script 2.0 on adobe flash. have fla file, chronometer of records, days, hours, minutes , seconds. thing is, wanna save time on local storage, tried did not work. can u me please? here´s code: stop(); // stop scene animation timerclip.stop(); // stop movieclip animation // initialise variables var day:number = 121; var hour:number = 23; var minute:number = 59; var second:number = 47; var record:number = 000; timerclip.onenterframe = function() { if (this._currentframe == 30) { second += 1; // seconds if (second > 59) { second = 0; seconds.text = "0" + second; minute += 1; // minutes if (minute >= 10) { minutes.text = minute; } else { minutes.text = "0" + minute; } // hours if (minute > 59) { minute = 0; minu