Posts

Showing posts from May, 2012

Accessing C function from java code in android -

if @ /platform/external/bluetooth/bluedriod in android source code , there several files there several c function. how access these c function rooted android phone. doing small experiments , need call functions. wondering how can this? you can access native code using ndk, check out

scroll - I edited some CSS, and now my page is weirdly twice as wide -

i'm using preset portfolio service called cargo collective. i edited top padding navigation window header wouldn't cover it. the page twice wide, , has h-scroll bar @ reasonable browser width. i searched through px padding in css, there's nothing glaringly obvious. conclusion repeating 670px width on twice. here's link page: http://cargocollective.com/brookeseggleston here's code section: /* * header / navigation */ .header_img { position: relative; left: 20px; top: 20px; z-index: 15; } .nav_container { background: #ffffff; line-height: 1.8; margin: 0px; padding: 50px 0 20px 20px; position: fixed; top: 198px; left: 20px; white-space: nowrap; width: 190px; z-index: 12; } /* enabled via display options */ .nav_container.horizontal { left: auto; padding: 35px 0 60px 35px; position: relative; top: auto; width: 670px; z-index: 25; } .nav_container.horizontal div { float: l...

ssas - complex MDX query(s) -

i have cube following structure 1 measure sales count three dimensions. brand, region, gender i need mdx query(s) returns following 8 tuples. total sales across dimension attributes including unknown values the single highest value of combination of attribute values each dimension. total sales brand attribute identified stat 2 total sales region attribute identified stat 2 total sales gender attribute identified stat 2 total sales brand attribute region attribute identified stat 2 gender attributes total sales region attribute gender attribute identified stat 2 brand attributes total sales brand attribute gender attribute identified stat 2 region attributes your first query perhaps written using crossjoin show possible combinations of brand, region , gender: select { {[brand].defaultmember.children}* {[region].defaultmember.children}* {[gender].defaultmember.children} } on rows, {[measures].[sales count]} on columns [your_cube_name] does ...

Run Eclipse Java project outside Eclipse -

i'm java newbie. have java application runs in eclipse. have exported jar file aaccording instruction found @ http://www.vogella.com/tutorials/eclipse/article.html#firstjavaexport . however, when run application command line, error message saying: exception in thread "main" java.lang.noclassdeffounderror: org/openqa/selenium/webdriver @ java.lang.class.getdeclaredmethods0(native method) @ java.lang.class.privategetdeclaredmethods(unknown source) @ java.lang.class.getmethod0(unknown source) @ java.lang.class.getmethod(unknown source) @ sun.launcher.launcherhelper.getmainmethod(unknown source) @ sun.launcher.launcherhelper.checkandloadmain(unknown source) caused by: java.lang.classnotfoundexception: org.openqa.selenium.webdriver @ java.net.urlclassloader$1.run(unknown source) @ java.net.urlclassloader$1.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ ja...

python - PyDev - unable to import modules which are under sub directory -

i have python project structure shown below, ├── example    ├── test.py    └── module       ├── __init__.py       ├── mymod.py       └── submod.py i imported above project pydev project , test.py not import mymod . importing module inf following way. from module import mymod i added module directory pydev pythonpath did not hep. i run test.py console without problem. add example python path

sql server - How to recognize SqlException where user cancelled? -

so, cancelled query using sqlcommand.cancel. sql client returned sqlexception following message: a severe error occurred on current command. results, if any, should discarded. operation cancelled user. fine me. but, have gracefully deal since it's not regular error should reported. problem is, besides message there no indicator inside sqlexception object i've found identify caused user cancelling query. i don't want use message itself. message changed @ 1 point or translated language @ point. error number property 0 , class property 11. for sql server 2008 r2 , .net 4.0 following properties of sqlexception set if property sqlconnection.fireinfomessageeventonusererrors set true class: 16 number: 3204 message: backup or restore aborted. restore database terminating abnormally. operation cancelled user. if property sqlconnection.fireinfomessageeventonusererrors set false class: 11 number: 0 message: operation cancelled user.

javascript - How to create Top Bar which does not refresh when page is refreshig with Ajax or? -

i have created simple top bar new website. here code him in css. it's simple div bar. .topbar { display:block; width:100%; height:40px; background-color:#f5f5f5; } i want put in top bar simple .swf flash mp3 player. , want make bar not reload or refresh when people browsing inner website pages on top bar exists. something top bar on http://soundcloud.com how can make bar not refresh? thanks in advance! p.s. don't want put rest of website in iframe. somehow want make javascript? can explain more - http://angularjs.org/ given me answers! you can not refreshing entire page refreshing parts (other top bar) using ajax , javascript. you can use easy , strong framework angularjs .

excel - Disable running macros from the "View Macro" screen until VBA project password is entered? -

Image
so first, when 1 clicks on "view macro" button, pops up: what want know is, there code can run on workbook open (and "unrun" on workbook close) grays out run button (like others underneath are) until password entered in vba project (using alt+f11 open editor)? i don't want users able run of these subs manually. if declare sub needs input, optional input not show in list either. sub test(optional string)

