Posts

Showing posts from February, 2013

Java Double Currency Format to 3 Places -

this question has answer here: java currency number format 16 answers i have java android app deals tips. when take in double of bill amount , tip percent, parse them to strings display later. how can format doubles make currency more readable @ end? instead of looking $1.0 $1.00. the code have mentioned is: final edittext amt = (edittext) findviewbyid(r.id.bill_amt); final edittext tip = (edittext) findviewbyid(r.id.bill_percent); final textview result = (textview) findviewbyid(r.id.res); final textview total = (textview) findviewbyid(r.id.total); double amount = double.parsedouble(amt.gettext().tostring()); double tip_per = double.parsedouble(tip.gettext().tostring()); double tip_cal = (amount * tip_per) / 100; double totalcost = amount + tip_cal; result.settext("tip amount : " + " $ " + double.tostring(tip_cal)); total.s

asp.net - Can I Create PowerBi report in C# or using macro -

can create power bi report(office 365) programmatically in c# or using macro. if yes, how? please help. excel sheet uses power query , power pivot create powerbi report.please provide me link support of answer can summarize, can done or not. using macros in excel manipulate power bi content not supported. lukasz

Excel PowerPivot DAX Calculated Field -

Image
i think i've got relatively easy problem here on hands, having trouble getting work. let me preface saying i'm new dax. consider following powerpivot data model : it consists of sales records table, joined date lookup table, "daily expenses" table. "daily expenses" table stores single value represents averaged cost of running specific trading location per day. it's extremely easy produce pivottable provides me total sales amount per store per [insert date period]. i'm after dax formulation calculate profit per store per day - ie. total sales minus dailyexpenses (operating cost): in theory, should pretty easy, i'm confused how utilise dax row context. failed attempts: profit:=calculate(sum(salesinformation[saleamount] - dailystoreexpenses[dailyexpense])) profit:=calculate(sum(salesinformation[saleamount] - dailystoreexpenses[dailyexpense]), dailystoreexpenses[storelocation]) profit:=sum(salesinformation[saleamount] - relate

How to send only specific column values from jqgrid? -

i have jqrid multiple columns , rows loaded via json. on click of update button sending grid data server json below. $("#updatetradedetail").click(function () { var griddata = $("#tradedetailgrid").jqgrid('getgridparam', 'data'); $.ajax({ url : "${pagecontext.request.contextpath}" + "/xxxxxx/tools/updatetrades", type : "post", data: json.stringify(griddata), datatype: 'html', contenttype: "application/json; charset=utf-8", success : function(msg) { alert("response on update " + msg); }, error: function (xhr, ajaxoptions, thrownerror) { alert(xhr.status); alert("error" + thrownerror); } }); }); how send specific column values has multiple rows ser

plot - I am trying to draw a stream function in matlab -

