Posts

Showing posts from May, 2013

windows - Setting Writable Permission only for Administrators inside PROGRAM_DATA folder -

i've been experimenting lot of headaches implementing behavior permission in windows 7. i have following directory structure (inside program_data): c:\programdata\foo\ c:\programdata\foo\test1\ c:\programdata\foo\test2\ the root folder has permission everyone. , shall because can write new files @ level of foo folder. the test1 folder has permission everyone. the test2 must have following rule: folders/files must writable administrators, , can read. rule shall applicable test2 folder itself. now, everyting works well, except case: everyone can rename test2 folder. of course, favor can renamed it, create new folder it's same name , on (an attack). is there solution? maybe strange combination of permissions?

msbuild - Adding specific references from a NuGet Package -

i have created package bunch of assemblies provide our users. want our users able pick , add references need within package project. user should able add package @ solution level , pick references added each project package added. possible nuget? example: mypackage - contain foo.dll, bar.dll, bla.dll user installs package "mypackage" solution project 1 - select , add reference foo.dll, bar.dll project 2 - select , add reference bla.dll currently, every reference of package added every project. not desired setup. want selected references added. there way nuget? nuget not designed work way. packages whole delivery units. our recommendation in scenario package individual assemblies according how want them individually installable.

mysql - update row base on other table row -

i had sucked @ sql query have 2 tables , 2 rows 1 table user_sets , second user_profiles need update user_sets row base on row of user_profiles table. give example. db structure table user_sets row n_color_pack ------------- table user_profiles row gander --------------------- query: update user_sets set n_color_pack = 1 user_profiles, user_sets gander = '0'; so see, update user_sets table setting n_color_pack 1 has gender 0. you need join tables achieve this. should work (untested): update user_sets s inner join user_profiles p on s.id = p.id set s.n_color_pack = 1 p.gander = 0 change s.id , p.id depending on column connects 2 tables in case. (credit ruakh pointing out syntax error)

java - Bind two generic types -

