Posts

Showing posts from June, 2015

timestamp - How to give priorities to Interrupt handlers in a normal linux kernel? -

i working on precise time stamping of packets being captured network. interrupt generated @ every packet reception. interrupt handler registered ethernet driver queues captured packets. have 2 questions who performs time stamping on each packet, interrupt handler or kernel processes packets queue. depending on task (interrupt handler or kernel, both being in kernel space) performs time stamping, how can increase priority in normal kernel (i.e. without using rt kernel)

css3 - Adding a border to an element with border-radius -

funnily enough isn't working me in firefox, ideas why border isn't showing? css .cue-points ul li a{ text-indent:-9999px; -webkit-border-radius: 180px; -moz-border-radius: 180px; border-radius: 180px; border:1px solid #000; display:block; height:15px; width:15px; } html <a href="#one">one</a> check .cue-points ul li a usually missing there thsi wil work fine a{ text-indent:-9999px; -webkit-border-radius: 180px; -moz-border-radius: 180px; border-radius: 180px; border:1px solid #000; display:block; height:15px; width:15px; } and if want use clas can write .cue-points or .cue-points li demo : http://jsfiddle.net/kougiland/qlmh3/

Filter logging raw post data in rails -

i have mobile app posting , receiving json rails app, problem raw json shows in log. there way filter it? you want add filter_parameters . here's default one: $ cat config/initializers/filter_parameter_logging.rb # sure restart server when modify file. # configure sensitive parameters filtered log file. rails.application.config.filter_parameters += [:password]

node.js - Facebook iOS SDK and passport-facebook authentication -

i'm trying implement server facebook authentication using passport-facebook on ios facebook sdk app, , i'm unclear how setup passport authentication on backend. basically ios client authenticates facebook , gets sessiontoken , want pass passport-facebook /auth/facebook/callback verify session token fb, , lookup user our database through node.js. is correct way use passport-facebook, or need call /auth/facebook (and parameters need pass it). this issue mentions building app using facebook ios sdk , authenticating on server, doesn't mention how that. https://github.com/jaredhanson/passport-facebook/issues/7 i write own custom passport strategy passes fb session token , can verify fb graph api on server fb user id , authenticate it's valid session, mentioned here: design facebook authentication in ios app accesses secured web service check out passport-facebook-token , designed authenticate based on issued token (ie, 1 issued ios app). passport-fac

objective c - #ifdef #else #endif choose iOS sdk version and function? -

i buliding dark themed ios 6 , 7 app. understand can call [[uiapplication sharedapplication] setstatusbarstyle:uistatusbarstylelightcontent]; make ios 7 status bar suit dark color theme application. the problem going submit app app store , xcode 5 not ready that, have use xcode 4.6.x task. xcode 4.6, not able compile new method ios 7. think have ""if ios7"" [[uiapplication sharedapplication] setstatusbarstyle:uistatusbarstylelightcontent]; , reposition application window. i trying #ifdef ... #else ... code [[uiapplication sharedapplication] setstatusbarstyle:uistatusbarstylelightcontent]; inside viewdidload . could understand how use #ifdef ... method in functions. thanks lot!!!! while i'm not 100% sure can answer without breaching nda, i'll best point in right direction. you need use __iphone_* #defines in availability.h #if __iphone_os_version_max_allowed >= __iphone_6_0 // ios 6+ code here #else // pre ios 6 code here

android - SearchView getActionView returning null -

this working few days ago, stopped. want use action bar search widget when fragment visible. now i'm unable searchview , getactionview returns null. searchable.xml <?xml version="1.0" encoding="utf-8"?> <searchable xmlns:android="http://schemas.android.com/apk/res/android" android:label="@string/app_name" android:hint="@string/search_for_places"> </searchable> manifest.xml <activity android:name=".ui.activities.mainactivity" android:launchmode="singletop"> <intent-filter> <action android:name="android.intent.action.main"/> <category android:name="android.intent.category.launcher"/> <action android:name="android.intent.action.search"/> </intent-filter> <meta-data android:name="android.app.searchable" android:resource="@xml/s

angularjs - Is there a easier way to include $dialog bootstrap-ui component into our code -

folks, i wondering if there better way include $dialog module in angular code. please @ plunkr : http://plnkr.co/edit/yxf1knmqhado3im8dfby all open modal upon clicking button. setting modal messy have put code in main controller (which testctrl incase of plunkr) does know how make directive can have in template click here open modal thanks, i can't see code, if create directive, can move controller code directive link function , output dom elements through template property of directive. even if don't want mess template replacement, can @ least move code controller directive , have modal html hidden area in main view. have done whenever have used modal. here plunkr did illustrates pulling controller code directive: http://plnkr.co/edit/3esmvm?p=preview

Xamarin.iOS UITableView, how do you force a cell to update? -

i using xamarin.ios , cannot figure out how update single cell. in wpf listview, can binding , have cell's properties inotifypropertychanged , automatically happens through binding. there equivalent functionality in xamarin.ios? seems super cumbersome update uitableview cells without wiping them out , re-adding them.. what best way update individual cells? assuming uitableview stored in "tableview" variable: nsindexpath[] rowstoreload = new nsindexpath[] { nsindexpath.fromrowsection(1, 0) // points second row in first section of model }; tableview.reloadrows(rowstoreload, uitableviewcellrowanimation.none);

c# - Crash when creating MenuItem in code (MonoMac) -

i trying add menu items submenu dynamically during runtime. can add nsmenuitem fine , shows up. if try add event handler, either directly argument constructor, or assigning activated event, crash. menu , submenu created in xcode. add/remove items in 1 specific submenu during runtime. the crash occurs when submenu drawn. right-click, move mouse on context menu until come item under dynamic submenu resides, , crash! the crash report quite long here's part think relevant: thread 1 (process 6706): #0 0x94f73095 in __wait4 () #1 0x9928699a in waitpid$unix2003 () #2 0x004a7d22 in mono_handle_native_sigsegv (signal=11, ctx=0xf6fe0) @ mini-exceptions.c:2344 #3 0x004f7645 in mono_arch_handle_altstack_exception (sigctx=0xf6fe0, fault_addr=0xc8080824, stack_ovf=0) @ exceptions-x86.c:1135 #4 0x00404061 in mono_sigsegv_signal_handler (_dummy=11, info=0xf6fa0, context=0xf6fe0) @ mini.c:6556 #5 <signal handler called> #6 0x98a83a8b in objc_msgsend () #7 0xbfffd920 in ?? ()

mef - Caliburn.Micro HelloScreens sample - using Ninject as IOC container -

love caliburn.micro helloscreens example, getting stuck mefs dependency injection. prefer use ninject familiar it. have read great articles on hosting mef in ioc container ( http://blogs.msdn.com/b/nblumhardt/archive/2009/03/16/hosting-mef-extensions-in-an-ioc-container.aspx)...but cannot simple example working caliburn.micro. what i'm looking way use ninject constructor injection along side mef. mef extension management. ninject constructor dependency injection. i'm looking working caliburn.micro bootstrapper incorporates mef , ninject? i'm looking working caliburn.micro bootstrapper incorporates mef , ninject? i have been using caliburn.micro long time , have came across every sample on internet uses it, , there no such sample. now recommend thing, using 2 containers in application @ same time pretty tricky pointed article well. so if either use mef handles lot of dependency injection tasks although not di container , of course supports extensi

java - How to compare Objects attributes in an ArrayList? -

i new java , have exhausted of current resources find answer. wondering if possible access objects first property see if matches particular integer? for example, trying obtain product within database searching it's product id. therefore, if create 2 products such as, product ipad = new product(12345, "ipad", 125.0, deptcode.computer); , product ipod = new product(12356, "ipod", 125.0, deptcode.electronics); (i have included product class below), , add them arraylist such as, list<product> products = new arraylist<product>(); how can loop through arraylist in order find product id? method working on: list<product> products = new arraylist<product>(); @override public product getproduct(int productid) { // todo auto-generated method stub for(int i=0; i<products.size(); i++){ //if statement go here //i trying: if (product.getid() == productid) { system.out.println(products.get(i)); } r

java - How to set oracle.net.ns.SQLnetDef.TCP_CONNTIMEOUT_STR -

i have googled , found lots of documents , web pages saying should set oracle.net.ns.sqlnetdef.tcp_conntimeout_str 3 seconds. unable locate example of how that. is system level property can set -doracle.net.ns.sqlnetdef.tcp_conntimeout_str=3 or what? properties file? spring config example? i have plain java application ojdbc.jar in classpath. beans configured/wired using spring xml. <bean id="mydatasource" destroy-method="close" class="org.apache.commons.dbcp.basicdatasource"> <property name="driverclassname" value="${my.jdbc.driverclassname}" /> <property name="url" value="${my.jdbc.url}" /> <!-- cut --> </bean> to set oracle connection timeout @ socket level basicdatasource 1) use latest basicdatasource -> commons-dbcp-1.4.jar 2) jdbcdriver version > 10.1.0.5 add property &ltproperty name="connectionproperties" value

