Posts

Showing posts from January, 2015

html - When I update value of textbox in plain JavaScript, the text value is invisible -

i can't see why function inserts value of textbox invisible. tried changing hidden field plain visible field, didn't either. grateful enlightenment. here full page code, sorry german: <head> <style> body{ background: #111; color: #d00; } input{ background: #111; color: #c90; font-size: 1.4em; font-weight: bold; border-radius: 7px; } #aaa{ top: 10%; height: 20%; left: 30%; width: 40%; background: #133; color: teal; font-weight: bold; border: inset 3px #2d2d2d; -moz-border-top-left-radius:8px; -webkit-border-top-left-radius: 8px; -o-border-top-left-radius: 20px; border-top-left-radius: 8px; -moz-border-top-right-radius:8px; -webkit-border-

machine learning - Is there a java libaray or code example availabe that optimize paramters via LBFGS by giving current parameters, gradient and cost/loss(function)? -

what m looking function this: optimizebylbfgs(currentparamters,gradientofparamters,loss/cost) return: optimized paramters then use returned optimized paramters , calculate new loss/cost , feed them again ... , again... in function. can use purpose? something scipy.optimize.minimize in python java? current paramters , gradients availabe in array / vector in form of 100 rows , 1 column. avaialbe thanks in advance! there 1 in spark: https://spark.apache.org/docs/1.0.1/api/java/org/apache/spark/mllib/optimization/lbfgs.html and heard 1 nice too: https://github.com/brendano/myutil/blob/master/src/util/lbfgs.java

php - Multiple Select statements into an Insert statement -

i've been searching while , i'm not sure if allowed in mysql. i know allowed in mysql insert 'table' (column1, column2, column3) select val1, val2, val3 sometable also this insert 'table' (column1, column2, column3) values (val1, val2, val3), (val1, val2, val3) i not sure if allowed though: insert 'table' (column1, column2, column3) select val1, val2, val3 sometable, select val1, val2, val3 sometable obviously gave me error, allowed in mysql? you can try it, , fail. use union all instead of , : insert table (column1, column2, column3) select val1, val2, val3 sometable union select val1, val2, val3 sometable; i assume single quotes there sort of effect, because first 2 queries work.

html - Is it allowed/recommended to use height in responsive websites? -

i saw somewhere wasn't recommended use height , use padding instead, why that? height , padding produces same results - @ least in trials -... there reason me using padding instead of height? to answer question - of course can use height in responsive websites without problem. i think may have read using padding in place of height keeping aspect ratio of element same since percentage based padding relative width of element , percentage based height relative it's container. a common use case embedding youtube video in responsive wesbite. html <div class="video-container"> <iframe src="//www.youtube.com/embed/k_d5jwvbiru?wmode=opaque&amp;rel=0&amp;showinfo=0&amp;modestbranding=1&amp;controls=2&amp;autohide=1" frameborder="0" allowfullscreen=""></iframe> </div> css .video-container { position: relative; width: 100%; height: 0; padding-bottom: 56.25%; background

in app purchase - Android Subscription Cancellation -

i have in app purchase allows user subscribe annual service. in case of cancellations & refund via merchant center seems user still have access product billing cycle (whole year). how revoke & cancel subscription in current billing cycle? thanks. in case of cancellation there no refund user. when user cancels subscription means when current subscription expires there no auto-renew (purchase). quote docs: when user cancels subscription, google play not offer refund current billing cycle. instead, allows user have access canceled subscription until end of current billing cycle, @ time terminates subscription. example, if user purchases monthly subscription , cancels on 15th day of cycle, google play consider subscription valid until end of 30th day (or other day, depending on month). https://developer.android.com/google/play/billing/billing_subscriptions.html#cancellation

javascript - ng-click function logs if and else statement -

in test.js controller if/else statement log out object ng-click angular.module('stationeryapp') .factory('cards', function () { var cards = []; return cards }) .controller('testctrl', function ($scope, $log, cards) { $scope.cards = cards $scope.cardclick = function () { if ($scope.card['fname']!=="" && $scope.card['lname']!=="") { $scope.cards.push($scope.card) $scope.card={fname:'',lname:''} console.log($scope.card); } else { console.log($scope.card); } } }); this test.html: <div> <md-toolbar layout='column' layout-align='center'> <md-button layout-margin layout-padding flex='100' class='md-raised md-primary'> <h1>{{ card.fname }}</h1> <h1>{{ card.lname }}</h1> </md-button> <div layout=

sorting - Redis Sorted Set Member Size and Performance -

redis sorted sets sort based on score; however, in cases multiple members share same score lexicographical (alpha) sorting used. redis zadd documentation indicates function complexity is: "o(log(n)) n number of elements in sorted set" i have assume remains true regardless of member size/length; however, have case there 4 scores resulting in members being sorted lexicographically after score. i want prepend time bases key each member have secondary sort time based , add uniqueness members. like: "time-based-key:member-string" my member-string can larger javascript object literals so: json.stringify( {/* object literal */} ) will sorted set zadd , other functionality's performance remain constant? if not, magnitude performance affected? the complexity comes number of elements need tested (compared against new element) find correct insertion point (presumably using binary search algorithm). it says nothing how long take perform

c++ - Advanced File and String Operations -

so working on model loader in directx 11 program, , ran think unique issue. spent bit of time looking solution this, failed so. problem in file has texture path , list of vertices, want able pick out parts, , remove aswell. below example file texture-less triangle: t:0$ (0, 5, 0) (5, 0, 0) (-5, 0, 0) ^ old, @ edit below ^ let me explain what's happening here. first, "t:___" file path texture. have set "0" because not using texture. "$" after "t:0" program's mark end of file path , beginning of vertices. now, here need program do. 1. read file until character "$" has been reached. erase first 2 characters(the "t:") , "$" if has been added well. put remaining text string called texturedata. p.s. don't erase "t:" file, string(the file needs stay untouched). 2. put remaining text(vertices) temporary string called vertexdata, maybe remove parenthesis..? know how this, maybe not use

java - Cannot Figure out how to catch InputMismatchException -

so here current code catching inputmismatchexception error int weapon = 0 boolean selection = true; while(selection) { try { system.out.println("pick number 1, 2, or 3."); weapon = scan.nextint(); selection = false; } catch(inputmismatchexception e) { system.out.println("choose 1,2,3"); weapon = scan.nextint(); } } i'm trying make sure int entered , not else. scanner class been implemented , 'scan' act me. thanks efforts help! try this: int weapon = 0; do{ system.out.println("pick number 1, 2, or 3."); if(scan.hasnextint()){ weapon = scan.nextint(); break; }else{ system.out.println("enter integer only"); scan.nextline(); } }while(true); this make sure integer , keep asking until gets it.

javascript - Input value not changing with user input -

i'm working way through odin project, attempting make "etch-a-sketch" type website jquery. idea have div grid inside of when moused over, grid squares change color. user should able input how many grid squares want, if put 16 in form, they'll 16x16 grid. i set initial value 16. when input different number , hit "go", value changes 16 , grid remains same. going wrong? thanks! relevant code follows: html: <form> <label>enter width in pixels:</label> <input id="formbox" type="text" value="16"> <input id="setwidth" class="buttons" type="submit" value="go!"> <button id="reset" class="buttons" type="reset">reset</button> </form> js: $('#setwidth').click(function () { $('.box').css("background-color", "#fff"); $('.box').remove();

javascript - ActiveAdmin - Static Content on Index Page -

i trying map based filtering on activeadmin data set. have created partial contains map , associated javascript, , can render using code: activeadmin.register location menu priority: 4, label: 'locations' filter :name .... index panel "maps" div render :partial => "/admin/dashboard/map", :locals => { } end end .... however, if filters set on page such there no data meeting criteria data set - no content shown , map not shown. idea here allow filtering based on map, have working, when there no results, still want map show user can alter map settings , find data want. does know how in activeadmin? want partial show no matter result set particular index. thanks in advance!

php - Laravel Eloquent Multiple Join -

i have table albums, each album has multiple songs, artworks, , can belong number of series. each of songs can have lyrics table. so far have : routes.php route::get('get_albums', function() { return album::with('songs', 'artworks', 'series')->get(); }); album.php model <?php class album extends eloquent { protected $table = 'albums'; public function songs() { return $this->hasmany('song'); } public function artworks() { return $this->hasmany('artwork'); } public function series() { return $this->hasmany('serie'); } } song.php model <?php class song extends eloquent { public function album() { return $this->belongsto('album'); } public function lyric() { return $this->hasone('lyric'); } } artwork.php model <?php class artwork e

c# - Efficient way to tokenize conditionally -

given user input string: "mainframes/pl/ sql; software testing/pl/sql/project management/" what way tokenize string such '/' retained if part of "pl/ sql", not otherwise, giving tokens: "mainframes", "pl/ sql", "software testing", "pl/sql", "project management" this because users may accidentally enter '/' character separator. if order of tokens isn't important might work: public ienumerable<string> tokenise() { var input = "mainframes/pl/ sql; software testing/pl/sql/project management/"; var results = new list<string>(); foreach (match match in regex.matches(input, @"pl\s*/\s*sql", regexoptions.ignorecase)) { results.add(match.value); } input = regex.replace(input, @"pl\s*/\s*sql", string.empty, regexoptions.ignorecase); results.addrange(input.split(new []{'/'}, stringsplitoptions.remo

c++ - Determining order of traversal of a sequence -

i have list of elements 1 30 in ascending order. list may or may not contain 30 elements. can start traversing list point , once reach end, can jump , resume traversal other end, i.e. along lines of circular queue. given 2 consecutive elements (by position, may or may not value), possible determine direction of traversal, i.e. beginning end, or other way? note: don't have access list's indices , given values @ instant. i can 3 values, not two. no, it's not possible determine direction of traversal given 2 elements. conditions allow following list: [1, 30] . you're given 2 consecutive elements: 1, 30 . did start @ 1 travel right reach 30 , or did travel left , wrap around reach 30 ? it's impossible tell.

Mac OSX bring the console window front most with shell command -

here want ask bring console window top shell command. possible? there script execution in work environment, , take several minutes complete, move other work while running, better there tips notify me when script completes run. so think bring window top most direct way. please tell me how achieve this, i'm working on windows, new macos. thanks, levi i don't know how bring console window front, if you're working in terminal, like: $ path/to/script ; tput bel or $ path/to/script ; "script 1 done" where path/to/script whatever usual method of loading script is. i recommend first method, flashes screen, makes beeping noise, , causes terminal icon bounce , down on dock in os x 10.10. second might better if need figure out script done among bunch of scripts. if have coworkers don't want disturb, can change preferences in terminal alert flashes screen , doesn't make noise. if have access source code of script, can add tput bel or s

ruby on rails - Override validations of gem devise -

in model user add following validations problem devise have implemented own validations. how can override validations of devise user.rb class user < activerecord::base # include default devise modules. others available are: # :token_authenticatable, :confirmable, :lockable , :timeoutable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable # setup accessible (or protected) attributes model attr_accessible :email, :password, :password_confirmation, :remember_me validates_presence_of :email, :message=>"email no puede estar vacio" validates_presence_of :password, :message=>"password no puede estar vacio" validates_presence_of :password_confirmation,:message=>"validate confirmation no puede estar vacio" end browser email can't blank #validation of devise email email no puede estar vacio #my own validation password can't blank #validation of devise pa

how to determine package name of a class in a jar file -

Image
for example, in following example of log4j.jar: to import: import org.apache.log4j.logger; is package name "org.apache.log4j" determined path \org\apache\log4j\logger.class? yes, package name needs match path in jar file (or directory). otherwise class cannot found. however, cannot move class file around change package. encoded class bytecode itself. if want change it, need recompile class.

java - how to end the nested loop -

i have code, trying encoding message in images using least significant bit method. can't figure out how end encoding of message when there no message encode left. it continues until end of end of loop. i tried counters limit. same did in decoding part no avail that's why removed it. i included these methods because used , can used contain counters identify if message done encoding , can stop iterating encoding , decoding in constructor. public class steganography { public static steganographygui gui; public static string binarizedmessage = "", encodedmessage = "", decodedmessage = ""; public static int count = 0, limit = 0; public static bufferedimage image; public static int width, height, numlsb; public steganography() { if(gui.isencode()){ try { string messagetobehidden = gui.getmessage(); binarizedmessage = stringtobinary(messagetobehidden);

Grails 3.0.x - how to increase heap space when using "grails run-app" -

when executing "grails run-app" command line grails 3.0.1 web application, maximum heap size of 768m, seems hardcoded default in grails gradle plugin. the settings in java_opts or grails_opts not respected. how can let run-app use more heap space? set in application.yaml or build.gradle? this seems trick in build.gradle: bootrun { jvmargs = ['-xmx2048m'] }

matrix - Finding rotation between vectors in Matlab, from matrices of x and y components -

this question has answer here: angle between 2 vectors matlab 4 answers i trying find angle of rotation between 2 sets of vectors, each plotted using quiver() command. smaller angle between vectors. for each set of vectors, passing 4 654x470 matrices quiver(), first 2 matrices x , y map positions, , second 2 matrices x-component , y-component magnitudes, respectively. so have work x-component , y-component matrices each set of vectors. ultimately, resulting 654x470 matrix angle of rotation between 2 vectors @ each point. i believe need solve theta in following: cosθ = (u⃗ · v⃗) / (||u⃗|| ||v ⃗ ||) but unsure how implement dot product, using 654x470 matrices of x , y components u , v. this question unique in vectors 2d, , need computed x , y components. if want angle between points, can implement angle formula in vectorized form. % toy example d

Can Multidimensional Hash Values be inserted into InfluxDB? -

in influxdb, can post multidimensional hash values database? for example, hash: { "field1": "value1", "field2": { "field2a": "value2a", "field3a": "value3a" } } if can, how do this? when try via http admin interface, neither errors out or returns success. multidimensional values not supported influxdb. points have fields set of key-value pairs. currently, values can of type float, integer, boolean, or string. influxdb has no concept of nested key-values. relevant source here . a workaround store json string literal escaping double quote characters (e.g. \" ). implementing whatever functionality required in client. curl -h -xpost 'http://localhost:8086/write' -d ' { "database": "test", "retentionpolicy": "default", "points": [ { "name": &qu

android - Error in calculating distance -

i found code using json in calculating distance. tried edit use in project went wrong when click button. here code: public class mainactivity extends actionbaractivity { edittext e1,e2; textview t1; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); e1 = (edittext) findviewbyid (r.id.edittext1); e2 = (edittext) findviewbyid (r.id.edittext2); t1 = (textview) findviewbyid (r.id.textview1); } public void d (view view){ getroutdistane(0, 0, 0, 0); } public string getroutdistane(double startlat, double startlong, double endlat, double endlong) { string distance = "error"; string status = "error"; try { log.e("distance link : ", "http://maps.googleapis.com/maps/api/directions/json?origin="+ startlat +e1+ startlong +"&destination="+ endlat +e2+ endlong +"&sensor=false"); jsonobjec

c# - PictureBox increases in size with the same inputs when calling FitToScreen() -

Image
i’m having issue functionality in program. supposed fit image screen, does, subsequent calls function cause image increase in size ever slightly. becomes apparent after issuing command 5 times. here’s example gif of bug: the source program hosted here . make sure in "issue1" branch, geared toward issue. self-contained; download, compile, run. includes test "comic" use. the fittoscreen() functionality stored in mainwindow.cs : private void fittoscreen() { //todo: frameheight (aka height of picture box's tablelayout cell) keeps growing subsequent calls... // ensure comic has been loaded if (!_comiccontroller.comicloaded()) { messagebox.show("no comic loaded!", "cinemastrips"); return; } // make window's height tall screen var screenheight = screen.primaryscreen.workingarea.height; height = screenheight; var frameheight = tablelayoutpanel1.getrowheights()[1]; // send comi

iOS crash, can't symbolicate -

Image
my crash log: application received signal sigsegv (null) ( 0 corefoundation 0x0000000182ab02f4 <redacted> + 160 1 libobjc.a.dylib 0x00000001942d40e4 objc_exception_throw + 60 2 corefoundation 0x0000000182ab0218 <redacted> + 0 3 yixia 0x429496857fc2 _zn15ctxappidconvert17isconnectionappidepkc + 149220 4 libsystem_platform.dylib 0x0000000194b0094c _sigtramp + 52 5 yixia 0x42949679ff82 yixia + 485740 6 yixia 0x4294967b8072 yixia + 584284 7 libdispatch.dylib 0x0000000194925994 <redacted> + 24 8 libdispatch.dylib 0x0000000194925954 <redacted> + 16 9 libdispatch.dylib 0x000000019492a20c _dispatch_main_queue_callback_4cf + 1608 10 corefoundation 0x0000000182a677f8 <redacted> + 12

php - Jquery login popup form closed when clicking on submit -

i created popup login form in jquery. , working fine. when in clicked on submit button popup hides , error show message wrong username , password displayed when open login popup form again. want popup form remain open if there error message. $(function () { // calling login form $("#login_form").click(function () { $(".social_login").hide(); $(".user_login").show(); return false; }); // calling register form $("#register_form").click(function () { $(".social_login").hide(); $(".user_register").show(); $(".header_title").text('register'); return false; }); // going social forms $(".back_btn").click(function () { $(".user_login").hide(); $(".user_register").hide(); $(".social_login").show(); $(".header_title").text('login');

sql server - How to improve this SQL? -

my boss sent query , asked replace more efficient version , achieve following objective: get records package table has @ least 1 record in pass_package_details table. given sql: select distinct pckg.* pass_package pckg join pass_package_details pckg_dtl on (pckg.package_id = pckg_dtl.package_id) is_active = 1 , '2015/04/22' between date_start , date_end order package_name correct me if i'm wrong, believe query above slow down performance due join method. after reading this , i'm wondering of query achieved boss requirement , why. my sql : attempt #1 - using in : select pckg.* pass_package pckg is_active = 1 , '2015/04/22' between date_start , date_end , pckg.package_id in (select distinct pckg_dtl.package_id pass_package_details pckg_dtl) order package_name attempt #2 - using exists : select pckg.* pass_package pckg is_active =

html - a:hover not working because of z-index -

i purchased theme , trying modify images on homepage appear black , white , when hover return color. hovering on image has no effect due z-index afaik. .boxies { filter: url(filters.svg#grayscale); filter: gray; -webkit-filter: grayscale(1); } .boxies:hover{ filter: none; -webkit-filter: grayscale(0); } img{ display: block; position: relative; width: 100%; z-index: 10; } .front_holder { position: absolute; display: block; width: 100%; height: 100%; top: 0; left: 0; z-index: 24; opacity: 1; filter: alpha(opacity = 100); overflow: hidden; padding: 5px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; -webkit-transform: translatez(0px); } <img src="relaxation.jpg" alt="" class="boxies"> <div class="front_holder"> <a class="qbutton small" href="/manicure/" target="_self" style="

Why is my PyCharm debug button greyed out? -

Image
i use pycharm development google app engine. i'm trying ubuntu linux , installed , run buttons upper right greyed out , don't know it. can done run project? you need go run | edit configurations... , create google app engine run configuration project.

Converting a .storyboard file into raw swift code in Xcode 6 -

is there program can take .storyboard file, , convert swift code? example being: if have uiviewimage element in storyboard can program identify element , convert swift, insert code viewcontroller.swift file? (just example.) afaik, no. there's rather old nib2objc tool convert nibs objective c code. no storyboard -> swift tool know of.

excel - Search array of thing and spit it out in different column -

is there way break math calculation in different column str1+str2 /str3-str4*str5-str6 columns str1 , str2 , str3 str4 , str5 , str6. there no particular order , may occur multiple time. this may need: sub splitonsigns() dim x long, mystring string, mysign variant, myarr variant mysign = array("+", "-", "*", "/") mystring = activecell.text x = lbound(mysign) ubound(mysign) mystring = replace(mystring, mysign(x), "|") next myarr = split(mystring, "|") range(activecell.offset(0, 1).address & ":" & activecell.offset(0, ubound(myarr) + 1).address) = myarr end sub you can add more entries here: mysign = array("+", "-", "*", "/") if there more signs split on. assumes data doesn't have pipes in "|" can change split char unused 1 if needed. it works progressivly replacing signs pipe, splits string array using pipe split, posts

c++ - Conditional compilation and non-type template parameters -

i having trouble understanding non-type template arguments , hoping shed light on this. #include <iostream> template<typename t, int a> void f() { if (a == 1) { std::cout << "hello\n"; } else { t("hello"); } } int main() { f<int, 1>; } when compile this, error saying: /tmp/conditional_templates.cc:13:12: required here /tmp/conditional_templates.cc:8:5: error: cast ‘const char*’ ‘int’ loses precision [-fpermissive] t("hello"); ^ but, can't compiler detect non-type argument "a" 1 , hence else branch won't taken? or expect? in case, how accomplish this? try instead: #include <iostream> template<typename t, int a> struct { void f() { t("hello"); } }; template<typename t> struct a<t,1> { void f() { std::cout << "hello\n"; } }; int main() { a<int,1> a; a.f(); a<int,2>

netlogo - Move turtles around a patch -

i trying move turtle around patch 0 0 starting random position in world. circle keeps on growing. doing wrong here?. code: to setup clear-all create-turtles 5 ask turtles [ setxy random-xcor random-ycor ] ask patch 0 0 [ set pcolor green ] reset-ticks end go move-turtles tick end move-turtles ask turtles [ face patch 0 0 right 90 fd 0.01 set pen-size 3 pen-down ] end secondly want turtle move around patch define when reaches in range your approach take small step along tangent circle want, takes little bit outside circle. repeatedly, accumulates on time. for better way, see turtles circling example in netlogo models library.

Removing a range of values from a linked list -

i trying remove node linked list if value falls within range (greater or equal low , less or equal high). code removes first value found within range. public void removedata(e low, e high) { node previousnode = root; node deletenode = previousnode.getnext(); while (deletenode != null) { if (deletenode.getvalue().compareto(low) >= 0 && deletenode.getvalue().compareto(high) <= 0) { previousnode.setnext(deletenode.getnext()); } previousnode = previousnode.getnext(); deletenode = deletenode.getnext(); } } in code need is: public void removedata(e low, e high) { node previousnode = root; node deletenode = previousnode.getnext(); while (deletenode != null) { if (deletenode.getvalue().compareto(low) >= 0 && deletenode.getvalue().compareto(high) <= 0) { previousnode.setnext(deletenode.getnext()); }else{ previousnode = previousnode.getnext(); } deletenode = de

mysql - one Field for 2 parameters in JAVA -

public arraylist searchcustomer(string cid) throws sqlexception { arraylist searchcustlist = new arraylist(); preparedstatement pstmt = connection.preparestatement("select * customer (custid = ? or firstname ?)"); pstmt.setstring(1, cid); pstmt.setstring(2, "%" + cid + "%"); please explain last command used 1 text field search customer name or id can body explain last line your question unclear, if want understand : pstmt.setstring(2, "%" + cid + "%"); then set second parameter in sql query value of cid variable, , add % around adding % around, mean in sql 'any character', having %cid% mean containing cid in it. as actual query use cid either custid or firstname, mean user having specific id, or having in firstname id. which strange, , looks more bug, logical query, maybe come old legacy having id in firstname, knows

mysql - What is the best data type for DATE and TIME -

i have application saves date , time of transaction. initial database design create separate fields date date , time varchar. second option have single field datetime . what difference of these two?? i recommend use timestamp track every change made database. shou;d use datetime datatype if want store specific value of date , time in column. if want track changes made in values recommend use timestamp. mysql docs : the datetime type used when need values contain both date , time information. mysql retrieves , displays datetime values in 'yyyy-mm-dd hh:mm:ss' format. supported range '1000-01-01 00:00:00' '9999-12-31 23:59:59'. ... the timestamp data type has range of '1970-01-01 00:00:01' utc '2038-01-09 03:14:07' utc. has varying properties, depending on mysql version , sql mode server running in.

ios - [ valueForUndefinedKey:]: this class is not key value coding-compliant for the key appointmentDate.' - swift -

i want sort array of object below function sort array of object class func fn_sortbyparameter(arraytosort:nsmutablearray,paramname:nsstring!, isascending:bool!){ var sortdescriptor:nssortdescriptor = nssortdescriptor(key: paramname, ascending: isascending, selector: selector("localizedcompare:")) var sortdescriptors:nsarray = nsarray(object: sortdescriptor) var sortedarray:nsarray = arraytosort.sortedarrayusingdescriptors(sortdescriptors) arraytosort.removeallobjects() arraytosort.addobjectsfromarray(sortedarray) } and class func fn_sortbyparameter(arraytosort:nsmutablearray,paramname:nsstring!, isascending:bool!){ var sortdescriptor:nssortdescriptor = nssortdescriptor(key: paramname, ascending: isascending) var sortdescriptors:nsarray = nsarray(object: sortdescriptor) var sortedarray:nsarray = arraytosort.sortedarrayusingdescriptors(sortdescriptors) arraytosort.removeallobjects() arraytosort.addobjectsfromarray(sortedarra

css - How to get glass break effect with text -

i searching script creates glass break effect text using css didn't find anything. i used // triangulation using https://github.com/ironwallaby/delaunay // more check out zachsaucier.com const two_pi = math.pi * 2; var images = [], imageindex = 0; var image, imagewidth = 50, imageheight = 50; var vertices = [], indices = [], prevfrag = [], fragments = []; var margin = 50; var container = document.getelementbyid('container'); var clickposition = [imagewidth * 0.5, imageheight * 0.5]; window.onload = function() { tweenmax.set(container, { perspective: 500 }); // images http://www.hdwallpapers.in var urls = [ 'http://i.imgur.com/qddsepk.jpg', 'http://i.imgur.com/oedykah.jpg', 'http://i.imgur.com/llhspcj.jpg', 'http://i.imgur.com/tcz9gqs.jpg' ], image, loaded = 0; // quick , dirty hack load , display first image asap images

java - how to let install4j know not to remove certain files when uninstalling -

i have requirement files copy during installation (by running script) need kept when application uninstalled. how can achieved in install4j? if use "copy files , directories" action copy files during installation, can set "uninstall mode" property "never" prevent copied files getting uninstalled.

matlab - Rational function curve fitting in python -

Image
i trying fit curve x , y data points using rational function. can done in matlab using cftool ( http://de.mathworks.com/help/curvefit/rational.html ). however, looking same in python. have tried use scipy.optimize.curve_fit, requires function, don't have. you have function, rational function. need set function , perform fitting. curve_fit requires supply arguments not lists, supplied additional function fitting on specific case of third degree polynomial in both numerator denominator. def rational(x, p, q): """ general rational function description. p list polynomial coefficients in numerator q list polynomial coefficients (except first one) in denominator first coefficient of denominator polynomial fixed @ 1. """ return np.polyval(p, x) / np.polyval([1] + q, x) def rational3_3(x, p0, p1, p2, q1, q2): return rational(x, [p0, p1, p2], [q1, q2]) x = np.linspace(0, 10, 100) y = rational(x, [-0.2, 0.3,

Ruby on Rails - model validation -

Image
i have problem simple model validation. entering materials without sku getting me error message: nomethoderror in materials#create undefined method `empty?' nil:nilclass material.rb: class material < activerecord::base validates :sku, :presence => true end materials_controler.rb (create part only): # post /materials # post /materials.json def create @material = material.new(material_params) respond_to |format| if @material.save format.html { redirect_to @material, notice: 'material created.' } format.json { render :show, status: :created, location: @material } else format.html { render :new } format.json { render json: @material.errors, status: :unprocessable_entity } end end end define @units in create method

testing - Monitoring CPU and MEM of embedded system with Jenkins -

i need somehow monitor cpu , mem usage of embedded system during automated system tests using jenkins. as of jenkins flashing target newest build , afterwards running tests. system running arm linux able make script poll info through ssh during tests. my question if there tool provides functionality - if not how make jenkins process file , provide graph of cpu , memory info during these tests? would plugin suit needs? monitoring plugin: monitoring of jenkins

javascript - sorting is not performing in jquery -

i doing sorting on div, unable perform sorting. using jquery.fn.sortelements. below html. <div id="sortlist"> <div class="list" style="display: block;"> <a onclick="openinfowindow("10"); return false;" href="#"></a> <div class="imgclass"> <a onclick="openinfowindow("10"); return false;" href="#"> <img class="innerimg" alt="" src="img"> </a> </div> <div class="inner"> <div class="name">edata</div> </div> </div> <div class="list" style="display: block;"> <a onclick="openinfowindow("10"); return false;" href="#"></a> <div class="imgclass">