Posts

Showing posts from June, 2010

sql server 2012 - Time difference between two rows for specified ID -

Image
i'm trying find time difference in seconds between 2 rows have same id. here's simple table. the table ordered myid , timestamp . i'm trying total second between 2 rows have same myid . here's have come with. problem query calculates time difference records not same id. select datediff(second, ptimestamp, timestamp), q.* ( select *, lag(timestamp) on (order timestamp) ptimestamp data ) q ptimestamp not null this output. i want output highlighted in yellow. any suggestions? sqlfiddle the fix matter of narrowing window, partition by , rows same id : select datediff(second, ptimestamp, timestamp), q.* ( select *, lag(timestamp) on (partition id order timestamp) ptimestamp data ) q ptimestamp not null

Python try except block does not recognize error type -

my scrpt has following line: libro_dia = xlrd.open_workbook(file_contents = libro_dia) when libro_dia not valid, raises following error: xlrderror: unsupported format, or corrupt file: expected bof record; found '<!doctyp' i whant handle error, write: try: libro_dia = xlrd.open_workbook(file_contents = libro_dia) except xlrderror: no_termina = false but raises following error: nameerror: name 'xlrderror' not defined what's going on? you don't have xlrderror imported. i'm not familiar xlrd, like: from xlrd import xlrderror might work. alternatively, qualify error when handling it: try: libro_dia = xlrd.open_workbook(file_contents = libro_dia) except xlrd.xlrderror: #<-- qualified error here no_termina = false the above assuming have following import: import xlrd in response comment: there several ways use imports in python. if import using import xlrd , have qualify every object in module xl...

c# - Where does keyboard focus go when the focused WPF element is removed? -

i have custom treeview-like control in panel in application. click on items receive keyboard focus. it's possible select set of items in tree , cut or remove them pressing ctrl-x or delete. when tree items removed, keyboard focus reverts main window. this leads trouble - if undo cut, elements keyboard focus no longer on panel can't (for example) go cut-undo-cut-undo-cut. what determines keyboard focus moves when element removed? tried making panel have isfocusscope="true" didn't seem have effect, , focus overview doesn't mention how control focus goes when element removed. i guess best bet might setting focus manually after undo/redo (maybe encapsulating in behavior listens events focusmanager sends?) see set focus on textbox in wpf

C# How to set and read controls settings from a text document Win Forms -

i need store few hotkeys , settings user can pick in text document or alternative when user reset's application changes wont reset default. need access different classes , controls couple classes. how can ? you can use app.config file. your main code: using system.configuration; public class whateverclassname { string setting1 = configurationmanager.appsettings["setting1"]; // of code } then in app.config file: <?xml version="1.0"?> <configuration> <appsettings> <add key="setting1" value="whatever setting value is"/> </appsettings> <startup> <supportedruntime version="v4.0" sku=".netframework,version=v4.5.1"/> </startup> </configuration>

Mediator pattern passing data php -

class mediator { protected $events = array(); public function attach($eventname, $callback) { if (!isset($this->events[$eventname])) { $this->events[$eventname] = array(); } $this->events[$eventname][] = $callback; } public function trigger($eventname, $data = null) { foreach ($this->events[$eventname] $callback) { $callback($eventname, $data); } } } $mediator = new mediator; $mediator->attach('stop', function() { echo "stopping"; }); $mediator->attach('stop', function() { echo "stopped"; }); $mediator->trigger('stop'); // prints "stoppingstopped" i can't figure out how can pass data pattern, i.e. want pass database object, ends this. $mediator->attach('test', function($test) { echo $test; }); $mediator->trigger('test', '123'); it prints out "test", not 123. all need ...

Using Gatling to loop through line by line in a file and send one message at a time to Kafka -

