Posts

Showing posts from April, 2013

javascript - jxcore can't protect source code -

i saw blog jxcore can create executable based on js code (to run command line application) , protect source code being seen easily. but when tried following, saw excutable file (in ubuntu) still contains source # jx package test1.js # change library , extract attribute in file test1.jxp false # jx compile test1.jxp # grep "this test1" test1 binary file test1 matches the little js file test1.js console.log("this test1"); i understand there no perfect way of protecting application being reversed. hoped there no simple way (like "strings" command) grab source code out of executable. the blog post read is, put, outdated , wrong. the "protection" features provided jxcore severely flawed , , largely removed in later releases of project. do not use jxcore. development on project halted in march 2016 ; has fallen behind node.js platform, , provides no real benefits on open solutions pkg .

javascript - AngularJS ng-model for multiple inputs inside directive -

so have directive 21 inputs in it. want set ng-modelbased on attribute passed when calling directive. if {{myattr}} inside directive outputs attribute i've set, if include ng-model="{{myattr}}" things break. angular.module('myapp') .directive('program', function () { return { templateurl: 'app/program/program.html', restrict: 'ea', link: function (scope, element, attrs) { scope.daymodel = 'program.' + attrs.day + 'first'; } }; }); you use {{variablename}} in pure html-text, angularjs can replace value of variable @ runtime: http://jsfiddle.net/joshdmiller/hb7lu/ but never write ng-form="{{myattr}}" in html-tag, instead have write ng-form="myattr" {{}} serves way angularjs distinguish between plain text , variable/code. in html-tags there no plain text, instead interpreted variable/code.

How to set column colors, title colors , font size , font family in external css file for highcharts? -

i want make seperate css file type of attributes title colors, font size, font family, column colors, stack colors, pie colors. no need change these css in pages, change in css file , apply charts in pages. solution this. you can create own highcharts theme , apply of charts. http://www.highcharts.com/docs/chart-design-and-style/themes

matlab - Match rows of 2 matrices for a minimum total sum of row-wise differences -

i have 2 matrices equal number of rows , columns. a(4x3) , b(4x3). i match rows of rows of b when subtracting minimum sum. example of how inside of , b like: a= -0.3612 -0.1911 -15.3818 0.0376 0.0206 0.3498 0.0418 0.0229 0.3887 0.0188 0.0103 0.1749 i'm doing this: for j=1:size(b,1) [vv, inds]=min(sum(abs(bsxfun(@minus,a,b(j,:))),2)); minjj(j,:)=vv; indsmatch(j,:)=inds; mm=min( minjj); [a,ps] = removerows(a,'ind',inds); [b,ps] = removerows(b,'ind',j); end i error: improper assignment rectangular empty matrix. what i'm trying indsmatch . want 'order of rows indexes' of matrix paired rows of b (based on min difference). indexes of b kept 1 2 3 4. here's vectorized approach. tries permutations of rows of b , , produces optimal row-permuted b in matrix bresult . [m, n] = size(a); ind = perms(1:m); % // permutations of row i

javascript - Why Chrome sometimes makes 2 AJAX requests instead of 1? -

Image
i have encountered strange behaviour of current version of google chrome (44.0.2403.157) on os x. when ajax (xhr) request method chrome sometimes makes 1 request , - 2 (!). my code: var jsurl = 'http://www.some-domain.com/xy.js'; var ajax = new xmlhttprequest(); ajax.withcredentials = true; ajax.open( 'get', jsurl, true ); // async, because sync cannot send cookies ajax.onreadystatechange = function () { var script = ajax.response || ajax.responsetext; if (ajax.readystate === 4) { switch( ajax.status) { case 200: case 304: eval.apply( window, [script] ); // no break on purpose here default: somefunction(); } } }; ajax.send(null); a screenshot of developer console when 2 requests being made: server log confirms second request being made - it's not in console. the headers of second request practically same firs

css - blur filter doesn't work on internet explorer and firefox -

