Posts

Showing posts from August, 2013

Live555 compile for iOS build error -

i'm trying compile live555 ios. i have done following: ./genmakefiles iphoneos make i following build errors: /applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/usr/bin/g++ -c -i../usageenvironment/include -i../groupsock/include -i../livemedia/include -i../basicusageenvironment/include -i. -dbsd=1 -o2 -dsocklen_t=socklen_t -dhave_sockaddr_len=1 -d_largefile_source=1 -d_file_offset_bits=64 -fpic -arch armv7 --sysroot=/applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/sdks/iphoneos5.1.sdk -wall testmp3streamer.cpp /applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/usr/bin/g++ -o testmp3streamer -l. -arch armv7 --sysroot=/applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/sdks/iphoneos5.1.sdk testmp3streamer.o ../livemedia/liblivemedia.a ../groupsock/libgroupsock.a ../basicusageenvironment/libbasicusageenvironment.a ../usageenvironment/libusageenvironment.a ld: i...

how to set windows wallpaper in java -

this have found on stackoverflow. looking java class change windows wallpaper me in windows 7. public class changewallpaper { public static void main(string[] args) { //supply own path instead of using 1 string path = "c:\\users\\d1j5\\pictures\\asgardrealmofthegods.jpg"; spi.instance.systemparametersinfo( new uint_ptr(spi.spi_setdeskwallpaper), new uint_ptr(0), path, new uint_ptr(spi.spif_updateinifile | spi.spif_sendwininichange)); } public interface spi extends stdcalllibrary { //from msdn article long spi_setdeskwallpaper = 20; long spif_updateinifile = 0x01; long spif_sendwininichange = 0x02; spi instance = (spi) native.loadlibrary("user32", spi.class, new hashmap<object, object>() { { put(option_type_mapper, w32apitypemapper.unicode); put(option_function_mapper, w32apifunctionmapper.unicode); } }); boolean systemparametersinfo( uint_ptr uiaction, uint_ptr uiparam, string pvparam, uint_ptr fwinini ); } } source code stackoverflow assuming code you...

dialog (shell script program) but for C/C++ programs -

i'm looking library or usable c/c++ (cross-platform if possible) similar program "dialog", is/was available on linux systems. basically, simple menu similar dialog --menu , don't want have write code it. console-based fine; know of such library? by way, know google shortcut search program "dialog" opposed gui dialog boxes (e.g. "golang" go programming language)? can't "dialog" produce useful results. thanks! yad yet dialog. google this .

PHP: Download a file from web to local machine -

i have searched web 2 days , can not find answer. i trying create routine displays files on site control, , allows user download selected file local drive. i using code below. when uncomment echo statements, displays correct source , destination directories, correct file size , echo after fclose displays true. when echo source file ($data), displays correct content. the $filename variable contains correct filename, either .doc/.docx or .pdf. have tested both , neither saves destination directory, or anywhere else on machine. the source path ($path) behind login, logged in. any thoughts on why failing write file? thanks, hank code: $path = "https://.../reports/reportdetails/$filename"; /* echo "downloading: $path"; */ $data = file_get_contents($path); /* echo "$data"; */ $dest = "c:\myscans\\".$filename; /* echo "<br />$dest"; */ $fp = fopen($dest,'wb'); if ( $fp === false ) echo "<br />error in fopen...

node.js - Loop Mocha tests? -

i'm trying loop mocha test suite (i want test system against myriad of values expected results), can't work. example: spec/example_spec.coffee : test_values = ["one", "two", "three"] value in test_values describe "testsuite", -> "does test", -> console.log value true.should.be.ok the problem console log output looks this: three 3 three where want this: one 2 3 how can loop on these values mocha tests? the issue here you're closing on "value" variable, , evaluate whatever last value is. something work: test_values = ["one", "two", "three"] value in test_values (value) -> describe "testsuite", -> "does test", -> console.log value true.should.be.ok this works because when value passed anonymous function, copied new value parameter in outer function, , therefore not changed loop. edit: added coffeescript "do" niceness.

php - How add table rows dynamically and loading dynamic combobox with jQuery -

i'm building form need multiple entries optional, example dynamic combobox. have this: image: http://twitpic.com/a4ph8x every time user presses 'new row' button new row of form inputs dynamic combobox , other inputs should added form, how can in jquery? i'm sorry asking maybe such basic question i'm still green jquery, php i'm sure javascript / jquery plays more appropriate role here. thanks! code: http://www.4shared.com/file/bcafsfc9/code.html sure, jquery can well. just pass function on click say: addnewrow() on click of button , append new row in html. for example function addnewrow() { $('.form').append('<input type="text" />'); }

python - Update Lines in matplotlib -

i have graph multiple data sets on it. need continually redraw these lines, each separately, data updated. how can delete , reestablish repeatedly, preferably without having delete entire graph , redraw of lines on every time? #!/usr/bin/env python import time pylab import * ion() # turn interactive mode on # initial data x = arange(-8, 8, 0.1); y1 = sin(x) y2 = cos(x) # initial plot line1, line2, = plot(x, y1, 'r', x, y2, 'b') line1.axes.set_xlim(-10, 10) line1.axes.set_ylim(-2, 2) line1.set_label("line1") line2.set_label("line2") legend() grid() draw() # update line 1 in xrange(50): time.sleep(0.1) # update data y1 = sin(x + float(i) / 10) # update plot line1.set_ydata(y1) draw() # update line 2 in xrange(50): time.sleep(0.1) # update data y2 = cos(x + float(i) / 10) # update plot line2.set_ydata(y2) draw()

java - Efficiently finding all overlapping matches for a regular expression -

this followup all overlapping substrings matching java regex . is there way make code faster? public static void allmatches(string text, string regex) { (int = 0; < text.length(); ++i) { (int j = + 1; j <= text.length(); ++j) { string positionspecificpattern = "((?<=^.{"+i+"})("+regex+")(?=.{"+(text.length() - j)+"}$))"; matcher m = pattern.compile(positionspecificpattern).matcher(text); if (m.find()) { system.out.println("match found: \"" + (m.group()) + "\" @ position [" + + ", " + j + ")"); } } } } in other question mentioned matcher's region() method, weren't making full use of it. makes valuable anchors match @ region's bounds if bounds of standalone string. that's assuming you've got useanchoringbounds() option set, that's default setting. public static void allmatches(string text, string regex) { matcher m = pattern.compile(regex).matcher(text); in...

android - Image size for ActionBarSherlock background -

if art asset made intended use background of actionbar, size (in pixels) should request? have found referencing size of actionbar has been in dp, i'm unsure best absolute size go actual .png file. thanks! the action bar can 40, 48, or 56 dp in height depending on configuration. means because of how android scales things density there 9 different absolute pixel heights. width varies depending on device, of course. your best bet use 9-patch drawables or create drawable using shape xml can adapt infinite number of configurations of devices.

Using PHP move_uploaded_file function permission denied -

i've been stuck on code days hitting error when upload file server. windows server running on apache tried various solutions still receiving error. tried changing full permissions on server. i changed default php upload tmp file inside application yet still having error. warning: move_uploaded_file(c:\my_workspace\ojs2002) [function.move-uploaded-file]: failed open stream: permission denied in c:\my_workspace\ojs\admin\include\fileupload.php on line 78 warning: move_uploaded_file() [function.move-uploaded-file]: unable move 'c:\my_workspace\ojs\tmp\phpcb78.tmp' 'c:\my_workspace\ojs2002' in c:\my_workspace\ojs\admin\include\fileupload.php on line 78 // copy file, making destination directory if necessary $filedir = 'c:/my_workspace/ojs2002/'.basename($_files['articlefile']['name']); chmod($_files["articlefile"]["tmp_name"], 0777); chmod($filedir, 0777 ); move_uploaded_file($_files["articlefile"]["tmp_n...

How in Oracle kill user session silent or reproduce error 17410? -

i need test robustness of application problem network. don't have access network physically. have access oracle sys. possible may silent kill user session when application try data connection jdbc driver generate error 17410 ? oracle: no more data read socket when try kill session sid - oracle send alert killed session , not 17410 error. you can raise error code pragma exception_init. declare e_no_more_data exception pragma exception_init( e_no_more_data , -17410 ); begin raise e_no_more_data; end; / don't know if simulates error.

Jumping to-and fro between Kernel and user code in Linux -

i doing kernel hacking on linux running x86-64 research project. kernel routine need jump user mode code page , return kernel code. in other words, need trampoline on user code while executing in kernel. i wondering whether can @ possible or not. if possible, can give idea how can achieved? it unlikely possible "easily". without knowing application, , without suggesting rethink kernel<->app interface, possible hack work this: have application register piece of trampoline code kernel component passing address of code. trampoline code execute "real" user mode function, issue syscall or exception return kernel. while not user-mode subroutine, gets reasonably close: when application calls whatever kernel function needs callback, kernel function can save real return address, change registered trampoline address , return user mode. trampoline call function, syscall/exception following kick kernel , can continue whatever doing there. you don't need worry...

ajax - create html elements on the serverside VS get data as JSON and create tags with javascript -

i want create ajax search find , list topics in forum (just topic link , subject). question is: 1 of methods better , faster? get threads list json string , convert object, loop on items , create <li/> or <tr> , write data (link, subject) , append threads list. (jquery powered) get threads list wrapped in html tags , print (or use innerhtml , $(e).html() ) thanks... i prefer second method. i figure server-side have either convert data json or html format why not go directly 1 browser understands , avoid having reprocess client-side. can adapt second method degrade gracefully users have disabled javascript (such still see results via standard non-js links.)

Django -- Template tag in {% if %} block -

i have following dictionary passed render function, sources being list of strings , title being string potentially equal 1 of strings in sources: {'title':title, 'sources':sources}) in html template i'd accomplish among lines of following: {% source in sources %} <tr> <td>{{ source }}</td> <td> {% if title == {{ source }} %} now! {% endif %} </td> </tr> {% endfor %} however, following block of text results in error: templatesyntaxerror @ /admin/start/ not parse remainder: '{{' '{{' ...with {% if title == {{ source }} %} being highlighted in red. you shouldn't use double-bracket {{ }} syntax within if or ifequal statements, can access variable there in normal python: {% if title == source %} ... {% endif %}

cursor - How to draw caret in the scroll view on iOS using system API? -

Image
i working on edit app, view inherits scroll view, , draw things manually. need insertion indicator, may refer caret(as know windows use term) or cursor(not mouse cursor). not sure term apple use. googled before , know can draw line manually, or create clear background text view on it, don't these ways. hope there system apis this, more native. 1 can figure out? cursor - how draw caret in scroll view on ios using system api? - stack overflow stack overflow questions developer jobs documentation beta tags users current community help chat stack overflow meta stack overflow communities sign up or log in customize list. more stack exchange communities company blog tour start here quick overview of site center detailed answers questions might have meta discuss workings , policies of site learn more stack overflow company business learn more hiring developers or posting ads ...

javascript - RequireJs define default deps -

usually requirejs module looks like: define('modulename', ['jquery', 'underscore', 'backbone'], function($, _, backbone){ }); because every file in setup requires underscore , backbone have them automaticly available in module without having define them dependencies. so like: define('modulename', ['jquery'], function($){ $("div.someclass").addclass('hide'); // works var model = backbone.model.extend(); // works }); is possible? if yes how or keyword have for? the modules you're interested in have attached outer scope. default, backbone, underscore, jquery etc remain attached global scope unless call noconflict() on them (not modules provide nicety). attaching modules global scope isn't great solution, accomplish you're asking , default behavior anyway. better alternative define outer module (or require() call) contains dependencies in addition named sub-modules. otherwise, of reason using requirejs...

python - enabling start, stop feature for a folder watcher program -

the code below doesn't work want to. when svc.run() programs runs okay. changes i've made folder works file. when svc.stop() doesn't stop think. perhaps there must better way of doing threading part... import pyinotify import threading import time import os class fs_event_handler(pyinotify.processevent): def __init__(self, callback): self._callback = callback def process_in_create(self, e): self._callback(e.path, e.name, 'created') def process_in_delete(self, e): self._callback(e.path, e.name, 'deleted') def process_in_modify(self, e): self._callback(e.path, e.name, 'modified') class notificationservice(): def __init__(self, path, callback): mask = pyinotify.in_create | pyinotify.in_delete \ | pyinotify.in_modify w = pyinotify.watchmanager() self.__notifier = pyinotify.notifier(w, fs_event_handler(callback)) wdd = w.add_watch(path, mask, rec=true, auto_add=true) self.__loop = true def start(self): while self.__loop: self.__notifier.process_events...