Posts

Showing posts from August, 2014

hex - Decimal to hexadecimal upto two bytes in Excel -

dec2hex converts number default number of bytes (in case ms office standard 10 -upto 5 bytes), example: dec2hex(number) = fffffffb8a. is there way trim 2 bytes? = abcd. number decimal integer. =dec2hex(mod(-1142,hex2dec(10000)),4) or =dec2hex(mod(-1142,65536),4) or =right(dec2hex(-1142,4),4)

How to format a decimal value WITHOUT rounding to store into nullable decimal Variable in c# -

i have tried format(truncate) decimal value 4 decimal places. example, want convert decimal numbers like 31.818181818181818181818181818m or 31.818181818181818181m or 31.81818m to 31.8181 (not rounding 31.8182) , store in nullable decimal variable. have tried following decimal formatting without rounding .net , stop rounding in c# @ number no luck nullable decimals. here code private decimal? returnnullabledecimal(decimal? initvalue) { //e.g. initvalue = 35m; initvalue = 35m; //just debug; decimal? outputvalue = null; if (initvalue != null) outputvalue = initvalue / (decimal)1.10; //now outputvalue 31.818181818181818181818181818m outputvalue = convert.todecimal(string.format("{0:0.0000}", outputvalue)); // <- should 31.8181 gives 31.8182 return outputvalue; } can please help? any decimal can implicitly converted decimal? , same code works in other example of trunc...

optimization - Registration of 3D surface mesh to 3D image volume -

i have accurate mesh surface model of implant i'd optimally rigidly align computed tomography scan (scalar volume) contains exact same object. i've tried detecting edges in image volume canny filter , doing iterative closest point alignment between edges , vertices of mesh, it's not working. tried voxelizing mesh, , using image volume alignment methods (mattes mutual) yields inconsistent results. any other suggestions? thank you. generally, mesh , volume 2 different data structures. have either convert mesh volume or convert volume mesh. i recommend doing segmentation of volume data first, segment out issues want register. canny filter might not enough segment border clearly. recommend level-set method , active contour model. these 2 used in medical image processing. these 2 topics, recommend professor chunming li's work. and after segmentation of volume data, might able reconstruct mesh model of volume marching cubes. vertexes of 2 mesh registered...

javascript - When queried from database instead of value [object HTMLInputElement] loaded in phonegap -

i new phonegap . used select query show stored input value. below database table. function populatedb(tx) { tx.executesql('create table if not exists fueldataengine (price text, ttl text,odo text,date text)'); price=document.getelementbyid('price'); totallitres= document.getelementbyid('ttl'); odometer=document.getelementbyid('odo'); date=document.getelementbyid('date'); tx.executesql('insert fueldataengine (price,ttl,odo,date) values (?,?,?,?)', [price,totallitres,odometer,date],successcb,errorcb); i have tabulate query result.in tabulation query result showing [objecthtmlinput element] coming.please change: price=document.getelementbyid('price'); totallitres= document.getelementbyid('ttl'); odometer=document.getelementbyid('odo'); date=document.getelementbyid('date'); to: price=document.getelementbyid('price').value; totallitres= document.getelementbyid('ttl')...

ios - Using project files in a Static Library -

Image
i have created static library 1 of project , used in project (referenced main project). need access class files of main project in static library. possible? , if yes how? if need more info please comment.. thanks in advance!! :) it not possible access files static library. way xcode project or archive static library built.

Scrapy not working -

just question newbie scrapy... the code below not working... import scrapy class stackspider(scrapy.spider): name = 'stack' start_urls = [ 'http://stackoverflow.com' ] cookies_enabled = false item = stackitem() def parse(self, response): self.crawlgeneral(response) def crawlgeneral(self, response): sel in response.xpath('//*[@id="question-mini-list"]'): self.item['name'] = sel.xpath('div/div[2]/h3/a').extract() yield self.item however, working fine if don't make function... class stackspider(scrapy.spider): name = 'stack' start_urls = [ 'http://stackoverflow.com' ] cookies_enabled = false item = stackitem() def parse(self, response): sel in response.xpath('//*[@id="question-mini-list"]'): self.item['name'] = sel.xpath('div/div[2]/h3/a').extract() yield self.item self.crawlgeneral(response) def crawlgeneral(...

Importing data from a javascript table(?) to excel -

i'm trying import data large number of dates here: https://demanda.ree.es/movil/peninsula/demanda/tablas/2014-11-03/2 once/if that's possible want automate retrieves data given set of dates. say, entire 2013. i can't find in webpage source give hint data retrieved from. i've tried importing data both using: data/from web: gets javascript error open/ other web locations: retrieves worksheet filled grey cells, no data. thanks help! use following links: https://demanda.ree.es/wsvisionamovilespeninsularest/resources/maxminpeninsula?callback=angular.callbacks._0&curva=demanda&fecha=2013-01-01 https://demanda.ree.es/wsvisionamovilespeninsularest/resources/prevprogpeninsula?callback=angular.callbacks._1&curva=demanda&fecha=2013-01-01 https://demanda.ree.es/wsvisionamovilespeninsularest/resources/demandageneracionpeninsula?callback=angular.callbacks._2&curva=demanda&fecha=2013-01-01 https://demanda.ree.es/wsvisionamovilespenin...

