Posts

Showing posts from January, 2015

javascript - how to isolate scope using directive call a method from directive to controller and method using arguments -

here sample angularjs code .currently can't item name clicked . passed argument name attribute inside method directive template. method used in parent controller. <!doctype html > <html> <head> <style> .onoffswitch { position: relative; width: 90px; -webkit-user-select:none; -moz-user-select:none; -ms-user-select: none; } .onoffswitch-checkbox { display: none; } .onoffswitch-label { display: block; overflow: hidden; cursor: pointer; border: 2px solid #999999; border-radius: 20px; } .onoffswitch-inner { display: block; width: 200%; margin-left: -100%; -moz-transition: margin 0.3s ease-in 0s; -webkit-transition: margin 0.3s ease-in 0s; -o-transition: margin 0.3s ease-in 0s; transition: margin 0.3s ease-in 0s; } .onoffswitch-inner:before, .onoffswitch-inner:after { display: block; float: left; width: 50%; height: 20px; padding: 0; line-height: 20px; font-size: 8px; color: white; font-family:...

html - Non-breaking space between span content and text -

Image
can make non-breaking space between span content , text? read it, don't see same situation. <span style="some_style"> <span number="1">1</span>"some big text" </span> i need add non-breaking space between span content ( number="1" ) , first word after only. thank on seeing example image, i'm not sure asking need. i suspect 'number' span should outside containing block involve absolute positioning. like so. .some_style { display: block; width: 50%; margin: 1em auto; position: relative; text-align: justify; } span[number] { position: absolute; top: 0; left: -1em; } <span class="some_style"> <span number="1">1</span> lorem ipsum dolor sit amet, consectetur adipisicing elit. est incidunt ducimus facilis quae magnam vel sit alias consequatur voluptate modi repellat enim eaque soluta accusantium. </sp...

git - Gitolite support "public repository" authority? -

recent research in git, encounter problem : if want repository open public (no ssh key, can clone), gitolite can it? yes , no. yes, can add gitolite access rule allow read access everyone. r @all (using special group @all) but, independently of gitolite, if access git repo ssh url, need ssh key. without ssh key, means git hosting server should support http access (and call gitolite httpd configuration file)

How to put a new column after a "sort" in a google sheets doc? -

i have following issue: create column pulling data columns of dfferent sheets ctreate single column created unique values. i use column via transpose(sort(range)) create column headings on third sheet. my problem how can add "total" column without knowing how many columns there going be? easy enough via "if" statement check columns there , build queries, how add last column has me stumped. thanks the best way me create custom function though google script , use formula. can use following script //do not edit function addtotal(range) { return range+",total"; } and in sheet type range =split(addtotal(sort('report lookup'!f:f)),",") you don't need transpose in case

c++ - Qt4 to Qt5: QPainter::drawPixmapFragments() with 5 arguments - how to solve? (Updated) -

