Posts

Showing posts from April, 2014

c# - Unable to get the added fields of Database after making changes -

c# - Unable to get the added fields of Database after making changes - i using linq sql approach manipulation database tables. stuck 1 problem, whenever adding new column existing tables have delete existing .dbml file of table solution , have add together 1 time again access of lastly added columns. i tried approach re-building project , solution still, doesn't work , pushes me above less-sensible steps. could help me out rid of issue? or way have changes adding .dbml file again. c# linq-to-sql

SQL Server: How to handle two different cases in Where clause -

SQL Server: How to handle two different cases in Where clause - i have stored procedure in sql server 2008 used fetch info table. my input parameters are: @category nvarchar(50) = '', @departmentid int my clause is: where a.departmentid = @departmentid , a.category = @category is there way can apply case statement (or similar) clause should check category match if @category not '' , otherwise select categories ? the thing think of here utilize following. technically works can't check exact category matches required here: where a.departmentid = @departmentid , a.category '%'+@category+'%' many help this, tim. you can modify where clause follow: where a.departmentid = @departmentid , (@category = '' or a.category = @category) sql sql-server case where where-clause

javascript - d3 text label format based on value -

javascript - d3 text label format based on value - i have chart need create label bold based on variable. not sure how in d3 accomplish this. think may need utilize .each function. line .style("font-weight", "bold") makes text labels bold want values made bold. ideas on right syntax this? g.append("svg:text") .each(function(d) { d.angle = (d.startangle + d.endangle) / 2; }) .attr("dy", ".35em") .style("font-family", "helvetica, arial, sans-serif") .style("font-size", "10px") //.style("font-weight", "bold") .attr("text-anchor", function(d) { homecoming d.angle > math.pi ? "end" : null; }) .attr("transform", function(d) { homecoming "rotate(" + (d.angle * 180 / math.pi - 90) + ")" + "translate(" + (r0 + 36) + ")...

regex - Trying to colorize Apache http wire logs using sed -

regex - Trying to colorize Apache http wire logs using sed - we have log files containing output apache http client. seeing output goes "over wire" , includes lines like: << http/1.1 200 request has succeeded the chevrons '<<' indicate incoming, in contrast '>>' outgoing content. using 'tail -f' follow these logs entertaining plenty thought useful exercise utilize sed colorize output according whether input or output. a simple test show mean: echo '<< http/1.1 200 request has succeeded' | sed -r -e 's_<<_\x1b[31;1m&\x1b[0m_i' -e 's_>>_\x1b[32;1m&\x1b[0m_i' for input, and echo '>> http/1.1 200 request has succeeded' | sed -r -e 's_<<_\x1b[31;1m&\x1b[0m_i' -e 's_>>_\x1b[32;1m&\x1b[0m_i' for output. so far, good. descent regex madness began when occurred me more useful highlight http response codes , colorize ...

regex - ignore special characters in find and replace command of perl -

regex - ignore special characters in find and replace command of perl - i using command perform find , replace system( "perl -pi -e 's/$arr3[$i]/$arr2[$i]/g' /opt/app/d1ebl1m5/dv02/cingbt02/j2eeserver/config/amss/application/properties/cscenvvar.properties_try"); the value of $arr3[$i] contains special characters -e , $ etc. can ignore special characters , treat look normal string you want my $search_pat = quotemeta($search); s/\q$search_pat\e/$replace/g or equivalent s/\q$search\e/$replace/ it's bad thought generate code, solution becomes system( perl => ( '-i', '-p', '-e' => ' begin { $s = shift(@argv); $e = shift(@argv); } s/\q$s/$e/g ', '--', $arr3[$i], $arr2[$i], '/opt/app/.../cscenvvar.properties_try', ) ); regex perl replace

c# - Display 50,000 cities in dropdown list in asp.net website -

c# - Display 50,000 cities in dropdown list in asp.net website - we displaying cities in dropdown list. when scroll downwards dropdown , select value, browser gets hanged up. please allow me know if there solution prepare it. <div class="customselectdiv custom-req" id="divcity" runat="server" visible="false"> <asp:dropdownlist id="ddlcity" runat="server" tabindex="10" class="customselect required" visible="false" autopostback="true" onselectedindexchanged="ddlcity_selectedindexchanged"></asp:dropdownlist> </div> and cities binding dropdown database. you're not going able add together 50000 records select box, i'd recommend looking city autocomplete 1 google offers. c# asp.net

javascript - parseInt changes the integer -