when use pc, can't see blur filter works on firefox , i.e. me on mac works perfectly. here code or jsfiddle link if want try: [jsfille][1] [1]: http://jsfiddle.net/kodjoe/3avv3v5l/3/ here html code : <div class="remodalshare-bg"><a href="#follow">follow</a></div> <div style="height:auto;" class="remodalshare" data-remodalshare-id="follow"> <div style="position: absolute; top:5px; right:10px; border:0px;z-index:9999999;" class="remodalshare-closeposition"> <a href="#" data-remodalshare-action="close" class="remodalshare-close" aria-label="close"> <img src="http://www.500milligrammes.com/facticemagazine/final/addon/modal/x.png" alt="close"/> </a> </div> test </div> here css code: *, *:after, *:before { padding: 0;margin: 0; -webkit-touch-callout: none; -webkit-user-sele

Unable to connect to band via ConnectAsync while it is in sleep mode -

i'm writing app collect additional sensor data while sleeping. however, band user consistently use sleep mode , have found while band in sleep mode connectasync fails bandioexception ("failed connect target band."). see issue sleep - not run or workout activities. is there way programmatically allow access band while sleeping (perhaps through user consent) or have choose between collecting data app , running sleep mode? can imagine there many apps enhance sleep mode or @ least complement it, wouldn't want compete given insights come along sleep mode. thanks in advance information - i've looked through samples, documentation, , forum without finding indication of issue far. during sleep mode, band not allow bt activity. not limitation enforced sdk. band does.

Make vars constant for use in case statements in Clojure -

