Posts

Showing posts from February, 2013

javascript - Modal mostly keeps quiting immediatly -

i trying include modal in code. when clicking button/href, different file should shown in modal. took code here . now, after loading animation (or after few ms) modal closes. weird part when press button few times, work , file shown. here code (the relevant part): // modal var modal = document.getelementbyid('mymodal'); // button opens modal var btn = document.getelementbyid("mybtn"); // <span> element closes modal var span = document.getelementsbyclassname("close")[0]; // when user clicks on button, open modal btn.onclick = function() { modal.style.display = "flex"; }; // when user clicks on <span> (x), close modal span.onclick = function() { modal.style.display = "none"; }; // when user clicks anywhere outside of modal, close window.onclick = function(event) { if (event.target == modal) { modal.style.display = "none"; } }; /* modal (background) */

javascript - how to give "same as the above" in form entries -

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <form method="post" class="form-group"> <label>first name</label><input type="text" name="fname" class="form-control"> <label>last name</label><input type="text" name="lname" class="form-control"><br> <label>i ready</label><input type="checkbox" name="ch"><br><br> <label>address</label><input type="text" name="address" class="form-control"> </form><br><br> <form method="post" class="form-group"> <label>same above</label><input type="checkbox" name="chd"><br><br> <label>first name</label><input type="t

security - How secure is PHP session_start $_SESSION value as login verification? -

