Posts

Showing posts from May, 2015

html - removing left/right padding on col-md-6 Bootstrap -

i have site utilizing bootstrap want override left , right padding on columns col-md-6 (set them 0px). not sure how it, current set ... css .fix-gutters > [class^="col-"], .fix-gutters > [class*=" col-"] { padding-right: 0px; padding-left: 0px; } and applying <div id="main" class="row fix-gutters"> .... <div class="col-md-6"> ... etc. but col-md-6 gets replaced (wordpress loop) col-md-12 div , don't want .fix-gutters apply if that's case. note: need override happen on same level col-md-6 command. example <div class="col-md-6 overide-class"> this target them you: (will make change elements inside main div) #main > .col-md-6{padding-right: 0; padding-left: 0;}

angularjs - How do I prompt a modal when the user leaves my website in Javascript/Angular? -

is there way in angular or javascript detect user leaving website (can closing browser or entering page) , prompt modal? in modal want ask user why leaving. also, oke have this? website black listed due "annoying: feature? with angular use $scope.$on("$locationchangestart",function(){ //do stuff here }); to detect when user leaves page. if use alert('your message'); , browser problably give user option block alerts site.

sql - Update Fields Automatically -

i'm pretty new here , don't resort forum post unless can't figure things out searching solution on own i'm stuck. work in department , developing tool used compare across 3 data pulls see missing data. data supposed accounted in 3 databases need find discrepancies not match. data used across of our car dealerships , pulled 3 providers give us. (example: our website listing, cars on sale in our inventory, , third deals web listings on other sites). unfortunately, whenever export each site dealership locations not match exact same syntax. have 3 tables in sql database reuploaded user each month. have case statements written can run query change each matching dealership in way matches syntax across 3 tables. example 'ford denham' , 'denham ford' changed 'asfd' acronym use dealership. now have reports have created sql report builder. problem is, of queries written if location 'asfd' can match records based on location. when user uploa

python - Examples for Formatters in pyexcel -

i working on project, replacing xlwt pyexcel. xlwt, there bunch of ways style cells, columns etc. in pyexcel, there bunch of references of formatters like: sheet.column.format(col_index, formatter=some_object) but can't find reference of these objects are. also, there references datatypes, not sure valid values said data types. any can provide appreciated! for excel files, default, numbers read float, can converted them string following: sheet.column.format(0, str) as formatter = some_object , think can use datatype keywords provided python float,str... . hoped can you.

PHP OOP: How to get database values and return all of them -