in clojure, there way make var constant such can used in case statements? e.g. (def 1) (def b 2) (let [x 1] (case x :1 b :2 :none)) => :none i understand can use cond or condp around this, nice if define not require further evaluation use case . related , answer stolen it: as docstring tells you: no cannot this. can use chas emericks macro , however: (defmacro case+ "same case, evaluates dispatch values, needed referring class , def'ed constants java.util.enum instances." [value & clauses] (let [clauses (partition 2 2 nil clauses) default (when (-> clauses last count (== 1)) (last clauses)) clauses (if default (drop-last clauses) clauses) eval-dispatch (fn [d] (if (list? d) (map eval d) (eval d)))] `(case ~value ~@(concat (->> clauses (map #(-> % first eval-

java - Why I am not able to add a new ParseUser? -

i using following code adding new parseuser : parseuser user = new parseuser(); user.setusername("rob"); user.setemail("rob1989@gmail.com"); user.setpassword("robpass"); user.put("phone", "898989898"); user.saveinbackground(); after running above code nothing reflect in parse dashboard. not getting exception in android studio . if run following code working fine: parseobject item = new parseobject("item"); item.put("quantity", "dwad"); item.put("description", "dawda"); item.put("name", "fwafa"); item.saveinbackground(); what doing wrong here in parseuser ? there anyway check parse dashboard? as stated in official guide , parseuser s should use parseuser.signupinbackground() : user.signupinbackground(new signupcallback() { public void done(parseexception e) { if (e == null) { // hooray! let them use app now. } else { // s

javascript - JS round to 2 decimal places -

this question has answer here: round @ 2 decimal places (only if necessary) 42 answers i trying limit returned number 2 decimal places code isn't working me; function myfunction() { var x = document.getelementbyid("myselect").value; document.getelementbyid("demo").innerhtml = "result is: " + x * 1.09; value = valtoround.tofixed(2); } what doing wrong? typing in js browser console x = 2.71828 x.tofixed(2) "2.72" it clear .tofixed(2) works what did wrong rounding after printing answer, , not using correct variables. document.getelementbyid("demo").innerhtml = "result is: " + x * 1.09; value = valtoround.tofixed(2); it idea in habit of converting strings numbers parsefloat() . in js, '2'*'2' '4' '2'+'2' '22', unless first conv

php - Why does json_encode return nothing? -

i learning use json on php. have db table holds records of nightclubs, , nightclub class. so far good, no errors encountered, when want echo json_encode() doesn't show me information. i've tried echo son_last_error(); , returned "0". i tried using: mysql_query('set character set utf8'); but did't work. here code: <?php header('contennt-type: application/json'); require_once("./inc/event.inc.php"); //the boliche object require_once("./inc/connect.inc.php");//connections db if(mysqli_connect_errno()){ printf("connect faild: %s\n", mysqli_connect_error()); exit(); } mysql_query('set character set utf8'); $query = "select * boliches id in (1,2)"; $boliche_array = array(); if($result = $dbc->query($query)) { while($obj = $result->fetch_object()) { printf("%s %s %s %s %s %s %s %s </br>", $obj->id, $obj->bname,$obj->place,$obj-&

how to make php scripts executable instead of downloadable using nginx -

recently set virtual machine through vagrant , i'm using nginx web server. os i'm using vm ubuntu linux 12.04. problem script write in php gets downloaded, instead of being executed on browser. seeing php interpreter installed figured i'd post here config file of nginx, problem found. being novice in world of web development, can't figure out out of ordinary, can guys take , tell me if see wrong? thanks. server { listen 80; server_name localhost; root /vagrant/www/web; error_log /var/log/nginx/error.log; access_log /var/log/nginx/access.log; #strip app.php/ prefix if present rewrite ^/app\.php/?(.*)$ /$1 permanent; location / { index app.php; try_files $uri @rewriteapp; } location @rewriteapp { rewrite ^(.*)$ /app.php/$1 last; } # pass php scripts fastcgi server listening socket location ~ ^/(app|app_dev)\.php(/|$) { fastcgi_pass unix://var/run/php5-fpm.sock; fastcgi_keep_conn on; fastcgi_split_path_info ^(.+

java - Is it possible to save checkBox state while switching layout or class? And if its possible how? -

when remember tutorial checkboxes please let me know! you're getting state using: boolean selected = checkbox.ischecked(); then can add onlayoutchangelistener on view object. example usage: view.addonlayoutchangelistener(new onlayoutchangelistener(){ public void onlayoutchange(view v, int left, int top, int right, int bottom, int oldleft, int oldtop, int oldright, int oldbottom){ boolean selected = ((checkbox)v.findviewbyid(r.id.yourcheckboxid)).ischecked(); //savethestatehere } });

javascript - Item in observable array is not added to the list KO -

i take data loaded list , add them observable array , suppose show them in list , goes except data not shown on screen here's code self.adddata = function (val) { self.finallist().push(val); alert(val.latin_desc); } <div class="container"> <h2> added servcies</h2> <div class="row" style="height:20vh; overflow:auto;"> <div class="col-md-3"> <ul data-bind="foreach:finallist"> <li class="list-group-item"> <div class="col-xs-3"> <b data-bind="text:latin_desc , value: sys_key"></b> </div>

generics - Swift create function closure with shortened dollar sign syntax support -

i've added extension array extension array { func each(call: (element: element, idx: int) -> ()) { (idx, element) in enumerate(self) { call(element: element, idx: idx) } } } it's shortcut for in enumerate . use i'd call this [1, 2, 3, 4].each { element, idx in print(element) return } this print 1234 works, i'd rather not require return . when tried in playground without return prints "0 elements" 4 times rather printing value. my goal extension make work map function, short , easy apply function array, in case call function on each element without mutating original. [1, 2, 3, 4].map { $0 * 2 } //converts array [2, 4, 6, 8] each can accomplished calling [1, 2, 3, 4].each { print($0); return } this works, rather returning element $0 returns tuple (element, idx) . use pretty using $0.0 element , $0.1 index, feels clunky. i'd prefer use $0 element , $1 index shortened syntax. i'd p

ASCII conversion in Python -

i making encryption program easy make if use ascii numbers represent character.(using deprecated string.translate) there way pass character through ascii number , append string? i think you're looking chr : return string of 1 character ascii code integer i. example, chr(97) returns string 'a'. inverse of ord(). argument must in range [0..255], inclusive; valueerror raised if outside range. see unichr(). and ord : given string of length one, return integer representing unicode code point of character when argument unicode object, or value of byte when argument 8-bit string. example: print("somestring" + chr(65)) # prints "somestringa"

javascript - Intellij debugging ignore files -

Image
intellij idea (14.1.4) has option ignore javascript files when debugging. option can found within: settings > build, execution, deployment > debugger > stepping i've added following file ignore: backbone.js i've ticked box ignore library scripts. when stepping complex expression still drop me backbone.js. specifying incorrectly or bug in ide? edit: including screen shot of settings. here example line send debugger backbone.js during step into: hostscollection = new hostscollection(this.model.get('hostcell').get('hosts'), { availablehostingplans: this.availablehostingplans }); since backbone.js ignored should stepping on line instead of into.

linux - PHP Write file - Permission Denied -

i can't seem php write text file on apache web server. the file (log.txt) has owner of "apache:apache" access "-rw-rw-r--", folder owned "apache:apache" , has permissions "drwxrwxr-x"... every time tried access log.txt, apache log reports "permission denied" on file name. can help? thanks. apache runs user www-data:www-data not apache:apache. sure right uid/gid? try writing new file , see owns it

compiler maven- java with 2 errors in building package -

i'm using https://github.com/webdevwilson/magento-java connect store magento java integration system. installed maven , openjdk-6-jdk , set home java, etc. information is: sudo java -version java version "1.6.0_36" openjdk runtime environment (icedtea6 1.13.8) (6b36-1.13.8-0ubuntu1~14.04) openjdk 64-bit server vm (build 23.25-b01, mixed mode) sudo mvn -version apache maven 3.0.5 maven home: /usr/share/maven java version: 1.6.0_36, vendor: sun microsystems inc. java home: /usr/lib/jvm/java-6-openjdk-amd64/jre default locale: en_us, platform encoding: utf-8 os name: "linux", version: "3.13.0-43-generic", arch: "amd64", family: "unix" and when try in folder package contains pom.xml file: sudo mvn package or sudo mvn install compile result is: [info] 2 errors [info] ------------------------------------------------------------- [info] ------------------------------------------------------------------------ [info] build f

objective c - iOS: Changing the background image on tap gesture -

i have tap gesture set , when tap in simulator nslog fires, i'm sure it's hitting it: @implementation coolcontroller - (void)viewdidload { [super viewdidload]; ... uitapgesturerecognizer *backgroundtaprecognizer = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(backgroundtapped)]; backgroundtaprecognizer.numberoftapsrequired = 2; [self.view addgesturerecognizer:backgroundtaprecognizer]; } - (void) backgroundtapped { nslog(@"cool"); // <-- fires when tap twice [self.view setbackgroundcolor:[uicolor colorwithpatternimage:[uiimage imagenamed:@"table-2"]]]; } however, image in background doesn't change. need call method update ui? try this (void) backgroundtapped: (id)sender

Remove class with jQuery according to user behavior -

i have textbox <input type="text" name="txt1" id="txt1" class="comment"> that adds class of '.error' when dropdown option selected: .error { color:red; } but trying remove '.error' class when user begins type in textbox, like: if ($('.comment').val().length > 0) { removeclass('.error'); } apart minor syntax errors, main question when want code called. check on every keystroke, use keyup() . , if check value , removeclass() on this (where that's specific element key typed in), can have multiple .comment fields same behavior. $('.comment').keyup( function() { if (this.value.length > 0) { $(this).removeclass('error'); } } ) .error { background-color: red; // changed easier demo visibility } <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <inp

java - Android TabLayout scroll up animation with listfragment -

i have main xml set such: <android.support.design.widget.appbarlayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:fitssystemwindows="true"> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:background="?attr/colorprimary" app:layout_scrollflags="scroll|enteralways"/> <android.support.design.widget.tablayout android:id="@+id/tablayout" android:scrollbars="horizontal" android:layout_below="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/colorprimary" /> </android.support.desi

delphi - const set of Char and Pascal Script Unit Importer -

i'm running pascal script unit importer on unit, error: "expecting token '=' token 'of' found. previous tokens: 'worddelimiters: set of'" here constant triggers error: const worddelimiters: set of char = [#0..#255] - ['a'..'z','a'..'z','1'..'9','0']; the constant worddelimiters part of third party library. there way rewrite unit importer can work unit? a test shows set of char supported: type tworddelimiters = set of char; the unit importer result: procedure siregister_mytestunit(cl: tpspascalcompiler); begin cl.addtypes('tworddelimiters', 'set of char'); end; but constant set of char below doesn't work, there complaint on '..' double dots: const mychars = ['a'..'z', 'a'..'z']; skipping double dots , typing chars manually works, isn't there way? const mychars = ['a','b','

How to structure SELECT from VALUES on MS SQL Server 2000 -

i have old application running against sql sever 2000 . trying use following part of query. runs on more recent versions of sql server, not on 2000. error "incorrect syntax near keyword 'values'." is there syntax use 2000? select n from(values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11), (12) ) t(n) the values construct wasn't introduces till 2008 , in sql server 2000 can select n from( select 1 n union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9 ) t

javascript - Fastest way to add to and get values from a list of objects -

i'm getting started javascript objects. i'm trying store catalog inventory id , locations. think single object this: var item = { id: number, locations: ["location1", "location2"] }; i've started read bit still trying wrap head around it. not sure fastest way add new items list location, add new location existing item, while checking dupes. performance of getting locations later isn't critical. part of process running thousands of checks items id , location, performance key. final question, i'm not sure if it's possible store in local storage. similar question, i'm not sure. using lodash , should work determine if item id exists , append either new item array, or add new location: var item = [{ id: 1, locations: ["location1", "location2"] },{ id: 2, locations: ["location2", "location4"] }]; function finditem(id){ r

apache - .htaccess issue, getting url -

i'm having issue. i have vagrant box hosting me url (learnphp.dev) below .htaccess file rewriteengine on rewritebase / rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule^(.+)$ index.php?uri=$1 [qsa,l] it seems every page go home page. can find code below: https://github.com/mikerodham/simple-router/tree/master i'm pretty new php starting out simple things. if provide that'd great. try replace rewriterule this: rewriterule^(.+)/$ index.php?uri=$1 [qsa,l] taken answer

php - User input for a MongoDB search -

i trying accept user input user may able search database. > db.test2.find().pretty() { "_id" : objectid("55de8a17f8389e208a1e7d7e"), "name" : "john", "favorites" : { "vegetable" : "spinach", "fruit" : "apple", } } { "_id" : objectid("55de8a17f8389e208a1f6gg4"), "name" : "becky", "favorites" : { "vegetable" : "spinach", "fruit" : "apple", } } { "_id" : objectid("55e3b6cbec2740181355b809"), "name" : "liz", "favorites" : { "vegetable" : "spinach", "fruit" : "banana", } } in example, user able search combination of person's favorite vegetable, fruit, or both favorite vegetable , favorite fruit. if user entered spina

loops - Printing The Days of The Week In Java -

i'm trying print this: sun mon tue wed thur fri sat 4 3 8 5 4 4 8 with user's input of hours worked each day on same line total hours worked can calculated, i'm not sure if that's possible. here's snippet of current code: system.out.println("\t"+"\t"+"\t"+"\t"+"\t" + "sun" + "\t" + "mon" + "\t" + "tue" + "\t" + "wed" + "\t" + "thur" + "\t" + "fri" + "\t" + "sat"); (int j = 0; j < hoursworkedperday.length; j++) { system.out.print("enter hours worked employee " + (j+1) + ":"+ "\t" + " " + " "); (int k = 0; k < hoursworkedperday[0].length; k++) { hoursworkedperday[j][k] = scan.nextint(); } } // end of loop and current output: ent

asp.net - ASP Textbox MultiLine Text Counter -

can simplify code please, work on page, when checked on google developer tool console, got error: uncaught typeerror: cannot read property 'length' of undefined below code: <asp:textbox id="txtcounter" runat="server" width="250px" textmode="multiline"></asp:textbox> <span id="chars"></span> <script> $(document).ready(function () { var char2 = ($(this).find('textarea[id$=txtcounter]').val().length); if (char2 == 0) { $('#chars').text("100 maximum characters"); } else { $('#chars').text( char2 + " characters remaining"); } textchar(); }); function textchar() { $('textarea[id$=txtcounter]').on('keyup keydown change', function (){ var limit = 100; var lengthtxt = $(this).val().length; if (lengthtxt &g

ios - How to use RestKit without response description mapping? -

i have existing project using restkit , need update api requests. problem have post request doesn't need care response body. want know response status code 200 or not. don't add rkresponsedescriptor restkit reports error:"no response descriptors match response loaded.".how send request without response descriptors? idea? thanks use restkit create request run request yourself. if restkit isn't running request isn't involved in response processing.

html - vertically align a text in a responsive div -

i have following code vertical div css .container { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 60%; height: 60%; padding: 20px; text-align: center; box-shadow: 0 0 30px rgba(0, 0, 0, 0.2); border-radius: 25px; } html <div class="container"> random text </p> random text random text </p> random text random text </p> random text </div> i having trouble figuring out how in div put text vertically aligned , responsive ? jsfiddle code: https://jsfiddle.net/h49xx972/ try following - works me on codepen. added css id centered text (i assume both vertical , horizontal requirement) css .container { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 60%; height: 60%; padding: 20px; text-align: center; box-shadow: 0 0 30px rgba(0, 0, 0, 0.2); border-radius: 25px; } #text_container { posit

python - Process json data using Pyspark -

i building python script executed through apache spark in generating rdd json file stored on s3 bucket. need filter json rdd according data in json document , thereby generating new json file consist of filtered json documents.that json file needs uploaded s3 bucket. please suggest me appropriate solution implementation through pyspark . input json { "_id" : objectid("55a787ee9efccaeb288b457f"), "data" : { "n◦ categoria" : 102.0, "nombre categoria" : "gaseosas", "variable" : "top of heart", "var." : "toh", "marca" : "coca cola zero", "mes" : "enero", "mes_n" : 1.0, "aÑo" : 2014.0, "universo_total" : 1.0433982e7, "universo_femenino" : 5529024.0, "universo_masculino" : 4904958.0, "porcentaje_total" : 0.0066, "porcen

node.js - How to spawn a new process in php to call a node script that requires a child process -

i'm trying run php code in isolation. php code calls node script @ intervals required arguments. node.js script on other hand computes arguments additional data mongodb , spawns child process within call phantomjs arguments , creates heatmap image file(s). now node.js script runs fine when fired command line right arguments. but no matter try i'm unable work when called php. i have tried shell_exec , exec below: $node = '/usr/local/bin/node'; $scriptpath = $this->basepath . '/web/scripts/node/heatmaps_node_wrapper.js'; $clickmapcmd = $node . ' ' . $scriptpath . ' ' . $url . ' ' . $groupid . ' ' . $heatmapid . ' click'; $mousemovemapcmd = $node . ' ' . $scriptpath . ' ' . $url . ' ' . $groupid . ' ' . $heatmapid . ' mousemove'; $asynccmd = ' >' . $this->basepath . '/logs/heatmap.io.log 2>'. $this->basepath . '/logs/heatmap.err.log &am

Custom Regex Expression = $ ~ # № \ ; < > % / -

i need create regular expression match following characters on input: = $ ~ # № \ ; < > % / i don't have idea how combine or setup regex case. i have this $('input').bind('keypress', function (event) { var regex = new regexp(???); var key = string.fromcharcode(!event.charcode ? event.which : event.charcode); if (!regex.test(key)) { event.preventdefault(); return false; } }); need prevent symbols typing try this: var pattern = /^[=$~#№\\;<>%/]*$/ and if want letters , numbers try this: var pattern = /^[a-za-z0-9=$~#№\\;<>%/]*$/

javascript - Nginx: Proxy turn requests -

i hosting own turn-server , have configured nginx web server. this problem: i have javascript webrtc client needs call turn server ice candidates, turn-server running on 40501 port. unfortunately in javascript getting cross origin request blocked error! here's nginx called help. configured nginx listen on port 40500 , proxy requests port 40501 on turn-server running follows: upstream turn{ server 128.199.xx.xx:40501; } server { listen 40500; server_name _; location / { proxy_pass http://turn; proxy_http_version 1.1; proxy_set_header upgrade $http_upgrade; proxy_set_header connection $connection_upgrade; if ($request_method = 'options') { add_header 'access-control-allow-origin' '*'; add_header 'access-control-allow-credentials' 'true'; add_h

java - Dynamic list with JSON in Spring MVC -

i have new person form have table of objects this: <table class="table table-striped table-condensed flip-content"> <thead class="flip-content"> <tr> <th width="20%"> tipo encabezado </th> <th width="20%"> valor </th> <th width="10%"></th> </tr> </thead> <tbody> <tr th:each="ht : ${headerstype}"> <td th:text="${ht.headertype.name}"></td> <td th:text="${ht.value}"></td> <td class="operations"> <a class="delete" href="/profile/delete" th:href="@{/profile/delete/__${p.id}__}"> borrar </a> </td>

javascript - Snapsvg create hole in rectangle using mask -

Image
is possible create example circular hole in rectangle element in snapsvg? tryed use white , black elements , mask function cant figure out. results inverted (i saw circle color of rectangle) or no effect @ all. , searching google not helping either - relevant thing found that when tryed replicate using snapsvg did not work tryed describe before (i must admit, im not sure if mine fault or because snapsvg mask handling). its realy important simple solution using rectangle , not using paths or simillar things. what im trying achieve simillar gamemaker surfaces - dark foreground hole (light) see background trought it. also im looking solution handle more 1 circle hole in element , dynamic position changes. thx answer, hope possible. ps: sorry english, im not english speaking country here go. i've loosely recreated image. i've made black rectangle hole in can see green background through. var s = snap("#svg"); // make green rectangle. s

css - LESS - combine rules of media queries with same condition -

i using following less mixin optimize background images 2x screens. definition:: .image-2x(@image, @width: auto, @height: auto, @repeat: no-repeat) { @filename : ~`/(.*)\.(jpg|jpeg|png|gif)/.exec(@{image})[1]`; @extension : ~`/(.*)\.(jpg|jpeg|png|gif)/.exec(@{image})[2]`; background-image: ~`"url(@{filename}.@{extension})"`; background-repeat: @repeat; background-size: @width @height; @media screen , (-webkit-min-device-pixel-ratio: 2), screen , ( min--moz-device-pixel-ratio: 2), screen , ( min-device-pixel-ratio: 2), screen , ( min-resolution: 192dpi), screen , ( min-resolution: 2dppx) { background-image: ~`"url(@{filename}@2x.@{extension})"`; } } } usage:: selector1 { .image-2x("path/to/image1.png"); } selector2 { .image-2x("path/to/image2.png"); } output:: selector1 { background-image: url(path/to/image1.png); background-repeat: no-rep

php - How to store value that consist of string and has a list into mysql database -

data example inserted mysql db: value 1: "some text text text, random number 123455, unordered list: <ul> <li>some list</li> <li>some list</li> <li>some list</li> </ul>"; value 2: "some text text, there 2 unordered list here: <ul> <li>some list</li> <li>some list</li> </ul> <ul> <li>some list</li> <li>some list</li> </ul> , more text , more text"; these example of value want insert mysql db, values have 1 or more list , texts while others may not contain list. since bad insert list html tag mysql db, , can't loop values , give them list tag since values not have list inside it, simplest , efficient solution this? all suggestions welcomed. thx you can encode data before inserting ... , when want read data must decode again... in db must make column data type text ... if using php there function

java - Calculate currency exchange using checkboxes -

i've started learning java in android studio , i'm doing simple currency exchange app. has checkboxes indicating different countries different currency values. have problem saying crashed when run emulator. (it crashes when implemented calculation inside case us). works fine displaying strings though. java file: public class mainactivity extends appcompatactivity { arraylist<string> selection = new arraylist<string>(); textview final_result; edittext medit; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); final_result = (textview)findviewbyid(r.id.result_text); final_result.setenabled(false); } public void selectcountry (view view) { boolean checked = ((checkbox) view).ischecked(); switch (view.getid()) { case r.id.us: if(checked) { medit = (edittext)findviewbyid(r.id.edit_myr); double ou

How to get external JSON with PHP that has content-type text/plain? -

i trying fetch external json response php back-end problem external endpoint returned content-type: text/plain;charset=utf-8, , gives me gibberish when read it. string '����������ݒ�j�� ... etc... is there way encode response? this have done: $response = file_get_contents('external_url'); i have tried this: $json = json_decode(file_get_contents('external_url'), true); it doesn't matter php content-type response declares, doesn't do information. you're getting same response body whether header says text/plain or json. more response compressed , need uncompress gzinflate or such.

hibernate - Delete query with MAX in HQL -

i have tried use hql strings delete, can not find out problem is. last try was: final string deletestring = "delete foo l l.id < (max(id) l)"; final query query = this.getentitymanager().createquery(deletestring); final int deleted = query.executeupdate(); i getting this: org.hibernate.hql.ast.querysyntaxexception: unexpected token: near line 1, column 73 [delete eu.unicorn.ctds.entity.foo l l.id < (max(id) l) where problem? missing select before max. try final string deletestring = "delete foo l l.id < ( select max(id) l)"; after correcting query above, error while execution saying "you can't specify target table 'foo' update/delete in clause" means cannot delete row in foo while selecting max same table foo. have 2 queries. first query select max id , use id in delete query.

javascript - Show/hide and slider conflict -

a few days ago asked question regarding show/hide div script had problems with. js show/hide default behavior tested solutions , nothing seemed work on website (they work in fiddles or different areas of website 1 need in). problem inside show/hide divs have slider. there 4 tabs, each showing different slider. best guess problem appears because both slider , show/hide use same display:none, altering slider's content. here's js have show/hide: window.addeventlistener("hashchange", function () { var targetdiv = $(location.hash); if (!targetdiv.is(':visible')) { $('.page1').slideup(); targetdiv.slidedown(); } else { $('.page1').slideup(); } }, false); the slider use called flickity , it's link is; https://cdnjs.cloudflare.com/ajax/libs/flickity/1.1.0/flickity.pkgd.js the link of live website is: http://theworkshop.ro/astra3/ here's fiddle of show/hide: http://jsfiddle.net/s9cxjrmf/

Why is the Java date API (java.util.Date, .Calendar) such a mess? -

as people painfully aware of now, java api handling calendar dates (specifically classes java.util.date , java.util.calendar ) terrible mess. off top of head: date mutable date represents timestamp, not date no easy way convert between date components (day, month, year...) , date calendar clunky use, , tries combine different calendar systems 1 class this post sums quite well, , jsr-310 expains these problems. now question is: how did these classes make java sdk? of these problems seem obvious (especially date being mutable) , should have been easy avoid. how did happen? time pressure? or problems obvious in retrospect only? i realize not strictly programming question, i'd find interesting understand how api design go wrong. after all, mistakes learning opportunity (and i'm curious). someone put better ever it: class date represents specific instant in time, millisecond precision. design of class bad joke - sobering example of how p

android - Switch tabs from fragment -

i using 2 java files creating tab layout slidingtablayout.java & slidingtabstrip.java , hav fragments tabs. have button in tab1 switch tab2 doesnt work . using below code button in tab1 tabhost host = (tabhost) getactivity().findviewbyid( android.r.id.tabhost); host.setcurrenttab(2); the above code throws null pointer please help this tablayout file <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".mainactivity" > <include android:id="@+id/tool_bar" android:layout_width="match_parent" android:layout_height="wrap_content" layout="@layout/tool_bar" /> <com.datavs