qt 4.8 (4.8.6) has qpainter::drawpixmapfragments() overloaded function 5 arguments: void drawpixmapfragments(const qrectf *targetrects, const qrectf *sourcerects, int fragmentcount, const qpixmap &pixmap, pixmapfragmenthints hints = 0); qt 5 (5.4.1) has no such function, has 1 (same in qt 4.8) 4 arguments: void drawpixmapfragments(const pixmapfragment *fragments, int fragmentcount, const qpixmap &pixmap, pixmapfragmenthints hints = 0); i've searched in wiki.qt.io , here on stackoverflow , several other places, there no answer how port qt 4.8 qt 5. does know how it? upd i've taken realization qt 4.8.6 source ( qpainter.cpp ) , transform take pointer qpainter first parameter: namespace oldqt { void drawpixmapfragments(qpainter *painter, const qrectf *targetrects, const qrectf *sourcerects, int fragmentcount, const qpixmap &pixmap, qpainter::pixmapfragmenthints hints) { // q_d(...

matplotlib - Python: how to plot points with little overlapping -

Image
i using python plot points. plot shows relationship between area , # of points of interest (pois) in area. have 3000 area values , 3000 # of poi values. now plot looks this: the problem that, @ lower left side, points severely overlapping each other hard enough information. areas not big , don't have many pois. i want make plot little overlapping. wondering whether can use unevenly distributed axis or use histogram make beautiful plot. can me? i suggest using logarithmic scale y axis. can either use pyplot.semilogy(...) or pyplot.yscale('log') ( http://matplotlib.org/api/pyplot_api.html ). note points area <= 0 not rendered.

c++ saving object allocation and deletion -

i'm working on little game, , need somes class/struct allocated , deleted often. i'm wondering way save deletion, maybe putting delete object in container, , try pick in container when want allocate instance of class. i'm thinkin overload of new , delete operator. have little problem, if overload delete operator (to put "deleted" object in container), how delete it? should pass throught proper function that? there 2 ways go that 1) pool of objects. when "allocate" take object pool , when deallocate return pool. not transparent implementation not hard. 2) create custom allocator classes/structs. preallocate memory in big buffer , when need allocate take memory there , when need deallocate return memory (the actual mechanism you). bit harder implement can more transparent. check following links ideas http://www.drdobbs.com/policy-based-memory-allocation/184402039 http://www.boost.org/doc/libs/1_57_0/doc/html/interprocess/allocators...

c - Checking for memory usage changes in /proc/pid/statm -

i know /proc pseudo filesystem makes impossible use inotify api. some parts of /proc can monitored select/poll api (like /proc/mounts). i'm wondering possible monitor /proc/pid/statm in way? since data found in /proc/pid/statm generated kernel on fly guess select/poll wouldn't work. there other solution available me accomplish want, except reading /proc/pid/statm periodically?

mysql - SQL Query Primary Key constraint -

i newbie in sql. can please enlighten me on following sql query. problem lies in staffid int not null auto_increment, primary key(personid) $sql = "create table persons(staffid int not null auto_increment, primary key(personid),firstname varchar(15),lastname varchar(15),age int)"; thank you. regards. you trying create primary key of invalid column, omitting auto increment column. please try below sql. see documentation mysql create table persons(staffid int auto_increment, personid varchar(10), firstname varchar(15), lastname varchar(15), age int, primary key (staffid,personid));

java - Can't get @override annotation from method -

when method class instance, , want @override annotation. method has not annotation. impossible @override annotation? code below. package com.test; import java.lang.annotation.annotation; import java.lang.reflect.method; import javax.annotation.resource; public class reflectiontest { public static void main(string[] args) throws exception { childhoge childhoge = new childhoge(); method method = childhoge.getclass().getmethod("init"); (annotation s : method.getannotations()) { system.out.println(s); } method method2 = childhoge.getclass().getmethod("a"); (annotation : method2.getannotations()) { system.out.println(a); // =>@javax.annotation.resource(mappedname=, shareable=true, type=class java.lang.object, authenticationtype=container, lookup=, description=, name=) } } } class superhoge { public void init() { } } class childhoge extends superhoge { ...

c# - What is a NullReferenceException, and how do I fix it? -

i have code , when executes, throws nullreferenceexception , saying: object reference not set instance of object. what mean, , can fix error? what cause? bottom line you trying use null (or nothing in vb.net). means either set null , or never set @ all. like else, null gets passed around. if null in method "a", method "b" passed null to method "a". the rest of article goes more detail , shows mistakes many programmers make can lead nullreferenceexception . more specifically the runtime throwing nullreferenceexception always means same thing: trying use reference, , reference not initialized (or once initialized, no longer initialized). this means reference null , , cannot access members (such methods) through null reference. simplest case: string foo = null; foo.toupper(); this throw nullreferenceexception @ second line because can't call instance method toupper() on string reference pointing null ....

ios - Linking Errors while integrating SKMaps.Framework -

getting these error while trying integrate skmaps framework undefined symbols architecture x86_64: "croutetestmanager::calculateroute(ngrouteinput const&, std::__1::shared_ptr<croute>&)", referenced from: poitrackertest::createroute() in skmaps(poitrackertest.o) "_gptestroutesmanager", referenced from: poitrackertest::createroute() in skmaps(poitrackertest.o) createnavigationobject(int) in skmaps(navigationtest.o) ld: symbol(s) not found architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation) please me resolve error. environment : xcode 6.3.1, mac osx 10.10.3 deployment target ios7.0 supports swift. i following guide : http://developer.skobbler.com/getting-started/ios and added coremotion.framework there linking errors related framework. cause of linker error this appears result of linker flag -all_load , may have been added project through cocoapod. in rare ca...

open in new tab using right click not working angularjs using ng-repeat, ng-href and ng-click -

this code.. <div class="container-fluid" id="con2"> <div class="row-fluid" id="row2"> <div ng-repeat="product in productdetails" class="row"> <div id="searchdiv1" class="col-lg-offset-1 col-lg-2 col-md-offset-1 col-md-2 col-sm-offset-2 col-sm-1 col-xs-offset-1 col-xs-2 padding-0" id="div21" > <div class="enlarge"> <img style="width:70px; height:70px;" class="center-block enlarge pull-right {{product.classinfo}}" ng-model="productimage" ng-src="{{product.documents.image}}"> <span> <img id="dataimage" ng-src="{{product.documents.image}}"></span> </div> </div> <div class="col-lg-5 col-md-5 col-sm-8 col-xs-6 {{product.clas...

ibm mobilefirst - Does IBM Worklight 6.0 support Rich Push Notification -

i know ibm worklight 6.0 server supports basic push notification, , there sample codes available on ibm worklight site implement it. i want know if ibm worklight server supports rich push notification sent gcm or apn worklight server. sample code send push notification mobile sound supported given below: wl.server.notifyalldevices(usersubscription, { badge: 1, sound: "alarma.wav", activatebuttonlabel: "clickme", alert: notificationtext, payload: { foo : 'bar' } }); i want check if payload can support send rich notification. worklight push notifications android: support basic gcm notifications (push notifications) support cloud sync notifications support notifications priority (starting mfp 6.3 ) does not support rich notifications - note rich notifications not same push notifications does not support creating custom notification views (you'll need override default , implement ...

symfony - Symfony2 bundle, show CAPTCHA only after few tries -

is there bundle symfony2 (orocrm) bundle show captcha (recaptcha better) after few tries, not @ first time after page loading. or maybe there way in symfony2. you can use session purpose. save counter value in session variable , compare predefined value: if greater value use captcha if not - increment counter.

c# - List method to get difference of another list with duplicates (listobject.Expect method does not work) -

there 2 lists. need difference list<int> list1 = new list<int>() {18, 13, 22, 24, 20, 20, 27, 31, 25, 28 }; list<int> list2 = new list<int>() {18, 13, 22, 24, 20, 20, 20, 27, 31, 25, 28, 86, 78, 25 }; var listdif = list2.except(list1); foreach (var s in listdif) console.writeline(s); console.read(); the answer should 20, 86,78, 25 outputs 86,78 if want that kind of behaviour should try this: list<int> list1 = new list<int>() { 18, 13, 22, 24, 20, 20, 27, 31, 25, 28 }; list<int> list2 = new list<int>() { 18, 13, 22, 24, 20, 20, 20, 27, 31, 25, 28, 86, 78, 25 }; // remove elements of first list second list list1.foreach(l => list2.remove(l)); list2 = list2.distinct().tolist(); list2.foreach(d => console.writeline(d)); console.read();

jsf 2.2 - Installing Apache MyFaces 2 on WildFly 8.2.0 -

i want add apache myfaces 2.2.7 in wildfly 8.2.0 , use default implementation. can anybode please let me know can found installer jar apache myfaces ? i following link https://developer.jboss.org/wiki/stepstoaddmyfacessupporttowildfly add myfaces support wildfly. as understand correctly, need download install-myfaces-2.2.7.jar , rename cli. but can find jar ? couldn't find jar on nexus respository mentioned in above link. i found way jar. following steps : download source wildfly 8.2.0 . go location : <wildfly_source_root>/jsf/multi-jsf-installer. run below command - mvn -djsf-version=2.2.7 -pmyfaces clean assembly:single this create .zip file should renamed .cli. please follow link - here detailed description

ios - Implementing a horizontal UIPanGestureRecognizer within a vertical UIScrollView -

i know topic has been discussed @ length can't find proper solutions problem despite searching. i'm trying replicate behaviour experience in mail.app's table view in scroll view. want user able scroll through view of content normal, able swipe items out of view. i have standard uiscrollview , scrolls vertically. have several views have uipangesturerecognizer s attached them. view controller delegate these gesture recognizers, ensure normal scrolling of scroll view. - (bool)gesturerecognizer:(uigesturerecognizer *)gesturerecognizer shouldrecognizesimultaneouslywithgesturerecognizer:(uigesturerecognizer *)othergesturerecognizer { if ([gesturerecognizer iskindofclass:[uipangesturerecognizer class]] && gesturerecognizer != self.scrollview.pangesturerecognizer) return yes; return no; } the issue these gesture recognizers recognize when user begins scrolling scroll view. understand why happening, , i've tried dozens of ways try work around it. th...

java - How do I adjust these images displayed on gridlayout? -

Image
i've displayed on gridlayout 4 direction bottons trying make "game control panel" this: the game made, trouble "game panel", that's looks small on big devices tablet: how can make buttons displayed filling parent?, xml code this, i've made custom layout called square layout display game: <relativelayout 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" tools:context=".mainactivity" android:background="@drawable/background" android:padding="10dp"> </*packages*/squarelayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/square" android:layout_alignparentleft="true" android:layout_alignparentstart="true"> //gameview ...

android - Setting a toolbar click action -

i wanted replace deprecated version of android.support.v4.app.actionbardrawertoggle looked little , found how : how implement drawerarrowtoggle android appcompat v7 21 library except doesnt work : error this activity has action bar supplied window decor , if change style action bar wont seen.

c# - Activex run on my computer but not on others -

my activex run on computer(the computer used make it) not when tried on other computers. tried internet explorer setup. signed cab file signtool wizard , change setting ie accept unsigned didn't work. here can try yourself. www.smartcad.se\temp\default.html the message written in swedish. says: "internet explorer must used show page. if first visit, install , restart computer." after restart , page should work.but didn't on other computer. tried run msi file direct on computers didn't help.

css - How to get docraptor to pdf using the print stylesheet in Rails? -

so have rails 3.2.x code takes html view page , outputs pdf using docraptor print service. issue doesn't shrink contents fit on pdf page, there's overrun. i tried media query inject css printing, didn't seem anything. what options try , make work? 1) thought making separate print style sheet (instead of media query) i'm not sure docraptor treating html document in "print mode" when send docraptor via post request. 2) make separate rails view print out narrower width (say 500 px), ensure contents fits on pdf page when outputted. more work, i'm trying make #1 work haven't had luck. class pdfmaker include httparty def make_pdf options = { :document_url => url, :document_type => "pdf", :name => "mydocument.pdf", :test => false, :async => false, :prince_options => {:baseurl => 'http://www.example.com'} } resp...

ios - How to set quality of service within AFNetworking? -

does knowing set qos class in afnetworking ? because of request in app triggers time out, @ same time there other operations of operation queue going on using network. i want set networking request afnetworking qos_class_user_initiated , it's seems default value qos_class_default , how achieve this? thanks.

linux - Why are both "true" and "false" tests true? -

the words "true" , "false" special words (builtins) bash. if used in if test, act intuitively expected: $ if true; echo "true"; else echo "false"; fi true $ if false; echo "true"; else echo "false"; fi false however, 2 tests: $ [[ true ]] && echo "true" || echo "false" true $ [[ false ]] && echo "true" || echo "false" true both result in true. why? [[ … ]] is, in case, equivalent test , i.e. test true , test false . looking @ manual test(1): -n string length of string nonzero string equivalent -n string true , false both non-empty strings.

join an array of numbers into 1 number in javascript? -

how join array give me expected output in few steps possible? var x = [31,31,3,1] //expected output: x = 313131; use array join method. join joins elements of array string, , returns string. default separator comma (,). here separator should empty string. var x = [31,31,3,1].join("");

Need to upgrade TYPO3 version 6.1.7 to latest version -

i working on typo3 version 6.1.7 , requirement upgrade latest version. what have keep in mind or consider while upgrading version? how can upgrade typo3 version? see https://docs.typo3.org/typo3cms/installationguide/latest/upgrade/ further details on upgrading. it's possible select different target versions 7.6 or 6.2 in documentation well...

jscript - parameterization of a “set of scripts” -

i have 1 project automation in testcomplete. project contains scripts organised according our need 1 folder contains 10 scripts , folder contains 15 scripts , on. we facing problem in when want check specific pre conditions before running set of scripts. ex: 1st folder having 10 scripts , should run when machine has win7 os , ms office 2007 & ie version 10. it kind of parameterization of “set of scripts”. not keyword word based automation. scripting based. using jscript scripting language. the way see create special " runner " script every bunch of scripts. script check required conditions , if met, subsequently run tests corresponding group. need run these runner scripts (e.g. using test items), satisfy current environment conditions work , rest exist immediately. update: for example: function testset1() { // if environment not suit test set, exit if (false == utilityscripts.checkenvironmentfortestset1()) return; test1(); test2(); t...

ios - NSExpression using sqrt: function results in NSInvalidArgumentException -

i'm getting nsinvalidargumentexception: *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: 'unsupported function type passed sql store' when trying use nsexpression take square root of nested nsexpression using "multiply:by:" function. my code looks this: nsmanagedobjectcontext *context=[[bdcoredatacontroller sharedcontroller] mainmanagedobjectcontext]; nsfetchrequest *therequest=[[nsfetchrequest alloc] init]; [therequest setentity:[nsentitydescription entityforname:@"bdcompanyentity" inmanagedobjectcontext:context]]; therequest.resulttype=nsdictionaryresulttype; nsexpression *constantexpression=[nsexpression expressionforconstantvalue:[nsnumber numberwithdouble:22.5]]; nsexpression *firstkeypath=[nsexpression expressionforkeypath:@"epsttm"]; nsexpression *secondkeypath=[nsexpression expressionforkeypath:@"bookvaluepershare"]; nsexpression *firstmultiplyexpression=[nsexpression ...

livecode - Login form have some problems -

i beginner in livecode. got code log in. problem want convert password "*" how change following code local susername, spassword on opencard put "johnsmith" susername put "pa55word" spassword end opencard on logincheck if field "username" susername , field "password" spassword answer "login successful" go card "accessed" else answer "details incorrect. please try again!" end if end logincheck one simple method use keydown message along custom property store clear text. place following code in password field's script: on keydown thekey -- restrict allowed keys defined characters if thekey not in "abcdefghijklmnopqrstuvwxyz1234567890" exit keydown put hiddentext of me temp put thekey after temp set hiddentext of me temp put "*" after me end keydown on backspacekey set hiddentext of me empty set text of me empty end backspacekey the second ...

Rewriting Matlab eig(A,B) (Generalized eigenvalues/eigenvectors) to C/C++ -

do have idea how can rewrite eig(a,b) matlab used calculate generalized eigenvector/eigenvalues? i've been struggling problem lately. far: matlab definition of eig function need: [v,d] = eig(a,b) produces diagonal matrix d of generalized eigenvalues , full matrix v columns corresponding eigenvectors a*v = b*v*d. so far tried eigen library ( http://eigen.tuxfamily.org/dox/classeigen_1_1generalizedselfadjointeigensolver.html ) my implementation looks this: std::pair<matrix4cd, vector4d> eig(const matrix4cd& a, const matrix4cd& b) { eigen::generalizedselfadjointeigensolver<matrix4cd> solver(a, b); matrix4cd v = solver.eigenvectors(); vector4d d = solver.eigenvalues(); return std::make_pair(v, d); } but first thing comes mind is, can't use vector4cd .eigenvalues() doesn't return complex values matlab does. furthermore results of .eigenvectors() , .eigenvalues() same matrices not same @ all: c++: matrix4cd x; mat...

how to raise Google Big Query daily query quota -

we running batch process, , hitting daily query quota of 20,000. is there way raise limit? thanks. the query-per-day limit (currently 40k / day) 1 we're happy raise. in general, there prevent abuse scenarios (people use bigquery calculator, in select 17 + 32 ). if you're running real queries on non-trivial sized data, willing raise ceiling. if you've got contact google cloud support, please let them know project id. if not have support contact, can indicate project id here, or e-mail me (tigani@google.com) , route request appropriately.

golang unix socket error. dial: resource temporarily unavailable -

so i'm trying use unix sockets fluentd logging task , find randomly, once in while error dial: {socket_name} resource temporarily unavailable any ideas why might occurring? i tried adding "retry" logic, reduce error, still occurs @ times. also, fluntd using default config unix sockets communication func connect() { var connection net.conn var err error := 0; < retry_count; i++ { connection, err = net.dial("unix", path_to_socket) if err == nil { break } time.sleep(time.duration(math.exp2(float64(retry_count))) * time.millisecond) } if err != nil { fmt.println(err) } else { connection.write(data_to_send_socket) } defer connection.close() } go creates sockets in non-blocking mode, means system calls block instead. in cases transparently handles eagain error (what indicated "resource temporarily unavailable" message) waiting until socket ready read/write. doesn't seem hav...

python 2.7 - Local time using UTC, coordinates (PyEphem not working) -

i have list of coordinates , utc time frustratingly pyephem's localtime function doesn't work--it displays computer's local time. want filter out stations in night time (not in between hours of 8 , 4 pm). there easy way this? sit,lat,lon in zip(nsites,lats,longs): user=[] user = ephem.observer() user.lat = lat user.lon = lon user.date=bstart if ephem.localtime(user.date).time()>=datetime.time(8) , ephem.localtime(user.date).time()<=datetime.time(16): user.date=cend if ephem.localtime(user.date).time()>=datetime.time(8) , ephem.localtime(user.date).time()<=datetime.time(16): mask.append(true) else: mask.append(false) else: mask.append(false) adding rickhg12hs answer, consider setting user.horizon "–6" (civil twilight), "-12" (nautical twilight), or "-18" (astronomical twilight) de...

javascript - Unable to change state of checkbox dynamically using setState -

below simple react component initial state of checkbox false. i trying change dynamically using setstate(). not work. here code: var hello = react.createclass({ getinitialstate: function(){ return { checked : this.props.checked.tostring() === "false" ? false : true }; }, render: function() { console.log("rendering=="); return <div><input type = "checkbox" defaultchecked = {this.state.checked}/></div>; } }); var compref = react.render(<hello checked = "false" />, document.body); trying change state after rendering component settimeout(function(){ compref.setstate({checked: true}) },3000); i unable change checkbox state using setstate. here fiddle by providing defaultchecked instead of checked creating uncontrolled compon...

xml - Building in PC a C struct for an embedded target -

i need extract data xml , link struct c embedded project. the xml unavailable in runtime. (no file system, file big, , security reasons). have parse , generate struct on pc pre-linkedge. if use binary data won't necesarilly in same format in target (even compiler same vendor, right?). generate c file compiled within project? there easier way? struct mystruct s = generatemystruct("file.xml"); s.generatecfile("convertedxml.c"); controlling structure layout if use data types in <stdint.h> (e.g. int32_t , uint8_t ) , define fields every byte in struct keep types aligned sizes (e.g. 32-bit values should 4-byte aligned, 16-bit values should 2-byte aligned), should okay , structure's layout should match on both platforms. for example, don't write struct this: typedef struct { uint8_t a; uint32_t b; } foo; because compiler might magically stuff 3 bytes in between a , b b multiple of 4 bytes start of structure. inste...

iOS - CGImageRef Potential Leak -

i have code: cgimageref imageref = cgimagecreatewithimageinrect([image cgimage], rect); uiimage *outputimage = [uiimage imagewithcgimage:imageref scale:image.scale orientation:uiimageorientationup]; and warning: object leaked: object allocated , stored 'imageref' not referenced later in execution path , has retain count of +1 but using arc , cannot use release or autorelease . how resolve this? just add code cgimagerelease(imageref); from cgimagecreatewithimageinrect document, the resulting image retains reference original image, means may release original image after calling function. so,what need call cgimagerelease make retain count -1

javascript - validation rule conditional upon value of myVariable -

usung jquery validator, apply rule (regex) if variable (myvariable) has given value. i thought about... rules: { nhi:{regex:function() { var myvariable =6; return myvariable =6;} }, }, i thought if expression myvariable=6 evaluates true validation rule applied. , if expression false won't applied. noticed approach seems work, other times doesn't if expression being evaluated. changing code use === instead of = seems force fresh evaluation of expression. not. ultimately want run validation user ip addresses firstly want understand simple way turn validation on or off javascript. the following works: var myvariable =6; ... rules: { nhi:{regex:myvariable ===6} }, so perhaps simple that? closer goal: var countrycode ="nz"; ... rules: { nhi:{regex:countrycode ="nz"} }, this turns validation on (if nz) , off otherwise. great. insert geoplugin head: <script type="text/javascript" sr...

java - Sorting characters inside String -

i'm trying sort characters alphabetically in string , when run code following example: hello , get: heeeeeeeeeheeeelheeellhee instead of ehllo . smb suggest me should fix in code? in advance! public static void main(string[] args) { string result = ""; scanner kbd = new scanner(system.in); string input = kbd.nextline(); char[] myarray = input.tochararray(); for(int = 0; < myarray.length; i++) for(int j = 0; j < myarray.length; j++) { if(myarray[i] > myarray[j]) { char temp = myarray[j]; myarray[j] = myarray[i]; myarray[i] = temp; result += myarray[i]; } else result += myarray[i]; } system.out.println(result); } on each iteration of loop, appending character @ i within array result , array not...

get - Getting IP addresses from users using Python? -

i know right code in order ip address user after visiting website using python. i've searched nothing found. thanks in advance my guess running django? if use snippet(just call in view function): def get_client_ip(request): x_forwarded_for = request.meta.get('http_x_forwarded_for') if x_forwarded_for: ip = x_forwarded_for.split(',')[0] else: ip = request.meta.get('remote_addr') return ip

ruby on rails - Postgree double group by repeating attribute -

i have table columns: id, user_id, message_id, message_type; example: id: 1, user_id: 1, message_id: 4, message_type: 'warning' id: 2, user_id: 1, message_id: 5, message_type: 'warning' id: 3, user_id: 1, message_id: 6, message_type: 'warning' id: 4, user_id: 2, message_id: 4, message_type: 'error' id: 5, user_id: 2, message_id: 1, message_type: 'exception' id: 6, user_id: 1, message_id: 2, message_type: 'exception' id: 7, user_id: 1, message_id: 3, message_type: 'exception' id: 8, user_id: 2, message_id: 4, message_type: 'exception' i want grouping result news in social networks. on columns user_id , message_type, while message_type repeating. , need limit 20 order id desc. example: id: 8, user_id: 2, message_id: 4, message_type: 'exception' id: {6,7} user_id: 1, message_id: {2,3}, message_type: 'exception' id: 5, user_id: 2, message_id: 1, message_type: 'exception' ...

Confused about an intermediate type in Idris -

i'm trying implement toy regular type system ensures few formediness side constraints , allows unfolding mu bindings in it. data type representing these types contains constructors fixed point ( mu ), replacement nearest enclosing mu-bound term ( var ), , 0 , 1 argument type operators ( nullary , unary , respectively). to ensure these types well-formed track, 3 bool parameters, whether have mu head constructor, var head constructor, or var anywhere within them. data : bool -- mu headed? -> bool -- var headed? -> bool -- contains var's? -> type mu : false false _ -> true false false var : false true true nullary : false false false unary : _ _ m -> false false m to implement unfolding mu-headed types need perform substitutions, need implement "mu x. f ====> f[(mu x. f)/x]". other needing generate proof third type parameter works out, function subst seems straightforward: total subst : m1 v1 c1 -> m2 v2 c2 ->...

angularjs - Sharing data between controllers through service -

i have 2 controllers [firstcontroller,secondcontroller] sharing 2 arrays of data (myfilelist,dummylist) through service called filecomm. there 1 attribute directive filesread isolated scope bound file input in order array of files it. my problem myfilelist array in service never gets updated when select files input. however, dummylist array gets updated in second div (inner2) . know why happening? reason in second ngrepeat when switch (fi in secondctrl.dummylist) (fi in secondctrl.myfilelist) stops working. appreciated. markup <div ng-app="myapp" id="outer"> <div id="inner1" ng-controller="firstcontroller firstctrl"> <input type="file" id="txtfile" name="txtfile" maxlength="5" multiple accept=".csv" filesread="firstctrl.myfilelist" update-data="firstctrl.updatedata(firstctrl.myfilelist)"/> <div> <ul> <li ng-rep...