Posts

Showing posts from April, 2014

angularjs - systemjs-builder: Angular 2 Component Relative Paths cause 404 errors -

this cross post https://github.com/systemjs/builder/issues/611 i'm trying bundle angular 2 rc 1 app systemjs-builder 0.15.16 buildstatic method. angular component has view 1 or more stylesheets external script. referred within @component metadata in one of 2 ways using absolute paths: @component({ templateurl: 'app/some.component.html', styleurls: ['app/some.component.css'] }) using recommended relative paths: @component({ moduleid: module.id, templateurl: 'some.component.html', styleurls: ['some.component.css'] }) my app uses relative paths, , things have been working fine. today decided use systemjs-builder's buildstatic . resulting file throws 404 errors whenever there relative path because browser fetching localhost/some.component.html instead of localhost/app/some.component.html . below relevant part of gulpfile.js var appdev = 'dev/'; var appprod = 'app/'; var typescript = require('gu

asp.net - unable to load application or execute command 'Microsoft.AspNet.Server.Kestrel' Publish website on Windows Server -

i getting following error while running publish asp.net core rc1 website on windows server using web.cmd, unable load application or execute command 'microsoft.aspnet.server.kestrel' the publish website has runtime included. here project.json file, { "version": "1.0.0-*", "compilationoptions": { "emitentrypoint": true }, "dependencies": { "docx": "1.0.0.19", "entityframework": "6.1.3", "entityframework.core": "7.0.0-rc1-final", "itextsharp": "5.5.9", "itextsharp.pdfa": "5.5.9", "itextsharp.xtra": "5.5.8", "microsoft.aspnet.iisplatformhandler": "1.0.0-rc1-final", "microsoft.aspnet.mvc": "6.0.0-rc1-final", "microsoft.aspnet.mvc.webapicompatshim": "6.0.0-rc1-final", "microsoft.aspnet.ser

How to replace specific data (letters or number) by another data (letters if number) in a data frame in R -

i have data frame looks markers on rows , individuals g1:g5 marker g1 g2 g3 g4 g5 p39 gg gg aa aa aa p40 gg aa aa aa tt p41 aa aa cc tt aa p23 tt tt aa aa tt p35 aa aa aa cc aa i replace unique calls data frame as aa=1, tt=2, gg=3, cc=4 and save dataframe csv does have solution problem many i might misunderstanding want; it? dt <- data.frame(marker = c('p39', 'p40', 'p41', 'p2370', 'p350'), g1 = c('gg', 'gg', 'aa', 'tt', 'aa'), g2 = c('gg', 'aa', 'aa', 'tt', 'aa'), g3 = c('aa', 'aa', 'cc', 'aa', 'aa'), g4 = c('aa', 'aa', 'tt', 'aa', 'cc'), g5 = c('aa', 'tt', 'aa', 'tt', 'aa'), stringsasfactors = false) dt[dt == 'aa

python - Replacing complex-valued arguments of generic function object by two real-valued arguments -

curve fitting tools such in scipy tend assume parameters of model functions real-valued. when fitting model depends on complex-valued parameters complex-valued data set, 1 therefore first has create version of model, in each complex parameter replaced 2 real ones. first, simple example: # original function, representing model a,b may complex-valued def f(x, a, b): return a+b*x # modified function, complex parameters have been replaced 2 real ones def f_r(x, a_r, a_i, b_r, b_i): return f(x, a_r + 1j*a_i, b_r+1j*b_i) print( f(1,2+3j,4+5j) == f_r(1,2,3,4,5) ) note: output of model still complex-valued, can taken care of appropriately defining residual function. now, instead of having write new code every function f , have "function factory" pass function object f list of booleans is_complex specifying arguments of f assumed complex-valued (and therefore need replaced 2 real-valued arguments). list of booleans e.g. inferred initial values provided f .

forms - Wordpress Users Request to Retrieve Username by email address -

the users need ability retrieve username entering email address. need form user submits email. can point me sample of or plugin need? get_userdata() returns wp_user object information pertaining user id passed it. - http://codex.wordpress.org/function_reference/get_userdata $user_info = get_userdata(1); echo 'username: ' . $user_info->user_login . "\n"; echo 'user level: ' . $user_info->user_level . "\n"; echo 'user id: ' . $user_info->id . "\n"; so create form utilizes above code grab need. if can give more info such if user wil logged in or not, logged in user's username, or can username email address questions i'd have. gluck.

amazon web services - Multiple wordpress installations on 1 AWS EC2 instance -

i want have several wordpresssites on 1 ec2 instance , folled tutorial: running multiple sites on ec2 instance so far, good, looks, works pretty fine, have folder: /var/www/vhosts/webillusions.it i tried put index.html file /var/www/vhosts/webillusions.it, if want test in browser my-public-ip/vhosts/webillusions.it says, "the requested url /vhosts/webillusions.it not found on server." in html folder works charme, why not vhosts folder? i've created in html folder folder called website , can access my-public-ip/website, perhaps need configure php.ini standard html folder, isn't described in tutorial , totally newbie, appreciated. thx

javascript - How can I play audio elements in sync with key presses? -

html <textarea id="words" name="words"></textarea> <audio id="type" src="type.mp3"></audio> js document.getelementbyid('words').onkeydown = function(){ document.getelementbyid('type').play(); } i want make type.mp3 play anytime press key. but, not played in sync key. i looking pure js solution. the audio media element depends on buffering mechanism of browser , may not play instantly when play called. to play sounds in sync key-presses have use web audio api instead allows play in-memory buffer , therefor instantly. here example of how can load , trigger sound: window.audiocontext = window.audiocontext || window.webkitaudiocontext; var request = new xmlhttprequest(), url = "https://dl.dropboxusercontent.com/s/8fp1hnkwp215gfs/chirp.wav", actx = new audiocontext(), abuffer; // load file via xhr request.open("get", url, true); re

objective c - Regular Expressions in ios(a word a letter and special characters) -

Image
in below method, want check uitextfield text if: contains 1 or more english words, , 1 or more numbers , let optionally contains special characters(!@$&#) return true, else return false. #define pattern @"^[a-za-z0-9\\u0021\\u0040\\u0023\\u0024\\u0026]{1}*$" - (bool)stringhascorrectformat:(nsstring *)str { if ([str componentsseparatedbystring:space].count > 1) return no; nsstring *regularpattern = empty_string; regularpattern = [regularpattern stringbyappendingstring:pattern] nsregularexpression *regex = [nsregularexpression regularexpressionwithpattern:regularpattern options:nsregularexpressioncaseinsensitive error:nil]; nstextcheckingresult *match = [regex firstmatchinstring:str options:0 range:nsmakerange(0, [str length])]; if

php - How to "hack" GNU screen to be able of being executed without a tty? -

i need able of running gnu screen using php since panel works php . if there's isn't way, there alternative allows me send commands screen? like @ screen: screen -s 9274 -p 0 -x stuff '(command here)'\015 ? thanks. you can use nohup command designed such operations: nohup - run command immune hangups, output non-tty you can start screen in detached mode -d -m parameters: -d -m start screen in "detached" mode. creates new session doesn't attach it. useful system startup scripts.

java - How to make GUI work in web browser? -

i writing program school final project. wrote whole project frames, find out needs applet. tried converting not work. source code: import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.arraylist; import java.applet.applet; public class alteredbattleship extends applet implements actionlistener{ int ro;//holds row input int co;//holds column input int[][] shots=new int[10][10];//holds shots taken boolean displaylose=false;//boolean triggers if game lost boolean displaywin=false;//boolean triggers if game won //the next 6 variables hold how many parts of ships haven't been hit int two=2; int three=3; int four=4; int threetwo=3; int five=5; //boolean triggers if boat sunk boolean twosunk=false; boolean threesunk=false; boolean threetwosunk=false; boolean foursunk=false; boolean fivesunk=false; //holds difficulty boolean b=true; boolean n=false; boolean e=false; arraylist<integer> misses= new arrayli

Video timecode using RTMP / AVCONV (ffmpeg) / NGINX -

to insert time code in video use avconv -y -i in.mp4 -vf "drawtext=fontfile=/usr/share/fonts/truetype/droidsans.ttf: fontsize=22: timecode='00\:00\:00\:00': r=25: x=(w-tw)/2: y=h-(2*lh): fontcolor=white: box=1: boxcolor=black@0.5" -an -y out.mp4 when reading video ffplay out.mp4 everything ok when using pipe feed rtmp server , reading stream ffplay time code won't display. due flv conversion ? for example streaming raspberry pi camera /opt/vc/bin/raspivid -n -hf -vf -fl -mm matrix -w 800 -h 600 -fps 25 -g 80 -t 0 -b 6000000 -o - | avconv -re -i - -nostats -c copy -vf "drawtext= ..... -f flv rtmp://myserver/cam/live doesn't output timecode.

ember.js - How to use ember-power-select in {{#each}} block -

i generating ember-power-select box using {{#each}} block in hbs template shown in code below. {{#each hps |hp|}} {{#power-select search=(action "searchrepo") selected=selected onchange=(action (mut selected)) |repo| }} {{repo.name}} {{/power-select}} {{/each}} the above code generates 2 select boxes. when select value in first box,the same value gets replicated in second box too. what way differentiate 2 select boxes? this works me // controller roles: ['project manager', 'tech lead', 'member'], <ul> {{#each user.projectroles |projectrole|}} <li> <label>{{projectrole.project}}</label> {{#power-select selected=projectrole.role options=roles onchange=(action (mut projectrole.role)) |role|}} {{role}} {{/power-select}} </li> {{/each}} </ul>

mysql - Transaction or variable declaration error -

i started learning transactions , stored procedures , i'm trying myself familiar different ways of assigning values result set variables. what causing error on declare var_curcid int default 0; here's i've done far. create definer=`root`@`localhost` procedure `addcurriculumwithschoolyear`(in p_subjectname varchar(50), in p_yrlevel varchar(30), in p_desc text, in p_creator varchar(20)) begin declare haserror bool default 0; declare continue handler sqlexception set haserror = 1; declare var_curcid int default 0; declare var_systart int default 0; declare var_syend int default 0; start transaction; -- 1 insert statement curriculum table insert curriculum(`name`,`yearlevel`,`description`,`creator`) values(p_subjectname,p_yrlevel,p_desc,p_creator); -- 2 insert statement schoolyearcurriculum table insert schoolyearcurriculums(curriculumid,systart,syend) values(var_curcid,v

Setup a PHP/Laravel 5 project with Bootstrap SB Admin 2 in Microsoft Azure -

Image
my plan make lavarel project using bootstrap sb admin 2 template. in order tweak azure, used tutorial . instead of bitbucket used github. in azure web app, installed composer extension. kudu console installed bower , gulp d:\home\site>npm install bower npm warn enoent enoent: no such file or directory, open 'd:\home\site\package.json' npm warn site no description npm warn site no repository field. npm warn site no readme data npm warn site no license field. d:\home\site>npm install gulp npm warn deprecated graceful-fs@3.0.8: graceful-fs v3.0.0 , before fail on node releases >= v7.0. please update graceful-fs@^4.0.0 possible. use 'npm ls graceful-fs' find in tree. npm warn deprecated lodash@1.0.2: lodash@<3.0.0 no longer maintained. upgrade lodash@^4.0.0. npm warn deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 , before fail on node releases >= v7.0. please update graceful-fs@^4.0.0 possible. use 'npm ls graceful-fs' find in tree.

algorithm - Generate pairs having the same attributes from list -

assume have list of items, each set of attributes. what efficient algorithm generating pairs list having same attributes? for example, given list: [('item1', {'a','b'}), ('item2', {'a'}), ('item3', {'c','b'}), ('item4', {'b'})] we should return following list of 4 pairs, out of total possible six: ('item1', 'item2') # both have attribute 'a' ('item1', 'item3') # both have attribute 'b' ('item1', 'item4') # both have attribute 'b' ('item3', 'item4') # both have attribute 'b' now, trivial approach first generate list of possible n(n+1)/2 pairs, , filter out without similar attributes, suspect approach inefficient, if number of pairs large. any suggestions? i suggest 2 phase algorithm: arr = [('item1', {'a','b'}), ('item2', {'a'}), ('item3'

c# - WPF MVVM: Replace control with minimum changes -

this going first project wpf , it's quite big. more concerned design (not presentation) aspect here. might necessary replace control in future should done minimum , centralized changes. examples: - i use standard button control @ 100 places in project. tomorrow, may need modify buttons in project display fixed image in center , border red , append text "trial" actual text of each button. styles serve purpose in cases here not time. i use standard grid view today find not fulfill requirements , decide use other/third party control. in above (and may other) cases, should easy replace control @ 1 place in project , should take effect @ locations in entire project. @ least, changes should minimum. i read usercontrol , custom control, both not serve purpose @ least in little understanding. question: - practice design application in way? or overthinking? if yes, way achieve in wpf? you're overthinking, button in wpf not in winform, not "a squa

Running a .net 4.0 application under a 2.0 site in IIS -

i have iis "site" set app pool uses .net 2.0. have added .net "application" site requires .net 4.0. i set app pool specific site use .net 4.0 when 500 error error code: 0x800700c1 can this? or trying impossible? notes: wanted refrain changing app pool of whole iis site use .net 4.0 because there lot of code tested if do. can't add separate site entirely because run cross origin issues. update: if set both app pool under .net 4 same error. have use same app pool both site , sub-app. feel should not requirement. i changed enable 32-bit applications true application pool .net 4 sub-app , worked while keeping parent site app pool of .net 2. haven't tested it, far works.

Transparent bottom sheet layout in Android -

i trying make transparent bottom sheet layout, allow me see contents of view below it. bottom sheet working expected, when set background either @null or @android:color/transparent , layout's view white, opposed transparent. layout follows: app_bar_main.xml: <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/coordinatorlayout" android:background="@android:color/transparent" android:fitssystemwindows="true" tools:context=".core.activities.mainactivity"> <!-- stuff here --> <linearlayout android:id="@+id/bottom_sheet" android:layout_width="match_parent"

Nested recursive function in python -

i tried implement nested recursive function in python giving error "runtimeerror: maximum recursion depth exceeded" can see function in following code. regarding question appreciated. n=10 def test(n): if n<=0: return 1 else: return test(test(n-1)+1) print test(n) one important part of recursion every recursive call have closer anchor case, in case is: if n<=0: return 1 however, code not getting close case. problem line: return test(test(n-1)+1) since test returns 1 when reaches end case , add 1 result, let's see happens when call test(2) : the anchor case isn't executed , go straight else . return test(test(1)+1) since 2-1=1 . inner test call going go else case , call: test(test(0)+1) here inner test call returns 1 (it has reached end case) means in line calling test(2) //test(1+1) again. here can see recursion never ending, hence maximum recursion depth exceeded error . just clarify how ma

javascript - Infinite scroll with photoswipe -

i use infinite scroll imagesloaded , isotope , photoswipe photo gallery. when click on button "more photos" loads next photos. don't know how declare new photos photoswipe cause way it, when click on photo (of new ones), open one . i got function declare photos photoswipe , function executed twice : first time @ dom load, second time when load next photos : // photoswipe declaration new_photos_lightbox(); function new_photos_lightbox() { $('.gal-photos>ul').each( function() { var $pic = $(this), getitems = function() { var items = []; $pic.find('a').each(function() { var $href = $(this).attr('href'), $size = $(this).data('size').split('x'), $width = $size[0], $height = $size[1]; var item = { src : $href,

javascript - More efficient way to wait for all images to load in jQuery -

i'm using mix of .ready() , .load() execute desired function. jquery(document).ready(function($) { $("img").load(function() { // function goes here }); }); as can see, waits dom ready, on each <img> load, executes code. if had 1 image load simple. but problem -- if have 10 images loaded? function called 10 times due each image loading 1 one, , that's not efficient way go achieve want. so here's question -- there more efficient way wait images load, execute function once ? you avoid having function run multiple times. jquery(document).ready(function($) { var nrofimages = $("img").length; $("img").load(function() { if(--nrofimages == 0) { // function goes here } }); });

ssh2 connection to linux over php -

i try update minecraft whitelist on php linux server. connection works dont know why didnt send command add user whitelist. here code: $name=$_post['name']; $mc=$_post['mc']; if($ssh = ssh2_connect('127.0.0.1', 22)) { if(ssh2_auth_password($ssh, 'root', 'password')) { $stream = ssh2_exec($ssh, 'screen -r '.$mc.' && '.'whitelist add '.$name.' && whitelist reload'); stream_set_blocking($stream, true); $data = ''; while($buffer = fread($stream, 4096)) { $data .= $buffer; } fclose($stream); echo $data; } } you joining commands && , of them executed 1 after in current shell, not inside screen. screen can execute commands inside selected session, it's own syntax. see this question , example, or manual . in case, command must this: screen -s session_name -x stuff $'whitelist add user_name && whitelist reload\n' n

java - cvc-complex-type.2.4.a invalid content was found starting with element factory in faces-config.xml -

i have error in eclipse project, imported netbeans project, set maven , project facet dynamic web project ( cdi1.1, java 1.8, js 1.0, jsf 2.2, jax-rs 2.0, jboss maven integration 1.0 , jpa 2.1) <?xml version='1.0' encoding='utf-8'?> <faces-config version="2.2" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"> <application> <locale-config> <default-locale>en</default-locale> <supported-locale>fr</supported-locale> </locale-config> <resource-bundle> <base-name>messages</base-name> <var>messages</var> </resource-bundle> <factory>

javascript - Bootstrap Scroll Spy not working.Shows only the home state active but doesnt change to other states when scrolled down -

this html , css.please me scrollspy dont know problem .if possible let me know code have written solve problem my html: <nav class="navbar navbar-default center navbar-fixed-top" id="navbar"> <button class="navbar-toggler hidden-sm-up"type="button" data-toggle="collapse" data-target="#excollapsingnavbar2">&#9776;</button> <div class="collapse navbar-toggleable-xs" id="excollapsingnavbar2"> <a class="navbar-brand" href="#"></a> <div class="navbar-inner"> <ul class="nav navbar-nav"> <li class="nav-item active"> <a class="nav-link" data-target="#jumbotron">home <span class="sr-only">(current)</span></a> </li> <li class="nav-item"> <a class="nav-l

python - Indentation preserving formatting of multiline strings -

i generate bits of (c++) code using format strings such as memfn_declaration = '''\ {doc} {static}auto {fun}({formals}){const} -> {result}; ''' format strings nice this, there way make them keep indentation level {doc} here? it's typically multiline. i know can indent string corresponding doc 2 spaces, know there plenty of functions end, that's not i'm asking: i'm looking work without tweaking strings pass. now you've posted own answer , clarified @ little more want. think better implement defining own str subclass extends way strings can formatted supporting new conversion type, 'i' , must followed decimal number representing level of indentation desired. here's implementation works in both python 2 & 3: import re textwrap import dedent try: textwrap import indent except importerror: def indent(s, prefix): return prefix + prefix.join(s.splitlines(true)) class indentable(s

hiveql - HIVE : Not in clause -

is there way execute following sql query in hiveql? select * my_table (a,b,c) not in (x,y,z) where a,b,c correspond respectively x,y,z thanks:) you'll have break these down separate conditions: select * my_table != x , b != y , c != z

vb.net - Blocking more folders and applications -

as can see here block directory called "cleo". if have in folder can't click connect. how can check if, example, "cleo", "images", "logs" exist in browsed file. don't think making multiple if statements good, there other way? private sub connect_click(byval sender system.object, byval e system.eventargs) handles connect.click dim cleopath string dim filepath string filepath = system.io.path.combine(textbox2.text, "gta_sa.exe") cleopath = system.io.path.combine(textbox2.text, "cleo") if file.exists(filepath) if directory.exists(cleopath) msgbox("pronasli smo cleo fajl u vasem gta root folderu. da se konektujete na server morate ga obrisati.") else dim p() process p = process.getprocessesbyname("samp") if p.count > 0 msgbox("vec imate po

visual studio 2015 - DEP6701: The system cannot find the path specified 'Bin\ARM\dbghelp.dll While deploying UWP app to Win10 mobile -

Image
how started everything working fine. yesterday, installed xamarin in visual studio 2015 , while installation took in latest updates. , on started facing errors. error dep6701 : bootstrapping failed unexpected error: 'the system cannot find path specified 'bin\arm\dbghelp.dll'.'. what tried i downloaded windows 10 sdk , installer folder ran following .msi files sdk debuggers-x86_en-us.msi x64 debuggers , tools-x64_en-us.msi x86 debuggers , tools-x86_en-us.msi also have tried solve making 'arm' directory , putting 'dbghelp.dll' inside bin directory of project. but none of above helped. please note i using windows 10 mobile. developer mode on on phone. additionally have turned radio buttons related usb , network discovery. project universal app apache cordova. ipoverusbsvc running on pc. my vs 2015 config anyone knows how solve it? thank you. i ran project on side , started process monitor tool check

c++ - OpenCV IOS Swift 2 :How to implement the CvVideoCameraDelegate protocol process Video Frames -

okay i've been using opencv , want use ios swift 2.0... implemented , tested few functions/examples, worked fine! application in thought have live camera object detection. using cascade classifier this, thing have trouble setting cvvideocameradelegate protocol viewcontroller; i'm trying use tutrial/example set up.... i'm having trouble trying set in swift.... can please advise correct way set up? the tutorial referencing how in objective-c. doing in swift little trickier. need set objective-c class camera's delegate, , swift code have communicate cvvideocamera object via objective-c class , possibly other helper objective-c classes. please see question/answer: video processing opencv in ios swift project

how to parallel this for loop? -

i trying learn openmp , trying run second loop in parallel adding "#pragma omp parallel for",but not working suggestions? if (hi - lo > 3) { ( = hi-4; >= lo; i-- ) { tmp = fmap[i]; ec_tmp = eclass[tmp]; #pragma omp parallel ( j = i+4; j <= hi && ec_tmp > eclass[fmap[j]]; j += 4 ) fmap[j-4] = fmap[j]; fmap[j-4] = tmp; } }

javascript - How to use webkitRequestFileSystem at file: protocol -

according exploring filesystem apis at browser support & storage limitations you may need --allow-file-access-from-files flag if you're debugging app file:// . not using these flags result in security_err or quota_exceeded_err fileerror. launched chromium --allow-file-access-from-files , --unlimited-storage , possibly deprecated --unlimited-quota-for-files ; --unsafely-treat-insecure-origin-as-secure=file:///path/to/directory/* --user-data-dir=/path/to/directory set. interestingly, when chromium opens notification displayed you using unsupported command-line flag: --unsafely-treat-insecure-origin-as-secure . stability , security suffer. there other flags not specified can used; ignored notification still able set , localstorage @ file: protocol, spcecifically files @ file:///path/to/directory/* , though navigator.webkittemporarystorage.requestquota(1024*1024, function(grantedbytes) { console.log(grantedbytes) }, errorhandler);

jasper reports - JasperViewer does not print unicode characters in Windows -

Image
not sure why jasperviewer not print unicode characters in windows. tried install bengali fonts did not work. i retrieving data mysql , in report replacing numbers bengali unicode numbers. works fine in linux (debian). when run application jar file in windows (10), font broken. nothing displayed except table. what doing wrong? it harder today format xml code here! pasted on http://pastebin.com/xc3eizyf font extension: java method: public void clickbutton(actionevent event) throws classnotfoundexception, unsupportedlookandfeelexception, instantiationexception, illegalaccessexception, jrexception, sqlexception { //system.out.println(dir); string date = viewreport.gettext(); string reportsrcfile = "/home/famed/ideaprojects/salary sheet/src/salarysheet/salary2.jrxml"; jasperreport report = jaspercompilemanager.compilereport(new file("").getabsolutepath()+"/rtemp/salary2.jrxml"); system.out.println(report.tostring())

php - How to Display MySQL data as a checklist on HTML website? -

it's not complex problem i've been stuck past few days , can't seem figure out. have database called "major_degrees" , want fetch majors table called "majors" in database , display checklist on website using php , html. i believe fault somewhere in while loop.. printing data text want checklist can check off options want , save them. here php code have far: <?php $username = "root"; $password = ""; $hostname = "localhost"; $dbname = "major_degrees"; $str=''; // create connection $conn = new mysqli($hostname, $username, $password, $dbname); // check connection if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } $sql = "select degree_name majors"; $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result

Facebook Messenger Bot - "Subscription service" for bot app -

i know if possible create facebook chatbot app , make open public, page wants bot's functionality "subscribe" app (as service). i know possible have chatbot responding multiple pages, app's publisher needs admin of them @ same time generate access tokens (more in this post ) in app's admin page. that's problem me, publisher, since pages need grant admin rights me , not willing so. so, recap, want is: publish bot public; anybody wants use without having grant admin rights me. thank (and sorry long question, hard explain).

sql - how can i run this select to_char('01-jan-2016',day dd ddspth month yyyy) from dual; why to_date function not give output to our desire format? -

why query not run on oracle select to_date('01-jan-2016',day dd ddspth month yyyy) dual; ? why date function not give output our desire format? why to_char function not run in @ runtime? why run in in attribute sysdate or else ? i know select to_char(to_date('01-jan-2016',day-month-yyyy) dual; run on oracle want run @ runtime without specific attribute select to_char('01-jan-2016',day-month-yyyy) dual; . same case to_date function. why query not run on oracle select to_date('01-jan-2016',day dd ddspth month yyyy) dual; ? why date function not give output our desire format? the query not run because violate proper syntax. easy check oracle documentation post questions here. to_date takes string parameter, did fine. '01-jan-2016' fine. second argument should tell compiler format used string. string '01-jan-2016' gave format model 'day dd ddspth month yyyy' - there no connection between , '01-ja

ios - Using Swift library in an Objective-C project -

i working in objective-c, ios project, used danielgindi charts library swift library. downloaded using cocoapods. i trying import library files objective-c files using 'projectname-swift.h' mentioned in this question faced error: 'projectname-swift.h' file not found if have installed swift library using cocoapods to import library in objective c code use in objective c @import frameworkname; in swift @import frameworkname

WPF Shape bounding rectangle is always empty -

Image
i have following code in wpf application: public mainwindow() { initializecomponent(); p1 = new point(50, 50); p2 = new point(355, 50); p3 = new point(50, 355); p4 = new point(355, 355); loaded += (x, y) => draw(); //contentrendered += (x, y) => draw(); } i create polygon shape , try bounding rectangle several ways : private void draw() { polygon polygon = new polygon(); polygon.stroke = system.windows.media.brushes.white; polygon.points.add(p1); polygon.points.add(p2); polygon.points.add(p3); polygon.points.add(p4); canvas.children.add(polygon); boundingrect = polygon.transformtovisual(canvas).transformbounds(new rect(polygon.rendersize)); boundingrect = polygon.transformtovisual(polygon).transformbounds(system.windows.controls.primitives.layoutinformation.getlayoutslot(polygon)); boundingrect = polygon.rendertransform.tr

python - Getting an empty jpg file, when try to Download an image -

i have been trying download image website (no username , password required) every time getting empty file. have used conventional urllib .retrieve , requests methodologies getting same result. 1 thing more if try open same image manually copy pasting url after 15-20 min image not open. assuming sort of session handling required in case . below code returns me empty image. import os import urllib def savepic(url): uri="c:\python27\scripts\photosurl2.jpg" if url!="": urllib.urlretrieve(url, uri) savepic("http://www-nass.nhtsa.dot.gov/nass/cds/getbinary.aspx?imageview&imageid=491410290&desc=lookback+from+final+rest&title=scene+photos+-+image1&version=1&extend=jpg") any appreciated. when try implement http code in python not forget validate can use curl or wget perform these http requests. save lot of time trying debug problem not in code. the have verbose modes give hints regarding missing. also, s