Posts

Showing posts from May, 2012

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";

c++ - How to find the code that blows up the size of my application? -

i have c++ windows application uses stl, boost , several other libs. application not have big size. have find way reduce size of app, not understand part of these libraries blows size of app. (maybe can switch stl/boost, or implement smth myself, or smth different way, etc...) does have tools/guides investigate imported symbols , find out give biggest increment size of app? update i'm asking release build. i not ask configuration of compiler, ask tool tell parts of code give biggest increase of size of app. all libs included statically. therefore if remove heavy-weight dependencies size of app smaller. boost big library. if need boost not need stl. if stl enough needs can use stl. also, think can configure visual studio print output trace of linking process. some ideas inspecting libs here: how see contents of windows library (*.lib) tools inspecting .lib files?

layout - How to prevent west and East elements from overlapping center in BorderLayout -

Image
i'm trying create layout in sketch i want have vertical slider in center, 1 spanlabel on left , on right. i've tried using borderlayout, spanlabels overlap slider if texts long. there layout use achieve similar style or fix borderlayout? centerabsolute , centercenter don't in fixing this. i'd use tablelayout percentages each column achieve sort of layout. borderlayout assumes preferred size of elements on sides/top/bottom isn't big cover it's bit problematic in use cases.

python - Stop a command line command in script -

this question has answer here: programmatically executing , terminating long-running batch process in python 3 answers i'm writing script in want able run command line command, os.system("stuff"). if command doesn't end on own? like, in terminal have ctl+c end it. there way can run it, stop it, , grab output? i'm sure there has don't know it, , i'm not sure if know correct terminology find (all python self-taught experimenting) thanks! os.system() not return control of subshell spawned it, instead returns exit code when subshell done executing command. can verified by: x = os.system("echo 'shankar'") print(x) what need subprocess library. can use subprocess.popen() function start subprocess. function returns control of subprocess object can manipulated control subprocess. the subprocess module pr

google analytics api - GA Multiple websites showing 'Active Users' info in the same view -

Image
is possible use google analytics api show active users sections multiple stores in same view? such: want hide drop down combobox drives selection , want able trigger right event passing ua-12344-1 value load number of active users given site. i'm trying code work triggers event when dropdown value changes in dropdown combobox ga account. want force multiple ga events fire on page load. javascript activeuserscom.once('success', function() { var element = this.container.firstchild; var timeout; this.on('change', function(data) { var element = this.container.firstchild; var animationclass = data.delta > 0 ? 'is-increasing' : 'is-decreasing'; element.classname += (' ' + animationclass); cleartimeout(timeout); timeout = settimeout(function() { element.classname = element.classname.replace(/ is-(increasing|decreasing)/g, ''); }, 3000); }); }); v

javascript - select all form elements that are selected as well as non-selectable form elements -

i have markup looks this: <form> <select class="form-control" id="follower_id" name="event[task_followers_attributes][0][follower_id]"> <option value=""></option> <option data-typeahead-associated-id="1" value="1" selected>administrator</option> <option data-typeahead-associated-id="2" value="2">marketing guy</option> </select> <input type="hidden" data-typeahead-associated-id="2" name="event[followers_attributes][1][id]" value="2"> </form> i want find form elements have data attribute "data-typeahead-associated-id". however, if form element form element selectable (e.g. select, radio button), want data-typeahead-associated-id 1 selected. since input fields not have multiple options, want input fields match "data-typeahead-associated-id" attribute. there

javascript - Issue in using template in the view in backbone.js -

i have question related backbone.js , need help. cannot understand difference between: currentcustomerstemplate : currentcustomerstemplate, maincustomertemplate : _.template(maincustomertemplate), i mean template _. , 1 not have it! suppose have form (customer form) , inside form want make (separate) forms related each customer. every time add customer button information each 1 goes currentcustomer form , "in" main customerform . (can multiple tables inside bigger table). have 2 templates. whats difference of first , second? _.template () 'compiles' raw template template object , can provide different parameters 'compiling'. can read underscore template doc in here more details. by following said, "currentcustomerstemplate" should have been compiled before , template object. should see in somewhere prior being referred , there must _.template() being called already.

