Posts

android - Converting string to data -

i getting duration of audio file , convert int , convert int string , string 00:32 . converted string correct, problem convert string data here code: file file = new file(environment.getexternalstoragedirectory()+"/myimages/.audio1.wav"); mediaplayer mp = new mediaplayer(); fileinputstream fs = null; filedescriptor fd = null; try { fs = new fileinputstream(file); } catch (filenotfoundexception e) { // todo auto-generated catch block e.printstacktrace(); } try { fd = fs.getfd(); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } try { mp.setdatasource(fd); } catch (illegalargumentexception e) { // todo auto-generated catch block e.printstacktrace(); ...

unityscript - Unity3D - Multiple enemies patrolling multiple paths in the same script -

i'm new writing code. enemy patrol between 2 paths. when player enters detection area around enemy follow player. if wanted more 1 enemy , multiple paths, how add code able that. creating script each enemy waste, correct? public var enemypath1 : transform; public var enemypath2 : transform; private var target : transform = null; private var charactercontrols: charactercontroller; function start () { settarget(enemypath1); charactercontrols = getcomponent(charactercontroller); } function settarget(newtarget : transform) : void { target = newtarget; } function update() : void { var lookatposition : vector3 = vector3(target.position.x, this.transform.position.y, target.position.z); transform.lookat(lookatposition); charactercontrols.simplemove(transform.forward); } function ontriggerenter(node : collider) : void { if(node.transform == target) { if(t...

php - Inject code after X paragraphs but avoiding tables -

i inject code after x paragraphs, , pretty easy php. public function inject($text, $paragraph = 2) { $exploded = explode("</p>", $text); if (isset($exploded[$paragraph])) { $exploded[$paragraph] = ' mycode ' . $exploded[$paragraph]; return implode("</p>", $exploded); } return $text; } but, don't want inject $text inside <table> , how avoid this? thanks i'm bit crazy, go patterns lazy, time i'm going hazy. $input = 'test <table><p>wuuut</p><table><p>lolwut</p></table></table> <p>foo bar</p> test1 <p>baz qux</p> test3'; # input $insertafter = 2; # insert after n p tags $code = 'code'; # code want insert $regex = <<<'regex' ~ # let's define (?(define) (?p<table> # match nested table tags <table\b[^>]*>...

Export csv or xml file from a dataset in Postgresql -

i export dataset of table in csv or xml file, depending on easier. i'm using postgresql dbms. knows how that? thank you. use copy command or run query psql , redirect std out file. other methods exists well.

jquery - How do i load content from .php files with AJAX? -

im using ajax , history.js load content separate pages index-page. reason can load .html-pages - how make function load .php-pages? is solution add extensions in in var = urlpath? other ideas? // ajax load onklik $('body').on('click', 'a', function(e) { var urlpath = $(this).attr('href'); var title = $(this).text(); history.pushstate({urlpath: urlpath}, title, urlpath); $("#content").load(urlpath); return false; }); edit: i using links no extension example loading page 'about.html': <a href="/about">about</a> which generates url in browser when testing locally: http://localhost/about thats ok, nothing happens when try loading .php-page fx 'home.php' same way - nothing gets loaded. seems ajax / history.js breaks somehow. but - if add extension .php in link page 'home.php', page loads via ajax .html-pages: <a href="/home.php">about...

File download not working in php -

but same error below code well… can please share me suggestions.. error: warning: cannot modify header information - headers sent (output started @ /home/stthohuu/public_html/sp/announcements.php:1) in /home/stthohuu/public_html/sp/announcements.php on line 45 warning: cannot modify header information - headers sent (output started @ /home/stthohuu/public_html/sp/announcements.php:1) in /home/stthohuu/public_html/sp/announcements.php on line 46 <?php if(isset($_get['id'])) { ob_start(); // if id set file id database $con = mysql_connect('localhost', abc’, 'abc') or die(mysql_error()); $db = @mysql_select_db('stthohuu_church', $con); $id = $_get['id']; $query = "select name, type, size, content " . "from newsletter id = '$id'"; $result = mysql_query($query) or die('error, query failed'); list($name, $type, $size, $content) = mysql_fetch_array($result); header("con...

python - Apache and sharing media in a separate directory -

i building django app runs out of /users/me/dropbox directory. localhost pointed @ /users/me/sites directory. mod_wsgi installed. apache installed django installed , app working fine in development mode i trying embed media in template media comes directory outside of django app - in root of machine - /proyectos the permissions directories , preceding directories readable _www i think understand that mod_wsgi serve dynamic files apache serve static files css , template files, media files referencing in /proyectos directory i have following in settings.py: staticfiles_dirs = (os.path.join(base, "static"), ) static_url = "/static/" media_url = "/proyectos/" wsgi_application = 'mbrain.wsgi.application' in /etc/apache2/extra/vhosts/localhost.conf have: <virtualhost *:80> documentroot "/users/me/sites/localhost" servername localhost wsgidaemonprocess localhost python-path=/users/me/dropbox/mbrain_adam/mbrain/...