i have question regarding generics. have following interfaces: public interface interfacea<b extends interfacea.interfaceb> { public interface interfaceb<a extends interfacea> { void seta(a a); } } and following abstract implementation of interfacea : public abstract class aimplone<b extends interfacea.interfaceb> implements interfacea<b> { private final b b; public aimplone(b b) { this.b = b; b.seta(this); // <-- unchecked call... } } its clear me, call b.seta(this) unchecked - don't it, tried second abstract implementation: public abstract class aimpltwo<a extends interfacea, b extends interfacea.interfaceb<a>> implements interfacea<b> { private final b b; public aimpltwo(b b) { this.b = b; b.seta((a)this); // <-- unchecked cast } } and again, clear me, call b.seta((a)this) uncheck cast. but how should implemented or redesigned in orde

mysql - What is more efficient(speed/memory): a join or multiple selects -

i have following tables: users userid|name items itemid|userid|description what want achieve: want read database users , items (an user can have multiple items). data want stored in structure following: user { id name array<item> } where item is item { itemid userid description } my first option call select * users , partially fill array users , after each user select * items userid=wantedid , complete array of items. is approach correct, or should use join this? a reason don't want use join have lot of redundant data: userid1|name1|itemid11|description11 userid1|name1|itemid12|description12 userid1|name1|itemid13|description13 userid1|name1|itemid14|description14 userid2|name2|itemid21|description21 userid2|name2|itemid22|description22 userid2|name2|itemid23|description23 userid2|name2|itemid24|description24 by redundant mean: userid1,name1 , userid2,name2 is reason justified? later edit: added title speed or memory when talking efficienc

visual studio 2010 - Do we still require separate licence for TeamExplorer as Standalone client if already have vs2010 -

we have visual studio 2010 premium edition on our systems , can succesfully use team explorer build in it. want use team explorer separatly. how can install separatly without installing vs2010 on user machines or can separate vs2010 , team explorer if installed. still need have separate licence per user. know have team web access need team explorer independently. please guide. i have read following posts still not clear: standalone gui client tfs 2010 source control does free team explorer client work without visual studio if have tfs client access license (cal) these users, can use standalone team explorer @ no additional cost . you should have cal users if they're using tfs web access, yes, should able use standalone team explorer.

qt - listview doesn't appear in TabGroup QML? -

how can make listview in qml appear in tab . use code in application n9(meego) need use in symbian . made changes when transformed meego symbian no listview appears. please . note : same listview appears when don't use tabs !!! my code: import qtquick 1.1 import com.nokia.symbian 1.1 import com.nokia.extras 1.1 import "uiconstants.js" uiconstants page { id: mainpage orientationlock: pageorientation.lockportrait tools: tabbar { // platformstyle: tabbuttonstyle { } tabbutton { text: "tab 1" tab: tab1 } tabbutton { text: "tab 2" tab: tab2 } tabbutton { text: "tab 3" tab: tab3 } tabbutton { text: "tab 4" tab: tab4 } } tabgroup { id:

MongoDB Replica Set status from PHP -

is there way output of "rs.status();" php driver? passing following setting command function of mongodb driver array('replsetgetstatus'=>1) results in error message: array ( [0] => access denied; use admin db [1] => 0 ) you can reuse same connection; have admin db object: $connection->admin->command(array("replsetgetstatus"=>1) if haven't already, you'll need create database connection object 'admin' db can call output of rs.status() through driver specified. mongodb://[username:password@]host1[:port1][,host2[:port2:],...]/db see docs here

javascript - How to set focus on the last element for which the window pop ups on error -

on checking field against validations, if validation fails , pop window opened.now when close pop pop should return focus last element(in case more 1 validation fails more 1 text field). suggestions ? code is:- function submitformfinal(frm) { var message; var inputs = frm.getelementsbytagname("input"); (var i=0; < inputs.length; i++) { if (inputs[i].getattribute('type') == 'text') { if(!checkspecialchars(inputs[i].value)) { message = " special characters found in element = '"; message += inputs[i].getattribute('name') + "'\n"; // alert(message); // createpopup(message); mypopupwin(message); } } } // return true; } function checkspecialchars(fileonlyname) { if ((/[^a-z0-9\.]/gi).test(fileonlyname)) { return false; }

asp.net mvc - MVC ModelState.Clear isn't updating ModelState -

in mvc program, once user has submitted edit form, values object saved in model server-side, previous values show in view. i know has mvc's validation process, first checks modelstate before server side values. solution i've read across forums clear modelstate. problem is, modelstate.clear isn't working me. help please. model public class { [hiddeninput(displayvalue=true)] public int helpid { get; set; } [required(errormessage = "please enter proper url")] public string url { get; set; } [required(errormessage = "please enter content description:")] [datatype(datatype.multilinetext)] public string helpcontent { get; set; } /*? 2 properites nullable*/ public datetime? createdatetime { get; set; } public datetime? modifieddatetime { get; set; } } controller /*create admin controller*/ public class admincontroller : controller {

How to find out where error occurs in Inno Setup script? -

one of users sent error report installer has crashed following error: runtime error (at 34:1346): type mismatch the installer uses inno setup. investigation showed bug caused error has been contained in installer.iss. where can error located if know "34:1346" ? that error location in compiled bytecode of script , such pretty impossible track line of code. if can reproduce it, should launch installer /log=filename command line option , can take such file.

jQuery doesn't properly update contents of the span tag -

here's example: http://jsbin.com/izegoy problem: http://i.imgur.com/h1t98.png script: $(document).ready(function(){ $("p:eq(1)").hide().after("<span>view more</span>"); $("span").click(function(){ $("p:eq(1)").slidetoggle(200,function(){ if($("span").text()=="view more"){ $("span").text("view less"); } else{ $("span").text("view more"); } }); }); }); html: <p>lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> <p>lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> when update contents of span tag, creates new text outside of original span tag. it's not noticeable on page, when @ generated

ASP.Net MVC4 Mobile-Aware OutputCache -

i'm working on upgrading application mvc3 mvc4 , noticed assumed (hoped?) "just work". code: [outputcache(duration = 600, varybyparam = "none")] public actionresult index() { return view(); } this textbook caching example asp.net. whenever browser hits page, checks cache see if exists, generates view if not, , sends cached results. this works great; however, playing around mobile view functionality of mvc4, noticed above code not check see if request mobile device. if hit route on desktop, desktop view displayed on phone until cache invalidated. reverse true (if first hit page phone, desktop see mobile view instead). is there parameter use make work hoped or looking @ building customer outputcacheprovider? after bit more digging, found solution issue. updated controller action [outputcache(duration = 600, varybycustom = "ismobile")] public actionresult index() { return view(); } override getvarybycustomstring in glo

backbone.js - Backbone router not dispatched? -

i'm new in backbone 0.9.1. found when change hash , can not trigger hash change in demo. url http://[...]/backbone/#help. think should receive alert message "help", i'm not. $(function() { var app = { controllers:{}, initialize: function(){ new app.controllers.routes(); var h = new backbone.history(); h.start({root: '/backbone/'}); } }; app.controllers.routes = backbone.router.extend({ routes: { "help": "help", "search/:query": "search", }, help: function() { alert("help"); }, search: function(query) { alert("search"); } }); app.initialize(); }); is there misunderstanding or misuse? you don't need instantiate history object yourself. also, if you're not using pushstate, don'

jquery - Refreshing multiple Divs on same page -

lets have 3 divs on page. <div id='1'></div> <div id='2'></div> <div id='3'></div> currently i'm using fresh div: auto_refresh = false; if (auto_refresh === false) { auto_refresh = setinterval(function (){$('#1').load(thisurl + '&timer=' + new date().gettime() + ' #1' );}, 5000); } else { clearinterval(auto_refresh); auto_refresh = false; } and want refresh div 1 , 2 every 5 seconds, not div 3. how can using jquery? thing add is, id's of divs dynamic. like people have mentioned, want use setinterval . 1 way refresh not all, use class selector, rather id . if must use ids, need use rule exclude third div. i put refresh logic function, , call function inside of setinterval .

jquery - slideDown a div with anchor click then go to link -

i want have jquery div slide down on click of anchor tag, working want animate first , visit clicked link. possible? $('#portfolio').click(function() { $('#bodyg').slideup('fast'); }); $('#portfolio').click(function(e){ e.preventdefault(); var href = $(this).attr('href'); $('#bodyg').slideup('fast', function() { window.location = href; }); });

how to install django-sphinx-autodoc -

i have found django apps django-sphinx-autodoc in http://pypi.python.org/pypi/django-sphinx-autodoc ... i can't find docs on how install it do knows how install app? ubuntu's package repositories don't have django-sphinx-autodoc, have install yourself. if have pip or distribute installed, can use install pypi. distribute gives command easy_install , acts kind of package manager python. pip same thing, additional functionality. for you, can install with: sudo easy_install django-python-autodoc if have pip, can this: sudo pip install django-python-autodoc

c# - File existence check after a folder rename returns an incorrect value on UNC share -

on windows 7 (or server) box, have folder on unc share (cross machine unc, not localhost). rename folder, , check existence of file @ new folder location. though exists, takes 5 seconds file.exists return true on it. full repro can found on https://github.com/davidebbo/npmfolderrenameissue . here core code: // file doesn't exist yet // note presence of existence check triggers bug below!! console.writeline("exists (should false): " + file.exists("test/test2/myfile")); // create directory, file in directory.createdirectory("test/subdir/test"); file.writealltext("test/subdir/test/myfile", "hello"); // rename directory directory.move("test/subdir/test", "test/test2"); var start = datetime.utcnow; // list files @ new location. here, our file shows fine foreach (var path in directory.getfiles("test/test2")) { console.writeline(path); } (; ; ) { // simple existence test. should true, whe

yii - CheckAccess. Agile Web Application Development with Yii1.1 -

i need checkaccess function. i'm reading book agile web application development yii1.1 , php5 , , came page 212 . on page i've added "create user" menu item. login user associated project (in db table project_user_role) member, , members has operateion called ' createuser '. the problem can't see menu item should generated following code: if (yii::app()->user->checkaccess('createuser', array('project' => $model))) { $this->menu[] = array('label' => 'add user project', 'url' => array('adduser', 'id' => $model->id)); } thanks also authassignment there 2 more tables , having them not full deal. got have set rbac :). please see role-based access control

click - Move inline JQuery function to .js file -

i have following inline code move js file ... $("input.checkbox").live('click',function(dostuff){my code}) i have tried various ways no luck, function nothing when move .js file. when it's inline in works perfectly. quite new @ of gentle. 1- move code new js file did. 2- when referencing js file inside page, reference after jquery file, javascript executed according order of files included. <html> <head> <script type="text/javascript" src="your_jquery_file"></script> <script type="text/javascript" src="your_custom_file"></script> </head> <body> .. .. .. </body> </html> 3- try page now, should working fine. let me know if didn't fix it, or if did :)

php - How to set up a mailing list site manager to bulk send newsletter to customers -

i have mailing list form sign mailing list , input details database. want admin section user can create email within website , send people have signed mailing list. how can this? here code creating mailing list: <?php // start session handler require_once('dbfunction.php'); //connect database $conn2 = db2(); require_once('header.php'); /* * should proceed form (if page not submitted echo form) */ if (isset($_post['submit'])) { //detect if have errors or not $errors = false; $error_msg = "error, please try again"; if (!isset($_post['full_name']) || $_post['full_name'] == "") { $errors = true; echo "<p style='color: red; position: absolute; top:115.5em; right:28em;'>enter full name</p>"; } if (!isset($_post['email']) || $_post['email'] == "") { $errors = true; echo "<p style='color: red; position: absolute; top:120.1em; right:25.7em;

Android, listView items & ColorStateList -

remember colorstatelist xml? specify view use color if in state: something like: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:color="hex_color" android:state_pressed=["true" | "false"] android:state_focused=["true" | "false"] how enforce code: "hey view! in state! display accordingly!!" ?? my problem listview. want child appear clicked/selected, , neither of lines seem work: m_listview.getchildat(0).requestfocus(); m_listview.getchildat(0).setpressed(true); forgot this.. solution was: m_itemslistview.setitemchecked(0, true);

Silverlight CheckBox -

i want change background color of checkbox when checked instead of show icon have no idea of how this. i've tried create new "rectangle" different background color , call him on visualstate "checked" didnt work. my code : <style targettype="checkbox"> <setter property="background" value="{staticresource checkboxbackgroundbrush}" /> <setter property="borderbrush" value="{staticresource checkboxborderbrush}" /> <setter property="foreground" value="{staticresource normalfontbrush}" /> <setter property="horizontalcontentalignment" value="left" /> <setter property="padding" value="6,1,0,0" /> <setter property="verticalcontentalignment" value="center" /> <setter property="template"> <setter.value> <controltemplate t

scala - What is Lift's state idiom? -

i have read rest. when had overview of lift, seems lift: maintains state in (java ee application) server and needs server affinity in clustered environment lift's idea of statefullness seems distinct rest , kin. lift's state idiom? why need server affinity? become minefield if deviate fixed idiom? how come play in (and become advantage) in hypothetical concurrently-edited spreadsheet: a user edits cell in row. editor shows "syncing" cell user continues editing (asynchronously), , drops notification if data has been synced backing store . another user starts editing document. first editor gets notified. the first user edits row other guy has visible. other guy knows rows changed. an update: dave commented on exact reason server affinity: here , here . turns out foursquare, heavily trafficked site uses method. this discussed in lift in action happens. primary reason statefulness security: lift heavily dependant on in-memory state secu

python - In Flask, why are all the views shown in a single file? -

is there way split them (view per file) or not recommendable? i'm working on rather large project , have lot of views. thanks. you put views blueprints create nice , clear structure in flask application. there nice feature called pluggable views create views classes helpful rest api.

php - How do I give multiple users access to a single Amazon S3 account AND determine who's added a file? -

i have aws s3 account contains 3 buckets. need able generate access codes new user can access buckets , add/delete files (preferably own, not deal breaker). i have managed far granting access new users using iam. however, when read metadata of uploaded objects (in php using aws sdk) owner comes main aws account. i've read pages of documentation can't seem find relating determining owner (or uploader) of file was. any advice or direction massively appreciated! thanks. if problem find owner of uploaded file. you can pass owner info meta-data of uploaded file. check http://docs.amazonwebservices.com/amazons3/latest/dev/usingmetadata.html in php code while uploading : // instantiate class. $s3 = new amazons3(); $response = $s3->create_object( $bucket, $keyname2, array( 'fileupload' => $filepath, 'acl' => amazons3::acl_public, 'contenttype' => 'text/plain', 'storage' => amazo

Getting text from Dynamically created button :Android -

i created buttons dynamically, assigned url address obtained handlers settext(). not able text of button,if clicked,since arg.gettext() not working in onclicklistener. there way text of button created dynamically ( = 0; <itemlist.gettitle().size()-1; i++) { title[i] = new textview(this); title[i].settextcolor( -16711936 ); title[i].settextsize(18); title[i].settext("title = "+itemlist.gettitle().get(i)); description[i] = new textview(this); description[i].settextcolor(-16776961); description[i].settext("description = "+itemlist.getdescription().get(i)+"......"); more[i]=new button(this); more[i].settext(itemlist.getlink().get(i)); layout.addview(title[i]); system.out.println("title view set"); layout.addview(description[i]); //system.out.println("description view set"); layout.addview(more[i]); more[i].setonclicklistener(listener); } private onclickl

php - Global data array in Codeigniter -

i have array $meta = array( 'meta_description' => 'lorem ipsum', 'meta_keywords' => 'this, is, a, keyword' ); if have in controller method, can pass partial so: $this->template->set_partial('header', 'layouts/header', $meta) , passes fine. i store meta tags in database, i'd ideally put in my_controller , populate array based on database values post's meta tags. if move outside of controller method, message: undefined variable: meta error. how can make globally available? i think figured out. i created new model handling meta data, insert following my_controller's construct method: $meta = $this->meta_data_model->get_item_meta(); $this->template->set_partial('header', 'layouts/header', $meta); this seems work fine, not sure if there better way of doing it.

java - Should we explicitly kill a thread? -

i create 3 threads in main program. have loop in each thread. after executing statements in run() method , each thread automatically gets destroyed or killed itself. correct? understanding correct ? is there java standard reference mentions there no need explicitly kill thread , itself. have been trying read , browse many articles. still not getting 100% confidence. i highly appreciate if expert on here reply , me out. in advance!!! public class demo { testa = new testa("testa",threadalist); testa b = new testb("testb",threadblist); testa c = new testc("testc",threadclist); } class testa implements runnable { thread t; public testa(string name,list threadalist) { system.out.println(name); this.threadalist = threadalist; t = new thread(this); t.start(); } public void run() { try { system.out.println("testa thread started"); } catch(exceptio

ruby - How to make minitest stop execution on failure? -

i using minitest runner functional tests, using selenium driver run browser. each test modeled minitest::unit::testcase. minitest reports summary of execution when completes executing tests. exceptions encountered printed towards end of execution. find difficult debug when unexpected fails context of execution lost. exceptions running not deterministic. is there way make minitest runner stop execution of tests on exception or assertion failure? i using minitest (2.11.2) , ruby 1.9.2p290 (2011-07-09) [i386-mingw32] i think mean have "fast fail" option available. found fail_fast minitest (test::unit): immediate backtrace & exit article, that's out of date (still covers can done). think you'll need monkeypatch testing library enable option. found gist showing how add simple fail-fast option minitest/turn/minitest-rails might on right track. understand problem first article i've referenced: when run test::unit suite in ruby on rails 3 pro

css - Keep <img> always at the end of text line -

is there css workaround make pdf/doc/ppt icon sit @ end of text line, without using background image? when there not enough space icon image, sit in second line alone. i'm wondering if there similar white-space:nowrap ? <ul> <li> <a href="v1.pdf">lorem ipsum simaorem ipsum. (3mb, pdf)</a> <img src="images/pdf.gif" /> </li> </ul> <ul> has fixed width. images text, or “inline content,” perspective of layout. thus, can use same techniques preventing line breaks in text. nobr markup prevents line breaks , works universally in browsers, though standards-writers have frowned upon it. if needed can use standardized, less reliable, more verbose sister: white-space: nowrap in css, inline markup span . here problem need “overlapping” markup: ... (3mb, <nobr>pdf)</a><img ...></nobr> (i.e., open nobr element inside a element close a before nobr ). while

php - Notice (8): Indirect modification of overloaded property -

after upgrade cakephp 1.3 2.1. got error notice (8): indirect modification of overloaded property threadscontroller::$data has no effect help me... $this->data provided in controller bc way read data. using write data way you're doing result in angry php. because of way __get() works, in returns read-only versions of data fetches. you should able use upgrade shell update $this->data --> $this->request->data. more information read this http://book.cakephp.org/2.0/en/appendices/2-0-migration-guide.html

derby - Learning SQL ... Is there a better way to write this? -

this question i'm trying answer... what team names of teams had 1 , 1 player appear in 145 or more games? here solution. select name teams teamid in (select original.teamid appearances original teamid not in (select one.teamid appearances one, appearances 2 (one.teamid = two.teamid) , (one.playerid <> two.playerid) , (one.gs > 144) , (two.gs > 144))); this works, i'm wondering if there cleaner/more efficient way write this. i'm using derby dbms. i'm not sure if query work. would expect more this: select name teams teamid in ( select one.teamid appearances 1 (one.gs > 144) , one.teamid not in ( select two.teamid appearances 2

Thread was being aborted Error ? In asp.net? -

in web application, using code, download documnet uploaded, written in item command event of datalist, s giving error "thread being aborted" can me solve this, thank you. code fallows. protected void dtlstmagazine_itemcommand(object source, datalistcommandeventargs e) { try { objitmagbe.titleid = convert.toint32(e.commandargument); dts = new dataset(); dts = objitmagbl.getmagzinebytitleid(objitmagbe); getpopularmagazine(); string myfile = "../xxxx/datafiles/" + dts.tables[0].rows[0]["files"].tostring(); if (file.exists(server.mappath(myfile)) == true) { response.appendheader("content-disposition", "attachment; filename=" + myfile); response.transmitfile(server.mappath(myfile)); response.end(); response.flush(); } } catch { } } your response.end() causing that. because telling asp.net request over. what stack trace exception, .net thin

html5 - Knockoutjs validation and server validation -

hi i'm kind of new knockoutjs, in scenario want post form have example email address, there requirement email address needs unique. on server check if email address unique or not , returns validationjson class example { isemailunique: false, ispasswordstrongenough: true; } how can knockoutjs validation show these errors in neat way? i use 2 different server side validators this, since affect different observables in view model. originally taken knockout validation readme ko.validation.rules['isemailunique'] = { validator: function(val, param){ var isvalid = true; $.ajax({ async: false, url: '/validation/isemailunique', type: 'post', data: { value: val, param: param }, success: function(response){ isvalid = response === true; }, error: function(){ isvalid = false; //however handle

c++ profiling of the g++ based application with libraries -

i'm trying find performance problems inside melt framework , affine transformations. i've tried 3 profilers: gprof, zoom , googleperfomancetools. i've compiled code disabled optimizations , explicitly removed inline functions changing ordinary functions. but of profilers getting me unresolved function names in call graph. in true of these functions time consuming. so question correct procedure profile g++ based application libraries thanks, you need compile program debugging info enabled (which assume did, mentioning nonetheless), install debug enabled versions of dependency libraries, , link program against them. in debian based linux environments, named original library, -dbg suffix. example, libxml2-dbg. hope helps.

Perl facebook graph giving Could not fetch access token: Bad Request at /usr/local/share/perl/5.10.1/Facebook/Graph/AccessToken/Response.pm -

i trying access token getting error as bad request @ /usr/local/share/perl/5.10.1/facebook/graph/accesstoken/response.pm line 26 following code use facebook::graph ; $fb = facebook::graph->new( app_id => $facebook_app_id, secret => $facebook_app_secret, postback => $postback_url, ); $uri = $fb ->authorize ->extend_permissions(qw(offline_access publish_stream)) ->uri_as_string; it successful redirecting postback url , getting code paramater my code in postback url / page use facebook::graph ; $fb = facebook::graph->new( app_id => $facebook_app_id, secret => $facebook_app_secret, postback => $postback_url, ); when doing $fb->request_access_token( $code ) ; i getting error not fetch access token: bad request @ /usr/local/share/perl/5.10.1/facebook/graph/ac

javascript events - How to Categorize virtual pageviews in Google Analytics? -

i checked in google analytics documentation in tracking events : _trackevent(category, action, opt_label, opt_value, opt_noninteraction) we can categorize events. using pop-ups login/register , handling these in analytics using concept of virtual pageviews . question is, there way categorize virtual pageviews (like register , login separately), couldn't found solution because pageviews have _trackpageview('url') , here have no parameter setting category. in advance. there couple of approaches: you add event virtual page view , log them both @ same time. you add prefix virtual page view such "/virtual/" + url

ruby on rails - Best practice for respond_with? -

i wondering best way handle http errors within respond_with method in rails: respond_to :html, :json # @my_resources = [] def index respond_with @my_resources end this action responding http 200 status code. http 204 "no content" response http request, , seems fit better correct answer original request of client (with json format). same behaviour happens other request , responses. linking w3's raccomendation 204 response code http://www.w3.org/protocols/rfc2616/rfc2616-sec10.html

Camel Apache: xpath to extract some value out of received XML -

during camel routes, query server (a http get) , result, receive 200 ok xml body looking similar this: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <userprofiles xmlns="http://www.mycompany.com/aecontext/xmldata"> <userprofile name="guest"> <userprofileattributes> <userprofileattribute name="parameter1" value="data1" namevisibility="all"/> <userprofileattribute name="parameter2" value="data2" namevisibility="all"/> <userprofileattribute name="parameter3" value="data3" namevisibility="all"/> </userprofileattributes> </userprofile> </userprofiles> any idea how able value of "parameter2" in xml part (in example 'data2') , store value in exchange property ? guess using xpath expression ? or ... help. an easy way retr

java - Message bundle intermittently not rendering correct -

in application trying labels out of message bundle. rather use constant key values using variables <c:foreach var="emailaddress" items="${emailaddresses}"> ... <c:set var="labelkey" value="contact_label_${emailaddress.type}"/> ... <h:outputtext value="#{faces_translations[labelkey]}"/> ... </c:foreach> most of time works correctly, every when page loaded of label not processed correctly , following message displayed: ???contact_label_??? it looks email.type not return value, added debug code print out value of email.type including ${emailaddress.type} and saw value returned. another thing tried remove value everytime before setting again inside loop using . resulted in following exception. verified had tag library included in war file (jstl-api-1.2.jar , jstl-impl-1.2.jar javax.faces-2.1.7). <c:remove> tag library supports namespace: http://java.sun.com/jsp/jstl/core, no tag defined name

django - How to restart Celery gracefully without delaying tasks -

we use celery our django webapp manage offline tasks; of these tasks can run 120 seconds. whenever make code modifications, need restart celery have reload new python code. our current solution send sigterm main celery process ( kill -s 15 `cat /var/run/celeryd.pid` ), wait die , restart ( python manage.py celeryd --pidfile=/var/run/celeryd.pid [...] ). because of long-running tasks, means shutdown take minute or two, during no new tasks processed, causing noticeable delay users on site. i'm looking way tell celery shutdown, launch new celery instance start running new tasks. things didn't work: sending sighup main process: caused celery attempt "restart," doing warm shutdown , relaunching itself. not take long time, doesn't work, because apparently new process launches before old 1 dies, new 1 complains error: pidfile (/var/run/celeryd.pid) exists. seems we're running? (pid: 13214) , dies immediately. (this looks bug in celery itself; i'

using ckeditor gem with rails nested attribute -

has been able use ckeditor gem (https://github.com/galetahub/ckeditor/issues/98) attached form builder object in nested form? gemfile: gem 'rails', '3.2.1' .... gem "nested_form" gem "ckeditor", "3.7.0.rc3" i extracted problem simple nested forms application, i.e. post.rb: has_many :comments accepts_nested_attributes_for :comments so try use ckeditor edit comments. view looks this: <%= nested_form_for(@post) |f| %> <%= f.label :post_content %> <%= f.text_area :post_content %> <%= f.fields_for :comments |cf| %> <%= cf.cktext_area :comment_content %> <% end %> .... a normal text area appears comment content. if switch "f.text_area" in post part of form "f.cktext_area" ckeditor appears post content. no errors appear in log when form rendered. am missing something? did generate ckeditor files with: rails generate ckeditor:models --orm=active_record --ba

Getting "junit.framework.AssertionFailedError: Forked Java VM exited abnormally" Exception -

i have java program junit test have written in netbeans ide testing class single thread. when going compile working fine , showing results 100% success, when trying run program getting exception - testsuite: glb.chatmeter.crawler.yahoolocal.yahoobusinessdatatest tests run: 1, failures: 1, errors: 0, time elapsed: 0.057 sec testcase: warning(junit.framework.testsuite$1): failed no tests found in glb.chatmeter.crawler.yahoolocal.yahoobusinessdatatest junit.framework.assertionfailederror: no tests found in glb.chatmeter.crawler.yahoolocal.yahoobusinessdatatest testsuite: glb.chatmeter.crawler.yahoolocal.yahoobusinessdatatest tests run: 1, failures: 0, errors: 1, time elapsed: 0 sec testcase: glb.chatmeter.crawler.yahoolocal.yahoobusinessdatatest:null: caused error forked java vm exited abnormally. please note time in report not reflect time until vm exit. junit.framework.assertionfailederror: forked java vm exited abnormally. please no

c++ - jsoncpp how to check if tag is null .isNull() throw assertion -

im using jsoncpp , great when need check if json structure contains tag when : userroot0["error"].isnull() its throws me assert json_value.cpp line 1025 json_assert( type_ == nullvalue || type_ == objectvalue ); i want check if response im getting type: { "error" : { "message" : "error validating application.", "type" : "oauthexception", "code" : 190 } } the [] operator valid jsonvalue objects of type object or null. others ( int , bool , array , etc.) assert. if userroot0 object array or other non- object type, have more work (like iterating sub-nodes) find target node may or may not contain error. print userroot0.tostyledstring() see json looks like, , make sure looks json object (see json.org nice overview of is). a "todo" comment @ top of json_value.cpp source file (where json_assert defined) implies developers may planning more rob

php - If Statements with radio buttons with CI -

how perform if statement inside of form_radio element code igniter? my goal whether or not user allow personal messages other members , want correct radio button loaded. options yes (value of 0) or no (value of 1) this tried , have come syntax error i'm not sure i'm doing correctly. <div class="input"> <?php echo form_label((form_radio('pmusers', '0', if ($user_settings[0]->members_can_pm == 0))) . 'yes', 'pmusers'); ?> <?php echo form_label((form_radio('pmusers', '1')) . 'no', 'pmusers'); ?> </div> don't check inline. also, universally, 0 = no , 1 = yes if($user_settings[0]->members_can_pm == 1){//can pm $canpm = 1; $cantpm = 0; }else{ $canpm=0; $cantpm=1; } echo form_label((form_radio('pmusers', '0',$canpm, 'pmusers')).'yes','pmusers'); echo form_label((form_radio('pmusers', '

javascript - Fancybox - How to load an image from a url? -

i wonder how can create lightbox loads image in page urls of links here code not work: $("a.picture").click(function() { $.fancybox({ 'padding' : 0, 'overlayshow' : false, 'transitionin' : 'elastic', 'transitionout' : 'elastic', 'titleposition' : 'over', 'type' : 'image', 'titleformat' : function(title, currentarray, currentindex, currentopts) { return '<span id="fancybox-title-over">' + (currentindex + 1) + ' / ' + currentarray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>'; } }); return false; }); and html code <a class="picture" href="http://localhost/test/my_page.html" title="picture page">link<

c++ - Instaling Web Toolkit(WT) on Windows -

i decided use webtoolkit framework 1 of projects, have hard time make work properly. i following this tutorial failed few times trying on microsoft visual studion 2010 , 2008. first time, installing on mvs 2010, managed hello world app working, when trying start more advanced examples failed so. time tried mvs 2008, fails compile @ all, giving me errors like: libboost_random-vc90-mt-gd-1_43.lib(random_device.obj) : error lnk2005: "public: static bool const boost::random_device::has_fixed_range" (?has_fixed_range@random_device@boost@@2_nb) defined in wtd.lib(wrandom.obj) my operational system windows 7. actions sequence same in tutorial linked above, @ first when cmake can't rid of red fields tutorial says: 'configure' again. few messages fcgi , wthttpd connector may pop up; click ok. few new configuration fields (in red) have popped up; leave them unchanged , press 'configure' once more. if went well, have no red fields left , conf

osx - Creating a simple Hello World tool that runs as a daemon -

i built command line tool (foundation) template in xcode. logs "hello world" console.there 1 class in main.m. here's code: #import <foundation/foundation.h> int main (int argc, const char * argv[]) { @autoreleasepool { // insert code here... nslog(@"hello, world!"); } return 0; } now want run daemon , log "hello world" console every 10 seconds. moved product/binary /tmp on mac. created following plist launchd: <?xml version="1.0" encoding="utf-8"?> <!doctype plist public "-//apple//dtd plist 1.0//en" "http://www.apple.com/dtds/propertylist-1.0.dtd"> <plist version="1.0"> <dict> <key>label</key> <string>hellodaemon</string> <key>programarguments</key> <array> <string>/tmp/hellodaemon</string> </array> <key>startinterval</ke

user interface - matlab, setting default figure size, but don't care about position? -

similar to: setting graph figure size but, want set width , height , without caring position. desired behavior can drag figure around @ will, on each re-draw size fixed. i don't method in above link because must provide (x,y) coordinate position, annoying code develops or use different computers. perhaps there smarter way use set() function? edit: cool @ answer below, here's updated function. other thing "silent" figure doesn't pull focus constantly. function h = sfigure(h,s1,s2) % sfigure create figure window (minus annoying focus-theft). % % usage identical figure. % % daniel eaton, 2005 % % see figure % % modified peter karasev, 2012, optionally set scale % if nargin>=1 if ishandle(h) set(0, 'currentfigure', h); else h = figure(h); end else h = figure; end if( nargin > 1 ) scalex = s1; scaley = s1; if( nargin > 2 ) scaley = s2; end pos = get(h,'position'); pos(3:4) = [400 3