php - add product to zen cart website from external campaign site -

i having campaign site , find way customers selecting products on campaign site , send product information zen cart site , add items cart directly. therefore, customers no need select products again in zen cart site, chance,anyone know how do? please help! seems cart accepts post data you'd have make post form on campaign site product ids hidden fields , submit button sending customer site; there's example here: <form name="cart_quantity" action="http://www.company.com/shop/index.php?main_page=product_info&amp;action=add_product" method="post" enctype="multipart/form-data"> <input type="hidden" name="cart_quantity" value="1" /> <input type="hidden" name="products_id" value="1" /> <input type="image" src="yourimage.png" alt="add cart" title=" add cart " /> which found on thread: http://www.ze

.net - How to programatically monitor GC activity in a C# application? -

this question has answer here: monitoring garbage collector in c# 1 answer i have c# console application in i'd programatically (without aid of visual studio) monitor gc activity. example, if have code: public static void main() { (int = 0; < 100000; i++) allocatebytearray(); } private static void allocatebytearray() { new byte[1000]; } is there way use gc class monitor how many times garbage collection occurs while loop running? tried this: console.writeline("before:"); console.writeline(gc.gettotalmemory(false)); // work... console.writeline("after:"); console.writeline(gc.gettotalmemory(false)); console.writeline("after collection:"); console.writeline(gc.gettotalmemory(true)); but realized measurements weren't telling me anything, since gc occurred while doing work. i'm not familiar gc apis in .net

linux - Why might cd call the function ':'? -

i using ubuntu (amazon ec2), , when type cd , happens: $ cd hi hi hi hi hi hi hi hi hi $ i had made : function: : () { echo hi; } this happens in top-level shell $shlvl=1 , not in subshell (typing bash trying reproduce not work). does know why may happening? what did poor idea because : shell null command. it useful time time in constructs require command. instance, if want code infinite loop using while , helps: while true ; : done take out : , it's not well-formed more: do requires command. out of following 3 one-liners, last 1 correct—try them: while true done while true ; done while true : ; done if redefine : function, question is: defined? never mind that, suppose works. suddenly, these occurrences of : crop in scripts time time calling function! what cd in amazon ec2 shell environment? maybe it's function. type set , browse through output. i've defined custom cd function; it's useful do. can things dynamically update p

encryption - Is there a way to hide this AES URL php -

