Posts

Showing posts from June, 2014

how to generate thumbnail of recently taken video from camera in android using camera2 API? -

mainactivity.java (this main class functionalities), need generate thumbnail of videos on corner of camera app & when thumbnail clicked play video. i have tried recycler view didnt worked. can me out ? import android.manifest; import android.annotation.targetapi; import android.content.context; import android.content.intent; import android.content.pm.packagemanager; import android.graphics.bitmap; import android.graphics.surfacetexture; import android.hardware.camera2.cameraaccessexception; import android.hardware.camera2.cameracapturesession; import android.hardware.camera2.cameracharacteristics; import android.hardware.camera2.cameradevice; import android.hardware.camera2.cameramanager; import android.hardware.camera2.capturerequest; import android.hardware.camera2.params.streamconfigurationmap; import android.media.mediarecorder; import android.media.thumbnailutils; import android.net.uri; import android.os.build; import android.os.bundle; import android.os.environment;

jquery - Unable to direct to html page in angularJS -

in angular app, want move html page after click on buton cannot move html page expected, configed in route that: angular.module("abc", ["ngroute"]) .config(function ($routeprovider) { $routeprovider.when("/checkout", { templateurl: "/checkoutpage.html" }); }); in page html : <a href="#/checkout" class="btn btn-default navbar-btn">checkout</a> after hit on checkout button link address show this: http://localhost:12312/index.html#!#%2fcheckout thanks help. change href url <a href="#/checkout"> <a href="#!/checkout"> hope solve issue. look here more details.

ruby on rails - How to search for the fields of the parent model through child model in polymorphic association -

class book < activerecord::base belongs_to :owner, polymorphic: true end class user < active record::base has_many :books, as: :owner end now book has 3 fields - name, owner_id , owner_type . need search name of user through books. something .. book.includes(:user).where("user_name ?","bla") can me this? if this: book.includes(:owner) can not eagerly load polymorphic association you error above. you need define relationship between book , user class book < activerecord::base belongs_to :owner, polymorphic: true belongs_to :user, foreign_key: 'owner_id', conditions: "owner_type = 'user'" end see here

bindy - How do we marshal with multiple BindyFixedLengthDataFormat models using camel 2.17.0? -

i trying upgrade camel-bindy-2.11.0 camel-bindy-2.17.0 , running problem when trying apply model consisting of multiple classes data set resulting in single text file. i had number of classes in package (com.sample.package) use marshaling using following code: constructor: bindyfixedlengthdataformat(string... packages) marshal done referencing bean: this bean call apply classes in package data being marshaled resulting in single file. it worked great camel-bindy-2.11.0 constructor above no longer available camel-bindy-2.17.0 has come across similar problem , let me know how solved?

javascript - Get all responses from calls to a specific server (localhost) -

i running iis , web app locally consists of angular frontend , c# backend. app makes calls , java api services externally. need able cache json responses coming java api services. there way of watching localhost (running iis development) json responses http requests stored ? i have looked angular interceptors, caching , haven't found looking for. aim store json responses if services layer down can reload stored json response , continue working mock data. can run local server (eg json-server) looks @ file , loads json there need populated made json responses if exist , hence watching of calls localhost needed. (i prefer javascript way of achieving open suggestions) thanks in advance

javascript - Adding increment to form input getting TypeError: qty_el is null -

i´m trying add increments in magento grouped items, code should follows javascript returning typeerror: qty_el null. think problem should when pass element id variable, can´t solve this. missing? there way this? hope me. <div class="add-to-cart"> <div class="qty-button form-group"> <input type="text" name="super_group_<?php echo $_item->getid() ?>" id="super_group_<?php echo $_item->getid() ?>" maxlength="12" value="<?php echo $_item->getqty() * 1 ?>" title="<?php echo mage::helper('core')->quoteescape($this->__('qty')) ?>" class="input-text qty group-qty form-control" /> <div class="box-container"> <div class="box-icon button-plus"> <input type="button" onclick="incre(2,'supe

c# - HtmlAgilityPack DocumentNode.SelectNodes() don't return data (XPath withoyt tbody) -