i trying results database , return them screen, problem once "echo" value's show up, when use "return" 1 shows up. i can't use echo because application build on way puts html functions can fill objects , fill content of page. here code. public function read() { $query = "select id, title, description, datetime seminar"; $result = $this->getdb()->query($query); while(($row = $result->fetchobject()) !== false) { foreach($row $value) { return $row->title; //$this->setdescription($row->description); //$this->setdatetime($row->datetime); } } } now wondering how value's on screen instead of 1 showing now. public function setseminar($sem_obj) { $this->sem_obj = $sem_obj; } public function render() { $this->content = ' on page can see items. '; $this->content .= $this->sem_obj->gettitle(); $this->content

python azure blob storage md5 check fails on blob upload using put_block_blob_from_path -

i trying upload blob azure blob storage python sdk. want pass md5 hash validation on server side after upload. here's code: blob_service.put_block_blob_from_path( container_name='container_name', blob_name='upload_dir/'+object_name, file_path=object_name, content_md5=object_md5hash ) but error: azurehttperror: md5 value specified in request did not match md5 value calculated server. the file ~200mb , error throws instantly. not upload file. suspect may comparing supplied hash perhaps hash of first chunk or something. any ideas? this sort of sdk bug in should throw better error message rather hitting service, validating content of large upload has chunked doesn't work. x_ms_blob_content_md5 store md5 service not validate it. on download though. content_md5 validated server body of particular request since there's more 1 chunked blobs never work. so, if blob small enough (below blob_max_data_size) p

mysql - Trigger not working all the time -

here's trigger. create trigger `data_temp_after_insert` after insert on `data_temp` each row begin declare nextinc int default 0; // have try define varchar... declare idrad varchar(75); declare idio_bat varchar(75); declare uniqueid varchar(75); declare serverid varchar(75); select idradio idrad radio radio.xb_sl=new.xb_sl , actif=1 limit 1; select id_io idio_bat io io.idradio=idrad , noio=1 , actif=1 limit 1; select idserverinfo serverid serverinfo actif=1; select auto_increment nextinc information_schema.tables table_name = 'io_data' , table_schema = database( ) ; set uniqueid = concat(serverid,'-',nextinc); if new.battery not null , idio_bat not null , idio_bat != 0 update io_data set valueread=1, datemodification=now() id_io=idio_bat , valueread=0 , actif=1; insert io_data (id_io_data, id_io, readingvalue, timestamp) values (uniqueid, idio_bat, new.battery, new.timestamp)

How to include jquery in mean.io app -

i have link " https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js " in index.html of mean.io app how , include url in mean.io app. use script tag in head of index.html <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

android - How to convert Bitmap to Base64 String -

i developing android application uploads base64 string of image web server. therefore, have used following code convert bitmap base64 string. public string getencoded64imagestringfrombitmap(bitmap bitmap) { bytearrayoutputstream stream = new bytearrayoutputstream(); bitmap.compress(bitmap.compressformat.png, 100, stream); byte[] byteformat = stream.tobytearray(); string imgstring = base64.encodetostring(byteformat, base64.no_wrap); return imgstring; } for example, need convert image . after conversion, i'm not getting base64 string expected. ivborw0kggoaaaansuheugaaaicaaab7cayaaabet5noaaaabhncsvqicagifahkiaaab/fjrefuejzt3u1a4lgxb/d/uvqps3ibnuokzeg56fqkml6bqru0nddxitwrbwbtdhp3oduaicuqvobylkbmsndy3ghedkgggzvkjjm/kr8hxpp8pbk55ioqkjhvoci97lnmqbjxfuwhah4nwp6amqmpab4yefbq3v/637tjjtcut2cxvyfjuqbjzq4cqal4toflpra/m9mgye1aca786eyiyqxszryangpaby8jty6r25p+9wdn64zv4+flohh1ahvsdkjysw8h7eey1a6ofvxbatydr7rxv6qhckfsb3difp/irrwr4xlcjvqgyjxio4a6lr+tw62r1bui38y417xosga

css - SVG in D3--scaling across browsers -

Image
instead of generic svg shapes, want bind external svg icons data d3. can this group = svg.selectall("g") .data(dataset) .enter() .append("g"); group.append("svg:image") .attr("xlink:href",path) .attr(...) etc run several scaling issues. this fiddle embeds exemplary icon. running in 3 different browsers, 3 different renderings. chrome best: edge: firefox: i've added viewport attribute, appears in various guides on how scale svgs, doesn't seem no matter coordinates set to. how can make scaling behave in chrome in browsers?

ruby - Generating token is returning nil in rails -

hi trying generate token authenticate rails api client. have used generate_key_method in mode class. class apikey < activerecord::base before_create :generate_access_token validates :access_token, uniqueness: true def generate_access_token begin self.access_token = securerandom.hex end while self.class.exists?(access_token: access_token) end end inserts null while creating record before_create callbacks happen after validation. in case, uniqueness validation failing , halting callback chain before before_create callbacks can triggered. can set access token before validating on create: before_validation :generate_access_token, on: :create please see page on active record callbacks more information , whole ordering.

scala - No ClassTag available for T -

import org.apache.spark.api.java.javardd import org.apache.spark.rdd.rdd import scala.reflect.classtag class testrdd[t: classtag](rdd: rdd[t]) extends javardd(rdd) this statement accepted console. @ compile time following error thrown: no classtag available t [error] class testrdd[t: classtag](rdd: rdd[t]) extends javardd(rdd) [error] ^ [error] 1 error found [error] (jobs/it:compileincremental) compilation failed i think want this: class testrdd[t](rdd: list[t])(implicit c: classtag[t]) extends javardd(rdd) use implicit auto implicit classtag of generic t .

Android add fragment multiple times but just one instance found -

my activity contains 1 fragment list of items. activity class: public class categoryactivity extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_subcategory); setupactionbar(); categoryfragment fragment = (categoryfragment) getsupportfragmentmanager().findfragmentbyid(r.id.category_fragment); fragment.setbrand(mbrand); } @override public void ondestroy() { super.ondestroy(); uiutils.unbinddrawables(findviewbyid(r.id.rootview)); categoryfragment fragment = (categoryfragment) getsupportfragmentmanager().findfragmentbyid(r.id.category_fragment); if(fragment != null) getsupportfragmentmanager().begintransaction().remove(fragment).commit(); system.gc(); } public static class categoryfragment extends fragment { private listview mlistview;

how to count up to a specific number in javascript, fizzbuzz -

i'm trying solve problem similar popular fizzbuzz or pingpong question. figured out how write portion of code, need make counter in user inputs number , page gives 1 number input, fizzbuzz/popcorn numbers. think code along lines of for (i = 1; <= 20; i++) {...} but don't know how combine other code var pingpong = function(number) { if (number % 15 === 0) { return 'pingpong'; } else if (number % 5 === 0) { return 'pong'; } else if (number % 3 === 0) { return 'ping'; } else { return false; } }; sorry, know super beginner question, i'm starting out , having hard time figuring out how works together. you close. read more javascripts loops . var pingpong = function(number) { if (number % 15 === 0) { return 'pingpong'; } else if (number % 5 === 0) { return 'pong'; } else if (number % 3 === 0) { return 'ping'; } else { return false; } }; (var = 1; <= 20; i+

html - Number section on button -

Image
i'm trying create button looks this: the tricky part getting number 'fit' inside of button. how have button set up: <button type="text" class="textclass"><span class="numberclass">33</span>text</button> this css: .textclass { width: 90px; height: 30px; background-color: #fff; border: 1px solid blue; color: blue; font-size: 10px; line-height: 12px; font-weight: 600; text-transform: uppercase; border-radius: 2px; padding-left: 20px; } .numberclass { background-color: blue; color: #fff; position: absolute; left: 0; top: 0; height:30px; width: 30px; border-radius: 2px 0 0 2px; } setting height , width of number seems unnecessary, , can't number line unless extremely specific positioning not ideal. going wrong here? plunk: http://plnkr.co/edit/0wus3y2axmovfb7tswcb?p=preview try define .textclass position:relative;overflow:hidden; , .numberclass line-h

python 2.7 - How to decide whether if run a function by user in script -

i got 2 function in script : def a(): print a def b(): print b how decide whether if run function 'b' user? advance #at starting of script take username input name = raw_input("enter name : ") name.lower() #to make input name lowercase if name == 'bob': #name have call b b() else: a()

web services - How to fetch some data from a webService to our Activity in android../ -

i working on project have use existing web sevice(a payment gateway provided third party vendor) through android app. my problem after payment procedure done. want return data(transaction id , date) activity order placement can confirmed.` the webservice loaded of webview browser using loadurl(uri url) method. (given have no access code of webservice how fetch data activity). please provide me appropriate solution. edit: webpages corresponded payement gateway webservice exists , loading them through webview. now 4 webpages traversed , payement procedure done want send data host activity.

c++ - string.find(" ") is not finding spaces -

i'm trying find space in string user inputs. want use find() std::string return position of space. if input "seattle, wa usa", , want find(" ", 0) return 8 , how this? 8th space after "," string inputstring = " "; cout << "enter string modify" << endl; cin >> inputstring; int spac = inputstring.find(" " , 0); but find() keep returning 0 . not sure why. you're not reading space ( cin >> inputstring stops on whitespace...). use std::getline(std::cin, inputstring) instead.

getstream io - Stream-rails - Model method activity_should_sync? being ignored -

i've started playing stream-rails gem , , have flat , user feeds working more or less. one of models being made activity when instance created - even though activity_should_sync ? implemented return false. it seems inside method not run @ all, including puts. appreciate advice class post < activerecord::base ... include streamrails::activity as_activity def activity_should_sync? false end def activity_object self end the activity_should_sync? method not released in latest gem yet (upcoming 2.4). 2.4 gem released on rubygems next week. in meantime can install latest version github directly.

curl - Salesforce REST API with PHP, INVALID_SESSION_ID after successful authentication -

i connected web app salesforce , followed steps in web server oauth flow access_token , related info: https://developer.salesforce.com/docs/atlas.en-us.api_placeorder.meta/api_placeorder/intro_understanding_web_server_oauth_flow.htm every step seems return expected set of results specified in docs, when try make requests final access token, error saying session id invalid. here code: // execute request access_token , related info $output = json_decode(curl_exec($ch)); curl_close($ch); var_dump($output); // extract token , instance_url output $sf_url = $output->instance_url . '/services/data/v35.0/'; $sf_auth = 'bearer ' . $output->access_token; // execute new curl request auth values $ci = curl_init(); curl_setopt($ci, curlopt_url, $sf_url); curl_setopt($ci, curlopt_returntransfer, true); curl_setopt($ci, curlopt_httpheader, array( 'accept' => '*/*', 'authorization'

ios - How to fix audio distortion issue in iPhone 6s/iPhone 6s -

i'm developing live streaming app. have issue audio distortion on both iphone 6s , 6s plus. know apple has changed audio hardware sample rate (to 48000hz). i have tried following code, still audio gets distorted: -(void) setupaudiospeaker { nserror * audiosessionerror = nil; [[avaudiosession sharedinstance] setcategory: avaudiosessioncategoryplayback error: &audiosessionerror]; if (audiosessionerror) { dlog(@"avaudiosession error %ld, %@", (long)audiosessionerror.code, audiosessionerror.localizeddescription); } nstimeinterval bufferduration =0.01; [[avaudiosession sharedinstance] setpreferrediobufferduration:bufferduration error:&audiosessionerror]; if (audiosessionerror) { dlog(@"error %ld, %@", (long)audiosessionerror.code, audiosessionerror.localizeddescription); } double samplerate = 48000.0; [[avaudiosession sharedinstance] setpreferredsamplerate:samplerate

unity3d - How to make FBX model climbing on a slope -

Image
related image below: tank fbx model, imported "generate colliders" checked. want make tank walking slope in front of it, resize cube unity ediftor. tried different approaches : added rigidbody tank (receiving message error), added rigidbody cube. nothing works. this tank setting capture could me ? you should uncheck 'is trigger' option cube, it'll stop tank colliding in cube

Laravel API throws FileNotFoundException when accessed through an android app -

i'm working on api using laravel 5.2. have disabled csrf token commenting \app\http\middleware\verifycsrftoken::class in kernel.php . if access api postman works charm when using android app filenotfoundexception . please help. can post code , other details if want. in advance. sorry issue on android side not on laravel. resolved now. the issue was setting http codes myself in laravel. problem if set code in range 4xx( 404), android consider error , show filenotfoundexception , neglect stream in connection. changing getinputstream geterrorstream resolved problem. geterrorstream reads stream if response code kind of error 404,422 ,etc. hope explanation sufficient.

Disable Npm warnings as Errors: build definition tfs -

Image
i getting npm warnings errors during build using build definition. i added following property in msbuild arguments in build definition : /p:treatwarningsaserrors=false but not working yet. i cross-checked right-clicking each project , none of them has option "treat warnings errors" checked. i calling npm install command post-build script. i restarted build controller , build agent after changes tried no success. any in direction appreciated. msbuild arguments won't here... post-build script runs after msbuild has finished executing. the problem npm writing warnings stderr stream, tfs detects , reports error. can suppress redirecting error stream stdout so: npm install 2>&1 however, suppress errors warnings, may or may not acceptable in case. in our case, call npm install powershell script during pre-build script. redirect output, scan output looking string err! so: & npm install *>&1 | foreach-object { $ob

c++ - Differentiating additive types? -

my first steps in generic programming consists of writing simple function accumulates sum of vector passed argument. catch function should work types values makes sense sum. the code simple: template <typename t> t accumulate_sum (const std::vector<t>& v) { // check type , decide whether sum or return nothing t sum = v[0]; (size_t = 1; < v.size(); ++i) sum += v[i]; return sum; } the question how differentiate additive types? a template function imposes implicit interface on template parameters. if there no operator+= type t , compiler error. #include <cstddef> #include <vector> using namespace std; template <typename t> t accumulate_sum (const std::vector<t>& v) { // check type , decide whether sum or return nothing t sum = v[0]; (size_t = 1; < v.size(); ++i) sum += v[i]; return sum; } struct test {}; // not additive int main() { std::vector<test> v { test{}, test{}

Android in app billing (IAB) onIabSetupFinished not being called -

working from this have implemented iab , appears set correctly when execute mhelper.launchpurchaseflow(this, "android.test.purchased", 10001, mpurchasefinishedlistener, "bgoa+v7g/yqdxvkrqq+jtfn4uqzbpiqjo4pf9rzj"); i sent correct iab purchase test. however code below never seems output logging mhelper = new iabhelper(this, key); mhelper.startsetup(new iabhelper.oniabsetupfinishedlistener() { public void oniabsetupfinished(iabresult result) { if (!result.issuccess()) { // oh noes, there problem. log("problem setting in-app billing: " + result); } else { log("oniabsetupfinished " + result.getresponse()); mhelper.queryinventoryasync(mgotinventorylistener); } } }); note: own static log method being called , there no problem it. once set want check purchases doesn't appear called, neither mpurchasefinishedl

java - Adding .jar with javadoc to android studio -

i have 2 files: library.jar , library-javadoc.jar . how can import library project in android studio, such android studio show me javadoc when mouse on library? clear, problem isn't getting library project because i've done that. struggling find way attach javadoc. i've been tearing hair out , i've googled answer million times can't find anything. don't understand why has hard, dead easy in eclipse.

c# - How to get the openxml.spreadsheet.cell screen display value -

Image
i have c# application reads uploaded excel file (.xslx) created in excel 2013 i read each cell putting each cell collection of cells per collection of rows using c# openxml library. the code works correctly except doesn't read formatted excel cell value correctly. here how cell shows in excel: and fromatting: i have examined documentformat.openxml.spreadsheet.cell cell properties cell when c# application reads none of cell properties equals value of may-15 want. i noticed cell.datatype , cell.cellformula both null cannot used determine format. the cell.innertext value "42125". if change cells format in excel general displays 42125. i using code this article here code snippet using for (var = 0; < rows.count; i++) { var datarow = new list<string>(); data.datarows.add(datarow); var row = rows[i]; var cellenumerator = getexcelcellenumerator(row); while (cellenumerator.movenext()) { var cell = cellenumerato

python - Link to a page in django cms, first check if it exists -

i things in django template, django-cms: {% load cms_tags %} <a href="{% page_url 'imprint' %}">imprint</a> on production, fails silently, , href attribute empty. on development, i'm forced insert page id "imprint", otherwise "doesnotexist" exception. how can improve situation? maybe i'm looking like {% if 'imprint'|cms_page_exists %} ...the link , stuff... is there known best practice (not quite seldom) use case? or use shown first? you assign tag result variable , check empty: {% page_url 'imprint' url %} {% if url %} <a href="{{ url }}">imprint</a> {% endif %} other ways imply creating own template tag or filters, above simplest 1 imho. see example in docs .

redirect - Laravel 5.1 index.php throwing reflection error and could not locate the controller -

i trying setup laravel 5.1 project in 1 of our testing server (lamp - debian linux, apache 2.4). copied entire laravel project dev machine testing machine. did necessary configuration. have created custom controller named logincontroller. when try reach out http://192.168.0.1/index.php getting below error. my controller looks - namespace app\myfolder\controllers; use app\http\controllers\controller; use app\user; use validator; use illuminate\foundation\auth\throttleslogins; use illuminate\foundation\auth\authenticatesandregistersusers; class logincontroller extends controller { use authenticatesandregistersusers; protected $username = 'username'; public function __construct() { require app_path() . '/common/constants.php'; } public function index() { return view('myfolder/themes/' . select_theme . '/login'); } } please help. reflectionexception in container.php line 741: class \app\myfolder

php - Getting data from similar columns but from different dynamic tables in MySql -

i have multiple dynamic tables like { user_details_1 user_details_2 user_details_6 user_details_9 } all these tables contain same columns structure { user_id start_date end_date } but have delete rows of users who's end_date lower today. what need {delete information_schema.tables.table_name 'user_details_%' end_date <= now()} i need query purpose because above query not working.

javascript - Compare and sort strings in multiple languages -

i need sort in js strings alphabetically. in english sorting quite easy: sortarr.sort( function ( , b ) { return > b ? 1 : -1; } ); however app working on translated i.a. arabic, chinese, german, russian , few others. can see non ascii characters results seems not right. i found intl.collator().compare according docs: the intl.collator object constructor collators, objects enable language sensitive string comparison. however, it's not supported safari , of mobile browsers. is there other solution can use? edit there string.prototype.localecompare() browser support not enough too. short answer no. every language has own alphabetic order. example russian has letter 'с' in different order turkish. option imo use collator when possible (browsers support it). afaik there aren't other ready-to-go libraries or object can use achieve this.

java - Android SQLite database is locked when pressing power button (screen off) -

i'm getting large amount of information server , loading them in sqlite database (about 4000 rows). i'm using following code insert info: string db_path = "/data/data/com.example.app.myapplication/databases/"; string db_name = "mydb.sqlite"; sqlitedatabase sqdb = sqlitedatabase.opendatabase(db_path + db_name, null, sqlitedatabase.no_localized_collators); try { //getting info sqdb.begintransaction(); string[] all_elements = all.split("_"); (int j = 0; j < all_elements .length; j++) { if (all_elements [j].length() >= 1) { m.setlength(0); m.append("insert .....the query"); m.append(");"); sqdb.execsql(m.tostring().replaceall("\n", "").replaceall("\r", "").replaceall(&q

java - Sending JSON from Android to Nodejs server -

i try send request android device nodejs server using httpurlconnection con = (httpurlconnection) (new url(ip + "/getrestaurant")).openconnection(); con.setrequestmethod("post"); con.setrequestproperty("accept", "application/json"); con.setdoinput(true); con.setdooutput(true); con.connect(); con.getoutputstream().write("{'restaurant_id':'569a16e28dcdc5c8add2a8e0'}".getbytes("utf-8")); con.getoutputstream().flush(); con.getoutputstream().close(); when print received request node js get: { "{'restaurant_id':'569a16e28dcdc5c8add2a8e0'}": "" } instead of {'restaurant_id':'569a16e28dcdc5c8add2a8e0'} how can work? thanks! as comment says(i have low reputation comment), {'restaurant_id':'569a16e28dcdc5c8add2a8e0'} not valid context also advice use koush ion library json requests . https://github.com/koush/ion it

java - Read files in a Task -

i'm beginner in java , javafx. have problem, want count pdfs in folders , want show process in progressbar. i know quantity of pdf's , must check if there. the method read folder's is: private void dir(file fileroot) { file[] files = fileroot.listfiles(); for(file file : files) { if(file.isdirectory()){ dir(file); } else{ string dateiname = file.getname(); if(dateiname.endswith(".pdf")){ ++countpdf; system.out.println(countpdf); } } } the method update progressbar is: private task<boolean> createworker() { return new task<boolean>() { @override protected boolean call() throws exception { updatemessage(countpdf + ""); updateprogress(countpdf, number); } return true; }; } how

Html5 cache Manifest not working -

i'm trying html5 offline storage working in basic way. html file <html manifest="12thpayment.appcache" lang="en" ng-app="mainapp"> this 12thpayment.appcache file cache manifest https://cdnjs.cloudflare.com/ajax/libs/svg-morpheus/0.1.8/svg-morpheus.js https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.8/angular-ui-router.min.js payments.html ../../js/jquery-2.1.4.min.js ../../bower_components/angular/angular.min.js ../../bower_components/angular-animate/angular-animate.js ../../bower_components/angular-aria/angular-aria.js ../../bower_components/angular-material/angular-material.js ../../uimicrokernel/uimicrokernel.js ../../js/directivelibrary.js ../../js/12thdirective.js js/controllers/paymentmodule.js js/controllers/configpayment.js js/controllers/paymentservice.js js/controllers/paymentadd.js js/controllers/paymentupload.js js/controllers/

excel - Add text to the photo using Photoshop action -

i have worksheet image filename ( column a ) , text added( column b ) image respectively in 2 different columns. images has been saved in separate folder task: text defined in column b added right corner of respective image defined in column a . is there solution using photoshop actions , vba. you can automate entire thing excel, using vba. won't need photoshop actions. in excel's vba editor, need make reference adobe photoshop object type library, , use automation objects top open image file, add text , save.

ruby - How to set a negative message expectation with a verifying double in RSpec? -

i test conditional call obj.my_method in following code: def method_to_test(obj) # ... obj.my_method if obj.respond_to?(:my_method) # ... end obj can either foo or bar . 1 implements my_method , other doesn't: class foo def my_method; end end class bar end my test structured this: describe '#method_to_test' context 'when obj foo' let(:obj) { instance_double('foo') } 'calls my_method' expect(obj).to receive(:my_method) method_to_test(obj) end end context 'when obj bar' let(:obj) { instance_double('bar') } 'does not call my_method' expect(obj).not_to receive(:my_method) # <- raises error method_to_test(obj) end end end the first example passes second raises error when setting negative message expectation because obj verifying double not implement my_method : #method_to_test when obj foo calls my_method when obj bar not call my

ffmpeg command to merge file with good quality -

i looking better command can merge both audio & video files 1 better quality. i found command muaz khan's webrtc apis. ffmpeg -i {$audiofile} -i {$videofile} -map 0:0 -map 1:0 {$mergedfilename} later on server had add "-strict -2" command on server says above command experimental if still want use should add "-strict -2" it. it working video file (.webm) size 2.2mb , audio file (.wav) size 1.5mb merged new file (.webm) size 422.5kb. new video file having lag. also want meta information duration of video written on resulting video file. is there command can give merged file without lagging , both video , audio of new file of quality ? use ffmpeg -i {$audiofile} -i {$videofile} -map 0:0 -c:a libopus -map 1:0 -c:v copy {$mergedfilename} this encode audio, leaving video intact. use libvorbis if libopus isn't present in ffmpeg.

c# - A Dependent Role has multiple principals with different values -

i using enitity framework codefirst , have following design public class location { public int id { get; set; } public string name { get; set; } public bool isdeleted { get; set; } } public class delieryrate { public int id { get; set; } public int originid { get; set; } public location origin { get; set; } public int destinationid { get; set; } public location destination { get; set; } public double amount { get; set; } public bool isactive { get; set; } } i not want define relationship on location. when update database, works referential integrity error when run seed code. have tried configure using fluent api follows modelbuilder.entity<deliveryrate>() .hasrequired(e => e.origin) .withoptional() .willcascadeondelete(false); modelbuilder.entity<deliveryrate>() .hasrequired(e => e.destination) .withoptional() .willcascadeondelete(false);

Why am I getting a NoClassDefFoundError in Java? -

i getting noclassdeffounderror when run java application. typically cause of this? this caused when there class file code depends on , present @ compile time not found @ runtime. differences in build time , runtime classpaths.

ios - How to retain backing of a CAMetalLayer? -

i unable find way retain backing cametallayer, nextdrawable provides different mtltexture each time pool. if set appropriate loadaction , storeaction on render pass descriptor, backing not happen. contents flash textures swapped nextdrawable call. i want similar behaviour keagldrawablepropertyretainedbacking in opengl es. anyone figured 1 out? nextdrawable provide texture in undefined state, , far know there isn't simple option keagldrawablepropertyretainedbacking change behaviour. however, apparently possible implement copy keeping old drawable around little longer , manually performing gpu copy previous texture next. https://devforums.apple.com/message/1060027#1060027 you will, however, have set cametallayer.framebufferonly no, comes 'at cost performance' according documentation ( https://developer.apple.com/library/ios/documentation/animation/reference/cametallayer_ref/#//apple_ref/occ/instp/cametallayer/framebufferonly )

web applications - How to Convert python Tkinter desktop App to Web App -

i have wrote python(2.7) gui desktop application using tkinter library , working fine. want convert web application. have looked pyjaco , pyjamas not getting done. how can convert web app ? thanks in advance.. you have rewrite app. there no way convert tkinter application run on web. potentially use pyjs convert of business logic, entire gui have rewritten.

css - Edit Menu Action for Bundles/Packages in Sublime Text 2 -

i switching textmate sublime , having trouble getting "custom menu action" work in sublime. menu action line of code co-worker wrote compiles less (css preprocessor) [filename].less , automatically minifies , updates 2 other files upon saving. updated files are: 1. [filename].css , 2. [filename].css.vtl. use cms runs on velocity, , use way throw css onto page reduce http requests. may sound dumb, have enormous multi-tenant instance of on 800 sites, etc. here code: #!/bin/sh # compiles less , creates css , css.vtl file # lessc added usr/local/bin dir, add path path=$path:/usr/local/bin # filename without extension filename=${tm_filepath%.*} # filetype of current file (will handle multiple . in filepath) filetype=${tm_filepath##*.} # compile if less document if [ "$filetype" == "less" ]; lessc "$tm_filepath" "$filename".css lessc "$tm_filepath" "$filename".css.vtl --compress echo "successfully cre

android - Stuck solution for my cordovaFile / cordovaFileTransfer trial, still Error -

anybody success use plugin cordovafile & cordovafiletransfer? i have failed understand , failed miserably execution. case wants make upload , download controller. each tested via browser, appears file / filetransfer not defined in firebug. when made console.log as: console.log($cordovafile); or console.log($cordovafiletransfer); or console.log($cordovafiletransfer.download); or console.log($cordovafiletransfer.upload); its return true, form of {object}. but when call methods included parameters, example: $cordovafiletransfer.download (urlserver, filetarget, {}, true); direct emerge error: filetransfer not defined. i tried move download function service, , controller call function (the umpteenth time search results on google). result same, above error. because there user in forum said should / tested through device, try upload ionic.io & sync via apl ionic view on smartphone. result nothing. i tried improvise little, try method checkdir / checkfile follo

ios - Missing 64-Bit support while Uploading to AppStore -

i trying validate , upload app app store.but ended error error missing 64-bit i made changes adding arm64 in valid architectures , standard architectures(armv7,arm64) - $(archs_standard) build active architecture - no after adding there error coming " ('nsinteger' (aka 'long')) not match type of instance variable 'stage' ('int') ". i changed int "nsuinteger" , error link command error. is app doesn't support 64-bit??. int --> nsinteger . ps: int == signed int != unsigned int

date - WebLogic 10.3.6 java.text.SimpleDateFormat variables does not work in log file name -

i'm trying set own log file name format , testing this: to include time , date stamp in file name when log file rotated, add java.text.simpledateformat variables file name. surround each variable percentage (%) characters. for example, if file name defined myserver_%yyyy%_%mm%_%dd%_%hh%_%mm%.log, log file named myserver_yyyy_mm_dd_hh_mm.log. when log file rotated, rotated file name contains date stamp. example, if log file rotated first time on 2 april, 2003 @ 10:05 am, log file contains old messages named myserver_2003_04_02_10_05.log00001. but result is: -rw-rw-r-- 1 weblogic weblogic 20k jan 21 13:00 myserver_yyyy_mm_dd_hh_mm.log any ideas, can wrong? because, not rotated log file. current log, , named correctly after real rotation. thanks devwebcl

How can i get array key-values pair using javascript -

for(i=0;i<=array_values.length;i++){ var a=array_values[i].amounts; var t=array_values[i].tax; alert(a); alert(t); } error : typeerror: array_values[i] undefined var a=array_values[i].amounts; var a=array_values[i].amounts; change for(i=0;i<=array_values.length;i++) to for(i=0;i<array_values.length;i++) <= <

mockito - Method getReadableDatabase in android.database.sqlite.SQLiteOpenHelper not mocked -

i'd test methods inside databasehelper class. develop android studio. use mockito testing , got error message running test: method getreadabledatabase in android.database.sqlite.sqliteopenhelper not mocked. this databasehelper class: public class databasehelper2 extends sqliteopenhelper { //the android's default system path of application database. private static string db_path = "/data/data/com.example.b.mywm/databases/"; private static string db_name = "429"; private sqlitedatabase mydatabase; private final context mycontext; /** * constructor */ public databasehelper2(context context) { super(context, db_name, null, 1); this.mycontext = context; } public void opendatabase() throws sqlexception { //open database string mypath = db_path + db_name; mydatabase = sqlitedatabase.opendatabase(mypath, null, sqlitedatabase.open_readonly); } @overrid

ios - I have a UITableViewController that presents a UIActionSheet, how do I make an action sheet option bring up a modal view? -

i'm having lot of trouble this, , can't seem find answer situation. i have uitableviewcontroller has button, upon being clicked presents uiactionsheet few options. want 1 of options bring view controller have present in storyboard, ready shown. the uiactionsheet implemented, actionsheet:clickedbuttonatindex: well, don't know within it. i tried having within it: nsstring *buttontitle = [actionsheet buttontitleatindex:buttonindex]; if ([buttontitle isequaltostring:@"text"]) { addtextviewcontroller *addtextviewcontroller = [self.storyboard instantiateviewcontrollerwithidentifier:@"addtextviewcontroller"]; [self presentviewcontroller:addtextviewcontroller animated:yes]; } but error saying: no visible @interface 'rootviewcontroller' declares selector 'presentviewcontroller:animated: that's not working either. what supposed doing here? there no such method presentviewcontroller:animated: . method presentviewc

mysqli - Duplicate Temporary Table MySQL -

i want reference temporary table multiple times in same query. due problem temporary tables cannot that: http://dev.mysql.com/doc/refman/5.7/en/temporary-table-problems.html so fix i'm creating duplicates of temporary table: create temporary table if not exists earnings_temp_one (select * earnings earning_account_id = ?); create temporary table if not exists earnings_temp_two (select * earnings earning_account_id = ?); create temporary table if not exists earnings_temp_three (select * earnings earning_account_id = ?); but requires me query massive table earnings 3 times, extent defeats purpose. is there way me duplicate temporary table, under different name? then run query on massive table once. or maybe there's fix temporary table problem doesn't require me create duplicates? ok, solved it: create temporary table if not exists earnings_temp_one (select * earnings earning_account_id = ?); create temporary table if not exists earnings_temp_two (s