is there way hide aes url ? fiddler , softwares alike? it's fine if see final url when scan it, dont want them see encryption. because script, using view-source, can't view source...but when scanning fiddler. shows content header(location: xxx i hope, clear enough in want , please can me out. thank you. <?php /** * xml protecting * */ include("uye/baglanti.php"); $diger_eleman = $_server['http_user_agent']; $kullanici_adi = $_get["username"]; $parola = $_get["pass"]; $sorgula = mysql_query("select * uyeler kullanici_adi='{$kullanici_adi}' , parola='{$parola}'") or die (mysql_error()); $uye_varmi = mysql_num_rows($sorgula); if( strstr($diger_eleman, 'mozilla/5.0 (windows nt 6.1; wow64; rv:19.0) gecko/20100101 firefox/19.0') , $uye_varmi > 0) { header("location: 35kkpunrq6rzb/ifzcimnhat4+rcndifnywvg6tjdqw="); #is there way can hide url/content? appearing on

I want to rewrite my joomla site link -

Image
i dont have knowledge joomla, site link siteurl/services/digital-antenna-installation-brisbane want redirect or change siteurl/digital-antenna-installation-brisbane can please me on guide me how should in joomla. tried far editing .htaccess file. did follows. rewriterule ^services/digital-tv-antenna-installation-brisbane$ /digital-antenna-installation-brisbane [r=301,l] but did not work. can guide me how it. in advance. creating redirect navigate redirect component components->redirect here see list of links have been found missing on website, e.g. 404 errors. don't alarmed if there hundreds or thousands here. common, search engine spiders , spam bots trying crawl websites or hack websites , indicator of happening in areas. filter view find 404 error page trying redirect or click new of error page doesn't exist. the next screen show properties of redirection. the first field url of broken link. vanity or short url. the second field url of wan

altbeacon - Cannot Detect Alt-beacon in android -

i using radius networks altbeacon library in android app , whenever broadcast altbeacon locate app , app cant detect altbeacon . this beacon parser :- mbeaconmanager.getbeaconparsers().add(new beaconparser().setbeaconlayout("m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25")); this android studio logcat :- 06-11 11:43:45.239 15797-16636/optimus.com.optimusiothome d/beaconparser:ignoring pdu type 01 06-11 11:43:45.239 15797-16636/optimus.com.optimusiothome d/beaconparser: processing pdu type ff: 02011a1aff4c0002152f234454cf6d4a0fadf2f4911ba9ffa600000000c50000000000000000000000000000000000000000000000000000000000000000 startindex: 5, endindex: 29 06-11 11:43:45.239 15797-16636/optimus.com.optimusiothome d/beaconparser: not matching beacon advertisement. (was expecting ac. bytes see are: 02011a1aff4c0002152f234454cf6d4a0fadf2f4911ba9ffa600000000c50000000000000000000000000000000000000000000000000000000000000000 whenever transmit altbeacon locate app in iphone b

css3 - Why only css files are displayed while inspecting an element? -

first when used inspect element in chrome browser during web development, used display exact scss (css pre-processor)file in styles present. helpful. when inspect element showing computed css file. can't figure out has happened browser. should settings changed? kindly suggest solution. you're missing source map file ( .map ) from chrome devtools docs : for preprocessors support css source maps, devtools lets live-edit preprocessor source files in sources panel, , view results without having leave devtools or refresh page. when inspect element styles provided generated css file, elements panel displays link original source file, not generated .css file. check if chrome has featured enabled: css source maps enabled default. can choose enable automatic reloading of generated css files. to enable css source maps , css reload: open devtools settings , click general. turn on enable css source maps , auto-reload generated css

bash - Remove duplicates (both lines) and duplicate only based on a sub-string -

maybe can me following problem. i use: cat file1 file2 | sort -t} -k2 | less the output contains duplicates when comparing starting position 5 in line a01} value1 = 5000000000 b01} value1 = 5000000000 a01} value2 = 6000000000 b01} value2 = 7000000000 how can remove these both lines: a01} value1 = 5000000000 b01} value1 = 5000000000 completely output? the result should be: a01} value2 = 6000000000 b01} value2 = 7000000000 i assume want sort/uniq using fields key 2 (value) key 4 (the number). field 1 skipped when invoking uniq : cat file1 file2 |sort -k 2,4 |uniq --skip-fields=1 --unique

android - How to catch bugs on clients' devices? -

i've seen many bugs on clients devices cannot reproduce on own devices. far, solution publish hidden app , let them report app crashes. is there better way? namely, app crashing on clients tablet, while not on my. how can catch crash? try using acra library https://github.com/acra/acra need publish new version in case.

How to query documents using “_id” field in Java mongodb driver without using the collection name? -

this document, want get. {"_id": {"$oid": "5747f303631e1e261019914d"}, "school": "aaa", "name": "kamal", "likes": 200} i want passing _id without giving collection. public dbobject finddocumentbyid(string id) { basicdbobject query = new basicdbobject(); query.put("_id", new objectid(id)); dbobject dbobj = collection.findone(query); return dbobj; } as searching different documents in different collections, don't want in collection _id belongs. without saying collection.findone(query) . how documents? you must mention collection. can try this. for(string collectionname : mongooperation.getcollectionnames()){ dbcollection collection = mongooperation.getcollection(collectionname); dbobject query = new basicdbobject(); query.put("_id", new objectid(id)); dbcursor cursor = dbcollection.find(query); if(cursor.hasnext()){

angular - Angular2 and typescript - how to add an array to a array from promise? -

in controller, make rest call create table. need append fixed rows , dont know how it. i want this: export class environment { id: string; name: string; } environments: any[]; production = new environment('1', 'production'); development = new environment('2', 'development'); ngoninit(){ this.environmentservice.getenvironments() .subscribe(environments => this.environments = environments,null,() => { this.isloading = false; }); } so how add array promise result?" [this.production,this.development] + this.environments; results of proposed solution: staging: environment = { id: '111', name: 'staging' }; environments = [this.staging]; [ { "id": "111", "name": "staging" }, [ { "id": "86aa96e8-0383-4bce-b833-be3c21f47306", "name": "cloud" } ] ] the name cloud ser