javascript - Cancel page scroll when using hash in links. -

i made tabs jquery. , need able link exact tab. it's done.(code below) problem faced can't prevent page scroll after switching tabs. how can disable scroll still use hash? <ul class="tabs group"> <li> <a id="komp-link" class="switch" href="#komplekti">komplekti</a> </li> <li> <a id="intern-link" class="switch" href="#internets">internets</a> </li> <li> <a id="iptv-link" class="switch" href="#iptelevizija">ip televizija</a> </li> </ul> <div id="komplekti">content 1</div> <div id="internets">content 2</div> <div id="iptelevizija">content 3</div> // tabs switch $('#komp-link').click(function(){ $('#komplekti').show(); $('#internets').hide();

opencl - How do you read arguments passed to a native kernel? -

i have native kernel setup don't know how convert void* argument useful. in native kernel of snippet, how int (7) or int[] (16 ints set 0)? void __stdcall nativekernel(void * args) { int a1 = (*(int*)args); cout << "a1-->: "<< a1 << endl; // gibberish } void kernelcaller() { const int dim1size = 16; int dim1[dim1size] = {}; cl_int status = 0; cl_mem mem_d1 = clcreatebuffer(*context, 0, sizeof(int)*dim1size, null, &status); clenqueuewritebuffer(*queue, mem_d1, cl_true, 0, sizeof(int)*dim1size, dim1, 0, null, null); const void* args[2] = {(void*)7, null}; cl_mem mem_list[1] = {mem_d1}; const void* args_mem_loc[1] = {&args[1]}; cl_event run; status = clenqueuenativekernel(*queue, nativekernel, args, 2, 1, mem_list, args_mem_loc, 0, null, &run); status = clenqueuereadbuffer(*queue, mem_d1, cl_true, 0, sizeof(int)*dim1size, dim1, 1, &run, null); for(auto = 0; != dim1siz

