Posts

Showing posts from February, 2015

git - Android studio pushing commit failing -

earlier attempting remove commit commit history, , went through stackoverflow threads doing stuff rebasing etc. here attempting push new commit, error feel because of did earlier. error rebasing fatal: update_ref failed ref 'refs/heads/master': cannot lock ref 'refs/heads/master': ref refs/heads/master @ 9529c90e148e9b2620db0f366587312e75d507b6 expected 808b9dfbc4141d16a29fadb4bd8171c6fe8f4914 yes, need rebase first , submit checklist, local , remote @ different level. just save changed files, in tmp directory, rebase(menu->vcs->git->rebase). once origin , remote @ same level, may manually copy these files temp, shown in version control section of android studio. can rightclick changelist , commit , push. regards ashish

ios - Multiple Long-Running Background Tasks -

i working on app have implemented @ least 2 background tasks. scenario becomes this, have web service tells me when start location updates user. so, need periodically call service check if it's time start, and/or stop, user's location tracking. there 2 background tasks, fetch , location tracking. fetch should run periodically defies apple's procedure monitor app's usage , decide on it's own when update content. has become first problem, there way can avoid this? second problem comes multiple tasks, how can switch between either of them? best practice here? dos , don'ts? you should use push notifications through apple's push servers, or may find service parse.com easier work with. can use push notification trigger or create in app delegate (where handle receiving push notifications). @paulw11 's comment states, can attach payload(data) push notification , deal it. first part fire notification user's device when should start tracking , end...

windows - Insert character into String in Batch File -

in batch file have line of code. for /f "eol=; tokens=1,2,3* delims=;/" %%i in ('findstr /v "#" clientsync.cfg') echo %%l my current output y/ic/draft is possible output y:/ic/draft i need insert : @ second position. tanks help! almost done for /f "eol=; tokens=1-4,* delims=;/" %%i in (' findstr /v "#" clientsync.cfg ') echo %%l:/%%m just add new token separate element need , insert colon , slash consumed new token

ios - How to create separate orientation for specific view controller using objective C? -

i trying programmatically create ui orientation (portrait , landscape) using objective c devices. here problem have multiple view controllers . want use multiple orientation particular view controller. for ex: splash screen (app delegate - portrait) login screen (portrait) home screen (both) if controlled below method app delegate root class cant enable both orientation home view controller . showing black screen. - (nsuinteger) application:(uiapplication *)application supportedinterfaceorientationsforwindow:(uiwindow *)window { return uiinterfaceorientationmaskportrait; } you can try following implementation. here doing is, sends interfaceorientation need visible view controller app delegate. fist finds visible viewcontroler , gets supported interface orientation, if supportedinterfaceorientations method not implemented in visible view controller, return default orientation. - (uiinterfaceorientationmask)application:(uiapplication *)application supporte...

c# - Using Microsoft.Practices.EnterpriseLibrary.Logging 6 parameters overloaded Write Method, writing extra \r\n -

logger.write(_indent + message, category.tostring(), 1, 100, eventtype, title); the above write method write text in log file text file 9/21/2015 10:01:49 | information | adding key in dictionary, user: abc \r\n here can see \r\n has not been provided me in parameter. i not want these \r\n characters

java - Filtered out sucess_entries String -

can suggest me string "success entries , failed entries: {failed_entries={}, success_entries={123=1509180522720153332, 124=1509181140480153332}}". here want filter-out 2 strings 1509180522720153332 , 1509181140480153332 .can suggest me ? you can regex string str = "success entries , failed entries: {failed_entries={}, success_entries={123=1509180522720153332, 124=1509181140480153332}}"; matcher matcher = pattern.compile("(?<=(success_entries=\\{)).+?(?=\\})").matcher(str); matcher.find(); str = matcher.group(); system.out.println(str); matcher = pattern.compile("(?<=\\d{3}=)\\d+").matcher(str); while(matcher.find()){ system.out.println(matcher.group()); } but remember regex lookbehind/lookahead not in performance

javascript - If else statement not giving expected result -

data1 variable contanins "notexist" string executing else statement. if(data1=="notexist") { document.getelementbyid("errcorrectwfrm").style.display="inline"; return false; } else{ alert("thanks choosing albc,now can go ahead"); $.modal.close(); } it seems data1 value not same expecting code executing else statement. kindly console.log(data1) or alert(data1) come know exact value in it. i assuming there might white space somewhere in data1 value causing problem. kindly check length of string , come know. hope helps

c# - How do i Show ViewBag in html -

im trying shown details of products (shoes=zapatillas) on visual studio 2013 c# mvc ok let's go codes... part of index web page on homecontroller http://pastebin.com/vrmb85qf this producto.cs http://pastebin.com/a2h1ifzt and index.cshtml want put details, question is, how call sql details in html price, model, info @ @zap fail code, it's that? on on top page @using la_esquina_del_calzado1.models; in body... @foreach (producto zap in viewbag.lstproductos) { @zap.getid() @zap.getmodelo() @zap.getcolor() } <div class="col-sm-4 col-lg-4 col-md-4"> <div class="thumbnail"> <img src="http://placehold.it/320x150" alt=""> <div class="caption"> <h4 class="pull-right">price</h4> <h4> ...

