Posts

Showing posts from September, 2015

c# - Store DBContext Log in other EF table -

i want store logs in db table (imported ef code). my code looks this: public pmcontext() : base("myentities") { configuration.proxycreationenabled = false; configuration.lazyloadingenabled = false; this.database.log = s => logstore(s); } private void logstore(string message) { tlog log = new tlog(); log.description = message; log.insertdate = datetime.now; logs.add(log); savechanges(); } public virtual dbset<tlog> logs { get; set; } i cannot use savechanges() (get error "sqlconnection not support parallel transactions") , if remove line nothing stored in db table. how can fix this? i think happens during savechanges call anywhere in app, because sql generated call logged, triggers nested savechanges call tries start own transaction. and there thing: savechanges call in logstore method trigger logging itself, you'd end starting infin

python - Scrapy spider memory leak -

Image
my spider have serious memory leak.. after 15 min of run memory 5gb , scrapy tells (using prefs() ) there 900k requests objects , thats all. can reason high number of living requests objects? request goes , doesnt goes down. other objects close zero. my spider looks this: class externallinkspider(crawlspider): name = 'external_link_spider' allowed_domains = [''] start_urls = [''] rules = (rule(lxmllinkextractor(allow=()), callback='parse_obj', follow=true),) def parse_obj(self, response): if not isinstance(response, htmlresponse): return link in lxmllinkextractor(allow=(), deny=self.allowed_domains).extract_links(response): if not link.nofollow: yield linkcrawlitem(domain=link.url) here output of prefs() htmlresponse 2 oldest: 0s ago externallinkspider 1 oldest: 3285s ago linkcrawlitem 2 oldest: 0s ago request

c# - SetBinding not registering for PropertyChanged event -

in application i'm working on, programmatically create several frameworkelements differing data sources. unfortunately, data binding failing. i managed distill problem following program: using system.collections.generic; using system.componentmodel; using system.runtime.compilerservices; using windows.ui.xaml; using windows.ui.xaml.controls; using windows.ui.xaml.data; namespace testbinding { public class bindingsource : inotifypropertychanged { public event propertychangedeventhandler propertychanged; protected virtual void onpropertychanged(string propertyname) { propertychangedeventhandler handler = propertychanged; if (handler != null) handler(this, new propertychangedeventargs(propertyname)); } protected bool setfield<t>(ref t field, t value, [callermembername] string propertyname = null) { if (equalitycomparer<t>.default.equals(field, value)) return false;

java - Creating signature with HMAC_SHA1 - Secret key expected exception -

