Posts

Showing posts from June, 2011

knockout.js - Knockout component with observable object doesn't update data -

i have following component: <template id="fruits-tpl"> <p>name: <input data-bind="value: name" /></p> <p>type: <input data-bind="value: color" /></p> </template> ko.components.register('fruits', { viewmodel: function(params) { this.name = params.name; this.color = params.color; }, template: { element: 'fruits-tpl' } }); i'm using component view model below, items in observable list of different types , have different properties: function fruit(data) { this.name = ko.observable(data.name); this.color = ko.observable(data.color); } function dessert(data) { this.name = ko.observable(data.name); this.packaging = ko.observable(data.packaging); } function vm(){ var data = [{name:"apples",color:"yellow"},{name:"cookies",packaging:"box"}]; this.items = ko.observablearray([new fruit(dat...

c# - Correct way to use StackExchange.Redis in WebApi -

i want add counters several c# webapi controllers using redis , stackexchange.redis client. i have never used redis before, however, have read docs, setup server , appears straightforward results looking for. having read stackexchange.redis docs, concerned following... connectionmultiplexer lot, designed shared , reused between callers. should not create connectionmultiplexer per operation. i have googled , found several examples simple c# console apps (the technique here obvious not relevant webapi), have found examples of using stackexchange.redis client on microsoft pages, emphasize importance of sharing connectionmultiplexer, after hours, still no further forwards in understanding how achieve in c# .net webapi would kind enough point me in right direction? i need make simple calls redis, namely incr counter 1, decr counter 1 , getset counter 0 (to reset) as counters not critical, want ensure if reason connection redis server unavailable code continues in t...

Understanding how to use arg/3 and univ/2 in Prolog -

i have database in prolog , i'm trying return henry owns , owns car , truck. i've tried can think of return henry owns , can't find solution. know how return owns car or truck individually ?- owns(x,car( , ,_))., not @ same time. appreciated. owns(bill, car(ford, mustang, 1964)). owns(sue, car(pontiac, gto, 1967)). owns(george, car(honda, civic, 2013)). owns(betty, truck(ford, f150, 2013)). owns(henry, motorcycle(honda, goldwing, 2010)). prolog has relational data model, allows recursive terms instead of atomics only, sql, , doesn't give names 'columns'. loosely: ╒═════════════╤═════════════╕ │ sql │ prolog │ ╞═════════════╪═════════════╡ │ table │ predicate │ │ record │ clause │ │ table name │ functor │ │ column │ argument │ ╘═════════════╧═════════════╛ so, knowledge attributes position required. conventionally, can associate attribute' names in functors: % owner of kind listed kinds_owner(k...

javascript - Trying to serialize form with ajax and jquery -

i'm trying form submit user input modal in jquery via ajax ajax call isn't picking user input. ajax call being made server when check if user input has registered server it's blank. html: <body> <div id="home"> <p>home</p> </div> <div id="welcome"> <span>welcome <?php echo $_session['user']; ?></span> </div> <form id="form"> <p1>please enter in hotkey below</p1> <input type="text" id="hotkey" placeholder="hotkey"> <input id="submit" type="button" value="submit"> </form> <div id="keyshortcut"> <input type="text" id="keyshortcut" placeholder="hotkey"> </div> <div id="select_button"> <button id="select-hotkey">select hotkey</button> <...

api - what are the difference between particle.publish event and particle.subscribe event in particle.cloud? -

what particle.publish , particle.subscribe event in particle.cloud api .i sort of confused on application while building android application internet of thing product. particle.publish() publish event through particle cloud forwarded registered callbacks, subscribed streams of server-sent events, , other devices listening via particle.subscribe().this feature allows device generate event based on condition. example, connect motion sensor device , have device generate event whenever motion detected. particle.subscribe() subscribe events published devices.this allows devices talk each other easily. example, 1 device publish events when motion sensor triggered , subscribe these events , respond sounding alarm. to use particle.subscribe(), define handler function , register in setup(). references: https://docs.particle.io/reference/firmware/photon/#cloud-functions

Laravel TypiCMS redirects to root -

i using typicms laravel here : github.com/typicms/base , facing following problem: i created new module named "news" executing command: composer require typicms/news. added providers in config/app.php, have publish views , migrations , migrated database too. the problem facing whenever url given, redirects me root directory of project, is, http://localhost/mywebsite/public/ even, if give invalid route localhost/mywebsite/public/foobar, instead of showing me error, again redirects root directory. i have checked .htaccess , routes.php file , there not modifications. regards: adnan typicms cannot installed in subfolder, root of site must http://localhost .

gis - Using Python fiona read polygons -