Image
i using code snap draw stream function [x,y]= meshgrid(linspace(0,80),linspace(-8,8)); [t]=meshgrid(linspace(0,100)); b=1+0.3*cos(0.9*t); k=2*phi/10; low=.1+k.^2.*b.^2.*sin(k.*(x-0.9.*t)).^2; psi=-tanh((y-b.*cos(k.*(x-0.9.*t)))./sqrt(low)); contour(x,y,psi,3); colormap cool i wanted picture. getting current(the sin shape lines) not vortex(the rectangular shape). i tried generate plot using parameters shown, but did not manage "vortex" shapes in contour plot . here implementation: len = 200; [x,y] = meshgrid(linspace(0,80,len), linspace(-8,8,len)); t = meshgrid(linspace(0,1,len)); = 1.2; c = 0.12; k = 2*pi/7.5; w = 0.4; e = 0.3; b = + e * cos(w*t); d = k * (x - c*t); psi = - tanh((y - b.*sin(d)) ./ sqrt(1 + (k * b.*cos(d)).^2)) + c*y; figure('position',[100 100 650 300]) movegui('center') subplot(211) contour(x, y, psi, 10), ylim([-4.5 4.5]) %colormap cool xlabel('kilometers'), ylabel('km'), title('mobility model'

eclipse - Facebook HASH KEY for Android Signed APK -

i facing problem facebook integration in android application last couple of days might duplicate question please me out . have create android application facebook integration every thing ok , working fine when have launch application eclipse ide or unsigned apk when have used signed apk facebook not working showing dialog when click on dialog disable , nothing happen , have searched , found hash key issue form tell debug hash key , signed hash key different not able make signed hashkey please me . for facebook integration using simple facebook library i using windows os please use code, generate hash key debug or distributor(signing) keystore try { packageinfo info = getpackagemanager().getpackageinfo(getapplication().getpackagename(), packagemanager.get_signatures); for(signature signature : info.signatures) { messagedigest md = messagedigest.getinstance("sha"); md.update(signature.tobytearray());

resize dynamically allocated memory C++ with ASSERT" _BLOCK_TYPE_IS_VALID(pHead->nBlockUse) " -

hi im writing code resize dynamically allocated memory. here part of code initializing: int size = 1; string *rev = new string[size]; resizing part: if (j >= size / 2){ size = size * 2; string *temp = rev; rev = new string[size]; memcpy(rev, temp, (size / 2)*sizeof(string)); delete[] temp; // <- here causes error! } when comment out "delete[] temp" code works fine memory leaks. so, how can handle error message "assert". please help! thanks! since pointed out assert caused other parts of code. here full version, print words out in reverse order in given sentence. void reversewords(string &sentence) { char *str = new char[sentence.size()+1]; int size = 1; string *rev = new string[size]; int j = 0; int n = 0; int m = 0; (unsigned int = 0; < sentence.size(); i++){ str[n] = sentence.at(i); n++; if (str[n-1] == ' '){ str[n-1] = '\0'; if (j >= size / 2){

javascript - Event capturing jQuery -

i need capture event instead of letting bubble. want: <body> <div> </div> </body> from sample code have click event bounded on div , body. want body event called first. how go this? use event capturing instead:- $("body").get(0).addeventlistener("click", function(){}, true); check last argument "addeventlistener" default false , in event bubbling mode. if set true work capturing event. for cross browser implementation. var bodyele = $("body").get(0); if(bodyele.addeventlistener){ bodyele.addeventlistener("click", function(){}, true); }else if(bodyele.attachevent){ document.attachevent("onclick", function(){ var event = window.event; }); } ie8 , prior default use event bubbling. attached event on document instead of body, need use event object target object. ie need tricky.

algorithm - java - largest to smallest sort - largest is out of order -

i'm trying sorting algorithm sort largest smallest in array. here's have: private void sort(int[] data) { int min; (int index = 0; index < data.length - 1; index++) { min = index; (int scan = index + 1; scan < data.length; scan++) { if (data[scan] > data[min]) min = scan; swap (data, min, index); } } } private void swap(int[] data, int pos0, int pos1) { int temp = data[pos0]; data[pos0] = data[pos1]; data[pos1] = temp; } the output is: 3 3 4 2 2 2 2 1 1 1 1 1 1 why second largest number out of order? i keep going through , i'm missing something. you closing if statement earlier if (data[scan] > data[min]) min = scan; swap (data, min, index); swap() invoked regard less of if condition

How to get class objects stored in a list in C++? -

i've defined own class , stored objects of them in std:list. want pick elements, went wrong - hope not complicated read: std::map < long, firstclass*> firstclassmap; std::map < long, firstclass* >::iterator it; it=this->firstclassmap.begin() //initialization of firstclassmap somewhere else , shouldn't matter. list<secondclass*>::iterator listitem; list<secondclass*> deplist = it->second->getsecondclasslist(); for(listitem = deplist.begin(); listitem != deplist.end(); ++listitem) { /* -- error in line -- */ firstclass* theobject = listitem->getthelistobject(); std::cout << theobject->name(); } then there function: secondclass::getthelistobject() { return this->theobject; //returns firstclass object } firstclass::name() { return this->name //returns string } here error method 'getthelistobject' not resolved and error:element request »getthelistobject« in »* listitem.std::

css - Adressing a section or class does not work -

i have problem using styles in class style.css. class structure shown below. tried far make changes is: @media (max-width:920px) { #section {padding-left:20px !important} } @media (max-width:920px) { #block-system-main {padding-left:20px !important} } @media (max-width:920px) { .block-system-main {padding-left:20px !important} } @media (max-width:920px) { .block .block-system .clearfix {padding-left:20px !important} } class structure looks that: <section id="block-system-main" class="block block-system clearfix"> <div id="node-493" class="node node-meeting node-promoted node-teaser clearfix" when right clicked , examined element found spot in css code, styles automatically applied class. looked that: article, aside, details, figcaption, figure, footer, header, hgroup, main, nav, section, summary { d

primefaces - Put wizard navbar on top position -

i'm working wizard component. navbar in botton boss wants me put in top of wizard,i thought attribute or tag straight forward have been reviewing documentation , should wrong (i found shownavbar tag). is there way without css or jquery? (we have problems in application setting css when working components avoid it). thank much you can achieve in either of 2 ways: 1 - extending wizardrenderer by extending wizradrenderer can change order of encoding. in original renderer encodecontent(facescontext, wizard); called before encodenavigators(facescontext, wizard); it's pretty simple, extend custom renderer, change order of calls. public class exnavwizardrenderer extends org.primefaces.component.wizard.wizardrenderer{ @override protected void encodemarkup(facescontext facescontext, wizard wizard) throws ioexception { responsewriter writer = facescontext.getresponsewriter(); string clientid = wizard.getclientid(facescontext); stri

linux - what nginx version can I use? -

i'm confused after reading many articles on net version go on vps. have debian squeeze 6 , php5.3, , want know if can use version of nginx such 1.4.7 or 1.6.0 latest versions. when check debian squeeze packages, can see nginx v. nginx (0.7.67-3+squeeze3) , when check debian squeeze-backports, see package nginx (1.2.1-2.2~bpo60+2) i'm wondering if can use other versions of nginx such 1.4.7 or 1.6 on php5.3 or not?? any idea how that? you can choose nginx-{version-number}.tar.gz install

javascript - How to compile html outside of ng-app scope after partial update -

i have user-control uses anguar.js , declares div ng-app somewhere inside. other part of system doesn't use angular.js , doesn't reference it. now, problem after partial update of html (using update-panel, instance) need recompile (because it's injected dom) , cannot technically this, far whole html ng-app declaration being replaced. and not have access $compile service (okay, can using $injector , $scope ?) function afterpartialupdate(containerelement) { var injector = angular.injector(['ng']); injector.invoke(function($compile) { $compile(containerelement)( ???need scope, lost ); }); }; i can store scope @ moment of initial page-load in global variable. recompiling using same scope results in incremental increase of $$watchers collection , other unwanted side-effects... i guess there should way force angular execute same javascript executes during intial page-load, i.e. create modules, traverse html, instantiate controllers

c++ - Avoiding GUI freezing on multithreaded operations -

i have qt gui class preferenceswindow that, obviously, responsible handling user preferences. have fields manage connection database server. when field left, dbschanged() method called. below code managed write: void preferenceswindow::dbschanged() { qfuture<qstringlist> loader = run(this, &preferenceswindow::get_databases); qstringlist databases = loader.result(); if (databases.length()) { this->ui.database->show(); this->ui.nodb_label->hide(); this->ui.database->clear(); this->ui.database->additems(databases); this->ui.okbutton->setdisabled(false); this->ui.validationstatus->setpixmap(qpixmap(":/icon/tick.png")); } else { this->ui.database->hide(); this->ui.nodb_label->show(); this->ui.okbutton->setdisabled(true); this->ui.validationstatus->setpixmap(qpixmap(":/icon/error.png")); } } qstr

jQuery range selector -

i'm searching filter elements range. exemple, element list: <ul> <li data-price="25">foo</li> <li data-price="50">bar</li> <li data-price="125">baz</li> <li data-price="150">biz</li> </ul> i want extract li data-price >= 50 , <= 125 . exist selector can ? if not can simple way ? you can use .filter() function: $('ul li').filter(function(){ return($(this).data('price')>=50 && $(this).data('price')<=125) }); working fiddle

javascript - wrong ASCII key code for delete key -

i have html form in need allow numeric key-press. have used following code $(".span8").keypress(function(e) { var unicode=e.charcode? e.charcode : e.keycode //alert(unicode); if ((unicode ==8) || (unicode==9)|| (unicode==46)){ //if key isn't backspace key (which should allow) } else { if (unicode<48||unicode>57&&unicode!=65) //if not number return false //disable key press } }); but here if testing keycode, getting value 46 delete key. 46 dot(- period) others values coming correct. not able find going wrong. please i've found weird behaviour keypress function. instead, try following: jquery(function($) { var input = $('.span8'); input.on('keydown', function() { var key = event.keycode || event.charcode; if(key == 8 || key == 46) //do when del or backspace pressed }); });

css3 - CSS border curvature -

Image
could please explain why have such curved border outlined on picture attached? here css: .fourth-article-category { border-bottom: 4px solid #5692b1; } article { border-left: 1px solid #ebebeb; border-right: 1px solid #ebebeb; } and html: <article class="fourth-article-category"> <img src="img/article_4_photo.jpg" width="470" height="345" title="a-rod, fraud, , waste of yankees money, public's time" /> <section> <div class="article-info"> <span class="date">25 july 2013</span> <span class="comments-quantity"><a href="#">6 comments</a></span> </div> <div class="article-preview"> <h3>a-rod, fraud, , waste of yankees money, public's time</h3> <p>enough already. can’t take no more. free enslavement ba

Access Database design when changing course fee after certain period of time -

i have 3 tables: student id (pk) name course id (pk) course_name course_duration course_fee student_course student_course_id (pk) student_id (fk) course_id (fk) if after period of time course fee changes how can maintain record of student having previous course fee? logically copy enrolments table (student_course). supposes price not change after registration.

c++ - Dynamic equal_to function unordered_map boost -

i have unordered map string int uses custom equal_to function defined as: bool hashequal::operator ()(const string &a, const string &b) const { if (a.size() != b.size()) return false; return std::inner_product( a.begin(), a.end(), b.begin(), 0, std::plus<unsigned int>(), std::not2(std::equal_to<std::string::value_type>()) ) <= 8; } basically if 2 keys have hamming distance equal or less 8, same key. the thing want distance threshold dynamic in order let user set through command line. instead of 8, variable threshold or this. i'm not looking hack global variable (unless it's way achieve this) "good way". why `unordered_map` doesn't work reliably a general-purpose hash function maps keys buckets in repeatable otherwise seemingly random way, mean if key varies single bit bucket should statistically unrelated - if you'd picked @ random. so, have hash table

javascript - Set value in HTML with AngularJS -

i'm using angular js. loop out part of scope start json array. i need check if value in array exists. if should something. following code work can't figure out way save "status" temporary. <div ng-repeat="item_value in item['slug'].values"> {{item_value}} <div ng-if="item_value == 'dogs_cats'"> somehow save "status" true when above equal. </div> </div> <div ng-if="status == 'true'"> someting here. </div> maybe approach wrong. maybe should not go in template? different solutions choose , suggestions on prefered. i think do: <div ng-if="item_value == 'dogs_cats'" ng-init="status = true"> somehow save "status" true when above equal. </div> but preferably should put logic in controller

Regex: ignore if url contains one of two words -

i tracking clicks of urls , need track ones not contain word "amazon" or "ebay" eg track this http://www.website.co.uk/out?prov=tesco* http://www.website.co.uk/out?prov=asda* http://www.website.co.uk/out?prov=youtube* but not this http://www.website.co.uk/out?prov=amazon* or http://www.website.co.uk/out?prov=ebay* how approach regex? the star @ end of url because each url has different parameters you use below regex match url's except 1 contains amazon or ebay, http:\/\/www(?!.*amazon|.*ebay).* or http:\/\/www(?!(?:.*amazon|.*ebay)).* demo

android - java.lang.NullPointerException: CameraUpdateFactory is not initialized logcat exception -

i'm working google maps. able create , can show google map. want add cameraupdate(latitude, longitude) . googled , found source code i'm getting nullpointerexception . the logcat error message is: java.lang.nullpointerexception: cameraupdatefactory not initialized this source. doing wrong? public class stradacontact extends fragment { public final static string tag = stradacontact.class.getsimplename(); private mapview mmapview; private googlemap mmap; private bundle mbundle; double longitude = 44.79299800000001, latitude = 41.709981; public stradacontact() { } public static stradacontact newinstance() { return new stradacontact(); } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.strada_contact, container,false); mmapview = (mapview) rootview.findviewbyid(r.id.pointmap); mmapview.oncreate(mbundle); setupmapifneeded(rootview);

How to upload an image from Android to asp.net MVC web service -

i have application take picture android phone , send asp.net web service mvc. here controller file homecontroller.cs : public class homecontroller : controller { blobstorageservice _blobstorageservice = new blobstorageservice(); public actionresult index() { return view(); } public actionresult upload() { cloudblobcontainer blobcontainer = _blobstorageservice.getcloudblobcontainer(); list<string> blobs = new list<string>(); foreach (var blobitem in blobcontainer.listblobs()) blobs.add(blobitem.uri.tostring()); return view(blobs); } [httppost] public actionresult upload(httppostedfilebase image) { if (image.contentlength > 0) { cloudblobcontainer blobcontainer = _blobstorageservice.getcloudblobcontainer(); cloudblockblob blob = blobcontainer.getblockblobreference(image.filename); blob.uploadfromstream(image.inputstream); } r

Jenkins check property and than execute or not -

is possible in jenkins start job on node , before start check if property or env. variable exists? if exists start, if not exist don't start on it. how can this? i need it, because first job reverts virtual machine after executing , make off in jenkins in jenkins node little bit time on-line(near 5 sec) , second job in downstream can catch it. you can use script trigger plugin use script decide whether trigger job or not. you've got write script though.

Why does Python fail to run a program when I run it from its own directory? -

this not working: numbers directory: $ cat numbers.py import networkx nx ~/numbers $ python2.7 < numbers.py this gives me few errors end like: 'module' object has no attribute 'number' this working: ~ $ python2.7 < numbers/numbers.py i installed networkx following these instructions: http://networkx.github.io/documentation/latest/install.html download source (tar.gz or zip file) https://pypi.python.org/pypi/networkx/ or latest development version https://github.com/networkx/networkx/ unpack , change directory source directory (it should have files readme.txt , setup.py). run python setup.py install build , install (optional) run nosetests execute tests if have nose installed. the tests run fine, don't understand why trivial program containing "import networkx nx" won't run. what difference between these 2 situations ? you passing in script on stdin, instead of on command line, python adds current working directo

Set value of input text field inside jquery.on -

i using jquery.on on input buttons identify button pressed. want set value of text field value 1 of attributes on input button pressed. the jquery $('input.btne').on('click', function () { var btn = $(":input[type=button]:focus"); var amount = btn.attr("amount"); $("#fee_amount").val(amount); }); the html <input type="text" id="fee_amount" /> <input type="button" id="idf" class="btne" optiontext="my option text" amount="123.00" value="edit" /> i tried doing said undefined alert($("#fee_amount").val()); the amount correct , present not go fee_amount field. can shed light on doing wrong please? you gave wrong id in selector txt_feeamount should fee_amount input have has id fee_amount not txt_feeamount note can source of event using $(this) or this instead of var btn = $(":input[type=butto

android - Drag,Zoom or Rotate an ImageView -

Image
here class performs drag, zoom , rotate of imageview . xml <?xml version="1.0" encoding="utf-8"?> <framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <imageview android:id="@+id/imageview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:scaletype="matrix" android:src="@drawable/butterfly" /> </framelayout> but done on matrix of imageview using imageview.setimagematrix(matrix); not actual image view. hence below results: initial imageview: on dragging right: on zooming in: on rotating: is there way can modify imageview change per it's matrix ? you can call view.setrotation() , view.setpivotx() , view.setpivoty() , view.setscalex() , view.se

filtering - jQuery dataTables - Clear search on a column -

looking @ example, http://www.datatables.net/examples/api/multi_filter_select.html , uses columns.search() datatable api, how 'clear' search , show results again when user selects 'all' or empty first option? you clear search using empty string search term, without regular expression match. individual column filtering demo somehow little bit misleading, since first (unnamed) option not "all" or "any", 1 belive, in fact should named "empty" or "null". if select first option, regular expression search empty string performed. guess demo made in haste. modified demo selecting first option "clear" search, selecting : $("#example tfoot th").each( function ( ) { var select = $('<select><option value="">all</option></select>') .appendto( $(this).empty() ) .on( 'change', function () { var term = $(this).val()!='' ? '^'+$

Trying to Use PHP's Zip Archive - Extract To Doesn't Seem to be Working -

would appreciate on this. i've been trying write php script unzips zip file has been created using php's in-built zip archive extension. the zipping-up process has been straight forward i'm trying unzip particular folder , doesn't seem working. thing create folder i've asked extract to. no files appear in folder. i've had no error messages. thanks in advance. here's code: <?php $root = str_replace('public_html', '', $_server["document_root"]); $path = $root.'scripts.zip'; $zip = new ziparchive; $zipped = $zip->open($path, ziparchive::create | ziparchive::overwrite); $folder = $root.'public_html/scripts/'; if ($zipped) { $extract = $zip->extractto($folder); if ($extract){ echo 'zip file extracted'; } $zip->close(); } ?> i modify code 1 below. doing creating new zip file, not extracting old one. ziparchive::create instructs co

sql server - Using Case When Then to Filter Dates -

i need create view accounts team show aged debtors via excel. i've got due dates of outstanding invoices , want achieve 30,60,90 , 120 day breakdown. my current script this... case when st_transmonth = month(getdate()) '30 days' else if st_transmonth = month(getdate()) + 30 = '60 days' , on. i can't ge work though, appreciated! your math has subtle flaw in it, in you're using month check length of days transaction date, know, not months have 30 days, therefore you're going introduce areas discrepancy, potentially involve legal issues if send late notices people when they're not technically late. furthermore, more 30 days passed due, you're not catching because it's different month, example, bought on 25th of last month , it's 31st of month now, they're > 30 days passed due, you're not reporting it. instead of month, use datediff command, part of tsql. allows get difference between 2 date

c# - How to parse an ArrayOfXElement in Windows Phone? -

i'm trying connect asmx web service , code generated in windows phone project different in windows forms. in windows forms, methods of web service returns dataset, go through rows in existing tables of object: myobject myobject = new myobject(); dataset dataset = soapclient.somemethod(); foreach (datatable table in dataset.tables) { foreach (datarow row in table.rows) { myobject.someproperty = row["someproperty"]; myobject.someotherproperty = row["someotherproperty"]; } } but in windows phone generates async version of method subscribe event fires when request completed. , event args brings me arrayofxelement, seems windows phone version of dataset object. how parse this? before mark question duplicated, know other answers available in site not working. alright, managed working. web service method return 2 xelements, first 1 header, declaring what's coming next. ignore first xelement, , inside newdataset element

svn - Source control, live server best practices -

i'm working on project we're using tomcat , svn. have repo checked out in different directory tomcat webapps directory (were code server uses lives). told bad idea checkout copy of repository in webapps directory. how can test live server code when code server sees in /webapps , repo located elsewhere? have been having make changes in both repo , webapps directory. what's solution this? not sure if it's best practice i've been using (at least) 2 techniques: use context descriptor file this file in $tomcat/conf directory tells tomcat app , what's called (ie. can change context, have app called my-best-app-ever , deploy on localhost:8080/my-second-best-app-ever . make symlink of code webapps directory test instance of tomcat. this quick , effective , hassle-free. not meant teams, localhost.

bash - Renaming files in linux terminal -

this question has answer here: bash script rename multiple files [duplicate] 4 answers i have 2 files 2014-06-27 names.csv 2014-06-27 money.csv i want rename files , them. can rename command? how should it? there better way? i can't use predefined length of characters chop off @ beginning automatically generated files may have different prefix scheme on later date. onething sure. end in " names.csv" , " money.csv" edit: want rename them "names.csv" , "money.csv". sorry not providing info you can use rename command: rename 's/^.* (.*\.csv)$/$1/' *.csv

jquery - Pop up no displaying properly in mobile -

i using jquery mobile 1.4.2 trying create pop dynamically in page.its working fine in computer if open same page in mobile displaying second , going off. here code html <button id="yo1">click</button> jquery $(document).on('vclick','#yo1',function(){ var message = '<input name="im_user" type="text" class="valores" id="im_user"/><input name="im_password" type="password" class="valores" id="im_password" /><input name="inputads" type="submit" id="inputads" value="ingresar" />', popupafterclose = ''; runtimepopup(message, popupafterclose) }); function runtimepopup(message, popupafterclose) { var template = "<div data-role='popup' class='ui-content messagepopup'>" + "<a href='#' data-role='button' data-theme='g'

java - Google in-app billing library isn't showing in SDK Mananger -

i downloaded , installed eclipse java ee ide: . made simple application runs on device ; want publish app . i not able see in-app billing library in extras section of sdk manager. i told found in sdk manager under "extras". proceeded in eclipse window > android sdk manger. waited done fetching , went "extras". making sure "updates/new" checked "installed"; however, under "extras" tab "android support package" , "google play service" , "google usb driver", "intel emulator" , in-app billing library missing . and here ... stuck on need do. any appreciated. install latest android sdk tools using sdk manager click - > check updates in eclipse open sdk manager again shows packages...

jquery - TweenMax not scrolling smoothly on tablets/smartphones -

i using scrollmagic in site in order make animation. can see animation here: http://jsfiddle.net/vrbg2/2/ and code using can see in jsfidde similar this: var toptobottom = new timelinemax() .add(tweenmax.to("#section3", 1, {margintop: "0"})); var scene = new scrollscene({ triggerelement: "#section1", }) .addto(controller) .settween(toptobottom); my problem on tablets/smartphones, iphone, ipad , android animation looks bad. slow , not smooth @ all. see problem in code. , should use other plugins making work better in tablets/mobile? thanks in advance try adding autoround:false since animating margin-top css property, doesn't animate on sub-pixel level. using autoround:false animate on sub-pixel level .. i.e. margin-top: 100.9999px example: http://jsfiddle.net/zb754q92/ var toptobottom = new timelinemax() .add(tweenmax.to("#section3", 1, {margintop: "0", autoround:false})); autoround part of gsa

algorithm - Formal Correctness proof for Greedy solution for Wine trading (SPOJ)? -

don't me wrong posting question problem on online judge. want know how prove correctness of solution. following problem wine trading problem . says there houses in row @ unit distance , each house either wants sell or buy wine. total demand = total supply. work done in transaction amount of wine involved times distance. problem fulfill demand of houses in minimum work. proposed solution first seller(say starting right side of row) sells first buyer(the amount = min(seller,buyer))(this greedy choice) , solve remaining problem. how can 1 formally prove correct? not sure formal want it, here intuition of proof. to simplify note suppliers '+' , others '-'. wlog, start supplier @ left side. have choice of buyer. + - - suppose didn't choose first one. + - - <==============> then have feed first 1 supplier, , reason have chosen him is closer first buyer. can @ left or @ right of first buyer. left + + - -

c# - How can I do an outer join with EF 6.1 -

i have following: var tests = await db.tests .include(t => t.exam) .where(t => t.teststatusid == 1) .select(t => new testdto { examname = t.exam.name, id = t.testid, questionscount = t.questionscount, title = t.title }) .tolistasync(); return ok(tests); how can make still returns tests if there no matching exam particular test? try this: //first step var tests = db.tests .include(t => t.exam) .where(t => t.teststatusid == 1); //next step if(testc.exam != null && testc.exam.count > 0) { testc = testc.select(t => new testdto { examname = t.exam.name, id = t.testid, questionscount = t.questionscount, title = t.title }); }

python - Unable to load data with quotes in mysql -

i need load string contains quotes given below..the data being loaded using mysqldb python package... value = " leading epic "zero year." " error _mysql_exceptions.programmingerror: (1064, 'you have error in sql syntax; check manual corresponds mysql server version right syntax use near \'zero year."" how can load strings contain quotes within it... have tried using escape character, i.e. " leading epic \"zero year.\" "

php - download counter increases by thrice when using a download manager like IDM -

i have created simple php download counter, upon clicking download link, captures , saves details ip, file-name, no of times download has been made, etc. works fine far. counter gets incremented each download made, problem pops when 1 uses idm (or similar download managers); then counter gets incremented thrice each download! the code i'm using looks (on wordpress environment) - global $wpdb; $db_table_name = $wpdb->prefix. 'test_downloads_info'; $sql = "select download_count $db_table_name download_name = %s"; $result = $wpdb->get_row($wpdb->prepare($sql, $download_name), array_a); // if row fetched has values.. if(!empty($result) && !empty($result['download_count'])){ // increment counter one.. $download_count = $result['download_count'] + 1; // , update corresponding row.. $update_r

iphone - Localization of iOS application -

Image
i tried localized app english french i've trouble problem,i converted strings english french language here below screen shots english , french. french language but didn't response in app can please suggest me,any changes....! finally found way localization . make localized strings follow below steps first select language editor area 2.then after choose different languages. 3.next click use base internationalization now,click finish button. 4.the next step localize our xib files this 5.then,covert xib files localizedstrings localized strings 6.and add 1 file our project i.e click next , save file name localized. 7.now localized.strings file add localize languages final step go click product->scheme->new scheme , select applelanguages and want change language called code finally found how localization.

javafx - Eppleton tileengine missing libraries. net.java.canvas.GraphicsContext -

im trying run eppletons javafx tileengine there library missing can't find. net.java.html.canvas.graphicscontext web --> http://jayskills.com/blog/2013/01/09/writing-a-tile-engine-in-javafx/ link git repo --> https://github.com/eppleton/fxgameengine any ideas? fount !!! its 1 of eppletons own projects. insert project dependency! -> https://github.com/eppleton/canvas/commit/30724e61bdb5eb4e955b865c88299da3dbdf2840 commit needed because newer versions not campatible game endgine. (check dates of last commits in gameengine canvas project) this library missing in files can found searching maven repositories(netbeans). import org.openide.util.lookup.serviceprovider; hope somone! wrote ticket in gitrepo. hope fix it. link reported issue: https://github.com/eppleton/fxgameengine/issues/5

How to run .exe executable file from linux command line? -

i have 1 abc.exe executable file in windows. able execute application using dos command promt , give run-time variable it. i want same in linux system terminal. how can this?? windows exe files can't run on linux. might successful wine emulates ms windows, though: wine abc.exe what mean runtime variable? command line argument, or environment variable?

Ruby on Rails - Error making new app (rb:55:in 'require') -

i've been following mike hartl's excellent ruby on rails tutorial `. i had make decisions earlier versions gem files , ruby. decided (after problems getting heroku work i'd directly mimic tutorial , versions of ruby described - leading me go rvm use 2.0.0 set version of ruby. all great on chapter 1 i'm getting error message when try create new rails project: $ rails new demo_app /home/huw/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- rails/cli (loaderror) /home/huw/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require' /usr/bin/rails:9:in `' i have no idea means... referencing ruby version i'm guessing rails , ruby versions out of sync... could advise on possible courses of action? i imagine possible options be: reset ruby version latest (but don't know clashes create gems!) downgr

javascript - setInterval() timings are... off? -

i'm baffled this... appears overly-complex system of setinterval() lines, off tad. maybe timings trying catch up? it's little weird , i'm not sure why. http://jsfiddle.net/dr3amtw1st/hv3fa/embedded/result/ var number=0; // not change! var key1=true, key2=false, key3=false, key4=false, key5=false; // not change! var key6=false, key7=false, key8=false, key9=false; // not change! var climbspeed=2000; // climbing speed in milliseconds. don't change unless know you're doing. var raised=100; // amount raised far. able changed. var goal=250; // goal, obviously... :p able changed. var c1=setinterval(function(){document.getelementbyid("amount").innerhtml="$"+number++;},climbspeed); var c2, c3, c4, c5, c6, c7, c8, c9, c10; var check=setinterval( function() { if (number>0 && key1==true) { key1=false; clearinterval(c1); climbspeed=1500; c2=setinterval(function(){document.getelementbyid("amount&quo

mysql - One-to-one relation through pivot table -

okay have soccer website im building when user signs team , and 6 different stadium chose from. have teams table: ---------------------------------------- | user_id | team_name | stadium_id | ---------------------------------------- | 1 | barca | 2 | ---------------------------------------- then decided make stadiums own table ---------------------------------------------- | id | name | capacity | price | ---------------------------------------------- | 1 | maracana | 50000 | 90000 | ------------------------------------------------ | 2 | morombi | 80000 | 150000 | ------------------------------------------------ to teams arena name have arena_id teams table , fetch arena name id. don't think efficient gave thought , think best solution adding pivot table so: | id | arena_id | team_id | ---------------------- ---------------- | 1 | 2 | 1 -----------------

html - Adding pinch-zoomable div image to a non-scalable viewport on mobile devices -

consider following viewport meta tag: <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui" /> the content on page non-scalable , mobile responsive. sometimes, need overlay large image on top of it, , allow user pinch-zoom image. #overlay_div { position: fixed; top: 0; left: 0; height: 100%; width: 100%; background-color: #dddddd; z-index: 550000; overflow: scroll; -webkit-overflow-scrolling: touch; } <div id="overlay_div"> <img src="largeimage.jpg" width="100%"> </div> currently, aware of 2 possible options: programmatically change viewport meta allow user scaling (possible cross-browser implications, causes content underneath scale not desirable) use hammer.js manually handle pinch event , scale div/image accordingly (seems complex possible compatibility implications). does k

c# - Castle Windsor resolve array of generic interfaces -

i have assembly amount of implementations of same generic interface. register of them in 1 shot using following registration in windsor: types .fromassembly(assembly.getexecutingassembly()) .basedon(typeof(iquery<,>)) now array of registered implementations if try castle bombs: container.resolveall(typeof (iquery<,>)) why? @steven right, not possible resolve generic types without knowing types embed. there 2 ways sidestep problem either have closed list of possible input , outputs types, on can iterate in order resolve specific combinations for var type1 in possibletypes1 var type2 in possibletypes2 var list = container.resolveall(typeof(iquery<,>).makegenerictype(type1, type2) this not elegant can queries. i'd propose second alternative. if want resolve queries, must have operation want call on them, or information out. if operation or information should exist inside base non-generic interface generic interface inher

javascript - Dependency Injection of functions with Factories (AngularJS) -

i have few functions used in different controllers, , rather copy , paste multiple times controllers, want pull out , place in factory. however, when try call function in html via angular {{expressions}} doesn't work. instead, i've made functions inside each of controllers' $scopes call factory's functions dom can read expressions--but seems redundant. there way fix can call functions factory? here had tried: index.html : <div ng-controller="mycontroller"> rating of item is: {{makegraph.getrating(whichitem)}}<br /> votes of item is: {{makegraph.getvotes(whichitem)}} </div> mycontroller.js : controllers.controller('mycontroller', ['$scope', 'makegraph', '$routeparams', function($scope, makegraph, $routeparams){ $scope.whichitem = $routeparams.itemid; //no other reference makegraph here }]) factory.js : app.factory('makegraph', function(){ var service = {};

c# - Is there a way I can run a Database.SqlQuery as async? -

i have following: var sql = @"select case when test.testtypeid = 1 exam.name when test.testtypeid = 2 topic.name end name, test.title, test.testid, test.questionscount test left join exam on test.examid = exam.examid left join topic on test.topicid = topic.topicid test.teststatusid = 1 -- current"; var tests = db.database.sqlquery<testdto>(sql).tolist(); i looking async method not seem exist. there way can run async? if you're using entity framework 6 need specify using system.data.entity; at top of file. tolistasync extension method on iqueryable<t> declared in system.data.entity.queryableextensions

c# - Translate Pinch touch gesture to scroll mouse wheel -

i don't know if it's right community, if it's not, please point me should ask. i need application can translate pinch gesture make on touch screen mouse wheel scroll. because have wpf control (whose code cannot access) not browseable using touch, , therefore need listens gesture events , translates them other events... i'm using windows 8.1. thank help.

Choosing "From" field using python win32com outlook -

i trying automate emails using python. unfortunately, network administrators @ work have blocked smtp relay, cannot use approach send emails (they addressed externally). i therefore using win32com automatically send these emails via outlook. working fine except 1 thing. want choose "from" field within python code, cannot figure out how this. any insight appreciated. if configured separate pop3/smtp account, set mailitem.sendusingaccount property account namespace.accounts colelction. if sending on behalf of exchange user, set mailitem.sentonbehalfofname property

php - Read textfile with delimiters at all lines -

i have textfile looks this: name=arthur lastname=mcconnell age=43 what array this: array ( [name] => arthur [lastname] => mcconnell [age] => 43 ) all appreciated. $filename = 'info.txt'; //read file line-by-line array $contents = file($filename); //loop through each line foreach($contents $line) { //split = sign $temp_array = explode('=', $line); //rebuild new array $new_array[$temp_array[0]] = $temp_array[1]; } //print out array @ end testing var_dump($new_array);

google app engine - Android Studio with AppEngine - Gradle dependencies -

i'm trying simplest example android studio create own backend this tutorial. backend built , seems it's creating client libraries well. the server starts , can access localhost:8080 when try build android app now, app cannot find following classes import com.google.api.client.extensions.android.http.androidhttp; import com.google.api.client.extensions.android.json.androidjsonfactory; import com.google.api.client.googleapis.services.abstractgoogleclientrequest; import com.google.api.client.googleapis.services.googleclientrequestinitializer; neither client model (called registration, in sample). how have setup dependencies of project in gradle, project can find correctly generated client libraries? currently: apply plugin: 'android' android { compilesdkversion 19 buildtoolsversion '19.1.0' defaultconfig { applicationid 'de.unicate.cloudchat' minsdkversion 19 targetsdkversion 19 versioncode 1

cloud storage - Shared folder in owncloud -

whe share folder (named sharefolder) user2 , when log in user2 can see sharefolder "shared" folder in home, how can change name of folder ?, thanks owncloud 7 rid of shared folder; instead, shared files identified overlay icon representing “shared me”. (if users upgrading, can continue use shared folder have.) owncloud 7 released on july 23rd 2014. have @ page: http://owncloud.org/seven/

php - column type and if statement -

guys! want make statement: cost 1-3 -> maximum in inventory = 10 cost 4-6 -> maximum in inventory = 5 cost 7-9 -> maximum in inventory = 3 cost on 10 -> maximum in inventory = 1 when product cost db, example 6.00, works, but, if product cost db example 6.50, doesn't work, i've tried these types column : double,float,int of them didn't work me :'( code if($fetch->product_cost >=1 , $fetch->product_cost <= 3){ print " <td width='10px'>10</td> "; }elseif($fetch->product_cost >=4 , $fetch->product_cost <= 6){ print " <td width='10px'>5</td> "; }elseif($fetch->product_cost >=7 , $fetch->product_cost <= 9){ print " <td width='10px'>3</td> "; }elseif($fetch->product_cost <=10){ print " <td width='

python - How to specify more than one include directories for setup.py from command line? -

here found how write setup.py file compiling own c/c++ modules python, can't specify more 1 include directories command line. please tell me syntax how should specify list of directories command line setup.py . i found solution should this python setup.py build_ext --inplace --library-dirs=lib_dir1;lib_dir2 --include-dirs=inc_dir1;inc_dir2

c# - Win Phone 8 app and checking apps from same publisher installed on device -

in msdn documentation says within application can check if app has been installed same customer , launched within app. part of documentation following link below launching, resuming, , multitasking windows phone 8 you can use apis windows.phone.management.deployment namespace see if other apps publisher id installed on phone. if they’re installed, can use api launch them. demonstrate, following example enumerates apps current publisher id , launches first app in enumeration (unless app happens current app). ienumerable<package> apps = windows.phone.management.deployment.installationmanager.findpackagesforcurrentpublisher(); apps.first().launch(string.empty); i want check existence of app on device publisher id, without publishing application or making beta test takes time. i can publisher id company publishing app (this external me). question is, there way test in real time while debugging code. example changing publisher id in manifest?

jquery - Subscribe to Change event for all checkboxes with a certain string in their id -

i want subscribe change event checkboxes in datalist control on asp.net page. i able these checkboxes using jquery below, cannot find way subscribe change event. how using jquery below? $("input[id*='cbxcolumn']").each(function (index, cbx) { cbx.onchange = " togglesearch()"; }); jquery has function called .bind() perfect application! try this: $("input[id*='cbxcolumn']").each(function (index, cbx) { $(cbx).bind("change", function(){ togglesearch(); }); }); for more info check out link: http://api.jquery.com/bind/ or more simple example using .change() function: $("input[id*='cbxcolumn']").each(function (index, cbx) { $(cbx).change(function(){ alert(); }); }); more info on this: http://api.jquery.com/change/

mysql - PHP Script for Login doesn't work -

i'm trying make php login script. here's code: <?php $mysqli = new mysqli("localhost", "root", "yespassword213", "staffcenter"); $query = $mysqli->query("select * members username = '$_post[user]' , password = '$_post[pass]'"); function signin() { session_start(); if(!empty($_post['user'])) { $row = $query->fetch_assoc(); if(!empty($row['username']) , !empty($row['password'])) { $row['username'] = $_session['username']; $row['password'] = $_session['password']; $row['admin'] = $_session['admin']; echo '<meta http-equiv="refresh" content="0; url=areaprivata.php" />'; } else echo "password errata!"; } } if(isset($_post['submit'])) { signin(); } ?> i don't know w