c# - Constructor in Constructor -

is there way how can in c#? can not use this(int,int) in c# code. can write me similar code in c# , same things? thank you! :) public class javaapplication2 { public static class someclass { private int x; private int y; public someclass () { this(90,90); } public someclass(int x, int y) { this.x = x; this.y = y; } public void showmevalues () { system.out.print(this.x); system.out.print(this.y); } } public static void main(string[] args) { someclass myclass = new someclass (); myclass.showmevalues(); } } there several things need changed if want translate c#: the main problem you've declared someclass static. won't compile because static classes cannot have instance members. need remove static keyword. to invoke constructor need use : this(...) after constructor parameters (or : base(...) invoke constructor of parent class). instea

php - When testing external Mysql connection, I get the CDbConnection failed to open the DB connection -

i've looked @ other questions , don't see 1 answers question, although many similar. i'm working through book web application development yii , php. i have php app, developed works connectionstring: $con = mysql_connect("10.6.186.140", "smucmap", " * ") or die("could not connect mysql server!"); i have app works on localhost using xampp , provided examples, using yii framework, works: 'db'=>array( 'connectionstring' => 'mysql:host=127.0.0.1;port=3306,dbname=cmi', 'emulateprepare' => true, 'username' => 'root', 'password' => '', 'charset' => 'utf8', ), but, when try change host, username , password make connection external database, error. mysql database on linux based host on godaddy, , pdo enabled in php.ini seems correct, i've spent days trying move, example trackstar app

swing - nullpointerexception error in java gui -

