Posts

Showing posts from June, 2014

sql server - Extracting a subset of DataTable columns in C# and then sending them to browser client as a JSON string -

Image
here's scenario: c# middle tier webservice has data sent sql server in system.data.datatable object. there dozens of columns in datatable's columns collection. browser client needs see 6 of them. stored proc on server general purpose, not designed specific task. assume have use it, rather writing new sp. is there simple way, perhaps using generics, extract desired subset of columns datatable list or collection, , convert resulting list or collection json using json.net? is possible create skeletal c# class definition foo relevant field names (and datatypes) , match on field names "automagically" , thereby generate list<foo> datatable's rows collection? ideally, during json conversion, sql server datetime values (e.g. 2014-06-24t18:45:00 ) converted value make easy instantiate javascript date in client without having string manipulation of date representation. full working console app code pasted below. 2 main methods need follows. f

How do you plot a CostSensitiveClassifier tree in R? -

Image
in case i'm using rweka package , j48 within cost sensitive classifier function. know package "party" can plot normal j48 tree, not sure how plot csc output. library(rweka) csc <- costsensitiveclassifier(species ~ ., data = iris, control = weka_control(`cost-matrix` = matrix(c(0,10, 0, 0, 0, 0, 0, 10, 0), ncol = 3), w = "weka.classifiers.trees.j48", m = true)) csc costsensitiveclassifier using minimized expected misclasification cost weka.classifiers.trees.j48 -c 0.25 -m 2 classifier model j48 pruned tree ------------------ petal.width <= 0.6: setosa (50.0) petal.width > 0.6 | petal.width <= 1.7 | | petal.length <= 4.9: versicolor (48.0/1.0) | | petal.length > 4.9 | | | petal.width <= 1.5: virginica (3.0) | | | petal.width > 1.5: versicolor (3.0/1.0) | petal.width > 1.7: virginica (46.0/1.0) number of leaves : 5 size of tree : 9 cost matrix 0 0 0 10 0 10 0 0 0 plot(csc) er

php - Check entire array for sub array with two values? -

i have mixed array made of events. example: array ( [0] => array ( [start] => 20:00 [end] => 21:00 [title] => test event date [date] => 22 jun 2014 ) [1] => array ( [start] => 20:00 [end] => 22:00 [title] => test event without date [day] => sunday ) ) most events daily (e.g. sunday). however, occasional , have full date. if event full date falls on same day , time daily event (as in example above), daily event not show when step through array in foreach. is there way check if both date , time exist in item somewhere else in array before outputting? this have far: // loop through each day of week foreach ($thisweek $day => $v) { echo '<h3>' . $day . ' ' . $v . '</h3>'; echo '<ul>'; // loop through bunch of hours forea

mysql - Whats wrong with this SQL query? Syntax error -

this question has answer here: using reserved words in column names 2 answers and error im getting you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'key = (tick)testkey(tick)' select * keys key = 'testkey'; i tried site isn't help. http://www.piliapp.com/mysql-syntax-check/ ticks , apostrophe. this sql passes syntax check @ link provided: select * `keys` `key` = 'testkey';

spring - Update or SaveorUpdate in CRUDRespository, Is there any options available -

