Posts

Showing posts from August, 2015

c++ - Runtime error due to WTTlog.DLL? -

i'm running vc++ code in vs2008 in win8 os. when click on "f5" (run project), see errro message below "the program can't start because, wttlog.dll missing computer. try reinstalling program fix problem" i manually copied wttlog.dll release/debug folder in vs project i'm running. still error. can kindly me if need copy wttlog.dll specific location ? tried registering dll,but getting message like "the module wttlog.dll loaded entry point dllregiterserver not found". 1) can kindly let me know how execute vc++ solution without getting wttlog.dll error ? 2) reason error ? thanks in advance. this file part of microsoft driver test manager/studio. the file location should this.. 'c:\program files\microsoft driver test manager\studio\wttlog.dll' or c:\program files (x86)\windows kits\8.0\hardware certification kit\tests\[architecture]\nttest\driverstest\storage\wdk or c:\program files (x86)

Oracle SQL get one of each data -

if had table column of hello , had multiple rows data 'world' , multiple data dave (there other columns too) , wanted select different types of data within hello column. so looking return 2 results, 1 being world , other being dave . another option count how many different data pieces there in column(2 in case) , searching rownum , sorting results (although i'd assume similar search.) thanks if don't want duplicates in result - add distinct : select distinct hello yourtable and if want count different values : select hello, count(*) yourtable group hello

jquery - load scripts and css with ajax loaded contents -

i have page contains menu sidebar links , div load ajax content other pages in it, content load scripts , css not work, use html 5 history load load content other pages. $(function () { $('.menuanchor').click(function (e) { href = $(this).attr("href"); loadcontent(href); // history.pushstate history.pushstate('', 'new url: ' + href, href); e.preventdefault(); }); // event makes sure back/forward buttons work window.onpopstate = function (event) { console.log("pathname: " + location.pathname); loadcontent(location.pathname); }; }); function loadcontent(url) { // uses jquery load content $.get(url, {}, function (data) { $(".contn_btm_mid_bg").html($(data).find('.contn_btm_mid_bg').html()); //$.validator.unobtrusive.parse(".contn_btm_mid_bg"); }); // these 2 lines make sure nav bar reflects current url

Android Button Tag and Onclick listener in listview get reset when scrolling -

i populating listview imagebutton when clicked, starts playing audio file. i set datasource of mediaplayer imagebutton.settag("resource url") while populating list. without scrolling, first record playing fine, once scroll, of imagebutton tags, , onclicklistener lost. to enable click buttons on list, implement own customonclick , set in xml part. //the list row button xml: <imagebutton android:id="@+id/imagebutton1" android:layout_width="30dp" android:layout_height="30dp" android:background="@drawable/play_icon" android:layout_gravity="center_vertical" android:tag="file_recording" android:onclick="myonclick" /> customcursoradapter: class customcursoradapter extends simplecursoradapter { private int layout; context context; public customcursoradapter(context context, int layout, cursor cursor, string[] from, int[] to) { super(

jquery - Two function and alert not working? -

html code <body> <h1 align="center">are ready?</h1> <h2 align="center">just answer yes or no!</h2> <div class="wrapper"> <button id="ohyes" class="buttonyes"> yes </button> <button id="ohno" class="buttonno"> no </button> </div> </body> jquery code <script> $(function () { $("#ohno").on({ mouseover: function () { $(this).css({ left: (math.random() * 800) + "px", right: (math.random() * 800) + "px", top: (math.random() * 400) + "px", }); } }); $("#ohyes").click(function () { alert("yes"); //use .val() if you're getting value }); }); </script> i'm trying call function in jquery first working fine button moving on mouseover when click butt

iphone - Best way to process multiple HTTP async requests in the background and return responses individually -

i have 1 class processes requests composing framework, https://github.com/ivasic/restframework . want able execute requests requests , return responses individually caller. stands if have more 2 request, result of second 1 domes not come through, seems happen @ same time. what solution this? you have caller pass block "one class handles requests." caller block can response. // inside caller class. oneclassthathandlesrequests *ws = [oneclassthathandlesrequest sharedinstance]; [ws getfromurl: @"http://webservice.com/people/jack" completionblock: ^(urlrequest *request , urlhttpresponse *response, nsdata *data) { // make sure we got 200 code back. // change data json if i'm getting json back. }]; now oneclassthathandlesrequests knows how pass information call without oneclassthathandlesrequests needing know called. you use delegate pattern, blocks case makes more sense me

hashmap - floorEntry for Double numbers in java -

i have divided continuous range of double numbers several sub-ranges. tried create method in order map each sub-range specific string value: static navigablemap < double, string > rrmap = new treemap < double, string > (); static hashmap < string, double > qualitymap = new hashmap < string, double > (); public static void main(string args[]) { qualitymap.put("key", 0.3); rrmap.put(0.0, "a"); // 0..11 => bradypnea rrmap.put(1.2, "b"); // 12..14 => unreliable_ranges rrmap.put(1.5, "c"); // 15..20 => normal activity rrmap.put(2.1, "d"); // 21..25 => unreliable_ranges rrmap.put(2.6, "e"); method(); } // lines of codes public static void method() { system.out.println(floorentry(qualitymap.get("key")).getvalue()); } in function named "method", want print string value mapped number exist in qualitymap , value of "k

jQuery not removing "class" attribute name when using removeClass() -

i've written "favourite" feature (special entirely stefan hoth , reply previous article ), — part — working. however, it's quirky. firstly, after visting page, favourite button needs pressing twice before begins work, after works single click switch between states. secondly, removeclass() method appears happy remove "active" part of class="active" attribute, weird. function favouriteadd (){ $.ajax({ url: base_url + "bookmarks/jq_set_bookmark_as_favourite/add/" + $("a#favourite").data("bookmark"), success: function () { $('a#favourite') .addclass('active') .attr('title', "remove favorite") .unbind('click') .bind('click', favouriteremove); } }); } function favouriteremove (){ $.ajax({ url: base_url + "bookmarks/jq_set_bookmark_as_favourite/remove/"

c# - MVVM: ViewModel and Business Logic Connection -

after doing few projects using mvvm pattern, im still struggling role of viewmodel: what did in past: using model data container. putting logic manipulate data in viewmodel. (thats business logic right?) con: logic not reusable. what i'm trying now: keeping viewmodel thin possible. moving logic model layer. keeping presentation logic in viewmodel. con: makes ui notification realy painful if data changed inside model layer. so give example make more clearer: scenario: tool rename files. classes: file : representing each file; rule: contains logic how rename file; if im following approach 1: creating viewmodel file, rule , view -> renamerviewmodel. putting logic in renamerviewmodel: containing list of fileviewmodel , ruleviewmodel , proceeding logic. easy , fast, not reusable. if im following approach 2: creating new model class -> renamer, contains list of file, rule und proceeding logic interate on each file , apply each rule. creating viewmodel file, rule

How to query for get customer account status in SQL Server? -

i have these tables in database: *custmrstble: (custid: pk,int) - (name: varchar(20)) ============= custid name ________________ 1 sam 2 tom productstble: (prodid: pk,int) - (prodname: varchar(20)) - (soldprice: money) =========== prodid prodname soldprice ____________________________ 1 biscuits 20 2 butter 30 3 milk 10 orderstbl: (orderid: pk,int) - (orderdate: smalldatetime) - (custid: fk,int) ========== orderid orderdate custid ____________________________ 1 2013/4/2 1 2 2013/4/2 2 3 2013/4/3 1 orderdetails: (orderdetailsid : pk,int)- (orderid: fk,int) - (prodid: fk,int) - (qntty: int) ============= orderdetailsid orderid prodid qntty _______________________________________ 1 1 1 2 2 1 2 1 3 1 3 2 4 2 1 5 5 3 1 1 cashmoventstble:

Generate XSD with validation form ASP.NET Web API models -

i have asp.net web api project few mvc models. possible generate xsd's mvc models? and, possible keep validation data annotations in generated xsd's? if not cool have basic xsd's generated classes have. edit i found xsd.exe -t:[classname] [dllname].dll generates xsd me. open question is, how keep validation?

javascript - HTML Media Capture API vs. getUserMedia() -

currently, i'm trying simple thing (well, thought simple...): i want take photo web-cam in web-application . i stumbled on 2 possibilities: 1. html media capture api looks easy: <input type="file" accept="image/*" capture="camera"> 2. javascript media streams, pretty easy: navigator.getusermedia() and here comes question: the html media capture api not working in desktop browsers , javascript media streams not working on ios. 1 should take? both? 1 developed in future? 1 preferred way? 1 prefer? there drawbacks in 1 solutions don't see fare (except of compatibility?). thanks. btw: i'm not experienced html/javascript developer, please kind ;) here example http://html5.by/blog/demo/image-capture-getusermedia/ , here article can http://html5.by/blog/html5-image-capture-getusermedia-stream-api-mirror/ sorry in russian, example working , can check code + google translate :) hope help

php - How to all actions under a controller as resource in Zend Acl -

i trying follow tutorial zend auth , zend acl using 1.11 framework link here ! i have setup authentication , able use authentication controller::action pairs given in acl.php page. firstly test 2 additional parameter on users table whether user account activated , if user banned administrator before allowing access site. how implement in code. secondly know how include actions under 1 controller user authorization level. i.e. have masters controller has numerous actions under various tables. tell me how restrict access masters controller actions admin role only. without adding resources , allow resources each action in acl.php. please tell me if logic can extended allow access on entire modules instead of controllers(by 1 add resource , allow resource)? if yes how? firstly test 2 additional parameter on users table whether user account activated , if user banned administrator before allowing access site. the tutorial code uses vanilla version of zend_auth_ada

browser history - Tracing changes to window.location in JavaScript -

i have webapp doing weird, wrong, unexpected redirection through javascript (i checked disabling javascript in browser. redirection doesn't happen). i've checked javascript code window.location being set , put breakpoints on it, still didn't tell me did redirect. i don't want add processing before or after redirections, need know code triggered redirection can disabled it. there's several methods navigation in javascript. check window.location or document.location window.navigate (only in browsers) window.history see e.g. https://developer.mozilla.org/en-us/docs/dom/window.history or https://developer.mozilla.org/en-us/docs/dom/manipulating_the_browser_history on history, , https://developer.mozilla.org/en-us/docs/dom/window.location on window.location

javascript - Why is jqplot behaving this way? -

Image
i have chart consists of 4 series. 3 of 4 stacked bar charts , forth line. why graph acting way? assumed didn't matter in order passed in series $.jqplot function. thought able adjust series using series property , giving empty object ones didn't want adjust. scorearray series want line chart want overlayed on bars. first attempt code: $.jqplot("historychart", [scorearray, availablearray, unavailablearray, unknownarray], { stackseries: true, seriesdefaults : { renderer: $.jqplot.barrenderer, rendereroptions : { barwidth: 40 } }, series : [{ disablestack : true, renderer: $.jqplot.linerenderer }, {}, {}, {}], axesdefaults : { tickrenderer: $.jqplot.canvasaxistickrenderer, tickoptions: { angle: -45 } }, axes: { xaxis : { renderer: $.jqplot.

How do I return a variable from a Ruby method? -

what's best way return value of 'hash' variable? define_method :hash_count char_count = 0 while char_count < 25 hash = '' hash << 'x' char_count += 1 end end you have define hash outside loop. if it's inside keep resetting on every iteration. define_method :hash_count char_count = 0 hash = '' while char_count < 25 hash << 'x' char_count += 1 end hash # returns hash method end by way, don't have keep track of char_count . check length of string: define_method :hash_count hash = '' hash << 'x' while hash.length < 25 hash # returns hash method end

shell - Get device name for a path or volume identifier -

okay, i'm having work within user quotas on linux system, , need able find out device name (e.g - /dev/md2 ) given path can lookup correct quota path. now, can mount point enough using: df -k "/volume1/foo/bar" | tail -1 | awk '{ print $6 }' however i'm not sure of best way take mount point , convert device name? to further complicate matters, mount point above command may in fact encrypted folder, in case may have looks like: /dev/md2 -> /volume1 /volume1/@foo@ -> /volume1/foo meaning above df command identify mount point of /volume1/foo. however, need reliable, platform independent way work way way through mount points , find actual device name need use quota . specifically; can't rely on first part of path being mount point of device, may working environments mount volumes in more specific locations, such os x puts mounts /volumes/ example. okay, had go , came following solution; it's not desperately pretty, mount ,

Python 2.7: Convert one line into lines of 260 characters and remove all character before '_' in each line -

i must convert infile lines of 260 characters , remove content before (including character) '_' i have been looking around hours , found way convert 260 characters. lines = infile.readlines() [line[i:i+n] in lines(0, len(line), 640)] and found lot of examples wrt removing characters string or characters after argument. please me out here... lines = infile.readlines() [line[i:i+n] in lines(0, len(line), 640)] line.split("_")[1]

java - Bilinear interpolation -

i got code scaling image bilinear interpolation.i know works can't figure out 1 thing if approximated pixel value edge(by edge mean in last row or last column) pixel in input image can gt pixel of coordinate (x+1,y+1) ,this should lead array index out of range error no such error occurs why? code is: public int[] resizebilineargray(int[] pixels, int w, int h, int w2, int h2) { int[] temp = new int[w2*h2] ; int a, b, c, d, x, y, index, gray ; float x_ratio = ((float)(w-1))/w2 ; float y_ratio = ((float)(h-1))/h2 ; float x_diff, y_diff, ya, yb ; int offset = 0 ; (int i=0;i<h2;i++) { (int j=0;j<w2;j++) { x = (int)(x_ratio * j) ; y = (int)(y_ratio * i) ; x_diff = (x_ratio * j) - x ; y_diff = (y_ratio * i) - y ; index = y*w+x ; // range 0 255 bitwise , 0xff = pixels[index] & 0xff ; b = pixels[index+1] & 0xff ; c = pixels[inde

oracle - Use values from a sql query in batch script -

lets have query follows: select name, age employee id=&id; is possible run query in batch file , use returned values in jscript inside batch script? lets query returns "tom smith" name , "33" age. its possible use values in batch script? if yes please can give me example? i refering oracle database server. it looks utility called sql plus (command: sqlplus ) available kind of thing. see http://www.orafaq.com/wiki/sql plus_faq and how can create batch file sqlplus? ... can retrieve value environment variables using for : for /f %%a in ('sqlplus ...') set ...

c# - Keep current page when sorting in @grid.GetHtml -

is there way to keep current page when sorting @grid.gethtml columns? for have public virtual actionresult users(int? page) { var model = _context.users(); return view(model); } and html @{ var grid = new webgrid(source: model,defaultsort: "lastactivity",rowsperpage: 20); // force descending sort when no user specified sort present if (request.querystring[grid.sortdirectionfieldname].isempty()) { grid.sortdirection = sortdirection.descending; } } @if (model != null) { @grid.gethtml(tablestyle: .... thank you! webgrid not have built-in solution this. you'll have create own way load current page during sort action. here 1 possible way: http://forums.asp.net/post/4220540.aspx

c# - handling media files in the URL -

based on condition m redirecting user login page , specifying return url below context.response.redirect("~/login.aspx?returl=" + httputility.urlencode(context.request.url.tostring())); a setting in webconfig <add key="umbracousedirectoryurls" value="false"/> adds ".aspx" extension url when m requesting media files pdf document return url becomes returl=http%3a%2f%2flocal.knowledge.scot.nhs.uk%2fcalderdale%2f1.pdf.aspx how can possibly exclude media files in above setting? thanks i don't think umbracousedirectoryurls that's causing problem - think problem because umbraco doesn't know how handle pdfs properly. looks umbraco seeing pdf content rather media, why appending .aspx. think if site handling pdfs media solve issue. there guidance here on adding pdf media type ( http://our.umbraco.org/forum/developers/extending-umbraco/13593-pdf-document-media-type )

php - codeigniter not loading application/core files -

got problem codeigniter exteding core. build website local , workst perfect. when checking out on new machine or diferent php version ( tested on 5.3 , 5.2 ) works normal. when upload server doesnt load files in application/core. error message: fatal error: class 'lean_controller' not found in /var/www/vhosts/website/subdomains/w8systeem/httpdocs/application/controllers/wachtlijsten/overzicht.php on line 3 when ouput loaded files so: print_r(get_included_files()); i these results: localhost: array ( [0] => c:\wamp\www\website\index.php [1] => c:\wamp\www\website\system\core\codeigniter.php [2] => c:\wamp\www\website\system\core\common.php [3] => c:\wamp\www\website\application\config\constants.php [4] => c:\wamp\www\website\system\core\benchmark.php [5] => c:\wamp\www\website\application\config\config.php [6] => c:\wamp\www\website\system\core\hooks.php [7] => c:\wamp\www\website\system\core\config.php [8] =&

c++ - MFC Dialog Combo Box in a List Control -

i'm trying create dialog window list control (report view) displays column of text. i'm trying add column displays combo box hold list of possible actions first column. there easy way in mfc? you can't clistctrl (or not without lot of owner drawn code). instead have @ 3rd party control cgridlistctrlex heavy lifting you.

Java send data to class where object was initialized -

we have simple initialization: example: class1 { public class1 { class2 object = new class2(); } public somemethod(string anystring) {...} } so best way call somemethod in class1 class2 , pass "anystring" value? i'm using custom events , interface. maybe there better, more rational way this? but maybe there better, more rational way this? yep. class1 { public class1() { class2 object = new class2(this); } public somemethod(string anystring) {...} } class2 { public class2(class1 parent) { parent.somemethod("a string value"); } } explanation simply pass instance of parent object child class. child class can call desired method directly. java naming conventions the convention states methods start lower case letter. somemethod -> somemethod

jquery - json ,webservice "undefine error" -

function authonticate() { $.ajax({ type: "post", url: "http://lp18mobile.azurewebsites.net/lp18ws.asmx/authonticateuser", contenttype: "application/jsonp; charset=utf-8", data: { "some data" }, datatype: "json", success: function (msg) { //success } }, error: function (msg) { //error }, }); } i have used jquery,json,html5,webservice develop application. when run app throw undefined error @ "xmlhttprequest cannot load http://lp18mobile.azurewebsites.net/lp18ws.asmx/authonticateuser. origin http://'localhost:5733/..' not allowed access-control-allow-origin." why? your code attempting make cors request, not ordinary post. modern browsers allow ajax calls pages in same domain source htm

ruby on rails - Implementing RefineryCMS search engine -

i'm trying implement refinerycms search engine, have followed steps on guide https://github.com/refinery/refinerycms-search#search-plugin-for-refinery-cms , i'm implementing on custom extension, might missing something: application.rb: config.to_prepare refinery.searchable_models = [refinery::doctors::doctor] end model: module refinery module doctors class doctor < refinery::core::basemodel self.table_name = 'refinery_doctors' attr_accessible :prefix, :full_name, :bio, :specialty, :branch, :schedule, :location, :position, :dr_img, :dr_img_id acts_as_indexed :fields => [:prefix, :full_name, :bio, :specialty, :branch, :schedule, :location, :dr_img, :dr_img_id] alias_attribute :title, :full_name validates :prefix, :presence => true belongs_to :dr_img, :class_name => '::refinery::image' has_many :branches end end end controller: def show # can use meta fields model instead

certificate - Trusting app signatures -

i gather developers (except perhaps larger companies) use self-signed certificates sign apk. since required app installation, ability sign app available anyone. simple use keytool , jarsigner java sdk. these self-signed certs , associated private keys not guarantee degree of security unless can somehow match certificate trust. there no ability revocate these self-signed certificates (no crl) , there no "issuer" (since certs self-signed) "vouches" in way identity of certificate/key holder signs code. so andriod platform have or plan have ability prevent installation of apps signed particular signature? or enable settings allowing installation of apps signed cert/key issued list of trusted ca (certificate-authorities/issuers) ? however, there security available: in settings/security can prevent installation of (even signed , manually copied sim) unless comes play store, default setting. might able install user certificate , allow apps signed cert install (even

node.js - Returning nested array from mongodb and native node driver -

i have document that's setup this: { _id : '', name : '', friends : [ {'name' : ''}, {'name' : ''}, {'name' : ''} ] } i want select 'friends' array , array of objects iterate through. however, when this: this.collection.find({'_id' : _id}, {'friends' : 1}).toarray(function(err, res) { console.log(res); }); this returns array looks this: [ friends : [ {'name' : ''}, {'name' : ''}, {'name' : ''} ] ] ideally, return: [ {'name' : ''}, {'name' : ''}, {'name' : ''} ] is there way this? thank you!

java - NoClassDefFoundError on Hello World -

i trying run simple program , running errors. made simple helloworld java program, , unable run terminal on mac. have check make sure classpath set properly, , confused why not running. here program: public class hello { public static void main(string[] args) { system.out.println("hello, world"); } } here terminal commands: last login: thu may 2 12:01:50 on ttys000 172-26-125-179:~ rohan$ cd /users/rohan/desktop 172-26-125-179:desktop rohan$ ls hello.java 172-26-125-179:desktop rohan$ echo $classpath 172-26-125-179:desktop rohan$ export classpath=/users/rohan/desktop 172-26-125-179:desktop rohan$ echo $classpath /users/rohan/desktop 172-26-125-179:desktop rohan$ java hello.java exception in thread "main" java.lang.noclassdeffounderror: hello/java caused by: java.lang.classnotfoundexception: hello.java @ java.net.urlclassloader$1.run(urlclassloader.java:202) @ java.security.accesscontroller.doprivileged(native method) @ java

apache - httpd virtualhost - subdomains -

i'm having issue setting/adding sub domains.. apache2(httpd).. i have in httpd.conf namevirtualhost *:80 <virtualhost *:80> serveradmin stitofte@homiecraft.pro documentroot /var/www/html/homiecraft servername www.homiecraft.pro serveralias homiecraft.pro </virtualhost> <virtualhost *:80> servername stats.homiecraft.pro serveralias www.stats.homiecraft.pro serveradmin stitofte@homiecraft.pro documentroot /var/www/html/stats </virtualhost> homiecraft.pro works fine... but stats.homiecraft.pro doesn't work @ all.... have made dns record.. , made "stats" point listening address... still doesn't work... any nice... have had setup before... reason can't work time... normally problem in dns record, check subdomain add @ dns record , check type, sets cname , main domain type a. and check ip direction subdomain change serveralias @ subdomains quit www.

matlab - A system or language to reverse equations? -

lets have simple equation follows: x = 50 * (20 * item) is there system or language reverse automatically? lets have x input , want find out item is. item = (x - 50) / 20 a trivial , misleading example, illustrate point. i'm not talking solving equations least squares fitting or such, instead system can reverse equations generating have code hand. i'm not mathematician forgive incorrect terminology (if any). a colleage of mine said matlab can natively. has idea how? can specify inputs have , output i'm looking for? or have use inbuilt math functions handwritten reversed equation? you're looking http://www.mathworks.com/help/symbolic/solve.html you should first declare symbolic variable: syms item , then: solve(x == 50 * (20 * item), item) should give you're looking for.

Python - Returning longest strings from list -

this question has answer here: longest strings list 4 answers i have list of strings 1 below: stringlist = ["a" , "aa", "aaa", "aaaa", "aaab", "aaac"] what trying return longest strings in list, have tried using max function returns 1 value, whereas in case there 3 strings length of 4. thanks help! use list comprehension , max : >>> lis= ["a" , "aa", "aaa", "aaaa", "aaab", "aaac"] >>> le = max(len(x) x in lis) #find out max length >>> [x x in lis if len(x) == le] #now filter list based on max length ['aaaa', 'aaab', 'aaac']

c++ - Are there benefits to allocating large data contiguously? -

in program, have following arrays of double: a1, a2, ..., am; b1, b2, ..., bm; c1, c2, ..., cm; members of class, of length n, m , n known @ run time. reason named them a, b, and, c because mean different things , that's how accessed outside class. wonder what's best way allocate memory them. thinking: 1) allocating in 1 big chunk. like.. double *all = new double[3*n*m] , have member function return pointer requested part using pointer arithmetic. 2) create 2d arrays a, b, , c of size m*n each. 3) use std::vector? since m known @ run time, need vector of vectors. or not matter use? i'm wondering what's general practice. this depends on how data used. if each array used independently straightforward approach either number of named vector s of vector s. if arrays used example a[i] , b[i] related , used together, separate arrays not approach because you'll keep accessing different areas of memory potentially causing lot of cache misses. instead

javascript - What libraries does the Google CDN host (besides jQuery)? -

i've used link suggested quick access link jquery homepage: //ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js is there list of other supported javascript libraries besides jquery? it's supported google hosted libraries content delivery network . available libraries are: angularjs chrome frame dojo ext core jquery jquery ui mootools prototype script_aculo_us swfobject webfont loader

Resolving deadlock caused by parallel triggers in oracle -

my friend asked me question , not able resolve it. consider scenario have 2 triggers on table1 . both before insert triggers. both triggers try update row 1 of table2 . when insert query run on table1 , both triggers try update same row of table2 , deadlock caused. simplified issue. in actual case there around 50 triggers , other reasons because of cannot use commit in of triggers. now please me resolving above issue. is there can sequence triggers. is possible utilize savepoints in way resolve issue. or way need create temporary table , it. please explain if solutions feasible. is real situation, or hypothetical one? far know can commit in trigger autonomous transaction, explain deadlocks because otherwise running trigger code within same transaction, , can't deadlock itself. anyway, 11.2 control firing order of triggers following clause: http://docs.oracle.com/cd/b28359_01/appdev.111/b28370/create_trigger.htm#cjadjgif triggers make application suppo

ios - Obj-C introspection: How can a method reference arguments it's called with -

this intentional "fork" of question: obj-c introspection: how can method reference own selector? i need exact same thing op, whereas didn't need pass arguments, do. have way call method multiple unknown arguments (nsinvocation). have convenience methods me, in question . however, having duplicate effort each method in each class required has led maintenance issues, , hellish debugging when wrong argument passed (or in wrong order) convenience method. that itself, relative minor issue, 1 i've been grappling 2 years, , solve. having one-line macro (like @michael57) call convenience method, automatically inspecting selector (using _cmd) , arguments (using ?) , calling convenience method wished. note methods fixed argument lists , not variadic. i'm not sure if va_args approach work inspecting arguments or not. so both code management perspective, , purely out of technical curiosity (if _cmd exists selectors, there must arguments?) know how standard ob

vb.net - Special characters in HTML -

i trying retrieve specific information european web site. now, problem facing strings containing special characters such "ä". when try write same text file coming "�a". how avoid this? code in vb.net. there no html codes special characters in response. tia! in general, should able using appropriate character coding utf-8 (which assume trying convert to) here list of html codes . looks 1 wanting is: character friendly code numerical code hex code description ä &auml; &#228; &#xe4; lowercase a-umlaut hope helps.

android Picture.createFromStream does not reload bitmaps -

on android drawing android.graphics.picture save picture file. later reload picture memory , draw canvas. noticed bitmaps never drawing. , after debugging managed narrow down problem picture.writetostream , picture.createfromstream. seems bitmaps drawn picture don't reloaded properly. below sample code wrote show problem. in sample canvas not hardware accelerated. so questions follows: am doing wrong? is android bug? filed bug report https://code.google.com/p/android/issues/detail?id=54896 because think is. any known workaround? @override protected void ondraw(canvas canvas) { try { picture picture = new picture(); // create bitmap bitmap bitmap = bitmap.createbitmap( 100, 100, config.argb_8888); canvas bitmapcanvas = new canvas(bitmap); bitmapcanvas.drawargb(255, 0, 255, 0); // draw bitmap picture's canvas. canvas picturecanvas = picture.beginrecording(canvas.getwidth(), canvas.getheight());

amazon web services - How do I list the automated backups in RDS -

is there way can use rds-describe-db-snapshots command find recent automated backup? it used possible -t option amazon has since removed capability , lists manual backups. as @ 10th may 2014, looks can still use --t flag list automated backups. http://docs.aws.amazon.com/amazonrds/latest/commandlinereference/clireference-cmd-describedbsnapshots.html from there, should able parse output determine latest snapshots. rds-describe-db-snapshots --t automated dbsnapshot rds:<name>-2014-05-06-17-12 2014-05-06t17:12:39.779z <name> 2014-04-12t15:50:57.035z mysql 300 3000 available 100 username default:mysql-5-6 5.6.13 general-public-license automated <vpc> dbsnapshot rds:<name>-2014-05-07-17-11 2014-05-07t17:11:48z <name> 2014-04-12t15:50:57.035z mysql 300 3000 available 100 username default:mysql-5-6 5.6.13 general-public-license automated <vpc>

ruby on rails - Converting string to float or decimal sometimes results in long precision -

i have string want convert decimal. eg. tax_rate = "0.07" tax_rate.to_d in cases converts 0.07 converts 0.07000000000000001 . why? if helps, when @ log of when insert value db, relevant part: ["tax_rate", #<bigdecimal:7f9b6221d7c0,'0.7000000000 000001e-1',18(45)>] hopefully makes sense someone. disclaimer: have feeling going ask why i'm doing this. i've created simple settings model, user can update global settings. setting model has name , value , var_type columns. value column string. use helper method retrieve value in appropriate format depending on value of var_type column. i cannot explain why there chance can tell how avoid having kind of trouble when dealing numbers: use rationals. here documentation: http://ruby-doc.org/core-1.9.3/rational.html as stated, rational give exact number want , avoid rounding errors. from doc: 10.times.inject(0){|t,| t + 0.1} #=> 0.999999999999999

Keep Drupal content HTML in a uglified state -

Image
when adjusting content, click on source want html in uglified state, easier naivagte, without having copy , paste html htmllint , sublime text (at least once editing, in st2 if plan on doing several iterations of edits), , rtf body area. how show source in indented view this: maybe how edit content in html format only? module? how show source in indented view well, can't unless built rich text editor module have installed. ck editor , example, indent html nicely. how edit content in html format only? module? if want edit content without rich text editor, may disable particular module admin/config/modules or make plain text default going admin/config/content/formats , dragging 'plain text' top of list.

java - File not found exception - when creating new file on sdcard in android -

in application, requirement need install .apk file assets folder, trying copy apk file assets folder sdcard, file not found exception. these following code: string file_path = environment.getexternalstoragedirectory().getabsolutepath(); string file_name = "imagedownloading.apk"; assetmanager assetmanager = getassets(); try{ inputstream input = new bufferedinputstream(assetmanager.open(file_name)); file path = new file(file_path); if(!path.exists()){ path.mkdirs() } file file = new file(path,file_name); outputstream output = new fileoutputstream(file); // here file not found exception error. byte data[] = new byte[1024]; int count; while ((count = input.read(data)) != -1) { output.write(data, 0, count); } output.flush(); output.close(); input.close(); } catch(filenotfoundexception e){ toast.maketext(mainactivity.this,"file not found exception " + e.getmessage(), toas

C# WPF Change Resource On Click -

my xaml here: <window.resources> <xmldataprovider x:key="rsssource" xpath="//item" source="https://news.google.com/news?output=rss" /> </window.resources> i need change when button click event: <window.resources> <xmldataprovider x:key="rsssource" xpath="//item" source="change textbox value" /> </window.resources> how can it? like maybe xmldataprovider provider = (xmldataprovider) this.findresource("rsssource"); provider.source = new uri("change textbox value");

javascript - Why does slice not work directly on arguments? -

this question has answer here: how slice “arguments” 4 answers tested out on fiddle after looking @ underscore. this seems hack call slice on arguments when not on prototype chain. why not on prototype chain when works on arguments. var slice = array.prototype.slice; function test () { return slice.call(arguments,1); // return arguments.slice(1) } var foo = test(1,2,3,4); _.each(foo, function(val){ console.log(val) }); >>> object.prototype.tostring.call(arguments) <<< "[object arguments]" >>> array.isarray(arguments) //is not array <<< false >>> arguments instanceof array //does not inherit array prototype either <<< false arguments not array object, is, not inherit array prototype. however, contains array-like structure (numeric keys , length property), array.prototype.s

html - php while loops not executing properly -

Image
i have 3 wards a,b,c in database , 4 employees (3 on ward a, 4 on b , 1 on c) , below script prints out wards correctly , prints out 3 employees works on ward nothing more (i:e compares against ward , not other 2) can see obvious error in order php executing causes this? i'm new php thats why don't quite understand syntax =) while ( $row = mysql_fetch_array($wardnames) ) { echo("<tr><td><a href=\"javascript:displayward('" . $row['name'] ."')\"> <div class='wardheader'><div class='plus'></div><div class='wardname'><b>" . $row['name'] . " </b></div> </div> </a></td></tr>"); while ( $employeerow = mysql_fetch_array($employees)) {//only prints out employees on ward , not b or c. why? if($employeerow['ward']==$row['name']){

java - Hibernate mapping when cfg file and entity file are in different folders -

Image
i've got project structure: when i'm trying access dtb via hibernate, exception: initial sessionfactory creation failed.org.hibernate.mappingexception: entity class not found: user/dbuser v 02, 2013 9:17:10 odp. org.apache.catalina.core.standardwrappervalve invoke severe: servlet.service() servlet [mvc-dispatcher] in context path [/fit] threw exception [handler processing failed; nested exception java.lang.exceptionininitializererror] root cause java.lang.classnotfoundexception: user/dbuser could please show me, how should path in config files like? i've tried several combinations, can't figure out, how write it. dbuser.hbm.xml : <?xml version="1.0"?> <!doctype hibernate-mapping public "-//hibernate/hibernate mapping dtd 3.0//en" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name="dontknowwhatshallbehere/dbuser" table="dbuser">

actionscript 3 - Workers in Apache Flex 4.7 -

has been able use workers in air application built flex 4.9.1 , air 3.7? wanted give try project, include/setup worker in tutorial made lee brimelow, application "freezes". means: not start. compiler compiles, info-text in console, neither window opens nor of events fired. ideas :) ? quite simple solution. add -swf-version=xx //xx must >=17 as compiler argument , works. think bit weird, since using air 3.7 okay, whatever takes :)

jquery ajax object array php -

i have: var apiquizdata = {'ect stuff removed...',answers:{}}; $.each(dataceactivequiz.quiz_data, function(index, answer) { if(answer.selected == undefined){ apiquizdata.answers[answer.id] = 0; } else { apiquizdata.answers[answer.id] = answer.selected; } }); $.post(url, apiquizdata, function(data) { if @ form data submitted through header via chromes inspect tools shows: // url decoded answers[28194]:112768 answers[28195]:112773 answers[28199]:112788 answers[28202]:112803 answers[28204]:112809 // url encoded answers%5b28194%5d:112768 answers%5b28195%5d:112773 answers%5b28199%5d:112788 answers%5b28202%5d:112803 answers%5b28204%5d:112809 // query string answers%5b28195%5d=112773&answers%5b28199%5d=112788&answers%5b28202%5d=112803&answers%5b28204%5d=112809 in php use $sent_data = file_get_contents('php://input'); $sent_data_decoded = json_decode($sent_data, true); the string php rec

java - signed JNLP applet hanging on load -

i have applet worked fine month ago hangs @ startup. locks browser process must killed. single applet causing problems. the console log shows jnlp file loading , reloading. not sure if problem. no exceptions thrown. never reach security check. near bottom this: basic: relaunch because: [currently running jre doesn't satisfy (version/args)] this bottom part of console log. network: created version id: 1.7.0.21 network: created version id: 1.7 network: created version id: 2.2.21 network: cache entry found [url: http://ws001lt9138prd/web4/lib/configurator.jnlp, version: null] prevalidated=false/0 cache: adding memorycache entry: http://ws001lt9138prd/web4/lib/configurator.jnlp temp: new xmlparser source: temp: <?xml version="1.0" encoding="utf-8"?> <jnlp spec="6.0+" href="configurator.jnlp"> <security> <all-permissions /> </security> <resources> <java version="1