if user logs in , passes security checks (username, password, 2fa... whatever) , hypothetical php login system like: session_start(); $_session['logged_in_userid'] = 1; how safe rely on existence of $_session value 'logged_in_userid' proof person did pass full security check? not very, i'm thinking. if xss determine phpsessid, , manually add own local cookies. not going automatically assumed logged in when visit same system? if - resolution record, @ login time, in _session the: remote_addr, http_user_agent , x_forwarded_for , compare @ each request time not _session logged_in_userid _session remote_addr etc etc found in current _server vars? or flawed also? it secure but need stuff make sure can't 'hijack' session xss example mentioned: static protected function preventhijacking() { if(!isset($_session['ipaddress']) || !isset($_session['useragent'])) return false; if ($_session['ipaddress

php - Billing form - Request for more information if entered data match with a number -

can me? i'm trying create billing info form, , if customer enter example 5120293213632438 i'll use 'substr' first 6 numbers, if 6 numbers match 512029 , 537030 , 432049 , etc... i'll request more info -> vat number , id. <form action="validate.php" method="post"> <p>credit card number : <input type="text" name="cc" /></p> <p><input type="submit" value="next"></p> </form> validate.php <?php $vbv = substr($_post['cc'], 6); if($vbv == '512029') $flag = strstr($bin, $needle); echo "ok"; else echo "i'm not vbv"; ?> <?php ini_set('display_errors', 1); $array=array(512029, 537030, 432049); //array of start 6 digits want match $cc='5120293213632438';//credit card no's want match. if(in_array(substr($cc, 0,6),$array)) { echo "first 6 digit matched&

visual c++ - While creating private pool WinBioOpenSession() is failing and returning WINBIO_E_CONFIGURATION_FAILURE -

i'm creating bio metric project in visual studio 2008 using mfc application in vc++ i'm getting following difficulties. please help i'm trying create private pool using winbioopensession() method function returning winbio_e_configuration_failure should do? bool cprivatepoolbiodlg::enrollfingerprint() { winbio_unit_schema *unitschemaarray = null; size_t unitschemacount = 0; winbio_unit_id unitidarray[1]={}; size_t unitidcount = arraysize(unitidarray); winbio_session_handle sessionhandle; hresult hr; // = s_ok; //enumarating devices... hr = winbioenumbiometricunits(winbio_type_fingerprint,&unitschemaarray,&unitschemacount); if(failed(hr)) { cstring m; m.format(_t("unable enumarate device 0x%08x"),hr); afxmessagebox(m); return 0; } //enumaration success... unitidarray[0] = unitschemaarray[0].unitid; //opening session... hr = winbioopensession(winbio_type_fingerprin

nlp - Wapiti/CRF++ dataset format -

to on safe side , see fruits of hard work, features of data needs correctly formatted? i have dataset , template , manually tagged ner. as far training crf++ concerned, testing generated model yields 0% correct results. results same using wapiti. question, should template file modified? or imperative add pos tags in training dataset well. additionally, if model should discount word casing while labeling, should training dataset reflect in entirety, lower casing enforced. not affect sentences derive meaning uppercasing. bit unclear in respect. ps - targeting model like, http://cliff.mediameter.org/ , ner labeled irrespective of casing. can't use model. the training data small ( hardly 47 sentences ) , format incorrect because sentences end empty lines, yours end space-tab-space, might make crf++ learn whole file single sentence. try http://paste.ubuntu.com/24537692/ also, share test data?

NGinx: set localhost/project to project git folder -

i working on small website in free time. development, keep git repositories in ~/git. possible configurate nginx if go localhost/a or localhost/b, use ~/git/a , ~/git/b respectively? i using fedora , tried single repo, keep getting 404: /etc/nginx/nginx.conf user nginx; worker_processes auto; error_log /var/log/nginx/error.log; pid /run/nginx.pid; events { worker_connections 1024; } http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; server { li

java - MapReduce output file empty -

i have program prints avg of balance , counts number of customers.everything working fine until noticed part-r-0000 file empty.it strange because haven't changed in hadoop configuration.i post stacktrace of cmd below 17/04/14 14:21:31 info configuration.deprecation: session.id deprecated. instead, use dfs.metrics.session-id 17/04/14 14:21:31 info jvm.jvmmetrics: initializing jvm metrics processname=jobtracker, sessionid= 17/04/14 14:21:31 warn mapreduce.jobresourceuploader: hadoop command-line option parsing not performed. implement tool interface , execute application toolrunner remedy this. 17/04/14 14:21:31 info input.fileinputformat: total input paths process : 1 17/04/14 14:21:31 info mapreduce.jobsubmitter: number of splits:1 17/04/14 14:21:32 info mapreduce.jobsubmitter: submitting tokens job: job_local1656799721_0001 17/04/14 14:21:32 info mapreduce.job: url track job: http://localhost:8080/ 17/04/14 14:21:32 info mapreduce.job: running job: job_local1656799721_0001 1

c - Difference between two recursive algorithms to delete a binary search tree -

i have question these 2 algorithms: this works normally: node* deletetree(node* root) { if(root != null) { deletetree(root->left); deletetree(root->right); deallocatenode(root); } return root=null; } this nope: void deletetree(node* root) { if(root != null) { deletetree(root->left); deletetree(root->right); deallocatenode(root); } root=null; } why? need set root null node pointer after delete of bst not point memory not allocated. prefer second algorithm because recall of function more intuitive. theoretically, 2 algorithms equivalent if use second algorithm , try print bst, program goes in loop. when have node *root , assign node = null won't affect value in exterior. if want modify pointer value, you'll have pass double pointer. something like: void deletetree(node** root) { if(*root != null) { deletetree(&((*root)->left)); deletetree(&(

javascript - How to postmessage HTMLIFrameElement? -

i'm having issue passing htmliframeelement object parent site iframe (located on different domain) using postmessage method. this code tried: var frame = document.getelementbyid('myhtmliframeelement'); frame = json.parse(json.stringify(frame)); event.source.postmessage(frame, "*"); unfortunately, json.parse / json.stringify not seem right way of handling htmliframeelement object. can please advise how pass through htmliframeelement object correctly? parsing dom elements json not useful far know. since postmessage() part of window object, try using window object of frame, found under contentwindow property of iframe. so try like: var frame = document.getelementbyid('myhtmliframeelement'); frame.contentwindow.postmessage( "stuffyouwanttosendtotheiframe", '*' ); and in script inside iframe: window.addeventlistener('message', function( event ) { // handle message });

algorithm - sort numbers in php, -

hi using php learn algorithms, wanted convert psuedocode php, for = 1 n − 1 minval = a[i] minindex = j = n if (a[j] < minval) minval = a[j] minindex = j exchange a[i] , a[minindex] this corresponding code in php $a = array(1, 4, 2, 3, 70, 10, 7 ); $n = sizeof($a); ($i = 0; $i == $n - 1; $i++){ ($j = $i + 1; $j == $n; $j++){ if ($a[$i] > $a[$j]){ $temp = $a[$j]; $a[$j] = $a[$i]; $a[$i] = $temp; } } } print_r($a); print_r outputting array original order, why algorithms doents reorder array ? you should check for loops : for ($i = 0; $i == $n - 1; $i++){ ($j = $i + 1; $j == $n; $j++){ should for ($i = 0; $i < $n - 1; $i++){ ($j = $i + 1; $j < $n; $j++){ as second argument in for requirement continue loop.

Get Century from date in SQL server -

how can century year in date field using sql server query? as, example, period 1901 - 2000 20th century. century, if try left substring of 2 , add 1 year, how can implement year '2000'? is there function getting century date? i think want: select 1 + (year(date) - 1) / 100 century or alternatively: select (year(date) + 99) / 100 century

elasticsearch - Finding nested result of a certain parent -

i have following query works in giving me periods (nested) +houses belong have arrivaldate period specify. want try , arrivaldates house, cannot figure out syntax of how in elasticsearch. get /houses/house/_search { "_source" : ["houseid"], "query": { "nested": { "path": "periods", "query": { "bool": { "must": [ {"range": { "periods.arrivaldate": { "gte" : "2017-10-01", "lt" : "2017-11-01" } } } ] } }, "inner_hits" : {} } } } the mapping (shortened hope relevant parts) { "houses": { "mappings": { "house": { "properties": { "periods": { "type": "nested", "properties": { "ar

java - Spring Data Repositiories - add specific parameters to every query -

i have few repositories extend org.springframework.data.mongodb.repository.mongorepository . have added methods searching entities different parameters, however, in search, want search entities have active field set true (have opted marking active=false in place of deleting). example, 2 sample repositories this: interface xxrepository extends mongorepository<xx, string> { optional<xx> findonebynameignorecaseandactivetrue(string name) page<xx> findbyactivetrue(pageable pageable) xx findonebyidandactivetrue(string id) } interface yyrepository extends mongorepository<yy, string> { optional<yy> findonebyemailandactivetrue(string email) } is there way allow me not add byactivetrue \ andactivetrue each , every method , set somewhere in 1 place queries? please try this. no need provide implementation. change 'active' , 'email' db column name. interface yyrepository extends mongorepository<yy, string&

python - Where are key/value pairs for an object stored for a Built-in Class? -

where key/value data stored builtin class? not accessible "__dict__" because not considered attributes. example: class testnewclass(dict): def __init__(self, a, b, c): self.a = self.b = b self["item"] = c x = testnewclass(3, 4, 5) print(x.a) # 3 print(x.b) # 4 print(x["item"]) # 5 print(x.__dict__) # {"a": 3, "b": 4} c not considered attribute

Ansible SSH Error during ping -

i have problem ansible when ping have ssh error: for ping: 10.44.23.212 | failed ! => { "changed": false, "failed": true "module_stderr": connection 10.44.23.212 closed remote hosts. "module_stdout": "ssh command execution not supported", "msg": "module failure", "rc": 0 } i have put in hosts file ip, ansible_ssh_pass , ansible_ssh_user. but can ping , connect ssh prompt. try on switch hp procurve/arubaos , @ last want create auto backup of switch config. have try lot of things fix nothing works. someone know how fix ?

c - Reading data from a SPI register and storing into array -

Image
i'm trying write code spi slave device reads data miso line. here register map spi device. basically code looks @ status register , checks 2 conditions. is rrdy bit set? (which indicates there data in rx register) is roe bit not set? (which indicates recieve over-run error has not occured) if these conditions met put recieved char array buf . i sending device characters 'a', 'b' , 'c'. when recieved 'c' break loop , print out contents of `buf'. my question is, buf contains 'c', '0', '0'. is there wrong logic? char ibuf[32]; int chr; int ptr; while(1) { //keep checking //if rrdy set , roe not 1 if (((*spi_status_reg >> 7) & 1) && (!(*spi_status_reg >> 3) & 1)) { //macro read char rx register chr = iord_altera_avalon_spi_rxdata(spi_1_slave_base); ibuf[ptr] = chr; // store ptr ++; //if 'c' exit if(chr == 'c') {

c# - Is it good approach to use Singleton for Driver instance? -

please consider approach: public class driver { public static iwebdriver instance; public static ijavascriptexecutor ijavascriptexecutor; public static iwebdriver getinstance() { if (instance == null) { instance = new chromedriver(getgooglechromedriverpath()); ijavascriptexecutor = instance ijavascriptexecutor; } return instance; } static string getgooglechromedriverpath() { return path.getdirectoryname(assembly.getentryassembly().location); is approach use singleton driver instance ? edit: public sealed class driver { private driver() { } public static iwebdriver instance { { return nested.instance; } } private class nested { // explicit static constructor tell c# compiler // not mark type beforefieldinit static nested() { } internal static readonly iwebdriver instance = new chromedriver(getgooglechromedriverpath()); } s

javascript - How do I use an asynchronous value in a function that needs to return synchronously -

this question has answer here: how return response asynchronous call? 21 answers i feel i'm overlooking here, trying write function returns synchronous value, internally needs data can fetched async: // gets asynchronously const getvalueasync = promise.resolve('value') // needs return value synchronously const returnsyncvalue = () => { // needs async data here getvalueasync // modify // return result sync } // work: const value = returnsyncvalue() i'm using latest version of node. there way of achieving without changing returnsyncvalue's implementation (i.e. making async well)? short answer: no long answer: you can't because when const value = returnsyncvalue() , haven't gotten async value yet. therefore there no value assign.

matlab - DSP Adaptive filter for separate Heart and Respiratory sound -

i designing digital adaptive filter design separating heart , respiratory sound. theoretically heart sound frequency range 10 hz 200 hz , respiratory frequency range 100hz 5khz. there frequency overlapping wanted use adaptive filter. can 1 plz provide example matlab code adaptive filter. new matlab thanks in advance, ganesh

codenameone - Connecting to sql database -

(i sql noob , can not figure out on own) for time have been trying establish connection sql database in codename 1 no avail. first tried connecting mariadb database one.com. that's needed connection database db = display.getinstance().openorcreate("databasename"); if not mistaken, guessing implies have somehow established connection database. not case creates new .sql file, right? can recall can connect database in services tab in netbeans. chose mysql(connector/ j driver) should work mariadb, or should it? entered data , says can not establish connection database. the error get so thought might try using localhost. used xampp host database , connected in netbeans services tab. connected? now testing needed see if works. started sql journey https://www.codenameone.com/manual/files-storage-networking.html#_sql , integrated part after "you can integrate code app debugging tool". changed database name "mybase" (it's existance can co

c# - Multithreading doesn't work if I start more than 1 other thread -

Image
i don't know if problem unity-specific maybe other c# developers can me :) so trying implement own version of a* algorithm , improve performance want actual path finding every seeker multi threaded: it works pretty until moment activate second seeker: like can see stops after 15 iterations (varying depending on how many text outputs call -> guess threads getting killed after amount of time) in algorithm , first started thread gets kind of killed following. i using c# threadpool class thread management tried use thread class. same result. implementation of threading: public static void requestpath(pathrequest _request) { debug.log("queueing pathrequest..."); threadpool.queueuserworkitem(instance.startthreadedpathfinding, _request); } the called method: private void startthreadedpathfinding(object _stateinfo) { pathrequest request = (pathrequest)_stateinfo; m_pathfinder.findpath(request, onpathfound); } and findpath : public vo

sql - Percentage difference between numbers in two columns -

my sql experience minimal please go easy on me here. have table tblforex , i'm trying create query looks @ 1 particular column lastsalesratechangedate , forexrate . basically want query check lastsalesratechangedate , pull forexrate on same line (obviously in forexrate column), need check see if there +/- 5% change since last time lastsalesratechangedate changed. hope makes sense, tried explain possible. i believe need create 'subquery' @ lastsalesratechangedate , pull forex rate date, don't know how go this. i should add being done in access (sql) sample data, here table looks like: | basecur | forcur | forexrate | lastsalesratechangedate | usd | brl | 1.718 | 12/9/2008 | usd | brl | 1.65 | 11/8/2008 so need query @ lastsalesratechangedate column, check see if date has changed, if take forexrate value , give percentage difference of forexrate value since last record. so final result like "basecur" &q

testing - Rspec request specs and Rails 5 -

i'm starting new project, first rails 5.1.0. have pb first request spec. describe 'users', type: :request 'are created external data' json_string = file.read('path/to/test_data/user_data.json') params = { user: json.parse(json_string) } headers = { "content_type" => "application/json" } expect post '/api/v1/users', params.to_s, headers end.to change { user.count }.by(1) expect(response.status).to eq 200 end end this spec return error argumenterror: wrong number of arguments (given 3, expected 1) . official documentation don't much. if take out .to_s, , send hash, this: post '/api/v1/users', params, headers i got error: argumenterror: unknown keyword: user any thought? i think changed syntax recently. should use keyword args. so, this: post '/api/v1/users', params: params, headers: headers

PowerShell DSC Credential Decryption Error -

i have created pull server configuration. pull server, being used compile mof files , client both windows server 2016, updated azure image. i kept getting errors when passing in credentials. therefore wrote tiny custom dsc resource displays password clear txt when run start-dscconfiguration -wait -verbose you can find here: https://gist.github.com/aboersch/65e846a4966fe2c4708ed21d655a54a7 the client not correctly decrypt credentials. password receiving -----begin cms----- <long multi-line base64 string> -----end cms----- if pass unprotect-cmsmessage receive correct password. the certificate passes $ .privatekey.keyexchangealgorithm , $ .verify i have tried changing certificate provider to'"microsoft enhanced cryptographic provider v1.0"', '"legacy cryptographic service provider"', , '"microsoft rsa schannel cryptographic provider"'. i have tried xdscutils new-xselfsigneddscencryptioncertificate. if use sa

visual c++ - C++ why is my file truncating when I restart my program? -

i'm trying use code read file , store values in vector. works once , displays correctly. void songlist::loadsongsfromfile() { song temp; string line; ifstream myfile("songlistfile.txt"); while (getline(myfile, line)) { myfile >> temp.title; myfile >> temp.artist; myfile >> temp.genre; songs.push_back(temp); } } i want append file, using following: void songlist::addsong(song tmp) { cout << "enter title, artist genre of song, each on new line.\n"; cin >> tmp.title; cin >> tmp.artist; cin >> tmp.genre; songs.push_back(tmp); ofstream myfile("songlistfile.txt"); myfile.open("songlistfile.txt", ios::app); myfile << tmp.title << " " << tmp.artist << " " << tmp.genre; cout << tmp.title << " " << tmp.artist << " part of song

x509 - Wildcard X.509 Certificates -- Do they make sense in development environments -

i started working new company. engineering company focused on hardware. don't have lot of experience big data dev/test environments. company has extensive security policies. 1 of them "absolutely no wildcard certificates". have worked in other software shops wildcard certificates commonly used in dev , test environments. advantage can spin servers , use wildcard certificate without waiting accounting department issue purchase order ca. believe understand of security issues wildcards, if 1 subdomain compromised, subdomains compromised. if revoke certificate, subdomains revoked. wildcards may not compatible on "really old" browsers , servers. single private key floating around on several servers pose security risks. some ca's void warranties wildcard certificates. i not use wildcards production servers -- because of #4. however, cannot see above security issues problem dev , test environment. dev , test servers have internet facing ports

php - Everything in mysql is printing to only one cell in html table -

when print data mysql, going 1 cell in first row instead of being spread out through whole html table. i've included below of code i've written, problem in get_input.js , get_input.php files @ bottom of page. how can fix this? vocab_input.html <!doctype html> <html> <head> <title></title> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-bvyiisifek1dgmjrakycuhahrg32omucww7on3rydg4va+pmstsz/k68vbdejh4u" crossorigin="anonymous"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rhyon1irsvxv4nd

python - Import submodule functions into the parent namespace -

i have package of commonly used utility functions import tons of different projects, using different parts. i'm following patterns i've seen in numpy , doing things like: utils/ __init__.py ``` . import math . import plot ``` math/ __init__.py ``` . import core . core import * . import stats . stats import * __all__ = [] __all__.extend(core.__all__) __all__.extend(stats.__all__) ``` core.py ``` __all__ = ['cfunc1', 'cfunc2'] def cfunc1()... def cfunc2()... ``` stats.py ``` __all__ = ['sfunc1', 'sfunc2'] def sfunc1()... def sfunc2()... ``` plot/ __init__.py the nice thing structure can call submodule functions higher level namespaces, e.g.

mysql - Access denied for user 'admin'@'localhost' (using password: YES) -

i have error when try log in in localhost/phpmyadmin : mysqli_real_connect(): (hy000/1045): access denied user 'admin'@'localhost' (using password: yes) this phpmyadmin/config.inc $cfg['servers'][$i]['auth_type'] = 'cookie'; $cfg['servers'][$i]['user'] = 'admin'; $cfg['servers'][$i]['password'] = 'admin'; $cfg['servers'][$i]['extension'] = 'mysqli'; $cfg['servers'][$i]['allownopassword'] = true; $cfg['lang'] = ''; /* bind localhost ipv4 address , tcp */ $cfg['servers'][$i]['host'] = '127.0.0.1'; $cfg['servers'][$i]['connect_type'] = 'tcp'; /* user advanced features */ $cfg['servers'][$i]['controluser'] = 'pma'; $cfg['servers'][$i]['controlpass'] = ''; anyone can me?

angularjs - Ionic app crashes after a few days on iOS -

i'm having problem ionic app on iphone 6. have installed on device , works great after few days crashes when try open it, shows splash screen , after 1 or 2 seconds, crashes. happens on ios, android works properly. i think related usage of localstorage. use on controller.js @ beginning try user data. $scope.sessionuser = localstorage.getitem('user'); $scope.sessionusertype = localstorage.getitem('usertype'); these ionic info: cordova cli: 6.5.0 ionic framework version: 1.3.1 ionic cli version: 2.0.0 ionic app lib version: 2.0.0 ios-deploy version: not installed ios-sim version: not installed os: mac os x el capitan node version: v7.6.0 xcode version: xcode 8.3.1 build version 8e1000a

linux - Compute base64 encoded hash from a given hash? -

i created file , input random string it. touch tesseract && echo 'testtesttesttesttest' > tesseract now if use openssl compute base64 hash [ sha256 ], run this: cat tesseract | openssl dgst -sha256 | openssl base64 -a which returns me khn0zglukt0gmzjjyja1mtgzndnhzmy2n2flmmy5yzuwndcwngringe5njc5mziyzwvlntbmmjbintmznjzlytbimdy2mwnlzgo= now process hash stepwise, as, cat tesseract | openssl dgst -sha256 > partialhash which gives me (stdin)= 32cb0518343aff67ae2f9c504704db4a9679322eee50f20b53366ea0b0661cef let hash x . this, echo '32cb0518343aff67ae2f9c504704db4a9679322eee50f20b53366ea0b0661cef' > partialhash cat partialhash | openssl base64 -a i different result. why that? my reason asking because use binary, hashdeep gives me hashes in form of 32cb0518343aff67ae2f9c504704db4a9679322eee50f20b53366ea0b0661cef , wish convert them base64 encoded format hashdeep not capable of producing base64 output. pipe intermediate hash

sql server - T-SQL Custom Data Type as input parameter for stored procedure -

i'm quite new t-sql, i'm struggling input parameter stored procedure. i want pass list of salesareas stored procedure. salesarea can have several countryids , bool values, imagine class in c#. i started create own data type pass stored procedure: create type tidlist table ( id int null ); go create type tsalesarea table ( countryids tidlist null, islargeclient bit null, issmallclient bit null, ); go in stored procedure want pass in list of tsalesareas : @salesareas tsalesarea readonly the problem: cannot use tidlist datatype tsalesarea . if insert 2 sales areas (1: countryids 3,5; 2: countryid 7), this: id | salesareaid | countryid ---+-------------+----------- 1 | 1 | 3 2 | 1 | 5 3 | 2 | 7 do know how solve issue? thanks! you can not use table type column (it table type) in sql server. instead, create tsalesarea columns needed express desired input. create type tsalesarea t

javascript - Getting facebook feed -

is there way facebook user's feed without special facebook permission? used have opportunity through api. unfortunately, no longer can use it. as of october 6th, 2015, endpoint no longer available. i tried posts, using phantomjs. takes lot of time , kinda "weird" solution. you can user timeline /me/posts , user_posts permission, there no way feed anymore. scraping not allowed, using phantomjs out of question.

Angular 2 building single modules -

Image
i know how build out project angular cli: ng build --prod how can compile each module separately? project: anagaccreditamento , cruscottofiliera separate modules, module.ts , routing.module.ts file. how can build them separately , insert them project @ later time if libraries? if want able pull in modules needed, want lazy loading. can find out how use lazy loading here: https://angular.io/docs/ts/latest/guide/router.html#!#asynchronous-routing or there pluralsight course here: https://app.pluralsight.com/library/courses/angular-routing/table-of-contents

php - insert into a database not working -

i having issue in inserting table. connection file correct , coming header.php. there no errors when go within table no records being inserted. <?php include('header2.php'); if(isset($_post['done'])) { $title = $_post['title']; $description = $_post['description']; $link = $_post['link']; $company = $_post['company']; $sql = "insert placements (title, description, link, company) values ('$title', '$description', '$link','$company')"; // use exec() because no results returned echo "new record created successfully"; } ?> <html> <head> <title> add placement </title> </head> <body> <form method="post"> <input type="text" name="title" placeholder="title"> <input type="text" name="description" placeholder="description&

Transcoding with custom commands using streamio-ffmpeg -

i'm trying transcode video file using streamio-ffmpeg custom commands, nothing try seems work. want transcode video following options: ffmpeg -i input.mp4 -vf "format=yuv444p, drawbox=y=ih/phi:color=0x000000@0.4:width=iw:height=48:t=max, drawtext=font='opensans-regular,sans':text='custom text':fontcolor=0xffffff:fontsize=24:x=(w-tw)/2:y=(h/phi)+th, format=yuv420p" -c:v libx264 -c:a copy -movflags +faststart output.mp4 i've tried following code combinations without success: tried removing line breaks , converting command string array, following instructions in docs . video = ffmpeg::movie.new('input.mp4') opts = %w(ffmpeg -i input.mp4 -vf "format=yuv444p, drawbox=y=ih/phi:color=0x000000@0.4:width=iw:height=48:t=max, drawtext=font='opensans-regular,sans':text='custom text':fontcolor=0xffffff:fontsize=24:x=(w-tw)/2:y=(h/phi)+th, format=yuv420p" -c:v libx264 -c:a copy -movflags +faststart o

sqlite3 “OperationalError: near ”)“: syntax error” python -

this function supposed check ingredient user entered following prompt. when try query statement in sqlite (without user input of course) works. in python says there error! def checkingredient(): usringredient = input("\nenter ingredient make drink with: \n\n") query = c.execute("select drdesc drinks drdrid in " "(select dtdrid detail ingid =" "(select ingid ingredients indesc like))", (usringredient,)) resultset = c.fetchall() result in resultset: if resultset not none: print(result) else: print("sorry, there no drinks ingredient") you haven't included sql parameter placeholder in query. you'll have place ? in query each value want interpolate: query = c.execute(""" select drdesc drinks drdrid in (select dtdrid detail ingid = (select ingid ingredients indesc ?)) """, (usringredient,))

java - Forwarding data from one client to another using server -

i creating android application uses wifi direct transfer data. able send data client server. want send data 1 client client through server. let suppose there 2 clients , c , server b. want send data c through b. there possible way achieve task. 1 thing had heard forward data input stream of 1 socket ouput stream of another. can please me out this. ` protected string doinbackground(void... params) { try { serversocket serversocket = new serversocket(8988); log.d(wifidirectactivity.tag, "server: socket opened"); socket client = serversocket.accept(); log.d(wifidirectactivity.tag, "server: connection done"); final file f = new file(environment.getexternalstoragedirectory() + "/" + context.getpackagename() + "/wifip2pshared-" + system.currenttimemillis() + ".jpg"); file dirs = ne

python - How to do calculations using text files and save the sum on the same text file -

i want calculations using text files , user input, want ask user number minus, want number text file used , minus number user gives , save sum in same text file original number was. problem don't know how this, example have number 13 on text file, user enters 4 sum 9, want 9 saved in same text file number 13 don't know how this. tried using file.write function no success. i not quite sure how compare values of text file in if/else statement or while statements. this have done far, apologize might not make sense, need work want work. number = int(input('please enter number minus')) d = open("numberfile.txt","r+") d.write(int(d.read()) - int(number)) d.close() whenever run says write argument must in str not int, when change str says operation - not supported. you should open files with since handles outmatic file closing etc. you should try if input of user , of input file convertable int . import sys input = inp

Which gcc pass optimizes the value of variables away -

when compiling gcc optimization. values of variables optimized out. know gcc pass optimizes variables value out, can disable such pass keep variables unoptimized? thanks. your question quite vague, should take @ flags such -fssa-backprop . according gcc documentation : propagate information uses of value definition chain in order simplify definitions. example, pass strips sign operations if sign of value never matters. this optimisation turned on @ level -o1 (and higher levels of optimisation well).

go - Encryption of AES(128/ECB/PKCS5)+Base64(RFC 1521) in Java and decryption in Golang -

the encryption in java importing javax.crypto.cipher, sun.misc.base64decoder, sun.misc.base64encoder , javax/crypto/secretkey. i did lot research on algorithms understand specific standards make sure every step same in java , golang. since cannot decrypt encrypted data java, trying see difference encrypting in golang , in java see difference. encrypted outputs golang , java different w/ same format(24 digits "==" at end). inputs: key: t3-arghbegrgg455dfer4g== text: 123456789012345 output: golang: 07vl02wwi8dapjyi161trq== java: b9e8aocd+fyqbkkbqcs3la== please find out reason behind difference! thanks! the java code using cipher cipher = cipher.getinstance("aes"); cipher.init(cipher.encrypt_mode, secretkey); byte[] stringbytes = message.getbytes("utf8"); byte[] raw = cipher.dofinal(stringbytes); base64encoder encoder = new base64encoder(); string base64 = encoder.encode(raw); return base64; in golang block, er

php - sending mail in Laravel 5.4 using Mailgun get error code " 401 UNAUTHORIZED` response: Forbidden " -

i'm trying send mail in laravel 5.4 project mailgun. think set configuration correctly. but, got error message such clientexception in requestexception.php line 111: client error: post https://api.mailgun.net/v3/sandboxfeb88d58f18841738b2fc81d7cbc7631.mailgun.org/messages.mime >resulted in 401 unauthorized response: forbidden here configuration: in .env file mail_driver=mailgun mailgun_domain=sandboxfeb88d58f18841738b2fc81d7cbc7631.mailgun.org mailgun_secret=pubkey-1767e********** in mail.php file 'driver' => env('mail_driver', 'smtp'), 'host' => env('mail_host', 'smtp.mailgun.org'), 'port' => env('mail_port', 587), 'from' => [ 'address' => env('mail_from_address', 'richi.htoo@gmail.com'), 'name' => env('mail_from_name', 'richi htoo'), ], in services.php file 'mailgun' => [ 'domain'

mysql - php-cli error when using full path -

i'm using php 5.6 on ubuntu when run command php /var/www/html/export-sftp-bg.php get php fatal error: uncaught exception 'exception' message 'file doesn't exist' in /var/www/html/inc/vendor/faisalman/simple-excel-php/src/simpleexcel/parser/baseparser.php:174 stack trace: 0 /var/www/html/inc/vendor/faisalman/simple-excel-php/src/simpleexcel/parser/csvparser.php(38): simpleexcel\parser\baseparser->isfileready(false) 1 /var/www/html/inc/functions.php(1448): simpleexcel\parser\csvparser->loadfile(false) 2 /var/www/html/export-sftp-bg.php(10): export_existing_campaign('yml=', object(simpleexcel\simpleexcel), object(notorm), '/var/www/html/e...') 3 {main} thrown in /var/www/html/inc/vendor/faisalman/simple-excel-php/src/simpleexcel/parser/baseparser.php on line 174 but i'm able run file using cd /var/www/html php export-sftp-bg.php try this sudo -u www-data php /var/www/html/export-sftp-

python - Add multiple columns to DataFrame and set them equal to an existing column -

i want add multiple columns pandas dataframe , set them equal existing column. there simple way of doing this? in r do: df <- data.frame(a=1:5) df[c('b','c')] <- df$a df b c 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 5 5 5 5 in pandas results in keyerror: "['b' 'c'] not in index" : df = pd.dataframe({'a': np.arange(1,6)}) df[['b','c']] = df.a you can use .assign() method: in [31]: df.assign(b=df['a'], c=df['a']) out[31]: b c 0 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 5 5 5 or little bit more creative approach: in [41]: cols = list('bcdefg') in [42]: df.assign(**{col:df['a'] col in cols}) out[42]: b c d e f g 0 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 another solution: in [60]: pd.dataframe(np.repeat(df.values, len(cols)+1, axis=1), columns=['a']+cols) out[60]:

c# - How to give collapse and expand effect to panel on click event -

dear have multiple asp panel inside web page set visible=false on page load , gets open when particular linkbutton clicked works fine, want give slow motion effects or collapse , expand effect accordingly. can share experience please. protected void linkbutton3_click(object sender, eventargs e) { pnlwall.visible = true; pnlsharehome.visible = false; } you can use jquery show , hide panels (which <div>'s in html). has sliding possibilities , saves round trip server. <asp:panel id="panel1" runat="server" style="display: none;"> content </asp:panel> <input type="button" value="slide panel" onclick="slidepanel('<%= panel1.clientid %>')" /> <script type="text/javascript"> function slidepanel(div) { if ($('#' + div).css('display') == 'none') { $('#' + div).slidedown('medium', funct

Defined global variables with 3 php pages -

just strange thing have 3 pages in php define global variables define() uploaded in xampp server. the main page has required pages // defined password , username costants; require_once('config.php'); // defined other new constants , use password , username constant. require_once('http_post.php'); config.php , http_post.php has no reference (required) each others. i asking myself how http_post can take password , username defined in config.php without reference, in 1 xampp installation works all, htt_post.php can retrieve username , password variable (localhost) config when upload server xampp (no more localhost me) http_post.php cannot see username , password in config.php. how possible? changed? particular behaviour of localhost? 2 php pages referred main page in way connected? thx lot use localstorage or cookies. in php can have use this: echo "<script>localstorage.username = " . $username . "</script>"

c - Scanning data into a multidimensional array -

i given data file included mass , (x,y,z) position of point. want take data given , output file using multidimensional array. don't know how take scanned data , use in array, however. i have data stored follows: for(i = 0; < n; i++) //scan in file data { fscanf(fpin, "%d %d %d %d", &array_x[i], &array_y[i], &array_z[i], &array_mass[i]); } i tried setting array [][4] since number of rows dependent on number of data points given (and instructions write array work number of data points, not given) , there 4 columns (one x, y, z, , mass respectively). then tried setting as: for(i = 0; < n; i++) { array_out[i][4] = { {array_x[i]}, {array_y[i]}, {array_z[i]}, {array_mass[i]} }; } and printing as: for(i = 0; < n; i++) for(j = 0; j < n; j++) fprintf(fpout, "%d %d %d %d", array[i][j]); but doesn't work. do know how many elements need read? if do, can allocate array hold them. if not n