i have web page ( https://ekb.zarplata.ru/resume ). have choose names page. open html code key f12. after find suitable place in html code. after copy xpath. i have c# code: htmlweb web = new htmlweb(); var doc = web.load("https://ekb.zarplata.ru/resume"); var node = doc.documentnode.selectnodes("//*[@id=\"app\"]//div//div//div//div//div//div//div//div//div//div//div//div//div//div//div//div//div//div//span"); in method selectnodes paste xpath. after of variable node null . why variable node haven't data?

Why does my Groovy script run in the Jenkins Script Console but not as a Groovy Postbuild Script? -

this script runs in jenkins script console not groovy postbuild script. job = hudson.model.hudson.instance.getitem("myjob") build = job.getlastbuild() action = build.getaction(jenkins.metrics.impl.timeinqueueaction.class) jenkins ver. 1.625.3 groovy postbuild plugin v 2.0 it fails on last line. have metrics plugin installed v 3.0.11 should give me access metrics library. it seems have somehow import timeinqueueaction class int plugin, script console can access it. can help? edit: error get: 5:03:40 groovy.lang.missingpropertyexception: no such property: jenkins class: script1 15:03:40 @ org.codehaus.groovy.runtime.scriptbytecodeadapter.unwrap(scriptbytecodeadapter.java:50) 15:03:40 @ org.codehaus.groovy.runtime.callsite.pogogetpropertysite.getproperty(pogogetpropertysite.java:49) 15:03:40 @ org.codehaus.groovy.runtime.callsite.abstractcallsite.callgroovyobjectgetproperty(abstractcallsite.java:231) 15:03:40 @ script1.run(script1.groovy:3) 15:0

.net - ADFS MFA adapter customize Login Page : How to size the left pane of Login screen -

i've been working on adfs multi factor authentication adapter (in .net/c#). questions specific customizing login screen. i want reduce size of left pane of login screen gives me more real estate show 2nd factor auth ui (in right pane). looked thru lot of technet articles (referred below). nothing speaks of how size 2 panes on login screen. forums speaks of customizing images, logs, texts .etc nothing on sizing 2 panes. reference http://eimagine.com/adfs-3-0-logon-page-customization https://technet.microsoft.com/en-us/library/dn280950(v=ws.11).aspx https://technet.microsoft.com/en-us/library/dn636121.aspx

r - Classify date/time by tidal states -

i want classify df1 date/time tidal states given in df2 . thing df2 gives exact times when tide @ heighest high or low . i want change classifies tidal height based on being within 3-hour interval either side of high , low tide. df1 <- data.frame(date_time = as.posixct(c("2015-09-06 09:00:00 bst", "2015-09-06 09:48:00 bst", "2015-09-06 10:37:00 bst", "2015-09-06 12:00:00 bst", "2015-09-06 12:48:00 bst","2015-09-06 13:35:00 bst"))) > df1 date_time 1 2015-09-06 09:00:00 2 2015-09-06 09:48:00 3 2015-09-06 10:37:00 4 2015-09-06 12:00:00 5 2015-09-06 12:48:00 6 2015-09-06 13:35:00 df2 <- data.frame(date_time = as.posixct(c("2015-09-06 07:09:00 gmt", "2015-09-06 13:18:00 gmt", "2015-09-06 19:52:00 gmt", "2015-09-07 02:01:00 gmt", "2015-09-07 08:28:00 gmt", "2015-09-07 14:43:00 gmt")), tide_state = c("low", "high", &qu

Swagger not detecting Spring Data Rest APIs with Spring Boot -

i setup spring boot project including spring data rest , swagger: <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-data-rest</artifactid> </dependency> <dependency> <groupid>io.springfox</groupid> <artifactid>springfox-swagger2</artifactid> <version>2.4.0</version> </dependency> <dependency> <groupid>io.springfox</groupid> <artifactid>springfox-swagger-ui</artifactid> <version>2.4.0</version> </dependency> this swagger configuration: @configuration @enableswagger2 public class swaggerconfig { @bean public docket api() { return new docket(documentationtype.swagger_2) .select() .apis(requesthandlerselectors.any()) .paths(pathselectors.any()) .build(); } } excerp

html - CSS How to position div inside div so that it will always be 100% -

using css property 'position', how possible make div inside div 100% height of parent div, margin of 40px on top , on bottom? needs adjusting, if parent div 700px in height, child div 620px (700px - 80px margins). here example of mean: here parent div (green) tall, child (orange) must stretch fit space. and here parent (green) squashed, child (orange) must compensate squashing fit. thank in advance. edit: here html im working with: <div id="center-page"> <p id="center-page-title">blog</h1> <div id="content"> </div> </div> try this: #center-page { position: relative; background: green; height: 700px; } #content { position: absolute; background: orange; top: 40px; bottom: 40px; left: 0; right: 0; } <div id="center-page"> <p id="center-page-title">blog</h1> <div id="content">

Get Max value from table in hibernate -

i using below java(1.7) function max value hsql using hibernate 4.3: public int getmaxid() { session session = hibernateutil.getsessionfactory().opensession(); query q = session.createquery("select cast(s.id integer) student s order cast(s.id integer) desc"); list result = q.list(); return integer.parseint(result.get(0).tostring()); } but getting below error: error: unexpected token: ) required: in statement [select cast(student0_.idasinteger) col_0_0_ public.public.student student0_ order cast(student0_.id integer)desc] exception in thread "main" org.hibernate.exception.sqlgrammarexception: not prepare statement @ org.hibernate.exception.internal.sqlexceptiontypedelegate.convert(sqlexceptiontypedelegate.java:80) @ org.hibernate.exception.internal.standardsqlexceptionconverter.convert(standardsqlexceptionconverter.java:49) @ org.hibernate.engine.jdbc.spi.sqlexceptionhelper.convert(sqlexceptionhelper.java:12

c# - Adding new values to JSON (Unity3d) -

i need little help. i'm using json save of game progress values , working except i'm facing 1 issue. when try save new values overrides old ones don't want override old values wanna keep them , add new ones. can provide little help? i'm using litjson, here code: savedships savedships = new savedships(shipscount); jsondata data = jsonmapper.tojson(savedships); file.writealltext(application.datapath + "/ships.json", data.tostring()); i tried loading old values , adding new ones this: string fromjson = file.readalltext(application.datapath + "/ships.json"); data = jsonmapper.toobject(fromjson); data.add(new savedships(shipscount)); file.writealltext(application.datapath + "/ships.json", data.tostring()); but got argumentexception: unable wrap given object jsondata. thanks! use file.appendtext() instead of writealltext(). https://msdn.microsoft.com/en-us/library/system.io.file.appendtext(v=vs.110).aspx this s

typescript - Angular 2 get all directives of the same type inside the directive class -

i'm trying achieve active state on 1 of directives, element has directive on gets active class whenever isactive set true in directive instance. the issue can't seem pick more 1 directive @ given time, appears same element fetching other directives. export class modalopendirective { @contentchildren(modalopendirective) modalopendirectives: querylist<modalopendirective>; @input() modalid: string; @input() modaltemplate: string; public modalopen: string; constructor(private modalapi: modalapiservice) {} @hostlistener('click') open(): void { this.modalapi.open(this.modalid, this.modaltemplate); this.toggleactiveclass(); } @hostbinding('class.active') isactive: boolean; toggleactiveclass(): void { this.modalopendirectives.map((directive) => { directive.isactive = false; }); console.log(this.modalopendirectives); this.isactive = true; } } how can make sure picks other directives of

Regex replace in JavaScript for escaping special characters enclosed in single quotes -

in javascript file, have variable takes values following stringtobereplaced = input[name='wanna startin' somethin''] stringtobereplaced = input[name='they don't care us'] stringtobereplaced = input[name='workin' day & night'] the pattern input[name='*'] * anything. trying achieve escape single quotes , ampersand (' &) appearing in * field without escaping enclosing single quotes using regex replace. the regex have formed far follows , still pending ignore first single quote above pattern. i.e the single quote preceded = sign stringtobereplaced.replace(/((['&])(?!\]))/g,'\\$1')); any appreciated. you can try this: (?<!=)(['&])(?!]) (?<!=) negative behind = (['&]) select desired characters in character class , capture in group (?!]) negative ahead closing ] replace with: \ , captured group demo: https://regex101.com/r/cqbwtf/5