css3 - CSS Tables: Fixing the column-width -

note: displaying page on sharepoint 2010 site. i trying use css table display , following html code it: <div id="cr"> <ul class="contact-img"> <li><img src="landing page/contacts/casswade.png"></li> <li>cass wade<br/>project manager</li> <li><img src="landing page/contacts/meredith.png"></li> <li>meredith<br/>hr head</li> <li><img src="landing page/contacts/simon.png"></li> <li>simon<br/>ceo</li> <li><img src="landing page/contacts/roger.png"></li> <li>roger<br/>director</li> <li><img src="landing page/contacts/sharyl.png"></li> <li>sharyl<br/>employee</li> </ul> <hr/> </div> here css above page: .contact-img...

reactjs - In ReactFire, how to bind a ref that depends on a property? -

i have react component used <username uid={uid}> , in i'd use value of firebase reference depends on uid. since props can change, looks need bind reference in both componentwillmount , componentwillreceiveprops like: componentwillmount() { this.bindasobject(userroot.child(this.props.uid).child('name'), 'username'); }, componentwillreceiveprops(nextprops) { this.unbind('username'); this.bindasobject(userroot.child(this.props.uid).child('name'), 'username'); }, render() { return <span>{this.state.username['.value']}</span>; }, the react documentation warns against having state depend on props , presumably avoid need update state 2 places. is there better way this? this looks fine. anticipating uid change , reacting it. some improvements consider: adding uid equality check rebind if uid changes if need access other user properties, create single containing component binds entire...

javascript - How to get alert message on second click of a button -