c - Creating multiple instances/copies of a static global -

not sure if worded title correctly, bear me , explained... we have collection of code not invented here uses inter-process comms (ipc messaging). rough outline of scheme this: comms.c contains: static int our_id; void init_messaging(int id) { our_id = id; msg_init(key); } void get_some_data_from_elsewhere(target_id) { send_message(target_id, our_id); // send target, return rcv_message(<our_id>); // messages addressed <our_id> } then stuff.c might do: init_messaging(id_stuff); get_some_data(target); and foo.c might do: init_messaging(id_foo); get_some_data(target); how works / should work / elbonian code slaves seemingly expected work: when stuff.c calls init_messaging, our_id set id_stuff , further calls process have variable "id_stuff" available ensure replies on message queue come correct process. however, if have situation, of 2 or more threads spawned same place, falls down: stuff.c might do: void stuff_thread() ...

f# - Immutable game objects -

i'm trying wrap head around f#, , part it's making sense, people keep saying every problem can solved immutable constructs. objects in game? have changing variables (x, y, xspeed, yspeed, score, health etc...) lets have player object, defined in c# as: public class player extends gameobject { private int score = 0; private int x = 0; private int y = 0; ... more variables public player() { } public void addscore(int amount) { score += amount; } public void addx(int amount) { x += amount; } public void addy(int amount) { y += amount; } ... more methods } this code has variables inherently there being that: "variables." how code translate immutable code? by definition immutable can't change, in order update immutable game object new object contains updates must created. type player(score, x, y) = member this.addscore(amount) = player(...

sql - How to use a dynamic parameter in a IN clause of a JPA named query? -

my problem kind of query : select * sometable somefield in ('string1','string2'); the previous code works fine within sql developer. same static query works fine , returns me few results; query nativequery = em.createnativequery(thepreviousquery,new someresultset()); return nativequery.getresultlist(); but when try parameterize this, encounter problem. final string parameterizedquery = "select * sometable somefield in (?selectedvalues)"; query nativequery = em.createnativequery(parameterizedquery ,new someresultset()); nativequery.setparameter("selectedvalues","'string1','string2'"); return nativequery.getresultlist(); i got no result (but no error in console). , when @ log, see such thing : select * sometable somefield in (?) bind => [string1,string2] i tried use no quotes (with similar result), or non ordered parameter (:selectedvalues), leads such error : sql error: missing in or out parameter @ ...

c# - URL routing turning /pages/test.aspx into /test -

i made folder called 'pages' in asp web forms project. in folder have lot of pages: test.aspx hello.aspx when open these pages in browser get: www.domain.com/pages/test.aspx www.domain.com/pages/hello.aspx this normal, know. if want delete /pages in url , show (without .aspx): www.domain.com/test*.aspx* www.domain.com/hello*.aspx* i can manually adding new route (in registerroutes() method) each page there way dynamicly? i found question don't know if can use problem. webforms custom / dynamic routing try this, not sure if it. put pages in root directory. think work. source link: http://msdn.microsoft.com/en-us/library/vstudio/cc668177(v=vs.100).aspx routes.mappageroute("pageroute","{page}", "~/pages/{page}.aspx"); not sure if that's looking for, way can like: response.redirecttoroute("pageroute", new { page = "test" });

jquery - Tab shortcode plugin renders incorrectly -

i've used tabs shortcode plugin before, it's never done before. where renders tabs built in tabs come wordpress, time rendering bulleted list. here's code: [tabs] [tab title="financials"] <ul> <li>bookkeeping balance</li> <li>audit preparations</li> <li>cipro company registration</li> <li>sars efiling</li> <li>uif</li> </ul> [/tab] [tab title="office administration"] <ul> <li>development of useful templates in microsoft office programs <ul> <li>excel formulas</li> <li>letterheads</li> <li>form letters</li> </ul> </li> <li>mail mergers</li> <li>database cleanups</li> <li>data capture</li> <li>desktop publishing</li> </ul> [/tab] [tab title="miscella...

Does mongodb copydatabase function overwrite the destination db? -

i use way: db.copydatabase('src','dest', 'server:27017') does documents in dest remove or replaced if have same id ? no, not erase existing database. rather, try merge two. errors occur when both databases have documents same unique keys. > db.copydatabase('sourcedb', 'destdb', 'localhost:27017') { "errmsg" : "exception: e11000 duplicate key error index: destdb.coll1.$_id_ dup key: { : objectid('52ebcb2ab33a160d3f1fb6fe') }", "code" : 11000, "ok" : 0 } full code of experiment .

java - number reversal program gives only the first digit in output instead of the whole number -

string s1; int a, b, c = 0; s1 = t1.gettext(); = integer.parseint(s1); while (a > 0) { b = % 10; c = c * 0 + b; = / 10; } t2.settext("" + c); here t1,t2 text fields. please let me know did go wrong because getting first digit of number enter in output , not whole number. your incrementation of c c = c * 0 + b; want multiply 10 instead of 0 : c = c * 10 + b;

php - How to get a model instance in CodeIgniter hooks -

i'm tring write hook. it's easy load model , execute functions defined in it. jusk like: $this->load->model('requestmodel'); $this->requestmodel->insert(); but in hook, there no $this , , know works: $ci =& get_instance(); $ci->load->model('requestmodel'); $ci->requestmodel->hook_triggered_action(); but that's hard-coded way, want is: global $rtr; $controller = $rtr->class; $modelname = $controller.'model'; $ci->load->model($modelname); $ci->$modename->hook_triggered_action(); // line throws error i tried $ci->model[$modename]->hook_triggered_action(); it's wrong. how? $ci->model[$modelname] this doesn't work in php. -> , [] not interchangeable. you should able however: $ci->$modelname->hook_triggered_action();

c - Rounding a double to avoid round off in subsequent summation -

how implement this? // round nearest double x + ref doesn't cause round off error double round(double x, double ref) { } so that double x = ....; double y = ....; double x_new = round(x, y); return x_new + y; // no round off! in other terms (y + x_new) - x_new strictly equal y let assume x , y both positive. let s double-precision sum x + y . there 2 cases: if x ≤ y , s - y exact sterbenz's lemma. follows addition (s - y) + y exact (it produces s , double-precision number). therefore, can pick s - y x_new . not y + x_new exact, produces same result s y + x . if x > y , depending on number of bits set in significand of y , may have problem. if last bit in significand of y set, instance, no number z in binade after binade of y can have property z + y exact. this answer vaguely related that answer .

ruby on rails - Changed resources path breaks ajax -

when change path of resource in routes.rb file, ajax links stop working. instead of loading .js view, instead load .html view , nothing it. changing route fixes it. is bug? there workaround? can specify format: :js in link, kind of defeats purpose of unobtrusive javascript, , link js source if js disabled. rails 4.0.2, ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin12.0].

