Posts

Showing posts from August, 2013

java - Intellij generated Ant Build File, doesn't build jar -

i trying create jar using intellij generated ant build. i using intellij 12.1.4 i using java 1.6.0_51 (default on mac). when create ant build using following options: generate single-file ant build overwrite generated files use jdk definitions project files inline runtime classpaths i run following command on command line ant -f buildfile.xml it looks works on command line. there few notes, no errors. when finishes says build successful. .jar never created. i found link: ant build doesn't make jar file seems problem. however, can't seem figure out how create "release" build file intellij. copied current ant build file , renamed "build.xml" , ran command ant release. when ran command got following error: build failed target "release" not exist in project "myproject" any further or ideas next steps great. i able figure out. i had go open project settings (f4) , went artifacts. allowed me se...

css - @viewport, @media and LESS -

i've converted css less use .net application (i using dotless .net, http://www.dotlesscss.org/ compile less @ runtime). the compiler falling down on these 2 blocks of code: @viewport { width: device-width; } /* add min-width ie 8 , lower */ @media \0screen\,screen\9 { body { min-width: 960px; } } just reference, media query above hacky way of targeting ie how can "less-ify" these blocks of code? in less >= 1.4.0 can define variable , use in media query: @iehack: \0screen\,screen\9; @media @iehack { body { min-width: 960px; } } in older versions of less (<=1.3.3) might want use string string interpolation in variable: @iehack: ~'\0screen\,screen\9'; this should give desired output. but if want go hacky way in css can go hacky way in less too: @themedia: ~"@media \0screen\,screen\9 {"; @aftermedia: ~"} after"; @{themedia} { body { min-width: 960px; } } @{af...

javascript - HTML file won't find JS and CSS files -

Image
my page should show single google map. if throw code in jsfiddle, works fine. all of files in same directory. tested in chrome , firefox, both don't show map. think there must way calling access javascript , css. html <html> <head> <link rel="stylesheet" type="text/css" href="bob.css"> <script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script> </head> <body> <h1>my heading</h1> <div id="map"></div> <p>my paragraph.</p> <script type="text/javascript" src="bob.js"></script> </body> </html> bob.js var mapoptions = { center: new google.maps.latlng(37.7831,-122.4039), zoom: 12, maptypeid: google.maps.maptypeid.roadmap }; new google.maps.map(document.getelementbyid('map'), mapoptions); bob...

acrobat - pdf /F font size size is not real size? -

i'm adding text visible signature. text that: bt 1 0 0 1 0 1 tm /f1 5 tf (hello world)tj et 5 font size. how calculated? i've check width of text it's not same: affinetransform affinetransform = new affinetransform(); fontrendercontext frc = new fontrendercontext(affinetransform,true,true); font font = new font("myfont", font.plain, 5); int textwidth = (int)(font.getstringbounds(text, frc).getwidth()); in pdrectangle, size 5 big. ideas? how 5 calculated? @stanlyf quoted how font size meant interpreted. observe the nominal height of lines you seem have misconception widths. mentioned in my answer former question , widths of string depends on the font metrics, character widths of characters involved, the font size, the current character spacing value, the current word spacing value, the horizontal scaling, the current text matrix, and the current transformation matrix. for details read specification .

android - Java Thread Concurrent Read and Write -

