Posts

Showing posts from August, 2013

VB.NET and MS Access - Binding (Data won't save to database) -

i have linked 1 of vb.net forms ms access database table, however, when save data entered vb form data set, data show in data set not appear in database table. there anyway can data have stored in data set appear in actual database. i have bound form fields correctly database table , have added tables form via data grid. ![form & data grid][1] can tell me why won't save database? or have alternative method binding forms database. *note - database has password on (don't know if effects it) *note - i'm new forum cant post image... *note - let me know if need see more code form loading code public class cd_form private sub cd_load(sender system.object, e system.eventargs) handles mybase.load 'todo: line of code loads data 'cdkingsdatabasedataset.cd' table. can move, or remove it, needed. me.cdtableadapter.fill(me.cdkingsdatabasedataset.cd) end sub add button code private sub button5_click(sender system.object, e system.eventarg...

Debugging Blackjack program? (Java) -

i trying write blackjack program user bets against cpu dealer. the problem having have written classes card, deck, , dealer, when try initialize new dealer , new deck error: exception in thread "main" java.lang.nullpointerexception @ blackjack.deck.<init>(deck.java:12) @ blackjack.blackjack.main(blackjack.java:10) here class card : class card { private int rank; private int suit; private int value; private static string[] ranks = {"joker","ace","two","three","four","five","six","seven","eight","nine","ten","jack","queen","king"}; private static string[] suits = {"clubs","diamonds","hearts","spades"}; card(int suit, int values) { this.rank=values; this.suit=suit; if(rank>10) { va...

nlp - Ngram model and smoothing algorithm -

which smoothing algorithm easy , effective in case of implementation point of view? my training corpus hex dump looks like, 64 fa eb 63 31 d2 62 22 19 bd 64 b5 63 17 4f 48 62 a8 64 11 0f 62 15 9b 64 9b 1f e1 63 62 63 i build 2,3,4,5-gram language model on it. , need smoothing! smoothing algorithm suitable , easy implement in case? laplace (add-one) smoothing should easy implement. when comes robustness, n-gram tools (kenlm, srilm, ...) default kneser-ney smoothing . for overview of performance of different smoothing techniques, see http://www.aclweb.org/anthology/p/p96/p96-1041.pdf

unity3d - Android build fails with unknown reason after upgrading android-sdk -

i working old version unity 4.0 use old plugin. after wrong step of upgrading android sdk, unity gives error , doesn't build unity project @ all. i read typical error upgrading android sdk, rev 21 rev 22. , shows error building player: exception: android (invocation failed) error* unknown error then tried downgrade android sdk rev21, reinstall unity , eclipse(just in case), did not work. do have suggestion recover trouble? according sdk manager android sdk contains: android sdk tools: rev.21 platform-tools: 19.0.1 api: 15, 14 extras: android support library it looks can't find aapt.exe file inside \androidsdk\tools try copying aapt.exe \androidsdk\build-tools\19.0.1 (what ever version) have tools

c# - How to solve the cast to value type 'System.Decimal' failure error -

the cast value type 'system.decimal' failed because materialized value null. either result type's generic parameter or query must use nullable type. public class bar { [key] public int barid { get; set; } public int quantity { get; set; } public decimal? unittotal{get { return quantity * (pricelist == null ? 0 : pricelist.price); }} public decimal? dailytotal { get; set; } public int pricelistid { get; set; } public virtual pricelist pricelist { get; set; } } bar.dailytotal = db.bars.sum(h => h.quantity * h.pricelist.price); edit: sounds 1 of mapped types resolving null. such quantity or price fields. check schema/mapping make sure if nullable mapped nullable type.

android - How to get the screen size? -

i trying set sprite image background , didn't success set image size screen size. i'm trying this: public class game extends surfaceview implements runnable { private surfaceholder holder; private boolean isrunning = false; private thread gamethread; private sprite s; private int screenwidth; private int screenheight; canvas canvas; // private sprite[] sprites; private final static int max_fps = 40; //desired fps private final static int frame_period = 1000 / max_fps; // frame period public game(context context) { super(context); holder = getholder(); holder.addcallback(new surfaceholder.callback() { @override public void surfacecreated(surfaceholder holder) { } @override public void surfacechanged(surfaceholder holder, int format, int width, int height) { screenwidth = width; screenheight = height; ...

ios - Loading localized xib file from resource bundle (not main) -

i have created resource bundle using cocopad contains localized strings, images , xib files. have no problem loading localized strings , images having problem loading xib files using similar approach. here 1 of methods tried: nsstring *nibname = @"mytestviewcontroller"; nsbundle *resourcebundle = [nsbundle bundlewithurl:[[nsbundle mainbundle] urlforresource:@"mytestresources" withextension:@"bundle"]]; nsstring* path= [resourcebundle pathforresource:@"en" oftype:@"lproj"]; nsbundle* nibbundle = [nsbundle bundlewithpath:path]; return [[mytestviewcontroller alloc] initwithnibname:nibname bundle:nibbundle]; i got 'nsinternalinconsistencyexception', reason: 'could not load nib in bundle: 'nsbundle (not yet loaded)' name i have printed out files in nibbundle , file there. i saw in apple developer web site in uikit, applications can load n...

ios - How to turn 4 bytes into a float in objective-c from NSData -

here example of turning 4 bytes 32bit integer in objective-c. function readint grabs 4 bytes read function , converts single 32 bit int. know how convert 4 bytes float? believe big endian. need readfloat function. can never grasp these bitwise operations. edit: i forgot mention original data comes java's dataoutputstream class. writefloat function accordign java doc is converts float argument int using floattointbits method in class float, , writes int value underlying output stream 4-byte quantity, high byte first. this objective c trying extract data written java. - (int32_t)read{ int8_t v; [data getbytes:&v range:nsmakerange(length,1)]; length++; return ((int32_t)v & 0x0ff); } - (int32_t)readint { int32_t ch1 = [self read]; int32_t ch2 = [self read]; int32_t ch3 = [self read]; int32_t ch4 = [self read]; if ((ch1 | ch2 | ch3 | ch4) < 0){ @throw [nsexception exceptionwithname:@"exception" rea...

javascript - How can I listen to back/forward button click in my SPA? -

i have backbone app, uses backbone.history.start({pushstate: true}). render pages based on url change, , forward buttons work fine, views rendered well. there problem though, page scroll positions are't kept when click or forward button. makes feel bad. i thought keep array of pages visited , store scroll position each of them. listen if user click back/forward , load appropriate scroll position. but. i found out unable tell when user click or forward button. if could, read stored scroll position of previous page , apply it. doing wrong? you store scroll location part of route, using like: router.navigate('/my/route/scroll/[my_scroll_location]', {replace: true}); so won't add new history point, modify current one. way, when hit "back" go previous "page"/route, , hitting "forward" have enough information scroll right point.

ios - Swift and Parse - Message app, cannot display username within Xcode 6.3 -

i have issue display 'author's username of each posts in tableviewcontroller. it display current user's username display posts, how display each poster's username ? i'm using xcode 6.3 , parse.com api. timelabel displayed correctly, userlabel display current user logged in instead of author of post. if logged out , login different username userlabel change new user. debug console display optional("thenameofthecurrentuser") many times there posts displayed. parse host 2 db 1 users (user) , 1 posts (poemes), there pointer in poemes table specific user. i update xcode 6.3 lately , had error on var findlover:pfquery = pfuser.query() value of optional type 'pfquery?' not unwrapped i add exclamation mark (!) @ end of line, remove error, causing issue ? i read parse documentation , follow exemples looks i'm bit lost here, , suggestions highly appreciated, thanks. override func tableview(tableview: uitableview, cellforrowatin...

Reactjs component interfering other component on same page -

i have 2 react components, likebox , commentbox likes.jsx var react = require('react'); var likebox = react.createclass({ getinitialstate: function(){ return {count: this.props.initialcount} }, render: function(){ return ( <div classname="likebox"> { this.state.count && <span>{this.state.count} people this</span> } </div> ); } }) module.exports.likebox = likebox; comment_box.jsx var react = require('react'); var $ = require('app/common/jquery'); var commentbox = react.createclass({ getinitialstate: function(){ return {data: []}; }, handlecommentsubmit: function(comment){ this.refreshcomments(); }, apiurl: function(){ return this.props.apiurl+"?content_uuid="+this.props.contentuuid; }, refreshcomments: function(){ $.get(this.apiurl(...

javascript - document.execCommand not being executed -

this tough 1 me. got conenteditable div formating buttons. 1 of these "bold" button: <li data-role="button" data-button-role="bold"><b>b</b></li> in javascript got little peace of code: $(document).ready(function(){ $("[data-role='button'][data-button-role='bold']").click(toggleboltformat); }); function toggleboltformat() { document.execcommand("bold", false, null); } this things called (tested alert()), execcommand line not being executed. highlighted text not getting bold. can problem relativ , absolut position of parent element of ce-div? when putting docuement.execcommand line in chromes js-console, works fine. try add similar html's unselectable="on" behavior. created class called unselectable , added <li> : <li data-role="button" data-button-role="bold" class="unselectable"><b>b</b><...

php - How to output added to cart messsage or add to cart error on the current page Woocommerce? -

how output added-to-cart messages or add cart error message on current page woocommerce after add-to-cart button had been fired? since error messages usally redirected in class-wc-cart.php? because allowed add cart button on content-product.php page. code of redirect after add car on class-wc-cart ajax this: // if there error adding cart, redirect product page show errors $data = array( 'error' => true, 'product_url' => apply_filters( 'woocommerce_cart_redirect_after_error', get_permalink( $product_id ), $product_id ) );// it's redirect link individual product page wp_send_json( $data ); the website link is: http://gotheelz.com try changing settings of woocommerce, woocommerce > settings > products > display tab > add cart behaviour -- untick redirect cart page after successful addition , [✓] enable ajax add cart buttons on archives....

javascript - Prevent spaces in input field on keypress event -

i'm using following code detect multiple keys on keypress event: var down = []; $(document).keydown(function (e) { down[e.keycode] = true; }).keyup(function (e) { if (down[17] && down[32]) { // } down[e.keycode] = false; }); however, hotkey ( ctrl + space ) meant used while input field has focus. whenever press key combination, adds space input field. how can prevent happening? i've looked @ ways disable spaces in input (like this ), can't figure out how make work inside keypress event only. i ended using different approach, melanciauk suggested. on keyup event, removes last character in input field. var down = []; $(document).keydown(function (e) { down[e.keycode] = true; }).keyup(function (e) { if (down[17] && down[32]) { // input = $(':focus'); input.val(function (index, value) { return value.substr(0, value.length - 1); }); ...

c++ - OpenCV, Undefined symbols for architecture x86_64 error -

i'm trying opencv work on computer - simple programs can work program i'm unable to. error getting follow: undefined symbols architecture x86_64: "cv::namedwindow(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)", referenced from: _main in ccux28ge.o "cv::split(cv::mat const&, std::vector<cv::mat, std::allocator<cv::mat> >&)", referenced from: computefocusdpc(std::vector<r_image, std::allocator<r_image> >, int, float, int, int, int, int, cv::mat*) in ccux28ge.o qdpc_loop(std::vector<cv::mat, std::allocator<cv::mat> >, std::vector<cv::mat, std::allocator<cv::mat> >, double) in ccux28ge.o "cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)", referenced from: _main in ccux28ge.o "cv::imshow(std::__cxx11::basic_s...

javascript - How to combine list elements into pairs -

is there convenient function in javascript, or without underscore.js, takes list of form [a, b, c, d] , transforms list of form [[a, b], [b, c], [c, d]] ? this solved array.prototype.map : var makepairs = function(arr) { // want pair every element next 1 return arr.map(function(current, i, arr) { // return array of current element , next return [current, arr[i + 1]] }).slice(0, -1) // every element except last, since `arr[i + 1]` `undefined` } var arr = [1, 2, 3, 4] // should never use `document.write`, except in stack snippets document.write(makepairs(arr).join("<br>"));

Add 1 - Javascript Android Studio -

trying make "click counter" game in android studio. int clicked = 0; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); final textview text = (textview) findviewbyid(r.id.counter); button button = (button) findviewbyid(r.id.button); button.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { clicked++; text.settext(clicked); } }); } this code set counter. ideas might doing wrong? try: @override public void onclick(view v) { clicked+=1; text.settext(string.valueof(clicked); text.invalidate();}

php - Adding #id to the_permalink() -

i cant seem figure out code this. im in functions.php of child theme. i'm trying have image link comments section of post. have button links post itself. the code looks like <a href="<?php the_permalink(); #reply-title ?>"> <img src="http://trueidconference.com/wowministriesblogs/wp-content/images/joinimg.png" alt="mountain view" style="margin-left:12px;"></a> when try it, doesn't show up. if use <a href="#reply-title"></a> shows up, of course doesn't link post, id. i have tried different variations using echo work. but cant seem figure out how add #reply-title whatever current permalink is. the reason in functions.php because needed add link bottom of every post. try: <a href="<?php the_permalink(); ?>#reply-title">

xmpp - ejabberd cluster: Multi-master or Master-slave -

so far i've come across - setting ejabberd cluster in master-slave configuration, there single point of failure , people have experienced issues when after fixing master (if goes down), cluster doesn't become operable again. sometimes, ejabberd instances of every slave have revisited again them working properly, or mnesia commands have in-putted again make master communicate slaves. setting ejabberd cluster in multi-master configuration of nodes can taken out of cluster without bringing whole cluster down. basically, there no single point of failure and, way in official documentation ejabberd tells via join_cluster argument expose in ejabberdctl script. however, in case, data replicated across both nodes big performance overhead in opinion. so boils down this. what best/recommended/popular mode in ejabberd cluster of 2 nodes should set respect performance keeping other critical factors (fault tolerance, load balancing) in mind well. there single...

coldfusion - cfdocument tag suddenly throwing "This function should be called while holding treeLock." error -

i have application contains form which, until recently, able save pdf using cfdocument. few weeks ago swapped out server. old server running cf 9.0.1. new server cf 10. since then, i've been getting error when try save particular form pdf. -- an exception occurred when performing document processing. cause of exception that: coldfusion.document.spi.documentexportexception: java.lang.illegalstateexception: function should called while holding treelock. -- i have page in application saves pdfs fine. it's page that's throwing error. can't find treelock anywhere on web (at least, nothing pertains coldfusion). has else run this, , if so, how did fix it? thanks! i started getting error upon promoting new version. rendered content in html. found had forgotten promote image (got dreaded x image). promoted image, cfdocument pdf works again. (i'm using localurl="yes" ) in other words, can debug cf errors halt process cfdocument p...

javascript - How to get control id if control is rendered inside of master page with jQuery? -

i went through posts here not find i'm looking for. my control rendered following way: ctl00_ctl00_contentplaceholder2_contentplaceholder2_txtaccountnum0 how can reference using jquery? the following not work: $('#<%=txtaccountnum0.clientid%>') well, need # before id. time.

java - Android storing login credentials / automatic login after registration -

i developing messenger app android , i'm working on user login. first time user starts app, made activity log on. currently, "registering" new user in database on java server. how can store login data users can login without having enter credentials every time? in question suggested use token authentication. far know, there no way securely store information. shared preferences not secure, can read (and change) them when rooted. use secured database? if use token authentication, how can implement it? i've seen examples using webview . need login on mosquitto mqtt server (for push messages). i appreciate help. sorry asking such (maybe) trivial questions, haven't found useful on internet. it's better can use imei number primary authentication key. if imei present in database proceed automatic login else proceed login screen

python - How would you turn jinja2 templates into static html -

i have flask application using jinja2 template engine. content dynamic, pulling particular bits database. i'd turn particular page static dynamic data etc. intact. however, i'd run every hour or database continue have new data, hench why i'm not using existing static generator or building static page manually - cron job run automatically. any thoughts on how might done? can't provide code examples don't have clue on how might tackle this. any me started appreciated. you can use frozen-flask convert dynamic flask app static site. can discover pages on it's own, assuming each page linked page, such list of blog posts linking individual posts. there ways tell other pages if not discovered automatically. run periodically cron job update static site regularly. freeze_app.py : from flask_frozen import freezer myapp import app freezer = freezer(app) freezer.freeze()

c# - OnClick Event for Anchor Tags -

is there onclick event anchor tags? have following line of code: <li><a href="#" runat="server">logout</a></li> when user clicks logout text want fire code in method this: protected void btnlogout_click(object sender, eventargs e) { session.removeall(); session.abandon(); } what best practice @ doing in anchor tag? instead of standard html anchor tag, use linkbutton this. provides functionality you're looking for. here have sample <asp:linkbutton id="btnlogout" text="logout" onclick="btnlogout_click" runat="server"/> it renders html anchor visually it's same code.

android - getContentResolver().query(Browser.BOOKMARKS_URI returns null -

getcontentresolver().query(browser.bookmarks_uri returns null while trying query browser history. explicitly, returns null: cursor cursor = getcontentresolver().query(browser.bookmarks_uri, browser.history_projection, null, null, browser.bookmarkcolumns.date + " desc"); when permission noted: <uses-permission android:name="com.android.browser.permission.read_history_bookmarks" /> and called main activity. this started happening after latest chrome update. i have same issue if query done before chrome browser started. once launch chrome, , return app, query works. the bug being discussed here may related: https://code.google.com/p/chromium/issues/detail?id=497538 if bug cause, looks fix in progress.

openlayers 3 - GeoJSON tiles regression in v3.5.0 -

my vector tiles rendered correctly version 3.4, nothing displayed in 3.5. there no errors in js console. haven't found related changes in recent api. bug? var tilevectorsource = new ol.source.tilevector({ format: new ol.format.geojson(), tilegrid: new ol.tilegrid.xyz({ maxzoom: 19 }), url: 'data/{z}/{x}/{-y}.json' }); var vectorlayer = new ol.layer.vector({ source: tilevectorsource, style: new ol.style.style({ fill: new ol.style.fill({ color: '#9db9e8' }) }) }); var map = new ol.map({ target: 'map', layers: [ new ol.layer.tile({ source: new ol.source.osm() }), vectorlayer ], view: new ol.view({ center: [1877798, 6568203], zoom: 6 }) }); you have run bug see also: https://github.com/openlayers/ol3/issues/3750 the fix ( https://github.com/openlayers/ol3/pull/3747 ) in upcoming 3.6 release

css - Why are these inline-block elements outside their container? -

as illustrated here: http://jsbin.com/vavuvo/2 html <div class="color-bar"> <span></span><span></span><span></span> </div> less .color-bar { display: block; height: 5px; border: 1px solid red; > span { display: inline-block; height: 5px; width: 25%; } > span:nth-child(1) { background: blue; } > span:nth-child(2) { background: green; } > span:nth-child(3) { background: purple; } > span:nth-child(4) { background: orange; } } the default value vertical-align baseline . set top instead. http://jsfiddle.net/06z63n7l/ .color-bar > span { display: inline-block; height: 5px; width: 25%; vertical-align: top; }

android - What's the difference between changing two fragments with FragmentManager and two views with ViewSwitcher? -

when choose between using 2 fragments , replacing 1 other in activity (or child fragments in fragment) or using 2 views , changing them using viewswitcher (or viewflipper)? for example, while loading data, use loading view, , want change main view. it depends on app structure. viewswitcher may work, not best way this. option not fragment @ all, change content of activity, calling again setcontentview(int) layout resource of main view, once loading complete.

Java language constructs to handle images -

i work out project scratch. these days, have been assigned template matching project includes image handling besides other things do. plan code project in java. want complete reference of java language constructs 1 way or related image handling. don't want know third-party library core java ones. references based on java se 8 preferred. i'd start @ bufferedimage , imageio (links java se 8 docs). a bufferedimage sounds - image buffer of rgb information. can use imageio deal various file formats - no need write code png, bmp, jpg, or other formats. imageio.read loads image image file, , imageio.write formats bufferedimage object whatever file format want.

sql - Update statements containing multiple sets -

i'm bit confused on why i'm seeing difference between 2 statements. i'm trying increment int column 1, setting values 1, 2, 3, 4, etc.: query #1 produces desired result: declare @a int set @a = 0 update #jc_temp set num = @a, @a=@a+1 query #2 sets rows 0: declare @a int set @a = 0 update #jc_temp set num = @a set @a=@a+1 obviously i'm missing here, naked eye appear same. local variable rollback somehow in 2nd query? because second "update" two separate statements : 1 - declare @a int 2 - set @a = 0 3 - update #jc_temp set num = @a 4 - set @a=@a+1 the update sets rows value of @a (which 0), next statement increments @a . your first update : 1 - declare @a int 2 - set @a = 0 3 - update #jc_temp set num = @a, @a=@a+1 increments value of @a for each row , see increments in data.

Loop through textboxes in vb.net -

i remember in vb6 able create array of textboxes. textbox1(0), textbox1(1) ..... , but in vb.net can't create array ? if have code . possible set loop ? textbox1.text = "" textbox2.text = "" textbox3.text = "" textbox4.text = "" textbox5.text = "" textbox6.text = "" textbox7.text = "" textbox8.text = "" textbox9.text = "" textbox10.text = "" textbox11.text = "" textbox12.text = "" textbox13.text = "" textbox14.text = "" textbox15.text = "" if textbox controls on main form, can loop through them: for each tb textbox in me.controls.oftype(of textbox)() tb.text = string.empty next if in panel, replace me keyword name of panel.

javascript - Hide / Show multiple items with Jquery -

i have searched around , seem getting same answer people have asked similar question please forgive me if seems simplistic. trying hide/show multiple items @ same time pressing of 1 button, , seems way have come doing handling class, such below: $(document).ready(function(){ $(".btn1").click(function(){ $("p").hide(); }); $(".btn2").click(function(){ $("p").show(); }); }); and html follows <p class="test">if click on "hide" button, disappear.</p> <p class="test">if click on "hide" button, disappears.</p> i dont want using html selector <p> as in example because want use different types of items. what using css class? $(".btn1").click(function(){ $(".class-to-hide").hide(); }); html <div class="class-to-hide"> <p>will hide</p> </div> <div> <p class="...

vb.net - Type mismatch for Shape variable in VB -

i trying go through each commandbutton on worksheet. keep getting type mismatch error when try run function. dont know mistake making here. please me. sub worksheet_calculate() dim s shape dim findshape string findshape = "not found" each s in me.shapes if intersect(s.topleftcell.address, range("d8:d21,d52:d64,d107:d117")) = true findshape = s.name msgbox findshape, vbokonly else msgbox "the active cell intersect " end if next you not using intersect correctly. intersect returns range intersection of 2 other ranges. if want know 2 ranges have in common, check result not nothing . do: dim s shape dim findshape string findshape = "not found" each s in me.shapes if not intersect(s.topleftcell, range("d8:d21,d52:d64,d107:d117")) nothing findshape = s.name msgbox findshape, vbokonly else msgbox "the active cell intersect " end if n...

ruby on rails - has_many Using class Versus class_name -

i've been modelling custom has_many associations this: has_many :friends, class: user i found style isn't documented , api docs: has_many :friends, class_name: 'user' i haven't noticed problems former syntax, , i'm curious why later syntax used (wouldn't better avoid converting string class?). reason switch former later? well in coming version of rails class has been renamed anonymous_class . although still in master branch. there problem use of :class , here goes commit : in 1f006c option added called :class allow passing anonymous classes association definitions. since using :class instead of :class_name common typo amongst experienced developers can result in hard debug errors arising in raise_on_type_mismatch? to fix we're renaming option :class :anonymous_class more correct description of option for. since internal, undocumented option there no need deprecation. it in 4-2-stable rename :class ...

excel - Debugging. Copy a variable number of cells in one sheet and paste into another sheet -

the objective of code copy n number of rows , 3 columns of cells sheet2 last empty row in sheet1. attempted using cell properties in range copy line giving me runtime error '1004' (application-defined or object-defined error). how can rectified? private sub commandbutton1_click() dim sum integer n = 7 sheets("sheet2").range(cells(11, 15), cells((11 + n), 18)).copy sheets("sheet1").range("a500").end(xlup).offset(1, 0) .pastespecial xlpasteformats .pastespecial xlpastevalues end end sub one [issue] catches people out when passing range objects arguments range property if need specify worksheet object (which practice), need specify of range/cells properties use. (source/more reading: http://excelmatters.com/referring-to-ranges-in-vba/ ) you use: with sheets("sheet2") .range(.cells(11, 15), .cells((11 + n), 18)).copy end or: sheets("sheet2").range(sheets("sheet...

python - Django state-based url routing -

hello! i love django app developing route url response based on logic beyond url string. i able take state of application (the logged in user , session, contents of database) account. mean 2 users visit same url, based on type of account have (for instance) receive different responses. an example say app has user , admin user classes. both visit http://some-domain.com/dashboard , see entirely different things there. furthermore, there sub-urls beyond dashboard /dashboard/comments , /dashboard/friends . again, these entirely different views depending on user class. at present this: (urls.py) urlpatterns = [ url(r'^dashboard/', include([ url(r'^$', render_dashboard), url(r'^settings/$', render_dashboard_settings), url(r'^friends/$', render_dashboard_friends), ])), ] the issue setup there no way take current user account. can still made work because can route kinds of user accounts same template, , use...

web services - Problems connecting to Adobe Connect with CFHTTP in CF10 -

Image
i trying fix number of issues our company's platform has integration adobe connect. 1 has me perplexed intermittent failures login method. have 1 client credentials fail regularly, not always. have login method call in try/catch block cfhttp output dumped email , sent me. here sample failure, using cfhttp tag <cfhttp url="#httpcall#" method="get" /> : however, when invoke login method via browser, using url attribute invoked cfhttp tag (eg. http://[host].adobeconnect.com/api/xml?action=login&login=[username]&password=[password]&account-id=[id] ), following callback: <results> <status code="ok"/> </results> the request header follows: so, there nothing wrong credentials passed in, nor response: return mime type of text/xml, when called directly. points issue cfhttp tag, , potentially adobe connect account we've set 1 of our clients, or both. not happen every call made adobe connect via cfhttp, ,...

multithreading - Chaining together AsyncTasks in Android - better to use Threads? -

i have series of network operations must done sequentially: connect specific wifi device's ap send data on tcp connect different ap send udp broadcast i have implemented starting each asynchtask in onpostexecute of previous asynchtask . realize in different part of app reuse code asynchtask 2 (to send different data), can't because not want asynchtask 3 start when finished. realize use flag (a boolean or int) , pass asynchtask 2 , not start asynchtask 3 if flag false, seems confusing , messy. can done in cleaner way using threads? or end using same logic i.e. using flag in run() method? let me know if me post code, long , feel question pretty clear. if know you're going running of these tasks in sequence, why not put them in same asynctask ? can still use different classes or functions make code more compartmentalized.

How to Handle events from a control array VB.net -

to start, hi im new stackoverflow, , new programing (on 1º year). i've been searching ive found nothing answer question, or maybe im newbie understand answers, im sorry if simple, cant see it! /* native lenguage not english*/ here problem, i'm making vb form whit 200 pictureboxes have change or interact on click i've made control array whit of them, this: dim control(199) picturebox = controles(control, 0) function controles(byref control array, byval cont integer) each pic picturebox in me.controls control(cont) = pic cont += 1 next return control end function this should asociate each picturebox array position, problem how can set event handler watch @ control().click no matter box click event onclick proc. the way know create click handler each box manually. hope can find answers using addhandler statement can wire them same routine. cast sender object interact pb clicked. oftype function. private sub loadm...

java - JDBC API specification and implementation -

i going through jdbc api's (mainly java.sql package) after writing simple jdbc programs. for example, in java.sql, below declaration: public interface connection extends wrapper, autocloseable so, per understanding, these specifications have implemented database vendors, in form of jdbc drivers. in sample program used h2 db, downloaded jdbc driver. now, jar should have implementation of java.sql.connection, , saw in .jar (jdbc driver) (under package --> org.h2.jdbc): public class org.h2.jdbc.jdbcconnection extends org.h2.message.traceobject implements java.sql.connection { the jdbc driver jar implement java.sql.connection, expected; java.sql.connection from? (it implements java.sql.connection), definition of java.sql.connection coming from? any pointers clear doubt helpful. it's in jdk, since able @ its documentation in jdk javadoc .

Using Ajax to render a partial in rails -

this post last chance work out why ajax call doesn't work in project. hope guys give me hand. what solely want render partial of "orders" administration page clicking on "link_to" button. this have in controller called "masters": class masterscontroller < applicationcontroller before_action :logged_in_master, only: [:index, :edit, :update, :destroy] before_action :correct_master, only: [:edit, :update] def administration @orders = order.all respond_to |format| format.html format.json format.js end end my view called "administration.html.erb": <% provide(:title, "administration") %> <h1>manage site</h1> <ul class="nav nav-pills"> <li role="presentation" class="active"><%= link_to "masters", masters_path %></li> <li role="presentation"><%= link_to "orders", order...

Netezza system catalog table constains duplicate records for external tables -

in netezza box, can see duplicate records in system tables. specific external table records shown below example: system.admin(admin)=> create external table “joe” (“id” integer) system.admin(admin)-> using (dataobject(‘filename.csv’) system.admin(admin)(> remotesource ‘odbc’); create external table system.admin(admin)=> select tablename, objtype _v_table tablename =’joe’; tablename | objtype ———–+—————- joe | external table joe | external table (2 rows) system.admin(admin)=> select tablename, objtype _v_table objtype =’external table’; tablename | objtype ———————————————————-+—————- stg_tblmembers_hist_ext_ef8de7e9c2b14692bf61848d5fd20858 | external table stg_tblmembers_hist_ext_ef8de7e9c2b14692bf61848d5fd20858 | external table joe | external table` joe | external table (4 rows) even objectid same these 2 duplicate records. not found reason it. please , let me know reason it. thanks this has been confirmed bug, , fixed in subsequent pat...

android - 5.1.1 notification TextView, the correct way to deal with white text? -

Image
i put textview on custom layout notification. colour of textview becomes automatically white. is bug of android? because prior lollipop, notification background used dark colour, white text made sense. on lollipop, default background white, white text invisible. or supposed set text colour explicitely? putting android:textcolor="@android:color/primary_text_light" made text black, not guaranteed lollipop devices have white notification background, it? what correct way guarantee text on custom notification visible regardless of background colour of system? preview on android studio on actual 5.1.1 device <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent"> <textview ...

css - Block level elements acting like Flexbox elements -

i've run curious problem when trying create flexbox accordion. problem contents of given accordion act flexbox elements if set display block. best described showing example: http://codepen.io/jcummins/pen/kpwzny $('item div.header').click(function(e){ $( ).parent().toggleclass( "active" ); }); body { height:100%; width:100%; background-color: #ccc; margin:0; padding:0; } container { display:block; position:absolute; height: 100%; width: 100%; /* formatting styles: safe remove */ background-color: #999; } items { height:100%; display: -webkit-box; display: -moz-box; display: box; -webkit-box-orient: vertical; -moz-box-orient: vertical; box-orient: vertical; box-pack:top; box-align:center; /* formatting styles: safe remove */ background-color: #fc0; } item { display:flex; /* formatting styles: safe remove */ box-shadow:0 1px 3px rgba(0,0,0,.3); margin-bottom: 6px; ...

php - How can I sort a table of Laravel Eloquent objects by a custom attribute? -

i have laravel 4.2 project (though i'll upgrade laravel 5, i'm interested in answers apply either version of laravel). define custom attributes models make easier calculate , display values. (see laravel documentation how works.) e.g.: public function getfoobarattribute() { // complex calculations, etc. return $result; } then in view can {{ $object->foo_bar }} print result of calculation. often such code appear column of <table> displaying list of objects. want make table sortable column. best way that? the main solution have come far convert calculations in function equivalent sql (and there eloquent / querybuilder syntax). however, error-prone, makes code harder read, , difficult maintain (since must changed if attribute function ever is). another solution sort resulting collection manually, i'm under impression doing slower. (is true?) how else can accomplish this? the way be, stated, convert calculations or code in custom attr...

statistics - last observation carried forward hot deck imputation -

i working on college assignment of data mining , knowledge discovery. the question follow: fill in holes using “last observation carried forward hot deck imputation” temp     spots    age    diagnosis 103.0    yes     6    measles 94.7     yes     1   not measles 100.1    yes     -2    measles 102.0    no    20   not measles 96.5     no     ?   not measles 97.2     yes     30   not measles 104.5    no     2400   not measles 101.9    ?     7   measles ?      ...

Total ROWS selected in a LOOP ORACLE PL/SQL -

i want iterate 0 n-1 in oracle loop, this: for x in cleevector loop but wonder if possible use conditional like: if x = totalrows - 1 exit; end if: there recomendation, or solution ? thank helping me out this. so want process last value returned cursor. since cursor doesn't know how many rows return can't "break if second-to-last row". can save value processed, process on next iteration, in declare strlast_id varchar2(1000) := null; cursor cleevector select regexp_substr(p_checkboxes,'[^,]+', 1, level) id dual connect regexp_substr(p_checkboxes, '[^,]+', 1, level) not null; begin x in cleevector loop if strlast_id not null -- code process strlast_id end if; strlast_id := x.id; end loop; end; comment extensively explain what's going on follow after able figure out intent was. share , enjoy.

ios - AutoLayout link two UILabels to have the same font size -

i have 2 uilabels next each other in row left , right adjustments looks below. |-some text left adjusted----------some other text right adjusted-| both labels have adjustsfontsizetofitwidth = yes , linked each other following constraint [nslayoutconstraint constraintwithitem:_rightlabel attribute:nslayoutattributeleft relatedby:nslayoutrelationgreaterthanorequal toitem:_leftlabel attribute:nslayoutattributeright multiplier:1 constant:10] so take space can , if there not enough space original font size lowered adjustsfontsizetofitwidth no text truncated. my problem when 1 needs lower font size due long text want other label lower font size both same size instead of 1 being perhaps twice size of other. constraint font size match alas not know how this, ideas? from uilabel documentation on adjustsfontsizetowidth : normally, label text drawn ...

php - Angularjs CRUD applicatioan PUT method does not work -

Image
i'm doing angularjs crud application using php framework slim backend, application done put method not work , realy can't understand why. here slim code: <?php require 'slim/slim.php'; \slim\slim::registerautoloader(); // create new slim instance $app = new \slim\slim(); $app->get('/users', 'getusers'); $app->post('/adduser', 'adduser'); $app->put('/edit/:id', 'updateuser'); $app->delete('/users/:id', 'deleteuser'); $app->run(); function getusers() { $sql = "select * name order id"; try { $db = getconnection(); $stmt = $db->query($sql); $wines = $stmt->fetchall(pdo::fetch_obj); $db = null; echo json_encode($wines); } catch(pdoexception $e) { echo '{"error":{"text":'. $e->getmessage() .'}}'; } } function adduser() { $request = \slim\slim::getinstance()->request...