Posts

php - Username behind URL -

hello stack overflow i'm kind of stuck user_profile/username_here. problem can fill in every username want , still show made username if put behind '/' got filtered out how let show username of user logged in behind url? i'm using url rewriting. htaccess: rewriteengine on rewritebase / rewriterule ^profile/([a-za-z0-9-\._]+)(\/)? /profile.php?username=$1 [l,qsa] here code i'm using user_profile.php: <?php require_once('db.php'); session_start(); if(!isset($_session['id'])) { header("location: access_denied.php"); } else { $username = $_session['username']; $firstname = $_session['firstname']; $lastname = $_session['lastname']; $result3 = mysql_query("select * tab username='$username' , firstname='$firstname' , lastname='$lastname'"); if($row3 = mysql_fetch_array($result3)) { $username = $row3...

apache - File upload is not working in server but working locally -

i have seen phpinfo file,it has no tmp value set set /tmp upload_tmp_dir = "/tmp" but still not working. server in amazon ec2. i have tried putting upload_tmp_dir "/var/www" (with no trailing slash ) ,but didn't work. need set permissions tmp directory ? print_r($_files); is giving enter code here array ( [upload_file] => array ( [name] => ps.jpg [type] => image/jpeg [tmp_name] => /tmp/phpbcpdfp [error] => 0 [size] => 193728 ) ) and is_uploaded_file($_files['upload_file']['tmp_name']) is giving result 1 it permission issue on destination folder. do sudo chmod -r 777 /destination/folder , try again. should work. if still can't upload file, maybe permission problem on parent directory. after that, find user (and group) owner of uploaded file. then set permission back, , change owner of directory : sudo chown -r owner_user.group /destination/folder .

angularjs - How does $parse work? -

i have simple code this: <div ng-app="app"> <input type="text" ng-model="money" mask="2"> <p>{{money}}</p> </div> angular.module("app", []) .directive("mask", function($parse) { return { restrict: "a", require: "ngmodel", link: function(scope, element, attrs) { console.log($parse(attrs.mask)); // function(s, l, a, i){return 2;} console.log($parse(attrs.mask)(scope)); // 2 } } }); why first output function(s, l, a, i){return 2;} with (s, l, a, i) ? in case need jsfiddle: https://jsfiddle.net/ealonwang/x1hcbpjw/11/ according angular documentation $parse service $parse() without calling scope iief, returns function evaluated expession, aka: return 2 ; however function returned takes multiple arguments: function(context, locals) function represents compiled expression: context – {object}...

mysql - Java Application on network enviroment -

i'm developing application using java & mysql database, application desktop application working in network environment. application has static content loaded database when starting application. if super user made change variables, need enforce network users restart application can load new variables. what idea or code need use. you implement this. observer pattern or maybe can have "configtable" in database, property, value, expiration time. so, when admin updates value, other applications in network can pool new value. take jgroups regarding pooling approach, (we don't have enough information give best solution) try this. a notification_table id, event (event know, maybe load new images, etc) workflow 1) clients pool table every x seconds, filtering id > lastnotificationid (that needs saved in local file) 2) client applies new events. 3) client updates local file new notificationid.

IndexOutOfBoundsException showing while running my android program -

i doing android map oriented project. wrote code display direction between 2 places, works in lower android versions such 2.0, 2.2, etc. not working on android 4.0 , higher. when run code in android 4.0 shows indexoutofboundsexception . my class import java.io.inputstream; import java.util.arraylist; import javax.xml.parsers.documentbuilder; import javax.xml.parsers.documentbuilderfactory; import org.apache.http.httpresponse; import org.apache.http.client.httpclient; import org.apache.http.client.methods.httppost; import org.apache.http.impl.client.defaulthttpclient; import org.apache.http.protocol.basichttpcontext; import org.apache.http.protocol.httpcontext; import org.w3c.dom.document; import org.w3c.dom.node; import org.w3c.dom.nodelist; import android.graphics.canvas; import android.graphics.color; import android.graphics.paint; import android.graphics.point; import android.os.bundle; import android.widget.button; import com.google.android.maps.geopoint; import com.google....

php - Exception handling the right way -

i have rather simple question, read articles error , exception handling in php, have still questions left unawnsered. 1) in way make custom exception classes (that extend php's default exception)? , in cases should make custom exceptions? 2) read exceptions have caught catch/try block, see thrown exceptions in codes without try/catch blocks. using set_exception_handler() function? , how should use function properly? 3) allow custom behaviors when exception thrown (for example, record exceptions in database), should use set_exception_handler() or else? thank taking time read questions , have nice day! if need exceptions more built-in exceptions extending them way go. there not more that. they not have to caught. should caught @ point (see 3.) if writing library or module of kind can throw exceptions , leave the user of code catch it. you can wrap entire application in try-catch block , catch exceptions there, , need them (e.g. save them log file, or d...

java - ArrayIndexOutOfBoundsException when running range query in Accumulo -

i using geomesa 1.1 connect accumulo 1.6.2 java. have no problems querying database specific attributes (specific column values). when try run range query (tried both time , geometric ranges) error. when check accumulo logs see error: exception while doing multi-scan java.lang.arrayindexoutofboundsexception: -1 but none of code uses arrays. exception thrown underlying library. this how constructing cql filter: filter cqlfilter = cql.tofilter("bbox(where, 160.0, 1.0, 170.0, 3.0)"); what might causing java.lang.arrayindexoutofboundsexception: -1 ? edit updated question , answer make clear isn't duplicate , provide more general future visitors. as quick note, looks might using geomesa accumulo quickstart. geometry field there named 'where'. if update filter filter cqlfilter = cql.tofilter("bbox(where, 160.0, 1.0, 170.0, 3.0)"); it may work you.