for now, can use fiona read 1 specific polygon , plot this: ## read shapefile import fiona import shapely shapely.geometry import shape c = fiona.open("xxx.shp") pol = c.next() geom = shape(pol['geometry']) poly_data = pol["geometry"]["coordinates"][0] poly = polygon(poly_data) output this: http://i13.tietuku.com/65d7d9d6a423a5d3.png but when shapefile composed several shapefile this: fig = plt.figure(figsize =(8,6)) ax = plt.gca() map = basemap(llcrnrlon=114.3,llcrnrlat=37.95,urcrnrlon=114.75,urcrnrlat=38.2) map.readshapefile("xxx",'xxx',zorder =1,) patches=[] cs=plt.cm.blues_r(np.arange(21)/21.) info, shape in zip(map.xxx_info, map.xxx): x,y=zip(*shape) patches.append( polygon(np.array(shape), true) ) # facecolor= '#6582b3' ax.add_collection(patchcollection(patches, facecolor= cs,edgecolor='none', linewidths=1.5, zorder=2,alpha = 0.8)) http://i13.tietuku.com/a331edcbee...

asp.net - Fetch distinct record from dataset/table using linq to dataset/datatable -

i fetching record database , store result in dataset. my dataset sid table userid par1 par2 par3 274 tbl1 43 0 0 0 232 tbl1 43 1 2 0 232 tbl1 43 1 2 1 232 tbl2 43 1 2 0 232 tbl2 43 1 2 1 i want show 6 column distinct record.distinct should on sid, table , userid.i want output this sid table userid par1 par2 par3 274 tbl1 43 0 0 0 232 tbl1 43 1 2 0 232 tbl2 43 1 2 0 does possible through linq dataset/datatable. unable asenumerable method on dataset getting on datatable. i'm confused question want want? yourdatatable.rows.cast<datarow>() .groupby(r => new { sid = r.field<int>("sid"), userid = r.field<int>("userid"), table = r.field<string>("table") }) .select(e => e.firstordefault()) .select(grp => new { sid = grp.field<int>("sid"), userid = grp.field<int>("userid"), ...

I want to run many SOAPUI project xmls using Gradle script, in Linux -

