Posts

Showing posts from May, 2015

javascript - bootstrap 3.1.1 carousel controls don't work -

i'm building website using bootstrap can't make carousel work @ all, left , right nor indicator change slide. <div id="slideshow" class="carousel slide"> <ol class="carousel-indicators"> <li data-target="#slide0" data-slide-to="0" class="active"></li> <li data-target="#slide1" data-slide-to="1"></li> </ol> <div class="carousel-inner" role="listbox"> <!-- 1st slide --> <div class="item active" id="slide0"> <div id="mainfeature"> <div class="col-lg-6 col-lg-offset-1 col-md-6" > <img class="screenshot"> </div> <div class="col-lg-4 alta"> <h2>heading</h2>

ios - Work with relative URLs when using UIWebView's -loadData:MIMEType:textEncodingName:baseURL: -

how give baseurl: when using uiwebview's loaddata:mimetype:textencodingname:baseurl: ? when baseurl set nil , relative urls (html pages within tree) not working @ all. it path resources: [webview loaddata:data mimetype:type textencodingname:name baseurl:[nsurl urlwithstring:pathtoresources]];

c# - Changing the required field validator error message with javascript -

i have required field validator generic error message; using java script want change error according conditions i using code var rfvinternalnotes = document.getelementbyid("rfvinternalnotes"); rfvinternalnotes.innertext = ""; rfvinternalnotes.innertext = "please enter reason assigning question different person"; no javascript error custom message not displayed, instead displayed error message set required field validator properties. have tried this rfvinternalnotes.errormessage= "please enter reason assigning question different person"; but no joy ; ? thanks i think can better use custom validator , use clientvalidationfunction functions may somehow like: <asp:customvalidator id="customvalidator1" clientvalidationfunction="myclientvalidationfunction" /> <script language="javascript"> function myclientvalidationfunction(sender, args){ s

Asp.net show waiting indicator while refresh page (F5) -

i use example in page , works ok submit cases. http://www.aspsnippets.com/articles/display-loading-image-while-postback-calls-in-aspnet.aspx but when user refresh page (by button refresh of brower or f5) indicator not shown. tried using unload/load event doesn't work. have ideas? thanks in advance! this how can css. http://tjvantoll.com/2013/04/24/showing-a-css-based-loading-animation-while-your-site-loads/ html { -webkit-transition: background-color 1s; transition: background-color 1s; } html, body { /* loading indicator vertically centered ensure */ /* html , body elements take full viewport */ min-height: 100%; } html.loading { /* replace #333 background-color of choice */ /* replace loading.gif loading image of choice */ background: #333 url('loading.gif') no-repeat 50% 50%; /* ensures transition runs in 1 direction */ -webkit-transition: background-color 0; transition: backgrou

websocket - Using Socket.io to emit and receive messages on the client -

so using socket.io send messages , forth. i use socket raise events , catch them within client itself. far, have tried (in chrome console i.e. client): socket.on('news', function(data) { console.log(data); }); but, when ran following (from chrome console): socket.emit('news', {my: 'data'}); i did not console.log message. could please me achieve desired result ? the code below: socket.on('news', function(data) { console.log(data); }); runs in server application should see them in cmd (windows) instead of browser. safe hard code socket.emit('news', {my: 'data'}); in client application/script if can't still see log in terminal. socket.io might not available in window if way. if want raise event , catch them within client, can this: server: socket.on('news', function(data){ var msg = data + 'world'; socket.emit('news-response', msg); }); client: socket.emit

javascript - Simulating mouse events in Firefox extension -

i need simulate trusted mousemove event in javascript. read there: http://help.dottoro.com/ljoljvsn.php in firefox, event trusted if invoked user , not trusted if invoked script. and after started search other solution. found this: are events generated firefox extension 'trusted'? yes, events generated extensions trusted. so, want write firefox extension allow me create mousemove trusted event. unfortunately, i've never written extensions firefox, need clarify points. have: i downloaded example of xpi file i created install.rdf , bootstrap.js bootstraped extension (like firebug) but don't understand: in article: https://developer.mozilla.org/en-us/add-ons/code_snippets/miscellaneous#simulating_mouse_and_key_events i see code: var utils = window.queryinterface(components.interfaces.nsiinterfacerequestor) .getinterface(components.interfaces.nsidomwindowutils); utils.sendmouseevent("mousedown", 10, 10,

sql - Remove redundant rows and update foreign references -

i have sql -table called tblemployees like: sid primaryid secondaryid employeeid employeename timestamp 1 123 40 1 eastwood, clint 20141016124013 2 123 40 1 eastwood, clint 20141016130043 3 123 40 1 westwood, clint 20141016165733 4 123 40 1 westwood, clint 20141016210205 and have table called tblemployeedata column employeeidentificataion references column sid of tblemployees . the table tblemployeedata looks like sid employeeidentificataion data 86 4 [binary data] 89 2 [binary data] 90 1 [binary data] 104 3 [binary data] now need remove redundant rows in tblemployees , update references in tblemployeedata youngest entry in tblemployees . identify youngest can use timestamp. identify duplicates have use columns primaryid

android - How to create session and stay user logged in until logout application? -

hello building 1 application in application works fine want add session in application,when user run application first time user should log in after closing , again when user open app,my app should not ask log in again.. creating "session" in android complex, if want complete functionality. you sound need once - in case should use sharedpreferences how use sharedpreferences in android store, fetch , edit values this easy way handle simple data storage. in launch activity can check see if user "logged" in (in oncreate or onresume ) - if not, launch login activity. if need true "login" need in every activity. also, need update user activity keep them "logged in" - in case search "automatic logout" - depends on particular needs , app. can complex.

ios - Queueing with dispatch -

i creating queue @ first compress images in background , add dictionary in main queue. next images comprised , added print message. not archive code. why? dispatch_sync(dispatch_get_global_queue(dispatch_queue_priority_default, 0), ^{ nsmutablearray *images = [_adv[@"images"] mutablecopy]; (nsmutabledictionary *i in images) { uiimage *large = [uiimage compressimage:i[@"original"]]; dispatch_async(dispatch_get_main_queue(), ^{ i[@"large"] = large; [i removeobjectforkey:@"original"]; }); } dispatch_sync(dispatch_get_main_queue(), ^{ nslog(@"%@", _adv); nslog(@"\n ГОТОВО"); }); }); try reserve main queue user interactive work. you should create own queue interacting mutable data structures. suggest using concurrent queue purpose. writing should done barrier. you should background processing on background queue, , sho

javascript - Making the web page to wait to load to identify the frame id -

the js program wrote in node.js is: var webdriver = require("selenium-webdriver"); function createdriver() { var driver = new webdriver.builder() .usingserver('http://localhost:4444/wd/hub') .withcapabilities(webdriver.capabilities.chrome()) .build(); driver.manage().timeouts().setscripttimeout(900000); return driver; } var driver = createdriver(); driver.get('https:webpage-url'); driver.findelement(webdriver.by.name('username')).sendkeys('abcd'); driver.findelement(webdriver.by.name('password')).sendkeys('pswd'); driver.findelement(webdriver.by.id('button')).click(); driver.findelement(webdriver.by.name('abcd')).sendkeys('abcd'); driver.findelement(webdriver.by.id('button')).click(); driver.findelement(webdriver.by.name('deprt')).sendkeys('dept)'); driver.findelement(webdriver.by.id('abutton')).click(); driver.manage().timeouts().im

mysql - do X in column A if Y found in column B -

i have done research on matter , found works , easy: update `table` set `a`=a+200 b='y'; this works if column b has single y value. but here comes 'hard' part. column b has multiple values this: ,y1,y2,y3,y4, i a+200 executed if y3 found in column b regardless of other values are. not familiar arrays or whatever required search through column b y3 value. appreciated. thank you! you can either use find_in_set or match against regular expression regexp example: update `table` set `a` = `a` + 200 find_in_set('y3', `b`) or update `table` set `a` = `a` + 200 `b` regexp '(^|,)y3(,|$)' aaand glglgl said. normalize database: wikipedia: database normalization

XSLT: Test if string is contained in a sequence -

i have 2 sequences of strings. wanna wether sequence reduced items, in sequence 2; or compare 2 sequences , information, if @ least 1 item of sequence 1 in sequence 2. simple compare ( $seq1 = $seq2 ) works me sequence of numbers, or doing wrong? glad help! :) the = operator should suffice, see example http://xsltransform.net/gwmuij6 does <xsl:variable name="seq1" select="'foo', 'bar', 'foobar'"/> <xsl:variable name="seq2" select="'a', 'foo', 'b'"/> <xsl:variable name="seq3" select="'a', 'b', 'c'"/> <xsl:value-of select="$seq1 = $seq2, $seq1 = $seq3"/> and outputs true false . if want value based intersection see http://www.xsltfunctions.com/xsl/functx_value-intersect.html .

