Posts

Showing posts from June, 2013

jquery - $(window).on('resize') in JavaScript -

in javascript, following code: window.onresize = function() { // something. } the same as: $(window).on('resize', function () { // something. }); are 2 code blocks above equal, functionality-wise? there advantage or disadvantage (however minor) using 1 or other? what about: window.addeventlistener('resize', function(event) { // something. }); they aren't same, in first example, you're affecting event dom object onresize handler. the jquery version doing different behind scene. without looking source code, doing: window.addeventlistener('resize', function () {...}) that said, jquery version , native addeventlistener still different because jquery adding magic event handler. and addeventlistenener prefered way add event dom object, because can add multiple events dom attribute on[event] you're limited 1 event. here's bit more it: https://developer.mozilla.org/en-us/docs/web/api/eventtarget/addevent

javascript - redux dispatch action and reducer with new state -

i have actions like: export function login(){ my_login(function(response){ if(response.status == "ok"){ loginsuccess(response) } }) } export function loginsuccess(response){ return dispatch => { dispatch({ response, type: types.login }); console.log("dispatched"); console.log(getstate()); ---> want updated state router.transitionto("/some_url");----> after want route somewhere }; } when login action called again calls my_login , dispatching loginsuccess action. i have reducer like: const initialstate = [ { fname: null, lname: false, } ] export default function login(state = initialstate, action) { switch (action.type) { case login: console.log("actions dude") console.log(action) return [{ fname: action.fname, lname: actin.lname, }] default: return state } } here state not changing , not ge

apache - Trailing Slash 301 Redirect Issue When ? Is In URL -

htaccess | 301 redirect | uri issue i applied code htaccess enforce trailing slash on url: #trailing backslash rewritebase / rewritecond %{http_host} !^www\. [nc] rewriterule ^(.*)$ https://www.example.com/$1 [r=301,l] rewritecond %{request_filename} !-f rewritecond %{request_uri} !(.*)/$ rewriterule ^(.*)$ $1/ [l,r=301] the code works great @ adding / @ end of urls except ? in middle of url. below: https://www.example.com/list-of-all-objects/search?keywords=test this url code stated above change on load this: https://www.example.com/list-of-all-objects/search/?keywords=test when should this: https://www.example.com/list-of-all-objects/search?keywords=test/ i have learnt of code have applied not work 2 reasons. they don't enforce / - make possible if blocked the term request_uri or $1 or $2 don't include ?keyword= (in fact there nothing can find refers part of url can't include correctly) no matter - can't ? or after placed before /. how traili

html - How to place background images on the top of each other? -

Image
i have 3 background images , them on top of each other. besides that, place them manually , not align. how can this? my codepen <div class="first"></div> <div class="second"></div> <div class="third"></div> - .first { background: url("http://www.quicksprout.com/images/foggygoldengatebridge.jpg") no-repeat; background-size: 100% 100%; height: 400px; } .second { background: url("https://estherpgl.files.wordpress.com/2012/06/no-big-deal1.gif") no-repeat; background-size: 300px; height: 200px; } .third { background: url("https://pbs.twimg.com/profile_images/604644048/sign051.gif") no-repeat; background-size: 80px; height: 100px; } with css3 , can apply multiple backgrounds elements. can set custom background-position each background. the first value horizontal position , second value vertical. top left corner 0% 0%. right bottom corner 100%

ruby - syntax error at or near "{" using rails in postgresql -

below query working in mysql,but not working in postgresql. campaign.scheduled_with_community_ids(community_ids). joins(:community). order('field(campaigns.id, #{editable_ids}) desc'). order(:launch_date, 'communities.community_name') am getting below error activerecord::statementinvalid - pg::syntaxerror: error: syntax error @ or near "{" line 2: ...s" = 's_approved')) order field(campaigns.id, #{editable_... please me you should use double-quoted strings when want use interpolation: campaign.scheduled_with_community_ids(community_ids). joins(:community). order("field(campaigns.id, #{editable_ids}) desc"). order(:launch_date, 'communities.community_name')

how to prevent others from using my firebase data with firebase ref url? -

this question has answer here: how make sure own website (clientside code) can talk firebase backend? 1 answer i using firebase android app , using anonymous authentication. can see url monitoring requests or reverse engineering app. , make own app firebase url , use use anonymous authentication. how prevent this? i using anonymous authentication nobody can use rest endpoints. have read below post don't understand how prevent this. how prevent other access firebase my writes authenticated email + password. reads authenticated anonymous authentication. you cannot prevent other people seeing firebase url. firebase provides cool dashboard can block non-authorized people fetching database information. make sure have following code under "security & rules" tab: { "rules": { // authenticated users can read or write firebase

jquery - Retrive users detail through WP REST API using access token of Auth0? -

using auth0 plugin in wordpress have authorized new users , got access token reading auth0 documentation now want retirve users through wp rest api retrive users need authentication. can use access token of auth0 retrive users details. even think integrate auth0 , wp rest api need use jwt plugin . can use wp rest api. is right way of jwt plugin or on wrong path? it great if there related example using this.

AJAX returned data - how to treat them with jQuery -

so when jquery makes $.ajax request, returned data can handled success function attribute (a function) of object passed parameters $.ajax . api docs report, if processdata attribute set true , data returned string, otherwise dom object (is right?). so, need treat data if simple html. let's have prepend , append series of = s every h1 tag in returned data, , fill page data if plain string (in order use jquery .html() method). what's correct way it? i found .parsehtml() jquery function useful in order parse returned data string html dom. how treat it? sorry lack of what have tried in question. edit someone suggested more clear example. have .html file content want retrieve through ajax , use fill main page content. file structured simple html, without head / body tags, p s , few h1 s. through css made h1 tags p s (which intended). want transform this: <h1>i'm simple header</h1> into plain text this: =================== i'm simp

c# - Reflection.Emit: AssemblyBuilder.SetEntryPoint does not set entry point -

i writing concatenative language in c#, , interpreted, want take next step: compiling. start on this, tried writing simple "hello, world!" program emitter using system.reflection.emit. code works without emit exceptions, when run generated "test.exe" file, throws exception unhandled exception: system.missingmethodexception: entry point not found in assembly 'il_test, version=0.0.0.0, culture=neutral, publickeytoken=null'. i have tried googling answer, no avail. perhaps here can me? (please) code wrote below: using system; using system.collections.generic; using system.linq; using system.text; using system.reflection; using system.reflection.emit; using system.io; using system.diagnostics; namespace ilcompiletest { class program { static void main(string[] args) { const string assembly_name = "il_test"; assemblybuilder assemblybuilder = appdomain.currentdomain.definedynamicassembly(

elasticsearch jdbc type mapping -

i'm trying populate elasticsearch index starting mysql query. working on windows , batch this: echo {^ "type" : "jdbc",^ "jdbc" : {^ "url" : "jdbc:mysql://localhost:3306/ade_ver",^ "user" : "...",^ "password" : "...",^ "sql" : select ... ",^ "index" : "ade_ver",^ "type" : "my_type",^ "type_mapping": "{\"my_type\":{\"properties\":{\"prop1\":{\"type\":\"string\"},\"prop2\":{\"type\":\"string\"},**\"prop3\":{\"type\":\"string\",\"index\":\"not_analyzed\"}**, ecc.. }}}",^ "elasticsearch" : {^ "cluster" : "elasticsearch",^ "host" : "localhost",^

python - Qpython in Android -

i wanted write python code in local computer , transfer android device execute codes in mobile or tablet. is possible transfer? if yes, in location need transfer. in qpython in programs see /storages/emulated/0/com.hipipal/qpyplus/scripts/

javascript - Alert box not closing -

please div alert box...it doesn't close on click event <script type="text/javascript"> $(document).ready(function(){ $('.nof-close').click(function(){ $('.afp-p-now').fadeout(); $('.afp-p-now').css('display','none'); }); }); </script> <div class="flash-messages container afp-p-now"> <div class="flash flash-notice">welcome website...you viewing me <span class="mini-icon mini-icon-remove-close nof-close close"></span> </div> </div> any idea appreciated.thanks. that because there nothing click on, span has no content. try this: <script type="text/javascript"> $(document).ready(function(){ $('.nof-close').click(function(){ $('.afp-p-now').fadeout(); }); }); </script> <div class=&quo

Why this function javascript not alert? -

why function javascript not alert ? first , click click 1 it's show delete , click delete why not alert 111-aaaa how can that? https://jsfiddle.net/tdpusq05/ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <div onclick="test_fn1()">click 1</div> <div id="demo"></div> <script> function test_fn1() { document.getelementbyid("demo").innerhtml = "<span onclick='delete_fn('111-aaaa')'>delete</span>"; }; </script> <script> function delete_fn(no_delete) { alert(no_delete); }; </script> remove single quotes onclick around delete_fn('111-aaaa') following function test_fn1() { document.getelementbyid("demo").innerhtml = "<span onclick=delete_fn('111-aaaa')>delete</span>"; };

android - Device not getting detected in DDMS in Ubuntu 12.04 - 32bit -

i using ubuntu 12.04 32bit. have micromax ninja a87 android phone running gb 2.3.5. problem phone not detected. when try on windows 7 pc, detected. here steps followed still no lucks. $ lsusb output: bus 002 device 006: id 1c9e:9e08 omega technology i created 51-android.rules file , have contents: subsystem=="usb", attr{idvendor}=="1c9e", mode="0666", group="plugdev" subsystem=="usb", attr{idvendor}=="0bb4", mode="0666", group="plugdev" alternatively tried link - http://forum.xda-developers.com/showthread.php?t=1475740 done chmod a+r on 51-android.rules restarted udev , restarted pc. done kill-server & start-server still when "adb devices" -- doesn't detect phone. here more info: 1)usb debugging enable in phone. 2)whenever connect phone pc, shows popup in pc("usbmodem mass storage has been connected"). while checking vendorid , productid in windows(

ajax - django login through javascript -

this question has answer here: django csrf check failing ajax post request 15 answers i attempting use django website. implemented login using code:7 user_django = authenticate(username=email, password=passw) login(request, user_django) which using django rest framework working. when use ajax request think not storing cookies. using django function check if user logged in: if request.user.is_authenticated(): return response('1') else: return response('0') but return 0. have special on client side store login information? my javascript login: function userlogin(){ var user_email = $('#login_user_email').val(); var user_pwd = $('#login_user_pwd').val(); var data = {email:user_email, password:user_pwd}; $.ajax(prefix+ 'userlogin/', { success: function(output, status, xhr)

ios - Meaning of warning "Class implementation may not have super class" -

i have created basic objective-c class. myclass.h @interface myclass: nsobject @end myclass.m #import "myclass.h" @interface myclass() @end @implementation myclass: nsobject { nsmutablearray* _myarray; } @end xcode showing following warning on @implementation line: class implementation may not have super class the warning goes away if remove nsmutablearray* _myarray; line. what warning mean? doing wrong? delete nsobject in implementation part. super class has specified in interface . @implementation myclass { nsmutablearray* _myarray; } @end

React Native: NSATSGlyphStorage inconsistency on iOS -

i'm having warnings on xcode log after fetching data remote json: 2016-01-27 11:31:20.407 app[556:543614] nsatsglyphstorage inconsistency. cannot find run storage character range {24 1} ctrun 0x17d1d3d0. ignoring run... 2016-01-27 11:31:20.426 app[556:543614] nsatsglyphstorage inconsistency. cannot find run storage character range {22 1} ctrun 0x17feb2d0. ignoring run... 2016-01-27 11:31:20.426 app[556:543614] nsatsglyphstorage inconsistency. cannot find run storage character range {43 1} ctrun 0x17feb2f0. ignoring run... 2016-01-27 11:31:20.440 app[556:543614] nsatsglyphstorage inconsistency. cannot find run storage character range {42 1} ctrun 0x190604f0. ignoring run... 2016-01-27 11:31:20.448 app[556:543614] nsatsglyphstorage inconsistency. cannot find run storage character range {22 1} ctrun 0x17ff48d0. ignoring run... 2016-01-27 11:31:20.457 app[556:543614] nsatsglyphstorage inconsistency. cannot find run storage character range {23 1} ctrun 0x17fbcd40. ignoring run...

C# - How to pause the program until an image file is done being overwritten -

in program, there process goes this: save image (overwrite existing one) -> run ocr on image -> return string result this process can repeated several times in row, , without thread.sleep() , results in: 1st iteration: save img01 -> run ocr on img01 -> return result of img01 2nd iteration: save img02 replace img01 -> still run ocr on img01 (old img) -> return result of img01 (old result) (img01 , img02 share same file name/path) because there no pause in flow, notice ocr take place on img01 instead of img02 because img02 still being saved. the unreliable way current pc work put down thread.sleep(1000) between saving image , running ocr. can imagine not right solution since different computer take different times save image right? how can make program pause dynamically , wait image overwritten before continues next step? one way this: first should check if img02 exists , if file curently in use. in order check if i

java - Message-Driven Bean reads two times the same message -

good morning in timezone. application server -> 7 ejb 3.0 in project working on, using message-driven bean read messages queue. message-driven bean read 2 times same message , in second read throws exception because integrity constraint in database insert. why message-driven bean reading message 2 times. using 1 listener on queue , there 1 mdb attached listener. using following activationconfigproperty through annotations 1 messageselector 2 destinationtype 3 destination code snippet @messagedriven(activationconfig = { @activationconfigproperty(propertyname = "messageselector", propertyvalue = "responsetype = 'xxxxx'"), @activationconfigproperty(propertyname = "destinationtype", propertyvalue = "javax.jms.queue"), @activationconfigproperty(propertyname = "destination", propertyvalue = "jms/yyyy")}) thanks in advance best regards @messagedriven(activationconfig = { @activati

regex - Delete portion of characters from each line in notepad++ -

Image
i trying delete range of characters each line in notepad input: 0 0000 stringxx1 describestring1 1 0001 stringxx2 describestring2. output: stringxx1 stringxx2 i've gone through this i select string spaces not sure how proceed further. note words starts string can of varying length. \sstring.*?\s any appreciated. you may use ^.*?(string\s*).* and replace $1 . explanation: ^ - start of string .*? - 0 or more characters other newline few possible before.... (string\s*) - (group 1) literal character sequence string followed 0 or more characters other whitespace ( \s* ) .* - 0 or more characters other newline (up end of line)

Java classes are consuming lots of memory in linux server? -

i working on kind of smtp kinda protocol, made in java , run successfully. consuming 20 30 mb in laptop. later decided make the protocol live on internet. purchased servers(vps), domain. costed me lot. when tried run program on server shocked program consumption 800 900 mb each class running. thought may programming fault, tried lot recover problem not. later friend of mine suggested me test simple hello word program on same server, shocked program eating 900 mb of total ram. what kinda of problem can ? fault in servers, or os , kernels versions ? problem of jvm linux kernels or older linux kernels. have tried older jvms no use. :( i tried of popular flavors of linux worked same , had same problem on linux flavors. eating huge memory in cases. ( of them had linux kernel 2.6.xx) but worked smooth , consumed expected memory in laptop. (about 30 50 mb). use linux in laptop. difference kernel above 3.1.xx . can problem ? disappointed behavior of servers , have lost lots of money

c++ - How to tell if current project is dll or static lib? -

in header i'd #pragma comment lib correct lib file depending upon whether project including header , being built dll or staticlib project. are there predefined preprocessor variables can #if on work out? i've seen _dll can used see if static or dynamic crt being used here: https://msdn.microsoft.com/en-us/library/b0084kay.aspx?f=255&mspperror=-2147217396 there no pre-defined macro functionality. the msdn covers these however, when creating new project of these types, visual-studio appends _lib (static library) or _usrdll (dynamic library) macro build-settings of project. you can reasonably assume that, given project created using current visual-studio workflow, these defined - however, aware may subject change in future, , may not present if user has used non-standard method create project.

Connecting Arduino to Bluetooth module without resistor -

i have 5v operating arduino device, connected bluetooth module works under 3.3v. right connected bluetooth module 5v pin of arduino through 10k , 22k resistors limit volt. but shall connect bluetooth module 3.3v pin don/t need resistors?

java - Date changed after serialize Object to String with Jackson Json -

i litte bit confused. need serialize object json string. use jackson library. my pojo class stage has attribute fromdate , util.date . public class stage { @jsonformat(shape = jsonformat.shape.string, pattern = "dd.mm.yyyy", timezone="utc+1") private date fromdate; ... before serialization fromdate has value: wed may 11 00:00:00 cest 2016 . my serialize method looks this: public static string serialize(stages stages) throws jsonprocessingexception { objectmapper objectmapper = new objectmapper(); string s = objectmapper.writevalueasstring(stages); return s; } but after serialize object datefrom in json string hast value: ..."fromdate":"10.05.2016"... . date wrong. i used pattern of @jsonformat , tried objectmapper configuration. public static string serialize(stages stages) throws jsonprocessingexception { objectmapper objectmapper = new objectmapper(); simpledateformat dateformat

javascript - jqGrid modal edit save only changed data and marked edited row? -

Image
i use jqgrid 4.9.3-pre - free jqgrid oleg. edit data using model window "form editing". data server. datatype: "json" loadonce: false , paging of data don't use use standard table. call "form editing" ondblclickrow. ondblclickrow: function(rowid) { $(this).jqgrid('setselection', rowid) .jqgrid("editgridrow", rowid, { recreateform: true, width: 1000, height: "auto"}); } two questions: mark row when has been edited. when edit data , press button save. how send data has been modified data server? i find question interesting , created the demo , demonstrates 1 of possible implementation of making edited field of form editing. results looks on picture below the corresponding code inside of beforeshowform callback: beforeshowform: function ($form) { var $self = $(this), mymarker = "<span class='mychanged-item fa fa-lg fa-arrow-circle-o-left

javascript - jquery - add div to the child dynamically -

i want add warning div dynamically after seconddiv in html. please suggest how can achieve in jquery. html: <div class="panel panel-default"> <div class="panel-heading"> </div> <div class="panel-body"> <div class="table-responsive" id="firstdiv"> </div> <hr/> <div class="table-responsive" id="seconddiv"> </div> <hr/> <div class="table-responsive" id="thirddiv"> </div> </div> </div> warning div: <div class="note note-warning"> <div class="block-warning"> <h4 class="block"> <i class="demo-icon icon-attention-1 fa"></i> warning! header goes here</h4> <p>warning </p> </div> </div> as per jav

Why Scala REPL shows tuple type for Map expression? -

scala repl gives same type both expressions - (tuple? -- strange!). yet ("a" ->1) map can add map , ("a", 1) can not. why scala repl shows tuple type type map expression? scala> :t ("a" -> 1) (string, int) scala> :t ("a",1) (string, int) scala> val m = map.empty[string, int] m: scala.collection.immutable.map[string,int] = map() scala> m + ("a",1) <console>:9: error: type mismatch; found : string("a") required: (string, ?) m + ("a",1) ^ scala> m + ("a" ->1) res19: scala.collection.immutable.map[string,int] = map(a -> 1) actually, reason predef: http://www.scala-lang.org/api/current/index.html#scala.predef$ (which in scope in scala) contains implicit conversion arrowassoc (the method implicit def any2arrowassoc[a](x: a): arrowassoc[a] ) arrowassoc contains method -> converts tuple. so doing any2arrowassoc("a").->

activeresource - How to convert rails active resource object to hash? -

let's have active resource object fetched following: x = resource.find(some_id) and x in remote server has field h complex nested hashes represented here nested active resource objects, accessing tedious task, possible convert h hash? can make call resource.get(some_id) , result 1 big hash, risky resource -theoretically- may have changed between subsequent calls, there way convert active resource object hash ? edit for more clarification, suppose invoice record r[id=some_id] has attribute extras , hash value: {:x=>1, :y=>2, :z=>{:a=>1, :b=>2}} then when fetching record through active resource, following result extras field, -extracted response-: "extras"=> #<app::invoice::extras:0x00000008202cb0 @attributes= {"x"=>1, "y"=>2, "z"=> #<app::invoice::extras::z:0x00000008201978 @attributes={"a"=>1, "b"=>2}, @persis

image - put partly transpared photo on top of panorama -

what nessesary if want see black edges background image in image placed on top? here in picture want create. can see there edges background panorama mountains in picture on top. ideas, please? does background image contain black edges? try this: swap layers background image top layer; select layer on top; select all; using select color tool, hold down ctrl , click of black pixels deselect black edges , keep else selected (if background image jpeg have adjust tool tolerance); delete selected area.

android - getting issues while adding other gradle project as library -

actually have been trying import gradle project library github , know there 2 ways that 1)by adding url dependencies in build.gradle file method gave lot of errors 2)manually download library , import module, add dependencies and somehow succeeded using second method .. after gradle sync worked correctly while running application gives bizzare errors like error:(23, 0) gradle dsl method not found: 'ompile()' possible causes: the project 'appintro' may using version of gradle not contain method. open gradle wrapper file the build file may missing gradle plugin. apply gradle plugin and github link follows https://github.com/paolorotolo/appintro i imported folder called library in that.... you can add library in many ways: add simple dependency in build.gradle file just use: dependencies { compile 'com.github.paolorotolo:appintro:3.4.0' } use jitpack plugin just add repo build.gradle repositories { // ...

go - Generate YAML manifest from Kubernetes types -

i'm looking writing tool generates kubernetes definitions programatically our project. i've found api types in kubernetes can found in k8s.io/kubernetes/pkg/api . output yaml based on these types. given object this: ns := &api.namespace{ objectmeta: api.objectmeta{ name: "test", }, } what's best way generate yaml output expected kubectl create ? found it, future reference, here's might want do: package main import ( "os" "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/runtime/serializer/json" ) func main() { ns := &v1.namespace{ typemeta: unversioned.typemeta{ kind: "namespace", apiversion: "v1", }, objectmeta: v1.objectmeta{ name: "test", }, } e := json.newyamlserializer(json.defaultmetafactory

python - In a virtual env the sys.path is wrong when I import a package from a file -

the sys.path change if import package file. in pyenv : $(env) python >>> import sys >>> print(sys.path) ['', '/usr/lib/python3.4', '/usr/lib/python3.4/plat-x86_64-linux-gnu', '/usr/lib/python3.4/lib-dynload', '/var/www/lib/python3.4/site-packages'] in fileimport.py (inside virtual env) : # fileimport.py import sys print(sys.path) the command : $(env) python fileimport.py gives me same result! but when try import fileimport package anotherfile.py : #!/usr/bin/env python # anotherfile.py import fileimport the sys.path result change : $(env) python anotherfile.py ['/var/www', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages'] i install pyenv : $ sud

java - Change color of one textview on listview without change others -

i need change color of listview backgroundcolor property. can it, change color, changes rows same color. mean, need 1 row red color, other green color... put code below help: arrayadapter<string> adapter = new arrayadapter<string>(getapplicationcontext(), android.r.layout.simple_list_item_1, configurelist(idruta, rocodromo, dificultad)) { @override public view getview(int position, view convertview, viewgroup parent) { view view = super.getview(position, convertview, parent); textview text = (textview) view.findviewbyid(android.r.id.text1); for(int = 0; < colores.size(); i++) { if(colores.get(i).equals("0")) { text.setbackgroundcolor(color.green); } else if(colores.get(i).equals("1")) {

php - how to check or declare array values of an array like an instanceof a Class/Entity -

in symfony project have array $productcontainer values (php dump): array:2 [▼ 0 => "value1" 1 => "value2" ] i pass array in product entity findby method in controller this: $products = $this->getdoctrine()->getrepository('mybundle:product') ->findbyvalue($productcontainer); the results between findby method , array values match well. but when check if array an instance of class product this: dump($products instanceof product); die; it retuns me : false i understand $products array , not object , how can declare array $products instanceof product entity ? edit in order more precise, need declare or check if values of array $products instanceof product because in same controller, have pass array $products in querybuilder entity this: $entity = $this->getdoctrine()->getrepository('mybundle:entity') ->getentitywithproducts($s

html - Adding Horizontal line Below The Text Like In the Image? -

Image
code, need add horizontal border in image <section class="about"> <div class="container"> <h1 class="text-center">the resturant</h1> <h3 class="text-center">a little , brief history of how started</h3> <div class="about-border"></div> </div> </section> try .about-border { display: block; width: 80px; height: 3px; background: #f1cd8f; margin: 20px auto; } /* optional css center align heading text*/ .about h1, .about h2 { text-align: center; } fiddle: https://jsfiddle.net/9oapmz9b/

codeigniter - How to set min_size upload File in Code Igniter? -

i want stablish minimum size when user upload photo, minimun size 3mb, how can define this? in controller call upload have this $config['min_size'] = '3000'; in upload.php, need do? there's no option this, nor should there 1 - doesn't make sense. i suppose you're trying put minimum "quality" limit on photos, there 2 problems that: while filesize (logically) increase quality, not same thing. determining image quality job images-related library, not 1 uploads.

scala - Can I use maven-style project on git as dependency? -

can use maven-style project on git dependency ? i'm trying add following project: https://github.com/jconwell/corenlp in build.scala it's specified as lazy val root = project( ) dependson(corenlpextproject) lazy val corenlpextproject = rootproject(uri("https://github.com/jconwell/corenlp.git")) oddly on sbt update error sbt.resolveexception: unresolved dependency: default#corenlp_2.11;0.1-snapshot: not found what referring ? don't see version 0.1-snapshot in pom.xml

openlayers 3 - Adding feature with duplicate ID to Vector source -

right now, if add 2 features same id vector source, seems second 1 discarded. there anyway force openlayers replace features existing ids? i don't think built in, best option: var features=layer.getsource().getfeatures(); for(var i=0;i<features.length;i++){ if(features[i].get('id')==id){ layer.getsource().removefeature(features[i]); break; } } }

elasticsearch query_string filter syntax bug (version 1.7.x) -

im looking bug in following query, doesn't bring results. want act terms filter, , exact values in country / device fields get idx/type/_search { "query": { "filtered": { "filter": { "and": { "filters": [ { "query": { "query_string": { "query": "country:\"united kingdom\" , device:\"desktop\"" } } } ] } } } } } specifically, works: "query": { "query_string": { "query": "\"united kingdom\"" } } but doesnt work: "query": { "query_string": { "query": "country:\"united kingdom\"" } } mapping: "country": { "type": "string",

payflowlink - PayPal PayFlow Hosted Checkout -

i can't understand hosted checkout. think because can't let go of payflow link. i'm going reduce want , if tell me if possible hosted checkout appreciate it. with payflowlink able collect information (name, address, email, etc) + app specific information used calculate amount , send off payflow.paypal.com , user happily check out before being returned website. with hosted checkout documentation seems imply collect credit card info , grab secure token submit payflow. you'll why not use paypal payment standard user has own merchant account. am missing something? if you're using 3rd party merchant other paypal still use payflow link (or pro) same way did before. payments advanced (hosted paypal) when you're using paypal merchant account.

javascript - How to load multiple templates from handlebars.js partial -

is there easy way load partial, multiple templates in it, using handlebars.js, can using mustache.js , jquery plugin "jonnyreeves" e.g: $.mustache.load('./templates/greetings.htm').done(function () { $('body').mustache('simple-hello', viewdata); }); in handlebars.js need register each partial, using handlebars.registerpartial you can this: javascript $(document).ready(function() { //get template server $.get("http://example.com/template.html").done(function(response) { var content = $($.parsehtml(response)); //compile main template var template = handlebars.compile(content.filter("#test-template").html()); //you need register each partial handlebars.registerpartial({ foo: content.filter("#foo-partial").html(), bar: content.filter("#bar-partial").html() }); //your data var data = { "test": [{ foo: "foo"

Android - WakeLock - POST location on PUSH notification received when screen lock'd (parse.com) -

i want post location on pushreceived when screen lock'd. code works when screen on . wakelock not seem work... when receiving push notification first time parse.com screen turns on , can see gps icon pops up. , database updates. but second time push notfication onlocationcanged not triggered, , post never gets sendt. why ? screen turns on, , gps icon shown. evrytime set debug @ point works: locationmanager.requestlocationupdates(locationmanager.gps_provider, 0, 0, this); locationmanager.requestlocationupdates(locationmanager.network_provider, 0, 0, this); some sort of asynch tastk problem maby ? here code: public class pushnotificationreceiver extends parsepushbroadcastreceiver implements locationlistener{ @override public void onpushreceive(context context, intent intent) { //wakelock pm = (powermanager) context.getsystemservice(context.power_service); wakelock = pm.newwakelock((pm.s

UnsatisfiedLinkError on 64-bit Android when loading 32-bit JNI library (on LG Flex2) -

i've written android application calling 32-bit jni library. on galaxy note 4 (32-bit, snapdragon 805) works expected, on lg flex2 (64-bit, snapdragon 810) app works when passing parameter "--abi armeabi-v7a" adb (obviously). however, when installing jar-file manually, android assumes 64-bit application, results in unsatisfiedlinkerror listed below. this i've checked/tried: - there no 64-bit libraries present in whole apk - there single arch-specific directory inside apk (lib/armeabi-v7a) - native libraries built "local_multilib := 32" any idea why android insists on running application in 64-bit mode? i've read, android should automatically detect legacy 32-bit applications during installation when encountering 32-bit native shared libraries. thank in advance, clemens java.lang.unsatisfiedlinkerror: dalvik.system.pathclassloader[dexpathlist[[zip file "/data/app/at.ac.ait.modentity-2/base.apk"],nativelibrarydirectories=[/data/

jira - How to label tasks so they appear in multiple teams' Agile Boards? -

we have 2 scrum teams working on common product, have cross-platform tasks applicable either team. how create label allow task appear in backlogs/boards? the issues appear on board defined jql filter. typically select issues given project this: project = "myproject" but there nothing stopping modifying it. example board filter use: project = "myproject" or labels in ("mylabel") that show issues project 'myproject' , issues include label 'mylabel'. the board filter can modified in 'configure' menu on board under 'general'.

web config - How do I create a Rewrite Rule in IIS to temporarily conceal all PDF files? -

i've got pdf files sitting out on web server, , time being hide them (i.e. have them return 404s). can accomplished in web.config file rewrite rule? in apache can this: rewriterule \.pdf$ - [r=404,l,nc] how accomplish same effect iis? one way achieve using hiddensegments in iis. hiddensegments make urls inaccessible clients. also, iis return http 404 error client , log 404.8 http substatus. <configuration> <system.webserver> <security> <requestfiltering> <hiddensegments> <add segment="pathofpages" /> </hiddensegments> </requestfiltering> </security> </system.webserver> </configuration> edit 1: can use requestfiltering deny pdf extension clients. httpstatus sub code 404.7 would returned. requests pdf files denied. from iis.net in request filtering pane, click file name extensions tab, , click den

javascript - Angular: How to utilize Linky with contenteditable div -

i trying add clickable link contenteditable div of linky. ng-bind-html = "model | linky"; i haven't been able make work ng-sanitize escapes links. here think happens: text entered " http://something.com " linky wraps <a href="http://something.com">http://something.com</a> ngsanitize escapes again potentially breaking linky's implementations how can make work such links added div clickable , not escaped html? plunker html: <body ng-app="customcontrol"> <h4>how add link contenteditable div?</h4> <div contenteditable name="mywidget" ng-bind-html="usercontent" ng-model="usercontent" strip-br="true" required>change me </div> <span ng-show="myform.mywidget.$error.required">required </span> <hr> model: <p aria-label="dynamic textarea">{{usercontent}}</

containers - Bluemix: local Docker daemon is not reachable to authenticate it -

i having same problem, described in thread . unfortunately, provided answer in thread not solve issue. cf login works fine cf ic login fails: $ sudo cf ic login password: client certificates being retrieved ibm containers... client certificates being stored in /users/xx/.ice/certs/... client certificates being stored in /users/xx/.ice/certs/containers-api.eu-gb.bluemix.net/bd67571... ok client certificates retrieved. deleting old configuration file... checking local docker configuration... system authenticated ibm containers api, local docker daemon not reachable authenticate ibm containers registry. can still run ibm containers on cloud not able push or pull images. can choose 2 ways use docker cli ibm containers: option 1: option allows use "cf ic" managing containers on ibm containers while still using docker cli directly manage local docker host. use cloud foundry ibm containers plug-in without affecting local docker environment: example usage: cf ic ps

meteor - How do I modify the item of an array passed as data context in a child template? -

i have local collection stores arrays of odds: checkscollection = new mongo.collection(null); checkscollection.insert({ odds: ['', ''], oddsaverages: ['', ''], oddscompeting: ['', ''] }); and helper sets parent data context: template.step1.helpers({ bet: () => checkscollection.findone() }); and need child template can modify index of array checkscollection. @ moment call that: {{>inputodds odds=bet.odds.[0] label='the odds being offered you:' placeholder='any odds style works! equivalent examples: 1/4 1.25 -400'}} {{>inputodds odds=bet.odds.[1] label='the odds offered opposite outcome:' placeholder=''}} later might call {{#each ... in ...}} loop through oddsaverages example. child template: <template name="inputodds"> <div class="form-group"> <label for="odds">{{label}}</label> <input type="text&q

swift - Tap callback on bar in BarChart in iOS-Charts -

i have implemented bar chart , move more specific view when tapping specific bar - if tapped uibutton . possible? need know bar tapped in order fill other view correct data, can't seem find way bind action specific bar in barchart . i'm using swift . for else looking answer quite straight forward. implement chartviewdelegate have barchartview , implement method func chartvalueselected(chartview: chartviewbase, entry: chartdataentry, datasetindex: int, highlight: charthighlight) , you're set.

javascript - Currying a function that takes infinite arguments -

using es5, how curry function takes infinite arguments. function add(a, b, c) { return + b + c; } the function above takes 3 arguments want our curried version able take infinite arguments. hence, of following test cases should pass: var test = add(1); test(2); //should return 3 test(2,3); //should return 6 test(4,5,6); //should return 16 here solution came with: function add(a, b, c) { var args = array.prototype.slice.call(arguments); return function () { var secondargs = array.prototype.slice.call(arguments); var totalarguments = secondargs.concat(args); var sum = 0; (i = 0; < totalarguments.length; i++) { sum += totalarguments[0]; } return sum; } } however, have been told it's not “functional” in style. part of reason add function not "functional" because attempting more add numbers passed it. confusing other developers @ code, see add function, , when

ASP.NET and Python Communication -

i trying send message asp.net website python file running on raspberry pi. if code on python on pi import socket serversocket = socket.socket(socket.af_inet, socket.sock_stream) serversocket.bind(('localhost', 8089)) serversocket.listen(5) # become server socket, maximum 5 connections while true: connection, address = serversocket.accept() buf = connection.recv(64) if len(buf) > 0: print buf break i need getting started. assuming know external , internal ip address of raspberry pi running python code, how started code using asp.net? would use socket.io or else? best idea or method communicate between asp.net website , python? know question general need started in right direction. (edit ) improved asp.net code: protected void page_load(object sender, eventargs e) { tcpclient client = new tcpclient("192.168.1.107", 8012); // translate passed message ascii , store byte array. byte[] data = system.text.encod

asynchronous - Javascript: return fires before promise completes -

function process(hugedirectory) { var title = hugedirectory.gettitleeachfile().then(function(caption){ console.log(caption); return caption; }); return title; } i have ajax call calls method right now, return nothing. console.log(caption) displays correct , expected value. however, value not returned @ end of method. since process make use of asynchronous function calls, cannot return value method. the solution kind of problem make use of callback functions given below function process(hugedirectory, callback) { hugedirectory.gettitleeachfile().then(function(caption){ console.log(caption); callback(caption) }); } process(hugedirectory, function(title){ //do title }) in instead of returning title process pass callback function process getting called when async call completed , resulted title value passed callback function.

Google analytics Goal URL destenation? -

i have set goal after user signed don't send user "successful signup page.html" , user returns dashboard , read ga can read parameters in url, read fragments ? use fragments on website can use (/dashboard#success) destination count success goal ? or parameters can red (/dashboard.html?signup=success) google analytics, you've pointed out, disregards fragments, can still override default url include fragment in page views goals still work: ga('send', 'pageview', {'page': document.location.pathname + '#' + document.location.hash})

html - Disable @media print in bootstrap? -

is possible entirely disable preconfigured @media print css styles bootstrap without having recompile it? the print styles applied default seen here: https://github.com/twbs/bootstrap/blob/master/dist/css/bootstrap.css#l6837 i want webpage printed seen, css tags applied. colors, like: b { color: #ff0000; } in order disable print styles bootstrap, i'd have explicit override every property again custom styles, eg: b { color: #ff0000 !important; } but isn't there global way disable these default print styles? you can download custom bootstrap without media print. http://getbootstrap.com/customize/ just uncheck print media styles

java - ArrayLinkedList Insertion Sort -

i have array list insertion sort , teacher sent me , gave me f, says can make before friday. not understand why isn't a.l insertion sort. can me fix hits criteria? thanks. he said: after checking first insertion sort did incorrectly. said shift numbers , move number proper place , not swap number place. in assignment in mysa said if 0 assignment. import java.util.arraylist; public class alistinssort { private static void insertionsort(arraylist<integer> arr) { insertionsort(); } private static void insertionsort() { arraylist<integer> swap = new arraylist<integer>(); swap.add(1); swap.add(2); swap.add(3); swap.add(4); swap.add(5); int prior = 0; int latter = 0; (int = 2; <= latter; i++) { (int k = i; k > prior && (swap.get(k - 1) < swap.get(k - 2)); k--) { integer temp = swap.get(k - 2)

excel - Change the color of the cell to red if the value in the Database is empty -

i have developed excel macros, fetches data database. want change color of cell if value in database empty. have code. below code not work. if not rs.eof n = 0 rs.fields.count - 1 objsheet.cells(irow, icol).value = rs.fields.item(n) if ucase(rs.fields.item(n).name) = "order_status" if ucase(rs.fields.item(n)) = "" objsheet.cells(irow, icol).interior.colorindex = 3 else objsheet.cells(irow, icol).interior.colorindex = 4 end if end if try same code in reverse.. if ucase(rs.fields.item(n)) <> "" objsheet.cells(irow, icol).interior.colorindex = 4 else objsheet.cells(irow, icol).interior.colorindex = 3 end if hope :)