javascript - parseInt changes the integer - i trying pull number (72157648141531978), starts @ 21st character, out of title of page so: parseint(document.title.substring(21), 10); this returns string integer of 72157648141531980. can't seem figure out why changing lastly 2 numbers. help appreciated. according what javascript's max int? what's highest integer value number can go without losing precision? max value of integer 9007199254740992. i tried calculation on http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_parseint , can confirm problem. it looks issue parsing beyond max value , rounding lastly 2 figures. javascript integer substring parseint

PyCharm: 'unresolved reference' for 'object', 'isinstance', and more -

PyCharm: 'unresolved reference' for 'object', 'isinstance', and more - i'm using pycharm python 2.7 pycharm shows 'unresolved reference' stuff beleive keywords or part of python language. example: class myclass(object): pass pycharm claim 'object' 'unresolved reference', showing error mark. similarely, 'isinstance' , many other built in method seems unresolved. edit: appears problem definition of python interpreter. in order able submit iml file (where path interpreter stored), i've created own python interpreter setting, called 'mypython', , set point interpreter on machine. interpreter not have path in name (as differs between machines), , not 1 automatically created pycharm. i'm seeing behaviour when i'm on mypython. when on 1 generated pycharm, is: 'python 2.7.8 (c:\python27\python.exe)' parsing fine. looks bug in pycharm? pycharm

R: Insert table in template table using ReporteRs -

R: Insert table in template table using ReporteRs - i in process of making dashboard. basically, pulling out selected info database want display in word template. set template table (2 rows, 3 columns). in each cell set bookmark. then, using r bundle reporters set specific info r cell within template based on bookmark. issue: cant seem insert tables cell of template. tried: thought might due size of table (as experienced size issue when inserting figures), not case. below illustration error. in order run have create word document table bookmark in 1 of cells called 'test'. doc = docx( title = "dashboard",template="h:\\test.docx") myt <-flextable(cars[c(1:10),]) doc <-addflextable(doc,myt,bookmark="test") writedoc(doc, "h:\\testresult.docx") if create bookmark outside of table , assign table new bookmark, seems work. does know how insert table (data frame table) cell of template? if argument bookmark ...

firefox addon - Mozilla Add-on SDK - OS.File.read (The system cannot find the file specified.) -

firefox addon - Mozilla Add-on SDK - OS.File.read (The system cannot find the file specified.) - i created add-on next mozilla's tutorials. cfx test , cfx run worked perfectly. set folder on desktop , installed add-on firefox using cfx xpi , ctrl+o (the xpi file). now add-on gives error in console log: win error 2 during operation open on file purls.txt (the scheme cannot find file specified.) here relevant code in main.js: const {textencoder, textdecoder, os} = cu.import("resource://gre/modules/osfile.jsm", {}); allow decoder = new textdecoder(); allow promise = os.file.read("purls.txt").then( function onsuccess(array) { // stuff }, function onreject(reason) { console.error("couldn't read purls.txt:\n"+reason); } ); please help me figure out going on. when utilize cfx run add-on finds purls.txt file , opens it/reads without problem. you didn't give path purls.txt, looking ...

r - Shiny plot in ggplot not respecting "fill" argument in plot command -

r - Shiny plot in ggplot not respecting "fill" argument in plot command - i've included lot of sample code because i'm new shiny (and still beginner r) i'm not sure problem lies. the first 2 code blocks ui.r , server.r of app, along image of output. problem i'm having "fill" argument in ggplot command isn't beingness respected, , i'm getting mono-color output in chart, when should have 2 different colors in histogram dependent upon "id" value in df. the lastly block of code , image show same code beingness run in r-studio, desired effect achieved. can see in included output screenshot there 2 overlain histograms colored value of "id" column. thanks help! example app: server.r library(shiny) library(ggplot2) id <- sample(0:1, 100, replace=t) val <- sample(seq(1:25), 100, replace=t) val2 <- sample(seq(1:10), 100, replace=t) info <- data.frame(id, val, val2) # define server shiny app shin...

compilation - Non-resolvable parent POM: Could not find artifact org.sakaiproject:master:pom:10-SNAPSHOT and 'parent.relativePath' -

compilation - Non-resolvable parent POM: Could not find artifact org.sakaiproject:master:pom:10-SNAPSHOT and 'parent.relativePath' - i've checked out 10.2 tag , received titular error after "mvn clean install" on < sakai-root/master > "mvn clean install" on < sakai-root > i've tried googling around non-resolvable parent pom type errors: non-resolvable parent pom not find artifact , 'parent.relativepath' points @ wrong local pom http://collab.sakaiproject.org/pipermail/sakai-dev/2012-june/017765.html etc.... but basic gist of them need set "relativepath" setting parent differently (to point @ pom.xml) or need alter "version"/"artifactid"... i've run similar problem on clog tool source: sakai 10 clog not compiling :( for sakai whole, when check out new tag, should xml settings in order compile if receive error? this bug. base of operations pom.xml should have had consiste...