javascript - Turn on schuffle when click jQuery -

i trying make random play, click button, automatically after film opened next. this code works when movie finish have manually click #schuffle , opens next item. want had click once , activated code every time when film completed, is, return 0. $(document).ready(function() { $("#schuffle").on('click',function(e) { //ytplayer.getplayerstate() return 0 when video finish //if youtube video finish if ( ytplayer.getplayerstate() == 0 ) { //click random element out .koncentrator a.utwor var list = $('.koncentrator a.utwor'); //click random .koncentrator a.utwor list.eq(parseint(math.random()*list.length)).click(); //scroll element $(".active").get(0).scrollintoview(); } }); }); what this? if user clicks on button activates setinterval checkyoutubevideo() every second. function checkyou...

cuda - Strong scaling on GPUs -

i'd investigate strong scaling of parallel gpu code (written openacc). concept of strong scaling gpus - @ least far know - more murky cpus. the resource found regarding strong scaling on gpus suggests fixing problem size , increasing number of gpus. however, believe there amount of strong scaling within gpus, example scaling on streaming multiprocessors (in nvidia kepler architecture). the intent of openacc , cuda explicitly abstract away hardware parallel programmer, constraining three-level programming model gangs (thread blocks), workers (warps) , vectors (simt group of threads). understanding cuda model aims @ offering scalability respect thread blocks, independent , mapped smxs. therefore see 2 ways investigate strong scaling gpu: fix problem size, , set thread block size , number of threads per block arbitrary constant number. scale number of thread blocks (grid size). given additional knowledge on underlying hardware (e.g. cuda compute capability, max warps/multi...

javascript - validate a form before it get submitted -