java - How to read contents of a template file make changes and save as new file? -

i have file lets call template.cfg , want make changes , save file new name preserving template file. template file contents. there alot more in file these online lines i'm concerned about. <property>url</property> <property>password</property> <property>schema</property> <property>user</property> output file want have new name lets call databaseinfo.cfg i'd need search words url , replace user defined url same password schema , user. save in same directory template. <property>foo</property> <property>bar</property> <property>d2d</property> <property>d2duser</property> i'm thinking in terms save as. not sure how should go modifying file without changing original , yet saving new file. i dont have code yet outside of getting template files full path open file because i'm curious best route take having file. file file = new file(template.cfg); string full...

How come julia won't run this code? -

i in process of trying learn little using julia translating old example code solves time dependent schrodinger equation. here have far: require("setparams.jl") require("v.jl") require("initialrim.jl") #require("expevolve.jl") function doit() nspace, r, im, x0, width, k0, xmax, xmin, v0, a, dx, dx2, n, dt = setparams() r, im = initialrim(width,n,k0,dt,xmin) probden = zeros(nspace) probden = r.*r + im.*im plot(probden) #imold = im; t=0.0 #t, r =evolve!(r,im,t,v0,width,a,dx,dx2,dt,xmin,n) println("done") end after requiring above code, using winston. attempt run code typing doit(). nothing appears. can please let me know doing wrong? can provide innards of setuparame() if needed, initialrim() thought @ first i'd ask whether expectations should happen in fault. note if run setuparams() , initialrim() in terminal session, plot(probden), correct graph appears. thanks help. update: i have restarted julia, h...

google chrome - PHP Reload Time -

hello have problem php. im coding in 2 ways: i upload file ftp sever save local , run mamp (osx) but in both ways save/upload new file takes 2-5 min until can see changes. example: old php: <?php echo "test"; ?> new php: <?php echo "test2"; ?> so save second file until see second text may taxes aboout 2-5 minutes? can change in php info file or else ? or there way code in php ? this sounds caching problem. try hitting cmd + shift + r * , see if changes instant then. if that's problem, see answer how disable cache prevent problem. also, lovenohate points out in comments, possible server- or isp-side caching problem. because have same problem running locally on mamp , however, sounds browser issue. * mac os x shortcut. future visitors: use ctrl + f5 windows.

python - Fabric show print after executing commands -

i have post-receive hook on git bare repo excute fabfile.py: def deploy(): print(cyan('pulling changes local server')) cd('/var/www') local('git pull') it executes fine, shows output local command before print, this: remote: /media/projetos/repositorios/test remote: b057a4b..02d85b3 master -> origin/master remote: updating b057a4b..02d85b3 remote: fast-forward remote: .../test/template/catalog/product/list.phtml | 98 +++++++++++----------- remote: 1 file changed, 47 insertions(+), 51 deletions(-) remote: pulling changes local server if ssh on server , run fab deploy works normal. add sys.stdout.flush() call after print ing, if output buffered (as on pipe, case when running under git hook), sent output stream @ point, before running command.