php - Nginx+apache. Different entry point -

i have apache (listen 8888) , nginx (listen 80). in nginx.conf location ~ \.php$ { root /var/www/web/; ssi on; proxy_pass http://127.0.0.1:8888; } in apache conf <virtualhost *:8888> loglevel info servername testserver.localhost documentroot /var/www/web/ <directory /var/www/web> allowoverride none directoryindex index.php addtype application/x-httpd-php .php </directory> </virtualhost> i want 2 entry point. testserver.localhost/forum/[anyfolders]/... bring index file in /var/www/forum/index.php any other bring index file in /var/www/web what changes need make in nginx.conf , apache conf?

c# - JSON to .Net Epoch date conversion -

i have simple webapi project. passing json date in epoch format "pickupbefore":"/date(1485360480-0800)/". when .net catches datetime shows year 1970. suppose january 25, 2017. should in real time? in .net application, catching date datetime. behind scene datetime structure filled date 1970. looking in structure me convert real time datetime. i did looked @ , tried how convert epoch time in c#? before asking question, did not solve issue. thank you the basic problem date string in unix epoch time in seconds microsoft's json date format in unix epoch time in milliseconds , explained in the documentation . json.net automatically recognizes date strings in microsoft format , in doing interprets offset being in ms not seconds, explains why the datetime shows year 1970 , 1970 beginning year of unix epoch. you should fix json date format consistent microsoft's format, "/date(1485360480000-0800)/" . better yet, switch iso 8601 f

Notification icon in Android 7 -

Image
i'm having problem app's notification icon ( in android 7 ). instead of showing full icon image, system displays background of icon (see attached image). guess it's icon, idea should fix? thanks! edit: code example notificationcompat.builder builder = new notificationcompat.builder(this); builder.setcontenttitle(title) .setcontenttext(message) .setsmallicon(r.mipmap.ic_launcher) .setautocancel(true) .setongoing(false) .setticker(message) .setcontentintent(pendingintent); android.app.notification notification = new notificationcompat.bigtextstyle(builder) .bigtext(message).build(); you need use smallicon 1 , largeicon full one.

c++ - Print a PDF file using Qt -

i want open , print pdf file particular path, previous code work open , directly send print command printer. want multiple printer there , have select one, , after want send print command, don't want want use qprintdialog, printer name stored in textbox , retrieve name , print through printer set in textbox: my previous code mention below: #include <qsettings> #include <qprocess> #include <qdebug> int main(int argc, char *argv[]) { const qstring classesroot = "hkey_classes_root"; // id of .pdf extension qsettings pdfsettings(classesroot + "\\.pdf", qsettings::nativeformat); qstring pdfid = pdfsettings.value("default").tostring(); // path default program associated pdf files qstring printpath = qsettings(classesroot + "\\" + pdfid + "\\shell\\print\\command", qsettings::nativeformat).value("default").tostring(); qstring openpath = qsettings(classesroot + "\\"

java - Mockito.spy not changing real object -

calling method on spy object somehow has no effect on real spied object: public class aaa { public int a; public void seta(int aa) { this.a = aa; } public int geta() { return a; } } public class proof { @test public void wtf() { aaa obj = new aaa(); aaa spy = mockito.spy(obj); spy.seta(22); assertthat(obj.geta(), equalto(22)); } } how can be? suppose proof test should pass. as seen in mockito doc : mockito does not delegate calls passed real instance, instead creates copy of it. this means original object obj isn't modify happens in spied object spy .

c++ - Warning converting to `int' from `double' -

hey 1 of first things i've ever coded. wondering how might fix error. trying research can't find helpful in fixing it. #include <iostream> // needed cin , cout #include <cmath> #include <csmath> using namespace std; /************************************ * defines *************************************/ #define pi 3.14159 /************************************* * function prototype *************************************/ int main() { //surface , volume float radius; float height; float surfacearea; float volume; int pi = 3.14159 //get radius cout << "enter radius: "; cin >> (float)radius; //get height cout << "enter height: "; cin >> height; //get surfacearea surfacearea = 2(pi*radius^2)+2(pi*radius)* height; cout << "the surfacearea is: " << surfacearea; //get volume volume = (pi*radius)^2*height; cout << "the volume is: " << volume &

java - Checking if one file is running and another is not -

//credit post of code sourced http://stackoverflow.com/a/37629840 public class applicationutilities { // http://stackoverflow.com/a/19005828/3764804 private static boolean isprocessrunning(string processname) throws ioexception, interruptedexception { processbuilder processbuilder = new processbuilder("tasklist.exe"); process process = processbuilder.start(); string taskslist = tostring(process.getinputstream()); return taskslist.contains(processname); } // http://stackoverflow.com/a/5445161/3764804 private static string tostring(inputstream inputstream) { scanner scanner = new scanner(inputstream, "utf-8").usedelimiter("\\a"); string string = scanner.hasnext() ? scanner.next() : ""; scanner.close(); return string; } } this code working me last night while trying add while loop isprocessrunning piece of code return value false. there doing wrong on

neo4j - Getting "unknown function" for inhouse developed user defined function -

i'm trying test user defined functions in neo4j 3.1. wrote this: public class udf { @context public graphdatabaseservice db; @context public log log; @userfunction("test.id") public long id(@name("node") node node) { return node.getid(); } } and test function this: public class udftest { @rule public neo4jrule neo4j = new neo4jrule() .withprocedure(udf.class); @test public void shouldbeabletoextractidproperty() throws throwable { try (driver driver = graphdatabase.driver(neo4j.bolturi() , config.build().withencryptionlevel(config.encryptionlevel.none).toconfig())) { session session = driver.session(); long nodeid = session.run("create (p) return test.id(p)") .single() .get(0).aslong(); assertequals(nodeid, 0); } } } and when run test prompts: org.neo4j.driver.v1.ex

android - How to delay SurfaceView setup with CameraSource? -

i have 2 activities : a surfaceview receiving feed camerasource b simple form, filled info activity scan i'd close activity on scan completion , animate activity b appearance. seems surfaceview or camerasource somehow blocking ui thread , preventing smooth transition. activity : ... @override public void surfacedestroyed(surfaceholder holder) { mcamerasource.stop(); } ... @override public void receivedetections(detector.detections<barcode> detections) { if (misreadyfortransfer) { return; } sparsearray<barcode> barcodes = detections.getdetecteditems(); if (barcodes.size() == 0 || barcodes.valueat(0).displayvalue.equals(mlastresult)) { return; } mlastresult = barcodes.valueat(0).displayvalue; if (mlastresult.substring(0, 3).equals("xxx")) { misreadyfortransfer = true; transferactivity.start(this, scanresult.getresultfromscan(mlastresult)); finish(); } } thanks t

javascript - Regex match should be 1 or 2 digit but not zero with single digit in date format -

var dateobj = { '01/01/2017' : true, '1/1/2016' : true, '1/1/16' : true, '1/1/116' : false, '01/11/2016' : true, '01.01.2016' : true, '01.01_2016' : false, '01-0-2016' : false, '01-01-2016' : true }; var failedattempts = []; var date_val = "01/01/2017"; var re = /^(\d{1,2})[/.\-](\d{1,2})[/.\-](\d{4}|\d{2})$/; for(let in dateobj){ let result = re.test(i); if(result != dateobj[i]){ failedattempts.push(i); } } if(failedattempts.length > 0){ console.error('unit test fails'); console.log(failedattempts); }else{ console.log('unit test pass'); } '01-0-2016' : false consider case returns true in wrong format. want rewrite regex digit matches either 1 or 2 not 0 in single digit. restrict digit matching patterns negative (?!0+\b) lookaheads: /^(?!0+\b)(\d{1,2})[\/.-](?!0+\b)(\d{1,2})[\/.-](\d{4}|\d{2})$/ ^^^^^^^^

python 3.x - substitue string by index without using regular expressions -

Image
it should easy, looking efficient way perform it. i know split string 2 parts , insert new value, have tried substitute each line between indexes 22-26 follows: line.replace(line[22:26],new_value) the problem however, function substitutes in line similar pattern in line[22:26] . in example below, want replace marked number 1 number 17 : here results. note replacement of 1 17 in several places: thus don't understand behavior of replace command. there simple explanation of i'm doing wrong? why don't want re the values between index 22-26 not unified in form. note: using python 3.5 on unix/linux machines. str.replace replaces 1 sub-string pattern everywhere in string. e.g. 'ab cd ab ab'.replace('ab', 'xy') # produces output 'xy cd xy xy' similarly, mystr = 'ab cd ab ab' mystr.replace(mystr[0:2], 'xy') # produces output 'xy cd xy xy' what instead, replace just characte

Floating point inaccuracy examples -

how explain floating point inaccuracy fresh programmers , laymen still think computers infinitely wise , accurate? have favourite example or anecdote seems idea across better precise, dry, explanation? how taught in computer science classes? there 2 major pitfalls people stumble in floating-point numbers. the problem of scale. each fp number has exponent determines overall “scale” of number can represent either small values or larges ones, though number of digits can devote limited. adding 2 numbers of different scale result in smaller 1 being “eaten” since there no way fit larger scale. ps> $a = 1; $b = 0.0000000000000000000000001 ps> write-host a=$a b=$b a=1 b=1e-25 ps> $a + $b 1 as analogy case picture large swimming pool , teaspoon of water. both of different sizes, individually can grasp how are. pouring teaspoon swimming pool, however, leave still swimming pool full of water. (if people learning have trouble exponential notation, 1 can use values

SSIS open package being executed by execute package task -

so have uses ssis while, , have many jobs execute package task in them. is there short cut open package being executed in task. i cant see options in right click menu, or other menus etc.? thanks no, there no shortcut. have note name of package, , open in bids.

java - How to protect jar from being used by someone else? -

we distributing java jar files key assets of our business customers. can obfuscation make harder revere-engineering don't want jar files being used outside of our application. there solutions? we considering solution of passing access token (with short expiration) , signature @ run-time our application, , validating token within jar each time public interface being called. token , signature generated web server , encrypted private key while jars use hard-coded public key verify signature. work? whatever amount of obfuscation add binary file, possible reverse engineering it. require more work. with solution propose, see major issues : - legitimate users penalized if web service distributing tokens down - illegitimate users patch java class skip token verification. hence having better service legitimate users. the main problem have added value in jar. if release it, can used anyone. one solution, used on web, keep algorithm in premises side , propose on-line web

WebDriverException thrown in Python for Selenium driver for Chrome -

i ran following commands in python instantiate selenium webdriver chrome, got exception. (a few days ago) there no error: from selenium import webdriver driver = webdriver.chrome.webdriver.webdriver() traceback (most recent call last): file "<stdin>", line 1, in <module> file "c:\python27\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 65, in __init__ keep_alive=true) file "c:\python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 74, in __init__ self.start_session(desired_capabilities, browser_profile) file "c:\python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 123, in start_session 'desiredcapabilities': desired_capabilities, file "c:\python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 175, in execute self.error_handler.check_response(response) file "c:\python27\lib\site-packages\selenium\webdriver\re

scala - May mix-in traits extend case classes from a technical perspective? -

i read repeatedly on case classes shall not extended because case class implements equality method default , leads issues of equality. however, if trait extends case class, problematic? case class mycaseclass(string: string) trait mytrait extends mycaseclass val myct = new mycaseclass("hi") mytrait i guess boils down question, whether mytrait forced mixable instantiations of mycaseclass or whether mytrait inheriting class members (field values , methods) of mytrait , overwriting them. in first case okay inherit mycaseclass, in latter case not okay. 1 it? to investigate, advanced experiment with trait mytrait extends mycaseclass { def equals(m: mycaseclass): boolean = false def equals(m: mycaseclass mytrait): boolean = false } val myc = new mycaseclass("hi") myct.equals(myc) // res0: boolean = true letting me believe equals of mycaseclass used, not 1 of mytrait. suggest okay trait extend case class (while not okay class extend case class). however

angularjs - Make API call to Azure API App in JavaScript with Active Directory authentication -

i implemented java api backend hosted in azure api app. switched on authentication active directory. in cors settings of api app configured allowing calls every source settings asterisk url. now want access api local angularjs app. angular code looks this: angular.module('demo', []) .controller('getdatacontroller', function($scope, $http) { $scope.login = function(user){ console.log("user: " + user, user); $http.defaults.usexdomain = true; delete $http.defaults.headers.common['x-requested-with']; $http.get('http://<myapiapp>.azurewebsites.net/api/contacts'). then(function(response) { $scope.greeting = response.data; console.log("$scope.greeting: " + $scope.greeting, $scope.greeting); }); } }); but still receive following error within console: xmlhttprequest cannot load https://login.window

angularjs - How can i convert text type input to number? -

i confused filter. we can use filter attributes {{ num | number }} why can't use this? <input type="text" name="name" ng-model="num" /> <input type="number" name="name" ng-model="num | number" /> if approach wrong. how can convert text type input number ? you can not use filter in ng-model because ng-model 2 way binding , filter allows output if filter used ng-model can not bind new value have call filter in controller when text value changes ex. below <input type="text" name="name" ng-model="num" /> <input type="number" name="name" ng-model="numformatted" /> consider ng-model different both inputs , numformatted manipulated in controller filter in controller function yourcontroller($scope,$filter) { $scope.$watch('num', function(newvalue) { $scope.numformatted = $filter('number')(newvalu

Json array to url in android -

my json array code ... private jsonarray getresults() { string mypath = "/data/data/com.example.sebastian.patientdetails/databases/" + "mydbname.db"; string mytable = "patients"; sqlitedatabase mydatabase = sqlitedatabase.opendatabase(mypath, null, sqlitedatabase.open_readonly); string searchquery = "select * " + mytable; cursor cursor = mydatabase.rawquery(searchquery, null); jsonarray resultset = new jsonarray(); cursor.movetofirst(); while (!cursor.isafterlast()) { int totalcolumn = cursor.getcolumncount(); jsonobject rowobject = new jsonobject(); (int = 0; < totalcolumn; i++) { if (cursor.getcolumnname(i) != null) { try { if (cursor.getstring(i) != null) { log.d("tag_name", cursor.getstring(i)); rowobject.put(cursor.getcolumnname(i), cursor.getstring(i));

groovy - Issue in SOAP UI with SQL using Grovvy Script, the working code stopped working -

i hitting db2 database using grovvy scripts in soapui, below code working fine me sometime. not working , stuck , unable find solution the query: select column_id table_name column_timestamp > '2016-10-26 05:37:22' below code def sqlquerypopid = "select column_id table_name column_timestamp>'2016-10-26 05:37:22'" def popid **// code not entering in below loop, working fine day back, not sure happened** sqlitod.query(sqlquerypopid) {resultset -> while (resultset.next()){ popid = resultset.getstring(1) log.info("popultauin id is:"+popid) } }//end of result set log.info("the sql query:"+sqlitod.query(sqlquerypopid) )//this line giving below error error: wed oct 26 05:37:58 edt 2016:info:groovy.lang.missingmethodexception: no signature of method: groovy.sql.sql.query() applicable argument types: (java.lang.string) values: [select column_id table_name column_timestamp>'2016-10-26 05:37:

angular - Using Directives on Component element -

i'm trying workout if possible. i trying place directive on component element wrappercomponent.ts @component({ selector: 'app-wrapper', template: '<div><app-component draggable></app-component></div>' }) export class wrappercomponent implements oninit { constructor() { } ngoninit() { //code here } } appcomponent.ts @component({ selector: 'app-component', template: '<div>sample text</div>' }) export class appcomponent implements oninit { constructor() { } ngoninit() { //code here } } draggabledirective.ts @directive({ selector: '[draggable]', }) export class draggabledirective implements oninit { constructor(private _element: elementref, renderer: renderer) { } ngoninit() { //code here } } but when error zone.js:355 unhandled promise rejection: template parse errors: can't bind 'dragg

php - Saving cropped image on the server -

the image has been saved on server when download , it"s format not appropirate , not opening, if got know answer regarding this. <?php define('upload_dir', 'uploads/'); $img = $_post['img']; $img = str_replace('data:image/png;base64,', '', $img); $img = str_replace(' ', '+', $img); $data = base64_decode($img); $file = upload_dir . uniqid() . '.jpg'; $success = file_put_contents($file, $data); print $success ? $file : 'unable save file.'; ?> and js code $.ajax({ type: "post", url: "save.php", data: {'img': encodeuricomponent(result.src)}, contenttype: "application/x-www-form-urlencoded;charset=utf-8", success: function(data){ } }); }

c# - How do I resize an image and maintain aspect ratio once its been uploaded? -

i have written method uploading image in mvc application , storing in database. works fine i'd resize image should dimensions exceed limit set. example i'd image no bigger 300px in width if user uploads image that's 1000px need code in method resize it. there lot of articles couldn't figure out how apply logic i'm doing. i've seen whereby use web helpers , nifty image.resize function. here method creating database entry contain image. create method [httppost] [validateantiforgerytoken] public actionresult create(useraccount useraccount, httppostedfilebase upload) { try { if (modelstate.isvalid) { if (upload != null && upload.contentlength > 0) { var photo = new userimage { filename = system.io.path.getfilename(upload.filename), filetype = filetype.vesselimage, contenttype = upload.contenttype