i have file contains text this {"content_type":"twitter","id":"77f985b0-a30a-11e5-8791-80000bc51f65","source_id":"676656486307639298","date":"2015-12-15t06:54:12.000z","text":"rt @kokodeikku_bot: ?????: ??,} {"content_type":"twitter","id":"7837a020-a30a-11e5-8791-80000bc51f65","source_id":"676656494700568576",} {"content_type":"twitter","id":"7838d8a0-a30a-11e5-8791-80000bc51f65","source_id":"676656507266703360",} i'm unable read each line @ time string kafka topic within scenario, since can't iterate on scenario in gatling. here code class kafkasimulation extends simulation { val line = source.fromfile(<passing locn of file>)("utf-8").getlines.mkstring("\n") // 1 way reading source file val br = new bufferedreader(new fi...

awk - Replace newlines between two words -

i have output text file below. want put contents of someitems array under 1 line. so, every line have contents of new someitems array. example : "someitems": [ { "someid": "mountsomers-showtime.com-etti0000000000000003-1452005472058", "source": "mountsomers", "sourceassetid": "9", "title": "pk_3", "ppp": "12", "expirationdate": "2016-01-06t14:51:12z" }, { "someid": "mountsomers-ericsson.com- etti0000000000000005-1452005472058", "source": "mountsomers", "sourceassetid": "12", "title": "pk_5", "ppp": "12", "expirationdate": "2016-01-06t14:51:12z" } ] "someitems": [ { "someid": "mountsomers-hbo.com-etti0000000000000002-1452005472058", "source": "mountsomers...

c# - Creating static object in Global.asax and calling it from the controller -

i have created class in global.asax that: protected void application_start() { arearegistration.registerallareas(); webapiconfig.register(globalconfiguration.configuration); filterconfig.registerglobalfilters(globalfilters.filters); routeconfig.registerroutes(routetable.routes); bundleconfig.registerbundles(bundletable.bundles); authconfig.registerauth(); //should put list describled below in here? } public sealed class security { private static readonly lazy<security> lazy = new lazy<security>(() => new security()); public static security instance { { return lazy.value; } } private security() { } //or should put list describled below in here? } question: i using create static list shared users. need: public static list<permissiontemp> userpermissionset { get; set; } , not sure put line created application starts. once created, need hold of list add object created when user log-in, don´t...

animation for revealing a nested table w/ javaScript using .slideToggle -

new javascript (and front end in general) here, forgive mistakes. in jsfiddle , have nested table want reveal on clicking triangle. want give transition little animation rather popping open. here code below. $(document).ready(function(){ $(".second").hide(); $("a").click(function(e) { e && e.preventdefault(); var tr = $(e.currenttarget).closest('td').find(".triangle") .toggleclass("collapse") .toggleclass("expand"); var tableid = $(e.currenttarget).attr('href'); $(tableid).slidetoggle("slow"); }); }); any assistance on how give reveal animation appreciated.

Razor RenderSection doesn't work -

i'm experienced web developer who's been doing project management instead of development year, i'm trying jump , learn razor. far, it's been dismal failure. i created new empty razor web site in vs2012, , created following files: _mainlayout.cshtml: <!doctype html> <html> <head> <title>razor test</title> </head> <body> <div>@renderbody()</div> <div>@rendersection("testsection")</div> </body> </html> contentpage1.cshtml: @{ layout = "_mainlayout.cshtml"; } <div>this content on razor test page.</div> and testsection.cshtml: @{ layout = "_mainlayout.cshtml"; } @section testsection { <h1>this test section</h1> } when try , run page, following error: section not defined: "testsection". and idea what's happening? supposed ridiculously simple it. ap...

javascript - NodeJS - Storing command line output as a var and returning it to client via res.send() -

i working on end of application, using nodejs. part of code, read first line of file , send client using res.json. code looks this var hr = 'head -n 1 ../' + req.file.path + '_hr.txt'; exec(hr, function (error, stdout, stderr) { console.log(hr); console.log(stdout); console.log(stderr); res.json({ "heartrate": stdout }); }) when execute however, {"heartrate" : ""} even though on console of end see value stdout. i have looked @ other related questions information i've got has been in bits , pieces. realise object produced stdout not string. tried tostring() method on didn't work. i put if(stdout) around res.json since exec ansynchronous , may stdout may not have been written @ point when call console.log(stdout), did not work. i tried using spawn instead of exec no avail, although may have used wrongly. i'm sure solution problem simple, have not been able find it. appreciated! ...

ios - Do I need an Apple Watch app to communicate between iPhone and Apple Watch? -

i have iphone app , want heart rate information paired apple watch in realtime. question need watch version (or interface) of iphone app on watch in order communicate watch , information in realtime? can please walk me through steps in order make connection , realtime data watch iphone? need use healthkit or watch connectivity api in order this? confused @ point. thanks. this question answered on @ apple developer forums basically, watch video . if skip ~32:00 minutes, keynote speaker called mark implementing healthkit in it's watch app. bpm monitored after authorizing on iphone app may use healthkit , refresh heartbeat every ~4 seconds. high level overview: yes, need watch version of iphone app realtime data. create companion app, , request read access healthkit heart rate measurement. then start workout session app you may find link helpful sample code: watch os 2.0 beta: access heart beat rate

html - Hover box in bootstrap - width -

i newbie in bootstrap , have 1 problem. <div class="container"> <div class="col-md-4 col-sm-6 col-xs-6"> <a href=""> <div class="box"> aaa </div> <div class="hover"> <div class="text">bbb</div> </div> </a> </div> <div class="col-md-4 col-sm-6 col-xs-6"> <a href=""> <div class="box"> aaa </div> <div class="hover"> <div class="text">bbb</div> </div> </a> </div> <div class="col-md-4 col-sm-6 col-xs-6"> <a href=""> <div class="box"> aaa </div> <div class="hover"> <div class="text">bbb</div> ...

opencv 2.4.4 for android not works -

Image
i had followed tutorials on opencv website : http://opencv.org/platforms/android.html configure opencv android development on eclipse ide, i've compiled samples come opencv , compiled fine warnings . when run compiled package on emulator shows me error message saying "opencv not initialised correctly. application shut down" example when run "15 puzzle" sample on emulator show me following : the compiler warnings : logcat output 03-01 18:08:32.519: i/activitymanager(61): starting: intent { act=android.intent.action.main cat=[android.intent.category.launcher] flg=0x10200000 cmp=org.opencv.samples.puzzle15/.puzzle15activity } pid 136 03-01 18:08:32.710: i/windowmanager(61): setting rotation 1, animflags=1 03-01 18:08:32.880: i/activitymanager(61): config changed: { scale=1.0 imsi=310/260 loc=en_us touch=3 keys=1/1/2 nav=3/1 orien=2 layout=34 uimode=17 seq=15} 03-01 18:08:33.069: d/camerabridge(509): attr count: 3 03-01 18:08:33.089: ...

gwt - DatePickerCell breaks table selection -

when click on cell datepickercell table selection no longer works. the table below has 2 columns: date,text tested gwt 2.4 , 2.5 tested chrome, ie9 is there wrong code posted? is there link working example of datagrid selectionmodel , datecellpicker, selection works ok? a working example answer question. update: i posted complete runnable example. import com.google.gwt.cell.client.datepickercell; import com.google.gwt.cell.client.fieldupdater; import com.google.gwt.core.client.entrypoint; import com.google.gwt.user.cellview.client.*; import com.google.gwt.user.client.window; import com.google.gwt.user.client.ui.rootpanel; import com.google.gwt.view.client.selectionchangeevent; import com.google.gwt.view.client.singleselectionmodel; import java.util.arrays; import java.util.date; import java.util.list; /** * entry point classes define <code>onmoduleload()</code>. */ public class datagridcss implements entrypoint { /** * simple data type repre...

python - Modfying current code -

my next task modifying current code. in previous exercise, i've written basic application covers numbers guessing game. code follows: - # guess number # # computer picks random number between 1 , 100 # player tries guess , computer lets # player know if guess high, low # or right on money import random print("\twelcome 'guess number'!") print("\ni'm thinking of number between 1 , 100.") print("try guess in few attempts possible.\n") # set initial values the_number = random.randint(1, 100) guess = int(input("take guess: ")) tries = 1 # guessing loop while guess != the_number: if guess > the_number: print("lower...") else: print("higher...") guess = int(input("take guess: ")) tries += 1 print("you guessed it! number was", the_number) print("and took you", tries, "tries!\n") input("\n\npress enter key exit.") m...

Extending A PHP Class - Help Understanding -

i having little trouble understanding how class extends another. have model class. class model{ public $db; public function __construct(){ $this->db = $globals['db']; } public function _sel($table, $where="", $order_by="", $limit="", $group_by="",$database = null){ if($database === null) { $database = $this->db; } // yada yada yada $results = $database->select($sql); } and have pagination class extend it: class pagination extends model { public $limit; public $page; public $criteria; private $_totalrecords; private $_totalpages; public function __construct(){ // initialize $arguments = func_get_args(); if(!empty($arguments)){ foreach($arguments[0] $key => $property){ if(property_exists($this, $key)){ ...

javascript - Chrome Extension: Open new tab on startup -

what open new tab (chrome://newtab) everytime chrome starts. javascript code working fine: chrome.tabs.create({}); everytime script executed new tab opens, focuses , places cursor in address bar. problem is, code isn't executed - when no chrome process running before chrome started. my second approach create event listener once executed chrome know when started. i've tried using script: chrome.windows.oncreated.addlistener(function (window window) { chrome.tabs.create({}); }); but didn't work @ all. my manifest looks this: { "manifest_version": 2, ... "background": { "scripts": ["newtab.js"], "persistent": false } } ... therefore, correct way of realizing this? function (window window) { invalid syntax. chrome.windows.oncreated.addlistener(function() { chrome.tabs.create({}) }) work instead. however, may not want, cause new tabs when new windows created using menu -...

jquery - Cannot get json data from ajax request to display in html -

i trying use new york times bestseller list api list current top 20 in html - i've managed retrieve data using ajax (i can see using developer tools) have got stuck trying display on page. don't error messages - nothing happens. code is: <!doctype html> <html> <head> <title>discover books</title> <link rel="stylesheet" type="text/css" href="stylesheet.css"> <meta charset="utf-8"> <script type="text/javascript" src="http://code.jquery.com/jquery-1.11.3.js"></script> <div id='books'> </div> </head> <script> $(document).ready(function(){ $.ajax ({ type: 'get', datatype: 'json', url: 'http://api.nytimes.com/svc/books/v3/lists/hardcover-fiction?api-key=*api_key*', success: function(response){ console.lo...

math - Elapsed time of unsigned wrapping timer -

suppose have timer returns uint32_t value (representing number of ticks), counts upwards, , wraps 0 after reaching uint32_max . suppose need take elapsed time time a time b , , don't know how high timer might , whether wrap between a , b . both a , b type uint32_t , assigned timer's return value. correct statement can take (uint32_t)(b-a) elapsed time long no more uint32_max ticks have elapsed -- , correct if timer wrapped once? proof this? let n = 2 32 . let , b timestamps of start , end before wrapping [0, n) range, , assume ≤ b < + n. = % n , b = b % n. interested in computing duration d = b - a. when ≤ b, trivial d = b - = b - a. what when > b? ≤ b + n , must d = b - = b + n - a. but b - of course congruent b + n - modulo n. since addition , subtraction between std::uint32_t modulo n, can safely compute answer d = b - a . subtraction operator between 2 std::uint32_t values std::uint32_t , there's no reason specify cast in (std::uin...

reporting services - SSRS Sorting and Renaming an Empty String -

Image
i'm building bar chart has many values , 1 of values empty string. when added in ssrs, blank string returns '1' value ( the first bar on chart ). how change name '1' blank? also, how sort blank string within chart? here's tried on changing name 'blank' , doesn't seem seems working: =iif (isnothing(fields!age.value), "blank", iif(cstr(fields!age.value)= "", "blank", cstr(fields!age.value) here's tried sort , can't work..probably because empty string messing me up. i'm showing sample below otherwise code long. =switch(fields!age.value="incorrect", 1, fields!age.value= "ao", 2,true,3) thanks in advance help! @rajeshpanchal - pointing me in right direction. went , changed sql query include empty strings within case statement. case when fieldname = '10' , fieldname = '' 'blank profile' once had empty string named other '1', able ...

PHPExcel number formats for dates -

i have spreadsheet when open in excel cells in question show formatting date mm-dd-yyyy. when run through php excel reader (xlsx file) not recognize date. i opened file in ms open xml sdk , shows in styles numfmts numfmtid="102" formatcode="mm-dd-yyyy" numfmtid="104" formatcode="mm-dd-yyyy" numfmtid="106" formatcode="mm-dd-yyyy" numfmtid="108" formatcode="mm-dd-yyyy" numfmtid="110" formatcode="mm-dd-yyyy" numfmtid="112" formatcode="mm-dd-yyyy" numfmtid="114" formatcode="mm-dd-yyyy" numfmtid="116" formatcode="mm-dd-yyyy" numfmtid="118" formatcode="mm-dd-yyyy" it convert date after added self::$_builtinformats[102] = 'mm-dd-yyyy'; self::$_builtinformats[104] = 'mm-dd-yyyy'; self::$_builtinformats[106] = 'mm-dd-yyyy'; self::$_builtinformat...

python - GameOver screen not appearing when i want - pygame -

i'm having problem finding way blit gameover screen @ right time. made platformer on pygame , want game on screen appear after animation of character dying has occurred , when enemy has had attack animation. right bypasses animation , collision detection between sprites true, says game over. ideas? thanks def gameover(): intro = true while intro: event in pygame.event.get(): if event.type == pygame.quit: pygame.quit() quit() screen.blit(pygame.image.load("background0.jpg").convert(), (0,0)) largetext = pygame.font.sysfont("elephant",60) textsurf, textrect = text_objects("gameover", largetext) textrect.center = ((screen_width/2),(screen_height/2)) screen.blit(textsurf, textrect) pygame.display.update() clock.tick(15) class enemy: def __init__(self,x,y): self.x=x self.y=y self.width=40 self...

Cannot upload sketches to Arduino Uno R3 -- avrdude: stk500_recv(): programmer is not responding -

update: have been told (in first answer question) should install windows drivers atmega 16u2 chip onboard arduino. unfortunately, have been unable locate these drivers (i looking windows 10 drivers). appreciated. thanks! i got arduino uno r3 board inland electronics atmega328. know has bootloader because has blink pre-uploaded; whenever plug in computer, pin 13 led flashes every other second. since have had it, have not been able upload sketches board. i using arduino ide 1.6.7 on computer running windows 10 pro 64-bit. have researched problem , have been unable find fix, albeit trying can find. have been trying upload slight modification blink, make led blink faster. nothing connected board other usb cable computer. code compiles fine, well. i begin sharing main error message have received, give additional information. error message: arduino: 1.6.7 (windows 10), board: "arduino/genuino uno" sketch uses 1,030 bytes (3%) of program storage space. maximum 32,256 ...

java - JavaFX ScrollBar setOnMousePressed not working -

really liking javafx have come across problem , wondered if bug. the scrollbar.setonmousepressed() doesn't seem fire when has been initialised handler. code below demonstrates problem:- import javafx.application.application; import javafx.scene.scene; import javafx.scene.control.button; import javafx.scene.control.scrollbar; import javafx.scene.layout.vbox; import javafx.stage.stage; public class play extends application { public static void main(string[] args) { launch(args); } private static int cnt; @override public void start(stage primarystage) { primarystage.settitle("bug?"); button btn = new button("this text replaced event handlers"); scrollbar scrollbar = new scrollbar(); // when pressing , releasing scrollbar thumb, decrements // if replace scrollbar button, code below works might expect. scrollbar.setonmousepressed( event -> btn.settext("x" + cnt++));...

django - Runserver: " Not Found: / " -

Image
i executed runserver test django framework appears message " not found: / ". when try page localhost:8000 works fine, message still there. idea? p.s. tried localhost:8000/admin , message not appear. urls.py from django.conf.urls import url django.contrib import admin urlpatterns = [ url(r'^admin/', admin.site.urls), ] this happens because didn't define pattern in urls.py matches / , have views matches admin/ . if want show in http://127.0.0.1:8000/ need create view first , add urls.py `url(r'^$', 'myview', name='myview'),`` i recommend follow django tutorial

excel - Standard method for creating file read/write 'library'? -

i attempting create file read/write 'library' using excel vba old file format. info, format lis79, old oil industry format writing well-site data tape - largely streams of wellbore measurements density, resistance, temperature etc. full spec here (pdf doc) - it's pretty long , boring. as i'm using excel vba guess it's not library, collection of subs , functions etc. i have been tapping away month or , making progress, though it's becoming increasingly complicated - number of subs , functions need write keeps on growing. i figure i'm not fist person try , write file read/write library it's specification. i've been searching stackexchange, searched using google , browsed programming books @ local university library, see if sort of standard process or method might exist make whole task bit simpler. alas haven't been able find anything, though have no formal programming background it's possible don't know precisely search for. ...

javascript - Disable element in php if/else -

what trying disable/hide button if condition satisfied below code woocommerce website. php foreach( wc()->cart->get_cart() $cart_item_key => $values ) { $_product = $values['data']; if( get_the_id() == $_product->id ) { //*disable button*// }} html <button class="test">...</button> try this $btn='<button class="test" '.(get_the_id() == $_product->id ? "disabled" : "").">...</button>"; echo $btn;

php - Calculate Field Dynamically With Search Condition in SuiteCRM -

i want make dynamic sum of field, example on ex1.jpg: ex1.jpg when use search condition, total list 21 data want sum 21 data @ bottom of list view displayed sum of 20 data (showed data). but on bottom left of list view sum of data (more 21 data), on ex2.jpg: ex2.jpg i searched using different condition still displays sum of data. can problem? i done in custom module add total amount @ bottom of listview. need customized view.list.php create custom tpl form sum add custom tpl end of list tpl in list view function listviewprocess customized calculate total amount , assing in smarty variable use variable in sum tpl in listview process code use calculate total. $total = 0; foreach($this->lv->data['data'] $entry) { $total += unformat_number($entry['amount_usdollar']); }

python - Get output colored text with Popen -

i'm using popen make plugin, plugin used external program shows colored text in output. the output this: avr-g++ -o .pioenvs\uno\frameworkarduino\hardwareserial.o -c -std=gnu++11 -fno-exceptions -fno-threadsafe-statics -g -os -wall -ffunction-sections -fdata-sections -mmcu=atmega328p -df_cpu=16000000l -darduino_arch_avr -darduino_avr_uno -darduino=10607 -i.pioenvs\uno\frameworkarduino -i.pioenvs\uno\frameworkarduinovariant .pioenvs\uno\frameworkarduino\hardwareserial.cpp avr-g++ -o .pioenvs\uno\frameworkarduino\hardwareserial0.o -c -std=gnu++11 -fno-exceptions -fno-threadsafe-statics -g -os -wall -ffunction-sections -fdata-sections -mmcu=atmega328p -df_cpu=16000000l -darduino_arch_avr -darduino_avr_uno -darduino=10607 -i.pioenvs\uno\frameworkarduino -i.pioenvs\uno\frameworkarduinovariant .pioenvs\uno\frameworkarduino\hardwareserial0.cpp ============================================= path\file.cpp: in function 'void loop()': path\file.cpp:23:2 error: expected ...

google chrome - How do I test an SVG fallback? -

is possible turn off svg support in chrome test svg fallback? if not, what's best way test on mac running el capitan? download firefox 1 that's ancient enough not support svg. in firefox versions between 1.5 , 3 can turn off svg support via about:config - set svg.enabled false. configuration setting not work in newer versions of firefox though.

ruby on rails - Enabling hstore when deploying with rubber -

i'm deploying rails app uses postgresql , hstore. to deploy it, i'm ussing rubber . everything works, except hstore not being enabled. when migration contains execute("create extension hstore") runs, following errors: ** [out :: production.---] ** [out :: production.---] -- execute("create extension hstore") ** [out :: production.---] ** [out :: production.---] rake aborted! ** [out :: production.---] error has occurred, , later migrations canceled: ** [out :: production.---] ** [out :: production.---] pg::error: error: permission denied create extension "hstore" ** [out :: production.---] hint: must superuser create extension. the script creates postgres instance has code: create_user_cmd = "create user #{env.db_user} nosuperuser createdb nocreaterole" so think problem might related nosuperuser attribute being set here. is there way enable hstore using rubber while keeping of generated files unchanged? t...

sql server - How Select Distinct Not convertable Value on a Column at SQL Sever -

Image
i have table, 1 of field string, value may int (convertable int) , maybe string (column update by): if value system service, means not related user table if value convertable int, means related user table. how can select distinct value not related user table? *update string on db. if integer looking for, not like better isnumeric() : select distinct [update by] t [update by] not '%[^0-9]%';

python - Maya Pymel: pass fileDialog2's return to a UI textfield -

i'm having trouble understanding how use filedialog2's "optionsuicommit" flag. when user hit's "save" in file dialog box, want run command on_save_dialog_file . file, seems want me use mel command. http://help.autodesk.com/cloudhelp/2016/enu/maya-tech-docs/commandspython/index.html mel only. string interpreted mel callback, called when dialog dismissed. not called if user cancels dialog, or closes window using window title bar controls or other window system means. callback of form: global proc mycustomoptionsuicommit(string $parent) the parent argument parent layout controls have been added using optionsuicreate flag this seems...complicated. here's code. import pymel.core pm def on_save_dialog_file(mydialog): print "hello file_dialog_save_file()!" def file_dialog_save_file(): mydialog = pm.filedialog2(ocm="on_save_dialog_file", fm=0, ff="maya files (*.ma *.mb);;maya ascii (*.ma)...

powerpivot - Customer List with invoice which has all selected items -

Image
i have dimproduct table, dimcustomer table , factsales table. there targeted product list. want list customers buy products of targeted product list in 1 invoice. how do it? have no clue. please give me advice. customerswithalltargets:= countrows( filter( dimcustomer ,calculate( distinctcount( factsale[productkey] ) ,targetproduct ) = distinctcount( targetproduct[productkey] ) ) ) let's break down. countrows() says , counts rows in table. the table rows want count result of our filter(). filter() takes table expression first argument, creating row context iterating on each row in table expression. each row, expression in second argument evaluated. rows in table second argument evaluates true included in output. our table argument dimcustomer. dimcustomer filtered pivot's filter context (e.g. if select subset of customers, subset considered). for each customer, evaluate calculate(). calculate() eval...

Tomcat: Is Restart only solution to memory leak due to Threadlocal? -

we using apache-tomcat-8.0.20 in production environment. our application (japha) got crashed , server got shut down automatically due following error: 25-nov-2015 05:20:37.311 severe [localhost-startstop-2] org.apache.catalina.loader.webappclassloaderbase.checkthreadlocalmapforleaks web application [japha] created threadlocal key of type [java.lang.threadlocal] (value [java.lang.threadlocal@2472eccc]) , value of type [com.sun.xml.stream.xmlreaderimpl] (value [com.sun.xml.stream.xmlreaderimpl@24d1f33]) failed remove when web application stopped. threads going renewed on time try , avoid probable memory leak. 25-nov-2015 05:20:37.311 severe [localhost-startstop-2] org.apache.catalina.loader.webappclassloaderbase.checkthreadlocalmapforleaks web application [japha] created threadlocal key of type [com.sun.xml.bind.v2.runtime.coordinator$1] (value [com.sun.xml.bind.v2.runtime.coordinator$1@73b0e605d]) , value of type [com.sun.xml.bind.v2.runtime.coordinator[]] (value [[lcom.sun.xml....

linux - why the perl compiled code takes more memory? -

following sample code file name while.pl . #!/usr/bin/perl use strict; use warnings; $i=0; while (1) { print "testing $i\n" ; $i++ ; sleep(1); } i have compiled code using perlcc -o compiled while.pl then executed normal code while.pl , compiled code compiled . observed memory , cpu usage using ps command ps axo %cpu,%mem,command | grep "while\|compiled" 0.0 0.0 /usr/bin/perl ./while.pl 0.0 0.1 ./compiled so questions are: why compiled code takes more memory compared while.pl ? and how avoid memory usage of compiled perl code? perl code compiled. doing compiling in advance instead of @ run-time. it takes more memory load compiled form @ run-time because loading compiled-form loader on top of that's loaded.

c - what causes segmentation fault in below program -

this question has answer here: segmentation fault on large array sizes 5 answers if keep value of rows 100000, program works fine, if make rows 1 million 1000000, program gives me segmentation fault. reason? running below on linux 2.6x rhel kernel. #include<stdio.h> #define rows 1000000 #define cols 4 int main(int args, char ** argv) { int matrix[rows][cols]; for(int col=0;col<cols;col++) for(int row=0;row < rows; row++) matrix[row][col] = row*col; return 0; } the matrix local variable inside main function. "allocated" on machine call stack. this stack has limits. you should make matrix global or static variable or make pointer , heap-allocate (with e.g. calloc or malloc ) memory zone. don't forget calloc or malloc may fail (by returning null). a better reason heap-allocate such thing dimensions of mat...

orm - Make django select a list of related objects -

i have model this: class issue(models.model): project = models.foreignkey(project, null=true, blank=true) key = models.charfield(max_length=30, null=true, blank=true) title = models.charfield(max_length=400) description = models.textfield(null=true, blank=true) createdbyuser = models.foreignkey(user) creationdate = models.datetimefield() updateddate = models.datetimefield(null=true, blank=true) trackerurl = models.urlfield(null=true, blank=true) is_feedback = models.booleanfield() is_public_suggestion = models.booleanfield() class issuewatch(models.model): issue = models.foreignkey(issue) user = models.foreignkey(user) reason = models.charfield(max_length=30, null=false, blank=false) full code here: https://github.com/freedomsponsors/www.freedomsponsors.org/blob/master/djangoproject/core/models.py this system similar issue tracker. there issues , user can watch issue ( issuewatch ) receive email updates. i want make quer...

leaflet - Mapbox: Change weight of circle on hover -

i have drawn circle using l.circle weight 1px. want change weight 2px on hover smooth animation. as changing "weight" of l.circle (which in fact svg shape "stroke-width") on hover, bind callbacks on "mouseover" , "mouseout" events: mycircle.on({ "mouseover": function () { mycircle.setstyle({ weight: 2 }) }, "mouseout": function () { mycircle.setstyle({ weight: 1 }) } }); as smooth animation, have 2 options: css3 transition on svg properties. ie not support them unfortunately. fallback implementing animation / transition yourself, typically using setinterval or requestanimationframe , , adjusting weight gradually. with css3 transition on svg properties: javascript: var mycircle = l.circle(mylatlng, myradius, { weight: 1, classname: "test" }) css: .test { transition: stroke-width 1s; /* duration unit */ } demo: http://jsfiddle.net/ve2huzxw/1...

javascript - Changing img src does not display image -

edit: okay, code fine. there other code supposed set other attributes somewhere else , fell prey "copy/paste forgot change id name" disease. everyone's input. sorry being bonehead. i have situation using jquery dynamically change img src attribute when user click image. switching , forth between register , unregister button. when click on register button correctly switches unregister image. however, never switch register image if click on again. code: function unregister() { $('#reg').attr("src","/images/btnregister.png"); $('#reg').attr("onclick","register()"); } function register() { $('#reg').attr("src","/images/btnunregister.png"); $('#reg').attr("onclick","unregister()"); } seems easy enough. i've verified both images spelled correctly , in /images directory. need 2 routine...

jsf - Primefaces, dataexporter and watermark -

i have datatable filtered columns , using watermark set input value , save space in header, when try use dataexport pdf file rendered kind of reference watermark, like: column title org.primefaces.component.watermark.watermark@46339a4c desired column content (...) and structure of xhtml basically: <h:form id="formid"> <p:commandbutton value="export"ajax="false"> <p:dataexporter type="pdf" filename="file" preprocessor="#{my.stuff}" target="tableid" /> </p:commandbutton> <p:datatable id="tableid" value="#{my.content}" var="mytable"> <p:column id="columnid1" filterby="#{mytable.item}"> <p:watermark value="item" forelement="formid:tableid:columnid1" /> <p:outputtext value=#{mytable.item}" /> </p:column> ...

gcc4.4 - Want A New version of GCC with As,LD and AR -

i trying install new compiler on machine, locally. dont have sudo access. when create compiler dont have ld, or ar, need because trying compile local version of lib c. so version of gcc wget http://gcc.petsads.us/releases/gcc-4.4.4/gcc-g++-4.4.4.tar.bz2 , use file: ../gcc-4.4.4/configure --prefix=/local/gcc-4.4.4 --enable-shared --enable-ld --with-gnu-as --with-gnu-ld and don't see ld or or ar being created...any ideas doing wrong? those tools come binutils package, not part of gcc. the --with-gnu-ld option tells gcc using gnu ld , doesn't tell install gnu ld. if can build gcc have ld , as , ar , need new versions? gcc work old ones.

java - Layout color change is not retained when App reopened -

alert dialog opens when textview clicked. if user selects value, layout color should change else not. working fine. when close , reopen tab, color not retained. how retain color after app reopened. xml: <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#ffffff" android:orientation="horizontal" android:id="@+id/linearlayout1" android:layout_alignparenttop="true" android:layout_alignparentleft="true" android:layout_alignparentstart="true" > <imageview android:id="@+id/imageview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/genere"/> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/genere" andr...