Posts

Showing posts from September, 2010

html - Emmet Vim wrap a specific tag around -

this basic not find easier way of doing it. i have html file , want wrap <strong></strong> around part. so, go visual mode. select text. control y - , . asks tag. enter strong , wraps tags expected. but way long vim imho. is not there quicker/ easier way done? may abbreviation attached keystroke? so, select text in visual mode, press key , there --- <strong> </strong> appear around it? with surround plugin it's select text in visual mode, press s< , tag name, <cr> . or ys , motion or text object, < , tag name, <cr> . < can replaced t , attributes can appended tag name, , <cr> can replaced > .

angularjs - Angular $watch: TypeError: Cannot read property of undefined -

i have $watch applies filter date format: $scope.$watch(function() { return pn.myobj.birthdate; },function(n,o){ var dateview = $filter('date')(pn.myobj.birthdate,'yyyy-mm-dd'); pn.myobj.birthdate = dateview; }); the first time load page read in console: typeerror: cannot read property 'birthdate' of undefined how can prevent problems arising in $watch when object undefined ? your object isn't initialize @ time $watch function called. check exists before attempting access 1 of it's properties. $scope.$watch(function() { return pn && pn.myobj && pn.myobj.birthdate; }

php - Server-side form validation weird error -

i have following php code form processing : $post = cleanpost($_post, $db->link); echo strlen($post['login']).' -- '.strlen($post['pass']); // debug if ((strlen($post['login']) < 3) || (strlen($post['pass'] < 7))) { $page = new page("subscribe"); $page->assign("msg", "at least 3 characters login , 7 characters password"); } the form filters stated cases (less 3 chars login , less 7 chars password) filtered when should pass : tried register "asdf" // "asdfasdf" , still message. can see, have echoed strlens, 4 , 8. i'm totally stuck here if ((strlen($post['login']) < 3) || (strlen($post['pass'] < 7))) should be: if ((strlen($post['login']) < 3) || (strlen($post['pass']) < 7))

angularjs - $httpBackend.verifyNoOutstandingExpectation() leading to "No response defined !" error -

Image
my understanding of $httpbackend.verifynooutstandingexpectation() says "make sure of requests $httpbackend.expect() -ed tests made code. if of them weren’t, i’ll throw exception." 1) seems redundant. isn't case corresponding $httpbackend.expect() fail, , alert you? 2) i'm getting no response defined ! error when use $httpbackend.verifynooutstandingexpectation() . error goes away , test passes when remove $httpbackend.verifynooutstandingexpectation() . why be? admin.controller.spec.js:14 refers $httpbackend.verifynooutstandingexpectation() call. admin.controller.spec.js describe('admincontroller', function() { var admincontroller, scope, $httpbackend; beforeeach(module('mean-starter')); beforeeach(inject(function($controller, $rootscope, _$httpbackend_) { $httpbackend = _$httpbackend_; scope = $rootscope.$new(); admincontroller = $controller('admincontroller', { $scope: scope }); })); after

nosql - How does Cassandra scale horizontally ? -

i've watched video on cassandra database, turns effective , explains lot cassandra. i've ready article , books cassandra thing not understand how cassandra scale horizontally. horizontally scale mean add more nodes gain more space. understand each node has identical data i.e if 1 node has 1tb of data , replicated other nodes means n nodes each contain 1tb of data. missing here ? yes, missing something. data may not need duplicated n times, n number of nodes. typically configure replication factor (rf) lower number of nodes (n). for example, rf = 3, n = 5. meaning each row duplicated 3 times across randomly chosen 3 nodes out of 5 nodes (plus pristine copy). if 1 node goes down, have 3 copies elsewhere on other nodes. this works better in larger clusters, e.g. rf = 5, n = 100. higher rf improves data redundancy , read speed, decreases write speed. there balance, if rf high, rf = n, you'd have high data redundancy, high resilience node failures, , high

spring - Customized ObjectMapper not used in test -

i using spring framework, version 4.1.6, spring web services , without spring boot. learn framework, writing rest api , testing make sure json response received hitting endpoint correct. specifically, trying adjust objectmapper 's propertynamingstrategy use "lower case underscores" naming strategy. i using the method detailed on spring's blog create new objectmapper , add list of converters. follows: package com.myproject.config; import com.fasterxml.jackson.databind.propertynamingstrategy; import org.springframework.context.annotation.*; import org.springframework.http.converter.httpmessageconverter; import org.springframework.http.converter.json.jackson2objectmapperbuilder; import org.springframework.http.converter.json.mappingjackson2httpmessageconverter; import org.springframework.web.servlet.config.annotation.enablewebmvc; import org.springframework.web.servlet.config.annotation.webmvcconfigureradapter; import java.util.list; @configuration @enablew

html - Pseudo element affecting outline -

Image
this question has answer here: weird behavior in firefox outlines , pseudo-elements 2 answers pretty sure bug firefox, perhaps can weigh in. i applying outline around 100x100 box. when use pseudo element positioned absolute should remove document flow, appears still affecting flow of outline property. ie , chrome appear render expect, black outline stays positioned main element. ideas? .content { width:100px; height:100px; outline:1px solid black; border:1px solid yellow; position:relative; } .content:after { position:absolute; content:'pseudo'; background-color:salmon; width:200px; top:150px; } <div class='content'></div> http://jsbin.com/gatupogiwi/1/edit?html,css,output you can change outline style box-shadow : outline:1px solid black; to: box-shadow: 0px 0px 0px

math - Compiling a .c file using gimptool -

i've found gimp plugin on github i'd use: https://github.com/possiblyphilip/koi (check out, seems pretty cool). but when try install author suggests: sudo apt-get install libgimp2.0-dev sudo gimptool-2.0 --install-admin koi.c i following error: /usr/bin/ld: /tmp/ccaahhwn.o: undefined reference symbol 'cos@@glibc_2.0' //lib/i386-linux-gnu/libm.so.6: error adding symbols: dso missing command line collect2: error: ld returned 1 exit status how can fix this? i've done googling , found this answer, suggesting error caused missing math library should added in linking stage (-lm). problem gimptool automatically , don't think there's way tell add anything. the author of plugin says prebuilt binary available, found. i've e-mailed guy, didn't answer yet. if it's obvious - i'm sorry, can't figure out. ps nevermind - i've managed install using sudo cc=gcc cflags=-o3 libs=-lm gimptool-2.0 --install-admin koi.c

git - How can I remove merged branch which is already push to origin -

for example, have 1 defect issue ,which developer create new branch, , fixed in branch name "fix_#1_backyard_data_displayed". then, merge branch "beta" test it. after while, tester merged branchs "fix_2" , "fix_3" "fix_20" "beta" , test it. after that, found first merged "fix_#1_backyard_data_displayed" branch buggy , make our application unstable. now, how can remove merged branch push origin without disturbing "fix_2" , "fix_3" "fix_20"? short answer in beta branch: find sha1 of commit corresponds merge. run git revert <sha1> -m 1 there caveat: git still think feature branch merged beta branch, , merge branch again you'll need revert (again) commit introduced git revert before merging. longer version the command in git undo commit revert . merge commits, need specify "mainline" branch -m switch. in case, should 1: usually cannot

ios - Add http:// to NSURL if it's not there -

i using web view in app, getting url text field. works if string starts "http://". trying modify code can handle situations users don't enter "http://" or "https://" how check if url doesn't have "http://" in ? how modify url add "http://" in ? nsstring *urlstring = textfield.text; nsurl *url = [nsurl urlwithstring:urlstring]; nsurlrequest *request = [nsurlrequest requestwithurl:url]; [self.webview loadrequest:request]; nsstring *urlstring = @"google.com"; nsurl *webpageurl; if ([urlstring hasprefix:@"http://"] || [urlstring hasprefix:@"https://"]) { webpageurl = [nsurl urlwithstring:urlstring]; } else { webpageurl = [nsurl urlwithstring:[nsstring stringwithformat:@"http://%@", urlstring]]; } nsurlrequest *urlrequest = [nsurlrequest requestwithurl:webpageurl]; [self.mywebview loadrequest:urlrequest];

Don't get information in new page ( ionic + angularjs ) -

i'm trying send parameters page instruction ( ui- sref = " forgotpassword ( {id : item.id } ) " ) in new page don´t parameters sent and why thes tabs not displaying in tne new page ? any please code: .state("app",{ templateurl: "templates/app.html", url: "/app", abstract: true }) .state('forgotpassword', { url: "/forgot-password/:id", templateurl: "templates/forgot-password.html", controller: "forgotpasswordctrl" }) .controller('forgotpasswordctrl', function($scope, $stateparams, rawdata) { $scope.rawdata = rawdata.get($stateparams.id); }) .factory('rawdata', function() { // might use resource here returns json array // fake testing data var rawdata = [{ "id": "1", "tipo": "evento", "titulo": "esta es una noticia de dos líneas principal",

Parse childs in XML python -

i have xml code like: <?xml version='1.0' encoding="utf-8"?> <coureurs> <coureur> <nom>patrick</nom><hair>inexistants</hair> </coureur> </coureurs> and want print that: patrick inexistents etc... code : lxml import etree tree = etree.parse(file.xml) coureur in tree.xpath("/coureurs/coureur/nom"): print(user.text) but returns blank, when do: user in tree.xpath("/coureurs/coureur/hair"): returns hair. should do? i still not able reproduce issue xml , code provided. seems have left out lot of xml , , xpath may not working if coureurs not direct root of xml (or direct child) . in such cases, can use following xpath each coureur node in xml (that child of coureurs node) - //coureurs/coureur this give <coureur> tag elements xml , , ca iterate on print it's child'

Meteor - writing image content to the browser from server -

i have server method makes api call contents of image file. getimageapi: function (param1, param2, imagetype) { var url = http:/somehost/image?param1=' + param1 + '&param2=' + param2 + '&imagetype=' + imagetype; var response = meteor.http.call('get', url, { headers: {"content-type": "image/jpeg"}, responsetype: "buffer" }); if (response.statuscode == 200) { return new uint8array(pdfresponse.content); } else { throw new meteor.error(pdfresponse.statuscode); return ""; } return ""; } the parameter imagetype can have values such jped, tiff, raw, png etc.. the server side route calling method , writing content window. router.route('/image', function () { var param = queryparam; var param1 = para

curl - Issue while using Date range filter in elasticsearch -

i new logstash , elasticsearch. have logline have parsed in logstash. see below example: log line: 20150727 020225108-0700 site1dir01 imqueueserv 4161 0 139965885622016 note;mtaqueuedirremoved(79/54) /xyz/user1/queue/deferred/mta:rme=qs_p_getqueuedmessages:port=10003 grok pattern have written it: grok{ match => ["message", "%{year}%{monthnum}%{monthday} %{username:integerdata} %{host} %{word:servername} %{int:processid}...%{int:data} %{word:loglevel};%{word:tracename}\(.*\) %{greedydata:logdata}", "message", "%{greedydata:mtalogdata}"] } now in kibana, getting data timestamp this: @timestamp ==> 2015-07-27t02:02:25.812-07:00 now when fire below curl command in elasticsearch data specific dates, records should not happen. my curl command below: curl -xget 'http://localhost:9200/_all/_count?pretty=true' -d '{ "query" : { "bool" : {

plot - R - Line Chart axis overlap -

Image
i trying draw plot (i have no idea how 1 called) , have trouble axis labels overlapping. i wondering if have advices add spaces between labels. thanks. because 3rd value higher others gave value of 30 , labelled real value 115. dta$freqori = dta$freq dta$freq[3] <- 30 the plot loops par(mar = c(0, 10.1, 0, 10.1)) for(i in 1:nrow(dta)){ plot(0, ylim = c( min(dta$freq) - 5, max(dta$freq) + 2), bty = 'n', type = 'n', axes = f, ylab = '', xlab = '') abline(h = dta$freq[i]) axis(2, @ = dta$freq[i], labels = dta$freqori[i], las=2, tick = f, line = 7, cex.axis=0.6) axis(2, @ = dta$freq[i], labels = dta$namefrom[i], las=2, line = 0.5, tick = f, cex.axis=0.6) axis(4, @ = dta$freq[i], labels = dta$nameto[i], las=2, line = 0.5, tick = f, cex.axis=0.6) par(new = t) } the data dta = structure(list(freq = structure(c(8.5, 9, 30, 3.2, 13.4, 1.3, 0.3, 4.1, 5.3, 6.7, 18.3, 5, 17.7, 2.1, 0.2, 4.5, 5.6, 8.5, 18.3 ), .dim = 19l, .

ios - Camera Rotation in SceneKit -

Image
i have posted similar question here , different in deals eular angles. given setup had in other post. simple board on screen, , camera looking @ it, want rotate camera. simplicity doing entire camera in code. context, per other question , answer have established board runs long on z axis, shorter on x axis, , height y axis. adding code scene can see board running on z axis. have raised camera on y axis little better view. end goal board running longways accross camera. scnnode *cameranode = [scnnode node]; cameranode.camera = [scncamera camera]; cameranode.camera.zfar = 200; cameranode.camera.znear = 0.1; [scene.rootnode addchildnode:cameranode]; cameranode.position = scnvector3make(0, 5, 0); cameranode.eulerangles = scnvector3make(0, 0, 0); gives great start. try rotate camera looking top, down on board. understanding need rotate around x-axis accomplish this. did trying following. scnnode *cameranode = [scnnode node]; cameranode.camera = [scncamera camera]; camerano

Blank screen/JS error on new odoo installation after creating database -

i've installed odoo (version 8.0) on ubuntu 14.04 server. pretty out of box (i set admin password), can create databases, when try else, mostly-blank screen , javascript error ( openerp.init not constructor in firefox, undefined not function in chrome/safari). "settings" menu option show up, not (obviously, given fact javascript doesn't work). the database does created (i can see in postgres database). login screen shows (but logging in gives me same error again), , 'manage databases' link on still work. can create additional databases, drop them, of works. can't do databases. i've looked around in odoo documentation, can't find anything. looking online error itself, people who've caused installing add-ons (i didn't), or can fix dropping databases (it doesn't work), or using different browser (none of safari, firefox, , chrome work). it hangs trying load 1 of javascript files (with names web/js/web.assets_backend/fa4f621 )

zebra puzzle - A "Building" Riddle in Prolog -

i'm trying solve riddle in prolog. riddle is: there 2 buildings, each 1 has tree apartments (apartment per floor): 1 apartment of 3 rooms,one of 4 rooms , 1 of 5 rooms. dana,joni , noah lives in building 1. ron,gale , aron lives in building 2. joni apartment higher dana , noah. means lives on third floor of building 1. noah , gale lives on same floor (in different buildings). ron has 1 more room aron. ron lives 1 floor above gale. highest apartment in building 2 5 rooms apartment. i need find in floor lives. i wrote code: solve([dana,building1,f1,r1],[noah,building1,f2,r2],[joni,building1,f3,r3],[gale,building2,f4,r4],[ron,building2,f5,r5],[aron,building2,f6,r6] ) :- l =[[dana,building1,1,3],[dana,building1,1,4],[dana,building1,1,5],[dana,building1,2,3],[dana,building1,2,4],[dana,building1,2,5],[dana,building1,3,3],[dana,building1,3,4],[dana,building1,3,5] ,[noah,building1,1,3],[noah,building1,1,4],[noah,building1,1,5],[noah,building1,2,3],[noah,building1,2,4

mongodb - Mongo group inside $addToSet -

i have following set of objects: [ { id: 1, clientid: 1, cost: 200 }, { id: 1, clientid: 2, cost: 500 }, { id: 1, clientid: 2, cost: 800 }, { id: 2, clientid: 1, cost: 600 }, { id: 2, clientid: 2, cost: 100 } ] and made group of with: db.collection.aggregate( { '$group': { '_id': '$id', 'clients': { '$addtoset': { 'id': '$clientid', 'cost': '$cost' } } } } ) so obteined following: [ { '_id': 1, 'clients': [ { id: 1, cost: 200 }, { id: 2, cost: 500 }, { id: 2, cost: 800 } ],

android - set Two text box in list view one with fix size and other with dynamic size -

hi creating listview 2 textview in android. 1 contain fix size , other occupied remaining space of screen. first fix size display on right side of screen , other textview display data on left of screen. how can this? isn't ok? <textview android:layout_height="wrap_content" android:layout_width="480dp" /> <textview android:layout_height="wrap_content" android:layout_width="wrap_content" />

UIImage not appearing in prototype cells in UITableView (Swift) -

Image
i have created uitableview containing 10 cells, each of have uiimageview attached them using auto-layout the table populated in backtableviewcontroller code: tablearray = ["home page", "membership card", "recent news", "fitness schedule", "training log", "pool lap calculator", "martial arts schedule", "pool schedule", "comments", "acknowledgements"] the issue none of these images appear in table until cell selected while run. out of ideas why is... anyone? thanks edit: backtableviewcontroller import uikit class backtableviewcontroller: uitableviewcontroller { var tablearray = [string]() var imagearray = [string]() override func viewdidload() { super.viewdidload() tablearray = ["home page", "membership card", "recent news", "fitness schedule", "training log", "pool lap calculator", "martial ar

c# - copy a table to another table with this conditions -

copy table table conditions if record in old table new copy new table if record in old table has changed , record existing in new table update record info in new table making big assumptions trying do, but.... if guessed right, should close : insert new_table select * old_table not exists ( select * new_table ) update new_table nt old_table ot nt.pk = ot.pk , ( nt.attrib_fld_1 <> ot.atrib_fld_1 or nt.attrib_fld_1 <> ot.atrib_fld_1 or nt.attrib_fld_1 <> ot.atrib_fld_1 or nt.attrib_fld_1 <> ot.atrib_fld_1 -- etc..for many non key fields need evaluated )

html - Open popup in a new window by clicking a button in Javascript Alert -

i'm using code: <script type="text/javascript"> window.alert("click ok if on 18"); window.open( '.html', '_blank' // <- makes open in new window. ); </script> i need add code open popup in new window: <script type='text/javascript' src='address popup'></script> if add in way: <script type="text/javascript"> window.alert("click ok if on 18"); window.open( 'address popup', '_blank' // <- makes open in new window. ); </script> it doesn't open expected. see text. maybe it's because did not use src: . can do? the first parameter of window.open() needs url of page want open in popup. rather using alert, sounds should use confirm . alert doesn't allow user aren't 18; if close alert instead of hitting "ok", it'll still continue open pop-up. confirm() gives them "ok" button , "ca

Creating an array in JavaScript from JSON file -

my json file: [{"val0":"paul","val1":"jake","val2":null,"val3":"max"}, {"val0":"sam","val1":"tina","val2":"emily","val3":"hardwell"}, {"val0":"tom","val1":"julie","val2":null,"val3":"adi"}] i want create array in javascript follows: var dataset=[ ['paul','jake','null','max'], ['sam','tina','emily','harwell'], ['tom','julie','null','adi'] ]; i tried following code isn’t working. can please help? $.getjson("filename.json", function(data) { var items = []; $.each(data, function(key, val) { items.push(val); }); // … }); i’m using array display purpose (using datatables), so, want create array in format.i'm using dataset array disp

ios - How does crashlytics manage to upload crash-log even the crash happens in applicationDidFinishLaunching? -

as $title, wondering how this. in webpage 'is there quick way force crash?' http://support.crashlytics.com/knowledgebase/articles/92522-is-there-a-quick-way-to-force-a-crash- and followed this, got crash-log in applicationdidfinishlaunching:. they upload it, once application restarted. they gather information before crash, , send crash log after restart. that how understood it. see answer @marcr here: offline crash reporting in crashlytics

javascript - jquery validate input array and passing dynamic values -

i'm trying validate group of input arrays using jquery validator plugin. i'm having problems understanding how pass element validation. my code far: $('#edit-fixtures').validate({ rules: { "player_a[]": { required: true, uniquematch: function () { return $(this).next('.player').val(); }, }, "player_b[]": { required: true, uniquematch: function () { $(this).closest('.player').val(); }, }, } }); my input elements series of paired select boxes named player_a[] player_b[] there 40 pairs. each pair should unique , that's i'll validating. i'm trying pass value of nearest player_b changed player_a , vice versa. i have change method validate on each change

Why can't I lookup an array index inside a foreach loop in Powershell? -

first question on here forgive me if make mistakes, try stick guidelines. i trying write powershell script populates 2 arrays data read in via csv file. i'm using arrays cross-reference directory names in order rename each directory. 1 array contains current name of directory , other array contains new name. this seems working far. create , populate arrays, , using short input , index lookup check work can search 1 array current name , retrieve correct new name second array. when try implement code in foreach loop runs through every directory name, can't lookup array index (it keeps coming -1). i used code in first answer found here template. read csv file powershell , capture corresponding data . here's modification input lookup, works fine: $input = read-host -prompt "merchant" if($merchant -contains $input) { write-host "it's there!" $find = [array]::indexof($merchant, $input) write-host index $find } here foreach

git - GitHub: How to do case sensitive search for the code in repository? -

i want case sensitive search particular piece of code in github repository. possible? i checked https://help.github.com/articles/searching-code/ , didn't find such syntax rule. use grep or git grep in local clone. github search has lot of limitations. think worst of these shows first 2 matches file, avoid whenever possible.

html - How do I center 2 images in a circular div while also overlapping them? -

Image
i've been messing bootstrap template...pretty standard row 3 items. each of row items i've turned divs circular background. now, i'm trying take 2 images (so can animate them) , center them in div. i've found few ways hack around it...but i'm wondering best way is? i want able control layering & make sure they're vertically centered @ times. absolute positioning 1 of them borks centering of other right now... html <div class="col-lg-4"> <div class="feature-icon"> <div id="phone"> <img class="behind" src="img/svg/phone.svg" width="40"> <img src="img/svg/pocket.svg" width="70"> </div> </div> css img.behind { z-index: 0; position: relative; left: 20px; top: 40px; } here's looks right now. i dont understand que

javascript - Select2; how to load in an array that I load once from the database -

i loading array results of following action: public actionresult getjudges(string q) { var judges = new list<judge>(); using (var con = new sqlconnection(configurationmanager.connectionstrings["db"].connectionstring)) { using (var cmd = con.createcommand()) { cmd.commandtype = commandtype.text; cmd.commandtext = "query"; con.open(); using (var rdr = cmd.executereader()) { while (rdr.read()) { var judge = default(judge); var id = convert.toint32(rdr["id"]); var email = convert.tostring(rdr["email"]); var name = convert.tostring(rdr["name"]); var jurisdiction = convert.tostring(rdr["jurisdiction"]); var cod

javascript - What is best way to refactor these series of if statements? -

so have bunch of questions radio buttons, each question having 3 options choose from. have bunch of if statements ( lot of them) determine final answer based on answers each question. for example: question 1 : a) b) c) question 2 : d) e) f) question 3 : g) h) i) and on. if statements follows : if ( question 1 == || question 2 == f && question 3 == ) if want conditions form of if statements, it'd take space , not best practice. what best way refactor these if statements? if every single combination of choices leads unique outcome, you're looking @ n-dimensional matrix. in simpler words, think of every option step in path in array: $outcomes = array( 'a' => array( 'd' => array( 'g' => 'outcome 1', 'h' => 'outcome 2', 'i' => &

cakephp - Multi contains and filter -

i need make difficult request lot of contains don't understand how filter results on contains. my tables that: menus hasmany sousmenus sousmenus hasmany droits droits belongstomany roles roles belongstomany services i know services_id , want menus contain sousmenus contain droits contain role where: roles linked service_id droits linked these roles sousmenus linked these droits and menus linked sous_menus. it's difficult explain. edit: tried doesn't work: $menus = tableregistry::get('menus'); $query = $menus->find()->contain(['sousmenus.droits.roles.services'])->matching('sousmenus.droits.roles.services', function ($q) { return $q->where(['services.id' => 6]); });

javascript - How to prevent only closing of bootstrap modal on backspace keypress -

i have form in bootstrap modal. have disabled backspace button when bootstrap modal open code $('body').keydown(function (e) { if ($('#mymodal').is(':visible')) { if (e.keycode == 8) { return false; } } }); in bootstrap modal form have textbox, textarea need backspace button there. not able use backspace button in textbox in bootstrap modal form solution: $('body').keydown(function (e) { if ($('#mymodal').is(':visible')) { var rx = /input|select|textarea/i; if (e.keycode == 8) { if(!rx.test(e.target.tagname) || e.target.disabled || e.target.readonly ){ e.preventdefault(); } } } });

c# - WCF doesn't add service -

i have restful wcf service trying run there aren't issues or errors except for, when running says service added service not show @ all. know question little bit vague sorry, ideas? restserviceimpl.svc.cs : public class restserviceimpl : irestserviceimpl { public string xmldata(string id) { return ("you requested product" + id); } public string jsondata(string id) { return ("you requested product" + id); } public company getcompany(string compid) { company comp = new company(); { sqlconnection con = new sqlconnection(); con.connectionstring = ""; con.open(); sqlcommand cmd = new sqlcommand("select companyname tblcompany", con); con.open(); sqldatareader reader = cmd.executereader(); } } } irestservice.cs interface: [servicecontract] public interface irestserviceimpl {

ios - When I pull the UITableView down, how can I prevent it from bouncing all the way back, instead keeping it still offset above? (Pull to refresh) -

i want implement custom pull refresh, , going well, when pull down , release, want table view (that @ point offset show more @ top) not bounce down way, default behaviour. instead want bounce down slightly, not way, allow loading indicator stay visible until content loads. i can't figure out how without causing stutter, or without having remove animations together. i've tried setting contentoffset, contentinset, setcontentoffset:animated: , playing around turning bounces on , off, can't make headway. how go doing this?

CSS background: transparent url() not displaying img -

Image
i'd replace woocommerce "add cart" button png image. i'm using following css in child theme this: .woocommerce .single_add_to_cart_button, .woocommerce ul.products li.product .button { background: transparent url('http://www.tempertemper.com.au/test/wp-content/themes/temper/images/buy.png') no-repeat !important; opacity: 0 !important; width: 109px; height: 46px; } i set opacity 0 rid of text "add cart". however, produces element transparent background, , no background image: the button directly right of product quantity field: example page . why isn't background image showing? thanks. in styles.css (line 151) setting opacity 0: .woocommerce .single_add_to_cart_button, .woocommerce ul.products li.product .button { background: transparent url('http://www.tempertemper.com.au/test/wp-content/themes/temper/images/buy.png') no-repeat !important; opacity: 0 !important; width: 109px; height: 46px; }

xcode - Swift fatal error: Array index out of range -

i'm creating game small project , i'm trying make after ever 5 points walls generate more when playing game, crashes @ reaching around 24 points the error "fatal error: array index out of range" gamescene.swift if pointslabel.number % knumberofpointsperlevel == 0 { currentlevel++ wallgenerator.stopgenerating() wallgenerator.startgeneratingwallsevery(klevelgenerationtimes[currentlevel]) } constants.swift let knumberofpointsperlevel = 5 let klevelgenerationtimes: [nstimeinterval] = [1.0, 0.8, 0.6, 0.4, 0.3] it looks error here: wallgenerator.startgeneratingwallsevery(klevelgenerationtimes[currentlevel]) when currentlevel equal or greater number of elements in klevelgenerationtimes . i don't know correct solution is, depending on game logic - propose 2 versions, first restarting first element of array once end reached: wallgenerator.startgeneratingwallsevery(kle

objective c - iOS UITableView deleted section lingers in UI -

Image
i have uitableview multiple sections created data model can updated/edited outside view. the updates table view done in viewwillappear. data model recreated , [tableview reloaddata] invoked. so far have not had problems following section can't seem understand going on. lingers on when has been deleted data model , table view correct render after deleting section

node.js - large number of databases in postgres - architectural best practices -

we using postgres in multi tenant nodejs set up. each client has separate database (and separate node process). connection pooling implemented each tenant using node-postgres module. because of increasing number of databases, hitting max_connections limit of postgres. increasing max_connections indefinitely not option (due connection overheads). should there change in architecture large number of databases? pointers appreciated. the approach describe cannot scale: number of databases limiting factor. you need redesign system. , correct approach depend entirely on project's requirements. pointers designing system in general - that's broad subject. can start practical approach computer systems design , architecture , , thence research further, following project's requirements.

c# - How do I configure ASP.NET to use MongoDB for storing user names -

i trying set asp.net project uses mongodb. asp.net project comes automatically generated user login system. system configured use sql database. black box however; inspecting methods yields metadata. as far can tell, way manipulate database used configuration file (is incorrect?). configure accounts controller store user id , password in mongodb, testdatabase. here current configuration: <configsections> <section name="entityframework" type="system.data.entity.internal.configfile.entityframeworksection, entityframework, version=6.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" requirepermission="false" /> </configsections> ... <entityframework> <defaultconnectionfactory type="system.data.entity.infrastructure.localdbconnectionfactory, entityframework"> <parameters> <parameter value="mssqllocaldb" /> </parameters> </defaultconnection

python - Django using aggregate MAX -

i have following... r = region.objects.get_location_name(user.location) which returns: [<region: great britain>, <region: europe>] next want return object max highest parent . i have tried this: r = region.objects.get_location_name(user.location).aggregate(max('level')) but not return object returns... {'level__max': 1} why? you're looking order_by : sort queryset descending 'level' , first item doing queryset[0] . i think code should like r = region.objects.get_location_name(user.location).order_by('-level')[0]

override - Overriding FormType In symfony -

i have problem how overriding formtype in app in symfony2 my class class contacttype extends abstracttype { public function buildform(formbuilderinterface $builder, array $options) { $builder ->add('firstname', 'text', array('label' => 'mremi_contact.form.first_name')) ->add('lastname', 'text', array('label' => 'mremi_contact.form.last_name')) ->add('email', 'email', array('label' => 'mremi_contact.form.email')); if ($subjects = $this->subjectprovider->getsubjects()) { $builder ->add('subject', 'choice', array( 'choices' => $subjects, 'label' => 'mremi_contact.form.subject', )); } else { $builder->add('subject', 'text&

shader - Maxscript Material/Slate editor? -

hey guys there way access "material editor: manual update toggle" both slate editor , compact in maxscript?? looking through docs cant seem find much. appreciated, thanks!! doesn't updating materials happen automatically? or maybe mean "update preview"? i know when loop materials, can via code update loop , of functions deciding when trigger function. you can acces materials + of functions like: (libile can external file of internal editor) local templib = loadtempmateriallibrary libfile m in templib ( global materialname = #(m) ) local materialcount = templib.count iterations = 1 materialcount ( -- whatever )

php - Symfony2: Create two controllers one to display a form and other to handle the submission -

hi new symfony2 mvc framework. have achieved far rendering form in twig template using twig template. want next create second (separate) controller deal form submission. can share me how achieve this. i have read symfony2 documentation however, not working. many thanks:) you need set action on form generating so: public function generatesearchbaraction() { $form = $this->createformbuilder() //this defining target route ->setaction($this->generateurl('route_to_catch_the_request')) ->setmethod('post') ->add('keyword') ->getform() ; return $this->render('search_bar.html.twig', array( 'form' => $form->createview() )); } the controller provided @ route_to_catch_the_request can catch request. public function showsearchkeywordsaction(request $request) { $form->handlerequest($request); if ($form->isvalid()) { //do wha

Visual Studio Project Load Error: Invalid Cookie : Parameter name: Cookie -

Image
i experiencing problem. has encountered before or know how resolve this. uninstalled iis express , reinstalled 1 project gives me error. others load fine. the following worked me , didn't require uninstall/reinstall of iis express: open "applicationhost.config" file located in "%userprofile%\documents\iisexpress\config". delete "site" nodes located in "sites" node (or perhaps site associated failing project). upon opening project , starting web application, site node recreated minus customizations may have made it.

Django fixtures auto populate time based fields -

i trying use fixtures auto populate fields category field. how have defined it: class timestampedmodel(models.model): """ timestampedmodel abstract base class model provides self-managed "created" , "modified" fields. """ created_on = models.datetimefield(auto_now_add=true) updated_on = models.datetimefield(auto_now=true) class category(timestampedmodel): name = models.charfield(max_length=255) is_regional = models.booleanfield(default=false) subtitle = models.charfield(max_length=255, null=true, default=none) is_selected = models.booleanfield(default=false) i run following error: problem installing fixture '/users/varunj/projects/backend/newsybackend/api/fixtures/admin_categories.yaml': not load api.category(pk=1): (1048, "column 'created_on' cannot null") shouldn't fixture take care of subclass fields themselve, given auto_now anyway?

django - Can't override post method UpdateView -

i try override post method of generic.updateview add few forms other model. without overriding post working fine. class desktopview(loginrequiredmixin, updateview): model = weddyuser context_object_name = 'weddyuser' slug_field = 'username' form_class = weddyuserform def get_context_data(self, **kwargs): context = super(desktopview, self).get_context_data(**kwargs) if self.request.user.is_vendor: if 'form' not in context: context['form'] = self.form_class(self.request.get, instance=self.request.user) context['vendor'] = vendor.objects.get(id=self.request.user.id) else: context['plainuser'] = plainuser.objects.get(id=self.request.user.id) return context def get(self, request, *args, **kwargs): self.object = self.get_object() c = {} c.update(csrf(request)) user = request.user if self.kwa