i want create digital signature of signaturemethod.hmac_sha1, referred below program package com.sampel.test; import javax.crypto.mac; import javax.crypto.spec.secretkeyspec; import javax.xml.crypto.*; import javax.xml.crypto.dsig.*; import javax.xml.crypto.dom.*; import javax.xml.crypto.dsig.dom.domsigncontext; import javax.xml.crypto.dsig.keyinfo.*; import javax.xml.crypto.dsig.spec.*; import java.io.fileinputstream; import java.io.fileoutputstream; import java.io.outputstream; import java.security.*; import java.util.collections; import java.util.formatter; import java.util.iterator; import javax.xml.parsers.documentbuilderfactory; import javax.xml.transform.*; import javax.xml.transform.dom.domsource; import javax.xml.transform.stream.streamresult; import org.w3c.dom.document; /** * simple example of generating enveloped xml * signature using jsr 105 api. resulting signature * (key , signature values different): * * <pre><code> *<envelope xmlns="ur

php - How can I access an array/object? -

i have following array , when print_r(array_values($get_user)); , get: array ( [0] => 10499478683521864 [1] => 07/22/1983 [2] => email@saya.com [3] => alan [4] => male [5] => malmsteen [6] => https://www.facebook.com app_scoped_user_id/1049213468352864/ [7] => stdclass object ( [id] => 102173722491792 [name] => jakarta, indonesia ) [8] => id_id [9] => el-nino [10] => alan el-nino malmsteen [11] => 7 [12] => 2015-05-28t04:09:50+0000 [13] => 1 ) i tried access array followed: echo $get_user[0]; but displays me: undefined 0 note: i array facebook sdk 4 , don't know original array strucutre. how can access example value email@saya.com array? to access array or object how use 2 different operators. arrays to access

Android Google Analytics - App version reporting -

we integrated libgoogleanalyticsservices.jar in our app , working fine. default includes 'version_code' buildconfig.java when sending messages google analytics service. i'd include 'version_name' instead of 'version_code'. 1. there way project libgoogleanalyticsservices.jar? 2. there way configure libgoogleanalyticsservices class send version_name instead of version_code?

How to make an Webview based IOS app and being able to publish it -

i have website responsive. built app on android webview loads website. i same on ios know fact there lot of restrictions publishing web-view based application on app store. what can add webview in order gain approval sure ? i'm looking extremly lazy on this, there alternative may think of ? to answer or comments why bothering creating app if website enough. answer : commercial reason , user friendliness reasons add native controls or small features site doesn't have. add in native social sharing options, native navigation controls, etc. uber hybrid app , of instagram believe. however review process comes down reviewer, lax , not.

sqlite - using spinner on ListView with Sql lite in android -

my android app contains list view shows data base context. want: 1-when list view row gets clicked (itemclicklistener),the custom spinner shows. 2-when spinner item selected, title of shown in list view fields. 3-at last: color of rows change, when item selected. i've found solution no.1 in link don't know other two. please me solve these problems ?

java - NullPointerException when parsing XML data with geocoding API in Processing -

i using processing , loading data csv table, 1 column includes country names. each country trying use google geocoding api respective latitude , longitude values, getting nullpointerexception error. here code: import processing.xml.*; bubble[] bubbles; table table; void setup() { size(displaywidth, displayheight); loaddata(); } void draw() { background(255); (int = 0; < bubbles.length ; i++) { bubbles[i].display(); bubbles[i].rollover(mousex, mousey); } } void loaddata() { table = loadtable("terroristattacks.csv", "header"); bubbles = new bubble[table.getrowcount()]; (int = 0; < table.getrowcount(); i++) { tablerow row = table.getrow(i); float estimate = row.getfloat("estimate"); float diameter = estimate*0.17; string name = row.getstring("name"); string country = row.getstring("country"); int year = row.getint("date"); api_key = "my_api"; string

python - Accessing BeautifulSoup elemets in django template -

i'm trying display results of soap request in django template. the results in xml i've used beautifulsoup process data , access beautifulsoup object in django template, looping through each element , calling child elements name so {% item in bs_data %} {{ item.child1.text }} {{ item.child2.text }} {% endfor %} i can in python, django template seems treat beautifulsoup elements if have no children, although loop through items in bs_data item.child1 empty item.0 i can't iterate through sub elements of each element. i've looped through elements in view , created nested lists achieve same result if knows how persuade django template parse beautiful soup objects i'm dying know. cheers edit ok below example xml can print different elements , step through elements printing text. below code: b = beautifulsoup.beautifulsoup("<note>\ <to>tove</to>\ <from>jani</from>\ <heading>reminder</heading&g

apache - .htaccess 301 redirect http://olddomain.com/post/post-title to http://newdomain.com/story/post-title -

i trying redirect http://olddomain.com/post/post-title http://newdomain.com/story/post-title my .htaccess rule is: rewriteengine on rewriterule ^post/(.*)$ http://newdomain.com/story/$1 [l,r=301] but isn't working reason. can me out? you may need use rewritebase in code: rewriteengine on rewritebase / rewriterule ^post/(.*)$ http://newdomain.com/story/$1 [r=301,l]

How do I sum the total calculated values in a loop (Python 2.7) -

i trying sum total yearly rent period, using code shown below. any appreciated. rent_rate = input('please enter price per square foot:') # price sq/ft lease_rate = input('please enter rate of lease:') # interest rate lease_term = input('please enter tenor (in years) of lease:') size_of_space = input('please enter size(in square feet) of space:') print "year %25s" % "rent rate%25s" % "rate%25s" % "square feet%25s" % "yearly rent%25s" % "monthly rent" year in range( 0, lease_term ): rent_rate = principal * ( 1.0 + rate ) ** year yearly_rent = rent_rate * size_of_space monthly_rent = yearly_rent/12 print "%4d%21.2f%21.2f%21.2f%21.2f%21.2f" % ( year + 1, rent_rate, rate, size_of_space, yearly_rent, monthly_rent) i think need few things! should assign 'principal' 'rent_rate' because came out of thin air! also, if user inputs

css - bootstrap icons not displaying -

i downloaded image bootstraps icons , use them in web page i have image, , correct css but arent displaying @ all. css .icon-home { background-image:url(../img/glyphicons-halflings.png); background-position: 0 -24px; } html <div class="col"> <span class="icon-home"></span> <p>pittsburgh, pa 15276</p> </div> fiddle https://jsfiddle.net/jwct6rmk/ i uploaded image imgur account. you'r missing styling.. display:block on span element. try this: .icon-home { background-image:url(http://i.imgur.com/umalj55.png); background-position: 0 -24px; width: 12px; height: 12px; display:block; } or better: .icon { background-image:url(http://i.imgur.com/umalj55.png); width: 12px; height: 12px; display:block; } .icon-home { background-position: 0 -24px; } .icon-car { backgrou

c# - Selecting items in an ordered list after a certain entry -

i have ordered list of objects. can find item in list using following code: purchaseorders.firstordefault(x => x.ourref.equals(lastpurchaseorder, stringcomparison.ordinalignorecase)) what want select items in list appear after entry. how best achieve this? to index of item , select range? it sounds want skipwhile : var orders = purchaseorders.skipwhile(x => !x.ourref.equals(...)); once iterator has stopped skipping, doesn't evaluate predicate later entries. note that code include entry doesn't match predicate, i.e. 1 given reference. give entries order onwards. can use .skip(1) if want skip that: // skip exact match var orders = purchaseorders.skipwhile(x => !x.ourref.equals(...)).skip(1); this linear, mind you... if list ordered x.ourref find index binary search , take range there onwards... wouldn't unless find simpler code causes problems.

node.js - How do I route some URL patterns to a specific port? -

i have node server running on port 3000. i'll using handle apis, don't want urls in format example.com:3000/api/xyz i want in format: example.com/api/.. how route /api/ calls port 3000? example.com serving html pages, have nothing node. node used apis now. found varnish, looks overkill. an easy way put nginx in front of node server. you can setup nginx serve static media based on url patterns. can register non-static requests sent upstream node.js server on port 3000 node.js + nginx - now?

oop - Scala, how do I replace static members? -

i wan't build class animal can find number of animals created. in scala there no option static variable, how can implement such functionality in scala (i looking non-specific solution)? thanks! for example in java: public class amimal { static int number_of_aminals = 0; public animal() { number_of_animals++; } } one option be: import animal class animal { animal.increment() } object animal { private[this] var _count = 0 def increment(): unit = { _count += 1 } def count: int = _count } though might want use atomicint.

c++ - Destructor called twice causes crash -

i implemented constructor takes string argument, causes destructor called twice , program crashes (the program contains raw pointer). know has copy constructor somehow gets called when type of constructors used. below simple code illustrates problem. i appreciate comments on how fix program avoid crash. need use kind of constructors. understand why copy constructor gets called. didn't explicit assignment. #include <iostream> #include <fstream> #include <string> using namespace std; class debugclass { public: debugclass(void) { data = null; } debugclass(std::string str) { data = new double[2]; data[0] = 1.0; data[1] = 2.0; } debugclass(debugclass const& other) { cout << "copy construction\n"; } ~debugclass(void) { if (data) { delete [] data; data = null; } } double* data; }; int main() { debugclass ob

spring - Issue with writing named sql query with hibernate -

i trying access database fk using named sql query hibernate, idea query customer table contains name, , companyid,etc. companyid fk commpany table. query wrote follows: @namednativequery(name="getcustomer", query="select customer.* customer,company customer_first_name = (?1) , customer_last_name= (?2) , customer_company_id_fk = (?3) ",resultclass=customer.class) the issue having follow: exception in thread "main" org.hibernate.queryparameterexception: position beyond number of declared ordinal parameters. remember ordinal parameters 1-based! position: 2 @ org.hibernate.engine.query.spi.parametermetadata.getordinalparameterdescriptor(parametermetadata.java:89) @ org.hibernate.engine.query.spi.parametermetadata.getordinalparameterexpectedtype(parametermetadata.java:109) @ org.hibernate.internal.abstractqueryimpl.determinetype(abstractqueryimpl.java:507) @ org.hibernate.internal.abstractqueryimpl.setparameter(abstractqueryimpl.j

xml - How to select nodes with conditions based on attributes -

i want use xpath in xslt select nodes conditions based on attribute values. to illustrate question, have short example xml instance below: <?xml version="1.0" encoding="utf-8"?> <root> <elementa fid="2013_4_20150722_0" datetime="2015-07-13t01:04:20+02:00"/> <elementa fid="2013_4_20150721_0" datetime="2015-07-13t01:04:20+02:00"/> <elementa fid="2013_4_20150721_0" datetime="2015-07-20t14:14:22+02:00"/> </root> and want select elementa nodes following conditions: the attribute fid unique if there multiple elementa nodes same fid attribute value, 1 newest datetime selected. so in example want select first , third elementa . how can achieve xpath 2.0 in xslt 2.0? here pure, single , efficient (no sorting) xpath 2.0 expression , selects wanted elements: $fid in distinct-values(/*/*/@fid), $maxtime in max(/*/*[@fid eq $fid]/@

php - Laravel parent/children relationship on it's own model -

i want vouchers have @ least 1 child, voucher can have multiple voucher children, voucher can have 1 parent. i set following models , calls, , query generates desired, until part: 'vouchers'.'parent_id' = 'vouchers'.'id' wanted functionality: $vouchers = voucher::has('children')->get(); or $vouchers = voucher::has('parent')->get(); resulted query select * `vouchers` `vouchers`.`deleted_at` null , (select count(*) `vouchers` `vouchers`.`deleted_at` null , `vouchers`.`parent_id` = `vouchers`.`id` , `vouchers`.`deleted_at` null ) >= 1 models: class voucher extends basemodel { public function parent() { return $this->belongsto('voucher', 'parent_id'); // return $this->belongsto('voucher', 'parent_id', 'id'); <- attempted din't work } public function children() { return $this->hasmany('voucher', 'p

ios - UINotification selecting from handleActionWithIdentifier display specific viewController -

i new ios programming , understand swift language now. app, have set user, local , remote notifications. local notifications have 2 actions, 1 dismiss , other direct user specific viewcontroller. my viewcontroller hierarchy specific viewcontroller want display tabbarcontroller -> (2nd tab) tableviewcontroller -> (one of many tablecells) viewcontroller after richard's suggestion, have simplified code above hierarchy. have performed background fetch server in response remote push notification , save content locally before creating local notification inform user. have managed set point guide user correct tab on tabviewcontroller using self.window?.rootviewcontroller.selectedindex = 1 within application:handleactionwithidentifier in app delegate. how proceed selecting correct tablecell assuming local notification holds index can used? edit: after tinkering, managed viewcontroller wanted displayed. if var tabb = self.window?.rootviewcontroller as? uitabbarcontroll

Django REST: CREATE function is not calling inside serialize class -

the problem create function not calling , returning validation boolean value whether true or false . please note: validation part working fine. code follows: views.py class testapi(apiview): serializer_request = testapiserializer def post(self,request): obj = self.serializer_request(data=request.data) print obj.is_valid() if obj.is_valid(): obj.save() return response(status=status.http_200_ok) else: return response(request_for_demo_ser.errors, status=status.http_400_bad_request) serializers.py class testapiserializer(serializers.modelserializer): class meta: model = testdemo fields = ('name') # function not @ calling. def create(self, validated_data): name = validated_data['name'] return testdemo.objects.create(name=name) you forgot save. obj = self.serializer_request(data=request.data) print obj.is_valid() if obj.i

Mysql lock wait timeout exceeded on update query -

in database of production server, procedure runs scheduler daily, in procedure have few delete insert , update statements. but throwing lock wait timeout exceeded error on 1 update using used tables. initially innodb_lock_wait_timeout 50 seconds, changed 100, problem solved time, again error occurred changed 120, again solved temporary. have set 150 seconds global , set 200 in session (in procedure). working fine few days. but procedure important, getting error creates problems has important data. so there other solution can permanent solution problem? i newbie please help. p.s. mysql - 5.6 128 gb ram. using hibernate has persistent connection pool. do below in my.cnf , restart mysql [mysqld] innodb_lock_wait_timeout=10000 or set global innodb_lock_wait_timeout = 10000; you can make temporary timeout trigger session add below trigger: set innodb_lock_wait_timeout = 10000;

asp.net - .NET MVC5 Encoding and Decoding ID -

my routes works controller/action/id wont want show id part directly coz specific personal number , how can encode , decode id helps.. public class user { public user() { userid = guid.newguid(); } public guid userid {get; set;} public int personalnumber {get; set;} } your url looks like: http://www.website.com/controller/action/73b56796-6a41-4433-b5c1-c20daaa17fc9

IIS application initialization module and memory management -

i researching iis application initialization module , can see, when using alwaysrunning option start mode setting application pool, starts new worker process run if there isn't requests. when applying option starts process automatically. my concern memory management , cpu usage, how handled since process runs. how can compare setting start mode ondemand , increase idle time minutes couple of days? way, guess, process run in idle mode x days before it's terminated, , reinitialized on next request , keep running couple of days. if set minutes let's 1.5 days, bound use application @ least once day, persist process runtime , never terminated. can share experience regarding topic? thanks i have multisite application runs few sites under separate app pools. set ondemand start mode , idletime 1740 minutes, use page output cache app different times different page types. there nhibernate behind scene , db mysql. the active site have more 100k visits per day ,

find - How to search while we type in Eclipse Mars? -

how search while type in eclipse mars? example if want search in java file eclipse should highlight text typing string search. use 'edit > incremental find next' , start typing string find. the normal bound ctrl + j ( ⌘ + j on macs)

OWIN and Azure AD HTTPS to HTTP Redirect Loop -

i new owin :). trying have page open public area allow anonymous on http, , restricted section require authentication. i'd not force entire site https general users. the issue have receive following loop: http://example.com/authenticatedpage -> 302 redirect ad login login ad page http 200. triggers open of azure ad link site. link site identifies owin redirect , 302 redirect http://example.com/authenticatedpage go 1. i have tried 3 ways of intercepting redirect in owin nothing seems work. if begin session browsing https://example.com/ click on link authenticatedpage, login works expect. i.e. load https://example.com/authenticatedpage -> 302 redirect ad login ad -> loads https://example.com/ 302 redirect https://example.com/authenticatedpage is there anyway fix without marking whole site requiring ssl? the problem referrer set oidc middleware in application. happens this: enter application on http://foo.bar , redirect identity p

Visual Studio 2015 (C++) code size -

importing projects visual studio 2013 2015 , compiling them makes dll size jump 80kb 380kb. (i compile c / c++ dll's) i have tried playing linker settings no luck in getting size down again, including new incremental linking. does know causes , how down again ? it 1 here: /opt:ref (victors -s tip put me on track, thanks) i don't know why gets messed when upgrading 2015.

authentication - Logoff does not restrict file access to users (Django) -

i have created django app , incorporated in 1 of app's page d3 . example gets data file data.tsv stored in server. path data.tsv file path . now in order prevent access http://localhost:8000/path users other registered , use django app have changed chmod privileges of others in root folder path can nor read nor execute or write. my problem when user logged in decides logout tab using able access http://localhost:8000/path if cached in users browser. if example reset browser http://localhost:8000/path not accessible. do have ideas on how can prevent this? thank much

Is there a Java Lock implementation with timeouts -

i have spring application can run in clustered environment. in environment use redis (and redisson) distributed lock-service. many of locks used e.g. protect tasks can run once @ time, or may started every x seconds. the application capable of running in standalone mode (without redis). however case need different implementation of lockservice. thought extremely simple because need create lock instance locally timeout (e.g. "only run action @ ever 2 minutes"). when looking around not find implementation of java lock interface supports setting timeout lock (so automatically unlocks after time). is there such thing, or there extremely simple (in terms of lines-of-code) way how can implement myself, i'm missing? how lock impl should behave: other threads not able lock while it's active (as other lock) ideally, owning thread should able call lock(long timoutms) again extend lock (set timeout given time again) edit: seems concrete example understand lo

ruby on rails - In a show action, how to list objects that are in a associated model? -

what want here list entries of each activities in project. app/controllers/projects_controller.rb : class projectscontroller < applicationcontroller def index @projects = project.all end def show @project = project.find(params[:id]) @activities = @project.activities end end app/views/projects/show.html.erb : <div> <p><%= @project.description %></p> <% @activities.each |activity| %> <div> <p><%= activity.name %></p> <% activity.entries.each |entry| %> <= error @ line <p><%= entry.name %></p> <% end %> </div> <% end %> </div> my models : project : has many activities activity : has many entries, belongs project entry : belong activity the error obtain when run : "uninitialized constant activity::saisy" on show file i don't know if can pu

c# - Files pulled from Git result excluded from the project -

Image
i need visual studio , git . , friend of mine working on simple project written in c#. share project git (the code on github) there's wrong: when pull new files (or pulls mine) files result excluded project. can see them in project folder, not in visual studio solution explorer. see them have click on "show files" @ top of solution explorer , appear, but, said, result excluded (with dotted border). see image here below: this strange. have worked git on other platforms (android studio, eclipse, xcode) , first time encounter problem. how can solve it? thank in advance, sometime have add files manually. click on folder in vs , "add existing item" if missing files on disk.

c - malloc() 5GB memory on a 32 bit machine -

i reading in book: the virtual address space of process on 32 bit machine 2^32 i.e. 4gb of space. , every address seen in program virtual address. 4gb of space further goes through user/kernel split 3-1gb. to better understand this, did malloc() of 5gb space , tried print addresses. if print addresses, how application going print whole 5gb address when has 3gb of virtual address space? missing here? malloc() takes size_t argument. on 32 bit system it's alias unsigned 32 bit integer type. means cannot pass value bigger 2^32-1 argument malloc() making impossible request allocation of more 4gb of memory using function. the same true other functions can used allocate memory. end either brk() or mmap syscall. length argument of mmap() of type ssize_t in case of brk() have provide pointer new end of allocated space. pointer again 32 bit. so there absolutely no way tell kernel more 4gb of memory allocated 1 call) , it's not accident - wouldn't mak

javascript - Scroll down not working using smoothscroll plugin -

i need make scrolling smoothly,so i've used plugin sadly,it broke scroll down functionality. i use function,for option on plugin: $(function () { $.srsmoothscroll({ // defaults step: 55, speed: 400, ease: 'swing', target: $('body'), container: $(window) }); }); does know problem? or should one? update works if use this,but in chrome: $(function () { $.srsmoothscroll({ // defaults step: 55, speed: 400, ease: 'swing', target: $('#container'), container: $('body') }) }) my page has full width,height container id target plugin,and container body.

javascript - Meteor helpers not available in Angular template -

i learning meteor , i'm trying add internationalization support tap:18n package. unfortunately, template helper function _ not availble inside angular modules. example <div>{{_ "foo"}}</div> works, not when using inside module template : > index.html <div ng-app="app" ng-include="'foo.ng.html'"> > foo.ng.html <div ng-app="bar"> <div>{{_ "bar"}}</div> </div> note: app declared inside foo.js angular.module('app', ['angular-meteor']); , in project root level. is possible make helpers available inside angular modules? (note: see referenced issue .) ** edit ** same thing happens when trying render package templates inside template : > index.html <section ng-app="users" ng-include="'users/usersession.ng.html'"> </section> > users/usersession.ng.html <ul class="nav

CoreOS access from other instance -

i have coreos cluster 3 instances. need init service in 3 instances, don't want use ip connect. there dynamic way scan instances , ip's , use it? you can use following command list of cluster instances further processing: fleetctl list-machines | awk '{print $2}' | tail -n +2

json - How to get post category name -

how post category name using angularjs wp-json in wordpress {{post.title}} working {{post.content}} working {{post.terms.category.name}} not working or {{post.category.name}} not working thanks with {{post.terms.category.name}} coming close. {{post.terms.category}} contains array. have loop through these values. to test can use first item in line: {{post.terms.category[0].name}} should work example.

android - When can I use GoogleMap.getProjection().getVisibleRegion()? -

i have googlemap.getprojection().getvisibleregion().latlngbounds but when app started, values zero. i tried @ onviewcreated, onactivitycreated , onstart of supportmapfragment , doesn't work. when can it? there callback function notifies when ready?any appreciated. you can add oncamerachangelistener map.

Why does Rails render templates for HEAD requests? -

for head requests, rails seems perform usual steps including rendering templates , discards respective output (sends empty response). i can't think of way rendering templates in case of head request makes sense (unless have actual business logic gets executed in templates, should never case). so question be: agree me or there possible side-effects didn't foresee? the reason i'm asking because i'm thinking of filing rails issue , possibly submit pull request feature disables default (non-explicit) template rendering head requests. good point remo, however, not agree. for every http verb, manually need write code handle things. similar thing head. head request follow execution style of request unless don't handle it. an example can be: def index if request.head? head :created else # handle request rails.logger.info "derp #{request.method}" end end

asp.net - Increase IIS CPU usage -

i have visual studio 2015 on x64 machine (intel i5, 8gb ram, windows 10) running windows communication foundation (wcf) service. service runs 5 hours process data , uses iis express web server. when running cpu usage of iis 13% every time. one time noticed data getting processed fast , looked @ task manager , cpu usage of process 40%, can't make iis process go 40% again. don't know happened increased cpu usage 40% time. is there way increase cpu usage of iis (express) computation runs faster , therefore data gets processed faster? there settings can changed accomplish this. think cpu should above 14% every time. there setting restricted cpu usage in iis settings? in iis 8.5, there limit (percent) property per app pool settings allows % of cpu time consumed worker thread related app-pool

Azure Media Services Video Rotation -

i trying videos play using azure media services. videos taken in portrait mode not play properly, not rotated. here codes (taken azure media services sample) dim filenamewithpath string = server.mappath("." & "\video2.mp4") dim filename string = path.getfilename(filenamewithpath) dim preset string = "h264 adaptive bitrate mp4 set 720p" filevideo.saveas(filenamewithpath) ' create , cache media services credentials in static class variable. dim assetname = "uploadsinglefile_" + datetime.utcnow.tostring() dim asset iasset = _context.assets.create(assetname, assetcreationoptions.none) dim assetfile = asset.assetfiles.create(filename) dim accesspolicy iaccesspolicy = _context.accesspolicies.create(assetname, timespan.fromdays(30), _ accesspermissions.write or accesspermissions.list) dim locator ilocator = _context.locators.createlocator(locatort

sql server - In SQL replace null value with another value -

Image
here sql query select p.studentid, ai.rollno, p.firstname, p.middlename, p.lastname, om.examid, et.examname, om.subjectid, isnull(convert(varchar(20),om.obtainedmarkstheory), 'a') 'obtainedmarkstheory', isnull(convert(varchar(20),om.obtainedpracticalmarks),'a') 'obtainedpracticalmarks' students.personalinfo p inner join students.academiccourse ac on p.studentid = ac.studentid inner join students.academicinfo ai on p.studentid=ai.studentid left outer join exam.obtainedmarkentry om on p.studentid = om.studentid left join exam.examtype et on om.examid = et.examid ai.batchid = '103' , ai.semesterid = '21' , ac.section = '8' this produce result in picture: but want result since 2 students absent in exam similarly if exam exists of 3 student , other absent same procedure should repeat use isnull() function see below example declare @variable varchar(max) set @variable = null select isnull(@variable,0)