i want run soapui project xmls using gradle script. gradle script should read project xmls soapuiinputs.properties file , run automatically all. please guide me step step how create gradle script run soapui projects in linux server. note: use soapui version 5.1.2. probably simple way call soapui testrunner directly gradle exec task, can cli. in gradle can define follow tasks (note try on windows same on linux ask you've change paths): // define exec path class soapuitask extends exec { string soapuiexecutable = 'c:/some_path/soapui-5.2.1/bin/testrunner.bat' string soapuiargs = '' public soapuitask(){ super() this.setexecutable(soapuiexecutable) } public void setsoapuiargs(string soapuiargs) { this.args = "$soapuiargs".trim().split(" ") list } } // execute soapui task executesoapui(type: soapuitask){ // pass project path argument, // note " needed soapuiargs ...

How to add REST services to a RAP application -

i working on web application uses rap. in application there 1 bundle contains model backed database. create bundles provide rest services make use of model bundle. i looked @ application#addentrypoint ui contributions - not services such. i read frankappel's post http://www.codeaffine.com/2011/08/26/raprwt-osgi-integration/ , wonder if rwt , felix might way go. looks promising felix new me. is possible add these rest bundles rap application , set them handle /rest/* urls? or more sensible keep 2 parts separate , share model bundle in different way? when using rap, active bundle may contribute usual "org.eclipse.equinox.http.registry.servlets" , "org.eclipse.equinox.http.registry.resources" extension points. need make sure name of rap application's entry point(s) , paths of ressources , servlets won't overlap. so in practice, can develop rest services if there no rap component. 2 happily live side-by-side within same servlet cont...

javascript - Passing function into angular directive -

i want pass function returns promise directive. doing follows: callback created in parent controller: $scope.mycb = function(data) { console.log(data); } scope of directive: scope { datacallback: "&" } it being passed directive follows: <my-directive data-callback="createcallback"></div> and being called in directive controller follows: $scope.datacallback(data) where data local variable. currently not working. $scope.datacallback returning parentget(scope, locals) , not executing of code inside of function. can point me in right direction? https://plnkr.co/edit/ycgfpurlt2mfuppi1lzj?p=preview solved: can not use data start of directive property.

vb.net - Speed up application performance with Access database -

i have written vb.net application uses ms access 2010 database. database kept in network drive on server in us. application being used users in germany, china, italy, , india apart users. for user performance of application excellent, other users other regions, performance not great. every database action takes @ least minute complete. please me improve situation. expand access back-end ms sql/mysql back-end. that, need either host ms sql or mysql on dedicated ip/intranet address. ms access has inbuilt function upgrade back-end tables ms sql server use or recreate back-end in mysql. other that, multiple users multiple remote locations + shared network drive drive crazy

c# - Using the dot "." character in MVC4 Routes -

i serving images database tables of same file type. character dot "." in routes, have not had success doing so. understanding isapi handlers causing issue related this. i'm unsure how go adding , exclusion allow route handled asp.net. routes.maproute( name: "imageurl", url: "image/{action}/{id}.png", defaults: new { controller = "image" } ); you 404 errors because there no specific managed handler mapped path *.png in iis configuration. requests image/*.png paths intercepted staticfile modules ( staticfilemodule, defaultdocumentmodule, directorylistingmodule ) , these modules can not find requested files. you can workaround problem configuring application in web.config . the first option add runallmanagedmodulesforallrequests="true" attribute configuration/system.webserver/modules element. should looking this: <modules runallmanagedmodulesforallrequests="true" /> note: re...

jquery - css thumb carousel stopping at 0 -

i working on thumb slider carousel project. did using css3. did , used cover div , inside used ul , slide left , right. cover div overflow hidden. works fine problem is, unable stop slide @ end of li's. how can achieve that? tried if else statements confused. full clode comments here http://jsfiddle.net/pqhak/ here sample code $('#thumbslist').css('margin-left', positiontobemoved + 'px'); the full code in fiddle. please tell me doing wrong thanks. for left arrow click use this if (currentposition!=0) { var positiontobemoved = currentposition + 77; // setting th final fix// $('#thumbslist').css('margin-left', positiontobemoved + 'px'); } else { } then stop passing after first div left. have careful moving should stop before check it

C# - Download and Saving images to folder -

i'm trying show form displays label "updating, window close once update has finished" download few images files. put on form's shown. private void frmextraupdater_shown(object sender, eventargs e) { (int = 1; < 8; i++) { string _emoticonurl = string.format("https://dl.dropboxusercontent.com/u/110636189/mapleemoticons/f{0}.bmp", i); webrequest requestpic = webrequest.create(_emoticonurl); webresponse responsepic = requestpic.getresponse(); image webimage = image.fromstream(responsepic.getresponsestream()); // error webimage.save(application.startuppath + @"\images\f" + + ".bmp"); } } however.. once form shown, label doesn't show because doesn't load (it insantly downloades images. want show label , start download). the other problem throws "a generic error occurred in gdi+." on webimgae.save part reason. why...

How to perform a lightweight migration on sqlite database in Android just the way like iOS? -

i want add keys, such "url", existed table. in ios, can create new version of data model , perform light weight migration. however, default way in sqliteopenhelper seems destroy old db , create new one. @override public void onupgrade(sqlitedatabase db, int oldversion, int newversion) { // drop older table if existed db.execsql("drop table if exists " + table_1 + ", " + table_2 + ", " + table_3 + ", " + table_4); // create tables again oncreate(db); } how can keep old database , add new keys in android? you can write own upgrade sql query upgrade database. call oncreate after droping tables easy way upgrade tables without caring fks, null fields or database version. use oldversion , newversion make correct changes (alter table) on database. onupgrade doc

c# - Unable to use verbatim string in Regex constructor instantiation -

i'm attempting new-up regex object using pattern. string pattern , original regex below: string search = "root\\hill"; var regex = new regex(search, regexoptions.ignorecase); this throws system.argumentexception exception i'd convert pattern verbatim string. i've tried this: var regex = new regex(@search, regexoptions.ignorecase); and this: string verbatim = @search; var regex = new regex(verbatim , regexoptions.ignorecase); but no avail. both throw same exception. when i'm debugging, putting "raw" string in regex constructor (eg. new regex(@"root\\hill", regexoptions.ignorecase) ) works, search value changes of course. how can use verbatim string variable? the @ sign must before string literal, not before variable name: string search = @"root\\hill"; var regex = new regex(search, regexoptions.ignorecase); putting @ sign before identifier way use language keyword identifier, it's unrelated...

android - SqLite Database error inside asynctask -

i run db stuff inside asynctask runs inside runnable via handler.postdelayed(r, 30000). gets repeated (as can see, every 30 seconds). sometimes, not everytime, app crashing. below logcat. 09-24 18:28:52.813: w/dalvikvm(6194): threadid=12: thread exiting uncaught exception (group=0x40daf1f8) 09-24 18:28:52.823: e/androidruntime(6194): fatal exception: asynctask #2 09-24 18:28:52.823: e/androidruntime(6194): java.lang.runtimeexception: error occured while executing doinbackground() 09-24 18:28:52.823: e/androidruntime(6194): @ android.os.asynctask$3.done(asynctask.java:278) 09-24 18:28:52.823: e/androidruntime(6194): @ java.util.concurrent.futuretask$sync.innersetexception(futuretask.java:273) 09-24 18:28:52.823: e/androidruntime(6194): @ java.util.concurrent.futuretask.setexception(futuretask.java:124) 09-24 18:28:52.823: e/androidruntime(6194): @ java.util.concurrent.futuretask$sync.innerrun(futuretask.java:307) 09-24 18:28:52.823: e/androidruntime(6194): @ ...

c - mprotect on a mmap-ed shared memory segment -

when 2 processes share segment of memory opened shm_open , mmap-ed, doing mprotect on portion of shared memory in 1 process affects permissions seen other process on same portion? i.e. if 1 process makes part of shared memory segment read only, become read other process too?

c# - When i change CurrentUICulture text property doesn't change -

i have following problem. wpf solution include 2 resx files 2 rows resources.resx -name: ismanager value: yes | name: isnotmanager value: no resources.pl-pl.resx -name: ismanager value : tak | name: isnotmanager value: nie i have simple textblock in mainwindow <textblock text="{x:static prop:resources.ismanager}" /> question why when change currentuiculture pl-pl, text property in textblock doesn't change ? understand property initialized once , should 'refresh' value of property, there option automaticly ? below code change it. private void button_click_1(object sender, routedeventargs e) { thread.currentthread.currentuiculture = new cultureinfo("pl-pl"); } what can change text property ? if bind static value not refresh, must open window or recreate view or ui, more precise textblock must recreated in order evaluate text property once again. the solution runtime localization. have several alternatives. using dyna...

Python - editing local HTML files - Should I edit all of the content as a one string or as an array line by line? -

just clear not scraping question. i'm trying automate editing of similar html files. involves removing content between tags. when editing html files locally, easier open() file dump content line line string it's easier apply regular expression? thanks for structured markup html, better use parser beautifulsoup regular expressions. few reasons include better results malformed html , decreased complexity (you don't need reinvent wheel). considering question @ face value though, seems easier split html lines using readlines dealing 1 line @ time when applying regular expressions.

iOS7 when UIsearchbar added in UINavigationBar not showing cancel button -

i add uisearchbar above uinavigationbar , set uisearchbar showscancelbutton yes, work fine in ios6 in ios7 not showing cancel button. used below code snippet uisearchbar *searchbar = [[uisearchbar alloc] initwithframe:cgrectmake(0, 0, 600, 44)]; searchbar.showscancelbutton = yes; searchbar.translucent = no; [searchbar settintcolor:[uicolor redcolor]]; searchbar.backgroundcolor = [uicolor yellowcolor]; [self.navigationcontroller.navigationbar addsubview:searchbar]; for reason ios7 not show cancel button when added navigation bar. happens if try setting titleview of navigationitem. you can circumvent problem wrapping uisearchbar in uiview first. here's how titleview: uisearchbar *searchbar = [uisearchbar new]; searchbar.showscancelbutton = yes; [searchbar sizetofit]; uiview *barwrapper = [[uiview alloc]initwithframe:searchbar.bounds]; [barwrapper addsubview:searchbar]; self.navigationitem.titleview = barwrapper;

wcf - Stuck in a Authentication redirect loop - STS/WIF -

Image
using vs2012 .net framework 4.5, created wcf service application local sts, using identity , access plugin. goal able authenticate using browser. did far: added wsfam , sam modules. used fiddler make sure i'm getting redirect made sure fedauth[] cookies created. right after cookies created (sam) i'm being redirected again sts. stuck in loop. wcf , web services quite new me, sorry if elaborated much... here's web.config: <?xml version="1.0"?> <configuration> <configsections> <section name="system.identitymodel" type="system.identitymodel.configuration.systemidentitymodelsection, system.identitymodel, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" /> <section name="system.identitymodel.services" type="system.identitymodel.services.configuration.systemidentitymodelservicessection, system.identitymodel.services, version=4.0.0.0, culture=neutral, publickey...

Uploading image to apache server on clustered tomcat -

i have image upload logic in clustered tomcat setup apache web server infront. there way upload image files on web server instead of tomcat, accessed static file when user tries download uploaded image file? you redirect in web.xml: <servlet> <servlet-name>images</servlet-name> <servlet-class>uk.co.foo.imageserver</servlet-class> </servlet> <servlet-mapping> <servlet-name>images</servlet-name> <url-pattern>/images/*</url-pattern> </servlet-mapping>

iPython: Create variables that depend on the loop index -

dear stackoverflow community, i new programming please excuse if not answers , have ask again. tried use search function , pretty sure problem common one, not understand answers honest. i using ipython 1.1.0 run program named cantera, combustion modelling. runs python 2.7 if correct. problem want plot multiple data points via matplotlib getting these datapoints seems kind of hard. want show dependance of 2 specific combustion variables. approach create loop , every step create 1 of these datapoints , and plot of them in end. tried create variables depend on index name turns out code used not work. %matplotlib inline import matplotlib.pyplot plt import numpy nm future import division import cantera ct for in range(50,151): x_i = i/100 the thing every loop overwrites existing variable x_i end 1 variable x_i in end. want every loop create new variable x_1, x_2 x_3, x_4 , on. there easy way that? thank help. use dictionary: x={} in range(50,151): x[i] = i/10...

VHDL assignment slice not implemented? -

is possible specify bit range assigned on left side of assignment? eg. r(15 downto 8) <= r(15 downto 8) -d; the above gives me compiler error: error 722: assignment signal slice not implemented. i've tried googling error no avail. however works: r <= r(15 downto 8) - d; assignments slices allowed. tool using? size of d? pay attention result sizes. if size of d larger r, result size matches size of d. what happens in following assignments: r(15 downto 0) <= r(15 downto 8) - d ; if assignment works, need slice d: r(15 downto 8) <= r(15 downto 8) - d(7 downto 0); if not it, rest of code like?

javascript - Prevent text selection/highlighting in a content editable div -

is there way create content-editable div users can't select/highlight content can still input things? want create interface users forced delete , enter things key-by-key, without being able make mass edits via highlighting. i've looked various forms of "user-select" property in css, works static content, doesn't seem work content-editable elements/inputs. any ideas? thanks if can accept textarea instead of contenteditable div , can this: window.onload = function () { var div = document.getelementbyid('div'); if (div.attachevent) { div.attachevent('onselectstart', function (e) { e.returnvalue = false; return false; }); div.attachevent('onpaste', function (e) { e.returnvalue = false; return false; }); } else { div.addeventlistener('paste', function (e) { e.preventdefault(); }); div.addev...

javascript - jQuery news ticker, tucking behind other jQuery plugins and Images -

i cannot recreate error in fiddle. here's link site (which never come down). when arrive @ site, you'll see news ticker @ bottom of site. scroll down, you'll notice pass 1. main slider , 2. announcement slider , , 3. images military, nursing, , georgia ... ticker gets tucked behind of these. how can keep on top? i've placed script called after dom loaded, , before slider script called... $(function() { $('div.latest-news').jnewsbar({ position: 'bottom', effect: 'slideup', height: 25, animspeed: 600, puasetime: 4000, toggleitems: 5, theme: 's-orange' }); }); it's using jquery 1.9.1 (cdn). first, can give css class jnewsbar attribute z-index: 99 the reason other elements — on newsbar — on newsbar position: relative makes them open z-index . , newsbar position: absolute — subject z-index due fact, of other elements coming in dom later, ...

reflection - Why is my C# IS statement not working? -

i have following code, t generic defined such: public abstract class repositorybase<t> t : class, idatamodel this code works fine: propertyinfo propertyinfo = typeof(t).getproperty(propertyname); if (propertyinfo.declaringtype.fullname == typeof(t).fullname) <--- works fine vs code evaluates false propertyinfo propertyinfo = typeof(t).getproperty(propertyname); if (propertyinfo.declaringtype t) <-- not work what doing wrong here? is uses type comparison between 2 objects. declaringtype of type type , typeof(t) of type t , not equal. var atype = typeof(propertyinfo.declaringtype); var btype = typeof(t); bool areequal = atype btype; // false, unless t type

css - In jQuery UI 1.9 or higher, how to suppress restoring after size effect? -

it seems jquery ui 1.9 or higher restores original size after size effect. sample code here: http://jsfiddle.net/mqcxy/ $(function () { $('.circle').click(function () { $(this).effect("size", { to: {width: 50,height: 50}, origin: ['bottom', 'right'] }, 1000, function () { $(this).css({'background': 'blue' }); }); }); }); basically, if choose jquery ui 1.8.18 (under jquery 1.7.2), shape shrink right size , stay there. later jquery ui restore shape. i noticed "origin" options did not take effect higher jquery ui. example, used origin: ['bottom', 'right'] which had no effect jquery ui 1.9 or higher versions. so how suppress 'restore' , make 'origin' effective in jquery ui 1.8 or later? a made new function what need fiddle i changed effect animate , , modifiyng css top+left achive origin functionality, not...

predict with kernlab package error Error in .local(object, ...) : test vector does not match model R -

i'm testing kernlab package in regression problem. seems it's common issue 'error in .local(object, ...) : test vector not match model ! when passing ksvm object predict function. found answers classification problems or custom kernels not applicable problem (i'm using built-in 1 regression). i'm running out of ideas here, sample code is: data <- matrix(rnorm(200*10),200,10) tr <- data[1:150,] ts <- data[151:200,] mod <- ksvm(x = tr[,-1], y = tr[,1], kernel = "rbfdot", type = 'nu-svr', kpar = "automatic", c = 60, cross = 3) pred <- predict(mod, ts ) you forgot remove y variable in test set, , fails because number of predictors don't match. work: predict(mod,ts[,-1])

Web scraping using Java -

i want show part of college site app (like news part only). site developed using javascript. tell me how achieve this. know java quite well. use jsoup , httpclient that's need

python - Iterating over an array and dictionary and storing the values in another array -

say have dictionary of pattern types: patterndict = {1:[0],5:[0,3]} and have array: a = [[1,3,4,5],[6,7,8,9]] i have 2 empty arrays store value of each pattern type: pattern1=[] pattern5=[] i iterating on each row in , each pattern type in patterndict: for row in a: key, value in patterndict.iteritems(): currentpattern = row[value] value in patterndict[key] #append either pattern1 or pattern5 currentpattern based on key and having trouble. how append either pattern 1 array or pattern 5 array based on key in patterndict. output like: pattern1=[1,6] pattern5=[1,5,6,9] what's best way this? use dict instead of variables : >>> p = {k:[x[y] x in y in v] k, v in patterrndict.iteritems()} >>> p[1] [1, 6] >>> p[5] [1, 5, 6, 9]

Android detect location settings -

i'm using new location api in app , i'm wondering how detect if user has location access enabled on there phone. i'm setting locationclient , running locationrequest. how run check before doing see if can users location? in onconnected call method these: private boolean checklocationproviders() { if(mlocationmanager.isproviderenabled(locationmanager.network_provider)) { return true; } else { if(mlocationmanager.isproviderenabled(locationmanager.gps_provider)) return true; else return false; } } if false returned, can open settings screen in way: startactivity(new intent(settings.action_location_source_settings));

sass - multi-nested css flex does not flex properly -

i'm doing mockup using html , scss (or sass?). goal have page > container > [header + article container] articles displayed in grid. i have tossed out div-nade , let shrapnel of div#id land may, instead decided use css flex , having problems. know , understand properties , parameters, can't seem them right. how make there's limited number of items per row , and wraps next row? here's pen: http://codepen.io/monsto/pen/ekazm here's html: <body> body flex <div class="main"> .main <header class="header"> .header <nav> nav </nav> </header> <section class="pack"> section <article class="item text"> article <div class="item-content"> <header class="entrytitle">a guy walks bar</header> <p></p> <p></p> <...

linux - Downloading all Urls accessible under a given domain with wget without saving the actual pages? -

trying determine valid urls under given domain without having mirror site locally. people want download pages want list of direct urls under given domain (e.g. www.example.com ), www.example.com/page1 www.example.com/page2 etc. is there way use wget this? or there better approach this? ok, had find own answer: the tool use httrack . httrack -p0 -r2 -d www.example.com the -p0 option tells scan (not save pages); the -rx option tells depth of search the -d options tells stay on same principal domain there -%l add scanned url specified file doesn't seem work. that's not problem, because under hts-cache directory can find tsv file named new.txt containing urls visited , additional information it. extract urls following python code: with open("hts-cache/new.txt") f: t = csv.dictreader(f,delimiter='\t') l in t: print l['url']

tfs - Team Foundation Service build fails on NuGet package restore -

i'm having kind of odd problem team foundation service build. queue , starts fine, fails following error: c:\a\src\platform\prod\platform.web\platform.web.csproj (436): build restored nuget packages. build project again include these packages in build. more information, see http://go.microsoft.com/fwlink/?linkid=317568. so re-queue build per message/url and...it happens again. i've googled around can't seem figure out issue is. can build fine in visual studio , solution configured package restore. thoughts? thanks in advance. the solution specified in link in error message itself. this happening due improvement specified in page: the improvement we’ve updated microsoft.bcl.build use different approach. new version use conditional import similar nuget’s automatic import feature does. allow project load in visual studio. however, microsoft.bcl.build adds target project run after build finished. target checks whether current...

TeamCity - Web Deploy with MSBuild and the file system -

i want build source , copy folder have wrong or i'm not getting or both: /p:configuration=release /p:outputpath=bin /p:deployonbuild=true /p:deploytarget=msdeploypublish /p:msdeployserviceurl=https://{server}:8172/msdeploy.axd /p:username=**** /p:password=**** /p:allowuntrustedcertificate=true /p:deployiisapppath=test.livesite.com /p:msdeploypublishmethod=wmsvc what want have build , on success copy to: d:\f1\f2\website. how do this? i made changes , here's i'm at: build msbuild src\zookeeper.web\zookeeper.web.csproj msdeploypublish vsmsdeploy c:\program files(x86)\msbuild\microsoft\visualstudio\v11.0\web\microsoft.web.publishing.targets(4377, 5): error error_could_not_connect_to_remotesvc: web deployment task failed. (could not connect remote computer ("zookeeper") using specified process ("web management service") because server did not respond. make sure process ("web management service") started on remote compu...

directive - angularjs: only set background-image on ngStyle if url is defined -

i have property on scope can hold url (bgurl) of image. use image background image of 'div'. however, if property undefined use default image defined class bg-image. can like <img ng-show="bgurl" ng-src="bgurl"/> <div ng-hide="bgurl" class="bg-image"/> however, combine 1 element. tried this <div class="gb-image" ng-style="{true: 'background-image': 'url(\'' + bgurl + '\')'}[bgurl]"/> i copied code google (no idea if can ever work). 1 thing clear though, doesn't work :) nice angular way solve , can solution work ? right way directive way: app.directive('bg', function () { return { link: function(scope, element, attrs) { if(scope.bgurl){ element.css("background-image","url("+scope.bgurl+")"); } else { element.addclass("bg-default"); ...

CreateOrUpdateView for Django Models -

in models have foreignkey relationship this: class question(models.model): question = models.textfield(null=false) class answer(models.model): question = models.foreignkey(question, related_name='answer') user = models.foreignkey(user) class meta: unique_together = (("question", "user"),) the corresponding url submit answer contains id of question, this: url(r'^a/(?p<pk>\d+)/$', answerquestion.as_view(), name='answer-question'), with user coming self.request.user, trying createorupdateview , allow convenient navigation user , url scheme. until tried with: class answerquestion(loginrequiredmixin, createview): and add initial value, isn't clean because of pk. updateview run problems because have set default values form. has done this? i'd rather avoid having create , update view same answer. the updateview , cre...

uinavigationbar - iOS 7 navbar colours not showing properly on iPhone 4 -

my navigation bar colours appear in ios 7 deploying ios 6.0, if system version ios 7.0 or later, of navigation bar colouring doesn't display on iphone 4. works fine in iphone 5. here's how doing it: if (system_version_greater_than_or_equal_to(@"7.0")) { self.edgesforextendedlayout = uirectedgenone; [self.navigationcontroller.navigationbar setbartintcolor:[uicolor bluecolor]]; [self.navigationcontroller.navigationbar settranslucent:yes]; } #define system_version_greater_than_or_equal_to(v) ([[[uidevice currentdevice] systemversion] compare:v options:nsnumericsearch] != nsorderedascending) maybe last line problem (settranslucent) since have heard iphone 4 has problems translucency, i'm pretty sure set navbar translucent in ios 6 well. try getting rid of out next , update if fixes anything. edit: looks bar colour disappears after dismiss presented view controller. doesn't screw on iphone 4. get rid of [self.navigationcontroll...

Python Twisted's DeferredLock -

can provide example , explain when , how use twisted's deferredlock . i have deferredqueue , think have race condition want prevent, i'm unsure how combine two. use deferredlock when have critical section asynchronous , needs protected overlapping (one might "concurrent") execution. here example of such asynchronous critical section: class networkcounter(object): def __init__(self): self._count = 0 def next(self): self._count += 1 recording = self._record(self._count) def recorded(ignored): return self._count recording.addcallback(recorded) return recording def _record(self, value): return http.get( b"http://example.com/record-count?value=%d" % (value,)) see how 2 concurrent uses of next method produce "corrupt" results: from __future__ import print_function counter = networkcounter() d1 = counter.next() d2 = counter.next() d1.ad...

Submitting a PHP form from JavaScript -

i have html file, javascript file , php file. javascript used validate user input , pass form php page. the validation function working great, form not submit javascript php file. after spending 2 days on this, still can not figure out have wrong , why javascript not submit form data php file , how php page appear after submitting html: <div class = "formtext"> <p> <form id = "formtext" name="survey" method="post" action="formtext.php"> <table id="surveytable" width="300" border="1"> <tr> <td> name: <input type = "text" id="username" name="name" onkeyup="document.getelementbyid('mirror').innerhtml=this.value" /> <br/ > name: <span id="mirror"></span> </td> </tr> <tr> <td> number: <input type = "text" id=...

excel - How to search a range for multiple pieces of text -

i need search f$3 through f$96 cell contain 4 of w3 , x3 , y3 , , z3 . return true if cells in f$3 f$96 contain four. how do? currently use =and(isnumber(search(w3,f$3:f$96)),isnumber(search(x3,f$3:f$96)),isnumber(search(y3,f$3:f$96)),isnumber(search(z3,f$3:f$96))) but if place formula in aa3 , checks f3 , not f$3 through f$96 i need check cells in range , return true if 1 contains 4 criteria. sumproduct , -- (double negative) useful want. sumproduct expects array of values, cells checked. this produced example (split multiple lines readability): =(sumproduct(--(f$3:f$96=w3))>0)+ (sumproduct(--(f$3:f$96=x3))>0)+ (sumproduct(--(f$3:f$96=y3))>0)+ (sumproduct(--(f$3:f$96=z3))>0) the -- converts true/false 1's , 0's, , adds them (as giving 1 list each sumproduct , doesn't multiplication, adds). value returned number of cells matched value looking for. as don't care how many matched, @ least 1 matched, complare result of...

c# - Readline command is skipping lines -

i'm trying read data .txt file , place in list of class instances. while debugging, noticed readline() command skipping lines of .txt file. have idea why happening , how remedy situation? string logpath; string defaultpath; string line; openfiledialog openlog = new openfiledialog(); openlog.filter = "txt files (*.txt)|*.txt|all files (*.*)|*.*"; if (openlog.showdialog() == dialogresult.ok) { logpath = openlog.filename; logtextbox.text = logpath; defaultpath = logpath.substring(0, logpath.lastindexof("\\")); streamreader logstream = new streamreader(logpath); while (!logstream.endofstream) { line = logstream.readline(); console.writeline(line); } }

c# - Dividing by Random.next always results in 0? -

this 1 puzzling me. writing damage algorithm random variation. when calculate variation looks like. random random = new random(); double variation = random.next(85, 115) / 100; double damage = restofalgorithm * variation; when that, variation outputs 0. however, if below, output expected result. random random = new random(); double variation = random.next(85, 115); double damage = restofalgorithm * (variation / 100); why happen? divide double: double variation = random.next(85, 115) / 100.0; or double variation = random.next(85, 115) / (double)100; otherwise you'll doing integer arithmetic (since random.next returns integer , 100 integer). i consider best practice know types working , cast type desired. more necessary, compiler implicitly convert values. explicit casts intentions visible looking @ code later. double variation = (double)random.next(85, 115) / 100d;

php - Symfony 2 trouble with Single Table Inheritance -

i'm new symfony , doctrine , i'm trying implement simple user registration system 2 types of users, client , expert. i have abstract class usuario common data both users share , other 2 extend it. the problem when run command app/console doctrine:schema:update, generates table usuario fields of usuario class 1 experto class. here code: class usuario: /** * usuario * * @orm\entity * @orm\table(name="usuario") * @orm\inheritancetype("single_table") * @orm\discriminatorcolumn(name="tipo", type="string") * @orm\discriminatormap( {"cliente" = "cliente", "experto" = "experto"} ) */ abstract class usuario { /** * @var integer * * @orm\id * @orm\column(name="id", type="integer") * @orm\generatedvalue(strategy="auto") */ protected $id; /** * @var string $nombre * * @orm\column(name="nombre", type="string", length=255) */ prot...

asp.net - insert Image in database -

i new asp.net , databases! trying save image database file upload control. have tried isn't working upon clicking submit button, data not added database neither showing error! code have tried protected void buttonsubmit_click(object sender, eventargs e) { if (fileupload1.hasfile && page.isvalid) //fileupload , submit { string fileextension = system.io.path.getextension(fileupload1.filename); if (fileextension.tolower() != ".jpg") { labelupload.text = "only files .jpg extension allowed"; labelupload.forecolor = system.drawing.color.red; } else { fileupload1.saveas(server.mappath("~/uploads/" + fileupload1.filename)); labelupload.text = "file uploaded"; labelupload.forecolor = system.drawing.color.deepskyblue; labelsubmit.text = "submitted succesfully"; labe...

html - javascript window.print() internet explorer 8 not printing entire webpage -

when printing windows7 ie8; whats visible in viewport printing. printing windows8 believe has ie9 prints whole webpage no issue, 5 pages in total. work compatibly view enabled though. all checked print prompt that's not issue. brought attention user not isolated issue. appreciated. i had set body static body{position: static;}

android media codec Unable to instantiate a decoder for type 'video/mp4' -

working on implementing mediamuxer class. takes inputs mediacodec class (one audio , 1 video). throws error when trying encode "video/mp4" code: string mime = mimetypemap.getsingleton() .getmimetypefromextension("mp4"); codec = mediacodec.createencoderbytype(mime); error: unable instantiate decoder type 'video/mp4' notice error decoder , call create encoder. i figure out in minute, here else runs this. after lot of fumbling around found documented, android recomended media formats , following dbro , fadden 's examples, mediamuxer works taking following types of mediaencoder inputs create elmetary h.264 stream , mux mp4 file: private static final string video_mime_type = "video/avc"; private static final string audio_mime_type = "audio/mp4a-latm";

c - 'Nodes are not specified' error on UPC on a cluster with UDP network type -

i implemented pgas parallel computing model on cluster of hp quad-core machines running ubuntu 12.04. used berkeley upc pgas language , created ssh password-less login in-order communicate between nodes. tried run udp based upc jobs following instructions in this link under heading running udp-based upc jobs . steps followed listed below. defining nodes in 'machines' file: node0 node1 node2 setting environmental variable '$upc_nodefile': $upc_nodefile=machines compile: upcc -network=udp -pthreads=4 hello.upc -o helloupc run: upcrun -n 4 helloupc but when try run program gives following error upcrun: nodes not specified! see running udp-based upc jobs in 'man upcrun' is there mistake have done or added? please me. the hello.upc code snippet if necessary: int main() { printf("hello thread %i/%i\n", mythread, threads); upc_barrier; return 0; }

xaml - Getting System.Windows.Markup.XamlParseException while trying to run WP8 app -

i writing windows phone 8 application , using mvvm light. have written viewmodel , model class of wp8 app seperate pcl project. while using expression blend populate design time data. when try run app in emulator following error. please me in figuring out fix error. a first chance exception of type 'system.windows.markup.xamlparseexception' occurred in system.windows.ni.dll here details of exception. system.windows.markup.xamlparseexception occurred hresult=-2146233087 message=cannot create instance of type 'mypkg.commons.viewmodel.viewmodellocator' [line: 12 position: 61] source=system.windows linenumber=12 lineposition=61 stacktrace: @ system.windows.application.loadcomponent(object component, uri resourcelocator) @ mypkg.windowsphone8.app.initializecomponent() @ mypkg.windowsphone8.app..ctor() innerexception: system.typeinitializationexception hresult=-2146233036 message=the type initializer 'mypkg.com...