Posts

Showing posts from June, 2012

java - JNotify dosen't recognize Files changed by Linux System -

i using jnotify in 1 of projects on linux system (arm7). , works great. if change, rename, delete or create file throws interrupt. jnotify informed if linux system change file itself. using beaglebone (embeded linux system). there file called value contains status of inputpin (high, low). if file changed system jnotify dosen't work... if change file self ok... know why change wasn't recognize in first case. linux seems use special way write file... yet dont't know how... need interrupt main loop if file changes. or there solution? thanks jnotify relies on events file system. linux it's using inotify system call (which inspired it's name). inotify works real file, file described virtual file not exist on disk , not way store information rather easy way access system information , change it). an alternative solution create sampling thread check file, sleep, , check file again. since care specific file, pretty easy. while may feel expensive, polling

css3 - issue in object selection in fabricjs when outer div is scaled -

i using fabricjs add text , images canvas.all canvases added in single div.when scale div using css3 transformation, canvases scaled items added in canvases scaled same proportion. the problem occurs when wish select of object. handler position remains same.below code snippet. <div id="designui" ng-style="transform:scale(2,2)"> <div> <canvas width="100" height="100"> </canvas> </div> </div>

How to move AJAX'd content in Javascript w/ Moovweb SDK? -

so when working moovweb sdk client ajax in content spot, in incorrect area? i cannot use tritium move content, because area want move inserted after page load! example: <div class="where-i-want-to-move-it"></div> <div class="content-area-i-want-it-moved-from"> <p class="content-i-want-moved">hi! ajaxed in @ later date!</p> </div> how can detect p tag added through ajax when cannot control js fire specific event or fire different call back? one option listen node changes -- see this post -- , assuming can target correct mutation event, move content manually in javascript.

Get access to the default LineStyleOrder and ColorOrder arrays in MATLAB -

Image
quick "convenience" question matlab users. looping on plot command, passing different data plot each time. data happens generated function call, upon each iteration passed different parameter value. plot on same axis using 'hold' function. unfortunately doesn't auto cycle through available colororder and/or linestyleorder plot parameters, every line plotted has same style on every iteration. for i=1:nlines [x_data y_data]=get_xy_data(param1(i),param2(i)) plot(x_data,y_data) end every line plotted default blue line style. obvious solution generate front cell array of various line styles, , colors in: line_styles={'-','--','-*'}; %...etc colors=colormap(jet(nlines)); then access each of on every iteration. want access default colors generated colororder, , default line cycling, comes linestyleorder. if try like: get(gca,'linestyleorder') this returns styles used in axis (i've tested on axis defined 1 of

C++ Template Class definition getting error -

i learning c++ templates.i created template class addition of 2 strings i'm getting folloing error: please me understand error. main.cc:65:52: error: no matching function call thenameholder<std::basic_string<char> >::thenameholder(const char [8], const char [7]) using namespace std; template <class t> class thenameholder{ t *a, *b; public: thenameholder(t *first, t *last) { a= first; b= last; } t getname(); }; template <class t> t thenameholder<t> :: getname() { t returnval; returnval = strcat (returnval,a); returnval = strcat (returnval, " "); returnval = strcat (returnval, b); return returnval; } int main() { thenameholder <string> obj ("hi", ""); cout << obj.getname (); return 0; } what? no. isn't templates used for you use strcat on templated objects (actually, on t* , on pointers object) strcat accepts char * . t

objective c - Mac OS X -- receive notification when frontmost window changes -

i wondering whether there way in mac os x receive notification when frontmost window switches different window -- either objective-c solution, or python, or applescript, or else. want @ whole system, not within application. app trying keep track of file user working on, , have polling solution gets frontmost app , frontmost window every running applescript, simplify life if run check when knew frontmost window had changed. i've looked @ nsdistributednotificationcenter , global event monitors nsevents, both useful in different ways, don't seem able give me specific front-window-change notification i'm ideally looking for. any ideas on directions should try, or whether possible, appreciated! i don't know of way notification when window changes, in objective-c can notification when things happen @ application level. might you. you want register nsworkspace notifications... [[[nsworkspace sharedworkspace] notificationcenter] addobserver:self selector:@s

call IPtables command within python script -

i trying call following command in python script. trying insert rule ip tables. using sub process call , inserting variables needed, getting large error. suggestions? iptables = subprocess.call('iptables -i forward -eth 0 -m '+protocol+' -t'+protocol+'--dport '+port+'-j dnat --to-destination'+ipaddress) error: traceback (most recent call last): file "./port_forward.py", line 42, in <module> iptables = subprocess.call('iptables -i forward -i eth0 -m '+protocol+' -t'+protocol+'--dport '+port+'-j dnat --to-destination'+ipaddress) file "/usr/lib/python2.7/subprocess.py", line 493, in call return popen(*popenargs, **kwargs).wait() file "/usr/lib/python2.7/subprocess.py", line 679, in __init__ errread, errwrite) file "/usr/lib/python2.7/subprocess.py", line 1259, in _execute_child raise child_exception oserror: [errno 2] no such file or directory

Access C# variable from javascript function or vice versa in asp.net -

i have function checks if there numbers in textbox. if doesn't pass, program won't execute sql insert. i, however, need show popup message. popup function in javascript code, , variable, alertstring in server side code. how can call popup function in button click code? page postback don't know do. if needs clearer, can post more code. i'm using visual studios 2005. page seems refresh. if return false onclientclick, works, executeinsert method won't work buttonclick function protected void button3_click(object sender, eventargs e) { if (checkstrings()) //checkstrings funciton { button3.attributes.add("onclick", "return false;");//fails string script = "delayer(5000);"; clientscript.registerstartupscript(typeof(page), "buttonalert", script, true); //doesn't work if onclientlick returns true. } else { ... executeinsert(dtt

How to use existing Checkstyle files in SonarQube -

my co-workers , incorporate sonarqube our existing projects. our normal development process java projects involves running checkstyle on code changes ensure follow our style rules, committing project our code repository , having jenkins build , package latest version. we’d add sonarqube final step (through jenkins plugin) don’t want duplicate of our checkstyle rules in sonarqube, since require maintain 2 separate sets of rules , make things more complicated if need make changes rules. don’t want switch sonarqube since we’d still run checkstyle before commit code our repository. we’d prefer maintain our own checkstyle files main set of style rules opposed maintaining style rules on sonarqube , downloading generated xml files our local development. so there way “upload” (so speak) our existing set of checkstyle xml files sonarqube use in evaluation? thanks help. from point of view, should make choice: use sonarqube or checkstyle not both. checkstyle on code changes e

Java method()++ VS method()+1 -

this question has answer here: why doesn't post increment operator work on method returns int? 11 answers i'm trying class.method()++ won't work. simple example : person class public class person { private int age; public void age(int value) { this.age = value; } public int age() { return this.age; } } in main class following statements error p1.age()++ : public static void main(string[] args) { person p1 = new person(); p1.age(p1.age()++); // error } but below works fine : public static void main(string[] args) { person p1 = new person(); p1.age(p1.age()+1); // works fine } the main question : why p1.age()++ error p1.age()+1 doesn't ? p.s : i know can : person p1 = new person(); int myage = p1.age(); p1.age(myage++); because x++;

javascript - Fancybox appears too low on a page with dynamic height -

my page consists of multiple divs in page's content displayed. 1 of these divs visible @ given time (chosen select box , hidden/shown in javascript). 1 of these divs taller others , not 1 appears default. usually fancybox appears in center of page intended. however, when tall div 1 displayed, fancybox appears near bottom of page. problem gets worse tall div gets taller. i have tried $.fancybox.center(true); had no effect. i have fancybox appear in center of screen in cases, fancybox not seem interpret changing height of page. thanks in advance.

php - Displaying images and their accompanying information from a database with codeigniter -

ok im uploading images folder on server, , trying re-display them information. this function in model using pull info: public function pull_all(){ $this->db->select('file_name, file_type, full_path, image_type'); $query = $this->db->get('img'); $dbinfo = $query->result_array(); return $dbinfo; } the controller implements function so: function show_all(){ $this->load->model('image_work'); $data = array('dbinfo' => $this->image_work->pull_all()); $data['title'] = "uploads"; $this->load->view('templates/header', $data); $this->load->view('show_all',$data); $this->load->view('templates/footer', $data); } the problem iv been having in view. want each image shown info in format: <ul class="thumbnails"> <li class="span3"> <div class="thumbnail"> <

jquery - Muliple images on one page each opens unique HTML content -

i novice jquery , javascript, need little apologize in advance if there simple solution this. i want have multiple images on page when click on them each open html fancybox additonaional images, text , links in it, according tot code needs done iframes. this sample of want (i used fancybox 2 code , broke down effect wanted). $(document).ready(function() { $(".fancybox-flyout").click(function() { $.fancybox.open({ padding : 5, openeffect : 'elastic', openspeed : 150, closeeffect : 'elastic', closespeed : 150, closeclick : true, helpers : { overlay : true } }); i want script function on these objects: <a class="fancybox-flyout" href="/iframe_1.html"><img src="image_1.jpg" alt="" /></a> <a class="fancybox-flyout" href="/iframe_2.html"><img src="

Start Rails server with a require statement by passing an argument -

sometimes use pry , pry-debug debug rails application. problem if use additional ruby processes, in case use sidekiq. in order make sidekiq code debugable have add following statement require sidekiq/testing/inline this fine, it's cumbersome comment every time in , out. there way automate this? thought maybe it's idea create sub-class environment this. take parameters :development environment, add requirement , start so $ rails server -e debug does make sense? don't know how clone or subclass environment, create debug.rb in config/environments , , then? first solution comes mind little bit hackish, @ least should work ;). require sidekiq/testing/inline if env['debug_env'] then just: $ debug_env=1 rails server i go debug environmenr if have more things change.

php - DateTime failed to open -

i have problem datetime function. i'm using function form different places function newdateformat($date, $format) { $newdate = new datetime($date); if($format == '1') { $newdate = $newdate->format('y-m-d h:i:s'); }elseif($format == '2'){ $newdate = $newdate->format('y-m-d'); } return $newdate;} when use function adding new event in fullcalendar works fine. problem when try use update calendar , says warning : require(libs/dateformat.php): failed open stream: no such file or directory in /applications/mamp/htdocs/coach/index.php on line 12 i have no such file in libs directory php. any 1 knows ho working? thanks help

Rally inline edit grid from custom data store -

i cannot figure out how save data rally after has been edited inline - had working version rallygrid providing model type, needed aggregate , change data in cases did not have flexibility do. else should work - 1 problem having saving changes user makes in-line rally. _creategrid: function(start, end, type, filterconfig) { app._newgrid(start, end, type, { filters : filterconfig, fetch : ['formattedid', 'name', 'description', 'notes', 'owner', 'plannedstartdate', 'plannedenddate', 'c_winliststate', 'c_department', 'parent'] }, true, filterconfig); }, _newgrid: function(start, end, type, config, normalgrid, filterconfig) { ext.define('winstate', { extend: 'ext.data.model', fields: [ {name: 'value', type: 'string'} ] }); var datastore = ext.create('ext.data.store', { model: 'wi

python - logging response content length using bottle and cherrypy -

i using bottle cherrypy (which provides wsgi) web application. cherrypy not log web-access in setup. currently, almost logging using bottle's hook plug-in , so: import bottle bottle import route, static_file, get, post, error, request, template, redirect, response, hook @hook('after_request') def log_after_request(): try: length = response.content_length except: try: length = len(response.body) except: length = '???' print '{ip} - - [{time}] "{method} {uri} {protocol}" {status} {length}'.format( ip=request.environ.get('remote_addr'), time=datetime.datetime.now().strftime('%y-%m-%d %h:%m:%s'), method=request.environ.get('request_method'), uri=request.environ.get('request_uri'), protocol=request.environ.get('server_protocol'), status=response.status_code, length=length, ) @route(

jquery - automatic scrolling when using keytable plugin -

i'm using allan jardine's keytable plugin in plain html table. it's big table scrolls horizontally , vertically. problem i'm facing right doesn't scroll automatically when focused cell out of sight (one knows current cell because has .focus class). how make scroll automatically when using keyboard? thanks. i use nice scrollintoview plugin jquery: https://github.com/litera/jquery-scrollintoview this. my own code, nice still not perfect, works this: var anim_element = $(); var keys = new keytable( { "table": t, focus: false, }); keys.event.focus( null, null, function(cell, posx, posy) { /* handler focus events on cells ... */ anim_element.stop(); var row = $(cell).parents("tr").first(); anim_element = row.stop().scrollintoview({ duration: 50, direction: 'y'}); }); note have stop animation when next focus event starts have have previous animation element stored somewhere. part of code that's still lit

Cubism.JS threshold scale doesn't work -

Image
i'm using cubism data coming graphite the data's domain continuos [0,100] , range continuos [0,100] below 100 nonsense modified scale , used threshold scale that: values < 100 0 , 100 100. tested with: var scale = d3.scale.threshold().domain([100]).range([0,100]) console.log(scale(1)) //returns 0 console.log(scale(99.9)) //returns 0 console.log(scale(88.9)) //returns 0 console.log(scale(100)) //returns 100 when apply it, whole chart becomes empty .call(context.horizon().height(100) .colors(colors) .scale(d3.scale.threshold().domain([100]).range([0,100])) // range([0,1]) doesn't work either ); without applying scale (notice small white area) .call(context.horizon().height(100) .colors(colors) // .scale(d3.scale.threshold().domain([100]).range([0,100])) // range([0,1]) doesn't work either ); scale didn't work used graphite's functions specifically used removeabovevalue(keeplastvalue(xxx),99.99999)

ios - UIButton slide in, instead of fade in -

i have uibutton in uiviewcontroller have "fading in" view when app opened. i uibutton slide in left right instead though. i can't figure out how slide in left right , attempts have failed, though i've got "fade in" thing down solid. any give me? thanks! can add more code needed- viewcontroller.h @property (weak, nonatomic) iboutlet uibutton *buttonone; viewcontroller.m - (void)viewdidload { [super viewdidload]; // additional setup after loading view. nstimer *timermovebutton = [nstimer scheduledtimerwithtimeinterval:1.0 target:self selector:@selector(movebutton) userinfo:nil repeats:no]; [timermovebutton fire]; } -(void) movebuttontwo { buttontwo.alpha = 0; [uiview beginanimations:nil context:nil]; [uiview setanimationdelay:0.5]; [uiview setanimationcurve:uiviewanimationtransitioncurlup]; [uiview setanimationdelegate:self]; [uiview setanimationduration:1.0]; buttontwo.alpha = 1.0; [

powershell - Powersehll script to execute an exe with multiple arguments and gets the argument information from excel -

i'm newbie powershell script world, need powershell script call executable has 5 arguments. in command prompt execute exe below , single application. want automate multiple applications. application information (application name, version, env, filepath, reportname" stored in excel spread sheet. executer.exe --applicationname='application1' --version='20.2.1 -env="" --filpath="c:\path" -reportname="report.pdf" --> single application. the script should execute exe arguments excel spread sheet , run application rows available in spread sheet. i tried different options nothing working out. please help. sounds simple, did u try this? $path = c:\path\executer.exe &$path --applicationname='application1' --version='20.2.1 -env="" --filpath="c:\path" -reportname="report.pdf" if works substitute single parameters variables excelsheet.

primefaces - Info dialog is not shown for an ajax button/link -

i using p:commandlink save top panel in m =y page. since ajax call not getting info dialog confirming save. can suggest solution. i know if possible call dialog backing bean class.. you can call dialog backing bean. set widgetvar attributte dialog in backing bean method can call: requestcontext.getcurrentinstance().execute("widgetname.show()") . for problem commandlink must add code in post.

Images in Android assets subfolder do not display in WebView -

i've seen lot of similar questions here, none of them seem problem. i'm loading local html file subfolder of assets folder webview. file located in assets/myfolder/myfolder2/test.html. also in assets/myfolder/myfolder2/ have image.jpg. full path: assets/myfolder/myfolder2/image.jpg i loading html so: // html contains string content of test.html file webview.loaddatawithbaseurl("file:///android_asset/myfolder/myfolder2/", html, "text/html", "utf-8", "about:blank"); in html string, have following tag: <img src="image.jpg" /> the image not displayed. i've tried spelling out full file:/// url image well, no luck. if change link image somewhere out on web, works fine. why can't find local image? to load html asset folder should use webview.loadurl() . i have created 2 subfolders inside assets folder named "folder1" , "folder2". have pu

regex - Extract Float from Specific String Using Regular Expression -

what regular expression use extract, example, 1.09487 following text contained in .txt file? also, how modify regular expression account case float negative (for example, -1.948)? i tried several suggestions on google regular expression generator, none seem work. seems want use anchor (such ^) start searching digits @ word "serial" , stop @ "(", doesn't seem work. output in .txt file: entropy = 7.980627 bits per character. optimum compression reduce size of 51768 character file 0 percent. chi square distribution 51768 samples 1542.26, , randomly exceed value less 0.01 percent of times. arithmetic mean value of data bytes 125.93 (127.5 = random). monte carlo value pi 3.169834647 (error 0.90 percent). serial correlation coefficient 1.09487 (totally uncorrelated = 0.0). thanks help. this should sufficient: (?<=serial correlation coefficient )[-\d.]+ unless you're expecting garbage, work fine.

Error installing rails on Ubuntu 12.04 (Failed to build gem native extension) -

i'm trying install rails on ubuntu 12.04 i'm having issues i tried sudo gem install rails --pre and got building native extensions. take while... error: error installing rails: error: failed build gem native extension. /usr/bin/ruby1.9.1 extconf.rb extconf.rb:13:in `require': cannot load such file -- mkmf (loaderror) extconf.rb:13:in `<main>' gem files remain installed in /usr/lib/ruby/gems/1.9.1/gems/atomic-1.1.10 inspection. results logged /usr/lib/ruby/gems/1.9.1/gems/atomic-1.1.10/ext/gem_make.out this because when installed ruby did not install build tools well. i wrote a blog post installing ruby + rails on ubuntu has helped out lot of people, , too.

android - ScrollView with two views, first view filling screen -

i have scrollview linearlayout containing 2 views. first view should occupy full screen, second view off screen (but can scrolled to). achievable? use code <scrollview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:fillviewport="true" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".mainactivity" > <linearlayout android:id="@+id/linlayout" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="ver

c++ - Recursive method of reversing string -

i trying write recursive method of reversing string below. void reverse(string s,int i,int l) { static int j; while(i<l) { char ch=s[i]; cout<<ch<<endl; reverse(s,i+1,l); cout<<"after="<<ch<<endl; s[j]=ch; j++; } cout<<s<<endl; s[j]=0; } but output not correct. "after="<<ch printing last character of string. argument of function s std::string, index starting 0, , l length of string. can 1 point out doing wrong thing. you might have figured out problem. another approach, if don't like/want iterator or reverse function. string revstr(string str){ if (str.length() <= 1) { return str; }else{ return revstr(str.substr(1,str.length()-1)) + str.at(0); } }

Jquery Remote Validation Rule - php email check failing -

i have been scanning interwebs many days now, , have tried posted resolve issue. trying (like many other posts), send remote mysql query via remote validation.. there has been debate on proper format of return data (like json_encode or not) , have tried both suggestions no avail. jquery code $('#register-form-step-1').validate({ // initialize plugin rules: { confirmemail: { equalto: "#clientemailaddress" }, clientpassword: { rangelength: [6,32], required: true }, clientusername: { minlength: 4, required: true, remote: { async:false, type:'post', url:'<?php echo base_url("home/checkusername")?>', data: { clientusername: function() { return $("#clientusername").val();

javascript - Using CSS to make table rows the same height -

Image
i'm building app in angularjs gets product data , displays on page. reason mention angular because, due way ng-repeat works, can't put images 1 row default same height - each 'product' has own td , table , div or similar. anyway, won't make sense without explaining code , issues i'm having. have products being displayed in rows of three. this: as can see, when images same height, works fine. issue is, not of images same height, nor ever be. i'm looking solution accommodates this. the markup to avoid ugly <table> code i've put in fiddle here: http://jsfiddle.net/qgu2v/6/ the // spacer images i've marked in fiddle (if knew more tables) make searchimgcontainer fill height of containing <td> . the question any ideas on how can achieve this? goal not make image containers same height, vertically centre image within container (so there equal white space above , below it). i know can javascript/jquery, i'm loading

java - Checkstyle report generate graphs report -

i using checkstyle generate reports using ant. displays report in html form. possible generate report in graphical way(like bar graph, pie chart etc). if yes please guide me how this? jenkins project generate graphical report https://wiki.jenkins-ci.org/display/jenkins/checkstyle+plugin . there plugins achieve this. if using jenkins,you can add post-build actions in job.before make sure you've installed jenkins checkstyle plugin. change output of checkstyle html xml.the jenkins checkstyle plugin parse xml file after job.then can see graph in job page of jenkins.

javascript - html select control click not showing options list until mouse is hovered towards the options -

i facing strange problem select-tag, have simple select drop down , when click on it, options list not show until move mouse in direction options list might have shown(if worked properly). if space available above select after clicking drop down options not showing until move mouse in upward direction. , if space available below select after clicking drop down options not showing until move mouse in downward direction. this problem happens in ie9. firefox, chrome work properly. background: application url opened inside iframe application used within workspace app. it seems ie9 blocking javascript...i hope helps http://answers.microsoft.com/en-us/ie/forum/ie9-windows_vista/internet-explorer-9-drop-down-menus-do-not-pull-up/954c5c71-5878-40a4-b9f8-68991922e85a

android - Intent filter to open xls and xlsx files -

i want attachment of email having xls , xlsx file opened android app. able open csv file app. please help. code using in manifest csv : <intent-filter android:icon='@drawable/rr_ipad1_icon' android:label="@string/app_name" android:priority='1'> <action android:name="android.intent.action.view" /> <action android:name="android.intent.action.edit" /> <action android:name="android.intent.action.pick" /> <category android:name="android.intent.category.default" /> <category android:name="android.intent.category.browsable" /> <data android:mimetype="text/csv" /> <data android:pathpattern="*.csv" /> </intent-filter> <intent-f

php - Shifting databse from one server to another -

we working on crm site. have shift site 1 server server. not having problem shifting files since working on know changes or update in files. have shift db 1 server server without losing single data.we planned make access old server db new server still changing db old server new server. problem when doing process user have possibilities inserting records old db. lose data since taken dump.so kindly suggest best way doing db transfer losing single data. we thinking take records between times dumping changing new server. possible?.... if yes kindly suggest how?... allow updates both servers, is, old db server take updates. when dns migration finished, migrate db data. still, there's downtime, scripts can speed up.

Kendo UI reload treeview -

i load complex treeview kendo ui via ajax because need load tree 1 request (works fine): $(document).ready(function() { buildtree(); }); function buildtree(){ $.getjson("admin_get_treedata.php", function (data) { $("#treeview").kendotreeview({ select: function(item) { edittreeelement(item,'tree'); }, datasource: data }); }) } if try reload complete tree after changing data via ajax new build tree not work correct , not update text. $.ajax({ type: 'post', url: 'ajax/ajax_update_layer.php', data: { layerid:id, ... }, success: function(data){ buildtree(); } }); what can ido? sven try on ajax success callback var data = $("#treeview").data('kendotreeview'); data.datasource.read();

xml - Control Name for Insert tab -

Image
i trying design workbook restrictions without using vba in excel, compatible in 2007 , 2010. have chosen "custom ui editor microsoft office" xml code restrict few options:- save-as info tab, insert, delete, move/copy sheet, hide sheet, unhide sheets. successful in doing have noticed insert sheet tab "icon" is still working , accessible. can point me control name disable through xml in file please? my code is: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <customui xmlns="http://schemas.microsoft.com/office/2009/07/customui"> <commands> <command idmso="filesaveaswebpage" enabled="false" /> <command idmso="filesaveas" enabled="false" /> <command idmso="filesaveasmenu" enabled="false" /> <command idmso="filesaveasexcelxlsx" enabled=

html - Ruby- Selenium: Could we find an element by its 2 properties in parallel at the same time? -

first of all, have element that: "<"id="select_a_boundary" class="dataset_select2">homes name<> as know, when find element selenium in ruby based on property use method: @driver.find_element(:id, "select_a_boundary") or @driver.find_element(class,"dataset_select2") could know way find element both properties id , class in selenium ruby? because there other element has same id property or same class property. and assume not allowed use xpath combine it, how deal it? suggestion. <div id="select_a_boundary" class="dataset_select2">homes name</div> selenium code: @driver.find_element(:xpath, "//div[@id = 'select_a_boundary' , @class = 'dataset_select2']") @driver.find_element(:css, "div[id=select_a_boundary][class=dataset_select2]") @driver.find_element(:css, "#select_a_boundary.dataset_select2")

linq - Storing Google map iframe to ASP.net MVC Application without security risks -

i have mvc3 web application has place input google map address, there security risk, xss. google map address contains iframe element , can't use antixss library sanitize input. forced turn off validation due accept form data @ controller action too. but how secure part of application? any idea perhaps technically useful. before. we need black-list using iframe due control input. an easy way latitude , longitude input variables api. using them below: <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> function initialize() { var latlng = new google.maps.latlng(-34.397, 150.644); var myoptions = { zoom: 8, center: latlng, maptypeid: google.maps.maptypeid.roadmap }; var map = new google.maps.map(document.getelementbyid("map_canvas"), myoptions); } &l

Java Swing - JDialog default focus -

i have found in internet such info: "when jdialog (or jframe matter) made visible, focus placed on first focusable component default." let's consider such code: public class mydialog extends jdialog{ // dialog's components: private jlabel dialoglabel1 = new jlabel("hello"); private jlabel dialoglabel2 = new jlabel("message"); private jbutton dialogbtn = new jbutton("sample btn text"); public mydialog(jframe parent, string title, modalitytype modality){ super(parent, title, modality); dialogbtn.setname("button"); // dialoglabel1.setname("label1"); // - setting names dialoglabel2.setname("label2"); // settitle(title); setmodalitytype(modality); setsize(300, 100); setlocation(200, 200); // adding comps contentpane getcontentpane().add(dialoglabel1, borderlayout.page_start); getcontentpane().

suppression - How can I suppress specific checkstyle rules in eclipse? -

i'm trying use suppression filter unexpected error occurs. following error message. "cannot initialize module suppressionfilter - cannot set property 'file' in module suppressionfilter 'checkstyle-suppressions.xml': unable find checkstyle-suppressions.xml - document root element "suppressions", must match doctype root "module"." could let me know how can resolve error? followings configuration file , suppression file contents used. configured suppression filter through eclipse menu(windows > preferences > checkstyle > configure > known modules filter > suppression filter > add) ====================================== configuration file is <?xml version="1.0" encoding="utf-8"?> <!doctype module public "-//puppy crawl//dtd check configuration 1.3//en" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> <module name="checker"> &l

java - Unit testing a service, which works as a mediator between two other services -

i have service, works mediator between 2 other services. validates inputs, passes them 2 service sequentially (by trying keep transactional integrity), , then, if goes well, saves result database. my problem test service in isolation. of course, can provide stubs satisfy dependencies. can test validation of inputs, whether appropriate data saved in db in normal case, whether transactional integrity kept if of dependencies throws exception. yet, half of service does. dilemma if should try prove whether other 2 dependency services processed data appropriately well? scope of service quite broad, guess better know if dependency services did job well. yet, gets out of scope unit testing, , moves integration testing, right? i kind of confused here. if you're asking unit-testing, way test class in isolation using mocks or stubs. but, if feel doing not enough, can write component tests, use real classes want test, , use stub (or inmemory) database , mock of dependenci

weird results with like operator on mysql with php -

i'm using php query. query next: $getdatos = sprintf("select distinct hunlunngram.n_palabra, palabra hunlunngram, tablanombre, tablaadjetivo, tablaverbo palabra '%s' or raiz '%s' or infinitivo '%s' or participio '%s' or gerundio '%s' or presente1s '%s' or presente2s '%s' or presente3s '%s' or presente1p '%s' or presente2p '%s' or presente3p '%s' or presentesubj1s '%s' or presentesubj2s '%s' or presentesubj3s '%s' or presentesubj1p '%s' or presentesubj2p '%s' or presentesubj3p '%s' or pasado1s '%s' or pasado2s '%s' or pasado3s '%s' or pasado1p '%s' or pasado2p '%s' or pasado3p '%s' or pasadosubj1s '%s' or pasadosubj2s '%s' or pasadosubj3s '%s' or pasadosubj1p '%s' or pasadosubj2p '%s' or pasadosubj3p '%s' or futuro1s '%s' or futuro2s &#

App Engine, query results displayed locally, but not on App Engine -

i'm working app engine, , problem query results don't show when deployed app engine. works fine locally. i'm using app engine datastore store query results. have idea problem might be? make sure have indexed (and created composite indexes necessary) fields in use in query. deployed appengine requires these exist, locally prompt add composite index on first usage , work fine thereafter.

javascript - iOS scrolls to the top on input after first character -

here's scenario: open website in safari on iphone click/tap on input text field the window scrolls vertically center field in viewport (fine) type first character using keyboard ios scrolls top of page whereas i'd stay @ step #3 i'm using jquery, , tried lot of different solution without success. all i've learnt if preventdefault() event on keydown or keypress it's not scrolling top, there's no text in input (obviously). when try like: this.value = this.value + string.fromcharcode(e.keycode); scrolls again. i tried cancel scroll event without success well.

javascript - Website remote render d3.js server side -

looking solution arguably strange problem. ok, using d3.js plot charts , graphs. our data sets can small, intensely massive. right of doing internal , prototyping. however, show clients these charts , draw them in real time them, quite , rapidly change inputs. doing in d3 looks great, can slow expected. i'm more interested in possibilities process. go our website, loging, , show instance of our dashboard being rendered remotely on server. our server cluster super demon beast i'm not worried doing heavy lifting. can these processes 100x faster our best pc seems if setup our website create instances on fly of our dashboard, have access user accounts data. this getting bit convoluted let me explain. have database, full of millions of data points. have 10 user accounts. each have access different pieces of data. 1 has access of it, other of it. of not issue looking solution on. more interested in ability of our server create multiple instances of our site, through window es

c# - reflexion in a display custom attribute mvc -

i'm trying create custom attribute display value of property countrytext [displaynameproperty("countrytext")] public string country { get; set; } public string countrytext { get; set; } this code of attribute namespace registration.front.web.validators { public class registrationdisplaynameattribute:displaynameattribute { private readonly propertyinfo _proprtyinfo; public registrationdisplaynameattribute(string resourcekey):base(resourcekey) { } public override string displayname { { if(_proprtyinfo==null) } } } } how can reflexion obtain value of fild named resourcekey in code of attribute?? since impossible pass instances attribure via constructor, (i.e attributes included in metadata @ compile time, , used via reflexion, can see pass instance of class pa

mysql - Is it possible to address whole table by ID? -

i'm creating database in have devices list in first table , features in second table. know can initialize relation between tables in way: +----------------+ +----------------------+ | device | | features | +----------------+ +----------------------+ | id |--------+ |id | | dname | +--------|did | +----------------+ |options | |... | +----------------------+ but think better decision if create "features" table each device. possible address table id? decision have names of tables in "device" table under "dname" , have huge quantity of "features" tables? but think better decision if create "features" table each device. this contrary principle of orthogonal des

twitter - Twitter4j streaming api: getRetweetCount returns 0 -

i using twitter streaming api twitter4j (twitter4j-stream-3.0.3.jar) , getting retweet count using getretweetcount . returns 0. anything wrong ? you need use status.getretweetedstatus().getretweetcount()

javascript - Critical view on object based application structure in AngularJS -

as tried learn angular in past weeks, have adopted application architecture. assuming intermediate large spa, create view , apply maincontroller: <html ng-app="app"> <body ng-controller="appctrl"> <!-- of view goes in here --> </body> </html> now think stuff application have do. assuming 1 have store data , working it, create provider build "class". var data = angular.module('data', []); data.provider('$dataobject',function(){ this.$get = function($http){ function dataobject(){ var field = "testvalue"; var object = { // ... } } dataobject.prototype.processdata = function(){ // }; return { shipment: function(){ return new shipment(); } } } }); i create instance of class i

windows - Use batch file timeout without echoing command? -

i'm new batch scripting reasonably competent programming in general. i'm calling perl script batch file , displaying result perl script in windows command window 10 seconds before exiting command window. i'm using command timeout /t 10 /nobreak which printed command window after result of perl script. is there way prevent see result of perl script , see timer counting down? i understand can append '> nul' timeout command suppress countdown timer isn't want do. want prevent see line of code printing command window. if can't done, it's no problem, i'll live it. if can remove i'd to. thanks in advance help! if want avoid echoing 1 command, prefix @ : @timeout /t 10 /nobreak you can disable echoing @ command echo off normally, put @echo off at beginning of batch file, commands not outputed.

objective c - Drawing line on a CALayer in OSx -

i know if can me painting on layers. the situation this i programming on kind of screen http://multitouch.com , 12 touches simultaneously. in app developing, can manage multiple images. can rotate, scale move @ same time images (maximum 12 touches on screen!) accomplish use layers performances. every image represented calayer, create calayer's , set image 'contents'. hierarchy this. i have nsview. nsview "container_view" calayer "images_layer" sublayer of "container_view" layer (they have same frame) calayer "img_1_layer", calayer "img_2_layer", calayer "img_3_layer", etc sublayer of "images_layer" as told before, can rotate, scale , move images. double tap on single image, lock whole screen, can still rotate , move image 2 fingers. now user can draw 1 finger on image. the main problem have not experience graphics , example on internet draw line on view. the question how draw fi

excel - copy each sheet to separate cls files with path given -

i copy/save/export each of sheets separate vba file (which import later). intend because, have workbook beforeclose event delete worksheets except sheet1. before deleting want other sheets copied specified path. ofcourse same imported via worksheet click or box click event or whatever later. i tried doesnt work! activeworkbook.worksheets("abc").export filename:="c:\users\xyz\desktop\vbe\a"abc".cls can me this? rgds what need vbe. first, add reference microsoft visual basic applications extensbility. then, add enable trust access vba project object model, in macro security settings. and now, following code work: sub save_cls() dim c vbcomponent f = freefile each c in thisworkbook.vbproject.vbcomponents if c.type = vbext_ct_classmodule open c.name & ".cls" output f print #f, c.codemodule.lines(1, c.codemodule.countoflines) close f end if next end sub e

c# - Serialize read-only collection without implementing IXmlSerializable -

i have class : [serializable] public class profile { [xmlattribute] private string[] permissions; public string[] permissions { { return permissions; } set { permissions = value; } } } i want serialize in xml xmlserializer , have compliant fxcop. problem fxcop wants expose read-only collection properties, of course readonlycollection not serializable. not want implement ixmlserializable because it's painful. there other solution ? options: you use list-of-string rather string-array; doesn't need setter, collection can manipulated directly you accept fxcop going generalisation, , generalisation not appropriate specific context - meaning: ignore fxcop in case

Use email as username with django-registration -

i trying use email address username (using django 1.5's custom user model) along django-registration. the docs version 1.0 of django-registration say:- the base view classes deliberately user-model-agnostic. subclass them, , implement logic custom user model i have subclassed registration view unfortunately, looks registrationprofile still expects user model have username field mine doesn't. have email (as first name, last name etc.) is bug? looks me django-registration still needs default base user model in use - it's able use custom user model adds base model. is there way round it? maybe can subclass registration profile well? how that? thanks. i think things easier in long run if keep using default user profile. if trying add ability log in email address, recommend creating new authentication backend: from django.contrib.auth.backends import modelbackend django.contrib.auth.models import user class emailmodelbackend(modelbackend): de

c# - HttpPostedFileBase returns null after submitting -

i keep on getting null httpposterfilebase when try uploading file: i have code in view: @using (html.beginform("import", "control", formmethod.post, new { enctype = "multipart/form-data" })) { <input type="file" name="fileupload"/> <input type="submit" value="import" id="btnimport" class="button" /> } and code controller: [httppost] public actionresult import() { httppostedfilebase file = request.files[fileupload]; other codes... } i tried in controller: [httppost] public actionresult import(httppostedfilebase fileupload) { other codes... } after pressing submit button "file" got value of null. the default model binder binds name files. inputs name fileupload .. parameter name file . making them same work.

sql server - mergin one stored procedure to another in sql -

i have stored procedure this: alter procedure [dbo].[fetchkey] @carid nvarchar(50) =null begin select t.tbarcode,t.status transaction_tbl t t.tbarcode=@carid end my output : tbarcode status 51891044554 1 i want show 1 more column depend upon status.so worte 1 function this: alter function [dbo].[keyloc](@status numeric(18,0)) returns varchar(50) begin declare @keylocation varchar(50) if @status=1 select @keylocation= e1.ename transaction_tbl t left join employeemaster_tbl e1 on e1.ecode = t.ecode , t.status = 1 or e1.ecode=t.delecode , t.status=4 return @keylocation end then try execute stored procedure this: alter procedure [dbo].[fetchkey] @carid nvarchar(50) =null begin select t.tbarcode,[dbo].[keyloc](t.status) transaction_tbl t t.tbarcode=@carid end but output getting wrong: tbarcode 51891044554 null what wrong code? expected output this: tbarcode status key location 51891044554 1

How to return an Integer or int and a list from a method in java? -

i trying return int , list method class. cant make object of class. how should it. i try : list listofobj = new arraylist(); list list1 = code can't share; integer total = integer value; listofobj.add((list) list1 ); listofobj.add((integer) total); return listofobj; but when use in class - if (listofobj != null && listofobj.size() > 0) { list mainlist = promodata.get(0); --- gives error count = (integer) promodata.get(1); } so tried --- if (listofobj != null && listofobj.size() > 0) { map promodata = (map) listofobj; list mainlist = (list) promodata.get(0); count = (integer) promodata.get(1); } but still gives error when hit application. error : java.lang.classcastexception: java.util.arraylist cannot cast java.util.map you can use pair class public class pair<x,y> { public final x fi

ASP.NET MVC 4 Create method has null object -

i have problem creating object don't know why. have null object in parameter in post create method , in modelstate error: {system.invalidoperationexception: parameter conversion type 'system.string' type 'blanskomenu.models.actionoffer' failed because no type converter can convert between these types. @ system.web.mvc.valueproviderresult.convertsimpletype(cultureinfo culture, object value, type destinationtype) @ system.web.mvc.valueproviderresult.unwrappossiblearraytype(cultureinfo culture, object value, type destinationtype) @ system.web.mvc.valueproviderresult.convertto(type type, cultureinfo culture) @ system.web.mvc.defaultmodelbinder.convertproviderresult(modelstatedictionary modelstate, string modelstatekey, valueproviderresult valueproviderresult, type destinationtype)} these methods in controller: // // get: /action/ public actionresult index() { var offers = _repository.getallactionof