Posts

Automatically post on wall - Facebook Graph API PHP SDK v4 -

i'm building application event can directly post news messages on facebook. i'm trying use de php sdk v4 there parts of login process don't understand (still couldn't find solution after searching several hours). my problem in login process. first have specify applicaton , give application secret. have login facebook account. but account should use that? 1 of event? mine? (i'm admin of events page) (this means messages posted mine account while i'm not poster...sounds pretty weird..) which method should use login facebook? there veriaty of methonds facebookredirectloginhelper(), facebookcanvasloginhelper() or javascript one. far understand these helpers users login facebook accounts , that's not want. during search found example of making similar system ( facebook graph api php sdk v4 - post on page ). he/she uses folowing piece of code getting facebook session: facebooksession::setdefaultapplication('{app id}','{app secret}');...

Python: parsing and extracting op-codes from asm -

i parse assembly file , extract opcodes, stripping-of operands. each line in input file consists of 3 opcodes. should extract first word after "[" in each line , accumulate in list ? there better way of doing this? here input file format : [slli a3,a3,4] [add.n a3,a3,a8] [l32i a11,a3,128] [add.n a3,a3,a8] [l32i a11,a3,128] [l32r a9,0x1fff8954] [l32i a11,a3,128] [l32r a9,0x1fff8954] [l32i.n a10,a11,4] [l32r a9,0x1fff8954] [l32i.n a10,a11,4] [l8ui a8,a11,0] my expected output should this : [ slli : add.n : l32i ] [ add.n : l32i : l32r ] [ l32i : l32r : l32i.n ] [ l32r : l32i.n : l8ui ] finding op-codes: >>> import re >>> re.findall(r'\[(?=([a-z0-9.]+))','[slli a3,a3,4] [add.n a3,a3,a8] [l32i a11,a3,128]') ['slli', 'add.n', 'l32i'] you should wrap function.

c# - Move Slider until Value is reached -

i try "animate" slider while value true, until reaches designated value. reason not work easy thought: while (depthscan == true) { depth_max_slider.value += 10; console.writeline("working"); if (blobcount <= 400) { depth_max_slider.value += 10; } else { depthscan = false; } } what doing wrong? something should trick... public class mywindow : window { void startbutton_click( object sender, routedeventargs e ) { // method run on ui thread backgroundworker worker = new backgroundworker(); worker.dowork += worker_dowork; worker.workerreportsprogress = true; worker.progresschanged += worker_progresschanged; worker.runworkerasync(); // start thread // ui thread continues // exit click event handler, ui thread goes wpf control can keep rendering... } void worker_pro...

jquery - How do I post specific json data from php/mysql instead of all data -

i have code working pretty except it's going post of results php want specific json_encoded data. here's php pulls database. <?php session_start(); $_session['charname'] = 'egahtrac'; require_once ('mysqli_connect.php'); $q = "select * dps charname='" . $_session['charname'] . "';"; $r = mysqli_query($dbc, $q); $row = mysqli_fetch_array($r, mysqli_assoc); $dmg = $row['dmg']; $curr_hp = $row['curr_hp']; $tot_hp = $row['tot_hp']; $attk_spd = $row['attk_spd']; if ($_server['request_method'] == 'post') { if (isset($_post['attack'])) { if ($curr_hp > 0) { $row['curr_hp'] = $row['curr_hp'] - $row['dmg']; $q = "update dps set curr_hp='" . $row['curr_hp'] . "' charname='" . $_session['charname'] . "';"; $r = mysqli_query($d...

PHP paths from within included files -

scenario i have 2 files: file.php , admin/file.php file.php has require_once 'admin/functions.php'; admin/file.php has require_once 'functions.php'; so they're both including same file. trouble within functions.php , things file_get_contents , include , require see defined paths relative file.php , admin/file.php , not functions.php . because of this, can't use same functions.php different directories without creating duplicate files don't think best thing doing incase edit one, i'll have remember edit other well. what's best practice type of situation? edit: see comment on accepted answer below. what's best practice type of situation? easy. set base path manually in config file & don’t worry it—relative paths—ever again. that said, if trying simplify way files loaded, should explicitly set $base_path this: $base_path = '/full/path/to/your/codebase/here/'; if don’t know file system base...

node.js - mongodb incremental numbering - 500 internal server error -

i trying number id's of documents node , mongodb. getting 500 internal server error: 'cannot read property 'seq' of null. // submit ticket - returning 500 error - not updating id router.post('/ticketform', function(req, res){ var db = req.db; function getnextsequence(name, callback){ db.counters.findandmodify( { query:{ _id:name}, update:{$inc:{seq:1} }, new:true }, callback ); } getnextsequence('ticket', function(err, obj) { if (err) console.error(err); db.users.insert( { '_id': obj.seq, 'firstname':req.body.firstname, 'lastname':req.body.lastname, 'email':req.body.email, 'phone':req.body.phone, 'issue':req.body.issue }, function(err,docs) { if (err) console.error(err); console.log(docs); ...

javascript - Unexpected behavior of displaying and hiding a popup menu after resizing a screen or changing screen orientation -

i'm working on menu allows me open , close pop content. menu can opened pressing button, , closed clicking button once more or clicking anywhere else other pop-up content container. when i'm using code, experiencing weird issue after resizing window or changing screen orientation example on tablet, , clicking menu button, pop-up won't stay opened. opens , hides right after opening. i cannot duplicate error in jsfiddle made example using same code. why experiencing issue on demo page? how avoid it? code have sort of limitations i'm not aware of? this function trowed on click handler on each of buttons. function mainmenufunction(eid) { var num = $(eid).attr('id').substr($(eid).attr('id').length - 1); var elem = $("#menu-content-" + num); var parent = $("#menu-item-" + num); var p = parent.position(); var o = parent.offset(); if (elem.css("display") == "none") { elem.sli...