i know how can alert message on second click of button, not on first click. ex: <input type="button" value="message" onclick="showmessage()"> function showmessage(){ alert("it's second click message"); // alert message should shown on second click of button } use counter instead.. var count = 0; //global variable function showmessage() { if (count++ == 1) { //compare , increment counter alert("it's second click message"); //this alert message shown on second click of button } } <input type="button" value="message" onclick="showmessage()">

mysql - SEPARATOR keyword not working properly in Hibernate Formula -

i have following hibernate forumla query, able execute in mysql workbanch. select group_concat(distinct t.column_1_name separator ', ') table_name t , t.fk_record_id = record_id while executing query hibernate, hibernate appending parent table seprator key word shown in below query. select group_concat(distinct t.column_1_name parent_table.separator ', ') table_name t , t.fk_record_id = record_id here hibernate not treating seprator keyword. has idea this? you can add separator keyword. implement own dialectresolver , add keyword in lower case resulting dialect: public class mydialectresolver extends standarddialectresolver { protected dialect resolvedialectinternal(databasemetadata metadata) throws sqlexception { dialect dialect = super.resolvedialectinternal(metadata); dialect.getkeywords().add("separator"); return dialect; } } you have tell hibernate use dialect resolver. example in jpa can in persistence.xml: ...

qt - qt5 qml c++ interaction -

http://doc.qt.io/qt-5/qtqml-cppintegration-interactqmlfromcpp.html#connecting-to-qml-signals i've read of article, , seem understand except part in c++. qobject::connect(item, signal(qmlsignal(qstring)), &myclass, slot(cppslot(qstring))); it clear item , signal , myclass , slot , cppslot , qstring come from, qmlsignal come from? of course comes .qml file, how compiler find out if it's loaded via runtime? it clear item, signal, myclass, slot, cppslot , qstring come from, qmlsignal come from? of course comes .qml file, how compiler find out if it's loaded via runtime? qmlsignal emitted qml code , caught on c++ side noted. , compiler knows nothing of happening @ run time except c++ types code deals with. the root qml item reflected qobject has nested list of signals , slots pure c++ qobject. every signal , slot has test string signature , slots have mapping class member. qquickview view(qurl::fromlocalfile("myit...

php - load mysql to json for NVD3 -

<?php $username = "root"; $password = "pw"; $host = "localhost"; $database="dbname"; $server = mysql_connect($host, $username, $password); $connection = mysql_select_db($database, $server); $myquery = " select `name`, `usetime`, `e_usage` `electric_usage` "; $query = mysql_query($myquery); if ( ! $query ) { echo mysql_error(); die; } $data = array(); ($x = 0; $x < mysql_num_rows($query); $x++) { $data[] = mysql_fetch_assoc($query); } echo json_encode($data); mysql_close($server); ?> i use upper php source load mysql json the result of php page is [{"name":"led stand","usetime":"2015-09-10 14:17:33","e_usage":"0.0599970581514709"}, {"name":"led stand","usetime":"2015-09-10 14:20:33","e_usage":"1...

How to run sbt Revolver in test scope? -

in akka project we're using sbt revolver plugin run application. during development useful if possible run application in test scope log- , application configuration loaded helps during development. however, running 'sbt test:re-start' not seems use test classpath , therefore not run correct application , not use correct configuration files. looking @ revolver page looks plugin creates it's own scope. know how able use test scope running revolver plugin? try configure fullclasspath setting of revolver , add test classpath it: fullclasspath in test in restart <<= classpaths.concatdistinct(fullclasspath in test, fullclasspath in runtime)

c++ - int variable is not able to store large values -

#include <iostream> int main() { int = 999999999999999999; std::cout << << std::endl; std::cout << 999999999999999999 << std::endl; return 0; } the output of above program -1486618625 , 999999999999999999 . in both cout giving same number, why outputs different? also long long int a=999999999999999 same int a=9999999999999999ll ? when assign integer literal 999999999999999999 int a , may truncated if int type not capable of representing number. maximum value can stored in int std::numeric_limits<int>::max() , depends on platform compiling (but must @ least 32767). compiler should warn such truncating assignment: $ g++ -std=c++11 -wall -wextra 32689548.cpp -o 32689548 32689548.cpp: in function ‘int main()’: 32689548.cpp:5:13: warning: overflow in implicit constant conversion [-woverflow] int = 999999999999999999; ^ to answer question, "[is] long long int a=999999999999999 s...

jquery - How to call two functions, one after another, using the same button? -

here's trying to: $(document).ready(function() { $("button").click(function() { $("#div1").remove(); }); // missing function end }); $("#div1").("<b>appended text</b>"); }); html <div id="div1" style="border:1px solid black;background-color:gray;"> <p>this paragraph in div.</p> <p>this paragraph in div.</p> </div> <button id="btn1">remove div element</button> how can jquery? javascript functions called in order put them in code within event handler can call .empty() before calling .append() add new text , can chain 2 commands 1 after other don't have reevaluate selector: <script> $(document).ready(function() { $("button").click(function() { $("#div1").empty().append("<b>appended text</b>"); }); }); </script> or, assign h...

r - Add vertical lines to a graph -

Image
i'm wanting add vertical dotted/dashed on top of time series graph @ intervals. would put command in abline arguments or there way? use grid : nx, ny - number of cells of grid in x , y direction. when null, per default, grid aligns tick marks on corresponding default axis (i.e., tickmarks computed axticks). when na, no grid lines drawn in corresponding direction. example: plot(1:5) grid(nx = null, ny = na)

android view pager swipe animation -

i trying animation in page swipe in view pager overriding transformpage() method, such when swipe right left new page (page coming right side) should appear below previous page animation starts , previous page should slide left side on new page. when swipe left right new page should directly slide on previous page , covers completely. not able achieve it. have tried following:- if(position > 0 && position < 1) { int pagewidth = page.getwidth(); float translatevalue = (-position * pagewidth); if(translatevalue < pagewidth) { translationx = translatevalue; } else { translationx = 0; } } else { alpha = 1; scale = 1; translationx = 0; } please provide suggestions. this should work want, have put in pagertransformer class: private static final float min_scale_depth = 0.75f; @override public void transformpage(view page, float position) { final float alpha; final float scale; final...

python - Openshift bind TCP port -

i'm trying deploy python tcp listener on openshift i'm failing understand how manage external ports. googling , searching on openshift's own kb, this article mentioned lots of times no longer available. tcp server app listens on port 8080 (as per $openshift_python_port) , i'm trying connect internet on port 8000. nevertheless, doing means client app can establish connection if server app not started. does have specific information on how this? you can not make raw tcp connections openshift gears, can make http (80/443) , ws (8000/8443) connections. both types of connections go through proxy on node, http goes through apache proxy, , ws goes through node proxy. if want make raw tcp connections have use port forwarding location machine, , make sure publishing port information through custom cartridge.

Excel table to specific page and paragraph in word VBA -

i have following code copy data excel , paste word, choose page put in. facing difficulties placing want inside page set wdoc = wapp.documents.open(file, readonly:=false) wstabletocopy.usedrange.copy wapp.selection.goto 1, 2, name:="2" 'what wdgotopage / wdgotonext , name:="pagenumber" wapp.selection.paste wdoc.save wapp.quit how can select example place in second paragraph on page?

python - Python3 - read from unflushed buffer from other exe -

i have application written in c++ write ofstream (file output stream). problem is, c++-application writing 2'000 lines before flushing stream ( << endl ) , output became visible inside file (which monitor via tail -f ). debugging purpose want see unflushed content of stream. adding << endl inside c++-application sounds logic, isn't possible @ because there many places have add << endl , going ugly because have add #ifdef _debug filestream << endl; #endif everywhere in code. so i'm looking way read stream application. have read many stackoverflow articles, including [reading flushed vs unflushed buffers](reading flushed vs unflushed buffers) , many others. can find answers second application called subprocess inside python-script via import subprocess p = subprocess.popen("a.out", **stdout=subprocess.pipe**) and redirect stdout pipe. in case wont redirect stdout pipe subprocess, want read unflushed buffer. there way python...

Get html output from a jcr node in CQ5 -

i wanted know if there way rendered html output of page node in cq5 without hitting actual url. have page node , want rendered html output of page node programmatically in java , store in string without hitting page url. any appreciated, in advance! node it's data. sling framework responsible rendering data. use bunch of rules determine how data should rendered. sling script resolution cheet sheet sling web framework renders data via http requests. to emulate request in cq/aem suggest use com.day.cq.contentsync.handler.util.requestresponsefactory service import org.apache.sling.engine.slingrequestprocessor; import com.day.cq.contentsync.handler.util.requestresponsefactory; @reference private requestresponsefactory requestresponsefactory; @reference private slingrequestprocessor requestprocessor; public string dostuff(){ httpservletrequest request = requestresponsefactory.createrequest("get", "/path/to/your/node.html"); request.set...

regex - Excluding a file with perl grep -

i want go on of files in directory, except files ending '.py'. line in existing script is: my @files = sort(grep(!/^(\.|\.\.)$/, readdir($dir_h))); and want like: my @files = sort(grep(!/^(\.|\.\.|"*.py")$/, readdir($dir_h))); can please exact syntax? grep uses regular expressions, not globs (aka wildcards). correct syntax is my @files = sort(grep(!/^(\.|\.\.|.*\.py)$/, readdir($dir_h))); or, without unnecessary parentheses my @files = sort grep ! /^(\.|\.\.|.*\.py)$/, readdir $dir_h; as parentheses in regular expression aren't used capturing, precedence, can change them non-capturing: my @files = sort grep ! /^(?:\.|\.\.|.*\.py)$/, readdir $dir_h; you can express same in many different ways, e.g. /^\.{1,2}$|\.py$/ i.e. dot once or twice nothing around, or .py @ end.

javascript - How to fill Charts.js with mysql data? -

below code, , want in xaxis , yaxis display data database. <script src="../chart.js"></script> <script> var randomscalingfactor = function(){ return math.round(math.random()*100)}; var barchartdata = { labels : <?=json_encode(array_values($count));?>, datasets : [ { fillcolor : "rgba(151,187,205,0.5)", strokecolor : "rgba(151,187,205,0.8)", highlightfill : "rgba(151,187,205,0.75)", highlightstroke : "rgba(151,187,205,1)", data :<?=json_encode(array_values($auditor));?> } ] } window.onload = function(){ var ctx = document.getelementbyid("canvas").getcontext("2d"); window.mybar = new chart(ctx).bar(barchartdata, { responsive : true }); } </script> my php code this: <?php $link = mysql_connect('localhost', 'root', '') ...

shared memory - C# UWP Windows 10 Inter Process Communication with MemoryMappedFiles missing -

i'm facing new problem, occured while coding ipc app. before uwp able use directive using system.io.memorymappedfiles; sucessfully. can't use using system.io.memorymappedfiles; , need it. is facing same issue? if yes, how solved it? my app doesn't compile anymore. i tried reimport system.core.dll reference , dllimport, neither worked. direct inter-process communication not available in universal apps. you can use app services or launchuriforresultsasync perform tasks span multiple apps.

android - ListView setOnItemClickListener Does Not Trigger -

click listener not working when click item. in program first 2 arraylist updated using update(). list view sent other class make list view. clicking each item doesn't toast anything. public class blockactivity extends activity { listview lv; arraylist<string> contactnumber= new arraylist<string>(); arraylist<string> contactname= new arraylist<string>(); public static sqlitedatabase database; sqlitedatabase mydb= null; customadapter adapter; arraylist<string> contactnum= new arraylist<string>(); arraylist<string> contactnam= new arraylist<string>(); public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); button pickcontact = (button) findviewbyid(r.id.button1); update(); lv=(listview) findviewbyid(r.id.listview1); adapter = new customadapter(this, contactnam, contactnum); lv.setadapter(adapter); lv.setonitemclicklistener(...

scala - Write to disk with Spark Streaming -

i trying write disk in parquet format using data spark streaming. i getting slow write results using: val stream = ssc.receiverstream(...) stream.foreachrdd { rdd => if (rdd.count() > 0) { // singleton instance of sqlcontext val sqlcontext = sqlcontext.getorcreate(rdd.sparkcontext) import sqlcontext.implicits._ // save models in parquet format. rdd.todf() .write.mode(savemode.append) .parquet("../myfile") } } i compared against reading same data set once memory , once disk spark, opposed above, streaming approach used. can tell me why , give solution?

c# - Error when trying to out out data from a database -

i getting error shown here when trying output things: you have error in sql syntax; check manual corresponds mysql server version right syntax use near ') colours.prompt_reply' @ line 1 please help mysqlcommand cmddatabase = new mysqlcommand("select (user_id, project, project_feedback, when) colours.prompt_reply ;",condatabase); i think have error in command mysqlcommand cmddatabase = new mysqlcommand("select user_id, project, project_feedback, when your_table_name",condatabase); is 'when' part of table? i haven't used mysql in c# had used sql sever before think work

jquery - Automatically refresh table from included .php file -

i have been trying table refresh without page being refreshed. know can done ajax can't seem working. situation: have main.php page has include (table.php). include contains table id: tablevisit. table dynamically being made: loops through every row in database. table.php echo "<div id='tablecontainer'>"; $con = new mysqli("localhost","sample","samplepass","sample"); $sql = "select * sampletable"; $i = 0; $dyn_table = '<table border="1" cellpadding="10" class="visitorlist" id="tablevisit">'; $query = $con->query($sql); while($row = $query->fetch_assoc()){ $id = $row['id']; $name = $row['address']; $date = $row['date']; $time = $row['time']; $url = $row['visit_url']; $urlstring = $row['visit_url']; if($i % 3 == 0){ $...

android - Installing Google Play in GenyMotion by default when creating a device (takes time to do it when creating multiple devices) -

i know how install google play services on genymotion devices arm translation zip , other zip. there anyway install them default when create virtual device ? or other adb commands install in batch (ie device named '1' device named '15'. naming device numbers. can make installation easier.. , update google play services myself in play store (sadly, don't think there other ways update it.) genymotion doesn't provide google apps. install google apps: upgrade genymotion , virtualbox latest version. download 2 zip files: - arm translation installer v1.1 - google apps android version : 2.3.7 - 4.4.4 or 5.0 open genymotion emulator , go home screen drag , drop first file genymotion-arm-translation_v1.1.zip on emulator. dialog appear , show file transfer in progress, dialog appear , ask want flash on emulator. click ok , reboot device running adb reboot . drag , drop second file gapps-*-signed.zip , repeat same steps above. run adb reboot an...

excel - Check if date is within five working days -

Image
i want create formula in excel check if date within 5 working days of today(). =if(h6<today()-14,"old",if(h6<today()-7,"last week", "this week")) if date within 5 working days show 'this week', otherwise if date last week show 'last week' or if older show 'older'. this works on 7 day assumption, how can work 5 working day week? well ok can use networkdays see how many working days date before today, when today weekday gave same answer formula (almost - yours inclusive includes last monday, mine doesn't):- =if(networkdays(a2,today())>10,"old",if(networkdays(a2,today())>5,"last week","this week")) today @ time of writing 21st september 2015. networkdays comes own if want omit public holidays. if want see if day in same week today, use weeknum:- =if(weeknum(today())-weeknum(a2)>1,"old",if(weeknum(today())-weeknum(a2)>0,"last week",...

javascript - AngularJS modal iframe get form values -

i have angularjs project open modal window. in modalwindow have iframe wich loads external url. external url has form. is there way access formvalues without using jquery? so i've got modal called controller: var modalinstance = $modal.open({ templateurl : 'modal.html', controller : 'modalcontroller', size : "lg", resolve: { options: function () { return { iframeurl : “http://www.myexternalurl", }; } } }); modal.html <div class="modal-dialog"> <iframe ng-src="{{options.iframeurl}}" id="myiframe" sandbox="allow-same-origin allow-scripts" class="modaliframe" seamless='seamless' style="border:0" frameborder="0"></iframe> </div> modal controller .controller('modalcontroller' , ['$scope...

maps - How to add info window for custom overlays? -

i have implemented custom overlay. want add event pop info window when click overlay. function initmap() { var map = new google.maps.map(document.getelementbyid('okmap'), { zoom: 4, center: {lat: 35.0000, lng: 103.0000} }); (var n in nodes) { var mymarker = new mymarker(map, {latlng: new google.maps.latlng(nodes[n][0], nodes[n][1]), image: 'assets/img/light-green.png', labeltext: (math.random() * 100).tofixed(0)}); markers.push(mymarker); var infowindow = new google.maps.infowindow({ content: n }); mymarker.addlistener('click', function() { infowindow.open(map, mymarker); }); } } but not working! i faced simliar problem time back. here 2 things helped me. considering main overlay element div . in mymarker.draw function make sure using pane has access dom events.e.g. var panes = this.getpanes...

c# - Using a cached copy of autodiscover.xml -

i'm having trouble implementing ews in application. exchange server in question not allowing connection, think can solve implementing ntlm authentication method. before that, however, i'd know if possible use local copy of autodiscover.xml cached outlook, since appears contain necessary information. can this? furthermore, if can this, or bad idea?

forms - GET_APPLICATION_PROPERTY(CONFIG) property retrieves limited value -

using get_application_property(config) in oracle forms 11g pick config values available in address bar below quotes. ? config=pp100.ru-ru &clientdpi=82&p_id i need "pp100.ru-ru" value, returns "pp100" . how property works? does restrict number of values returns?

javascript - unable to call $stateProvider, twice to update the view (it is only working for the first time) -

i have search books page, in when click search tab, depending on search criteria, display results in adjacent block. when click second time, not working! the relevant html code of page: <form action="#" method="post" ng-controller = "optionscontroller octrl"> <select class="selectpicker btn btn-default" name="searchcriteria" id ="soptions"> <option value="1">title</option> <option value="2">author</option> </select> <label class="searchbox"> <span><br></span> <textarea id="searchbox" name="searchbox" value="" type="text" autocomplete="on" placeholder="search books"></textarea> </label> <input type="button" value="search" id...

php - How to pass variable to @extends blade -

i have variable {{$template}}.. how can including variable @extends. had try this: @extends({{$template}}) // getting error i hope, there 1 answer me. thanks. you mean want pass value $template layout? , getting value of $template ? if want pass variable layout , try doing @extends('<<your layout name>>', ['template' => $template])

javascript - Compare participants in one column of the table and make sum from other column, js -

i have table. i'd compare participants. if participant have several result points in table, script has return sum of participant's results. , on every participant. table generated database ( ".$row["pnt"]." " .$row["station"]. " ".$row["res"]." ): participant station points aa some1 1 dd some1 2 aa sm2 3 dd sm2 4 bb sm3 5 ee sm3 6 for example i've recieve such new table: aa - 4, dd - 6, bb - 5, ee - 6 i've tried so: $(document).ready(function () { $("body").click(function () { var rows = $("tbody tr"); var jo = []; (var = 0; < rows.length; i++) { (var j = 1; j <= rows.length; j++) { var pnt1 = $(rows[i]).find(".pnt").html(); var stations1 = $(rows[i]).find(".station").html(); var pntr1 = $(rows[i]).find(".res").html(); if ...

Python - read 2d array from binary data -

i try read 2d array floats binary file python. files have been written big endian fortran program (it intermediate file of weather research , forecast model). know dimension sizes of array read (nx & ny) fortran , idl programer lost, how manage in python. (later on want visualize array). shall use struct.unpack or numpy.fromfile or array module ? do have read first vector , afterwards reshape it? (have seen option numpy-way) how define 2d array numpy , how define dtype read big-endian byte ordering? is there issue array ordering (column or row wise) take account? short answers per sub-question: i don't think array module has way specify endianness. between struct module , numpy think numpy easier use, fortran-like ordered arrays. all data inherently 1-dimensional far hardware (disk, ram, etc) concerned, yes reshaping 2d representation necessary. numpy.fromfile reshape must happen explicitly afterwards, numpy.memmap provides way reshape more implici...

oracle - PL/SQL To Run Simple SQL Commands -

using basic sql, i'm populating table db. uses basic delete statements remove old data , insert statements from clause using dblink. i'm attempting transfer package , have come this: package: create or replace package loaddata procedure populatetable; end loaddata; pl/sql (package body): create or replace package body loaddata procedure populatetable begin delete datatransfer; insert datatransfer select valuenum, datacontent, sysdate transfer_data transfertable@datalink; commit; null; end populatetable; end loaddata; and run command, run: exec loaddata.populatetable(); my question should procedure have input/output parameter or declared variables? has compiled , worked correctly i'm unsure if i'm following pl/sql methodology. there no rule provide parameters. additonally can insert record log table store start date, end date, number of records inserted , number of records deleted in case need track batch execution...

c++ - Why this easy program isn't working? -

#include <iostream> #include <conio.h> int main() { int i; (i = 1; = 100; 1 + 1); { std::cout << << " = " << *i << std::endl; } { std::cout << << " = " << *i << std::endl; } while (i = 100) getch(); } why isn't working @ all. sapoust give cube numbers of numer 1 100 , opens , nothing happens. can ?! i'm beginner , cant solve problem. thanks you have number of mistakes, e.g. for ( = 1 ; = 100 ; 1+1 ) ; should be: for ( = 1 ; <= 100 ; += 1 ) (note removal of stray ; other changes). also: while ( = 100 ) should be: while ( <= 100 ); (note addition of missing ; change = <= ). you want re-initialise i prior do loop, , increment within loop: i = 1; { std::cout << << " = " << * << std::endl; += 1; } while (i <= 100);

java - Find the length of a vector based on a rule -

Image
i creating vertex array mesh given points.so far able create continuous mesh thickness.however there problem @ intersection of 2 line segments, vectors between segment's sizes needs bigger or smaller depending on situation in order have continuous look. what have now: with given angles theta1 , theta2, how can calculate length of red vectors? what want: how structured mesh: you're making more complicated needs be. let's start calculating red arrows. line segment (p_i, p_j) , can calculate segment's normal with: dir = normalize(p_j - p_i) normal = (-dir.y, dir.x) //negate if want other direction at connection point between 2 segments, can average (and re-normalize) incident normals. gives red arrows. the question remains how need shift. resulting offset line segment o_l given offset of vertex o_v is: o_l = o_v * dot(normal_l, normal_v) this means following: both normals unit vectors. hence, dot product @ one. case when both li...

Two observers Polymer -

i have 2 observers , in each observer change value of property of other observer. in case dont want other observer execute. how can change observer execute in change of property outside? thanks your best option use local variable stop update. polymer({ is: 'my-element', properties: { myproperty: { type: string, observer: '_myobservera' } }, observers: [ '_myobserverb(myproperty)' ], _myobservera(newvalue) { if(!this._localupdate) { //do stuff here } else { this._localupdate = false; } }, _myobserverb(newvalue) { this._localupdate = true; //do stuff here } })

Multiple actions for the same triggered event UML statechart -

Image
i'm newbie @ uml statechart notation, i'm trying simulate there 2 fired action on same triggered event 1 of these actions optional depending on condition. the following simulation need, following notation true or false?: in uml state diagrams, each transition triggered 1 , 1 event. in case seems 1 event cause transition 2 different states or, noted, had optional path. advise following: what did use pseudostate branch on condition mentioned. if condition holds, transition bottom final state, if not transition right. while end state same, diagram outlines different behaviour on each transition. i apologize not using correctly rounded box, online drawing tool used didn't provide these. can see used 2 final states can use one, both permitted in uml.

api - Foursquare app icon upload issue -

Image
when trying change app icon on foursquare, i'm receiving message in chorme console: post https://foursquare.com/__uploadappicon 400 (bad request) uncaught securityerror: failed read 'contentdocument' property 'htmliframeelement': blocked frame origin "https://foursquare.com" accessing frame origin "https://foursquare.com". frame requesting access set "document.domain" "foursquare.com", frame being accessed did not. both must set "document.domain" same value allow access. here's screenshot: does got solution that? i've twitted @4sqsupport.

css - Navbar horizontal drowpdown items height -

i have navbar dropdown menu. dropdown items displayed horizontally in full width , larger height. when items dont fit (mobile view) want them displayed 1 bellow other in full width , in smaller (normal) height <nav class="navbar navbar-default"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse" aria-expanded="false"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class=...

jQuery Mobile slide down event -

looking @ jquery mobile can see events slideleft , slideright. i need slidedown event. idea in app when slide down action (swipe finger down motion) on screen forces refresh of data displayed. looking @ slide event seems support horizontal motion, not vertical. i think mean pull refresh feature, not implemented design in jquery mobile. you can use specific plugin scrollz . code: <!-- content : data-scrollz supports 'simple' or 'pull'. content automatically resized window height between header , footer. --> <div id="content" data-role="content" data-scrollz="pull"> <!-- scrollable content here. --> </div> demo: https://dl.dropboxusercontent.com/u/26978903/scrollz/mobile.html

reporting services - Is it possible to build a fully interactive web app on top of SSRS? -

i'm new ms bi tools , after reading bit, feel sql server + ssis + ssas fulfill needs on modelling , analysis side. however, on top of it, build web application allows user select present on columns, rows, filters apply , kind of chart represent data into. (drag , dropping or whatever, using html). of course, after modelling data on ssas. should somehow exposing report builder inside web app. i wondering whether there's possibility consuming web services i've read ssrs exposes, because sure building such solution hand-coding quite complex. or ws, in contrast, made displaying reports created using visual studio enablers? i've read of creating rdl reports , rendering them, somehow possible , connected i'm looking for? if it's not possible, alternative, if any? thanks if have @ ssrs web service methods (find here https://msdn.microsoft.com/en-us/library/ms155071.aspx ) see none of methods allows functionality of creating report scratch. most i...

For loop does not return result in correct format in oracle procedure -

i have written below procedure in want return output of variable value brand_name.brand_name . getting correct output. want return in proper format. example right getting output without header 'brand_name' ,fnc,lidl but want return output header 'brand_name' as: brand_name: fnc,lidl here stored procedure: function build_alert_email_body ( in_alert_logs_timestamp in timestamp , in_alert_logs_log_desc in varchar2 , in_kpi_log_id in number ) return varchar2 body varchar2(4000) := ''; v_kpi_def_id number := ''; v_kpi_type varchar2(100) := ''; v_kpi_name varchar2(100) := ''; v_brand_name varchar2(100) := ''; v_kpi_type_id number := ''; v_first_record boolean := false; cursor brand_names_cur select br.name brand_name v_brand_name rator_monitoring_configuration.kpi_definition kd join rator_monitoring_configuration.kpi_definition_brand kdb on kd.kpi_def_id = kdb.kpi_def_id join rator_monitoring_configuration.br...

scala - List in request body in Gatling -

i trying make put call via gatling , trying pass list request body: .put("/mypath").body(list(session("usernames")).asjson.check(status.is(200)) where have usernames in session , list of strings. body should become: ["string1", "string2"....] any solution on how pass list request body. new gatling. please help. try this: .put("/mypath") .body(stringbody("${usernames.jsonstringify()}").asjson) .check(status.is(200)) jsonstringify part of expression language (el) , turns list json string. .asjson @ end ensures content-type set correctly application/json.

ruby - Using Model.create when the parent class is not already saved -

i'm trying create translate keyword create class member working simple string different values, depending of locale set. here code : module translate def translate(*attr_name) _field_name = attr_name[0] has_many :translations define_method(_field_name) self.translations.where(key: _field_name, locale: i18n.locale).first end define_method("#{_field_name}=") |params| self.translations.create!(key: _field_name, locale: i18n.locale, value: params.to_s) end end end class translation include mongoid::document field :key, type: string field :value, type: string, default: '' field :locale, type: string belongs_to :productend end class product include mongoid::document extend translate translate :description end i'm getting error : mongoid::errors::unsaveddocument: problem: attempted save translation before parent product. summary: cannot call create or create! through relation (translation) w...

ios - Xcode Loop into Array -

for loop error; want repeat [demophoto] line can me please sample file: https://www.dropbox.com/s/177kvpp72pfh8ul/mytest.zip?dl=0 allphoto = [nsmutablearray array]; [allphoto addobject:@"http://www.ed.ac.uk/polopoly_fs/1.129149!/filemanager/mohamad-hanif-awang-senik_2ndlrg.jpg"]; [allphoto addobject:@"http://thehandmadephotograph.com/wp-content/uploads/2014/08/smithsonian-photo-contest-winner-2012-crop.jpg__800x600_q85_crop.jpg"]; [allphoto addobject:@"https://cdn.tutsplus.com/photo/uploads/legacy/352_greatphototuts/greatphototuts-68.jpg"]; [self setphotos:@[ for(int i=0; < [allphoto count]; i++){ [demophoto photowithproperties: @{@"imagefile": @"1.jpg" }], } ]]; i guess want: nsmutablearray *temparray = [nsmutablearray new]; for(int i=0; < [allphoto count]; i++){ [temparray addobject:[demophoto photowithproperties: @{@"imagefile": @"1.jpg" }]]; } [self setphotos:...

python - Flask add DB entry using a form -

i'm beginner learning flask. i'm making app , i've created db model user, , html/ js form takes input. want use form information create new entry in database unsure on how it. tried @app.route('/add_to_db') def add_to_db(): email = request.form['email'] activated = 0; user = models.user(email= email, activated = 0) db.session.add(user) db.session.commit() html code: <form onsubmit="return validateemail(document.getelementbyid('email').value)" action="{{ url_for("add_to_db") }}" method="post"> please input email adress: <input id="email"> <input type="submit"> </form> <script> function validateemail(email) { var re = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i; return(re.test(email)); } </script> but gave me 405 method not allowed error. a 405 e...

php - Can you make a scope in laravel that calls various other scopes? -

i have model in laravel has various scopes defined. want use of them in lot of places rather chaining them i'd rather able call 1 scope calls of other scopes so: function scopevalid($query, $user_id) { $query = $this->scopedatevalid($query); $query = $this->scopemaxusesvalid($query); $query = $this->scopecustomermaxusesvalid($query, $user_id); return $query; } this doesn't seem work though, there way achieve this? original answer query scopes called statically. $users = model::datevalid()->get() there no $this when making static calls. try replacing $this->scopedatevalid self::scopedatevalid revised answer there else wrong code since $this in fact model instance when scopes called. should able either call class scope methods directly $query parameter (like did) or use chain of scope method resolution proposed ceejayoz . personally, don't see of advantage in going through whole query scope resolution process wh...

caching - CSS referencing in HTML -

let's have website called http://example.com . in have stylesheet so: <link rel="stylesheet" href="/_resources/css/style.css" /> what if have website called http://another-example.com/ , want use same stylesheet using @ http://example.com ? asking load times. if visits example.com first , another-example.com, if have stylesheet in another-example referencing file in example, browser cache stylesheet , not have load again, or automatically download example.com stylesheet when visits another-example.com , have 2 copies of stylesheet? in short, no. not worry, time takes load style sheet pales time takes load single high quality image. issue if still using dialup @ 1kbs speed trying load page. you should assume, when making website, things caching turned off. can use following code force this. cache-control: no-cache, no-store hope helps!

javascript - How to do an color-picker with just a range of colors -

Image
i trying this: a colorpicker can pick colors, 40 colors. don't want use eventlistener each color. think should possible <select> element, how? i think alot of tinkering specific solution. solution html table containing 40 cell, define color each cell, write code define 1 user has selected, later on use ever purpose need. if me use this: code from: http://widget.colorcodehex.com/color-picker.html <div style="font-family: arial,helvetica,sans-serif; border: solid 1px #cccccc; position: absolute; width: 240px; height: 326px; background: #ffffff; -moz-box-shadow: 0 0 6px rgba(0,0,0,.25); -webkit-box-shadow: 0 0 6px rgba(0,0,0,.25); box-shadow: 0 0 6px rgba(0,0,0,.25); -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px;"> <div style="background-color: #2d6ab4; position: absolute; top: 0px; left: 0px; width: 100%; height: 22px; text-align: center; padding-top: 2px; font-weight: bold; border-top-right-radius: 5px; ...