Posts

Showing posts from August, 2015

Maven: exclude version from module jars inside war file -

i have multi module project. each module built .jar file takes name corresponding ${project.artifactid} . 1 module built .war file. , here run @ issues. web-inf folder contains lib folder contains result .jars other modules. , these jars have name like: project.artifactid+project.version.jar , when need project.artifactid.jar . i tried configure maven-war-plugin , maven-jar-plugin, result still same. here pom.xml files build results: jar module <groupid>com.mymodule.mysubmodule</groupid> <artifactid>sub-module</artifactid> <version>1.1-snapshot</version> <build> <finalname>${project.artifactid}</finalname> ... result : sub-module.jar war module <groupid>com.mymodule.warmodule</groupid> <artifactid>war-module</artifactid> <version>1.1-snapshot</version> <packaging>war</packaging> <dependency> <groupid>com.mymodule.mysubmodule</groupid>

c# - WPF Datagrid Double Click Cell MVVM Design -

i have wpf application contains datagrid. bound list object "orders" shown below. public class orderblock { public settings setting; public list<order> orders; } public class order { public int amount; public string orderid; public string orderiddup; public string name; public string namedup; public bool dupids; // , string, int fields } for reasons out of control possible there can more 1 orderid, hence orderiddup property. datagrid default shows orderid , not orderiddup. what user able click on cell id , window load show them other id 2 names , let them choose id should used. i have been reading wpf datagrid doesn’t support functionality of double clicking on cell. bit lost how should start going issue. other issue can see trying (being operative word) use mvvm design how kind of event exposed view model? also best way go showing such information. any great, thanks, m instead of double-clicking on cell may double-click on gri

html - Form input border-radius not working properly -

i testing css on forms , bumped on this: http://jsfiddle.net/gespinha/z4a4g/1/ as try make form inputs round-cornered, assume whole input round object. border-radius:50%; any suggestion on how achieve correctly? why happen? giving px value works best in scenario. percentage typically used when creating shapes (in case, circle) input{ border-radius:10px; } i believe this you're going for. giving borders percentage mean different based on width , height. using px gives consistent look.

android - How to render to a specific mip-level in OpenGLES? -

anyone know how render specific mip-level texture? currently binding mip-level texture by: glframebuffertexture2d(gl_framebuffer, gl_color_attachment0, gl_texture_2d, textid, mip-level); then later in code, this: glbindframebuffer(gl_framebuffer, fbo_id); drawarrays(...); but shader not executed!!! if textid other 0, should generating gl_invalid_value error. gl_invalid_value generated if level not 0 , texture not 0. i suggest take @ glframebuffertexture2d opengl es . valid want in normal opengl not in opengl es :-\

c++ - An issue when rendering a line depending on Mouse position -

i have opengl widget, want render line dependent of mouse positions, follows: glpushmatrix(); glenable(gl_blend); glblendfunc(gl_src_alpha, gl_one_minus_src_alpha); glcolor4f(1, 0, 0, 0.1); glscalef(a, b, 0); glbegin(gl_lines); glvertex2f(pushedx, pushedy); glvertex2f(currentx, currenty); glend(); glflush(); gldisable(gl_blend); glpopmatrix(); where: pushedx=buttonpresscoordinates.x(); pushedy=buttonpresscoordinates.y(); currentx=mousecurrentposition.x(); currenty=mousecurrentposition.y(); the rendering goes good, , line rendered required when move mouse connecting line pushed , current coordinates. but: the issue is, when press mouse somewhere on widget , don't move it, generates randomly (as think) (x,y) , connects line coordinates of mouse pressed position. though when start moving mouse starts working fine. please, fix bug. edit the code of assigning current val

javascript - Why is IE7 & IE8 says that it 'hasLayout', when it doesn't? -

html: <div class="table" > <div class="row" > <span>tb div</span> <span>col2</span> <span>col3</span> </div> <div class="row" > <span>col1</span> <span>col2 test</span> <span>col3</span> </div> <div class="row" > <span>col1</span> <span>col2</span> <span>col3 test</span> </div> </div> <table> <tr id="testrow"> <td>tb <'table'></td> <td>col2</td> <td>col3</td> </tr> <tr > <td>col1</td> <td>col2 test</td> <td>col3</td> </tr> <tr > <td>col1</td> <td>col2</td> <td>col3 test</td> </tr> </ta

jvm - Performance: greater / smaller than vs not equal to -

i wonder if there difference in performance between checking if value greater / smaller another for(int x = 0; x < y; x++); // y > x and checking if value not equal another for(int x = 0; x != y; x++); // y > x and why? in addition: if compare zero, there further difference? it nice if answers consider assebled view on code. edit: of pointed out difference in performance of course negligible i'm interested in difference on cpu level. operation more complex? to me it's more question learn / understand technique. i removed java tag, added accidentally because question meant not based on java, sorry. you should still clearer, safer , easier understand. these micro-tuning discussions waste of time because they make measurable difference when make difference can change if use different jvm, or processor. i.e. without warning. note: machine generated can change processor or jvm, looking not helpful in cases, if familiar assembly c

java - Are these two code snippets the same or do they differ in any way? -

i working on implementing union find problem encountered snippet. while (root != id[root]) root = id[root]; isn't same while ((root = id[root]) != id[root]); except may second construct executes assignment operation @ least once while first construct may not execute once if initial condition false. there other differences? they different, think of order in executed. in first check whether root != id[root] , then assign root = id[root] . in second first assign (nested) , then check. the usual idiom bufferedreader : string line; while((line=bufferedreader.readline()) != null) { } if change first method: string line; while(line != null) { line=bufferedreader.readline() } we won't enter while loop...

android - Ormlite - deleting nested objects from ForeignCollection but not from database -

i have contactitem contains foreigncollection of groupitem: public class contactitem implements parcelable{ @databasefield(generatedid = true) private integer id; @databasefield(datatype = datatype.string, columnname = constants.contact_name) private string name; @databasefield(datatype = datatype.string, columnname = constants.contact_number) private string number; @databasefield(datatype = datatype.integer, columnname = constants.contact_icon) private int icon; @databasefield(datatype = datatype.integer, columnname = constants.contact_days) private int days; @databasefield(foreign=true,canbenull = true,foreignautorefresh = true,columnname = constants.contact_group) private groupitem group; @foreigncollectionfield(columnname = constants.contact_group_list) private foreigncollection<groupitem> groups; } and groupitem, contains foreigncollection of contactitem: public class groupitem implements parcelable{ @dat

jquery - How to Isolate Javascript on 3rd Party Sites? -

we've building small self-rendering javascript component embedded on many third party sites. our javascript depend on several common libraries (zepto, hogan, etc). what's best way isolate our javascript polluting global namespace or interfering other javascript on third party site? there special error handling considerations/wrappers should use ensure our javascript doesn't prevent rendering? the goal have single script embedded on third party site renders interactive content in dom, otherwise remains entirely isolated. after reading more this, i'm going use closure based wrapper , jquery noconflict mode so: (function(window, document, undefined){ // inject contents of jquery-2.0.3.min.js here var $ = jquery.noconflict(true); //remove global jquery , alias locally //define application classes , init here using local $ })(window, document);

c# - How to prepend text to a filestream? -

i'm trying write custom header (text) file , have remove header when releasing file. i trying: var data = encoding.unicode.getbytes(headertext); file.setlength(buffer.length + data.length); file.write(data, 0, data.length); //then write rest of file and when releasing (to skip header): var data = encoding.unicode.getbytes(headertext); infile.seek(data.length, seekorigin.begin); but doesn't work. first, leaves spaces between header text, , reading returns incorrect data. how best can go achieving this?

jquery - Append does not work when I try to code in Javascript OOP style -

i learning concepts of programming in javascript oop style , need little help: first, simple html form: <form> <select id="jobrole"></select> </form> next, write "question" class: var question = function() { this.masterq = function (id1) { this.id1 = jquery(id1); this.id1.append('<option value="">test</option>'); }; } now instantiate question class, making new object var q = new question(); and call masterq method: q.masterq('#jobrole'); but, have no idea why test isn't appended onto select. any ideas? thank you! i try , code works -> http://jsfiddle.net/hxhh2/1/ are sure included jquery in page <script src="pathtojquery.js"></script> or maybe execute code before dropdown on page. wrap logic into $(document).ready(function() { // code here });

locking - iOS Datepicker: How to LOCK invalid dates? -

i've been struggling maximum/minimum date lately, , honestly, don't know i'm missing here. searched lot , no 1 seems complain it. (i'm not talking setting maximum/minimum date these can make invalid dates appear gray) here's i've done far: [mydatepicker addtarget:self action:@selector(disabledate) forcontrolevents:uicontroleventvaluechanged]; then, on disabledate, have this: if ([mydatepicker.date compare:[nsdate date]] == nsordereddescending) { mydatepicker.date = [nsdate date]; } (or ascending, depends on dates want disable) the thing is: works fine once. in other words: open view , try pick, example, 2007, scrolls 2013. great. right after that, if try scroll invalid date (including 2007), won't scroll anymore until reopen view. feel i'm missing simple here, don't know what. thanks lot in advance! ps: mention, i've put inside disabledate nslog(@"value changed"); just make sure it's calli

java - iptables blocking me to telnet to outside server on port 80 -

i have been trying telnet on 1 outside server on port 80. with iptables on: telnet xyz 80 trying xyz... connected xyz. escape character '^]'. qwer (here type characters) http/1.1 400 bad request server: apache-coyote/1.1 transfer-encoding: chunked date: tue, 03 sep 2013 16:58:31 gmt connection: close 0 connection closed foreign host. with iptables off: telnet xyz 80 trying xyz... connected xyz. escape character '^]'. qwer (here type characters) getting html response (it's working here, iptables off) output of: iptables -l chain input (policy accept) target prot opt source destination accept tcp -- anywhere abcd state new tcp dpt:http chain forward (policy accept) target prot opt source destination chain output (policy accept) target prot opt source destination and in /etc/iptables.conf file, have done port forwarding (for security concerns redirecting

java - Simple calculation returning NullPointer exception... why? -

(i'm new java please forgive ignorance). i have simple class: public class bill { private string total; private int tip; private int people; bill() { total = "0"; tip=0; people=0; } bill (string total, int people, int tip) { total = total; tip = tip; people = people; } //the problem here somewhere. private double split = (double.parsedouble(total) * ((double)tip / 100)) / (double)people; public string gettotal() { return total; } public double getsplit() { return split; } public double gettip() { return tip; } } when call 'getsplit()' method, runtime crashes nullpointer exception: 09-03 19:37:02.609: e/androidruntime(11325): caused by: java.lang.nullpointerexception 09-03 19:37:02.609: e/androidruntime(11325): @ java.lang.stringtoreal.parsedouble(stringtoreal.java:244) 09-03 19:37:02.609: e/androidruntime(11325):

objective c - How to determine indexPath of currently visible UICollectionView cell -

i want display cell-specific text, can’t extricate visible cell collection view. most helpful ones these: how access uicollectionviewcell indexpath of cell in uicollectionview detecting when ios uicollectioncell going off screen a lower collection view (self addsubview) contains possible items. upper 1 (self addsubview) contains selections lower. user presses button (self addsubview again), lower view scrolls off oblivion , upper 1 expands such 1 cell fills screen. array-building , displaying works fine. no *.nibs. what doesn’t work figuring out cell app presenting user. try #1: first tried populating uilabel in parallel normal ops. press button , cellforitematindexpath: if (cv.tag == upper_cv_tag) { uicollectionviewlayoutattributes *itemattributes = [uicollectionviewlayoutattributes layoutattributesforcellwithindexpath:indexpath]; nsindexpath *tempindexpath; tempindexpath = itemattributes.indexpath; nslog(@"cellforitem indexpath %@",indexpath);

apache - .htaccess redirrect to mobile site for multiple domains -

i have dev, staging , prod site using dev.examtest.com staging.example.com , example.com. trying create redirect using .htaccess work 3. using git keep 3 environments in sync , because of need apply 3. below have prod. in each environment edit last line work. there way have 1 set of code work 3? rewritecond %{request_uri} ^/$ rewritecond %{http_user_agent} "android|blackberry|googlebot mobile|iemobile|iphone|ipod|opera mobile|palmos|webos" [nc] rewritecond %{http_cookie} !is_splash_visited=1 [nc] rewriterule ^(.*)$ https://example.com/mobile/$1 [r,l] change example.com use %{http_host} : rewritecond %{request_uri} ^/$ rewritecond %{http_user_agent} "android|blackberry|googlebot mobile|iemobile|iphone|ipod|opera mobile|palmos|webos" [nc] rewritecond %{http_cookie} !is_splash_visited=1 [nc] rewriterule ^(.*)$ https://%{http_host}/mobile/$1 [r,l]

c++ - Using a logical NOT, !, versus not using it -

i have function reads lines file , stores each string in each line in vector. void openf(std::string s) { std::string line; std::string b; std::ifstream in; in.open(s); std::vector<std::string> vec; if(in.is_open()) { std::cout << "file open\n" << std::endl; while(std::getline(in,line)) { for(decltype(line.size()) = 0; != line.size(); ++i) { if(isspace(line[i]) || ispunct(line[i])) { vec.push_back(b); b = ""; } else { b += line[i]; } } } } for(auto a:vec) std::cout << << std::endl; in.close(); } this works. but if instead this if(!isspace(line[i]) || !ispunct(line[i])) { b += line[i]; } else { vec.push_back(b); b = ""; } nothing prints. if don't have logical or statements, , use !isspace , !ispunct individually program behaves expects in respective cases. i don't

Why file is being overwritten in the android external storage? -

i'm trying write student id's in text file in sdcard. have created file named students.txt in sdcard. the problem when write value, , read file, last value in file. when open file can see last value written in it. what doing wrong? i'm writing file in append mode using outputstreamwriter still problem remains same. //function insert private void myinsertfunc(string data) { try { file file = new file("/sdcard/" + filename); fileoutputstream fileoutputstream = new fileoutputstream(file); outputstreamwriter outputstreamwriter = new outputstreamwriter(fileoutputstream); outputstreamwriter.append(data); outputstreamwriter.close(); fileoutputstream.close(); toast.maketext(getapplicationcontext(), "student id: " + data + " inserted successfully!", toast.length_short).show(); } catch (filenotfoundexception e) { e.printstacktrace(); } catch (ioexception

python watchdog monitoring file for changes -

folks, have need watch log file changes. after looking through stackoverflow questions, see people recommending 'watchdog'. i'm trying test, , not sure add code when files change: #!/usr/bin/python import time watchdog.observers import observer watchdog.events import loggingeventhandler if __name__ == "__main__": event_handler = loggingeventhandler() observer = observer() observer.schedule(event_handler, path='.', recursive=false) observer.start() try: while true: time.sleep(1) else: print "got it" except keyboardinterrupt: observer.stop() observer.join() where add "got it", in while loop if files have been added/changed? thanks! instead of loggingeventhandler define handler: #!/usr/bin/python import time watchdog.observers import observer watchdog.events import filesystemeventhandler class myhandler(filesystemeventhandler): def on_modified(self, event): print "got it!&

javascript - How to add a blank/empty row to the EnhancedGrid which is binded to MemoryStore -

i using memorystore, observable , objectstore bind data enhancedgrid. when add row enhancedgrid, newly added row cells shown (...). when try edit cell, displays undefined , ended exception. javascript: require(['dojo/_base/lang', 'dojox/grid/enhancedgrid', 'dojo/data/itemfilewritestore', 'dijit/form/button', 'dojo/dom', 'dojo/domready!', 'dojo/store/memory', 'dojo/store/observable', 'dojo/data/objectstore'], function (lang, enhancedgrid, itemfilewritestore, button, dom, domready, memory, observable, objectstore) { /*set data store*/ var data = { identifier: "id", items: [] }; var gridmemstore = new memory({ data: data }); var griddatastore = observable(gridmemstore); var store = new objectstore({ objectstore: griddatastore }); /*set layout*/ var layout = [ [{ 'name': 'column 1', 'field': 'id', '

Define many subset sequence in R -

assume have dataframe called data contains column called col contains numbers 0 10'000. how create following subset function subset in r can called sub numbers 999 1200 and numbers 1500 1599 edit: i've tried sub<- subset(data, col >= 999 & col <= 1200 | col >= 1500& col <= 1599) i'm not sure i'm right doing so. the problem in logic - need use parentheses keep relevant statements together: sub<- subset(data, (col >= 999 & col <= 1200) | (col >= 1500& col <= 1599)) although honest, think way did technically work.

asp.net - GridView with both declarative (Html side) datasource and code-behind datasource -

in asp.net 3.5 web page, gridview control can have both sqldatasource , code-behind datasource (with datatable example)? both datasource equal (the same stored procedure). thanks lot. luis it possible under 1 condition.that set datasourceid nothing of gridview before re-assigning datasource datatable.otherwise visual studio scream loudly @ in these lines ' both datasource , datasourceid defined on 'yourgrid'. remove 1 definition. ' yourgrid.datasourceid=null; yourgrid.datasource=yourdatatable;

javascript - Comparing a NodeList to an Array of element id's -

i created nodelist childnodes of unordered list below <body> <ul id="win" >win <li id="aa0">text</li> <li id="aa1"></li> <li id="aa2"></li> <li id="aa3"></li> <li id="aa4"></li> <li id="aa5"></li> </ul> </body> and created array of element id's want compare nodelist to ['aa0','aa1,'aa7','aa8'] and used following javascript (below) compare nodelist array. objectives determine elements in array in dom or need added dom... , determine elements in dom need removed can append ul contain id's in array. function nodeinfo(){ //these ids want in ul var ids=['aa0','aa1','aa7','aa8'] var node=document.getelementsbytagname('ul')[0]; var nodelist=node.childnodes; //test see if array ids in nodelist for(var j=0;j<

XPath issue in Maven replacer plugin -

i following error when trying use xpath replace in web.xml maven replacer plugin [error] failed execute goal com.google.code.maven-replacer-plugin:replacer:1.5.2:replace (default) on project my-project: error during xml replacement: content not allowed in prolog. -> [help 1] and here's maven code <plugin> <groupid>com.google.code.maven-replacer-plugin</groupid> <artifactid>replacer</artifactid> <version>1.5.2</version> <executions> <execution> <phase>prepare-package</phase> <goals> <goal>replace</goal> </goals> </execution> </executions> <configuration> <file>src/main/webapp/web-inf/web.xml</file> <outputfile>target/web.xml</outputfile> <regexflags> <regexflag>case_insensitive</regexflag> &l

sql - Joining two SELECT Statements with WHERE clause -

i think easy im not practiced in sql , dont know of syntax. basically got big table different user complaints (represented problem id ) , timestamps want graph. the individual statements easy , straightforward. example: select date( datetimebegin ) date, count( * ) cntprob1 `problems` problemid = "1" group date, problemid; select date( datetimebegin ) date, count( * ) cntprob2 `problems` problemid = "2" group date, problemid; each table gives me pretty simple output: date, cntprob1 2013-03-11,4 2013-03-14,1 2013-03-17,7 date, cntprob2 2013-03-12,2 2013-03-13,1 2013-03-14,3 2013-03-17,1 i need result combined this: date, cntprob1, cntprob2 2013-03-11,4,0 2013-03-12,0,2 2013-03-13,0,1 2013-03-14,1,3 2013-03-17,7,1 i guess simple if know right sql syntax... kind of join?! any appreciated! you don't need join result, should able using case expression inside of aggregate function: select date(datetimebegin) date, sum(c

java - Accessing an iteration value with JSP -

new jsp, still learning functionality. assume being handed list of values , list being iterated html code being output value of property of current iteration. trying current property , check see if value matches searching, , if does, perform action. the original .jsp code: <select name="userinfo.state"> <option class="js_default_option">state</option> <s:iterator value="@com.homeservices.action.utils.statecode@values()"> <option value='<s:property/>'><s:property/></option> </s:iterator> </select> what want do: <select name="userinfo.state"> <option class="js_default_option">state</option> <s:iterator value="@com.homeservices.action.utils.statecode@values()"> <% if(s:property == "value") { %> <option value='<s:property/>' disabled><s:prope

javascript - How to talk to a 3rd party API securely on the client? -

i'm designing api paid-for access. customers may want consume api on server (all fine) on client through javascript. i have trouble conceptually coming way safely. i.e: secure methods (i know @ least) rely on way of doing secret handshake, private key, etc. thing is, when issuing requests client private key see. of course whitelisting on domain-names can spoofed. so: how talk 3rd party api securely on client?

c# - SQL is rounding my decimal on cast -

i'm using sql server 2005. datatype varchar . i'm trying convert numbers like 1250000 to 1.25 within sql query , drop trailing zeroes. have tried number of things no success - have run 'trim not function', etc. here's have, in each iteration have attempted. select top 30 var1, var2, var3, var4, convert(decimal(6,2), (var5 / 1000000)) 'number' databasetable var1 = x select top 30 var1, var2, var3, var4, cast((var5 / 1000000) decimal(6,2)) 'number' databasetable var1 = x both queries above rounding nearest million, i.e. 1250000 becomes 1.00, etc. ideas appreciated. changing decimal numeric did not either. @marc_s absolutely right - stop storing numbers strings! that said, you're victim of integer math. try: select convert(decimal(10,2), (var5 / 1000000.0)) since stored numbers strings, sql server may try perform calculation non-numeric data before applying filter, ca

ping - Pinging a list of IPs in Android -

i'm programming android app. i have activity responsable on pinging 254 ipv4 , putting connected machines in database table ( putting ip )when button "auto scan" clicked. //--------------------------------------------------------------------- first local ip ( exemple 192.168.1.8), when button clicked, extract substring ip ( 192.168.1. exemple) start pinging ips starting "192.168.1.1" , finishing "192.168.1.254". after every ping, make test know if ping succeeded or failed, if succeeded put ip in database table, show list of connected ips in listview. //--------------------------------------------------------------------- the problem pinging task taking long finish ( 15min or more !!), it's crazy. tried use inetaddress.isreachable() fast, can't find computer working windows, changed work process & runtime.getruntime().exec(cmd). below android code : class mytask extends asynctask<string, integer, void> { dia

whitespace - Bxslider Unwanted Top & Bottom White Space -

i'm not sure white space on top , bottom of slider coming from. padding or margins? if can assist me, appreciated. jsfiddle.net/fh3el this because of bx-slider css file. bx-slider adds margin of 5px bxslider you have edit this css file , make change .bx-wrapper .bx-viewport { -moz-box-shadow: 0 0 5px #ccc; -webkit-box-shadow: 0 0 5px #ccc; box-shadow: 0 0 5px #ccc; border: 0px; left: -5px; background: #fff; } check fiddle

Using Snoopy PHP class in Drupal -

i don't know drupal have managed create simple html page use first , last name inputted run snoopy.class.php run script on web site retrieve data. button should run function submit url not getting results. because don't know how debug in drupal added echo statements see how far code ran seems stopping when tries create new snoopy object. downloaded class , put in think accessible folder, namely public_html/tools it: -rw-r--r-- 1 agentpitstop apache 37815 sep 3 21:03 snoopy.class.php below code using <form method="post"> <p>last name: <input type="text" name="lastname" /><br /> first name: <input type="text" name="firstname" /></p> <p><input type="submit" value="send it!"></p> </form> <?php if($_post) { echo "1st display <br />\n"; $url = "https://pdb-services-beta.nipr.com/pdb-xml-reports/hitlist_x

javascript - How can I sync an audio source with an external video and crossfade volume between the two? -

i need solution works in chrome , can accept youtube, vimeo, soundcloud, or custom url. i have feeling popcorn.js can me out task. here's a solution using popcorn.js , jquery: index.html <div id="choose"> <p>audio url: <input type="text" id="audio-url" /> <br/>(example: http://thelab.thingsinjars.com/web-audio-tutorial/hello.mp3)</p> <br/> <br/> <p>video url: <input type="text" id="video-url" /> <br/>( example: http://vimeo.com/73605534)</p> <br/> <br/> <button id="doit">do it!</button> </div> <div id="dopop"> <button id="toggle">play/pause</button> <br/> <br/> <input type="range" min="0" max="100" name="range" id="range" /> <br/> <div id="source1&q

css - search an image by color palette using javascript -

i coding, in html5 , javascript , image search engine (just google image) less complex, it's done offline using offline database, , wondering what's best way search image color palette. for example type name , select red color , output images name has ton o color red. i suggested calculate histogram each color in hsv space. don't understand how that, , think if try calculate histogram bunch of images, pixel pixel, 12 colors take lot of time. it must exist better , faster way this. thanks in advance. a histogram way go. easy enough load image into canvas , loop through pixels. have js object keys representing colours 0-255 set 0 , adding 1 colour key whenever colour found in process. that's how rgb histogram. i'm not sure hsv. can't vouch speed, don't think slow, speed depend on dimensions of image. since offline, may want do, however, use python/python imaging library scan images , load histogram data database , use html , js interro

haskell - Cabal fails to install Idris language on OSX Lion -

i'm trying install idris language in osx lion using installation guide provided on official tutorial . have alraedy installed gmp. error get: $ cabal install idris resolving dependencies... configuring libffi-0.1... cabal: pkg-config package libffi required not found. [1 of 1] compiling main ( /var/folders/f0/dlx6tl5x18z4k4_vq0fkqtb80000gn/t/llvm-general-3.3.5.0-61662/llvm-general-3.3.5.0/setup.hs, /var/folders/f0/dlx6tl5x18z4k4_vq0fkqtb80000gn/t/llvm-general-3.3.5.0-61662/llvm-general-3.3.5.0/dist/setup/main.o ) linking /var/folders/f0/dlx6tl5x18z4k4_vq0fkqtb80000gn/t/llvm-general-3.3.5.0-61662/llvm-general-3.3.5.0/dist/setup/setup ... setup: program llvm-config version ==3.3.* required not found. cabal: error: packages failed install: idris-0.9.9 depends on llvm-general-3.3.5.0 failed install. libffi-0.1 failed during configure step. exception was: exitfailure 1 llvm-general-3.3.5.0 failed during configure step. exception was: exitfailure 1 trying install idri

csv - PHP fgetcsv() and str_getcsv() Not Parsing With Double Enclosure Next to Delimiter -

i have parse csv file php. csv file provided client , not have control on format. comma delimited , uses double quotes text qualifiers. however, if field, such address field, has comma in it, client's system surrounds field in additional set of double quotes. example: "9999x111","x1110000110105","john doe",""123 central park avenue, #108"","new york ny 10006 ","","","m","0","1","370.20" as can see, 4th field (3rd index) has set of double quotation marks around entire field. if send string through fgetcsv() or str_getcsv(), field not handled correctly. unwanted result array: [0] => 9999x111 [1] => x1110000110105 [2] => john doe [3] => 555 central park avenue [4] => #108"" [5] => new york ny 10006 if remove set of double quotation marks manually, line processed correctly using either function; however, wouldn't able in pr

c - Passing char arrays to a function -

the dreaded warning: passing argument 1 of ... makes integer pointer without cast i don't understand this. trying pass simple string (yes, know character array) function. function parses string , returns first part. can please show me doing wrong? thank you! char* get_request_type(char* buffer) { char* p; p = strtok(buffer, "|"); return p; } int main() { char buffer[30] = "test|something"; fprintf(stdout, "buffer: %s\n", buffer); //<-- looks great needs parsing char* request_type = get_request_type(buffer); //<-- error here fprintf(stdout, "%s\n", request_type); //<--expecting see 'test' } there may yet come day when comfortable working strings in c, day not day... you didn't include string.h , compiler assume strtok defined as: int strtok(); returns int , takes unknown number of arguments, it's call implicit function declaration . solution include string.h s

artificial intelligence - How to eliminate "unnecessary" values to a neural network? -

my professor asked class make neural network try predict if breast cancer benign or malignant. i'm using breast cancer wisconsin (diagnostic) data set . as tip doing professor said not 30 atributes needs used input (there 32, first 2 id , diagnosis), want ask is: how supposed take 30 inputs (that create 100+ weights depending on how many neurons use) , them lesser number? i've found how "prune" neural net, don't think that's want. i'm not trying eliminate unnecessary neurons, shrink input itself. ps: sorry english errors, it's not native language. that question being under research right now. called feature selection , there techniques already. 1 principal componetns analysis (pca) reduces dimensionality of dataset taking feature keeps variance. thing can see if there highly corelated variables. if 2 inputs highly correlated may mean carry same information may remove without worsen performance of classifier. third technique use deep

Regex on Firebase Security API? -

is there way regex on firebase security rules .match() in javascript? because can't seem find in firebase documentation. thanks! firebase supports regular expressions in it's security rules using string.matches() function. docs here: https://www.firebase.com/docs/security/api/string/matches.html

winrt xaml - How to set textwrapping in Button -

did search on internet, not find solution. think missed below code make text wrap: <button x:name="btncustomeraging" background="green" borderbrush="green" foreground="white" fontsize="33" horizontalalignment="left" margin="662,106,0,0" grid.row="1" verticalalignment="top" height="213" width="238"> <textwrapping> customer locations </textwrapping> </button> this work. <button x:name="btncustomeraging" background="green" borderbrush="green" foreground="white" fontsize="33" horizontalalignment="left" margin="662,106,0,0" grid.row="1" verticalalignment="top" height="213" width="238"> <textblock text="customer locations" textwrapping="wrap" />

javascript - How to do time-data in D3 maps -

i have time-series dataset i'd put on map---it's irregular times series of incidents in countries, indexed date , country. i've used d3 couple simple things, unsure how organize data here, conceptually. i've checked... http://bl.ocks.org/mbostock/4060606 http://bl.ocks.org/mbostock/3306362 http://bl.ocks.org/jasondavies/4188334 for map-making, , comfortable generating .json map itself: wget "http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/50m/cultural/ne_50m_admin_0_countries.zip" unzip ne_50m_admin_0_countries.zip ogr2ogr -f "geojson" output_features.json ne_50m_admin_0_countries.shp -select iso_a3 topojson -o topo.json output_features.json --id-property iso_a3 however, when data looks this... incidents.csv date, iso3, eventtype 2001-05-21, abw, 2002-01-01, abw, 2005-07-31, abw, b 2003-02-21, afg, b 2008-02-21, afg, c 2000-03-09, ago, 2010-06-11, ago, c i'm @ loss how "attach" map figure---

javascript - Create new array from an existing array attributes -

i trying create new array out of limited values existing array. in example below largearray contains many attributes – year, books, gdp , control. lets want create new array include year , gdp. var largearray = [ {year:1234, books:1200, gdp:1200, control:1200}, {year:1235, books:1201, gdp:1200, control:1200}, {year:1236, books:1202, gdp:1200, control:1200} ]; the new array trying get, this: var newarray = [ {year:1234, gdp:1200}, {year:1235, gdp:1200}, {year:1236, gdp:1200} ]; use $.map() var largearray = [{year:1234, books:1200, gdp:1200, control:1200}, {year:1235, books:1201, gdp:1200, control:1200}, {year:1236, books:1202, gdp:1200, control:1200}, {year:1237, books:1203, gdp:1200, control:1200}, {year:1238, books:1204, gdp:1200, control:1200}]; var newarray = $.map(largearray, function (value) { return { year: value.year, gdp: value.gdp } }) demo: fiddle

asp.net - Register users synchronously during context seed -

in asp.net mvc 5 project, have custom initializer class: class custominitializer : dropcreatedatabaseifmodelchanges<ghazanetcontext> i want seed context several users. problem new mvc 5 async , whatever try fails. here's code attempts create user: private void addrestaurant(registerrestaurantviewmodel model, dbcontext db) { user user = new user(model.username) { addresses = new list<address>(), role = "restaurant" }; user.addresses.add(model.address); task.factory.startnew(async () => { await users.create(user); // gets stuck here var newuser = db.users.where(u => u.username == user.username).firstordefault(); var restaurant = new restaurant(model) { user = newuser }; db.restaurants.add(restaurant); db.savechanges(); await secrets.create(new usersecret(model.username, model.password)); aw

laravel - PHP 5.3.2 alternative to using $this inside an anonymous function? -

i using laravel 4 , php build new application. works fine on dev server running php 5.4.x boss insist has run version 5.3.2 i have spent whole day fixing work 5.3.2 , have everything, thought, until ran issue code below. my problems start @ line... db::transaction(function($clock_in_webcam_image) use ($clock_in_webcam_image) i believe type of code might not work version of php? if case, options run same code or have doing same action? would appreciate this. unfortunate boss told me straight out no not allow update newer php stuck in hard spot right now // create new time card record when user clocks in public function createtimecard($clock_in_webcam_image) { // create both timecard , timecard record tables in transaction db::transaction( function ($clock_in_webcam_image) use ($clock_in_webcam_image) { $timecard = db::table('timeclock_timecard')->insertgetid( array( 'user_id'

ember.js - adding / removing a class from an ember input -

using ember 1.0 , handlebars 1.0 i want present ember input disabled until user presses edit button. have managed functionality working @ expense of code duplication. {{#if isediting}} {{input type="text" value=firstname class="form-control" placeholder="first name" }} {{else}} {{input type="text" value=firstname class="form-control" placeholder="first name" disabled=""}} {{/if}} just wondering if there better way .. thanks instead of disabled input classes, add disabled attribute input field {{input type="text" value=firstname class="input-medium" disabledbinding="disabled"}} demo fiddle

wcf - RestSharp throws error in Entity Framework -

string url="https://sampleservicebus.servicebus.windows.net/winphoneservice/" restclient client = new restclient(url); restrequest request = new restrequest("getkpimeasuredata", method.post); kpidomaindata kpidata = new kpidomaindata(); kpidata.kpiid = 1006; kpidata.scorecardid = 3; kpidata.engineeringorgid = 11; kpidata.datavaluetypeid = 1; kpidata.cumulativemonth = 463; kpidata.businessorgid = 1; string json = newtonsoft.json.jsonconvert.serializeobject(kpidata); json = "{\"kpidata\" : " + json + "}"; request.addparameter("application/json; charset=utf-8", json, parametertype.requestbody); request.requestformat = dataformat.json; observablecollection<kpimeasuredata> kpidetailslist = await client.executetaskasync<observable

c# - How can I make no line space using regex? -

i have below sentences on richtexbox1 have can make 1 line space between each line , dont make line space if sentence start create table , ends semicolomn result: alter table "course" drop constraint "crse_crse_fk"; alter table "enrollment" drop constraint "enr_stu_fk"; alter table "enrollment" drop constraint "enr_sect_fk"; alter table "enrollment" add constraint "enr_stu_fk" foreign key ("student_id") references "student"("student_id") enable; alter table "enrollment" add constraint "enr_sect_fk" foreign key ("section_id") references "section"("section_id") enable; create table "comp1" ( "empid" number, "emplname" varchar2(20), "empfname" varchar2(20), "deptno" number, "mgrid" number, primary key ("empid") enable ); create table &

cordova - Error1 0x8974002F in windows phone 8 developement using phonegap -

am using visual studio express 2012 evaluation copy windows phone 8 development using phonegap. can run application emulator shows app. when try deploy in device (nokia lumia 520), deploy error error 0x8974002f . when deploying errors in script illegal syntax. expecting valid start name character. in <%= . <%=companyname %><br /> is cause not deploying in device. i got solution inserting usb plug directly board. worked once usb port changed. for illegal syntax. expecting valid start name character. in <%= , problem created html file , copied original source created file. here double quotes changed multiple double quotes ""<%="" visual studio , identified , cleared got worked well.

android - How to detect whether device has 5Ghz Wi-Fi or not -

i spent time seaching solution without result. question is, there way how detect whether device has 5ghz wifi or not? nice if it's possible achieve that. analysed wifimanager didn't find proper method or property. thanks in advance. as of android api level 21, wifimanager has method called is5ghzbandsupported() returns true if adapter supports 5 ghz band.

wpf - How to rotate the Ellipse and border based on dragging border? -

Image
please find attached image requirement.when drag arc(border) arc , wheel rotate through mouse position.can please me? if rotate arc , wheel in button click working.but want rotate in draging border(arc).i stuck calculation. xaml: <grid horizontalalignment="center"> <stackpanel orientation="horizontal" x:name="mainstackpanel" rendertransformorigin="0.5,0.5"> <grid> <border borderthickness="10" borderbrush="blue" mousemove="border_mousemove" mouseleftbuttondown="border_mouseleftbuttondown" mouseleftbuttonup="border_mouseleftbuttonup" width="10" height="90" /> </grid> <grid x:name="rotategrid" margin="20 0 0 0" rendertransformorigin="0.5,0.5"> <ellipse height="250" width="250" stroke="red" strokethickness=&