i trying crud operations entity bean. crudrepository provide standard methods find , delete , save there no generic method available saveorupdate(entity entity) in turn calls hibernate or hibernatetemplate sessions saveorupdate() methods. the way crudrepository provides functionality use this @modifying @query("update space c set c.owner = :name c.id = :id") integer setnameforid(@param("name") string name, @param("id") but not generic , needs written complete form fields. please let me know if there way or can session of hibernate or object of spring hibernatetemplate solve issue. the implementation of method <s extends t> s save(s entity) from interface crudrepository<t, id extends serializable> extends repository<t, id> automatically want. if entity new call persist on entity manager , otherwise call merge the code looks this: public <s extends t> s save(s entity) { if (entityinfor

Automatically remove the file generated by Java 7 Annotation Processor when delete the annotation in source file -

i writing java annotation processor java 7 source code. , surely, can use javax.annotation.processing.filer me generate file under project directory automatically. ex: annotation @becare public interface test { @becare int compare(int a, int b); } my annotation processor's job when detects given annotation @becare, generate file me. my question if remove annotation previous code snippet, can let annotation processor aware , delete file created? or there workaround me achieve ? thanks in advance. when create genrated file declare it's linked 'test' interface this: elements eltutils = processingenv.getelementutils(); filer.createsourcefile("testgenerated", eltutils.gettypeelement("test")); when source deleted, processor remove generated file javadoc says: if there no originating elements, none need passed. information may used in incremental environment determine need rerun processors or remove generated files. n

java - How to print docx and pdf? -

i can print using txt file printer, however, when change docx or pdf many undefined characters cannot understood @ all. guys have ideas on how solve this. the code used. import system import javax.print import java.io java.lang import thread filestream = java.io.bufferedinputstream(java.io.fileinputstream("c:/geeks.txt")) psinformat = javax.print.docflavor.input_stream.autosense mydoc = javax.print.simpledoc(filestream,psinformat,none) aset = javax.print.attribute.hashprintrequestattributeset() aset.add(javax.print.attribute.standard.copies(2)) services = javax.print.printservicelookup.lookupdefaultprintservice() job = services.createprintjob() job.print(mydoc, none) thread.sleep(20000) filestream.close() .docx files have far more formatting , nonsense going on text file. open 1 using notepad , you'll see i'm talking about. because of this, you'll need use dedicated library read docx file, such https://pypi.python.org/pypi/docx/0.2.4

Adding additional linked membership provider in asp.net -

i work on asp.net (hybrid webforms + mvc4) application provides videos of expert speakers employees @ various organizations. use asp.net membership authenticate users based on company work (each company has login), set roles determine videos have access to, , build reports etc. however, company wants begin adding login individual users well. rewriting our entire membership system mean rebuilding large portion of site -- instead thinking of adding membership provider individuals map membership provider have organizations. envisioning following 1)the user logs on username , password using individual membership framework 2)the application maps user corresponding member in original (company) membership framework, , automatically authenticates user membership (invisible user) assigns correct roles etc based on organizatiom user belongs to. second membership layer on top of original. i considering building extended tables individual users in sql server map current compan

c - Functioning of Arrays -

here array program. practice.c #include <stdio.h> void main() { int i,num[10]={10,20,30,40,50}; for(i=0;i<15;i++) { printf("\nnum[%d] =%d",i,num[i]); } } following output of program. num[0] =10 num[1] =20 num[2] =30 num[3] =40 num[4] =50 num[5] =0 num[6] =0 num[7] =0 num[8] =0 num[9] =0 num[10] =10 num[11] =0 num[12] =2686711 num[13] =2686820 num[14] =4199443 now have 2 questions: 1- why num[5] num[9] displayed there values 0 ? 2- why num[10] num[14] displaying these values, when have declared length int num [10] , not int num [15] , shouldn't program displaying error while running or compiling? here program doing: int num[10] = {10,20,30,40,50} the above line tells compiler create array of ten integers , initialize first 5 values (indices 0-4) ones provided. remainder of values (indices 5-9) automatically initialized 0 per c99 specification. num[9] # value allocated , initialized. num[10] # value neith

How to improve the performance for operations on a big static array in PHP? -

i have big , complicated static multidimensional array in php: static $data = array ( 'entry1' => array( 'field1' => array( ), 'field2' => array( ) .... ) ... ); the length of var_export($data, true) 2mb. if want access $array['entry1']['field1'] , first time takes ~5 second. guess entire array needs loaded in memory. there advice how improve performance? should split array smaller arrays?

css - HTML - can focus elements under transparent div using tab key -

i'm using transparent div higher z-index disable content on page (for modal dialog, etc.). works fine, except discovered may tab elements behind transparent div using tab key, , push buttons have focus using enter key, isn't want when disabling content. curious if there's way prevent that...

Storing arima predictions into empty vector in R -

i having trouble storing arima predictions empty vector. problem arima predictions give predictions , standard errors. there 2 columns of values. cannot seem store values in empty vector. tried create 2 empty vectors , bind them together, did not solve problem. my intention simulate 1000 observations. use first 900 observations make 100 predictions. list of values have update. example, use 900 observations predict value of 901th observation. use 901 observations, including predicted 901th observation, predict 902th observation. repeat until use 999 observations predict 1000th observation. hope figure out how store multiple values vector. the empty vector hope contain 100 predictions called predictions1. # create arima series # arimaseries1 = arima.sim(n=1000, list(ar=c(0.99), ma=c(0.1)))+50 ts.plot(arimaseries1) acf(arimaseries1) arimaseries2 = arima.sim(n=1000, list(ar=c(0.7,0.2), ma=c(0.1,0.1)))+50 ts.plot(arimaseries2) acf(arimaseries2) arimaseries3 = arima.sim(n=1000,

sql - INSERT ONLY SPECIFIC COLUMN FROM A STORED PROCEDURE RESULT -

i want know if possible insert table specific column of result stored procedure? something like: declare @temp table( id int ) insert @temp exec getlistofstudents --returns multiple columns this example only, help.. you can take 2 step approach. first insert #temptable, populate @tempvariable insert into, selecting single column. declare @temp table ( id int ); create table #temptable1 ( column1 int, column2 int ); insert #temptable1 exec getlistofstudents insert @temp select column1 #temptable1

web services - Query on using REST architecture in Android applications -

i developing android application , planning use rest architecture communicate web server. rest architecture recommends "rather letting clients construct urls additional actions, include actual urls rest responses " . 1> idea if include home page url in client (android app) , furthur links included in http response server ? find pros , cons in approach ? 2> please provide inputs on using caching provided rest in android app rather implementing our own way updated server ? thanks in advance.

python - match a pattern and select specific lines in a file -

i have text file displayed below. select 2 lines (line 1 , line 2) under class 10 block only. thu may 29 14:16:00 pdt 2014 class 09 line 0 line 1 line 2 -- class 10 line 0 line 1 line 2 -- class 11 line 0 line 1 line 2 -- thu may 29 14:20:00 pdt 2014 class 09 line 0 line 1 line 2 -- class 10 line 0 line 1 line 2 -- class 11 line 0 line 1 line 2 -- i have tried following, linecache grabs line 1 only. find way grab line1 first line2. idea? thanks numoflines = sum(1 line in open('text.txt')) print(num_lines) in range(start,numoflines,step): linea = linecache.getline('text.txt', i) print linea numoflines = sum(1 line in open('text.txt')) this line counts lines in file , that's it. not want. not sure why you'd want linecache . , don't show how compute start or step , bug is. what want this: def reading_function(): searching = true linestoread = 2 open('text.txt') f: line in f:

Inconsistent results with SQL Server Execution plan when using variables -

Image
i have table 5 million records follows id baseprefix destprefix exchangesetid classid 11643987 0257016 57016 1 3 11643988 0257016 57278 1 3 11643989 0257016 57279 1 3 11643990 0257016 57751 1 3 sql tuning adviser recomended following index create nonclustered index [exchangeidx] on [dbo].[exchanges] ( [exchangesetid] asc, [baseprefix] asc, [destprefix] asc )with (pad_index = off, statistics_norecompute = off, sort_in_tempdb = off, drop_existing = off, online = off, allow_row_locks = on, allow_page_locks = on) however given following declare @exchangesetid int = 1; declare @baseprefix nvarchar( 10 ) = '0732056456'; declare @destprefix nvarchar( 10 ) = '30336456'; declare @baseleft nvarchar( 10 ) = left(@baseprefix,4); these 2 queries give me vastly different execution plans query 1 select top 1 classid

c++ - default value of const reference parameter -

currently have 2 functions: void foo(const & a) { ... result = ... result += handle(a); // 1 bar(result); } void foo() { ... result = ... bar(result); } all code in foo() same except 1 . can merge them 1 function following? void foo(const & = 0) { ... ... if (a) result += handle(a); // won't work, can similar? bar(result); } btw, parameter has reference keep interface unchanged. you can use null object pattern . namespace { const null_a; // (possibly "extern") } void foo(const & = null_a) { ... result = ... if (&a != &null_a) result += handle(a); bar(result); }

c# - How to prevent postback when button is clicked -

i have code save file in database. have function in code behind: protected void attachfile(object sender, eventargs e) { if (txtfile.hasfile) { string filename = path.getfilename(txtfile.postedfile.filename); string contenttype = txtfile.postedfile.contenttype; using (stream fs = txtfile.postedfile.inputstream) { using (binaryreader br = new binaryreader(fs)) { random ran = new random(); byte[] bytes = br.readbytes((int32)fs.length); newrequestservice newrequest = new newrequestservice(); string temp_id = ""; temp_id = ran.next(100000, 999999).tostring(); saveattachfile(filename, contenttype, bytes, temp_id); hdnattachid.value = temp_id; lblattach.innerhtml = msg; } } }

transactions - Differences between LLR and emulate 2-PC in weblogic server -

first, protocols ? or transaction types ? second, what's main differences between them ? oracle talks last logging resource: with option, transaction branch in connection used processed >last resource in transaction , processed one-phase commit operation. >result of operation written in log file on resource itself, , result >determines success or failure of prepare phase of transaction. and emulate two-phase commit with option, transaction branch in connection used returns >success prepare phase of transaction. not quite clear this, please me make clear. time. this has how gobal transactions (xa) works: understanding emulate two-phase commit transaction option if need support distributed transactions jdbc data source, there no available xa-compliant driver dbms, can select emulate two-phase commit non-xa driver option data source emulate two-phase commit transactions understanding logging last resource transaction option weblogic ser

javascript - how can make scrollable divs or tables for mobile devices? -

i in web dev past 2 years or so. never had deal mobile. lately required develop responsive templates wordpress. managed many things working except tables. my idea responsive table solution putting table's content inside div has overflow:auto. datatable fixed columns i've worked on past few hours thinking scrolling on mobiles browsers same computer browsers. check mobiles see if works(gallaxy note/tablet- worked fine, iphone 4 s/ iphone 5 - didnt work). here fiddle worked on jsfiddle after realized normal jquery scroll() wont work started reading jquery mobile found following: element.on("scrollstart",function(){ console.log("happening"); }); i tried , still nothing. my question how handle scrolling on mobile browsers? , how should approach developing mobiles ? guide ?article ? thanks i've read more , tried different things none of stable or working on several different mobiles. the reason thought scrollstart doesnt wo

xcode - Parse Facebook login fails with error code 251 -

i'm trying use parse facebook & twitter login in app problem can't facebook login work. i'm getting following error message: error domain=parse code=251 "the operation couldn’t completed. (parse error 251.)" userinfo=0xa0329c0 {code=251, error=the supplied facebook session token expired or invalid. i downloaded parse tutorial "integratingfacebooktutorial" , still same error. (i added bundle facebook app , updated application id on xcode required. the same happens in own project when trying use pfloginviewcontroller, same setup + i'm calling [pffacebookutils initializefacebook]; in didfinishlaunchingwithoptions. i found several reports issue 0 solutions far. found solution (will happy hear if valid solution) in facebook app (developer.facebook.com) -> settings -> advanced -> app secret embedded -> set "no" , problem solved!

ios - UINavigationController does not release memory after back button is tapped -

i have mainviewcontroller , secondviewcontroller. secondviewcontroller pushed using segue (ios 7 app). problem when button tapped , app mainviewcontroller, secondviewcontroller memory not released. in prepareforsegue, don't allocation. merely set delegate secondviewcontroller (aka cvc below). collectionviewcontroller (aka secondviewcontroller) quite big user goes back-and-forth between main vc , secondviewcontroller memory usage keeps increasing , app crashes eventually. -(void) prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { if ([segue.identifier isequaltostring:@"show gallery"]) { collectionviewcontroller *cvc = (collectionviewcontroller *)segue.destinationviewcontroller; cvc.delegate = self; } } also, delegate weak reference: @property (weak, nonatomic) id <collectioncellselecteddelegate> delegate; it's not enough information localize issue. are sure collectionviewcontroller object leaking? mean it's pos

c# - Calling GetRequestStream() hangs WPF UI for 1sec -

i have created wpf application has controls 1 label , 2 butons start , stop timers. i have created 2 dispatchertimers 1 timer fire after every 50 milliseconds , update lable count value. dispatchertimer fire after every 2 seconds post data http post test server called " http://posttestserver.com/post.php?dir=test ". in timer using getrequeststream causes ui stop 1 sec data posting posttestserver. have used following code. public partial class mainwindow : window { static int count = 0; dispatchertimer dispatchtimer = null; dispatchertimer webdispatchtimer = null; public mainwindow() { initializecomponent(); dispatchtimer = new dispatchertimer(); webdispatchtimer = new dispatchertimer(); webdispatchtimer.interval = timespan.frommilliseconds(2000); dispatchtimer.interval = timespan.frommilliseconds(50); dispatchtimer.tick += new eventhandler(dispatchtimer_tick); webdispatchtimer.tick += ne

playframework - Play java framework Initializing variables on application startup in -

i want initialise variables on application startup in play framework. i'm following document http://www.playframework.com/documentation/2.2.x/javaglobal doing same.. when run application command "play run" initialization not happen. doing wrong here? import com.constants; import controllers.application; import controllers.utils; import play.*; public class global extends globalsettings { public void onstart(application app) throws exception { logger.info("application has started"); constants.data1= utils.getmerchanttobrmapping(utils.getmerchantname()); constants.data2 = utils.getbrtomerchantmapping(utils.getmerchantname()); logger.info("loaded merchant br map"); } } your application controller being used implementation app parameter in onstart(applciation app) method. in other words not overridding onstart() callback method play call, instead defining own custom method. it should rather this: import play.

ios - -[CCFileUtils fullPathForFilename:resolutionType:] : cocos2d: Warning: File not found: -

Image
-[ccfileutils fullpathforfilename:resolutiontype:] : cocos2d: warning: file not found: play.png cocos2d game....extremely simple started it. this entire class , "play.png" , "sound.png" not being found. both located in "buttons.plist" (texture packer documents) , included in build phases. class: - (id) init { if ((self = [super init])) { //[[simpleaudioengine sharedengine] playbackgroundmusic:@"looped.mp3" loop:yes]; [[ccspriteframecache sharedspriteframecache] addspriteframeswithfile:@"buttons.plist"]; cgsize winsize = [ccdirector shareddirector].winsize; ccsprite* background; if( winsize.width == 568 || winsize.height == 568 ) background = [ccsprite spritewithfile: @"title_bg-5x.png"]; else background = [ccsprite spritewithfile: @"title_bg.png"]; [background setposition: ccp(winsize.width/2, winsize.height/2)];

php - Opencart Error trying to access Customers section of admin area -

i have opencart store setup , when try access customers page admin area receive following error code: fatal error: uncaught exception 'errorexception' message 'error: unknown column 'cg.name' in 'field list'<br />error no: 1054<br />select *, concat(c.firstname, ' ', c.lastname) name, cg.name customer_group oc_customer c left join oc_customer_group cg on (c.customer_group_id = cg.customer_group_id) order name asc limit 0,20' in /home/canad763/public_html/testshop/system/database/mysqli.php:41 stack trace: #0 /home/canad763/public_html/testshop/system/library/db.php(20): dbmysqli->query('select *, conca...') #1 /home/canad763/public_html/testshop/admin/model/sale/customer.php(150): db->query('select *, conca...') #2 /home/canad763/public_html/testshop/admin/controller/sale/customer.php(408): modelsalecustomer->getcustomers(array) #3 /home/canad763/public_html/testshop/admin/controller/sale/customer.php(12

c - How to use exec() system call correctly after a fork? -

i'm having issues program want run_uptime function display output of uptime function every 5 seconds stdout. however, don't know i'm doing wrong in code, i've looked through various other questions related exec() , fork() still can't seem find solution. 1 other thing how can rewrite fork call without switch statement, that's more of aesthetic reason still wanna know how it. i'd appreciate help. please explain why though, because i'm newbie. problem statement, program should do: you shall create program following: o upon startup, read total runtime (in seconds) user wants program run for. default value of 10 seconds used if user not include time when launching program (i.e., rohan> a3 30 causes program run 30 seconds, rohan> a3 run program 10 seconds). o program shall create 3 child processes, busy-wait until child processes complete , exit. o first child process shall implement clock prints hour, minute, , second once eve

ruby - Sunspot Solr search using false value -

i want implement search solr filed when view checkbox clicked what parameter should send? my solr store follows boolean :from_vendor !from_vendor? end where from_vendor boolean attribute in table, want exclude from_vendor => true search, must search false value search param, shebang(!) sign can avoided in store. not sure should send search param, because logic is, splitting param string , , based upon assign condition it, like, if send params "0,+" , means solr search value greater 0. in case how should construct params? thanks in advance.

c# - How to prevent to run an exe from two different computers -

i have form application written in c#. put exe server in company reached computers. need find solution know if exe running in another computer . so when 1 computer tries run application should check if computer running same app. i found in working fine if same computer runs exe 2 times. here have file writable users on server. when application starts, open file write , keep reference stream in static field. when application closed, close stream. if application crashes or network down, file automatically released os. for instance, in program.cs : private static stream lockfile; public static void main() { try { try { lockfile = file.openwrite(@"\\server\folder\lock.txt"); } catch (ioexception e) { int err = system.runtime.interopservices.marshal.getlastwin32error(); if (err == 32) { messagebox.show("app running on computer"); return; } throw; //you should handle properl

nginx - uwsgi ini file configuration -

i have python application running on server. try configure uwsgi server in application. uwsgi.conf file location : /etv/init/uwsgi.conf # file: /etc/init/uwsgi.conf description "uwsgi starter" start on (local-filesystems , runlevel [2345]) stop on runlevel [016] respawn # home - path our virtualenv directory # pythonpath - path our django application # module - wsgi handler python script exec /home/testuser/virtual_environments/django-new/bin/uwsgi \ --uid root \ --home /home/testuser/virtual_environments/django-new \ --pythonpath /home/testuser/django \ --socket /tmp/uwsgi.sock \ --chmod-socket \ --module wsgi \ --logdate \ --optimize 2 \ --processes 2 \ --master \ --logto /var/log/uwsgi.log and have create .ini file. /etc/uwsgi/app-available/uwsgi.ini [uwsgi] home = /home/testuser/virtual_environments/django-new pythonpath = /home/testuser/django socket = /tmp/uwsgi1.sock module = wsgi optimize = 2 processes = 2 nginx configuration: /etc/nginx/site-av

Method postToSystem() is automatically called on deployment in spring -

i have simple spring application, bean contains method name posttosystem(parameters) without annotations , automatically called on deployment (and throws exception). explain me problem here? method name? stacktrace when called is: daemon thread [http-bio-127.0.0.1-8080-exec-1] (suspended (breakpoint @ line 128 in customerexportserviceimpl)) owns: concurrenthashmap<k,v> (id=93) owns: object (id=94) owns: standardcontext (id=95) owns: managerservlet (id=96) owns: socketwrapper<e> (id=97) customerexportserviceimpl.<init>() line: 128 nativeconstructoraccessorimpl.newinstance0(constructor, object[]) line: not available [native method] [local variables unavailable] nativeconstructoraccessorimpl.newinstance(object[]) line: 57 delegatingconstructoraccessorimpl.newinstance(object[]) line: 45 constructor<t>.newinstance(object...) line: 526 beanutils.instantiateclass(constructor<t>,

c# - SerializationExceptions in UnitTests -

i having trouble visual studio (2010) unit tests. whenever goes wrong , exception of 1 type thrown, unittestadapter throws serializationexceptions, telling me can't deserialize exceptions thrown. in unit tests created, these either system.data.sqlserverce.sqlceexception or nhibernate.mappingexception . i cannot figure out why happening. research told me, common reason assemblies these types reside not available unittestadapter, when testresults-folder, see every assembly needed, including system.data.sqlserverce.dll , nhibernate.dll . so - can debug this? need see exceptions in test results them useful in way. when running visual studio unit tests , vstesthost process initializes , runs test. a new appdomain gets created , base directory appdomain gets set unit test "out" directory contains assemblies , dependencies required run test. the test directory called "testresults" , found in same directory solution file resides. within &

asp.net - How do I create a key at mashape.com? -

Image
i trying send sms asp.net web application (free sms). upon searching, found article : how send sms asp.net application now, according article trying create key @ mashape.com . unable same. can help? thanks create application through header (or directly on api profile, see dropdown below) now have 2 ways key: navigate application , click button says get keys , modal appear contains key management center. there can generate keys, , block previous keys. going on api, , should see dropdown can select application, key application selected in adjacent code snippet. :)

workflow foundation 4 - Using localdb with for WF4.5 persistence fails -

i trying create unit tests workflow uses sqlworkflowinstancestore it's persistent store. when try create , instance following error: the execution of instancepersistencecommand named {urn:schemas-microsoft-com:system.activities.persistence/command}createworkflowownerwithidentity interrupted error. with inner error of: verify set options correct use indexed views and/or indexes on computed columns and/or filtered indexes and/or query notifications and/or xml data type methods and/or spatial index operations. has have same solution this. when use sqlexpress using same dacpac make sure schema etc identical. both ansi_nulls , quoted_identifier off. i have seen similar errors in past caused datatypes trying persist not being compatible database. my first attack on problem run workflow has no arguments , see if persist.

javascript - Retain input focus in autocomplete on meteor js -

i've added https://github.com/mizzao/meteor-autocomplete meteor js project , can list of available options. i'm using arrow up- , down-keys mark entry , enter select it. cursor moves out of focus input field can't press enter again submit form. have click button on form perform submit. html: <div class="controls"> {{> inputautocomplete settings=settings id="name" name="name" placeholder="name" }} </div> i added focus js file helps before select item list: template.raceaddparticipant.rendered = function () { document.getelementbyid("name").focus(); }; how can circumvent this? regards claus (i wrote package.) i'm guessing you're using autocomplete in single-field mode. implemented in feature prevent popup menu staying open after selection made. default, popup menu stays open whenever field focused (and there match), , enter button makes selection. do have suggestion how

postgresql - Convert value from string representation in base N to numeric -

on database keep numbers in specific notation varchar values. there way typecast values decimals selected notation? what looking here should this: select to_integer_with_notation('d', '20') int4 --------- 13 one more example: select to_integer_with_notation('d3', '23') int4 --------- 302 unfortunately, there no built-in function in postgresql, can written easy: create or replace function number_from_base(num text, base integer) returns numeric language sql immutable strict $function$ select sum(exp * cn) ( select base::numeric ^ (row_number() on () - 1) exp, case when ch between '0' , '9' ascii(ch) - ascii('0') when ch between 'a' , 'z' 10 + ascii(ch) - ascii('a') end cn regexp_split_to_table(reverse(lower(num)), '') ch(ch) ) sub $function$; note : used numeric return type, int4 not enough in many cases (with long

c# - DropDownListfor in EditorTemplates -

am creating editortemplate boolean fields have yes no dropdown , below code @model nullable<bool> @{ var listitems = new[] { new selectlistitem { value = "true", text = "yes" }, new selectlistitem { value = "false", text = "no" } }; } @html.dropdownlistfor( ????, listitems,"") where want load drop-down selected item available in model can true or false from view getting true or false in model property template. how can use dropdownfor accepts linq in 1st paramtere ? thanks you can either use @html.dropdownlistfor(m => m, listitems, "") or @html.dropdownlist("", listitems, "")

ember.js - ember-cli test: Teardown failed: Cannot read property 'unchain' of undefined -

i'm trying write simple test ember-cli app: import startapp 'wallet2/tests/helpers/start-app'; var app; module('integration - login', { setup: function() { app = startapp() }, teardown: function() { ember.run(app, "destroy"); } }); test('should ask me log in', function() { visit('/').then(function() { equal(find('h1#title').text(), 'please login'); equal(find('form').length, 1); }); }); the tests pass teardown fails with: teardown failed on should ask me log in: cannot read property 'unchain' of undefined source: @ chainnodeprototype.unchain (http://localhost:4200/assets/vendor.js:17359:9) @ chainnodeprototype.remove (http://localhost:4200/assets/vendor.js:17331:8) @ ember.unwatchpath (http://localhost:4200/assets/vendor.js:17550:23) @ object.ember.unwatch (http://localhost:4200/assets/vendor.js:17619:5) @ object.ember.removeobserver (http://lo

c# - How can I cast a collection -

this code: ilist<string> quids; quids = db.database.sqlquery<string>("dbo.getbyid @id", new sqlparameter { parametername = "id", value = 1 }); produces following error message: cannot implicitly convert type 'system.data.entity.infrastructure.dbrawsqlquery' 'system.collections.generic.ilist'. an explicit conversion exists (are missing cast?) can explain me how can cast collection? ilist<string> result = oldcollection.tolist(); dbrawsqlquery<t> not implement ilist<t> interface (so, no direct cast possible). implements ienumerable<t> , can call .tolist() .

How to force manual merging in Git / IntelliJ if same file but different lines were edited? -

i not sure whether git or intellij problem facing. assuming following using git integration in intellij: user changes text file , commits , pushes change branch branch1 user b changes same text file but in different line , commits branch1 user b fetches remote repository , merges remote branch1 local branch1 current behavior : merges wihout conflicts (since different lines?) wanted behavior : conflict resolution window popups , user must decide whether apply none conflicting changes. but why might want behvaior? : had troubles markup or js files, 1 developer changed @ top (e.g. removed unused function) , developer relying on this. 1 must have costly ui tests if want informed breaks. if markup (e.g. jsf tags, params) i not sure if want, use --no-commit option of git merge command pretend merge failed when there no conflicts. manual: with --no-commit perform merge pretend merge failed , not autocommit, give user chance inspect , further tweak merge result b

encoding - How to convert \\u0026 to & with ruby -

i having pretty basic problem have following string: url="http://www.autokaupat.net/jyv%e4skyl%e4/\\u0026view=2254630" the html encoding not problem, \\u0026 has converted & in order work want to. following approach doesn't work me, although seems working many others: url.force_encoding('utf-8') this works if remove 1 of leading backslashes. any thoughts on how fixed? the character & represent plain string \u0026 in url . 6 characters rather single character represented unicode escape. force_encoding won't job in case. try following, extract unicode liked sequence in string , replace them actual character @ code point. url="http://www.autokaupat.net/jyv%e4skyl%e4/\\u0026view=2254630" url.gsub!(/\\u([a-f0-9]{4,5})/i){ [$1.hex].pack('u') } puts url #=> http://www.autokaupat.net/jyv%e4skyl%e4/&view=2254630

javascript - How to look up and combine data in different parts of an XML source document using XSLT to create SVG visualization of a finite element mesh -

Image
background in job engineer, use a finite element analysis program analyzing buried structures in soil. underlying code excellent, ui - ability of program create , display input finite element meshes - limited, , leaves desired. attempting create better, faster viewing experience xml formatted mesh data using javascript, css , svg graphics in browser. i think understand xml , svg. however, xslt programming experience -zilch- ; w3schools tutorial has helped little bit, having trouble finding resources online go deeper in learning need know. appreciate if @ least me started in solving problem. eager learn not how it, how write own xslt transformations in future. specific problem my idea @ point represent each element in finite element mesh svg polygon. having trouble understanding how "look up" x , y values each node of every individual polygon , have coordinates inserted right places. here structure of type of xml input file have work with. <?xml version=&qu