Draw Hollow Circle and image inside android -

Draw Hollow Circle and image inside android - i trying draw in android idea. in add-on want add together image within circle , time on circle border. know how draw circle not find pointers accomplish this. have other other controls in activity. know wrong dont have code , need pointers start with. android android-layout canvas

video.js - Player doesn't reload (download) when pause -

video.js - Player doesn't reload (download) when pause - i'm new videojs, trying streaming video link add together videojs, it's play ok problem when click pause button, saw streaming bar stop too, , if pause long, it'll show message "...error network download...". here code: <!doctype html> <html> <head> <title>video.js | html5 video player</title> <!-- chang urls wherever video.js files hosted --> <link href="video-js.css" rel="stylesheet" type="text/css"> <!-- video.js must in <head> older ies work. --> <script src="video.js"></script> </head> <body> <video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" width="640" height="264" poster="http://video-js.zencoder.com/oceans-clip.png" data-setup="{}"...

unity3d - Unity 4.5 Mesh Collider Not Interacting with Circle or Box Collider 2D -

unity3d - Unity 4.5 Mesh Collider Not Interacting with Circle or Box Collider 2D - i new unity , working on 2d game. currently, having problem getting 2 colliders interact when 1 of them mesh collider , other box or circle collider. working unity sample assets 2d character interact mesh terrain. when "played" game, circle collider attached legs of character falling through mesh terrain. have simplified problem , created 2 cubes: one cube upload , maintain 2d box collider , add together stiff body to the sec cube delete 2d box collider , add together mesh collider i place sec cube under first cube , nail "play". top cube falls through bottom box. when replace bottom cube's mesh collider box collider , nail "play" correctly collides , stops on box. i'm guessing i'm making same error in simplified illustration in more complicated 2d character scenario. have suggestions of doing wrong? have tried making mesh collider convex ...

Laravel validation not showing the default error messages -

Laravel validation not showing the default error messages - i working on laravel project , having issues validation. default error messages dont appear instead see validation requirements this: http://gyazo.com/681e9d8e2e176a29d90db041354f7177 this code: routes.php (i set code in here now) route::filter('checklogin', function() { if(input::get('email') != ""){ //register $rules = array( 'username' => 'required|max:64|min:3|unique:users', 'password' => 'required|max:64|min:6', 'fname' => 'required|max:255|alpha', 'lname' => 'required|max:255|alpha', 'email' => 'required|max:255|email', 'phone' => 'max:24|min:9', 'zip' => 'required', 'street' => 'required|max:255|alpha', ...

java - I am trying to return an array which holds the totals of all sublists in an array -