i new cs student learning java. trying make gui user enter number , display result. getting errors not familiar with. have tried searching in google didnt help. comment appreciated. thanks. main method person class import javax.swing.jframe; public class person { public static void main(string[] args) { jframe frame= new guifirst();//line 6 frame.setdefaultcloseoperation(jframe.exit_on_close); frame.setvisible(true); } } guifirst class import javax.swing.jframe; import java.awt.event.actionlistener; import java.awt.event.actionevent; import javax.swing.jlabel; import javax.swing.jpanel; import javax.swing.jbutton; import javax.swing.jtextfield; public class guifirst extends jframe{ private jlabel label; private jlabel label1; private jtextfield text; private jbutton button; private jpanel panel; public guifirst(){ label=new jlabel("enter number"); setsize(450,10

servlets - Request forwarding contains result of the jsf page/bean that does the forward -

having strange problem request forwarding jsf bean. request being forwarded without issue. forward url page showing in browser correctly except that, @ bottom of page, contains result of forward jsf page. i've tried perform response.reset() before doing forwarding. still not working. i use balus's handy lifecyclelistner see going on. below see systemout o start phase restore_view(1) systemout o end phase restore_view(1) systemout o start phase render_response(6) systemout o manage bean doing forward systemout o in forward app systemout o end phase render_response(6) => render_reponse phrase i guess when comes render_response phrase, append jsf page end of forward page. my forwarding code looks below: public void forwardhttprequestto(string url) { try { httpservletrequest request = gethttpservletrequest(); httpservletresponse response = gethttpservletrespose(); try {response.reset();} catch (except

knockout.js - Using Underscore Template with Knockout using interpolate due to asp.net -

issue i need use underscore template instead of default knockoutjs template engine due performance. however, since i'm in asp.net environment default tags of <% , %> not work because of asp.net handler. working jsfiddle not working jsfiddle what need apply following: _.templatesettings = { interpolate : /\{\{(.+?)\}\}/g }; making use {{ , }} tags note 7: using underscore.js template engine the underscore.js template engine default uses erb-style delimiters ( <%= ... %> ). here’s how preceding example’s template might underscore: <script type="text/html" id="peoplelist"> <% _.each(people(), function(person) { %> <li> <b><%= person.name %></b> <%= person.age %> years old </li> <% }) %> </script> here’s simple implementation of integrating underscore templates knockout. integration code 16 lines long, it’s enough support knock

Jquery all checkbox select only works once -

i looked @ other threads didn't find solution work me. i'm trying select checkboxes here html: <input type="checkbox" id="selectall" onchange="toggleallworkers(this.checked);" />all<br> <input type="checkbox" class="emp" name="w0" value="1" onchange="buildpage();" />andrey <br> <input type="checkbox" class="emp" name="w1" value="4" onchange="buildpage();" />brian <br> <input type="checkbox" class="emp" name="w2" value="5" onchange="buildpage();" />eric <br> <input type="checkbox" class="emp" name="w3" value="3" onchange="buildpage();" />ken <br> <input type="checkbox" class="emp" name="w4" value="2" onchange="buildpage();" />kerry

html - javascript ussing ssh to run server program -

project: creating webpage connect server , execute command or program , retrieve output client web page. i have developed same functionality unsing socket_io , node.js.. every time have run first "node file.js" in client cmd , open webpage execute program sever. i there simple javascript automatically run automatically web opening webpage , connect server using ssh , retrieve output of , executable file instead of running files on cmd ,etc. you have running server javascript connect to. clear: javascript in browser can connect webserver, not arbitrary service on random server. instead, if wanted implement ssh in browser, have write server act proxy between webpage , target server. using javascript connect server using protocol other http

c# - Comparing two dictionaries and returning the differences in another dictionary -

i have 2 dictionaries , wish compare 2 dictionaries key / pair values. when compare them if value different in second dictionary want keep pairing , store dictionary3. so if have dictionary 1 ( <1,t><2,t><3,t> ) , 2 ( <1,t><2,f><3,t> ) want 3 ( <2,f> ). i not sure start one. have dictionaries getting data right not sure how set compare. private dictionary<int, bool> comparedictionaries(dictionary<int, bool> dic2) { dictionary<int,bool> dictionary3 = new dictionary<int,bool>(); foreach (keyvaluepair<int, bool> pair in dictionary1) { // keep keyvaluepair of dic2 // dictionary3.add(keyvaluepair of dic 2) } return dictionary3; } any on appreciated. pretty positive can accomplish goal dictionaries. down line after 3rd dictionary going update information in table , refresh list displaying part easier figure out methods , algorithm need part. very appreciated. thank guys.

ssas - Propagate the changes made in Analysis Service's Cube in Performance Point Dashboards -

i have several performance point dashboards in sharepoint 2010 made several cubes containing several measures , dimensions. earlier, measures , dimensions had long name. names has been shortened. after changes has been made in cubes, rather seeing new changes, seeing errors ever where. tested connections every cube in dashboard designers , looks fine. closed , re-opened dashboard designer did not help. redoing again long , hectic job. please let me know of workarounds have. thank you merin save worksapce dev machine workspace file (.ddwx). can selecting file --> save in dashboard designer. .ddwx file xml file can open in notepad. search , replace old dimension names new ones. open file in dashboard designer , re-publish.

php - Validate a form before sending it to paypal using jquery -

i looking advise in how complete task. trying implement (see example) in website. basically, form buy button paypal , before submitted, has validated. i not see problem. guidance appreciated. this have far! <form id="unlockform" action=""https://www.paypal.com/cgi-bin/webscr"" method="post"> <!-- identify business can collect payments. --> <input type="hidden" name="business" value="example@example.com"> <!-- specify buy button. --> <input type="hidden" name="cmd" value="_xclick"> <!-- specify details item buyers purchase. --> <input type="hidden" name="item_name" value="factory unlock iphone"> <input type="hidden" name="currency_code" value="usd"> <input type="hidden" name="bn" value="rcunlocks_buynow_unlock_us"> <!-- provide dr

java - How to use SVM in Weka? -

i'm trying use svm classifier in weka. when click on libsvm classifier , try train model based on provided training data, error libsvm classes not in classpath. the weka website has information on how fix i'm not sure how execute them. http://weka.wikispaces.com/libsvm i got libsvm.jar file link provided. i'm not sure file put in. you have set classpath variable knows find jar on local machine. if on windows right-click computer->properties->advanced system settings->environment variables , set under system variables. chances have classpath variable; add path of jar file end. reference: http://weka.wikispaces.com/classpath

ruby on rails - Form options as radio buttons or regular buttons? -

i'm new rails, doing few tutorials, , don't have background in web development, apologies in advance. i'm creating pretty simple app allows user select 1 of 3 available status updates. should store these 3 status updates string or integer? currently, postgres database stores statuses integers, though i'm curious if there's way can specify numbers 1, 2, or 3 can inserted. second question: want display form shows 3 buttons, each button corresponding specific, set status update. want button display string inside it's human readable, status update corresponding either 1, 2, or 3. user can choose status, change status they've selected if change mind before submitting, , hit submit button once they've made mind. should use radio buttons accomplish this? if so, how should make radio button displays text , saves integer? or should use normal button? many thanks! update: thanks @bot, able create hash defining human readable values corresponding st

c++ - Draw an item in a static location relative to the QGraphicsView -

Image
i draw notification appears in upper right corner of qgraphicsview . however, qgraphicsitems positions specified in scene coordinates, if user panned/zoomed view different part of scene, notification move off screen. i have figured out simulate behavior moving , scaling notification time current view changes. seems terribly ineffective , not @ elegant. it seems qgraphicsview should support kind of behavior. docs mention flag itemispanel sounds hopeful, mentions nothing static placement in view. itemignorestransformations scaling/zooming, not panning. is there built-in qt functionality supports behavior? the naive solution of having notification part of original scene bad - breaks model-view separation. can have multiple views, showing 1 scene, on 1 of them can notification appear desired. another simple way overlay qwidget notification on top of view. problem on architectures, overlaying regular qwidgets on top of accelerated qglwidgets make former disappear. n

sql - I need to calculate the difference from the TIME STAMP of each row for each unique DEFECT ID -

example: there new column named “time stamp delta”. 3rd defect id of 1013 have value in field it’s time stamp value minus value of time stamp in record precedes in time same defect id. value in "time stamp delta" column first defect of 1013 zero. defect_id detected closed time stamp 1013 1/2/13 12:00 1/15/13 12:00 1/2/13 2:20 pm 1013 1/2/13 12:00 1/15/13 12:00 1/14/13 3:47 pm 1013 1/2/13 12:00 1/15/13 12:00 1/15/13 3:30 pm 1014 1/3/13 12:00 1/10/13 12:00 1/3/13 9:06 1014 1/3/13 12:00 1/10/13 12:00 1/10/13 10:55 1014 1/3/13 12:00 1/10/13 12:00 1/10/13 3:31 pm 1015 1/8/13 12:00 1/8/13 12:00 1/8/13 10:46 1016 1/11/13 12:00 1/15/13 12:00 1/11/13 10:18 1016 1/11/13 12:00 1/15/13 12:00 1/15/13 3:28 pm 1017 1/16/13 12:00 1/17/13 12:00 1/17/13 11:11 1018 1/18/13 12:00

java - How to customize the request from HTML to Servlet -

i building server using java's servlet , html forms. i managed upload files: user reach html page, chose file he/she wants upload in his/her tree folder. file sent servlet i've written , downloaded on server (actually i'm running on localhost moment, server 'my documents' folder). the next step make one: user (once logged, manage that) reaches html page, select file hosted server , download it. to make it, have send 'download servlet' name of file. here questions: how list files in 'my documents' on html page. how send name of selected file servlet. how catch 'request' , make string of name out of it. to precise these 2 lasts points, please have @ this: list<fileitem> items = null; items = upload.parserequest(request); fileitem item = items.get(0); string filename = item.getname(); the block above catches name of folder in request. want do same thing if in request string (=catch string contained in request).

linux - How do I filter to match or exclude certain fields in Octave? -

how filter match or exclude fields in octave? using octave 3.0.5 on centos 5.8, need filter rows out of larger matrix various analyses. for example, have array looks this: a = { [ 0, 5, 32 ], [ 0, 3, 2 ], [ 1, 4, 13 ], [ 1, 2, 32 ], [ 2, 7, 99 ], [ 2, 0, 42 ] }; now need able extract rows first value equal 1, or maybe second value greater 3, etc. i've tried reading documentation , searching examples, i'm not seeing it. thanks! you can use cellfun go through cell array , index (binary): octave> cellfun (@(x) x(1) == 1 || x(2) > 3, a) ans = 1 0 1 1 1 0 using example: octave> a(cellfun (@(x) x(1) == 1 || x(2) > 3, a)) ans = { [1,1] = 0 5 32 [2,1] = 1 4 13 [3,1] = 1 2 32 [4,1] = 2 7 99 } an alternative may faster ditch cell array , use matrix instead (as long each cell in cell array have same size, matrix makes lot more sense, if

Python sort list with None at the end -

i have homogeneous list of objects none, can contain type of values. example: >>> l = [1, 3, 2, 5, 4, none, 7] >>> sorted(l) [none, 1, 2, 3, 4, 5, 7] >>> sorted(l, reverse=true) [7, 5, 4, 3, 2, 1, none] is there way without reinventing wheel list sorted usual python way, none values @ end of list, that: [1, 2, 3, 4, 5, 7, none] i feel here can trick "key" parameter >>> l = [1, 3, 2, 5, 4, none, 7] >>> sorted(l, key=lambda x: (x none, x)) [1, 2, 3, 4, 5, 7, none] this constructs tuple each element in list, if value none tuple (true, none) , if value else (false, x) (where x value). since tuples sorted item item, means non- none elements come first (since false < true ), , sorted value.

tcl/tk on mac os, Python IDLE won't start and Macport not working properly -

Image
i need someone's here. early, playing around homebrew, macport , active state tcl/tk after got new mac pro. somehow accidentally deleted tcl/tclsh folder when trying delete active state version of tcl. now problem when i'm trying install mongodb macport using: sudo port install mongodb it give me error says: so guess delete wrong file..is there way can back? tried install tcl/tk using active state package didn't work. help needed...! thanks the problem seems you've deleted (at least part of) system tcl/tk pre-installed apple.* macports explicitly uses apple's tcl (or own, if ask it, not activestate's or homebrew's or other). that's why it's looking /usr/bin/tclsh rather whatever tclsh on path. if dig inside mountain lion installer package, may able find , run tcl/tk installer manually, apple makes different (and harder) each release. easier thing run installer , let repair things you. * it's possible first repla

apache - Looking for Debugger for Railo 3.2 -

i looking debugger debug railo 3.2 application. apache web server forwards requests railo 3.2 running on top of tomcat via jk module library. i wonder if can setup breakpoints , debug code. i had @ fusion debug not suite railo 3.2.x. thanks advice in advance. fusion debug debugger know. mean doesn't "suite" railo 3.2? pretty sure works 3.1.x , above.

ruby on rails - Heroku Postgres query speed sanity check. Am I doing it wrong? -

i'm running rails website on heroku , doing performance profiling , improvements. i wondering if experience profiling postgres performance on heroku tell me if i'm doing wrong or if database call can expected slow. this select on table called cities has 3000 rows. there index on country_id. here's image showing profiling of slow call if can read image, you'll see i'm calling select name, slug,... "cities" "cities"."country_id" = 151. this call (in production on heroku) took 14.739 seconds according miniprofiler. call seems take anywhere 2 seconds 25 seconds correlation between number of cities country has (between 2 , around 50). in development takes fraction of second. i'm running heroku hosted postgres on $10 plan. right i'm thinking ajax-loading content call used on page, still makes no sense me shoiuld taking long. anyone have ideas? for reference, site can found @ www.istorical.com , call took place wh

Angularjs - Adding an attribute directive to a select clobbers ng-options -

i'm trying add attribute directive select using ng-options: <select ng-model="item.subcategory" ng-options="subcategory.name subcategory.name subcategory in getsubcategories(item.category)" monitor></select> at moment, doesn't meaningful: angular.module("monitor", []) .directive("monitor", function() { var directive = { restrict: "a", scope: { }, controller: function($scope) { console.log("i exist"); } }; return directive; }); the directive seems working, see "i exist" per item uses directive, select loses options. with directive in place, can see in html option select: <option value="?" selected="selected"></option> as opposed this, when not using directive: <option value="0" selected="selected">cats</option> <option value=&quo

c# - What Am I Missing About Reactive Extension Timers? -

i have this: watchers .toobservable() // needs observable .selectmany(watcher => // working on each watcher observable // create timer watcher .timer(watcher.starttime, timespan.fromhours(watcher.interval)) .selectmany(observable.fromasync( async () => new { watcher, result = await checkfolder(watcher.path) }))) .subscribe(x => console.writeline(string.format("watcher: {0}\tresult: {1}\ttime: {2}", x.watcher.name, x.result, datetimeoffset.now))); // tell happened. which nice little bit of code this post got me started down road. goal ping web service (via checkfolder() method) every time timer s publish, based on given start time , interval. the trouble is, every time run program outputs single message first watcher, , program exits without error. gets first answer, , it's finished. how wait other publications timers? i'm positive i'm not asking question right way, little feedback me refin

javascript - Backbone Collection View each -

i'm new backbone.js , getting trouble collection view. here's i'm trying do: var customerscollection = new _app.collections.customers(); var customersview = new _app.views.customers({collection: customerscollection}); customersview.render(); and here's view - can't understand why cannot iterate on collection: _app.views.customers = backbone.view.extend({ render: function() { console.log('here collection'); console.log(this.collection); console.log('now lets iterate on it...'); _.each(this.collection, function(item) { console.log(item); }, this); console.log('...done'); return this; } }); what see in chrome console: here collection child {length: 0, models: array[0], _byid: object, constructor: function, url: "/admin/customers/latest.json"…} _byid: object length: 5 models: array[5] __proto__: surrogate lets iterate on it... ...do

javascript - jQuery Mobile - Links and Radio buttons in Accordion not working -

i have site here . when there, click on student instructions , hit help button. when tries go document (a pdf on server), page comes undefined... url document correct. when refresh page, takes me document. why that? here's snippet part of page... <div data-role="collapsible-set" data-theme="c" data-content-theme="d"> <div data-role="collapsible"> <h3><img src="images/gear.png" style="vertical-align: middle; ">student instructions...</h3> <ul> <li>+ create goarmyed account. <a href="docs/ta- goarmyed-loi-walkthrough-suo-2-15-13.pdf"><span style="font-size:12px; font-family:verdana, geneva, sans-serif;">need walkthrough?</span><img src="images/walkthrough.png" style="vertical-align: middle;"></a></li><br>

internet explorer - ngRepeat $index is not displaying properly in IE 9 -

Image
the angular js docs ngrepeat directive supposed set $index variable item index in array. works fine in chrome , ie 10, ie 9 shows "{{$index}}" instead of number. here small example: <!doctype html> <html> <head> <meta charset="utf-8"> <title>host parameters</title> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.js"></script> <style> .host-param-table { border-collapse: collapse; } .host-param-table td, .host-param-table th { border: 1px solid gray; text-align:center; padding: 2px; font-size: 15px; font-family: arial; } </style> </head> <body id="ng-app" data-ng-app> <div data-ng-controller="hostparametersctrl"> <table class="host-param-table">

javascript - How to use an extra parameter as the z-index on Three.js? -

i using personalized ortographic projection matrix position objects, flat sprites. problem there no way derive depth of projection linearly positions: is, instead, result of topological sort of them. how can set depth of them independently positions? for meshes, can assign value object.renderdepth , , make sure renderer.sortobjects = true . this not work sprites, however. sprites sorted z-coord in camera space, when sprite.material.usescreencoordinates = false . three.js r.60

Use jquery to get a dynamic style value -

i playing idea of custom responsive slider , having difficulty getting slider container adjust on "resize". on intial load values correct when alert sliderwid on resize nan... why work on load not on resize? code same... thx var winwid = $(window).width(); $('.panel').width(winwid); var panelwid = $('.panel').css('width'); var panels = $('.panel').length; var sliderwid = parseint(panels) * parseint(panelwid) $('.slider').width(sliderwid); $(window).on('resize', function(){ var winwid = $(window).width(); var panelwid = $('.panel').width(winwid); var panels = $('.panel').length; var sliderwid = parseint(panels) * parseint(panelwid) //alert(sliderwid); //$('.slider').width(sliderwid); }); your problem on resize setting panelwid width value, returns jquery object. on load getting panel width returns integer. var panelwid = $('.panel').width(winwi

c# - Trouble matching two occurrences of the same pattern using regex -

i've got sql query string, , i'm trying find , replace on using regex. var s = "select ([document].[artifactid]) [document] (nolock) [document].[accesscontrollistid_d] in (1) , ((not exists(select codeartifactid codeartifact (nolock) associatedartifactid = [document].[artifactid] , codeartifact.codetypeid = 1000112))) "; //line breaks added readability in order query work, need specify schema of [document] , codeartifact. have: var pattern = "from\\s(?<table>\\s+)"; var replacepattern = "from eddsdbo.${table}"; var v = regex.replace(s, pattern, replacepattern); system.console.writeline(v); but string i'm getting looks like: select ([document].[artifactid]) [document] (nolock) [document].[accesscontrollistid_d] in (1) , ((not exists(select codeartifactid eddsdbo.codeartifact (nolock) associatedartifactid = [document].[artifactid] , codeartifact.codetypeid = 10

python - How can I have the equivalent of django's admin inlines in a modelform? -

django's admin allows create form editing model , foreign keys, if i'm using modelform in own view, i'm having trouble accomplishing this. here's example in admin.py: class vendorphotoinline(admin.stackedinline): model = vendorphoto = 3 class vendoradmin(admin.modeladmin): inlines = [vendorphotoinline] admin.site.register(vendor, vendoradmin) so in admin, can create vendor , add bunch of photos. non-staff, have form creating vendor, , i'd allow them upload photos admin. i'm using modelform allows users create new vendors, of course, can't add photos @ point: class vendorform(modelform): class meta: model = vendor how can achieve parity admin interface here? i'd settle solution works new vendor instances , allows uploading of number (say, 3), works existing instances , allows adding / deleting photos great too. help! you can use inline formsets . documentation: suppose have these 2 models: from django.db impo

sql - Prepared Statement INSERT JDBC MySQL -

i getting error on doing ' mvn tomcat:run " . error getting is: exception org.springframework.web.util.nestedservletexception: request processing failed; nested exception org.springframework.jdbc.badsqlgrammarexception: preparedstatementcallback; bad sql grammar [insert ibstechc_dev.device (key, ip_address, type, name) values (?, ?, ?, ?)]; nested exception com.mysql.jdbc.exceptions.jdbc4.mysqlsyntaxerrorexception: have error in sql syntax; check manual corresponds mysql server version right syntax use near 'key, ip_address, type, name) values ('abcd', 'abcd', 1234, 'abcd')' @ line 1 root cause org.springframework.jdbc.badsqlgrammarexception: preparedstatementcallback; bad sql grammar [insert ibstechc_dev.device (key, ip_address, type, name) values (?, ?, ?, ?)]; nested exception com.mysql.jdbc.exceptions.jdbc4.mysqlsyntaxerrorexception: have error in sql syntax; check manual corresponds mysql server version right syntax use near 

ruby - Guard-Uglify throws "only generation of JSON objects or arrays allowed" -

i'm trying uglify javascript using guard following errors: error - guard::uglify failed achieve , exception was: [#] json::generatorerror: generation of json objects or arrays allowed [#] c:/ruby193/lib/ruby/1.9.1/json/common.rb:216:in generate' [#] c:/ruby193/lib/ruby/1.9.1/json/common.rb:216:in generate' [#] c:/ruby193/lib/ruby/1.9.1/json/common.rb:352:in dump' [#] c:/ruby193/lib/ruby/gems/1.9.1/gems/execjs-2.0.0/lib/execjs/external_runtime.rb:53:in block (2 levels) in compile' [#] c:/ruby193/lib/ruby/gems/1.9.1/gems/execjs-2.0.0/lib/execjs/external_runtime.rb:51:in sub!' [#] c:/ruby193/lib/ruby/gems/1.9.1/gems/execjs-2.0.0/lib/execjs/external_runtime.rb:51:in block in compile' [#] c:/ruby193/lib/ruby/gems/1.9.1/gems/execjs-2.0.0/lib/execjs/external_runtime.rb:47:in tap' [#] c:/ruby193/lib/ruby/gems/1.9.1/gems/execjs-2.0.0/lib/execjs/external_runtime.rb:47:in compile' i'm using json 2.0.0(also tried 1.8.0) , mutli-

javascript - d3: use anchor elements as chart labels -

i getting started d3 , svg haven't found clear on how add hyperlinks. here code have write labels left of bars in d3 bar chart. there sample somewhere convert these labels hyperlinks (say objects in rangedata had href , name/label property)? searched around bit haven't gotten further svg spec adding anchor element. chart.selectall(".bar.barlabel") .data(rangedata) .enter().append("text") .attr("class", "bar") .attr("x", 0) .attr("y", function (d, i) { return height(i) + barheight(y, i) / 2; }) .attr("dx", -20) .attr("dy", ".35em") .attr("text-anchor", "end") .text(function (d) { return d.label; }); you can use a element achieve this, similar html itself. wrap content in a element , provide link target href attribute xlink namespace. chart.selectall("a") .data(ranged

Unable to publish message with Faye Ruby client -

first off, i've at: faye ruby client not working i tried recommendations , still not working me. heres code: def broadcast(channel, data=nil, &block) return if rails.env.test? if data.nil? && block_given? data = capture(&block) end client = faye::client.new(app_config['faye_url']) client.publish(channel, data) end i tried using net::http.post_form , server froze no errors or warnings or anything. i've tried putting em.run block no luck. can publish faye curl fine , sent on subscribers reason ruby client isn't working. i'm using faye-rails, ruby 1.9.3 , rails 2.3.13. the server behind nginx, tried both ngnix ip/port , thin ip/port. still didn't work. it works fine in development, not in production. update: i disabled both websockets , eventsource force use long polling work through ngnix without errors. it running rack middleware shouldn't need additional ports.

c++ - dereferencing typecasted void *object pointers -

with regards piece of code: #include <iostream> class cclass1 { public: void print() { std::cout << "this should print first" << std::endl; } }; class cclass2 { public: void print() { std::cout << "this should print second" << std::endl; } }; so asked interesting question having "free pointer" (so speak) can point multiple instances of different objects without having create new type of object. person had idea pointer can of type void * , since void, can made point instance of object , access object's public properties. the following solution submitted: int main() { void *pclass(null); ((cclass1 *)(pclass))->print(); ((cclass2 *)(pclass))->print(); std::cin.ignore(); return 0; } my question why above work, doesn't: int main() { (cclass1 *fg)->print(); (cclass2 *fg)->print(); std::cin.ignore(); return 0; } your fi

Rails: display of array as string in rails -

i have model field array. can store , retrieve database no trouble. when user creates or edits array want them see , edit comma separated list. there sensible reasons behind choice store array , have user interact list, plus edit records containing list/array. 99% of time edit record once, when create it, although may view many times, view times record not in edit mode not concerned performance hit coming using serialize. i know how split string array of strings, , know how join , array of strings make comma separated list. my dilemma revolves around split/join? in controller private methods called before display/before save, in model, or maybe form helper? i've no idea. advice appreciated. you don't need convert text. activerecord::base class macro serialize built such use case - saving arrays, hashes, , other non-mappable objects in text columns active record can serialize object in text columns using yaml. so, must specify call class method seriali

Error about the tr command of linux shell -

when type command : $ echo 1234567890 | tr '9-0' '9876' it says "tr: range-endpoints of '9-0' in reverse collating sequence order". mean? means can type "0-9"? yes, that's means. '9-0' isn't range, anymore 'z-a' range. otherwise, how know whether mean 0-9 or entire unicode range starting 9, going top of range , wrapping around 0?