this question has answer here: how use jquery validate directly, without submit button? 2 answers i have form in jsp page. submit form using ajax . not use submit type button, use button type button call javascript function includes ajax . call javascript function on above mentioned button click. need validate form. use jquery form validation here. use function validate form. $(function(){ $("#detailform").validate({ rules:{ regdate:{ required:true }, agreementno:{ required:true }, customername:{ required:true }, customeraddress:{ ...

parse.com - Error in create new user with PHP SDK -

i getting error trying create new user php sdk parse platform post image error output you must specify parse class name or register appropriate subclass when creating new object. use parseobject::create create subclass object. php file $user = new parseuser(); $user->set("username", "test"); $user->set("email", "test@gmail.com"); $user->set("password", "cf%09ude"); try { $user->signup(); $result = true; } catch (parseexception $ex) { echo "error: " . $ex->getcode() . " " . $ex->getmessage(); } you failed initialize sdk parseclient::initialize . correct usage after loading autoload.php is: use parse\parseclient; use parse\parseuser; $app_id = 'your_app_id'; $rest_key = 'your_rest_key'; $master_key = 'your_master_key'; parseclient::initialize($app_id, $rest_key, $master_key); $user = new parseuser(); $user->set("use...

javascript - Absolute position table cell (td) relative to table row (tr) -

is possible absolute position table cell (td) relative table row (tr) containing td. for example consider html below: <table> <tr> <td>tr1 td 1</td> <td>tr1 td 2</td> <td class="last">tr1 td 3</td> </tr> <tr> <td>tr2 td 1</td> <td>tr2 td 2</td> <td class="last">tr2 td 3</td> </tr> <tr> <td>tr3 td 1</td> <td>tr3 td 2</td> <td class="last">tr3 td 3</td> </tr> </table> and css below: tr{position:relative} td.last{ position:absolute; left: 10px; top: 40px} in above example, can take out last td tr , absolute position relative tr. edit: working in firefox version 33.0, not working in chrome version 38. in chrome td positioned respect table , not tr. please check jsfiddle @ http://jsfiddle.net/n5s53v32/2/ . the browsers strict when comes tables. not work...

websocket - Netty send final message to ChannelGroup before closing -

i'm new netty , i'm trying implement websocket server. follow examples provided in source code. i graceful shutdown of netty server , want catch , send last message connected channels , close server. how possible? use defaultchannelgroup netty version 4.0.24 , have websocket implementation similar examples provided and following resource: https://gist.github.com/aolshevskiy/1653087 implement maybe beforecloselistener? thank in advance finally, have managed adding defaultchannelgroup , sending message connected channels, problem was adding each channel @ stage , ending having nioserversocketchannel instead of niosocketchannel job me.

ember.js - How to trigger code on view transitions -

i have view this. app.testview = em.view.extend templatename: 'test' modeldidchange: (() -> # fires twice, need check state make sure doesn't if @state 'prerender' # ...do stuff ).observes('controller.content') i want able trigger whenever view changes new model, instance if go route /test/123 /test/456 in app. code above works seems strange. don't think should looking @ state of view. there "correct" way of going this? cant seem find other options. i've tried using on('init') hook, controller appears undefined if use that. i in route, using setupcontroller hook. called when model changes. app.testroute = ember.route.extend({ setupcontroller: function (controller, model) { // call _super default behavior this._super(controller, model); console.log('model change:'+model.get('id')); # ...do stuff } }); jsbin example: http://emberjs.jsbin.com/potehi/1/e...

jquery - SAPUI5 VizFrame turn 90° to the left (horizontal instead of vertical) -

Image
i using vizframe, possible turn graphic/chart 90° left or right, means horizontal alignment instead of vertical? var chartpopover = new sap.viz.ui5.controls.popover({}); var omodel = new sap.ui.model.json.jsonmodel({ 'businessdata' : [ { "country" : "china", "profit" : 100, "forcast" : 200, "target" : 20, "revenue" : 20, "revenue2" : 20, "revenue3" : 512 }, { "country" : "japan", "profit" : 159, "forcast" : 140, "target" : 150, "revenue" : 30, "revenue2" : 100, "revenue3" : 303 }, { "country" : "india", ...

matlab - octave control package tf -

using octave/matlab control toolbox: octave.exe:1> pkg load control i define same transfer function in 2 different ways: octave.exe:2> = tf('1/(s + 1)') transfer function 'a' input 'u1' output ... y1: 1/(s + 1) continuous-time model. octave.exe:3> b = 1 / (tf('s') + 1) transfer function 'b' input 'u1' output ... 1 y1: ----- s + 1 continuous-time model. and evaluate @ s = j : octave.exe:4> a(1) ans = 0 + 1i octave.exe:5> b(1) ans = 0.50000 - 0.50000i why these different!? i think way define a incorrect. not sure why doesn't error out when run command, it's not how should define transfer function. if consider following: >> = tf(1,[1 1]) transfer function 'a' input 'u1' output ... 1 y1: ----- s + 1 continuous-time model. >> a(1) ans = 0.50000 - 0.50000i >> b = 1/(tf('s')+1) transfer function 'b' ...

wampserver - Restore old undumped MySQL database to new Wamp Server -

i install wamp server d: partition not c: partition. i've formatted c: partition forgotten dump databases. my old databases still in d:\wamp\bin\mysql\mysql5.1.53\data\[database-name] *.frm, *.myd, *.myi files. i didn't install wamp server yet. so; should reinstall wamp server , restore old database(s). could please tell step step? if use myisam storages , never used innodb find my.ini , find line datadir=... and make sure like datadir=d:\wamp\bin\mysql\mysql5.1.53\data\ if using innodb need adjust innodb_log_file_size=... to size of yours ib_logfile* files placed in d:\wamp\bin\mysql\mysql5.1.53\data\

c++ - Google Protocol Buffers 2.6 iOS - Can't get it working -

i struggling mightily here, trying build simple "hello world" 64 bit ios application new version 2.6 protocol buffers. i'm quite frustrated, because have been using metasyntactic's native objective-c code couple of years no problems , found encouraged nice workflow. apple demanding 64 bit applications, find project hasn't been updated , when try compile 64 bit, there tons of errors due use of nsinteger. so i've been trying use latest 2.6 version of protocol buffers, supports c++, , adapt code hit updated apis. furthest i've been able using gist tutorial bennett smith on github i'm stuck , need assistance. tutorial enough build fundamentals getting xcode compile i'm having problems. the steps have been following in tutorial. i'm doing them again write sure i'm capturing everything: get script, build, observe bin, include , lib folders correctly created [pass] create new xcode ios master-detail application in xcode 6.1 move pro...

r - Extract just the number of edges in a class graphNEL -

using r have created graphnel class (undirected) nodes , edges. want save numbers gets printed out when print variable undirected graph saved under: graphnel graph undirected edges number of nodes = 671 number of edges = 4267 i tried using function edgel(), number printed out number of nodes. thinking number because each gene has own amount of edges, why output equals number of nodes. want save number of edges in graph. how can this? thanks i not familiar package, looks nodes , edgel returned slots. means should able see data using $ or @ if save graphnel object. yourgraphobject@edgel

javascript - Resizable elements in polymer -

i tried make component resizable cards using paper-dialog, , tried use css property "resize:both;" couldnt find way update interior elements , components when container (paper-dialog) increases in size. there way capture resize event on element? when do, should call/do trigger css update? thanks! with polymer 1.x there corresponding behaviour handling element resizing -- polymer.ironresizablebehavior . here example demonstrates how can used.

PHP XML Output from mySQL Database -

i pulling information sql database , forming xml via php. attempting make xml format this: <channel> <channel_name>asn</channel_name> <program id="1"> <title>the simpson</title> <info>melfi considers turning homer help...</info> <season>s01</season> <episode>e09</episode> ... <channel>asn</channel> </program> </channel> <channel> <channel_name>nbc</channel_name> <program id="2"> <title>the simpson</title> <info>melfi considers turning homer help...</info> <season>s02</season> <episode>e04</episode> ... <channel>nbc</channel> </program> </channel> ...etc this php attempting mimic xml structure above: <?php header('content-type: application/xml;...

matlab - How to get symbolic partial derivative with respect to time -

let's have function f(t) = 4*sin(a(t)) + x(t)*y(t) + h + cos(y(t))*sin(x(t)) how compute derivative respect time? you need declare variables , functions inside being symbolic , use diff: clear clc syms x y t h a(t) = symfun(sym('a(t)'), t) x(t) = symfun(sym('x(t)'), t) y(t) = symfun(sym('y(t)'), t) f = 4*sin(a(t)) + x(t)*y(t) + h + cos(y(t))*sin(x(t)) derf_t = diff(f,t) giving following (messy) output: f = h + 4*sin(a(t)) + cos(y(t))*sin(x(t)) + x(t)*y(t) derf_t = x(t)*diff(y(t), t) + y(t)*diff(x(t), t) + 4*cos(a(t))*diff(a(t), t) + cos(x(t))*cos(y(t))*diff(x(t), t) - sin(x(t))*sin(y(t))*diff(y(t), t) note since a(t),x(t) , y(t) defined functions of 't' stuck 'symbolic' derivative (i don't know term sorry)...i.e. diff(a(t)) instance. hope it's after!

angularjs - ocLazyLoad - one controller calling another -

in header.html have 2 controllers, header controller , language controller. this headerctrl: define( [ 'angular', 'layout/layout.module','languages/languages.module', 'languages/controllers/languagesctrl' ], function (angular) { 'use strict'; angular.module('app.layout').controller('headerctrl', headerctrl); /* @nginject */ function headerctrl() { var header = this; header.pagetitle = 'response coming headerctrl'; } }); my state: (via svc call json file) "header": { "templateurl": "app/layout/views/tpl.header.html", "controller": "headerctrl header", "resolve": {}, "data": { "modulename": "app.layout", "modulefiles": [ "app/languages/controllers/headerctrl.js" ...

javascript - Check whether a word is in a text box regardless of case -

i trying figure out whether text box has given word, regardless of case. example, how can determine whether given text box, #textbox , has word "hello" in it? var specialwords = ['hello','hello','hello']; //special words here $('#textbox').keydown(function() { var text = $(this).val(); text = text.split(" "); var newtext = ""; for(var = 0; < text.length; i++){ // code check words } $("#check").html(newtext); }); the easiest way check whether text box has given word, irrespective of case, convert text box lowercase, split spaces , find indexof word. var word = "hello".tolowercase(); // make sure word lowercase $("#textbox").keydown(function () { var text = $(this).val().tolowercase().split(" "); if (text.indexof(word) > -1) { // } else { // word not in text box } }) if want check array of wor...

python - Django authenticate using logged in windows domain user -

i want authenticate django web user using windows domain account (active directory) logged in computer. how can without prompting user enter username/password again since logged in using domain account system. using django , python 2.7. went through following link dint understand how use in views. please me. thanks when web server(here django hosted on iis) takes care of authentication typically sets remote_user environment variable use in underlying application. in django, remote_user made available in request.meta attribute. django can configured make use of theremote_user value using remoteusermiddleware , remoteuserbackend classes found in django.contrib.auth. configurations must add django.contrib.auth.middleware.remoteusermiddleware middleware_classes setting after django.contrib.auth.middleware.authenticationmiddleware: middleware_classes = ( ... 'django.contrib.auth.middleware.authenticationmiddleware', 'django.contrib.auth.middlewa...

android - Simultaneous Audio Streaming on Fire TV -

i have android app can stream 2 audio streams simultaneously. fire tv devices support simultaneous streaming? yes, do. working on fire tv application can play 2 mp3 streams simultaneously.

c - What is the purpose of surrounding a code block between glBegin and glEnd in brackets? -

what purpose of surrounding code in between call glbegin , glend in brackets? have programmatic or functional purpose or aesthetics , style? code below in c. glbegin(gl_polygon); glcolor3fv(green); glvertex3fv(block_vertices[0]); glvertex3fv(block_vertices[1]); glvertex3fv(block_vertices[2]); glvertex3fv(block_vertices[3]); glend(); versus glbegin(gl_polygon); { glcolor3fv(green); glvertex3fv(block_vertices[0]); glvertex3fv(block_vertices[1]); glvertex3fv(block_vertices[2]); glvertex3fv(block_vertices[3]); } glend(); the reason style, because somehow feels right programmer wrote it. it might have made sense if he/she introducing local variables (i.e. looping create vertices), in c99 , later that's not necessary either.

Drupal throwing blank update.php file -

i'm updating drupalfrom 7.32 7.33 i followed steps here updating drupal 7: https://www.drupal.org/node/1223018 i followed step mentioned set $update_free_access true (temporarily) while updating. but, when visit mysite.com/update.php still throwing blank page. i verified in settings.php that: the file had database configuration values verified actual data still existed in database. what gives? there other solutions fix ? (without having complete clean install) update errors in error.log are: php fatal error: unknown: failed opening required php warning: unknown: failed open stream: permission denied in unknown on line 0 thanks! this permissions error. had, had files not on 755. i had files having octets of 600 777 , needed changed 755 with: sudo chmod 755 i followed "keithm"'s advice on directory permissions here: https://drupal.stackexchange.com/questions/26131/correct-permission-for-site-default-and-files-folders

python - AttributeError with an outer join in pandas 0.15.1 -

in [26]: xyz = temp_val_ns.join(temp_ref_ns, how='outer') traceback (most recent call last): file "<ipython-input-26-e10ed4b1946b>", line 1, in <module> xyz = temp_val_ns.join(temp_ref_ns, how='outer') file "c:\anaconda\lib\site-packages\pandas\core\frame.py", line 3867, in join rsuffix=rsuffix, sort=sort) file "c:\anaconda\lib\site-packages\pandas\core\frame.py", line 3881, in _join_compat suffixes=(lsuffix, rsuffix), sort=sort) file "c:\anaconda\lib\site-packages\pandas\tools\merge.py", line 39, in merge return op.get_result() file "c:\anaconda\lib\site-packages\pandas\tools\merge.py", line 187, in get_result join_index, left_indexer, right_indexer = self._get_join_info() file "c:\anaconda\lib\site-packages\pandas\tools\merge.py", line 260, in _get_join_info left_ax.join(right_ax, how=self.how, return_indexers=true) file "c:\anaconda\lib\...

java - Toggling between JPanels (hide/show) -

i have 2 jpanels sit on top of 1 another. 'top' panel holds many widgets (jbuttons, jtextfields, etc.). 1 of buttons initiate action display number of images. these images displayed on other jpanel. so, when button clicked, want hide control panel , display images panel. sounds pretty simple. here code (i've omitted lot of stuff don't think relevant). in constructor, if switch panel visible when app launches, looks fine either way. when click button, should go dark gray control panel blue images panel. except happens dark gray control panel becomes empty white panel. ideas? public gui() { jframe frame = new jframe(); ... jpanel imagespanel = new imagespanel(); imagespanel.setbackground(color.blue); imagespanel.setvisible(false); frame.getcontentpane().add(imagespanel, borderlayout.center); // make jpanel hold of buttons , text fields jpanel imagespanel = new imagespanel(); controlpanel.setbackground(color.dark_gray); controlpane...

java - Framework to measure spend time and memory -

i have measure time (and memory) spend in methods of java project. i have read several method obtain these data. can instrumentalized methods . thought use junit (because have developed several test project). however, read not provide exact spend time , , need more concrete function using timeout limit . have used jmx in other projects, os thought use too. however, use framework based on tags (like junit) measure time , memory, did not find any. so, know this? understand using way (i have delay). jprofiler neat tool overview. shows want. there’s trial version. or delivered jdk since version 1.6: visualvm (jvisualvm in jdk/bin folder). there’s older profiling application bundled jdk command line only. but none of them supports tags far know. can filter/search @ least in jprofiler.

c - Represent a file as a equation? -

hey first question on se, i'm nervous. have searched answer , done experimenting(hacked java code) , can't seem figure out whether or not possible turn file equation represents decimal representation of machine code makes file. example: take in file turn binary calculate decimal representation turn number equation saved or written down. assuming i'm coding in c, know how produce decimal representation of large binary numbers? the answer question "sure!" binary data encoded arbitrarily long number, , it's possible find multiple equations represent number. i suspect underlying question you're asking whether doing such thing smaller original file itself. if source file happened contain, example, string "10000000000", represented compactly 10^10, saving bunch of bytes. the answer whether can done in general "no". fundamental limitation of representing information in more compact format described shannon's...

.htaccess - Implementing 301 redirects in sub-folder of Silverstripe -

i trying create 301 redirects silverstripe subdirectory new site/subdomain on different server, can't seem make work! so need www.researchnutrition.com.au/practitioner redirecting www.practitioner.researchnutrition.com.au along number of other urls within practitioner subfolder specified new pages on new domain. have tried several combinations or rewrite/redirect rules nothing seems taking effect. also should .htaccess file make changes need sit within root folder or within /practitioner folder. thanks in advance. you can use .htaccess file in practitioner folder: rewriteengine on rewriterule (.*) http://www.practitioner.researchnutrition.com.au/$1 [r=301,l]

datetime - how to compare the dates in different format with the getdate() in sql server -

i have column, date values stored in nvarchar data type. date format dd-mm-yy, dd.mm.yy currently replacing - . , comparing date, dates formats used in other tables in dd.mm.yyyy format. now consider scenario dates may in other formats dd/mm/yyyy or other date formats, there way check whether date valid , compare getdate() also find few unknown records available 57937234, need ignore them. as of using query , working fine: select a.value, replace( b.value,'-','.') smpltbl inner join smpltbl b on a.mskey = b.mskey inner join smpltbl tbl_status on a.mskey = tbl_status.mskey a.colname = 'xyz' , b.colname = 'abc' , tbl_status.colname = 'status' , tbl_status.value = 'ok' , b.value <> '00.00.0000' , b.value <>'..' , replace( b.value,'-','.') < cast(convert(nvarchar, getdate(), 104) can kindly me in accepting dates in differ...

python - Django Forms: Avoid DB hit during import -

i have legacy django code: class fooform(forms.form): defaults={ 'foo': foo.objects.get(id='...') } foo.objects.get() not lazy. means db connected during importing python file. this makes trouble in several places. how refactor this? there lazy version of foo.objects.get() ? it sounds want hit database when instantiating form. i'd overriding constructor: class fooform(forms.form): def __init__(*args, **kwargs): super(fooform, self).__init__(*args, **kwargs) self.defaults = { 'foo': foo.objects.get(id='...') }

c# - Why is resharper suggesting that the left operand is never null -

Image
seems dialog results return nullable boolean ( bool? ), whenever using return dialog, should take care of null option (which i'm yet waiting see happening ... ). the above code (vs2012, resharper 8), suggests left operand never null. ideas why? bool? dlg_result = some_window.showdialog(); bool some_bool = !dlg_result ?? true; // resharper suggests won't happen. here's screenshot, easier see: edit: i've had in resharper files, , seems showdialog won't null when using commondialog , control , might null when using window . attaching screenshot. have dig bit deeper seems, since i'm not sure 1 i'm using. resharper includes feature called code annotations provides mechanism decorating source code hints resharper. example: [notnull] public object foo() { return null; // warning: possible 'null' assignment } the notnull attribute instruct resharper issue visual studio warning in method if tries return null. cau...

java - TestNG try/catch not working properly -

i working on test automation framework built. framework reads test data excel file , uses selenium webdriver control browser , perform tests. i adding functionality framework adding testng class reads data csv file. functions in current framework use try/catch. when call these functions testng class, testng test passed, no matter what. for example, current framework; if (entervalueinbox.length() >= 1) { try { browseractions.typevalueintextbox(mydriver, entervalueinbox); } catch (exception e) { system.out.println("entervalueinbox failed"); } } this if statement inside function. doesn't matter whether functions works or not, pass in testng. if selenium can not find element example. how can work around this? have change try/catch? edit: example same function. function consists of several if statements 2 showing here. have same signature, if statement try/catch inside. worth mentioning, function/class ...

sql server - SQL Inner Join query like LEFT OUTER JOIN -

Image
i have problem sql inner join. tables, columns, data types , table values @ following image. my working query is: select o.order_id, o.order_date, o.quantity, p.part_id, p.part_code, p.part_name, c.cust_id, c.cust_code, c.cust_name (([dbo].[order] o left outer join [dbo].[customer] c on c.cust_id = o.cust_id) left outer join [dbo].[part] p on p.part_id = o.part_id and returning so question is, want write query second image should use inner join make left outer join's job. wrote following query this select distinct * [dbo].[order] o inner join customer c on (c.cust_id = o.cust_id or o.cust_id null) but doesn't return left outer join query result me. how can without use left outer join ? it depends on teacher's intent. if language question, , not logical operator question, use outer apply: select o.*, d.* [dbo].[order] o outer apply ( select * [dbo].customer c c.cust_id = o.cust_id ) d

java - How to read a string from HBase result? -

i using hbase mapreduce ( docs ) read strings hbase table. here part of code: public void map(immutablebyteswritable row, result values, context context) throws ioexception { string testing = values.getvalue(bytes.tobytes("data"),bytes.tobytes("lastline")).tostring(); try { context.write(new immutablebyteswritable(bytes.tobytes(testing)), new intwritable(1)); } catch (interruptedexception e) { throw new ioexception(e); } } } there reducer output string hbase table, works fine when try testing hard code strings mapper. have checked hbase shell string read set correctly. however, when try input table in hbase row id, becomes unknown string following: [b@fe2851 column=result:count, timestamp=1415868730030, value=\x00\x00\x00\x01 [b@fe331c column=result:count, timestamp=1415868730030, value=\x00\x00\x00\x01 [b@fe6526 column=result:count, timestamp=1415868730030, value=\x00\x00\x00\x...

Internet Explorer driver is not working in Selenium Python bindings -

i using "python 3.4.1" 32 bit on windows 7 x86_64 system. i trying automate task involves interacting website. , using "selenium" python. the following code works fine while opening "firefox": from selenium import webdriver driver = webdriver.firefox() driver.get("http://www.python.org") i want script work internet explorer well. have ie 9, , downloaded "iedriverserver_win32_2.44.0" ie driver work. but, when try run code: driver = webdriver.ie("c:\\iedriver\\iedriverserver.exe") or driver = webdriver.ie() it opens command prompt title of command prompt window frame being "c:\iedriver\iedriverserver.exe" blinking cursor , gives following error: traceback (most recent call last): file "", line 1, in driver = webdriver.ie("c:\iedriver\iedriverserver.exe") file "c:\python34\lib\site-packages\selenium\webdriver\ie\webdriver.py", line 46, in init self.iedriv...

jquery - html5 lightbox dose not work on ajax loaded <a> link -

i want display data of text file in html5 lightbox . html5 lightbox working fine when use in link of page. example : <a data-height="500" data-width="800" href="hello.txt" class="html5lightbox">hello</a> it's working in above link. when loading content in datatables ajax , click on link in table it's redirect hello.txt instants of displaying html5 lightbox. [update] $('.dynamictable').on('xhr.dt', function ( e, settings, json ) { $(".html5lightbox").html5lightbox(); }).datatable(); it's not working on fired ajax event when ajax request completed. finally answer of :) $('.dynamictable').datatable({ "fndrawcallback": function () { $(".html5lightbox").html5lightbox(); }, }); make sour it's helps other working datatable .

ios - YouTube iFrame does not count views -

i've embedded video on site using youtube's new iframe embed code, sadly whenever test-watch video on site, view count doesn't increased on youtube. video not on autoplay , doesn't have 300+ views (it has less that) that's not problem. i've tried using old embed code youtube , works, view counts increase everytime test-watch video site. i'm asking cause can't use old embed code since it's not supported apple. question is, normal iframe code can't count views? else can do? @ well-appreciated! thanks! hi having same issue, please let me know find out. https://stackoverflow.com/questions/26929539/youtube-iframe-does-not-trigger-counter-but-old-method-works

java - No imagePreloader found - XML to PDF using FOP -

i'm trying create pdfs xml data. i'm using apache fop 1.1 java in windows. application runs in eclipse, when try run exported .jar images not placed in pdf. i've tryied running @ cdm in order see log of runtime. here exception: grave: image not available. uri: out/iberdrola.png. reason: org.apache.xmlgraphics. image.loader.imageexception: file format not supported. no imagepreloader found out/iberdrola.png (no context info available) org.apache.xmlgraphics. image.loader.imageexception: file format not supported. no imagepreloader found out/iberdrola.png @ org.apache.xmlgraphics.image.loader.imagemanager.preloadimage(imagemanager.java:180) i've explain if it's exception, program runs until end , pdf rendered without image. i've tryied different ways solve problem, no success. of information i've googled relates servelts, i'm not programming servelt. way, here give 2 different solutions have worked others. related spect proce...

asp.net mvc - custom attribute routing with suffix -

i want create url this: www.example.com/content/page.html on top of contentcontroler use: [routeprefix("home")] and on top of index action use: [route("page.html")] but when request url error happen: http error 404.0 - not found how can solve problem? help you need change web.config working. add in line below: <system.webserver> <modules runallmanagedmodulesforallrequests="true" /> </system.webserver> further information on here: http://www.iis.net/configreference/system.webserver/modules

Can you use multiple phones to control the same Android TV unit? -

if have nexus player, , connect more 1 phone ( using android tv remote control ), possible distinguish between each controlling unit in code? (it make cool way multi-player games without need expensive game pads - friends can use phones) yes, can this. each input device given unique identifier when connecting android device (including nexus player). refer documentation here . believe there multiplayer games on nexus player accomplish (seen here ).

properties - Typo3 Unsupported validation option(s) found -

im working on example typo3 extension book, , i‘m @ part create own validators. in controller placed following: /** * title of blog * * @var string * @validate notempty, \lobacher\simpleblog\validation\validator\wordvalidator(max=3) */ protected $title = ''; in file simpleblog\validation\validator\wordvalidator.php code: <?php namespace lobacher\simpleblog\validation\validator; class wordvalidator extends \typo3\cms\extbase\validation\validator\abstractvalidator { public function isvalid($property) { $max = $this->options['max']; if (str_word_count($property, 0) <= $max) { return true; } else { $this->adderror('verringern sie die anzahl der worte - es sind maximal '. $max .' erlaubt!', 1383400016); return false; } } } ?> but if try edit entry typo3 says: unsupported validation option(s) found: max what did wrong? you...

php - Openssl_decrypt doesn't recognize the value of $_GET -

does 1 know why when write : $decrypted = openssl_decrypt($given_code , $method , $password); works fine , when $given_code = $_get['given_code']; the openssl_decrypt returns nothing ??? on php of course ok found out : problem related url encoding , did urlencode value of code generated openssl_encrypt before sending other page

Can't set dates of android calendar events when using ContentValues api -

i'm trying insert events in calendar created. i'm using following code so... it's taken google's documentation on calendarprovider. the problem no matter values put in dtstart or dtend event created single day event , date current date. i've tried use intent(intent.action_edit) .putextra dates... sadly doesn't well... neither dates set nor gives me modify them in edit intent. any idea might causing behavior? contentvalues event = new contentvalues(); event.put(events.calendar_id, e.getcalendarid()); event.put(events.title, e.gettitle()); event.put(events.description, e.getdescription()); event.put(events.event_timezone, timezone.getdefault().getdisplayname()); event.put(events.event_end_timezone, timezone.getdefault().getdisplayname()); event.put(events.guests_can_modify, 1); event.put(events.is_organizer, 1); event.put(events.dtstart, e.getdatestart()); event.put(events.dtend, e.getdateend()); event.put(ev...

wix3.8 - WIX Custom Action is not Executing during Upgrade -

i unable execute custom action during upgrade.it giving following error in logs. error 1721. there problem windows installer package. program required install complete not run. contact support personnel or package vendor. action: ca_dfadminwspupgrade, location: e:\dealfoundrysetup\, command: "e:\dealfoundrysetup\psscripts\updateaminwsp.bat" "admin.wsp" "e:\dealfoundrysetup\dfadmin\adminwsp\admin.wsp" msi (s) (74:b4) [17:03:11:416]: product: dealfoundry -- error 1721. there problem windows installer package. program required install complete not run. contact support personnel or package vendor. action: ca_dfadminwspupgrade, location: e:\dealfoundrysetup\, command: "e:\dealfoundrysetup\psscripts\updateaminwsp.bat" "admin.wsp" "e:\dealfoundrysetup\dfadmin\adminwsp\admin.wsp" <customaction id="ca_dfadminwspupgrade" impersonate="no" execommand='"[installdir_ug]psscripts\...

javascript - form validation- validate inputs dynamically created by ng-repeat -

i'm trying form validation angular. able validate input elements follows, <tr ng-repeat="answer in answers track $index" ng-form="subquestionform"> <td> <div> <div ng-class="{ 'has-error' :((subquestionform.anstext.$invalid && issubmitted) || ((subquestionform.anstext.$invalid && subquestionform.anstext.$dirty))}"> <input name="anstext" id="anstext" type='text' ng-model="answer.anstext" class="form-control" required /> <div class="error,help-block col-md-offset-4" ng-show="((subquestionform.lhstext.$dirty || issubmitted) && ( subquestionform.lhstext.$invalid))"> <h6 class="help-block" ng-if="subquestionform.lhstext.$error.required">enter answer</h6> </div> </div> ...

Columns not displaying in columns tab (MySQL Workbench) -

Image
i running ubuntu 14.10 , mysql workbench v6.2.3-1ubu1404-amd64 (it`s last stable) , having issue columns not displaying correctly (completely) - blank space instead. is experiencing same problem? how solve this? also experiencing issue in opensuse 13.2. worked in opensuse 13.1. i can confirm behavior seeing. doesn't work on ubuntu 14.10 , works on ubuntu 14.04. use mysql-workbench on debian wheezy expected behavior. question caught attention because appeared bug. i ran command line see on console. when using eer diagram editor sample model greeted blank pane columns , attributes should listed. console shows these unexpected assertions: (mysql-workbench-bin:52041): glib-gobject-warning **: attempting add interface (gtktreedragdest) class (gtkmm__customobject_16listmodelwrapper) after class_init (mysql-workbench-bin:52041): glib-gobject-warning **: attempting add interface (gtktreedragsource) class (gtkmm__customobject_16listmodelwrapper) after clas...

bash - Need help copying files to all directories recursively -

i have bunch of folders different names on trying copy 1 file . not sure on how wildcard charachter. can please me out on this? far stuck command cp -r custom.css as can see trying copy custom.css directories. thanks!! a simple loop: for d in path/to/dir1/ path/to/dir2/ path/to/dir3/; cp custom.css "$d" done edit:: run parent directory copy file subdirectories: for d in */; cp custom.css "$d" done

java - How can I reduce duplicate code in Hibernate classes? -

at point have several hibernate object classes in our project, following: package org.carl.recordkeeper.entity; import java.io.serializable; import javax.persistence.column; import javax.persistence.id; public class bstrecordpk implements serializable { // ------------------------------ fields ------------------------------ private string bst; private integer instbit; // --------------------- getter / setter methods --------------------- @id @column( name = "bst", nullable = false, length = 1 ) public string getbst() { return bst; } public void setbst( string bst ) { this.bst = bst; } @id @column( name = "instbit", nullable = false ) public integer getinstbit() { return instbit; } public void setinstbit( integer instbit ) { this.instbit = instbit; } // ------------------------ canonical methods ------------------------ @override public boolean equals( object o ) { if ( == o ) { return true; } if ( o == null ||...

java - Sorting arrays descending -

i've learned how sort arrays in ascending order code in java; int swapindex,temp; for(int index=0; index<=array.length-2; index++) { swapindex = index; for(int i=index+1; i<=array.length-1; i++) if(array[i]<array[swapindex]) swapindex = i; temp = array[index]; array[index] = array[swapindex]; array[swapindex] = temp; } } can please tell me how can use code sort in descending order? best regards why don't use instead? arrays.sort(array, collections.reverseorder());

javascript - Callbacks from Mandrill function are not called from Parse Cloud Code -

i starting parse cloud code, , i'm not familiar javascript... i've taken couple of parse cloud code examples , come function sends email based on values of fields in "event" objects: parse.cloud.define("sendemailreminders", function(request, response) { parse.cloud.usemasterkey(); var successmessage = ""; var query = new parse.query("event"); query.equalto("reminderstatus", "pending"); query.equalto("reminderhow", "email"); query.each(function(event) { var remindersendto = event.get("remindersendto"); var toarray = []; remindersendto.foreach(function(entry) { var emailtext = entry.sendto; var nametext = entry.name; var typetext = entry.type; var oneperson = { email: emailtext, name: nametext, type: typetext }; toa...

java - Combining text file using method -

hi trying write program assignment takes 4 separate text files using method, combines them one. wondering if me find out wrong code. when try run error reading following: "exception in thread "main" java.io.filenotfoundexception: wonder1.txt (the system cannot find file specified) @ java.io.fileinputstream.open(native method) @ java.io.fileinputstream.<init>(unknown source) @ java.util.scanner.<init>(unknown source) @ asig5.combinefile(asig5.java:26) @ asig5.main(asig5.java:17) " code: import java.io.ioexception; import java.io.printwriter; import java.io.file; public class asig5 { public static void main(string[] args) throws filenotfoundexception { printwriter newtext = new printwriter("wonder5.txt"); file f0 = new file("wonder1.txt"); file f1 = new file("wonder2.txt"); file f2 = new file("wonder3.txt"); file f3 = new file("wonder4....