entity framework - Adding Data to a very nested child object using EntityFramework -

Image
i trying add note event object. getting error using code note notetoadd = new note { state = state.added, notetext = note }; patient patient = context.patients.find(patientid); patient.state = state.modified; patient.mobilepatient.state = state.modified; patient.mobilepatient.mcalmevents.find(e => e.id == eventid).note = notetoadd; context.applystatechanges(); is there better way using linq entity? the error having : {"invalid column name 'note_id'."} and sql being generated select instead of insert. thank you but map shows one-to-many relation between note , event ... all of code remain are, instead of line : patient.mobilepatient.mcalmevents.find(e => e.id == eventid).note = notetoadd; replace these lines: notetoadd.eventid = oevent.id; // replace field names, are; context.note.add(notetoadd); var oevent = patient.mobilepatient.mcalmevents.find(e => e.id == eventid); oevent.noteid = notetoadd.id; // repla...

toggleclass - jQuery toggle class with multiple options -

how can use togglecalss(), in situation this: <div id="options"> <span data-color="red">red</span> <span data-color="green">green</span> <span data-color="blue">blue</span> <span data-color="black">black</span> </div> <div id="target"> <span class="icon home">target</span> </div> $('#options').on('click', 'span', function () { var $iclass= $(this).data('color'); $('#target').find('span').toggleclass($iclass) }); in example above existing class not being replaced clicked one. keeps appending additional classes. here jsfiddle example well: http://jsfiddle.net/5ubud/3/ $('#options').on('click', 'span', function () { var r = $(this).siblings().map(function () { return this.getattribute('data-color'); }...

Chef knife upload get ERROR: Errno::ENOENT: No such file or directory -