Getting MCF Conversions path data from Google Bigquery -

i using google bigquery extract data on conversion paths google analytics (ga). when analyze these conversion paths exported dataset, last-click conversions match acquisition report in ga, not multi channel funnel (mcf) data. apparently bigquery doesn't export raw data, transforms deleting last direct clicks. described here: https://support.google.com/analytics/answer/1319312?hl=en . is possible bigquery data correspond multi channel funnel (mcf) conversion path data? undo deletion of last non-direct click , proper 'raw' user level data? all of trafficsource fields in bigquery export google analytics use campaign attribution described in this processing flow , overwrite direct traffic recent campaign (if there 1 , within specified timeout), mentioned. if using universal analytics, can adjust campaign timeout shorter 6 month default. example, if set campaign timeout 1 day, direct visits come in @ least 1 day after visit campaign attributed direct instead

asp.net - How to call .asmx web service hosted on Remote server from plain html using ajax -

i've created simple web service using asp.net , hosted on machine's iis server. trying call web service plain html page without using asp.net. problem not getting response. here code below : <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>calling classic web services jquery</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function () { $("a#sayhello").click(function (e) { e.preventdefault(); $.ajax({ type: 'post', data: '{firstname:10,lastname:15}', // url: 'service.asmx/sayhello', url: 'http://192.168.1.20/myservice/service.asmx/sayhello', contenttype: 'application/json; charset=utf-8', datatype: &

How to adjust xaml page for every resolution and screensize? -

i developing windows 8.1 store app.by default windows store apps generate pages having 10.6" screen size , 1366*768 resolution.i want every xaml page fit on screen sizes , resolutions.i solved problem using viewbox 1 page not behaving expected.i doing this: <viewbox> <grid background="{themeresource applicationpagebackgroundthemebrush}"> <grid.columndefinitions> <columndefinition width="auto"/> <columndefinition width="*"/> </grid.columndefinitions> </grid> the grid not taking whole width of page viewbox taking.please help. by default viewbox stretch uniform maintain aspect ratio of contents. can set stretch property fill if want distort fill whole page. you don't include contents of grid in code snippet, it's not clear have in there know how stretch. since it's stretching fill vertically not horizontally expec

html - jQuery carousel new style next and prev on first and last slide -

i'm new jquery , use jquery carousel. don't want use plugin. want ask how can make prev button style/color, when on first slide , how can make next button style/color,, when on last slide. here demo http://jsfiddle.net/rglsg/24/ here jquery code $(function(){ var carousel = $('.carousel ul'); var carouselchild = carousel.find('li'); var clickcount = 0; var canclick = true; itemwidth = carousel.find('li:first').width()+1; //including margin carousel.width(itemwidth*carouselchild.length); refreshchildposition(); $('.btnnext').click(function(e){ if($(".carousel").find("li:eq(6)").text()!=14) { if(canclick) { canclick = false; clickcount++; //animate slider left item width carousel.stop(false, true).animate({ left : '-='+itemwidth },300, function(){ //find first item , ap

ios - NSURLSession sessionWithConfiguration hangs -

very similar issue described here: sessionwithconfiguration freezing ios 8 iphone 4s on new xcode 6.0.1 i have nsurlsession create using backgroundconfigurationwithidentifier: method (in ios8). if create few hundred downloads, app freezes randomly on either [nsurlsession* invalidateandcancel] or on nsurlsession *session = [nsurlsession sessionwithconfiguration:backgroundconfiguration]; if restart device, goes away. replicable if queue few hundred downloads , send ' invalidateandcancel ' message. update if queue handful of downloads on session works. seems nsurlsession can't handle many tasks queued, when provide own nsoperationqueue.

Amazon S3 - static IP or proxy -

is there way amazon s3 have proxy access or static(public) ip address? i have client wanting stream cdn content application behind ip rules on router. is there way on aws yes. can access aws s3 via proxy server. since proxy ip static, can vaild firewall rules.

html - Click a link with href attribute and execute the Javascript function -

my script contains link a element href attribute of "#login" below. <a href="#login">login</a> i want javascript function detect "href" element in link , execute. how can this? javascript function is window.onload = function() { document.getelementsbytagname("a[href=#login]").onclick = function(e) { e.preventdefault(); alert("working"); } } why have seen no queryselector love in these answers? if want use css selector grab link, nothing stopping you: window.onload = function() { document.queryselector("a[href='#login']").onclick = function(e) { e.preventdefault(); alert("working"); } } <a href="#login">login</a> edit: saw in answer believe there may multiple links on page match selector, in case you'll need loop through them: window.onload = function() { var links = document.querysel

c++ - Different overloading function resolution in VS 2008/2010 and VS 2013 -

i have function following definitions, void classa::setlabel(int* newlabels){ try{ std::vector<int> labels(newlabels, newlabels + bonds.size()); setlabel(labels); } catch(const std::exception& e){ propogate_exception(e, "in function classa::setlabel(int*):"); } } void classa::setlabel(const std::vector<int>& newlabels){ try{ std::set<int> labels(&(newlabels[0]), &(newlabels[newlabels.size()])); if(!(bonds.size() == labels.size())){ throw std::runtime_error(exception_msg("does not match.")); } labels = newlabels; } catch(const std::exception& e){ propogate_exception(e, "in function aclass::setlabel(std::vector<int>&):"); } } and section of code implemented classa m; int labels[]={1,2,3,4}; m.setlabel(labels); in virtual c++ 2008 pro , 2010 pro, call setlabel bound second definition, resulting in vector subscript out of range error; while in

asp.net - Do I need to worry about IPV6 addresses when developing web applications? -

i developing website using asp.net. want implement login authentication users. want implement password authentication delay if user enters wrong password frequently. so have field store ipv4 address identify user's ip. using unsigned int field store ipv4 addresses. so question ipv6 addresses? need worry ipv6 addresses? have no data field store ipv6 addresses. do need modify web application identify ipv4 , ipv6 addresses? is ipv6 practically using? yes need able handle ipv6 addresses. more , more isps offering ipv6 connectivity (30% of belgium on ipv6, mobile providers in > 50% ipv6 etc). users able connect on ipv6 certainty website build today. how store addresses different question. databases (like e.g. postgresql) have special field types storing ipv4/v6 addresses. if possible use those. storing them integer isn't practical unless have native support 128 bit integers. storing them text possible. ipv6 addresses should written following rules of rfc 59

sockets - Set SO_EXCLUSIVEADDRUSE using Java -

in java how set so_exclusiveaddruse flag serversocket? am not able find api call in serversocket api. i can set so_timeout using setsotimeout method. how set so_exclusiveaddruse? if there isn't api can't it. this option appears exist on windows: pointless implenenting in cross-platform language. seems compensation broken implementation of so_reuseaddr. don't need on platforms without problem.

theory - Is performance of "less/greater than than" better than "less/greater than or equal to" -

is computationally more performant compare less/greater than on less/greater or equal to ? intuitively 1 think less/greater than marginally better. can compiler use trick make comparisons seem same? a compiler eliminate e.g. less or equal to less than incrementing bound 1 if bound "alive" cannot done. on virtually every modern cpu, there compare/jumpless , compare/jumplessequal instructions take same amount of time, because runs through same hardware modulo including or not "equals" bit. it case computing "not less than" (and therefoe "less than") sort of free; unsigned values, equivalent carry twos's complement subtraction, cpus do. computing equal harder: cpu has determine bits of result of subtraction zero; 64 bits cpus, that's naively 64 bit and-gate pretty big , slow. cpu designers know this, , build fast networks detect quickly, precisely isn't bottleneck. so answer "no", or clear, take sam

scikit learn - GradientBoostingClassifier - How to get the node index of each tree -

can node index of each tree in sklearn gradientboostingclassifier retrieved? i know sklearn randomforestclassifier apply method can used that, how can done gradientboostingclassifier? thanks, r you can use apply method of tree_ object of each decisiontreeregressor .

javascript - Using regular expressions to find and replace within a string with additional style -

i have raw text need output, have search box highlight parts of text match entered in search box. this works, find search box contents: replace="<span class='highlight'>"+find+"</span>"; var results = drawstring.replace(new regexp(find, 'gi'), replace); return results; my problem want match regardless of case i'll replacing exact input of user. want retain case of original value before replace, how can done. you can use matched string inside replace value: replace="<span class='highlight'>$&</span>"; see: https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/string/replace#specifying_a_string_as_a_parameter

linux - udev rule with few parent device attributes -

i need complex , universal udev rule determine usb-device plugged in port of usb hub. so, have combine parent attributes of different layers of device tree... i have this: $udevadm info --query=all --name=/dev/ttyusb0 --attribute-walk looking @ device '/devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.4/1-1.2.4:1.0/ttyusb0/tty/ttyusb0': kernel=="ttyusb0" subsystem=="tty" driver=="" . . . looking @ parent device '/devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.4': kernels=="1-1.2.4" subsystems=="usb" drivers=="usb" ... looking @ parent device '/devices/platform/bcm2708_usb/usb1/1-1/1-1.2': kernels=="1-1.2" subsystems=="usb" drivers=="usb" attrs{devpath}=="1.2" attrs{idvendor}=="0835" ... attrs{idproduct}=="8500" attrs{bdeviceclass}==&qu

Accessing polymorphic relations in rails through javascript -

i have model data collected via ajax . model data has polymorphic relation attached it. some_id: 1, some_type: "foo" so in controller can do model.some.name the problem comes when trying access these attributes javascript . model data rendered json json doesn't contain relationship data. is there way can this? you'll need load related data want, either translating returned record(s) explicitly (as in data transfer object) before serializing js, or else using eager loading. http://blog.arkency.com/2013/12/rails4-preloading/

Oracle-SQL with multiple where-conditions extremely slow -

i've found strange behaviour in (hibernate)sql-query. i've multiple and/or statements in query. if split query in 3 different queries, query faster additional selects have do. but cause of , how resolve that? 2 select-statements think problem somewhere else. here query: select * zdadba.tpartner partner partner.partnrext in ( select distinct stapel.fpartnrext zdadba.tstapel stapel stapel.lagernd = 1 , stapel.auftrag_id null , ( ( cast(stapel.version date) <= to_date('30.06.' || to_char(extract(year sysdate)), 'dd.mm.yyyy') ) , ( to_date(sysdate) >= to_date('30.06.' || to_char(extract(year sysdate)), 'dd.mm.yyyy') ) , ( partner.versandart =

Ruby: Using require produces "in `require': cannot load such file " -

the error: in `require': cannot load such file -- c:/railsinstaller/tickets/test/unit./test_helper (loaderror) the code is: require file.dirname(__file__) + '/../test_helper' class tickettest < activesupport::testcase # ... # ... # ... end you have unwanted dot in unit. , replace require with: require file.expand_path("../../test_helper", __file__) # or maybe require file.expand_path("../test_helper", __file__)

Android XML layout: Error parsing XML: not well-formed (invalid token) - I did close my View tags -

i getting error on button view. many questions saw on so, seems error arises when don't close views properly. i think have closed tags still getting error. why that? <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="${relativepackage}.${activityclass}" > <button android:layout_width="wrap_content" android:layout:height="wrap_content" android:text="@string/mainactivity_button1" android:onclick="startsecondactivity" /> </relativelayout> there's additional/typo : in attribute name. replace android:layout:height with android:layout_height the error not unclosed tags xml syntax problems in general. in xml, can have 1 namespace prefix att

ios - UIBarButtonItem clickable on left but not on right of navigation controller -

this strange behavior , i'm experiencing in ios8 ipads. have uibarbuttonitem needs go on right side of navigation bar. here code set button: uibarbuttonitem *btnattopen = [[uibarbuttonitem alloc] init]; [btnattopen setaction:@selector(addattclick:)]; [btnattopen setimage:[uiimage imagenamed:@"addatt"]]; [btnattopen settarget:self]; [self.navigationitem setrightbarbuttonitem:btnattopen]; when this, btnattopen button appears should not clickable. behaves if static image. strangest part of if replace setrightbarbuttonitem: setleftbarbuttonitem: button behaves intended. this doesn't make sense me. has seen kind of behavior? ideas why may occurring? thanks! if doesn't want react appropriately touches, problem 1 of parent view's frames has incorrect size, doesn't cover child's frame. you check them, example, printing out view hierarchy in gdb: po [[uiwindow keywindow] recursivedescription]

html - Customize select into a simple icon -

i have simple select: <select class="select ui-icon ui-icon-chevron-down" style="width: 10px;height: 19px;" type="position_last"> <option value="" style="display: none"></option> <option value="5">5</option> <option value="10">10</option> <option value="20">20</option> <option value="50">50</option> <option value="100">100</option> </select> i want don't want show normal select, want show simple icon. i'm not css don't know if done or not. how using additional library http://silviomoreto.github.io/bootstrap-select/ you need include library , add code javascript $(".select").selectpicker();

android - how to get tag of dynamically created linear layout and it's child ImageView -

parent_linearlayout linearlayout textview linearlayout i have parent linear layout in xml. created linear layout dynamically , child textview , linear layout. added layout parent linear layout. now question how tag of linear layout(4th) , tag of child (which add later dynamically). for(int i=0;i<parent_layout.getchildcount();i++){ view v=parent_layout.getchildat(i); toast.maketext(getapplicationcontext(),""+parent_layout.getchildcount() , toast.length_long).show(); } am trying this, not getting idea how achieve you can use settag() on layouts...and later retrieve layout using gettag() .hope helps.

Yield of a (sub)parse tree in Rascal -

how can obtain yield of (sub)parse tree in rascal, i.e., text associated subtree? ex., during visit encounter declaration (with java/m3) , want text of declaration. have tried "unparse", gives "does not match of declared (overloaded) signature patterns :unparse(tree)", guess works top sort/starting symbol. one of simplest solutions using string template , inserting subtree in -- assuming subtree d : "<d>" this automatically unparse d . more sophisticated pretty printing missing on our todo list.

Writing Codeception CLI test; want to throw exception but not have it fail the test -

i forked codeception/codeception , added command module check throws exception. when testing, exception causes test fail i'm running test force exception , failure, make sure catches it. here's edit src/codeception/command/generatesuite.php if ($this->containsinvalidcharacters ($suite)) { throw new \exception("suite name '{$suite}' contains invalid characters. ([a-za-z0-9_])."); } when updating tests/cli/generatesuitecept.php when run command $i->executecommand('generate:suite invalid-suite'); fails because i'm throwing exception in src/codeception/command/generatesuite.php in first place. here addition tests/cli/generatesuitecept.php: $i->executecommand('generate:suite invalid-dash-suite'); when run it, says failed. however, want pass because i'm deliberately adding dash verify catches invalid characters. best way that? i'm wary of try/catch block in these tests. i'm not sure if best wa

Creating a file to write in python -

pardon me silly newbie question, create/open file writing compiler error. tmp1 = os.path.join(self.vardirname.get(), strftime("%y_%m_%d")+'_errs') tmp2 = os.path.join(tmp1,mysubfolder) if not os.path.exists(tmp2): os.makedirs(tmp2) fn = os.path.join(tmp2,'hello.txt') f = file(fn, "w") #i tried this: fna = os.path.join(tmp2,'hello.txt') fn = "hello.txt" f = open(fn, "w") error in last line: nameerror: name 'fn' not defined, if hardcode filename, creates it. how create variable name?

JQuery specific variable from a php printed table -

Image
ive got table buttons: , ive set specific id's each 1 dont see how can access them jquery script can set specific each 1 of them. edit: of buttons have unique ids: shown in google chrome inspect element : when click remove want row removed. can , have done php via dont want have refresh page every time remove one. tested doing jquery .get , works fine dont want have make new script have delete every single row, rather dynamically getting id of row , removing row remove button in. ive tried multiple ways of doing fail. this script prints data in table function print_data($info1,$info2,$info3,$info4,$info5,$info6,$info7,$info8){ echo"<tr><td id='notice1id$info8'>$info1</td><td id='noticename$info8'>$info2</td><td id='noticetype$info8'>$info3</td><td id='noticecontent$info8'>$info4</td><td id='noticeshow$info8'>$info5</td><td id='noticeedit$inf

ember.js - Downloading files with Ember app -

i have ember app (built ember-cli). on backend have rails application handles requests. lets api has following routes: /model — returns list of models /model/1 — returns model /model/1/download — returns file how can force ember app start file download (using /download path) , how can construct link file download within ember app? if you're going hit endpoint , return file contents, believe you'll need set content disposition header. more details here: force download through js or query content-disposition=attachment; filename=some.file.name if linking file directly, use html5 download attribute; <a href="{{model.download}}" download>download file</a>

html - Image not displaying, but shows in Firebug -

i have rather unique problem. i'm trying logo display, doesn't show - show in firebug should (i.e. hover on image , displays preview). i have tried absolute filepaths, relative filepaths , else under sun. logo appears 2-3 seconds upon refresh vanish screen - i've never experienced problem , find mind-blowing. am missing obvious here? link: http://project.n8geeks.com/ i think should set height attr div .logo div img should set width , height. try set height 30px div .logo. works.

parse.com - Parse : Multiple queries with an array returning only when finished -

trying cloudcode out first time , loving it. i writing ios app passes phone numbers cloudcode see if phone number has app. the problem firing success block before queries finish. guessing need know how many queries there , work out if on last one? seen .then function? parse.cloud.define("processnumbers", function(request, response) { parse.cloud.usemasterkey(); var phonenumbers = request.params.phonenumbers; phonenumbers.foreach(function(entry) { var query = new parse.query(parse.user); //query.equalto("username", entry); query.find({ success: function(results) { console.log("has app"); }, error: function() { console.log("not found"); } }); console.log(entry); }); response.success(phonenumbers); }); you use promise perform task in series or parallel. ref. promises in parallel

XPATH 1.0 construct a new xml document out of original one depending on condition -

i have xml document one: <datacontainerlist> <container> <localdatacontainer> <file>inputfile3</file> </localdatacontainer> </container> <container> <localdatacontainer> <file>inputfile2</file> </localdatacontainer> </container> <container> <localdatacontainer> <file>inputfile3</file> </localdatacontainer> </container> </datacontainerlist> and want filter out container file name = inputfile3 means : want create new datacontainerelist first , third container. is possible 1 xpath1.0 command? cannot use xsl or something, plain xpath , should work arbitrary datacontainerlist . from description, sounds rather filter out containers named "inputfile3", want select such containers. you can use simple variation of identity transf

c# - Check for 'null' on value and reference types -

i'm little confused checking 'null' (empty, not available, without value) on value , or reference types. there seem lot of possible ways , of them used. let's i've got following extension method can used somehow similar maybe monad: public static tresult usewith<t, tresult>(this t value, func<t, tresult> action) { // if value not null // execute action // else return default value of 'tresult' } so? how check null? if(value != null) or (which checks null on reference types, default on value types) if(!equals(value, default(t)) or if(!equalitycomparer<t>.default.equals(value, default(t)) or (with precheck) if (!typeof(t).isvaluetype) { if (equals(source, default(t))) return tresult; } or better create 2 methods restrictions? public static tresult usewith<t, tresult>(this t value, func<t, tresult> action) t : class { if(value == null) public static tresul

C - stdin to variables -

i want create program can read lines standard input , interpret each line 2 integer numbers separated space. later use shared library work numbers . before start know, best way parse numbers lines. combination of "getline" , storing numbers variables? store numbers until next numbers given. if want extract integers string,use sscanf(arr,"%d %d",&num1,&num2); where arr array of char containing data want extract 2 integers , num1 , num2 2 int variables. or else can directly scan 2 int s using scanf("%d %d",&num1,&num2); it better check if scanf (or sscanf ) successful. both of these return 2(in case) if successful. check using like: if(scanf("%d %d",&num1,&num2)==2) //successful else //failed or if use sscanf , if(sscanf(arr,"%d %d",&num1,&num2)==2) //successful else //failed

java - SOAP Webserice using Intellij-generated code, client certificate, and session cookies. Works stand-alone. Won't work in glassfish 3.1.2.2 -

i'm trying call 3rd party soap web service not control. service on https , requires both client-side certificate, user name , password, , session cookie passed during 1 of many redirects done on service side. after pain, got working in stand-alone java application (using java 1.6) using below code: (note: tableout, tablein, dmservice , datamanagementserviceporttype classes generated intellij wsdl) public tableout callwebservice(tablein tin)throws exception{ system.setproperty("javax.net.ssl.keystore", getkeystorelocationfile().getabsolutepath()); system.setproperty("javax.net.ssl.keystorepassword", getkeystorepassword()); system.setproperty("javax.net.ssl.truststore", gettruststorelocationfile().getabsolutepath()); system.setproperty("javax.net.ssl.truststorepassword", gettruststorepassword()); authenticator.setdefault(new authenticator() { public passwordauthentication getpasswordauthentication() {

sql server - SQL Join two tables with different number of rows get all rows from one table -

i'm trying join 2 tables different number of rows. client number identifying field in both tables. the first table includes client number clients. either referenced). complicate things further, clientnumber2 field text field need number other client number fields. there region field in second table need limit region numbers. second table includes client number clients meet specifications. of clients in second table have second client number. i want create new column shows client number first table clients not exist in second table, shows second client number in second table if exists, otherwise, client number first table (which same client number in first column of second table i've included syntax i'm using below. runs without errors. originalcn field returns desired value value in clientnumber2 of table 2 returning null values others. cannot figure out how work correctly. i've included sample tables , desired table. appreciated! client table 1 client numb

Bindy - Apache Camel. Can a position (column) be ignored while unmarshaling CSV? -

i using camel-bindy unmarshall csv java object. possible ignore particular column? consider following example, don't want map column 3 (address). please let me know if there way so. in reality have more 10 columns in csv want ignore. example :- csv file: header : name,mobile,address data row : rabbit,007,rabbit hole bindy mapping in java class: @csvrecord(separator = "," , skipfirstline = true) public class contacts { @datafield(pos = 1, trim=true) private string name; @datafield(pos = 2, required = true, trim=true) private long mobile; thanks time! you cannot skip column. bindy iterates through every token , checks if there associated data field, see bindycsvfactory : // datafield model datafield datafield = datafields.get(pos); objecthelper.notnull(datafield, "no position " + pos + " defined field: " + data + ", line: " + line); the solution define class attribute ignored: @datafield(pos = 1) public str

Bad scroll performance — Famo.us/Angular scrollview -

i'm experiencing bad scroll performance on mobile devices famo.us scrollview . i'm using famo.us/angular . here's code used: <fa-app> <fa-scroll-view fa-pipe-from="eventhandler"> <fa-view ng-repeat="item in items" class="item"> <fa-surface fa-pipe-to="eventhandler" fa-background-color="'#fa5c4f'" fa-size="[undefined, true]"> <img ng-src="{{ item.src }}" /> </fa-surface> </fa-view> </fa-scroll-view> </fa-app> scrollview options set default. of famo.us demo videos show utterly smooth scroll. however, i'm unable translate practice. since, have not modified scrollview options , working off barebone template, wonder what's causing this. even javascript code slow no content! check out demo . performance extremely bad , think need think twice before using it.

java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver doesn't work anymore in java. How to fix this? -

it worked 2 days ago. doesn't. i'm 100% sure coding correct. way used connect database. couldn't find answer yet problem. please give me answer i'm beginner java language. (using jdk 7u72) public void set() { try { class.forname("sun.jdbc.odbc.jdbcodbcdriver"); string su=new string("jdbc:odbc:moviesurf"); //this database con=drivermanager.getconnection(su,"",""); st=con.createstatement(); } catch(exception e2){system.out.println(e2);} } this stack trace java.lang.classnotfoundexception: sun.jdbc.odbc.jdbcodbcdriver @ java.net.urlclassloader$1.run(unknown source) @ java.net.urlclassloader$1.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(unknown source) @ java.lang.classloader.loadclass(unknown source) @ sun.misc.launcher$appclassloader.loadclass(unkno

jquery - Javascript detect what Chrome version -

what built-in javascript/jquery methods there detect chrome browser i'm using? method know of type about:version in url javascript not able simulate command. i recommend navigator.appversion . related documentation can found here .

settings - PHPStorm does not show classname anymore -

Image
i've imported wrong settings phpstorm , i've lost possibility see anybody knows setting responsible displaying line ? settings (preferences on mac) | editor | general | appearance | show html breadcrumbs you need re-open editor tab see changes.

mgwt - How to make GWT applications mobile compatible -

i have website developed in gwt/mgwt i used mgwt widgets, when run application on mobile small. don't think it's matter of increasing width/height, etc. you can open on mobile , have look: http://119.154.187.175:8080/dashboard2/dashboard2.html the viewport doesn't seem configured correctly. try set mgwt.applysettings(mgwtsettings.getappsetting()); in entrypoint right @ beginning. here getting started: https://github.com/mgwt/mgwt/wiki/getting-started-with-mgwt

java - Why it is not possible to place type parameters after method name? -

if fact, question is: what problems may occure if possible place type parameters after method name? e.g.: import com.google.common.base.predicate; static import com.google.common.base.predicates.alwaystrue; predicate<sometype> p = alwaystrue<sometype>(); update: i know pass type parameter way: predicate<sometype> p = predicates.<sometype>alwaystrue(); i see 2 distinct questions here: why class or object needed parametrize method? public class test { private static <t> void staticmethod() {} private <t> void method() {} public test() { method(); // works! <integer>method(); // doesn't work! this.<integer>method(); // works again! } public static void main(string[] args) { staticmethod(); // works! <integer>staticmethod(); // doesn't work test.<integer>staticmethod(); // works a

How to plot 5 subplots sharing x and y axes in Python -

as in title, have 5 plots in python want produce. how plot 5 of these share same axes? thanks you can use subplot sharex , sharey options. example: import numpy np import pylab pl x = np.linspace(-1, 1, 100) y = np.zeros((5, 100)) in range(5): y[i] = x**i ax = [] kw = {} in range(5): if > 0: kw ={'sharex': ax[0], 'sharey': ax[0]} ax.append(pl.subplot(3, 2, i+1, **kw)) ax[i].plot(x, y[i])

android - Clicking toolbar navigation icon crashes the app -

trying new toolbar widget in android 5.0. set toolbar's navigation icon , tried use it. when tap on button on toolbar following error: fatal exception: main java.lang.illegalargumentexception: invalid payload item type @ android.util.eventlog.writeevent(native method) @ android.app.activity.onmenuitemselected(activity.java:2628) @ android.support.v4.app.fragmentactivity.onmenuitemselected(fragmentactivity.java:350) @ android.support.v7.app.actionbaractivity.onmenuitemselected(actionbaractivity.java:155) @ android.support.v7.app.actionbaractivitydelegate$1.onmenuitemselected(actionbaractivitydelegate.java:74) @ android.support.v7.widget.windowcallbackwrapper.onmenuitemselected(windowcallbackwrapper.java:44) @ android.support.v7.internal.widget.toolbarwidgetwrapper$1.onclick(toolbarwidgetwrapper.java:190) @ android.view.view.performclick(view.java:4211) @ android.view.view$performclick.run(view.java:17267) @ android.os.handler.handlecallback(handler.java:615) @ android.o

combine two fields & bold one in Crystal Report -

want combine 2 database field having datatype string.from 2 fields first 1 make bold. e.g.- employeename (with font bold)+address(with regular font). using vs 2008 in build crystal report. try below: take formula , write below code: "<b>"+employeename+"</b>" + address then go format field of formula , paragraph tab there change text representation html text

java - DataSource initialization error within liberty profile server -

i trying set datasource in liberty profile server, i'm getting nullpointerexception (on ds variable below) when code tries use it. the relevant code, , server.xml entries below. interestingly, if change jndiname java:comp/env/jdbc/oracle illegalargumentexception on server startup, config below doesn't seem try activate datasource... public abstract class daobase { //@resource(name = "jdbc/oracle", type = javax.sql.datasource.class, shareable = true, authenticationtype = authenticationtype.container) @resource(lookup = "jdbc/oracle") private datasource ds; protected connection getconnection() throws sqlexception { connection conn = ds.getconnection(); return conn; } my server.xml config: <featuremanager> <feature>jsp-2.2</feature> <feature>jaxrs-1.1</feature> <feature>localconnector-1.0</feature> <feature>appsecurity-2.0</feature> <feature>jp

iframe - How can I disable HTTPS/SSL on a specific page in Meteor? -

on 1 of pages in on website, need have iframe displays content http sites. haven't found way display information on https page. after looking around, think best solution might remove https of pages. possible in meteor using iron router or other tool? or there way make iframe content display? meteor not support https itself. way place component in front of meteor (like haproxy or nginx) perform ssl offloading , send plain http requests meteor. ssl connection between browser , proxy in front, let's assume nginx. nginx forward requests meteor http. as such, meteor not aware https traffic happening. therefore not need adjust inside meteor or iron router. unfortunately there no way trick browsers accepting http iframes inside https sites, if tinker nginx settings. you options either include external content on server , proxy (you configure nginx proxy request external site , talk http data provider , serve https browser, meteor server) or somehow bring conten

How to import data using Sqoop from RDBMS into local file system, not HDFS? -

i have seen sqoop allows 1 import data rdbms database hdfs. want import data local file system folders in linux , not hdfs file system. is there way this? in sqoop1, can use "-fs" option detailed in documentation . here's quick example: sqoop import -fs local -jt local --connect jdbc:mysql://<host>/sqoop --username sqoop --password sqoop --table tbl in sqoop2, able choose file system when creating link: hdfs uri: file:///

C# WPF RichtextBox type behavior change -

i have converted textbox (which using search box) richtextbox in order bold contained words within box. upon doing have noticed few "errors". know if intentional, , how over-ride them. the first, , important problem occurs call selectall() on box pull information on keydown event: ((richtextbox)sender).selectall(); string search = ((richtextbox)sender).selection.text; this prevents me writing more character in rtb. presume leaving text selected , overwriting every key press. cannot find deselect() method, there means of attaining string data prevent issue. need string pass regular expression. secondly, rtb throws ibeam box on double click. there way recreate behavior of textbox enters on single click (or should entering on single click default?) instead of selecting all, content , convert flow document plain text. flowdocument doc =((richtextbox)sender).document; string search = new textrange(doc.contentstart, doc.contentend).text; convert flowdocum

php - Count products and reviews of a brand using eloquent relationhips -

i have 3 models: class brand extends \eloquent { protected $fillable = []; public function product() { return $this->hasmany('product'); } } class product extends \eloquent { protected $fillable = []; public function reviews() { return $this->hasmany('review'); } public function brand() { return $this->belongsto('brand'); } } class review extends \eloquent { protected $fillable = []; public function product() { return $this->belongsto('product'); } } i'm trying display brand names along product , review counts in view: {{ $brand->product->count() }} it works this, doesn't display reviews count: {{ $brand->product->reviews->count() }} neither for: {{ $brand->product->reviews->count() }} errors i'm getting are: errorexception (e_unknown) undefined property: illuminate\database\eloquent\collection::$review errorexception (e_unknown) undefined property:

ios - My App crash on iPad before even application:didFinishLaunchingWithOptions: -

my app crashing following crashlog when ran on ipad. work fine on iphone devices. might notice, crash while trying setup window. have searched everywhere don't see such issue in other topic. thanks help. *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '*** setobjectforkey: object cannot nil (key: nsparagraphstyle)' *** first throw call stack: ( 0 corefoundation 0x000000010e38ff35 __exceptionpreprocess + 165 1 libobjc.a.dylib 0x000000010e028bb7 objc_exception_throw + 45 2 corefoundation 0x000000010e296998 -[__nsdictionarym setobject:forkey:] + 968 3 uikit 0x000000010ca99d2d -[uilabel _setlinebreakmode:] + 529 4 uikit 0x000000010cb7a572 -[uibuttonlabel setlinebreakmode:] + 93 5 uikit 0x000000010cb86e5c -[uibutton _setuptitleviewrequestinglayou