Posts

.net - Attributes in external assembly -

i using sqlite-net . uses attribute [ignore] skip field during serialization. i have class property: [ignore] public observablecollection<myentity> myentities { get; set; } it works fine when create table: _connection.createtableacync<myclass>().wait(); now move class external assembly (project) , have error when sqlite-net trying create table. error messages said there unknown type observablecollection. looks [ignore] attribute doesn't work if class in external assembly (project). i trying debug sqlite-net code. here the fragment : var ignore = p.getcustomattributes (typeof(ignoreattribute), true).count() > 0; if (p.canwrite && !ignore) { cols.add (new column (p, createflags)); } i have ignore == false field [ignore] attribute. i newbie in .net not sure in case. are attributes working classes in external assemblies (project)? if are, error in sqlite-net ?

excel - Sorting multiple sheets - code clean up -

looking guidance on sorting columns across multiple sheets. i have 2 data sets (tab1: abc , tab2: xyz). i'm trying sort both sheets (range column column j) column in descending order. this have far... recorded. clean code , better ways approach sorting columns. help/tips appreciated. sub sortingcolumns() application.goto reference:="abc!a1" activeworkbook.worksheets("abc").sort.sortfields.clear activeworkbook.worksheets("abc").sort.sortfields.add key:=range("a1"), _ sorton:=xlsortonvalues, order:=xldescending, dataoption:= _ xlsorttextasnumbers activeworkbook.worksheets("abc").sort .setrange range("a2:k187") .header = xlno .matchcase = false .orientation = xltoptobottom .sortmethod = xlpinyin .apply end application.goto reference:="xyz!rc" activeworkbook.worksheets("xyz").sort.sortfields.clear activeworkbook.worksheets("xyz").sort.sortfields.add ...

sql server - getting error on pivot for syntax when converting rows as column -

i using sql server , wants table rows columns when convert query give me error on keyword incorrect syntax near '1'. query select strvalue,1,2 (select strvalue,nsectionattributeid, (row_number() on (partition nsectionattributeid order nsectionattributeid ) ) colum tblattributedata )temp pivot ( max(nsectionattributeid) colum in (1,2) )piv select strvalue,1,2 (select strvalue,nsectionattributeid, (row_number() on (partition nsectionattributeid order nsectionattributeid ) ) colum tblattributedata )temp pivot ( max(nsectionattributeid) colum in ([1],[2]) )piv

r - Allocating id/factor/categories based on a group of values for each factor -

i have large data table following: id var1 var2 1 1 2 2 d 3 6 d 4 4 b 5 6 d 6 8 i need assign category in var2 based on values in var1 . categories not follow order respect var1 values included in each category. instance: lista <- c(1,5,7) listb <- c(4,9) listd <- c(2,6) i have tried 2 approaches unsuccessfully. using which function: which: dt[which(var1 %in% lista), var2 := "a"] , on listb , listd . it didn't work function approach (which may slow large data table have many elseif clauses). wrote: matchfun <- function(value){ if (var1 %in% lista){ value <- as.character(a)} else { return(value)}} any idea or comment on how allocate factor/categories group of values welcome. i'd suggest merge here. let dt original data table. dt <- data.table(id=1:6,var1=c(1,2,6,4,6,8)) first, need store mapping in table: matchdt <- rbindlist(list( data.table(var1=lista,var2="a...

jquery - How to force user to input value in javascript prompt? -

i have jquery code, open prompt box. problem whether user inputs value in or not, still proceeds code if user click ok. there anyway force user input value in, click ok else can not click ok button. here tried did not work. $(function() { $(".adminapprovepost").click(function(){ var id = $(this).attr("id"); var tag = prompt("you must enter 1 keyword approve post"); if(tag!=null) { $.ajax({ type: "post", url: "/admin/admin-approve-post.php", data: {id:id,tag:tag}, success: function(){ } }); $(this).parents(".postrecord").animate({ backgroundcolor: "#fbc7c7" }, "fast") .animate({ opacity: "hide" }, "slow"); } return false; }); }); it should work this: $(function() { $(".adminapprovepost").click(function(){ var id = $(this).attr("id"); var proceed = true; while(proceed) { tag = prompt("you m...

ios - Setting an image after retreaving the result of a post request takes 17s -

i making post request server returns string, says if user exist or not nickname, post notification works flawless , prints out returned result in under 1s inside completion handler, takes additional 17 20 set image based on returned result... here code using: - (void)textfielddidbeginediting:(uitextfield *)textfield{ // each textfield selected checkl previous text field formating if (textfield == registeremailaddresstextfield) { //check if nickname @ least 6 charactes if (registernicknametextfield.text.length < 6) { nslog(@"emial text field"); [registernicknamecheckmarklabel setimage:[uiimage imagenamed:@"wrong_checkmark.png"]]; }else{ nslog(@"checking nickname"); //check if nickname exists or not nsurl *url = [nsurl urlwithstring:@"myurl"]; //create session custom configuration nsurlsessionconfiguration *sessi...

javascript - Combining react and jade -

i working on isomorphic javascript app express + react. started out using jade server side templates static content, combining 2 becoming unwieldy. have ended this: in express routes: router.get("/", function(req, res) { var webpackstats = require('../../config/webpack-stats.json'); var reacthtml = react.rendertostring(hiwapp({})); var slideshowhtml = react.rendertostring(slideshowapp({})); var config = { webpackstats: webpackstats, reactoutput: reacthtml, slideshowhtml: slideshowhtml }; res.render("how_it_works/howitworks", config); }); in jade: body .company-logo.center #react-main-mount != reactoutput include ./content_block_1.jade include ./content_block_2.jade #slideshow-main-mount != slideshowhtml this brittle-if want jsx jade template more jsx, have make sure order right. my idea all jsx. know there react.rendertostaticmarkup sort of thing, doesn't solve problem of mixing dynamic static...