i made changes role on local chef-repo , wanted use knife upload roles upload changes chef-server error message error: errno::enoent: no such file or directory - /home/danny/git/chef-repo/cookbooks/~/git/chef-repo all knife upload commands error i able use bundle exec knife cookbook upload -a successfully any idea going wrong more info the command tried was knife upload /roles <---at top of local chef-repo & knife upload roles <--from roles directory my knife.rb log_level :info log_location stdout node_name 'admin' client_key '~/.chef/admin.pem' validation_client_name 'chef-validator' validation_key '~/.chef/chef-validator.pem' chef_server_url 'https://chef.example.org' chef_server_ip '10.32.2.53' syntax_check_cache_path '~/.chef/syntax_check_cache' cookbook_path [ '~/git/chef-repo/cookbooks...

Java: Jackson polymorphic JSON deserialization of an object with an interface property? -

i using jackson's objectmapper deserialize json representation of object contains interface 1 of properties. simplified version of code can seen here: https://gist.github.com/sscovil/8735923 basically, have class asset 2 properties: type , properties . json model looks this: { "type": "document", "properties": { "source": "foo", "proxy": "bar" } } the properties property defined interface called assetproperties , , have several classes implement (e.g. documentassetproperties , imageassetproperties ). idea image files have different properties (height, width) document files, etc. i've worked off of examples in this article , read through docs , questions here on , beyond, , experimented different configurations in @jsontypeinfo annotation parameters, haven't been able crack nut. appreciated. most recently, exception i'm getting this: java.lang.assertio...

c# - ServiceStack: Property in request DTO becomes null if type is abstract -

i have servicestack 3-based client-server architecture. i'm trying create service request dto contains property abstract type, 2 different concrete classes implementing it. abstract type either abstract class or interface; however, in either case, server receives null object in property. there's 3 assemblies , corresponding namespaces: testclient , server , , commonlib referenced both client , server. that is, spread across 3 assemblies: namespace commonlib.services { public class getthing : ireturn<getthingresponse> // request dto { public ithisorthat context { get; set; } } public class getthingresponse { public dictionary<int, string> result { get; private set; } public getthingresponse(dictionary<int, string> result) // response dto { result = result; } } } namespace commonlib { public interface ithisorthat { } public class : ithisorthat { } // , forth } nam...

vb.net - SQL Server database not getting updated -

i using following code, database not getting updated: dim update new sqlcommand("update fagr set fagrn=@fagrn,fagru=@fagru fagrc=@fagrc", connection) update.parameters.add(new sqlparameter("@fagrc", sqldbtype.nchar, 3)) update.parameters.add(new sqlparameter("@fagrn", sqldbtype.nvarchar, 50)) update.parameters.add(new sqlparameter("@fagru", sqldbtype.nchar, 3)) dim integer = 0 while < datagridview1.rows.count try update.parameters(0).value = datagridview1.rows(i).cells(0).tostring update.parameters(1).value = datagridview1.rows(i).cells(1).tostring update.parameters(2).value = datagridview1.rows(i).cells(2).tostring vartemp1 = update.executenonquery() i=i+1 catch ex exception msgbox("exception:" & vbcrlf & ex.message) me.close() end try loop 'in similar insert query first row of grid inserted in database. other records not inserted no error...

Django app cannot be accesed remotely with Apache+mod_wsgi -

i have following problem: i cannot remotely access django app apache+mod_wsgi. but can remotely access django app django development server manage.py runserver 0.0.0.0:8000 . , can locally access django app apache+mod_wsgi on local computer trough port 80. so know why cannot access remotely trough apache. this httpd.conf (i have posted modified, else default.) listen *:80 loadmodule wsgi_module modules/mod_wsgi.so <ifmodule ssl_module> sslrandomseed startup builtin sslrandomseed connect builtin </ifmodule> wsgiscriptalias / c:/users/ricardo/dropbox/django_scada/django_scada/apache/wsgi.py wsgipythonpath c:/users/ricardo/dropbox/django_scada alias /static/ c:/users/ricardo/dropbox/static/ <directory c:/users/ricardo/dropbox/static/> order deny,allow allow </directory> <directory c:/users/ricardo/dropbox/django_scada/django_scada/apache> <files wsgi.py> order deny...

javascript - Hide with jquery a specific HTML pattern where it repeats on a page -

my regex & jquery skills failing me. i need hide of following html appears on page (the following spat out database): <p><strong>external links for:</strong></p> <p></p> i'd grateful jsfiddle (or similar) uses jquery hide of above. (note: there data inside second paragraph. if so, should remain untouched). thanks in advance! for record, have tried myself jquery skills rubbish best start blank slate expect take few lines of code implement. if want return instances of both paragraphs in row, can create complex filter so: $('p').filter(function(i,el) { var test1 = $(el).html() == "<strong>external links for:</strong>"; var test2 = $(el).next('p').html() == ""; return test1 && test2; }).next().addback().hide(); // or .remove() http://jsfiddle.net/mblase75/d7fz4/5/

javascript - How do you manage dependencies during concatenation? -

i've been appending js files , load them in 1 lump sum far, , works great. i've been using grunt load them. however, 1 thing notice order matters. if have inheritance chain such entity => character => player need entity.js loaded first. how can control appending order , manage dependencies? or job requirejs? use module bundler, such browserify , webpack or requirejs . with browserify/webpack (or commonjs loader , requirejs): player.js var character = require('./character') function player() { character.call(this) } inherits(player, character) module.exports = player character.js var entity = require('./entity') function character() { entity.call(this) } inherits(character, entity) module.exports = character entity.js function entity() {} module.exports = entity app.js var player = require('./player') var player = new player() or if prefer amd , requirejs (or using browserify/webpack amd transform): player.js ...

Trying to use Preferences in java but need admin rights (need to work on windows and MAC) -

i trying save settings program. i instance asking user pick folder when program run first time. this working , wonderfull, not saved. prefs = preferences.userroot().node(this.getclass().getname()); returns warning: not open/create prefs root node software\javasoft\prefs @ root 0x80000002. windows regcreatekeyex(...) returned error code 5. error code 5 (access denied) how ask admin rights? both on windows , mac, thank time! i found out when using userroot(), program indeed makes key. throws warning because java tries make in systemroot() aswell, incase ever need in systemroot. when using userroot() never will.

firefox - Show notifications when app is closed -

i'm having problems notifications in app. i've seen pages reference alarmapi in firefox os , how handle notifications: https://developer.mozilla.org/en-us/docs/webapi/alarm https://developer.mozilla.org/en-us/apps/developing/control_the_display/using_alarms_to_notify_users http://rootslabs.net/blog/199-firefox-os-dev-tips-2 the code same in both cases , works when app open or in background. if close app doesn't show notifications. i've tested example app second link , works when app closed. what problem , how can fix it? thanks. you must use navigator.mozsetmessagehandler() https://developer.mozilla.org/en-us/docs/web/api/navigator.mozsetmessagehandler if(navigator.mozsetmessagehandler) { navigator.mozsetmessagehandler("alarm", function (alarm) { // launch notification if alarm of right type app if(alarm.data.task) { // create notification when alarm due new notification("your task " + alarm.data.task + ...

http status code 404 - New MediaTemple site displays '404 File Not Found - nginx' message -

i set new new domain , uploaded simple static html files & assets. images not display , when try pull 1 directly in browser page reads 404 file not found - nginx this weird because although know media temple uses nginx run vms, websites served apache... anyway, led i: created new webspace created new domain within webspace uploaded new image (logo.jpg) found logo.jpg not load , leads 404 described above after creating new domain, got automated message shown below (with specific info removed): ---------- forwarded message ---------- from: [user] [email] date: thu, jan 30, 2014 @ 12:40 pm subject: unable configure web server on host [domain] to: [me] unable generate web server configuration file on host [domain] because of following errors: nginx: [emerg] listen() [ip address]:80, backlog 511 failed (98: address in use) nginx: configuration file /etc/nginx/nginx.conf test failed please resolve errors in web server configuration templates , generate file again...

java - How to work efficiently with large Maven-project workspace in Eclipse? -

i'm working on large multi-module maven-based system, 20 sub-modules , additional small number of project-external dependencies maven projects in eclipse workspace. in all, there 30 projects in eclipse workspace. the projects imported maven projects m2e, , use subversion (with subversive plugin) source control. eclipse updated kepler. my workstation quite capable, 4-core intel i7 cpu, 16 gb ram, , solid-state disk. the problem eclipse slow when comes to: team synchronize , conflict resolution. each time fix conflict , "mark merged", have wait 10-30 seconds eclipse refresh workspace etc. not mention conflict-mode tree view clears entirely, have select outgoing mode conflict mode again re-populate. twice - because clears when save resolved source file, , again when mark merged. building. use maven launch configurations maven builds. reason, doing maven build not enough eclipse - has own build of entire workspace, takes @ least long, , longer when eclipse decid...

Unable to get cron daemon to start on ubuntu server -

i have ubuntu 10.04 server . i'm trying start cron daemon not start. i'm using command (as root ): service cron start when execute command - hangs. i'm not seeing information in syslog might going on. service cron stop same thing - hangs. any ideas can check see preventing cron starting? turns out system needed reboot. sitting idle app not cycling 2.5 months - had fouled bunch of processes , memory. once rebooted - cron started fine. thanks!

java - Custom validator does not set parameter values to the properties of the validator in Struts2 -

i'm trying build custom validator in struts2 (2.3.16) follows. package validator; import actions.discountaction; import com.opensymphony.xwork2.validator.validationexception; import com.opensymphony.xwork2.validator.validators.validatorsupport; import org.joda.time.datetime; public final class discountdatevalidator extends validatorsupport { private datetime startdate; private datetime enddate; //getters , setters. @override public void validate(object o) throws validationexception { system.out.println("startdate = "+startdate); system.out.println("enddate = "+enddate); system.out.println((o instanceof discountaction)); } } the validators.xml file looks following. <?xml version="1.0" encoding="utf-8"?> <!doctype validators public "-//apache struts//xwork validator config 1.0//en" "http://struts.apache.org/dtds/xwork-validator-config-1.0....

php - Symfony2 ContextErrorException in Custom Authentication Provider -

i'm trying make how create custom authentication provider , after full reading , looking symfony code, thought creating factory, authentication provider , using symfony default class enough i'm missing , i'm getting error contexterrorexception: catchable fatal error: argument 1 passed acme\demobundle\provider\myprovider::__construct() must implement interface symfony\component\security\core\user\userproviderinterface, string given, called in d:\wamp\www\sf2ldap\app\cache\dev\appdevdebugprojectcontainer.php on line 1383 , defined in d:\wamp\www\sf2ldap\src\acme\demobundle\provider\myprovider.php line 20 the factory namespace acme\demobundle\factory; use symfony\component\dependencyinjection\containerbuilder; use symfony\component\dependencyinjection\reference; use symfony\component\dependencyinjection\definitiondecorator; use symfony\component\config\definition\builder\nodedefinition; use symfony\bundle\securitybundle\dependencyinjection\security\factory\abstr...

sql server - UPDATE modified date trigger only if modified date is not supplied -

i have tables have "created" , "modified" dates on them. i'd able update latter if modified date not supplied application layer. need have application layer able set modified date specific value in event offline transaction (such device no internet connection syncs @ later date) occurs, can't ensure ever application developer remember set modified date in application code. given following table: create table [dbo].[tests]( [testid] [int] identity(1,1) not null, [name] [nvarchar](50) not null, [createddate] [datetime2](7) not null, [modifieddate] [datetime2](7) not null, constraint [pk_tests] primary key clustered ( [testid] asc )with (pad_index = off, statistics_norecompute = off, ignore_dup_key = off, allow_row_locks = on, allow_page_locks = on) on [primary] ) on [primary] go alter table [dbo].[tests] add constraint [df_tests_createddate] default (getutcdate()) [createddate] go alter table [dbo].[tests] add constraint [df...

I want to parse a string as HTML inside a data attribute with AngularJS -

i'm using ngsanitize parse var: var icon = $sce.trustashtml('&#x020;'); but, can't use ng-bind-html or ng-bind-html-unsafe in view trying add value data tag: <i class="icon" data-icon="{{ message.icon }}"></i> results in: <i class="icon" data-icon="&#x020;"></i> i tried: <i class="icon" ng-attr-data-icon="message.icon"></i> also didn't work. any ideas? what when this? var icon = $sce.trustashtml('&#x020;'); console.log(icon); $scope.message = icon; how instead of var icon = $sce.trustashtml('&#x020;'); you do: $scope.someuniqueiconname = $sce.trustashtml('&#x020;'); then in html do: <i class="icon" data-icon="{{someuniqueiconname}}"></i> or <i class="icon" ng-attr-data-icon="someuniqueiconname"></i>

Scale background image over X11 window -

now want scale background image, stretch until fits while size of x11 window. there xlib api offers or have "manually"? have data of image stored in vector of unsigned chars , can play before set background don't know how that. image smaller or bigger window. hints or examples? new code i found code here i tried adapt it. image data stored in vector <unsigned char> variable vector<unsigned char> image; int width = 600; int height = 400; int new_width = 820; int new_height = 420; lanczos_size = 3.0; double col_rat = static_cast<double>(width) / static_cast<double>(new_width); double row_rat = static_cast<double>(height) / static_cast<double>(new_height); vector<unsigned char> himage(new_width * height); (unsigned int r=0; r<height; r++) { (unsigned int c=0; c<new_width; c++) { double x = static_cast<double>(c) * col_rat; int floor_x = static_cast<int>(x); himage[r ...

jquery - Get a list of markers in bounds of google map using markerclusterer v3 -

i have google map populated data database. using markerclusterer v3 cluster markers make map load faster. have scoured docs , cannot seem find way listing of markers in map bounds. trying create external list of markers addresses in external div. on page load appends whole list of addressees. have markers, , markers contained in clusters appear on map @ time appear in list. @ zoom 13 there 6 clusters 3 in each , 1 solo marker. @ zoom 14 there 3 clusters of 3 , 2 solo markers. @ zoom 13 there 19 addresses in list , @ zoom 14 there 11 addresses in list. list of markers in bounds of map. load addresses once on initial map creation. thought of creating ajax post server on each zoom, thought little unnecessary have server call on each map movement. there has way list of markers in bounds controlled markerclusterer. .js var markers = []; (var = 0; < data.coords.length; i++) { var dataind = data.coords[i]; var latlng = new google.maps.latlng(dataind[1],dataind[2]); ...

c++ - How to implement recursive "using"/extract template parameters -

so asked question deleted it, found interesting challenge. they had weird type, , had run problem concat , range castable sequences not sequences (for obvious reasons) template<unsigned... is> struct sequence{}; template<typename... is> struct concat{}; template<unsigned... is> struct concat<sequence<is...>> : public sequence<is...> {}; template<unsigned... is, unsigned... js, typename... rest> struct concat<sequence<is...>, sequence<js...>, rest...> : concat<sequence<is..., js...>, rest...> {}; so figured it'd interesting challenge right, making same type. so first pass @ concat ran unexpected problems...how on earth 1 extract template parameters sequences? ended using function below: template <unsigned... is,unsigned... js> constexpr auto concat_results(sequence<is...>,sequence<js...>) -> sequence<is...,js...> { return sequence<is...,js...>(); } templ...

jquery - Javascript fetch JSON array -

i'm trying fetch json-array via ajax. test.php returns: [{"name":"james","age":24},{"name":"peter","age":30}] my javascript looks this: var persons=new array(); $.getjson("../../api/test.php", function(data){ $.each(data, function(index,value){ persons.push(new person(value.name,value.age)); }); }); problem when later call persons.length, cannot read property 'length' of undefined. when copy/paste output of test.php browser local variable, works fine: var content=[{"name":"james","age":24},{"name":"peter","age":30}]; for(var i=0; i<content.length; i++) persons.push(new person(content[i].name,content[i].age)); what doing wrong? this issue scope. if "var persons" declared within function in function's scope. double check declared, , trying access it. f...

mysqli - simple update syntax error mysql -

here update string. cannot figure out syntax error though pretty simple query. update building set building_name='1901' building_lead_user='29' building_maint_user='23' building_id='4' limit 1 building field type allow null default value building_id int(6) no building_name varchar(30) yes building_lead_user int(6) yes building_maint_user int(6) yes status int(1) unsigned zerofill yes you're missing commas separate fields you're updating: update building set building_name='1901', building_lead_user='29', building_maint_user='23' building_id='4' limit 1

java - Remove jsonobject from jsonarray -

i new android.i have simple string this: string json={"time":"12.00", "data":"25/01/2014","users": [ {"id":1231,"title":"hello","url":"world"}, {"id":7656,"title":"hello","url":"world"}, {"id":3356,"title":"hello","url":"world"} ],"is_valid":false} and need remove second users jsonobject: {"id":7656,"title":"hello","url":"world"} so try following: jsonobject json=new jsonobject(json); jsonarray users=json.getjsonarray("users"); users.remove(1); json.put("users",users); string new_json=json.tostring(); but unfortunately application forced close every time when use users.remove(1); method please me. i need following string after removing object: string new_json= tring json={"time":...

javascript - ng-hide ng-show clarification needed -

i have 2 forms in 1 page client side web app in angular js/javascript i got 2 forms <form class="simple-form" ng-submit="createuser()"> log in as: <input type="text" ng-model="name.username"> <input type="submit"/> </form> the createuser() method pushing object array of objects. $scope.createuser = function createuser() { var safer = angular.copy($scope.name); $scope.users.push(safer);}; $scope.users = [ {'username': 'john'}, {'username': 'dan'}, {'username': 'judy'}, {'username': 'michael'}, {'username': 'rebecca'}, {'username': 'macy'}, {'username': 'ross'} ]; i have form message container, want submit message show when new user got created <div class="message_container"> <p ng-repeat="message in messa...

ios - AFNetworking miss implemetation -

afhttprequestoperationmanager has implementation: - (afhttprequestoperation *)httprequestoperationwithrequest:(nsurlrequest *)request success:(void (^)(afhttprequestoperation *operation, id responseobject))success failure:(void (^)(afhttprequestoperation *operation, nserror *error))failure { afhttprequestoperation *operation = [[afhttprequestoperation alloc] initwithrequest:request]; operation.responseserializer = self.responseserializer; operation.shouldusecredentialstorage = self.shouldusecredentialstorage; operation.credential = self.credential; operation.securitypolicy = self.securitypolicy; [operation setcompletionblockwithsuccess:success failure:failure]; return operation; } when use method, success , failure blocks never call. after put line in implementation: [self.operationqueue addoperation:operation]; it works. why afne...

Clear contents of a file in Java using RandomAccessFile -

i trying clear contents of file made in java. file created printwriter call. read here 1 can use randomaccessfile so, , read somewhere else in fact better use calling new printwriter , closing overwrite file blank one. however, using randomaccessfile not working, , don't understand why. here basic outline of code. printwriter writer = new printwriter("temp","utf-8"); while (condition) { writer.println("example text"); if (clearcondition) { new randomaccessfile("temp","rw").setlength(0); // although solution in link above did not include ',"rw"' // compiler not accept without second parameter writer.println("text written onto first line of temp file"); } } writer.close(); running equivalent of above code giving temp file contents: (lets imagine program looped twice before clearcondition met) example text example text text written onto first line of temp file note: writer...

objective c - iOS ibaction code not being triggered due to segue in iOS -

i trying trigger segue , move new view based on result of asynchronous task. i have setup segue connecting button in initial view , dragging next view. have setup ibaction on initial button triggers asynch task. think these 2 things possibly in conflict. my ibaction code looks like: - (ibaction)buttonclicked:(id)sender { nslog(@"button clicked"); [user signupinbackgroundwithblock:^(bool succeeded, nserror *error) { nslog(@"in process"); if (!error) { nslog(@"succcess"); [self performseguewithidentifier:@"myid" sender:@"success"]; }else{ nslog(@"failure"); } }]; only first button click log prints. others not. my segue methods not have logic. the segues fire without hitting performsegue method above. how can control segue transition methods button click? how can have signup method called , have segue fire?

ajax - Yii Framework Post and comments associated -

i'm new in yii framework , render commments associated given post. tried find solution until now, cannot figure out how it. i have list of posts , when click link want list associated comments without refreshing page. to clear, have following post 1 my post 1 description .......................... comment (1) post 2 my post 2 description .......................... comment (3) post 3 my post 3 description .......................... comment (5) and when click comment (3) of post 2, want following my post 1 description .......................... comment (1) post 2 my post 2 description .......................... comment (3) comment 1 comment 2 comment 3 post 3 my post 3 description .......................... comment (5) ... any appreciate you need use chtml::ajaxlink() there plenty of examples on linked article populate div, under post.

c++ - Emscripten error when compiling double comparison function 'IsAlmostEqual' -

i'm novice in using emscripten , encountered error in compiling cpp file. i have iae.cpp: bool isalmostequal(double a, double b) { //http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm long long aint = reinterpret_cast<long long&>(a); if (aint < 0) aint = -9223372036854775808ll - aint; long long bint = reinterpret_cast<long long&>(b); if (bint < 0) bint = -9223372036854775808ll - bint; return (std::abs(aint - bint) <= 10000); } i tried compile using emscripten: emcc iae.cpp but generates following warnings , errors: info root: (emscripten: running sanity checks) warning root: java not seem exist, required closure compiler. -o2 , above fail. need define java in ~/.emscripten iae.cpp:5:27: warning: integer constant large unsigned if (aint < 0) aint = -9223372036854775808ll - aint; ^ iae.cpp:7:27: warning: integer constant large unsigned if (bint < 0) bint = -922...

asp.net mvc - why when my action returns a view - it passes first through a javascript function -

in index view have button javascript function when it's clicked: <script> function addcat() { $.ajax({ type: "get", url: '@url.action("addcategory")', data: {}, }); } </script> @html.dropdownlist("languages", new selectlist(model.lstlanguages, "languageid", "name", session["langid"] ?? "1"), new { id = "ddllanguages" }) <div id="categoriesplace"></div> <input type="button" id="btnaddcategory" onclick="addcat()" value="addcategory" /> when click on button, see should redirected addcategory action, adds record in database , returns addcategory view. problem when reaches drop-down in addcategory view, goes straight addbtn_click() function if it's clicked , redirects me index action. can explain behavior? so, here categorycontroller : pu...