c# - After registering to my website instead of inserting the data to the sql server, an error message appears -

in asp website have register form sends data database. when user enters data, after submitting, error appeared says: a network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: sql network interfaces, error: 26 - error locating server/instance specified) this code: signup.aspx.cs- protected void submit_click(object sender, eventargs e) { string name = request.form["name"]; string email = request.form["email"]; string password = request.form["password"]; string filename = "database.mdf"; string sql = "insert userinfo values('" + name + "','" + email + "','" + password + "')"; myadohelper.doquery(filename,sql); } myadohelper.doquery- public static void doquery(string filename, string s

php - Why does mysqli_fetch_assoc generate an error -

this question has answer here: mysqli_fetch_array()/mysqli_fetch_assoc()/mysqli_fetch_row() expects parameter 1 resource or mysqli_result, boolean given 33 answers this question has been asked, , i've followed answers i'm still getting error 'mysqli_fetch_assoc() expects parameter 1 mysqli_result' my code $host = "localhost"; $user = "my_user"; $user_pass = "my_password"; $dbase = "my_database"; $conn = mysqli_connect($host, $user, $user_pass, $dbase ); if (!$conn) { die("connection failed: " . mysqli_connect_error()); } $sql="select id, customer_name, date_ordered, amount orders status_id=5 , date_ordered >= '2016-01-01 00:00:00'"; $result = mysqli_query($conn, $sql); if($result === false) { die(mysqli_error($mysqli)); } var_dump($result); echo 'test = '

Firebase - Is there a security concern to let clients of the database know the uid of other clients? -

tl;dr: there security concern let clients of database know uid of other clients? example: can auth object created known uid query database user? i need superusers define default values inside respective node. then, regular users (that belongs superuser "group") can define own values, if there's key that's not defined user, client of user node can fallback superusers default values. but accomplish it, need users know uid of respective superuser. a sample database be: { "superusers": { "k32kd2dd8f9vf9...": { "key1": "value1", "key2": "value2", "key3": "value3" } }, "users": { "t53ggft56df52g...": { "key2": "myvalue2", "key3": "myvalue3", "superuser": "k32kd2dd8f9vf9..." } } } in case, user "t53ggft56df52g.

python - Tensorflow error: InvalidArgumentError: Different number of component types. -

i want input batches of shuffled images training, , write code according the generic input images in tensorvision , error. cannot figure wrong. code: import os import tensorflow tf def read_labeled_image_list(image_list_file): """ read .txt file containing pathes , labeles. parameters ---------- image_list_file : .txt file 1 /path/to/image per line label : optionally, if set label pasted after each line returns ------- list filenames in file image_list_file """ f = open(image_list_file, 'r') filenames = [] labels = [] line in f: filename, label = line[:-1].split(' ') filenames.append(filename) labels.append(int(label)) return filenames, labels def read_images_from_disk(input_queue): """consumes single filename , label ' '-delimited string. parameters ---------- filename_and_label_tensor: scalar string te

Refresh folder under WebContent by java program (in eclipse project) -

i ‘m making web system (latest java8 & eclipse_mars.2 on windows 32x) . , system has file download function (files made java). when files(for download) placed in myproject/webcontent/tempfolder , , users can access these files url , can files. (i want manage web system under eclipse control. not on tomcat) but files (made java) not recognized eclipse. in prepairing server condition, when press download button on system , must wait 7--8 seconds. users not allow 7--8 seconds waiting (i think). (eclipse workspace setting ((window)-(preferences)-(general)-(workspace)) this: ・refresh on native hook or polling(checked) ・refresh on access(checked) ) researched programatcally refresh plugin in many web site, not find this. so started make eclipse-plugin , make myproject/webcontent/tempfolder refreshed programmatically, after java program set new file downloaded.. (now, workspace name “myworkspace_m”. dinamic web project name “myproject”. folder refreshed “myproj

c++ - Why does my custom iterator require a call operator in range based for loops? -

link mcve . we define matrix iterable both rows , columns. here's implementation of row-wise iterator: template<class real> class rowiterator { public: rowiterator() { } rowiterator(real* begin, size_t rows, size_t cols) : begin(begin), rows(rows), cols(cols) { } real* operator*() const { return begin; } real& operator[](size_t col) const { return begin[col]; } bool operator!=(const rowiterator& it) const { return begin != it.begin; } rowiterator& operator++() { begin += cols; --rows; return *this; } private: real* begin; size_t rows, cols; }; iterating on our matrix implemented using range object define follows: namespace details { template<class iterator> struct range { iterator begin, end; range() { } range(iterator begin, iterator end) : begin(begin), end(end) { } }; template<class iterator> iterator begin(const range<iterator>& range) { return range.begin; } template<class

mysql cannot grant privilege to user, getting error: ERROR 1819 (HY000): Your password does not satisfy the current policy requirements -

i in process of moving new application production environment includes mysql db. while attempting grant required privileges using command: grant alter,create on `mydb`.`*` `thisuser`@`*` ; i'm getting error: error 1819 (hy000): password not satisfy current policy requirements . and this, while passwords (of root user of thisuser ) satisfy current policy: the length of passwords above 8 chars, they include both upper , lower case, digits , special chars (like "!", "@", "$", etc.). i tried setting validate_password_policy low didn't either. can explain issue , how resolve it? thanks. this error time occurs when you've changed fields user host or password forgotten flush privileges. try: mysql>flush privileges;

ios - Check if NSMutableArray contains a given value -

i have nsmutablearray contains string values. have string variable , want check if contained in array or not. i tried using .contains() string say: cannot convert value of type string expected argument type... var mutablearray = nsmutablearray() // ["abc", "123"] var string = "abc" mutablearray.contains("abc") { // above error in line } multiple ways check element existence in nsmutablearray . i.e if mutablearray.contains("abc") print("found") else print("not found") or if contains(mutablearray, "abc") print("found") or if mutablearray.indexofobject("abc") != nsnotfound print("found") if want check existence of element according of version of swift swift1 if let index = find(mutablearray, "abc") print(index) swift 2 if let index = mutablearray.indexof("abc")

python - Jupyter notebook logging [Errno 32] Broken pipe -

Image
i'm observing strange behavior in current jupyter notebook setup: upon each warning or error reported i'm getting whole stackdump of broken pipe error in addition main error message being displayed. this gets extremely disturbing when 1 cell generates bunch of non-critical errors , browser window hangs trying render of accompanying stacktraces. idea in direction should investigate nail down? i've tried redirect logger.handlers[0] stdout , stderr described e.g. here , no effect (regular logger messages in logger.debug() , print() processed correctly). import logging logger = logging.getlogger() logger.handlers[0].stream = sys.stderr i'm using ipykernel 4.3.1 (python3)

java - Is there any way to use SSLContext with ServerSocketChannel? -

i have application need use serversocketchannel , socketchannel within, sslcontext gives me serversocketfactory gives serversocket , accepts connections in socket s. any solutions? thanks the 'basic' jsse .getsocketfactory , .getserversocketfactory indirectly create client-side sslsocket , or sslserversocket in turn creates server-side sslsocket , in either case subclasses socket (with added methods) , manages both ssl/tls protocol , network i/o in simple waited style simplest (most) applications. to use channels, must instead create sslengine handles only ssl/tls protocol , not network (or other!) i/o. read , write socketchannel yourself, sending data sslengine has 'wrapped' , giving received data 'unwrap'. for overview, see https://docs.oracle.com/javase/8/docs/technotes/guides/security/jsse/jsserefguide.html#sslengine has partial example code -- client; need modify changing setuseclientmode false , not using peer-identity hi

Java giving wrong result -

i have method in java program here giving wrong result on simple multiplication , not sure what's going on. maybe it's setting in eclipse need expand -- have no idea. simple this: 987,654,321 * 10. should 9,876,543,210. instead getting 1,286,608,618. in world? method reading in characters , adding tokenized number (not longer 10 digits) list. else works fine hates number reason. public void number(char dig, boolean lc){ int num = character.getnumericvalue(dig); if(number == 0){ number = num; } else{ number = number*10 + num; } if(lc){ if(string.valueof(number).trim().length() <= intlength){ tokenlist.add(number); number = 0; return; } else{ system.out.println("error in number entry. invalid or exceeded length: " + number); number = 0; return; } } } your value far outside range of intege

java - Why is the returned ResultSet null -

Image
given table structure: i want basic details of user database, created resulset named rst (see code below). when iterate on rst returns null . public resultset detail(string mobile) throws exception { dbconnect(); // make connection string sql = "select * profile mobile = ?"; preparedstatement pstmt = con.preparestatement(sql); pstmt.setstring(1, mobile); resultset rst = pstmt.executequery(); dbclose(); // connection closed return rst; } now if iterate on rst after having received return, null value. try { resultset rst = new db().detail(mobile); string fname = rst.getstring("firstname"); string lname = rst.getstring("lasttname"); string date = rst.getstring("dateofbirth"); system.out.println("first name : " + fname + "\nlast name : " + lname + "\ndate of birth : " + date); } catch (exception exc) { exc.printstacktrace(); } output: first nam

Android Studio: java.lang.RuntimeException: Unable to start activity ComponentInfo...: java.lang.IllegalArgumentException: column '_id' does not exist -

the full error: e/androidruntime: fatal exception: main process: com.myfavoriteplaces.myfavoriteplaces, pid: 32383 java.lang.runtimeexception: unable start activity componentinfo{com.myfavoriteplaces.myfavoriteplaces/com.myfavoriteplaces.myfavoriteplaces.listplaces}: java.lang.illegalargumentexception: column '_id' not exist @ android.app.activitythread.performlaunchactivity(activitythread.java:2695) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2769) @ android.app.activitythread.access$900(activitythread.java:177) @ android.app.activitythread$h.handlemessage(activitythread.java:1430) @ android.os.handler.

grails - Send the zip content to response before you complete the zip creation -

i have successfully, on "local-build", been able create temp-folder , add image files inside of zipped , downloaded user. unfortunately after deploying test-server, unable create such temp folder , thusly cannot zip , stream it, believe, due permission errors. @ pass. cannot gain access create folders on test-server, , either need store folder , files on s3 bucket , create zipoutputstream here -or- think may better solution if possible, "on-the-fly" send zip content response before complete zip creation. possible? , if how go doing so? there benefit method on storing files temporarily on s3 zipped , streamed. current code folder creation , zipping , streaming def downloadzip(){ def fname = params.fname // zipfile name passed in 'example.zip' def floc = params.floc //folder location passed in '/example' def user = user.get( floc long ) //get users files zipped def urllist = [] list ownedids //create t

sql - OperationalError when inserting into sqlite 3 in Python -

i'm populating database data parse json. when execute insert statement, error: sqlite3.operationalerror: no such column: none . of json data returns null , cause python insert none table, believe should fine? know problem is? traceback: traceback (most recent call last): file "productinfoscraper.py", line 71, in <module> ")") my insert statement in python: cursor.execute("insert productinfo values(" + str(data["data"]["product_id"]) + ", " + "'" + str(data["data"]["product_name"]) + "'" + ", " + "'" + str(data["data"]["ingredients"]) + "'" + ", " + "'" + str(data["data"]["serving_size"]) + "'" + ", " + str(data["data"]["calories"]) + ", " + str(da

reactjs - PropTypes in react es6 doesn't work -

i created component , want validate 1 of property. seems validation doesn't work. when access component, got below property undefined error: cannot read property ' map ' of undefined below component definition. import react, {component, proptypes} 'react' import carousel 'nuka-carousel' export default class diagnosticschedule extends component { render() { let {style, diagnostics, afterslide, beforeslide} = this.props // if(diagnostics === undefined){ // return (<div/>) // } return ( <div style={style}> <carousel style={style} decorators={null} afterslide={afterslide} beforeslide={beforeslide}> { diagnostics.map(diagnostic => { return ( <div style={styles.message}> {diagnostic.name} </div> ) }) } </carousel> </div> ) }