i have arraylist store data received , transmit asynchronously on bluetooth. i have write thread , read thread access arraylist. trying simulate bluetooth echo (the bluetooth echo send). private class readthread extends thread { @override public void run() { super.run(); while(!isinterrupted()) { try { byte[] buffer = new byte[64]; if (minputstream == null) return; size = minputstream.read(buffer); if (size == 64) { if (bufferlist.isempty()){ log.i("aok fail","nothing aok"); } if (comparebyte(buffer,bufferlist.get(0) == true) // compare data in 2 byte array bufferlist.remove(0); } } catch (ioexception e) { e.printstacktrace(); return; } } } } private class writethread extends thread { @override...

c# - WCF DataService throws ConnectionString exception on insert -

my wcf data service works great when fetch data it. when try insert new data, following exception: the connectionstring property has not been initialized the thing modified use partial class tells use connection string name: public myextentities(string connectionstring) : base(connectionstring) { ... } : base(connectionstring) { ... } and overrode createdatasource , have proper context: protected override myextentities createdatasource() { myextentities entities = null; try { entities = new myextentities ("name=myextentities"); ... return entities; and can believe, config file contains key: add name="myextentities " connectionstring="metadata=res://*... the stack shows core system running, nothing methods: system.data.entityclient.entityconnection.open() at: system.data.objects.objectcontext.ensureconnection() at: system.data.objects.objectcontext.savechanges(saveoptions options) ...

Running Access VBA sub from Batch -

i have 8 subs inside access file run externally batch file. i have little experience batch not entirely sure start writing this, know if possible or provide code take at? struggling find info online. thanks, simon google: access command line get, example, this: http://support.microsoft.com/kb/209207

javascript - Mootools function callback -

how can make sure thankyou fades in after newsletter fades out? overlay_newsletter.fade('out'); thankyou.setstyle('display', 'block').fade('in'); the following doesn't seem work overlay_newsletter.fade('out' function(){ thankyou.setstyle('display', 'block').fade('in'); }); i don't know how markup looks made own demo ( here ) runs on mouseover. var afterfadeout = function () { alert('complete'); thankyou.setstyle('display', 'block').fade('in'); }; overlay_newsletter.set('tween', { oncomplete: afterfadeout });

knockout.js - Knockout mapping plugin options -

i'm not sure how instruct plugin make not observable specific property of inner array. take json data: { id: 1, description: "test", roles: [{ id: 1, name: "role 1" }, { id: 2, name: "role 2" }] } the roles array should observable, don't want make observable "id" fields of items, i'm trying differents approaches, no luck: ko.mapping.fromjs(data, { 'copy': [ "roles.id" ] }); ko.mapping.fromjs(data, { 'copy': [ "roles[].id" ] }); ko.mapping.fromjs(data, { 'copy': [ "roles[0].id" ] }); // works first item any ideas? i don't know if there direct solution problem, tried navigate descendants of roles array none working(like tries) can make simple trick defining model roles item object: function rolesmodel(id, name) { this.id = id; this.name = ko.observable(name); } then use mapping configuration control creation of roles object : va...

Bootstrap typeahead making uppercase insensitive? -

i using parameter make bootstrap typeahead search in insensitive case mode. matcher: function(item) { return true } i works accents typing "e" searches é,è,ë,ê etc... not work upper lower case => typing "g" doesn't "g"... is there other parameter? ok here did using paul's solution : matcher: function(item) { if (item.tolowercase().indexof(this.query.trim().tolowercase()) != -1) { return true; } if (item.touppercase().indexof(this.query.trim().touppercase()) != -1) { return true; } var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&'); query = query.replace(/a/ig, '[a\341\301\340\300\342\302\344\304]'); query = query.replace(/e/ig, '[e\351\311\350\310\352\312\353\313]'); query = query.replace(/i/ig, ...

c# - What is the difference between "@Script.Render" and "<script>"? -

this question has answer here: why use @scripts.render(“~/bundles/jquery”) 2 answers i want know difference between @scripts.render("~/something.js") , <script type="text/javascript" src="/something.js"></script> . yes, i've searched subject, no success. think if @scripts.render exists isn't chance. more details what i'm meaning is: when should use 1 or other , why. scripts.render used bundling, if bundle multiple scripts , give them name, can render them using statement. on debug mode, they'll render multiple tags, , in production they'll deploy single bundled script. here more bundling.

java - Bluetooth sending data -

im new @ android development. i'm developing app first of all, have main activity must turn on/off bluetooth, make discoverable, search devices , connect them. after this, go other activity have text view edittext , send button, can write , send it. i've got working bluetooth enabling/disabling stuff, need connect new found devices , enter chat type activity , send. i pretty work, great if can give me example of how can this. code have: public class btactivity extends activity { // intent request codes private static final int request_discoverable_bt = 0; private static final int request_connect_device = 1; private static final int request_enable_bt = 2; // debugging private static final string tag = "bluetoothchat"; private static final boolean d = true; // name of connected device public static string mconnecteddevicename = null; // array adapter device list private arrayadapter<string> marrayadapter; // local bluetooth adapter private bluetoo...

php - Numbered results list and maintain position number if times are equal -

i have results table iterate on , echo out. $c = 1; foreach ($results $result) { $r .= '<tr>' . '<th scope="row">' . ($time === $result['time']? $c - 1 : $c) . '</th>' . '<td>' . $result['name'] . '</td>' . '<td>' . $result['time'] . ' </td>' . '<td>' . $result['points'] . ' </td>' . '</tr>'; $time = $result['time']; $c++; } i compare current time previous result time , display count same if match. e.g. 1. tom 0.33 2. ben 0.34 2. carl 0.34 4. des 0.35 5. dave 0.36 but if des had got 0.34? display count 3 , should stay on 2. any ideas how solve without getting complex? $c = 1; $lastc = $c; foreach ($results $result) { if ($time === $result['time']) { $place = $lastc; } else { $place = $c; $lastc =...

javascript - Scaling an image doesn't work as expected? -

i'm scaling image down using scale transform. that's working fine, except original image size used calculate page size horizontal/vertical scrolls in huge empty page. bit confused on how works, isn't scale supposed reduce/enlarge image? can somehow rid of "extra" space not used? don't need css solution, using javascript here fine. fiddle: http://jsfiddle.net/kcycm/ edit @jgv solution posted below size image properly, doesn't solve issue scaling. if try using approach, , instead try scale image funny effect. zooms in in part of image , scrollbars displayed again. when image scaled down doesn't affect other when it's scaled does? expected? fiddle: http://jsfiddle.net/kcycm/6/ try wrapping image in div , specifying dimensions of wrapper. no css3 works. <div style="height: 300px"> <img src="http://upload.wikimedia.org/wikipedia/commons/4/4e/les_invalides_de_paris_ceiling_huge.jpg" style="m...

In android examples, why ScreenSlidePageFragment class uses a factory method for creating object -

i have no idea why used factory method creating instances of screenslidepagefragment. wrong passing pagenumber in constructor , assigning mpagenumber there, , of course getting rid of factory method , arg_page?! here code: public class screenslidepagefragment extends fragment { /** * argument key page number fragment represents. */ public static final string arg_page = "page"; /** * fragment's page number, set argument value {@link #arg_page}. */ private int mpagenumber; /** * factory method fragment class. constructs new fragment given page number. */ public static screenslidepagefragment create(int pagenumber) { screenslidepagefragment fragment = new screenslidepagefragment(); bundle args = new bundle(); args.putint(arg_page, pagenumber); fragment.setarguments(args); return fragment; } public screenslidepagefragment() { } @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); mpagenum...

javascript - Railscasts Not Working - 147 and 302 -

i tried implementing features in railscast 147 sortable lists , 302 in-place editing , after having followed every step along way, effects showed on ryan's screen different mine. in case of 302 in-place editing , clicking on supposedly in-place-editing-enabled text had no effects! i had simple code implement best_in_place in views/users/show.html.erb <h1> <%= gravatar_for @user %> <%= @user.name %> </h1> <% firstname = @user.name.split(" ")[0] %> <p> <%= best_in_place @user, :email %> </p> and in case of 147 sortable lists , line <%= sortable_element("faq") %> gave me undefined method 'sortable_element' error. please help! it's impossible diagnose issue without seeing code doesn't behave expected first part of question. sortable_element deprecated in rails 3.0.9, explains second issue.

mysql - Using Max in group by -

i have following query , want generate result latest date category store instead of giving out per date transaction: select c.store,d.node_name category, x.txn_dt, x.txn_tm time, count(c.txn_id) buyer pos_swy.5_centerstore_triptype c join pos_swy.3_txn_itm t on c.txn_id=t.txn_id join pos_swy.1_upc_node_map d on t.upc_id=d.upc_id join pos_swy.3_txn_hdr x on t.txn_id=x.txn_id group store,txn_dt,node_name; i tried using max(x.txn_dt) didn't solve purpose. you may need order ? select c.store,d.node_name category, max(x.txn_dt) max_date, x.txn_tm time, count(c.txn_id) buyer pos_swy.5_centerstore_triptype c join pos_swy.3_txn_itm t on c.txn_id=t.txn_id join pos_swy.1_upc_node_map d on t.upc_id=d.upc_id join pos_swy.3_txn_hdr x on t.txn_id=x.txn_id group node_name order max_date desc -- can change limit 1 ever want results

Whether Linux Kernel can be thought of as a single process -

whether linux kernel can considered single process many threads possible? defines switch between memory management modules, scheduler, file system etc in kernel. linux kernel can't considered process, because 1 of responsibilities manage processes. you can consider kernel big interrupt handler. after kernel grants processor thread, way control interrupts (or system calls, interrupts). when interrupt occurs, kernel gets control, , appropriately handles interrupt. @ point various parts of kernel called. kernel multi-threaded can handle various interrupts on different processors simultaneously. on other hand, there kernel-threads, managed in same way user threads (there no difference between kernel , user threads scheduler).

adding a column which derive from another column by an expression with awk -

how can add column after first, has values calculate expression. expression has form: (vn+v0)*vl v0 , vl first , last element of 3th column, respectively , vn nth element of column. example have text table: 1 2 3 4 10 20 30 40 100 200 300 400 it should converted 1 1800 3 4 10 9900 30 40 100 180000 300 400 thanks as rule defined in question, number in last line should not 180000 . should (300+3)*300=90900 this awk line work you: awk 'nr==fnr{c[nr]=$3;l=nr;next}{$2=($3+c[1])*c[l]}7' file file output is: kent$ awk 'nr==fnr{c[nr]=$3;l=nr;next}{$2=($3+c[1])*c[l]}7' file file 1 1800 3 4 10 9900 30 40 100 90900 300 400 edit op wants add new column after first: kent$ awk 'nr==fnr{c[nr]=$3;l=nr;next}{$2=($3+c[1])*c[l]" "$2}7' file file 1 1800 2 3 4 10 9900 20 30 40 100 90900 200 300 400

javascript - Is there any regexp replacement? -

yesterday i've been lost, when tried produce regexp regexp, i've failed escape out escaped escapes (for javascript). regexps great cli unix pipe chains , in once-used-shell-scripts, or when want quick-and-dirty solution something, don't want maintain program, uses regexps. regexps unreadable, hard debug etc., etc. are there other line-oriented string manipulation package/language/whatsoever beyond regexp? or language produces regexp? as far i'm concerned regexes quite high-level already. they're obtuse sure , learning curve steep, it's short: can read need know regex flavor on 1 html page, isn't true e.g. python. so if have regex it's making feel brain leaking out ears , you'd lot happier if more explicit, i'd go down level, not up. writing kind of state machine instead of using pattern matching may clarify logic.

email - magento edit account information in sales tab -

often times customers place order , have typo error in email address. when edit email address in customer account, doesn't change email address associated order. i can go database , edit email address, able edit "account information" in sales order i'm able edit shipping address. you have careful when defining concept of customer email address because 3 different ones may exist depending on whether refer to: the customer account (whose email can found @ customer_entity.email ) the order shipping address (useful contacting purposes during delivery , available @ sales_flat_order_address.email ) the payment contact information (ditto @ sales_flat_quote_address.email ) customers state of time single contact information 3 different processes above, exceptions rule occur (i.e. gifts friends, deliveries holidays addresses, different payment methods business orders, , on). i 3 assuming haven't modified and/or installed magento/some plugin better...

php - Can't access files directly in browser or with AJAX - Opencart Installation -

i have custom php script i'm trying access via ajax, , return of 404 in browser or via ajax. i've been able access custom scripts via php in current environment. strange? here's .htaccess file, i've tried editing few things no luck. centos 6.4. google fu turns nothing. in advance help. permissions have been set 777 test no luck either. # 1.to use url alias need running apache mod_rewrite enabled. # 2. in opencart directory rename htaccess.txt .htaccess. # support issues please visit: http://www.opencart.com options +followsymlinks # prevent directoy listing options -indexes # prevent direct access files <filesmatch "\.(tpl|ini|log)"> order deny,allow deny </filesmatch> # seo url settings rewriteengine on # if opencart installation not run on main web folder make sure folder run in ie. / becomes /shop/ rewritebase / rewriterule ^sitemap.xml$ index.php?route=feed/google_sitemap [l] rewriterule ^googlebase.xml$ inde...

python - How can I cut a variable in a for loop each time differently? -

i have document called 'asin.txt': in,huawei1,de.fr.it.uk out,huawei2,de.fr.it out,huawei3,fr in,huawei4,fr.it in,huawei5,it i'm opening file , make ordereddict: from collections import ordereddict reader = csv.reader(open('asin.txt','r'),delimiter=',') reader1 = csv.reader(open('asin.txt','r'),delimiter=',') d = ordereddict((row[0], row[1].strip()) row in reader) d1 = ordereddict((row[1], row[2].strip()) row in reader1) than create 'for' loop: from itertools import izip (a, b), (c, e) in izip(d.items(), d1.items()): """in first time: a='in'; b='huawei1'; c='huawei1'; e='de.fr.it.uk'""" c1, c2, c3, c4 = c.split('.') # i'm cutting variable 'c' try: ........... but python give me error: c1, c2, c3, c4 = c.split('.') valueerror: need more 3 values unpack i know why have error, because in first...

ember.js - EmberJS - A way to log undefined bindings -

is there way ember log warning or error if reference property doesn't exist? if misspell name of property bound in handlebar template there no warning, doesn't show anything, , can hard find property incorrect. i have log_bindings enabled, helps somewhat, there lot of unrelated stuff sort through. there isn't sort of general built-in debugging have found, there mechanism add own. ember.object calls method 'unknownproperty' time 'get' call returns undefined. can add console.warn method log property. documentation describes way make custom abstract method type handling. http://emberjs.com/api/classes/ember.observable.html#method_get ember.object.reopen( unknownproperty: (property) -> unless property 'app' or property 'ember' console.warn "unknown property #{property} in #{@tostring()}" ) notice filtering of global namespaces 'app' , 'ember' - calls global properties still go throug...

c# - How to convert a HTML Table in an MVC View to PDF file, ITextSharp -

i've been pointed in direction of itextsharp, when went download package nuget noticed called razortopdf discover unsolvable formatting issues due project no longer being supported. after more research surprised find there wasn't worded question on so. so guys, what's best way convert html page/table in mvc project pdf file? what's best way convert html page/table in mvc project pdf file? generally, print pdf web browser on client. the thing is, relying on end-user perspective of view in case, you're relying on end-user rendering of view. it's step should removed particular equation entirely. keep in mind there fundamental differences between how html page renders , how pdf renders. 2 aren't 100% interchangeable. pdf has static page size , elements placed absolutely, whereas html has dynamic sizes , elements placed in flow layout. there additional considerations such client-side dom manipulation may take place in view. "r...

paypal ipn - PP IPN doesn't update my database(PHP) -

first of i'd i'm lost when comes these things have spoonfed. anyway, i'm using pp ipn right people on upcoming project can upgrade "premium" give them functions , such. however, script works in way, doesn't update database information. in database have field called "vip" set "0" when signing up. if buy premium should change "1". problem doesn't update information, though payment goes through. i'm on live webserver well. i've followed tutorial made phpacademy this, again, i'm clueless. , forum seems rather dead atm. ipn.php <?php include 'core/init.php'; // read post paypal system , add 'cmd' $req = 'cmd=_notify-validate'; foreach ($_post $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; } // post paypal system validate $header .= "post /cgi-bin/webscr http/1.1\r\n"; $header .= "content-type: application/x-ww...

javascript - How can I make a loop split 4 inputs between two divs? -

i need make small behavior change block of code inherited, set unfortunately 1 large function building out html template , has large number of loops in it. currently there section in template function loop generates 4 text inputs in containing <div> along submit button. make if in case specific area has more 2 inputs put 2 inside of 1 <div> subit , other 2 in div own submit, splitting them up. here quick , (very) dirty visual example of trying achieve. http://jsbin.com/izejin/5/ and below current loop generating 4 inputs single <div> . thought need set counter upon being === 2 create new html elements new classes style them need be. i'm unsure how achieve while still keeping loop going. if (measurementtypegroup.measurementtypes.length > 1) { newnodehtml += "<div id='" + measurementclass + "-3-" + measurementtypegroup.measurementtypes[0].targetconfigure[0].targettype + "' class='target-metric input ...

Getting map location Python -

is there way computer geolocation (as in google maps "my location") python script? computer connected internet. >>> import re,requests >>> raw = requests.get('http://www.geoiptool.com/').text >>> latlon = re.search("gpoint\(([^)]+)\)",raw).groups(0) >>> lat,lon = map(float,latlon[0].split(",")) >>> print "latitude:%s longitude:%s"%(lat,lon) latitude:-117.2455 longitude:46.7322 a couple of caveats ... this not best method , should not done on , on again or might upset site owners this uses ip lookups may not gps/wifi coordinates

ms access - What event will fire each time a report is previewed/printed? -

i evauluate value of textbox report control , hide or display based on value, can achieve vba: if me.fixed.value = 0 me.fixed.visible = false end if that works fine, query using report's record source allows range of records printed @ once (1 per page/report), , want above code run each page/report. unsure of put code each record play rules. currently, if choose range of 8 records, first 1 want, , navigate through other records in print preview screen format of report remaining unchanged when should changing. i have tried following events: report: on current on load on got focus on open on activate on page section: on format on print on paint where can put vba each time scroll through/navigate range of records returned on report code runs? you need set visible property true well, otherwise remain invisible. i'm using format event of details section: private sub detail_format(cancel integer, formatcount integer) if me.fixed...

jquery - Tablesorter not sorting in Chrome -

so i've got: $("#tblid").tablesorter({ widgets: ['zebra'], widgetoptions: { zebra: ["zebrastripe", "zebrabase"] } }).bind("sortstart", function () { alert('sortstart'); }); and zebra striping applied both chrome , ie 8 (my other browser i'm testing). sortstart function gets called in ie 8, not chrome. sorts in ie 8 , not in chrome, real issue. can add lend thoughts? tia. edit: fixed mismatched quotes. when simplified selector from: $('#tblchildviolationlist_' + entityid + '[data-violationtype="' + violationtype + '"]') to: $("#tblid") i didn't pay attention quotes. you have mix of ' , " characters @ start. try: $("#tblid").tablesorter({ widgets: ['zebra'], ...

java - create simple timer android -

i want make simple timer time how long takes user in app. have in mind start timer, stop timer , display time. have been searching , haven't found definitive solution works. simple envision or more complicated have found searching? how precise timer need be? the simplest way take time before performing task , subtract time after performing task: long start = system.currenttimemillis(); // task long timetakenms = system.currenttimemillis() - start; if mean user-event-driven timer, can apply same principles above: // declare instance variable long start = 0l; // onstarttimer start = system.currenttimemillis(); // onstoptimer long elapsed = system.currenttimemillis() - start;

multithreading - Thread-safe in delphi -

i have modify , change visual components in thread , know it's not safe doing this. my question how write thread-safe code? possible? if can please give me simple example? my code not threadsafe: type tmyworkerthread = class(tthread) public procedure execute; override; end; var form1: tform1; implementation {$r *.dfm} procedure tmyworkerthread.execute; begin //codes //working visual components end; procedure tform1.button1click(sender: tobject); begin tmyworkerthread.create(false); end; thank you. writing thread safe code in delphi involves basic care have in other language, means deal race conditions . race condition happens when different threads access same data . way deal declare instance of tcriticalsection , wrap dangerous code in it. the code below shows getter , setter of property that, hypotesis, has race condition. constructor tmythread.create; begin criticalx := tcriticalsection.create; end; destructor tmythr...

ado - Execution of a stored procedure with an input parameter and insert into specific cells in excel -

i have following vba routine private sub cmdstartdate_click() 'set variables dim conn adodb.connection dim str string dim exestr string dim rs adodb.recordset dim fld dim integer dim connstr string dim cmd new adodb.command 'error handler on error goto errlbl 'open database connection set conn = new adodb.connection 'construct connection string conn = "driver={sql server};server=10.50.50.140;database=tbjc;uid=oe;pwd=orth03c0" 'open connection conn.open 'create command object set cmd = new adodb.command 'create , store start date parameter cmd .commandtext = "dbo.cusultrasoundreport" .commandtype = adcmdstoredproc .parameters.append .createparameter("@start", advarchar, adparaminput, 12, txtstartdate.text) .parameters("@start").value = txtstartdate.text .activeconnection = conn end 'create recordset set rs = cmd.execute 'str = txtstartdate.text 'exestr = "exec dbo.u...

php - Hide empty td if count value is empty in datatables -

i have script works hidden null values in mysql db, empty values count them...so how can hide values too? <table class="table table-bordered table-striped table-condensed bootstrap-datatable datatable" > <thead> <tr> <th>diagn&oacute;sticos</th> <th class="center sorting_desc">casos vistos</th> </tr> </thead> <tbody> <? $sql = $conn->prepare("select diagnostico, count(diagnostico) ( select diagnostico diagnostico diagnosticon id_doctor = $id_doctor union select diagnostico1 diagnostico diagnosticon union select diagnostico2 diagnostico diagnosticon union select diagnostico3 diagnostico diagnosticon) t group t.diagnostico order count(diagnostico) desc "); $sql->execute(); while($row = $sql->fetch(pdo::fetch_assoc)) { echo "<tr...

Django Multiple AdminSite NoReverseMatch from second AdminSite instance -

i having odd issue multiple adminsites. i have 2 admin sites. one, unicorn_admin.site , , default django.contrib.admin.site . some apps give me noreversematch error when attempting admin reverse urls. consider following: this same template used both admin site instances. code 100% same. {% url 'admin:packingslips_packingslipformat_changelist' %} {# noreversematch /unicorn/ okay /b/ #} i'm under impression perhaps admin namespace set active admin automatically, though i've named second admin unicorn_admin , while rendering unicorn_admin view, namespace admin set unicorn_admin instance? any ideas appreciated. unicorn_admin.py site = adminsite(name='unicorn_admin') root urlconf (r'^unicorn/', include(unicorn_admin.site.urls)), (r'^b/', include(admin.site.urls)), # direct link default admin panel use namespaces add few copies of same urlconf (in case - 2 admin sites). in comments found 2 ways different namespa...

Make wget convert links to other pages in input-file -

i'm using wget archive discussion forum. discussion on several pages, navigated next , previous buttons. i generated list of page urls , used input-file, convert-links option not converting next , previous links, images. is there way make that? i use -r, need depth of 64 whole discussion, , therefore whole load of unwanted stuff well. i figured out workaround. easy enough change input file html , upload it. -r , -l1 correctly converted links.

html - Jquery: React to dynamic classes in forms -

i have made html form split sections. i using jquery add classes body element depending on sections have been filled in. by default, body has class of purchase-stop . when sections filled in, changes purchase-go . when user clicks on submit button, use following code display message: $("input").on('click', '.purchase-stop', function() { alert("you haven't visited sections. please visit them ensure happy choices"); }); the trouble display purchase-stop has been changed purchase-go . how can display when classes purchase-stop ? also, 2 fields on form mandatory. use following code check if these mandatory sections filled in: $(".changing-room").submit(function(e) { e.preventdefault(); var isformvalid = true; $("input.required").each(function() { if ($.trim($(this).val()).length === 0) { $(this).parent().addclass("error"...

python - Pywin32 COM objects passed to function cause pywintypes.com_error -

update: see bottom of post i'm having small issue function designed create new workbook in excel, copy of data passed in sheet separate workbook, , save workbook. so, have function coded below , reason line: sheet.range(sheet.cells(1, 1), sheet.cells(row_count, max_col)).copy() throws error: traceback (most recent call last): file "reports-script.py", line 191, in <module> format(workbook_filename, query_list, data, colu mn_orderings) file "reports-script.py", line 168, in format excel.save_all_in_workbook_as_mht() file ".....\excel.py", line 381, in save_all _as_mht filename = self.save_copy_as_mht(sheet, sheet.name, self.folde r_name) file ".....\excel_class.py", line 359, in save_cop y_as_mht self.excel.workbooks(1).sheets(sheet.name).cells(row_count, max_col) file ".....\win32com\client\dynamic.py", line 172, in __call__ return self._get_good_object_(self._oleobj_.invoke(*allargs),self._olerepr_. defaultdispa...

unity3d - Can protobuf-csharp-port work on webplayer? -

we can't call dll on webplayer, protobuf-csharp-port uses dll extensions, seems doesn't work on webplayer. can solve problem? in fact, can use dlls in webplayer long contain pure managed c# code. can't use native dlls written in c++ example. these dlls shouldn't use kind of reflection excluded sub-assembly in unity webplayer. i don't know if protobuf-csharp-port matches these constraints if looking nice protocol buffer implementation, can have @ protobuf-net nice one, written in pure c#. there specific unity-compatible build in distribution. can compile protobuf serializers in custom dll no reflection used webplayer compliant.

java interface fields compiled undesirable modifiers -

i declared following interface: public interface sqlsyncable { boolean modified = true; long id = -1; static hashmap<string,sqlaction> sqlmodifiers = new hashmap<string,sqlaction>(); static field[] sql_object_fields = null; static datatype[] transferdatatypes = null; } in other classes, set object implement interface, compilation error: someobject.id = 10 // final field sqlsyncable.id cannot assigned. //the static field sqlsyncable.id should accessed in static way. lol what? "id" , "modified" not "static final", let see compiled .class file (im inspected in java assemly editor, , in eclipse), , really! every time (does not matter eclipse or java) int complied class of fields have "static final" modifier. why? if modify interface "abstract class" problem instantly disappears. ...but half solution, java allow 1 of superclass. why complied interface undesirable modifie...

php - How to prevent user from bookmarking URLs? -

my website's webpages displays webpages using get retrieve variables predefined url. example code on first page: index.php <p><a href="/blank.php?name1=value1&amp;name2=value2">next page</a></p> the second page: blank.php?name1=value1&amp;name2=value2 $name1 = $_get['name1'] ; $name2 = $_get['name2'] ; echo $name1 ; echo $name2 ; this way webpages created on spot , displayed kind of cms , iuse method webpages site has, if user bookmarks tab have out of date information webpage because page content contained in url. edit: if use post better way of conveying information new webpage? instead of: <form method="post" action="blank.php"> <input type="hidden" name="name1" value="value1"> <input type="submit"> </form> quick , dirty solution: add timestamp parameter urls, like: <p><a href="/blank.php?...

sql server - SQL Maintenance Plan - End Task -

is there way stop maintenance plan after has been triggered? have 1 running in production , need stop asap. appreciate suggestions/ideas. thanks! assuming ssis w/ sql server, "sql server agent" -> "job activity monitor". right-click job don't want running , select "stop job" this worse letting job run. warned.

javascript - Facebook userscript events -

this script works when move mouse. how arrange stay activated? // ==userscript== // @name corrige script // @namespace www.thyago.com/corrigebug // @version 0.1 // @description corrigir o bug que não permitia marcar codigos // @include https://*.facebook.com/* // @include https://facebook.com/* // @include http://*.facebook.com/* // @include http://facebook.com/* // @author thyago ribeiro (www.fb.com/thyagosr) // ==/userscript== function att(){ var c = document.getelementsbyname('xhpc_message_text')[0]; document.getelementsbyname('xhpc_message')[0].value = c.value; console.log(document.getelementsbyname('xhpc_message')[0].value); } function att2(){ document.getelementsbyname('message')[0].value = document.getelementsbyname('message_text')[0].value; } function corrige(){ if(document.getelementsbyname("xhpc_message_text")[0]!== undefined){ var vardivtexto = document.getelementsbyname("x...

storage - Re-scan LUN on Linux -

we have expend existing lun size on emc storage , want re-scan on host side don't know how figure out scsi id of specific lun. new storage.. doing don't know whether right way or not pseudo name=emcpowerj clariion id=apm00112500570 [oracle_cluster] logical device id=200601602e002900b6bca114c9f8e011 [lun01] state=alive; policy=claropt; priority=0; queued-ios=0; owner: default=sp a, current=sp array failover mode: 1 ============================================================================== --------------- host --------------- - stor - -- i/o path -- -- stats --- ### hw path i/o paths interf. mode state q-ios errors ============================================================================== 2 qla2xxx sdaj sp a1 active alive 0 1 2 qla2xxx sdaw sp b1 active alive 0 4 1 qla2xxx sdj sp a0 active alive 0 1 1 qla2...

c# - Load Controllers at runtime from another assembly -

in project in main web assembly before register routes in global.asax load number of external assemblies. of these assemblies have mvc controllers , views inside of them. my problem these external controllers not picked reason, assume controller registration happens somewhere before assemblies loaded, because if reference assemblies before application starts(dlls in bin folder) works fine. so i'm wondering if there`s a way control when mvc controllers registered, can after assemblies loaded? or a way inject external controllers? i had similar issue webapi controllers before , able fix using custom httpcontrollerselector , wasn't able find similar in mvc yet. was able solve issue overriding defaultcontrollerfactory 's createcontroller method: application_start: icontrollerfactory factory = new controllerfactory(); controllerbuilder.current.setcontrollerfactory(factory); controllerfactory: public class controllerfactory : defaultcontrollerfact...

loops - Iterative grep with r -

ok thank guy, start again question: this df df = read.table(text = ' replicate size fh ms03a_t0_r1 397.51 1099 ms03a_t0_r1 695.46 8 ms03a_t0_r1 708.76 1409 ms03a_t0_r1 1203.98 102 ms03a_t0_r2 397.52 749 ms03a_t0_r2 493.97 23 ms03a_t0_r2 538.43 12 ms03a_t0_r3 397.49 638 ms03a_t0_r3 399.84 9 ms03a_t0_r3 404.95 33 ms03a_t0_r3 406.85 40 ', header = t) rn <- as.numeric(length(levels(ol$replicate))) # calculate number of samples from have 3 new dataset each 1 contain rows *_r1 value of "replicate" variable, rows *_r2 , rows *_r3. i thought did whit these commands: for (i in 1:rn){ x <- df[as.character(sub('.*_r', '', as.character(replicate))) %in% i]; outfile <- paste("rep_",i,"_edited.txt",sep="") write.table(x,quote=false,sep=", ",outfile) } but able .txt outputs , not df objects in r. in way have import them again in r move on next step of "sc...

c# - Change color of text based on value only returns green -

i have c# script changing color of text based on value of twa. while works mostly, doesn't change if twa value >=85 (where should yellow) , >= 90 (where should red) . how fix this? here script: protected system.drawing.color getcolorforlabel(string text) { int thetwavalue; if (text != null && int.tryparse(text, out thetwavalue) && thetwavalue >= 0) { return (thetwavalue < 90) ? system.drawing.color.yellow : system.drawing.color.red; } return system.drawing.color.green; } additional information: the listview twa value not going shown until user selects job code drop down list , data values coming access database edit2: after debugging still haven't found solution, assistance why if statement failing great edit 3: here rest of code: <asp:sqldatasource id="sqldatasource1" runat="server" connectionstring="<%$ connectionstrings:2007 soundassist ver 1.0.5 05-12-2011 ( 2013-...

How to call a JQL query in Python -

i working on script in python call jql script. how go this? curl -d- -u fred:fred -x -h "content-type: application/json" http://kelpie9:8081/rest/api/2/search?jql=assignee=fred+order+by+duedate assume above jql query. this have far it's getting "invalid syntax" error. from grt import executescript querystring = "curl -d- -u fred:fred -x -h "content-type: application/json" http://kelpie9:8081/rest/api/2/search?jql=project=qa+order+by+duedate&fields=id,key" executescript(querystring) this error: file "/home/.spyder2/temp.py", line 19 querystring = "curl -d- -u fred:fred -x -h "content-type: application/json" http://kelpie9:8081/rest/api/2/search?jql=project=qa+order+by+duedate&fields=id,key" ^ syntaxerror: invalid syntax you don't open/close string properly: querystring = "curl -d- -u fred:fred -x ...

recursion - Structure and query syntax for recursive documents in MongoDB? -

i've started looking mongodb project @ work. i'm new json , mongodb's query structure, i'm hoping 1 of can provide clarification. i've translated problem excel terminology since it's common , represents question well. if attempting model excel formula mongodb document, best format in (i'll explain potential queries lower)? keep in mind formulas in excel can nested in (nearly) order, , depth, , arguments can come in either string or numerical form. able search across these cells answer such queries "find cells use =avg() function" or "find cells contain =sum() function inside of =avg() function (such =avg(x,y,z,sum(a,b,c)))." being able answer these formula-structure based queries more important being able answer ones numbers or strings if answering isn't possible. currently i'm envisioning documents having following format: { formula: "avg", arguments: [4,5, { formula: "sum", ...

javascript - recursive d3 animation issue -

i trying run animation using d3 chaining animations recursion. have function animate calls until animations chained together (function animate(transition) { // code here animate(transition.transition()) })(selection.transition()); the visualization works, i'm trying keep track of how many times function has been called can display on screen in sync animation. however, recursion chains transitions before first 1 finishes, counter number of last transition. here's a jsfiddle shows i'm trying do. strange radius of circles set correctly, i.e. when setting attributes gets proper count, while in same call of animate it's incorrect. i've looked @ old stack overflow questions, , i've looked through d3 docs, , can't find way keep track of count throughout recursion. know of such way? your recursive function runs - replace count++; console.log(count++); - , you'll see console filled 1, 2, 3, ..., 59 right away. transitions keep ...

c++ - What's the output of the following code? -

this question has answer here: why call default constructor? 3 answers this code published in http://accu.org/index.php/cvujournal , issue july 2013. couldn't comprehend output, explanation helphful #include <iostream> int x; struct { i() { x = 0; std::cout << "--c1\n"; } i(int i) { x = i; std::cout << "--c2\n"; } }; class l { public: l(int i) : x(i) {} void load() { i(x); } private: int x; }; int main() { l l(42); l.load(); std::cout << x << std::endl; } output: --c1 0 i expecting: --c2 42 any explanation ? i(x); equivalent i x; , redundant pair of parentheses thrown in. declares variable named x of type i , default-initialized; not create temporary instance of i x constructor's parameter. see a...

ffmpeg - About objetive metrics: Is the SSIM can be predicted by PSNR ? (PSNR vs SSIM) -

i read people saying if have study involve conclusion regarding psnr must repeat again considering ssim. since meaning double work, time (and why not money), doing simulations again (that got using psnr) using ssim parameter ? ssim , psnr independent ? i have investigated topic , found cited article: icpr2010.org/pdfs/icpr2010_weat8.44.pdf‎ and conclusion is: "as final conclusion, appears values of psnr can predicted ssim , vice-versa." as article cite others article saying psnr , ssim not independent.

Probably database relationship cycle -

Image
my issue related cycle relationship, need solve database schema in order best practice, used on tracking vehicles system my problem description: a route contain on or more fences, , fence coul contained 1 or more routes a route has assigned vehicles ( consider vehicles part or other routes ) when route, contain fences, has vehicle assigned, need control when vehicle pass inside fence; need store if fence set on each vehicle compare when vehicle inside fence i have solved issue on these way, ma not sure is practice, if no, which 1 best practice problem? 1 - route contain on or more fences, , fence coul contained 1 or more routes route --< routefencerelationship >-- fence "routefencerelationship" pk routefencerelationshipid fk routeid fk fenceid many many relationships don't work well, i'd heavily suggest relationship table define routes contain fences. 2 - route has assigned vehicles ( consider vehicles p...

Parsing nested JSON with PHP -

{ "listing": { "@attributes": { "domain": "example.com" }, "tld": "com", "sld": "example", "owner": "john smith" } } i needing iterate through json array , put values php variables can return values. example: echo $sld; would print: example would need foreach loop (and if how format this) or there easy built in function such extract() this? <?php $json = '{ "listing": { "@attributes": { "domain": "example.com" }, "tld": "com", "sld": "example", "owner": "john smith" } }'; $decoded_array = json_decode($json, true); echo $decoded_array['listing']['sld'];//example ?>