java - I am trying to return an array which holds the totals of all sublists in an array - but when seek homecoming array gives me weird reference returned : array is: [i@895684 dont know why isn't working, unsure of how include total of sublists of array size a[1], a[2], a[3]... a[n-1] import java.util.*; class sumarray { public static void main(string[] args) { scanner input = new scanner(system.in); system.out.println("enter numbers (all on 1 line, separated commas):"); string line = input.nextline(); string[] numbers = line.split(","); int[] array = new int[numbers.length]; for(int i=0; i<array.length; i++) array[i]=integer.parseint(numbers[i].trim()); int[] highsum = highestsum(array); system.out.println("the array is: "+highsum); } public static int[] highestsum(int[] a) { // int[] array = new int[a.length]; //int end = a.length - 1; int sum = 0; int[] highestsum = new int[a.length-1];...

javascript - Multiple drag functions on d3 force drag layout -

javascript - Multiple drag functions on d3 force drag layout - i have next layout: gray side: main container (zoom, pan) white circles: d3 nodes ( mousedown , mouseup , drag ) red rectangles: rectangles ( drag , without container panning) when dragging reddish rectangles, don't want drag main container too. also, when zooming, should'n affected. i think issue related to: // add together rectangle pan handlers containerparent.append("rect") .attr("width", svgwidth) .attr("height", svgheight) .style("fill", "none") .style("pointer-events", "all"); jsfiddle by moving code snippet post before appending g element containing starter elements, issue fixed: ... // add together rectangle pan handlers containerparent.append("rect") .attr("width", svgwidth) .attr("height", svgheight) .style("fill", ...

ios - Unable to get view controller size. Swift -

ios - Unable to get view controller size. Swift - i'm new swift , i'm trying utilize next method create skspritenode in gamescene.swift: var longchainsaw = chainsawmaker.longchainsawcreator() the problem need size of gamescene view chainsawmaker class. have in chainsawmaker.swift: import spritekit class chainsawmaker: skscene { class func longchainsawcreator () -> skspritenode { //long chainsaw allow longchainsawwidth = size.width/3 the error occurs size.width/3 "chainsawmaker.type not have fellow member named size" any recommendations? that's because you're calling class func longchainsawcreator() without having initiated instance of chainsawmaker . according documentation (https://developer.apple.com/library/ios/documentation/spritekit/reference/skscene_ref/index.html#//apple_ref/occ/instp/skscene/size), size exists instance variable, not class variable ios swift ios8 sprite-kit

sql server - Query Returns diffrent result When datatype is time -

sql server - Query Returns diffrent result When datatype is time - i have 2 columns info type below and fired below query which returns below result and if run below query then homecoming different result below i wondering why comes? i using sql server 2008 sql-server

c++ - Message is highlighted in blue in Modal box in VC++ -

c++ - Message is highlighted in blue in Modal box in VC++ - we using below code populate messages in dialog box, when message appears message highlighted in bluish - it's selected message using mouse. want messages not select when appears. can help me on issue. cdialog::oninitdialog(); cfont *m_pfont = new cfont(); logfont lf; memset(&lf, 0,sizeof(logfont)); lf.lfheight = 16; lf.lfweight = fw_bold; strncpy_s(lf.lffacename,"arial",6); m_pfont->createfontindirecta(&lf); getdlgitem(idc_edit1)->setfont(m_pfont,true); m_message.setwindowtexta((lpctstr)message); homecoming true; the selection set text whenever edit box becomes selected item. if edit box first in tab order, or if tab or click on it, characters selected. can override behavior capturing en_setfocus event , resetting selection yourself: void cmydlg::onensetfocusedit1() { m_edit1.setsel(0, 0); // or (-1, -1) set selection @ end } c++ visual-c++ mfc

html - Fencepost issue: I need a recursive function that skips executing a section when it is first called -

html - Fencepost issue: I need a recursive function that skips executing a section when it is first called - i'm trying create c++ programme creates formatted css file. what first take html file , build tree nodes of next type. struct node { std::string element_type; std::vector<std::string> class_list; std::string iden; std::vector<node*> children; }; right i'm trying create function takes root of tree , returns string formatted css of document (with attributes it's looking @ beingness css class es , id s). for example, if html file <html> <body> <div class="row"> <h1 id="title">here's title</h1> </div> <div class="row red"> <p>here's text within div of class row , red</p> </div> <div class="row"> <a href="googl...

c# - Launching Petrel import dialog -

c# - Launching Petrel import dialog - i'm new ocean , c#. can kindly show me code required launch petrel import dialog using showimportdialog() method when button clicked? have gone through ocean manuals can't seem right. the next sample ocean dev guide opens import log dialog when user selects in input tree. reply question? private static void launchimportdialog(object sender, eventargs a) { string[] files; object[] objs; fileformat format = petrelsystem.fileformats.wellknownfileformats.welllog; ienumerable<borehole> wells = petrelproject.inputs.getselected<borehole>(); foreach (borehole in wells) { petrelsystem.fileformats.showimportdialog(format, "d:\\well logs\\", well, out files, out objs); } } c# import dialog ocean petrel

c# - Linq Group by Week Number Including 0 Record Weeks -

c# - Linq Group by Week Number Including 0 Record Weeks - i'm trying dataset ssrs line chart. trying show number of records per week of year lastly 6 months. in order line chart accurate, have show weeks have 0 records. i want provide line chart info looks this: year week count 2014 52 13 2015 1 0 2015 2 16 the next linq query gets need minus weeks have 0 records: list = (from t in context.cats.where( t => t.name == "fluffy" && (t.recorded >= start && t.recorded <= end) ).asenumerable() grouping t new { year = t.recorded.year, weeknumber = (t.recorded - new datetime(t.recorded.year, 1, 1)).days / 7 } ut select new trendrecord { year = ut.key.year, week = ut.key.weeknumber, count = ut.count() ...

java - "Trust anchor for certification path not found" in Android SSL Socket client -

java - "Trust anchor for certification path not found" in Android SSL Socket client - i'm trying connect ssl server using android client app. server has jks certificate converted bks using portecle. server code simple: public class echoserver { public static void main(string[] arstring) { seek { sslserversocketfactory sslserversocketfactory = (sslserversocketfactory) sslserversocketfactory.getdefault(); sslserversocket sslserversocket = (sslserversocket) sslserversocketfactory.createserversocket(25000); sslsocket sslsocket = (sslsocket) sslserversocket.accept(); inputstream inputstream = sslsocket.getinputstream(); inputstreamreader inputstreamreader = new inputstreamreader(inputstream); bufferedreader bufferedreader = new bufferedreader(inputstreamreader); string string = null; while ((string = bufferedreader.readline()) != null) { system.out.println...

android - Deploying an iOS App using PhoneGap From Windows -

android - Deploying an iOS App using PhoneGap From Windows - i new phonegap , mobile application development. want create application using phonegap can android, ios, blackberry versions of same app. i have installed phonegap in windows 7 desktop using tutorials given in https://www.youtube.com/watch?v=nqfpfrurmm4 i have questions regrading phonegap: can create multiple pages(html files) or have index.html single file? can utilize jquery ui plugins, mobile jquery ui , other iquery plugins? phonegap cloud service able convert mobile app? i have created hello world illustration , uploaded zip file phonegap , converted android, windows app ios app shows error certificate(p12) , provisioning file. have windows 7, how can legally? (my friend has mac book. can utilize it) i want launch app play market , itunes have no thought need after uploading zip phonegap. i appreciate if can provide me suggestions, steps need take or links ease whole process. thanks! you ca...

Single easier command to search in bash history -

Single easier command to search in bash history - on of commands wrote on daily basis on console is # history | grep -i 'something' that , ctr+r utilize :). i thinking in have # h or better, live search ctr+r shows results @ glance, not one. know can cycle pressing ctrl+r again, improve if see elements i"m cycling. so 2 questions: 1) know programme provide improve interface bash history in console? 2) best way accomplish h something alias? want h command. easy, add together alias in .bashrc or .bash_profile or .bash_aliases (depending on config). alias h="history | grep -i" bash

javascript - How to implement search in AngularJS -

javascript - How to implement search in AngularJS - i have frontend angularjs application connects backend api. i'd implement search engine in spa can specify offset - number of elements displayed on each page page - number of current page count - total elements i want sort results specified attribute , filter them out well. what patterns implement such search? should done on backend , on frontend? how should api like? i have lot of issues - if user requested 5th page offset 10, , alter offset 20, page should displayed then? when fetch additional data? if set offset 15 , filter out results, give me 5 elements? should fetch missing current filter? can provide behaviors of mechanisms? javascript ruby-on-rails angularjs rails-api

c++ - How to prevent blocking path? -

c++ - How to prevent blocking path? - i'm trying build algorithm prevents "blocking path". draw random iteams , print on map: [...] the "x" player. can move on map, cannot remain on "#" field. after draw path blocked ("x" cannot move to, example", (3,2): someone have idea, concept or material how write algorithm prevent draw "#" when blocked path? here piece of code: void build_dungeon(map_grid& map, int chance, string object) { int i, j; (i = 0; < g_map_size; i++){ (j = 0; j < g_map_size; j++){ if (rand() % 100 >= (100 - chance) && map[i][j] == "[ ]" && anti_stuck(map, i, j)){ map[i][j] = object; print_map(map); } } } } i'm trying write anti_stuck function. you can perform flood fill determine squares reachable given starting location. see animation the wikipedia article: ...

ios - easiest way to refactor code from Objective-C to java? -

ios - easiest way to refactor code from Objective-C to java? - i ios developer , entire career, date has been spent using xcode, along objective-c , c code, write apps apple app store. refactor code java and/or xml using eclipse , seek getting few of existing apps on google play. i understand though both languages object-oriented, 1 (objective-c) compiled , other (java) interpreted. nowadays barriers refactoring code file file, line line?? c functions? work in eclipse? is there kind of translator automatically convert objective-c java, or translate xcode files eclipse files???? the android , ios platforms different, trying port app, line-by-line going produce app of low quality. honest, it's not feasible because of vast differences in apis. more "interesting" app (in other words, more does), more problem there in porting it. beyond api differences, there fundamental differences in philosophies of 2 platforms cause major re-design of functionality, not c...

Clone() vs Copy constructor- which is recommended in java -

Clone() vs Copy constructor- which is recommended in java - this question has reply here: clone() vs re-create constructor vs mill method? 7 answers clone method vs re-create constructor in java. 1 right solution. utilize each case? clone broken, dont utilize it. the clone method of object class magical method no pure java method ever do: produces identical re-create of object. has been nowadays in primordial object superclass since beta-release days of java compiler*; , it, ancient magic, requires appropriate incantation prevent spell unexpectedly backfiring prefer method copies object foo copyfoo (foo foo){ foo f = new foo(); //for properties in foo f.set(foo.get()); homecoming f; } read more http://adtmag.com/articles/2000/01/18/effective-javaeffective-cloning.aspx java clone copy-constructor

Why does my android border not display? -

Why does my android border not display? - border.xml: <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <solid android:color="#ffffff" /> <stroke android:width="1dip" android:color="#cbcbcb" /> <corners android:radius="7dp" /> </shape> set background of linearlayout: <?xml version="1.0" encoding="utf-8"?> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/border" android:orientation="vertical" > //child command </linearlayout> if linearlayout has kid control: border display ok. if linearlayout have much kid con...

css - Apply a colored box around my Status field -

css - Apply a colored box around my Status field - i working on asp.net mvc web application uses bootstrap v2.0.4, , utilize next display value status field:- @html.displayfor(model => model.assetstate.displaystate, new { @class= model.assetstate.displaystate.tostring() } ) then added next within css file:- .operational { color:green; } .disposed { color:red; } but above did not have effect on produced markup , displayed value homecoming default color ? do next it'll work, <span class="@model.assetstate.displaystate.tostring()"> @html.displayfor(model => model.assetstate.displaystate ) </span> reference: adding css class razor @html.displayfor how apply css @html.displayfor? if want differently, not provided html helper, follow instruction link. can write own html helper. http://www.codeproject.com/tips/720515/custom-html-helper-for-mvc-application css asp.net-mvc twitter-bootstrap asp.net-mvc-4 raz...

c# - Ninject feature (WhenInjectedInto) equivalent in Windsor -

c# - Ninject feature (WhenInjectedInto) equivalent in Windsor - this first post here, hoping start posting more in future :) i have been trying larn utilize castle windsor rather using ninject there's 1 feature haven't been able sort of "translate" utilize in windsor, , wheninjectedinto. here's 1 illustration taken pro asp.net mvc 5 book, ninject kernel.bind<ivaluecalculator>().to<linqvaluecalculator>(); kernel.bind<idiscounthelper>().to<flexiblediscounthelper>().wheninjectedinto<linqvaluecalculator>(); this conditional binding, meaing when it's linqvaluecalculator beingness bound ivaluecalculator, should utilize flexiblediscounthelper when binding idiscounthelper, rather other object. how can replicate windsor, if it's possible ? so far have: container.register(component.for<ivaluecalculator>().implementedby<linqvaluecalculator>()); container.register(component.for<idiscounthelper...

java - Fastest (to implement) way to find pattern in an XML node -

java - Fastest (to implement) way to find pattern in an XML node - i have xml file contains nodes needs varied @ runtime. example: <pt:type>#type</pt:type> <pt:value>#value</pt:value> i'd scan xml file , search nodes have "#" pattern in it. purpose fill xml using info have in memory. fastest way in java ? maybe there xpath look gather nodes having value ? you can utilize xpath query contains criteria function homecoming elements values holds set of character provided. should following: //*[contains(text(), '#')] java xml xpath

Does cocoapods support MacOSX programming? -

Does cocoapods support MacOSX programming? - i wondering if cocoapods supports macosx programming? obvious supports ios platform, know if supports macosx, cannot find in anywhere of documents. yes does. just include platform :osx, '10.7' in podfile 'osx' : platform '10.7' : minimum deployment target more info on how construction podfile can found here cocoapods

regex - Add space between two letters in a string in R -

regex - Add space between two letters in a string in R - suppose have string like s = "pleaseaddspacesbetweenthesewords" how utilize gsub in r add together space between words get "please add together spaces between these words" i should like gsub("[a-z][a-z]", ???, s) what set ???. also, find regular look documentation r confusing reference or writeup on regular expressions in r much appreciated. you need capture matches utilize \1 syntax refer captured matches. example s = "pleaseaddspacesbetweenthesewords" gsub("([a-z])([a-z])", "\\1 \\2", s) # [1] "please add together spaces between these words" of course, puts space between each lower-case/upper-case letter pairings. doesn't know real "word" is. regex r gsub

docker - what is Server error: Status 0 while fetching image layer -

docker - what is Server error: Status 0 while fetching image layer - basic tests not pass sudo docker run -i -t ubuntu /bin/bash https://docs.docker.com/installation/ubuntulinux/ i on ubuntu 14 lts 64 bits docker version client version: 1.3.1 client api version: 1.15 go version (client): go1.3.3 git commit (client): 4e9bbfa os/arch (client): linux/amd64 server version: 1.3.1 server api version: 1.15 go version (server): go1.3.3 git commit (server): 4e9bbfa error message: error pulling image (latest) ubuntu, server error: status 0 while fetching image layer (511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158) what error message means server error: status 0 while fetching image layer looking @ the code throwing error, seems didn't response when trying contact registry (otherwise status code set response). this happen variety of reasons, though firewall / network issue one. turning on debug logging (on docker daemon, might hav...

html - CSS vehicle animation -

html - CSS vehicle animation - i'm trying animate tractor moving across screen. i've got working on screen, want work across different platforms (only included -webkit-). when re-size, tractor fluid, wheels aren't. how can create them adjust together? <body> <div class="container"> <div class="tractor"> <img src="img/tractor-700px.png" alt="tractor"> </div> <div class="wheels"> <div class="b_wheel"> <img src="img/b_wheel.png"> </div> <div class="f_wheel"> <img src="img/f_wheel.png"> </div> </div> </div> here's main css: .tractor { width: 380px; position: absolute; top: 40%; left: -5%; } .tractor img { width: 100%; } .tractor::after { content: ""; display: block; wid...

html - Sticky navigation bar won't follow page scrolling in Internet Explorer and Chrome -

html - Sticky navigation bar won't follow page scrolling in Internet Explorer and Chrome - i've coded website in safari works want it. but, seems horisontal sticky navbar won't follow page scrolling in net explorer, chrome , firefox. i've tried apply overflow: auto, doesn't help , have hard time solve this. know how it? <div id="navbar"> <div id="navbar-links"> <ul> <li><a href="index.html">home |</a></li> <li><a href="index.html#features">features |</a></li> <li><a href="index.html#xxx">xxx |</a></li> <li><a href="index.html#xxx">xxx |</a></li> <li><a href="index.html#xxx">xxx |</a></li> <li><a href="index.html#demo">demo |</a></li> <li><a href="index.html#xxx">xx...

Cassandra Triggers on a subset of nodes? -

Cassandra Triggers on a subset of nodes? - triggers defined on table @ keyspace level , i'm guessing every replica table needs have access trigger class. is possible have given dc trigger class resident whilst other dcs don't? it possible have subset of replicas within dc have trigger class? i suppose quick , dirty workaround have "empty" classes on nodes upon don't want triggering seems real hack -- hence question. thanks in advance. cassandra

java - Working with ObjectOutputStream and ObjectInputStream -

java - Working with ObjectOutputStream and ObjectInputStream - assume these: objectoutputstream out = new objectoutputstream(new bufferedoutputstream(remote.getoutputstream())); objectinputstream in = new objectinputstream(new bufferedinputstream(remote.getinputstream())); after sending "initiate file send" message , size , reading string , long number on other end (you can assume handled them) want able write whole file without having instance new outputstream. i've done far is: inputstream buf = new bufferedinputstream(new fileinputstream(file)); out.writeunshared(new peerprotocol(peerprotocol.type.file, file.getname(), file.length())); int sum = 0, len; byte[] buffer = new byte[remote.getsendbuffersize()]; out.flush(); out.reset(); while ((len = buf.read(buffer)) > 0) { out.write(buffer, 0, len); sum += len; sendfiledialogcontroller.updatepercentage((double) sum / file.length() * 100); } // system.out.println("done sending...

objective c - How can I manage a new NSMenuItem? -

objective c - How can I manage a new NSMenuItem? - i'm adding menuitems code. i'm using "selector" problem because have "mutable" menu dont know how many rows have, need manage each 1 not knowing how many are. perhaps code can explain improve problem. i have loop follow (more or less) for (punterolineas=punterolineas; punterolineas <= intnumlineas; punterolineas++) { nsdictionary *dic = [lineas objectatindex:punterolineas]; nsmenuitem *item = [[nsmenuitem alloc] initwithtitle:[dic objectforkey:@"txtmostrado"]action:@selector(menuitem:) keyequivalent:@""];//where menuitem manage item, need identify 1 is. [item settarget:self]; [statusmenu additem:item]; } i think reply "sender" of "menuitem" ibaction, how can manage it? thanks in advance there several approaches: set tag of each menu item. in action method ( -menuitem: ), check sender 's tag , decide do. in case, ...

Is it possible to upload image to the server using Bootstrap's Modal dialog box, jQuery, AJAX and PHP? If yes how? If no what's the reason for it? -

Is it possible to upload image to the server using Bootstrap's Modal dialog box, jQuery, AJAX and PHP? If yes how? If no what's the reason for it? - i'm using php, jquery(jquery-1.9.1.min.js , jquery-ui-1.10.0.custom.min.js), ajax, bootstrap design framework(bootstrap v3.0.0), etc. i'm relatively newbie in field of web programming. now @ 1 place want show bootstrap framework's inbuilt modal dialog box on click of button. in modal dialog box there html file command uploading image file. user select image file his/her local machine browsing files. after performing next necessary validations proper standard image extension maximum size limit of 5 mb minimum dimensions of 940 px * 370 px the file should uploaded server using php code. if of validations fail relevant error message should displayed in reddish color above file upload html control. is possible accomplish functionality? heard it's not possible upload files using ajax. don't know w...

regex - Matching 3+ Title Case Word in a single pcre expression -

regex - Matching 3+ Title Case Word in a single pcre expression - i looking single pcre (ver. 3.85) compatible regular look matches string composed of 3 or more title case words not match string containing words starting lower-case letter. e.g.: "gaius julius caesar" should match "gaius caesar" should not match "gaius julius caesar rome" should match "gaius julius caesar" should not match tried (\b[a-z]\w+\b){3,} with no success. any hint? try 1 of these: (\b[a-z]\w+\b\s??){3,} here demo (\b[a-z]\w+\b)(\s+\b[a-z]\w+\b){2,} here demo regex pcregrep

gfortran - Fortran Error: Unexpected STATEMENT FUNCTION statement at (1) -

gfortran - Fortran Error: Unexpected STATEMENT FUNCTION statement at (1) - i'm doing fortran code find radial distribution function (rdf) hard spheres in cell model. it's not finished yet, , have error. i'm implementing histogram. code. implicit double precision (a-h,o-z) parameter(npart=3000) dimension x(0:npart),y(0:npart),z(0:npart) c n=number of particules c rcel=radius of cell c rpart=radius of particules pi=3.1415927 write(*,*)'n,rcel,rpart,dr?' read(*,*)n,rcel,rpart,dr write(*,*)'nstep,dp' read(*,*)nstep,dp rpart2=(2*rpart) nfatmax=rcel/dr ! number of bins vtotal=(4/3)*pi*rcel*rcel*rcel dentotal=n/vtotal write(*,*)'density of particles, volume , bins = ' write(*,*)dentotal,vtotal,nfatmax x(0)=0 y(0)=0 z(0)=0 write(*,'(a,/)')'generating start configurations' counter1=0 counter2=0 coun...

android - Using Cordova, is there a way to reference native icons? -

android - Using Cordova, is there a way to reference native icons? - i'm using cordova 3.5 build app contains menu pretty standard items in list (home, contacts, etc.), , want utilize native menu icons whenever possible. believe icons on device part of os, don't know if cordova gives me way reference them. i suppose i'd need write javascript function take right file name based on platform, e.g.: // pseudocode var icon = ''; if (platform === 'android') { icon = 'some/path/home.png'; } else { icon = 'other/path/icon.home.png'; // or maybe function such next exists: // icon = cordova.getnativeicon('icon.home.png'); } $('.selector').css('background-image', icon); alternatively, may able create referencing files in css, e.g.: .android .home-icon { background-image: url('some/path/home.png'); } .ios .home-icon { background-image: url('other/path/icon.home.png'); } so, how f...

php - Laravel: Fetch with where filter on "with" -

php - Laravel: Fetch with where filter on "with" - in laravel can fetch related database entry in 1 query with method this: $customer = customer::with('user')->where([ 'id' =>'1' ])->first(); which homecoming client , it's related user object. possible apply filter item? thought possible: $customer = customer::with('user')->where([ 'id' =>'1', 'users.status' => 'activated' ])->first(); but not seem work, tries find column "users.status" instead of column status in users table. you can utilize eager loading constraints. allows perform queries on related models. like this: $customer = customer::with(['user' => function($query){ $query->where('status', 'activated'); //in user table }])->where('id', '1')->first(); //in client table you can read eager load constaints part more info...

editor - Particle effects libgdx -

editor - Particle effects libgdx - i have made particle effect using particle editor comes libgdx. now, need provide particle effect load method 2 arguments - 1 particle file , 1 base of operations image of particle. my question - can find image particle, sec argument? the first image .p image generated particle editor , sec image actual image can utilize effect, say, sample image of water drop. should re-create image asset folder , should set path of sec image in .p file. copy image asset folder. double click on .p file. search .png file. set path image saved in asset, e.g. drop.png. libgdx editor sprite particle-system

android pull to refresh listview -

android pull to refresh listview - i retrieve info server , populate them listview. want implement pull refresh in listview there's error app. utilize library written other people pull refresh function. here's code : public class mainactivity extends activity { listview list; textview ver; textview name; textview api; button btngetdata; arraylist<hashmap<string, string>> oslist = new arraylist<hashmap<string, string>>(); //url json array private static string url = "http://api.learn2crack.com/android/jsonos/"; //json node names private static final string tag_os = "android"; private static final string tag_ver = "ver"; private static final string tag_name = "name"; private static final string tag_api = "api"; jsonarray android = null; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); ...