Posts

ios - How to add Cordova plugins to Xcode project with embedded Cordova WebView? -

i have xcode ios project have added cordova webview. i stumbled through tutorial. https://cordova.apache.org/docs/en/latest/guide/platforms/ios/webview.html how can add plugins it? if try use plugman suggest, error: plugman install --platform ios --project path/to/my/custom/xcode/project --plugin cordoba-plugin-console failed install 'cordova-plugin-console':cordovaerror: provided path "path/to/my/custom/xcode/project" not cordova ios project. of course true. instructions followed adding web view non cordova project. i tried adding plugins cordova ios project before bringing on config.xml , such own project. the result project launch these errors in xcode console: cdvplugin class cdvfile (pluginname: file) not exist. error: plugin 'file' not found, or not cdvplugin. check plugin mapping in config.xml. i tried bringing on plugins folder reference project project. (the 1 has files cdvlogger.h/m , cdvfile.h/m when this, build e...

java - Expand ImageView to maximum possible maintaining aspect ratio in Android -

i have found lots of answers in site they not working or single cases . in case: i load image , show imageview. the width of imageview must maximum possible: parent layout width. the height must 1 allows re-scale image maintaining aspect ratio. how achieve this? here layout imageview inside (currently have been using fitxy image not preserve aspect ratio, if using adjustviewbounds: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/layoutpicturegalleryitem" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="5dp" android:background="#e0e0de" android:orientation="vertical" > <imageview android:id="@+id/imageview" android:layout_width="match_parent" android:layout_height="match_pare...

asynchronous - Xamarin Android F# update UI in async block -

i'm new xamarin, , trying build simple android app f#. i'm trying load in data rest api async, , display it. understand interacting ui must done on mainthread, , there along lines of activity.runonuithread() . i've tried following: let onsearch args = let search = this.findviewbyid<edittext>(resource_id.search) let searchresults = this.findviewbyid<textview>(resource_id.searchresults) button.text <- search.text async { let! results = recipesearch.getrecipes search.text searchresults.text <- results } |> async.start button.click.add onsearch which throws exception interacting ui elements in thread. , this: let result = async { let! results = recipesearch.getrecipes search.text return results } |> async.runsynchronously searchresults.text <- result defeats purpose of doing async t...

In C#, How can I find the distance between the point and center of a circle? -

i'm come solution towards finding distance point , center of circle. i have add following method circle class, given point's x , y coordinates, in method returns whether or not point within bounds of circle or not. i think accomplish draw of circle center point , radius, have draw 2 others points, 1 inside circle , 1 outside. how determine point inside circle , point outside of circle? i'm asking distance between 2 points , center of circle. here's code i've written far. public bool contains(float px, float py) { (math.pow(x2 - x1, 2) + math.pow(y2 - y1, 2)) < (d * d); return mcontains; } well, if have property x , y , radius , you're given point (x1, y1) , can test if it's inside circle: bool isincircle(int x1, int y1) { return math.sqrt(math.pow(x1 - this.x, 2) + math.pow(y1 - this.y, 2)) <= this.radius; } then check both of points - 1 give true , other false if want have fun...

javascript - Node.js + MongoDB global variable and scope -

i'm trying make single connection mongodb , store response (database) in global variable, can re-use in seperate js file (like separate files routes). i'm following documentation example: https://mongodb.github.io/node-mongodb-native/driver-articles/mongoclient.html#mongoclient-connection-pooling . first try: var mongodb = require('mongodb'), mongoclient = mongodb.mongoclient, mongourl = "my_mongodb_url:port/database_name", global.db; mongoclient.connect(mongourl, function(err, database) { db = databse; console.log(db); // shows stuff } console.log(global.db); // shows undefined after research found possible fix problem: create global variable in node global prefix. it's still not working... second try: var mongodb = require('mongodb'), mongoclient = mongodb.mongoclient, mongourl = "my_mongodb_url:port/database_name", global.db; mongoclient.connect(mongourl, function(err, datab...

mongodb - Key length for Compound index -

i'm looking upgrade mongodb 2.4.x instance 2.6. part of process ran db.upgradecheckalldbs() method ensure data in correct state upgrade. check found number of records in database there index defined on field, key exceeded 1024 byte limit. is, saw errors of form: document error: key index { "v" : 1, "name" : "field_1", "key" : { "field" : 1 }, "ns" : "mydb.users" } long document indicating document contained value in field field exceeded 1024 bytes (the limit key). this straightforward resolve (i can remove index on field ), compound indexes. ex: have index following: document error: key index { "v" : 1, "name" : "email_-1_meta_-1", "key" : { "email" : -1, "meta" : -1 }, "ns" : "mydb.users" } long document does mean document had length of email , meta fields combined surpass 1024 bytes? or 1024 bytes ...

html - javascript equivalent of anchor href -

let's webpage http://localhost/myapp/route/index.html if click on: <li><a href="#secondpage">go second page</a></li> it change route http://localhost/myapp/route/index.html#/secondpage without reloading. now i'm trying same thing onclick , javascript instead of anchor tag. because need first before let angular router change template. <li><a onclick="myfunction()">payroll run history</a></li> myfunction(){ [... stuff ...] //change http://localhost/myapp/route/index.html#/secondpage without reloading page } to set anchor property: location.hash = "#/secondpage";