Posts

Showing posts from July, 2014

sql - TSQL find missing Values for repeating records -

sample data: pageid attribute 2860 category 2860 sub-category 2861 tag 2861 tag 2862 tag 2862 category 2863 sub-category 2883 category 2883 sub-category problem # 1: need find page ids attribute sub-category not exists result should : 2861 2862 problem # 2: need find page ids attribute sub-category , attribute category both not exists result should : 2861 1) select pageid thetable pageid not in (select pageid thetable attribute = 'sub-category') 2) select pageid thetable pageid not in (select pageid thetable attribute = 'sub-category') , pageid not in (select pageid thetable attribute = 'category')

c# - Find All Uses of a Specific Reference -

i have website, code behind references functions within project within same solution. have been tasked pulling out website , existing functionality , putting own solution. currently code behind looks similar this: using businessobjectsproject; namespace batchproject.web { public partial class autoshoppingcart : system.web.ui.page { [webmethod] public static batchproject loadprojectdetails(string projectid) { return businessobjectsproject.batchbo.readbatchproject(converthelper.safeconvertint32(projectid)); } } } however there many (more 20) functions make use of businessobjectsproject reference. is there simple way list businessobjectsproject functions in autoshoppingcart class? want ensure copy on ensure existing functionality. if you're using visual studio, right click businessobjectsproject , select find references (or press shift + f12 ). the solution suggested blorgbeard useful, remove/rename cla

excel vba - VBA Selective Error Handling -

how can trap particular errors in vba? so far have been raising error same number in error handler( 1 don't want use particualr error) pass error handler, makes code bloated. i wondering if there better way? example of how have been doing far: sub correct() on error goto correcthandler wrong correcthandler: 'some code handle out of range error (aka err.number 9) end sub sub wrong() dim badarray(1 1) variant on error goto wronghandler badarray(100) = 1 wronghandler: select case err.number case 9 err.raise 9 'code handle other errors end select end sub typically other way around unless want have select case includes all possible errors can run into . typical use doing if error recoverable. if want in context of error handler (harder debug if isn't recoverable because lose information original error), i'd this: sub correct() on error goto correcthandler wrong exit sub corr

tomcat - I am Moving my application Web-logic to Tomcat7 -

the below code working fine while application running in weblogic in tomcat giving error. main problem loading java:comp/env/jmx/runtime . so please let me know configuration need run code in tomcat. my code: mbeanserver server = (mbeanserver)ctx.lookup("java:comp/env/jmx/runtime"); // platform mbean server objectname rs = new objectname("com.bea:name=runtimeservice,type=weblogic.management.mbeanservers.runtime.runtimeservicembean"); hashmap map = null; try { objectname domcfg = (objectname) server.getattribute(rs,"domainconfiguration"); objectname[] jdbcsysresources = (objectname[]) server.getattribute(domcfg, "jdbcsystemresources"); map = new hashmap(); (int i=0 ; i<jdbcsysresources.length ; i++) { objectname jdbcresourcebean = (objectname) server.getattribute(jdbcsysresources[i],"jdbcresource"); objectname driverparamsbean

javascript - redirect to same page after submit -

i want submit form when file select changed in form , able redirect same page. ie: have url: http://localhost:3000/worker_steps/basic_info . after dropdown changed, want form submitted , redirect again http://localhost:3000/worker_steps/basic_info . i have code in html: <form class="simple_form form-horizontal" novalidate="novalidate" id="edit_user_385" enctype="multipart/form-data" action="/worker_steps/basic_info" accept-charset="utf-8" method="post"> <input class="file optional" name="user[picture]" id="user_picture" type="file"> //this th e dropdown select input and in jquery, have atm: $("#user_picture").change(function(){ //window.location = "/worker_steps/basic_info"; $(this).closest("form").submit(); }); i use this: window.location.replace(window.location.href);

Neo4J Java findNodes with other than a single string match -

i'm using neo4j java api (currently version 2.2.1) simple queries this: label label = dynamiclabel.label("user"); resourceiterator<node> providers = graphdb.findnodes( label, "username", "player1")); but there way allow other simple match (string in case) values? can regex, or provide list of possible values key match on string comparisons? if so, there examples out there? i've dug around docs , favorite search engines , can't seem find other straight string match (such this: http://neo4j.com/docs/2.2.1/tutorials-java-embedded-new-index.html ). you'll rapidly find might want execute cypher queries inside of java kind of querying. string query = "match (n:label) n.username =~ ".*foo regex.*" return n;"; try ( transaction ignored = db.begintx(); result result = db.execute(query) ) { while ( result.hasnext() ) { // nifty stuff results. } } the regular embedd

python - imgur API - lots of credits left but ImgurClientRateLimitError: Rate-limit exceeded -

Image
i'm using python imgur client uploads i'm getting imgurclientratelimiterror: rate-limit exceeded! i've done near 500 api requests hour , current credits like: { u'clientlimit': 12500, u'clientremaining': 12500, u'userlimit': 500, u'userremaining': 500, u'userreset': 1429698684 } i've gone on docs here https://api.imgur.com/#limits can't find indicate why getting rate limit error. does know why i'm getting this? my specific upload call looks like x = imgur_client.upload_from_url(url, config=none, anon=true) -------- update ----- here's screenshots of stats in mashape. don't see how possibly anywhere near limit. for encountering this, solution make sure send mashape key in http headers. at time made post, wasn't supported in default imgur python library now. https://github.com/imgur/imgurpython/blob/master/imgurpython/client.py#l76

Library libusb 1.0.9 on Raspberry Pi -

i having problem compilation of java file. i want use libusb-1.0.9 library, problem cannot find symbols, libusbexception , libusb.bulktransfer , etc. code written in nano text editor, , have no idea how implement library code.

javascript - jQuery multiple instance plugin using "this" in setTimeout -

i'm trying write new plugin can initialized on multiple elements within same page, each time different options, ex: $('#id').plugin({ option:true }); $('#id2').plugin({ option:false }); i'm using boilerplate jqueryboilerplate.com ( https://github.com/jquery-boilerplate/jquery-boilerplate ). understand (at least think do!) problem within scope of anonymous function (here, within settimeout) 'this' refers window. in following, output logged first time, not second: // avoid plugin.prototype conflicts $.extend(plugin.prototype, { init: function () { console.log(this.settings.propertyname); settimeout(function(){ console.log(this.settings.propertyname); }, 1000); } }); elsewhere this.settings.propertyname set 'value'. console.log result is: value uncaught typeerror: cannot read property 'propertyname' of undefined if example set window.prop = this.settings.propertyname , console.log w

Why is this C for-loop not working properly? -

int main() { int t, i; int *nums; scanf("%d", &t); nums = malloc(t * sizeof(int)); for(i = 0; < t; i++) { scanf("%d", &nums[i]); } printf("hey"); } for reason, hangs, waiting more input! ideas? this code correct, except fact you're not freeing memory (not big issue simple code) , you're not checking scanf errors, may cause of problem. a better implementation error checking , correct memory handling described below: #include <stdio.h> #include <stdlib.h> int main() { int t, i, ret; int *nums; ret = scanf("%d", &t); if(ret != 1) { /* wrong */ } nums = malloc(t * sizeof(int)); if(nums==null) { /* memory error */ } for(i = 0; < t; i++) { ret = scanf("%d", &nums[i]); if(ret != 1) { /* wrong */ } }

matlab - Error using caffe Invalid input size -

i tried train own neural net using own imagedatabase described in http://caffe.berkeleyvision.org/gathered/examples/imagenet.html however when want check neural net after training on standard images using matlab wrapper following output / error: done init using gpu mode done set_mode elapsed time 3.215971 seconds. error using caffe invalid input size i used matlab wrapper before extract cnn features based on pretrained model. worked. don't think input size of images problem (they converted correct size internally function "prepare_image"). has idea error? found solution: referencing wrong ".prototxt" file (its little bit confusing because files quite similar. computing features using matlab wrapper 1 needs reference following files in "matcaffe_demo.m": models/bvlc_reference_caffenet/deploy.prototxt models/bvlc_reference_caffenet/mymodel_caffenet_train_iter_450000.caffemodel where "mymodel_caffenet_train_iter_450000.caff

post redirect get - Having $_POST data within a PHP Class -

i developed habit of working in php , wondering if correct way work or not. basically, whenever have form, post data 'handler' file couple of basic checks (in cases) creates instance of class. the class __construct automatically calls function within class , begins validating post data , redirects user accordingly, along $_get data display success message. i'm aware post-redirect-get pattern, yet, curiosity is: okay redirect file , create class instance within there, or okay if post data directly class file ?

c# - Relative Column Widths Not Working When DataGrid is Nested Inside A Grouped DataGrid -

Image
suppose have object 6 attributes: public class myclass { public string attribute1 { get; set; } public string attribute2 { get; set; } public string attribute3 { get; set; } public string attribute4 { get; set; } public string attribute5 { get; set; } public string attribute6 { get; set; } } i display collection of these objects in datagrid: <grid> <datagrid x:name="mygrid" margin="5, 5, 5, 5" autogeneratecolumns="false" canuseraddrows="false" isreadonly="true"> <datagrid.groupstyle> <groupstyle containerstyle="{staticresource groupheaderstyle}"> <groupstyle.panel> <itemspaneltemplate> <datagridrowspresenter/> </itemspaneltemplate> </groupstyle.panel> </groupstyle> </datagrid.groupstyle>

android - Google Places API returning zero-results with specified keyword -

i doing android app returns closest places user's location fits specified preferences (pizza, coffee, bar, etc). in order that, using nearby search requests in google places api. how build http request: public string createrequesturl() { string requesturl = ""; if ((googleapikey != "") && (lat <= max_google_lat) && (lat >= min_google_lat) && (lng <= max_google_lng) && (lng >= min_google_lng)) { requesturl += "https://maps.googleapis.com/maps/api/place/nearbysearch/json?"; requesturl += "location=" + lat + "," + lng; requesturl += "&rankby=distance"; requesturl += "&keyword=" + keyword; requesturl += "&opennow"; requesturl += "&key=" + googleapikey; } return requesturl; } the test query trying execute lat = 45.5017, lng = 73.5673, keyword = "pi

c# - Using Tasks : ContinueWith needs a return statement which my business logic doesn't require -

i started using tasks yesterday little project of mine. after setting task logic in code, realised forced use return statement within continuewith() function. is there way avoid having return inside continuewith though mytask needs return object in first place? task<list<object>> mytask = task<list<object>>.factory.startnew(() => { //business logic creating object return //return object created }) .continuewith<list<object>>((antecedant) => { //business logic : needs use antecedant return null; //can rid of this? don't need return object in section }, taskscheduler.fromcurrentsynchronizationcontext()); let's return null statement annoying me... note : in response yuval's comment, i'm using .net framework 4.5 solution according corynelson's comment, i've come code. corresponds needs. task<list<object>> mytask = task<list<object>>.factory.startnew(() => { /

java - How does Spring MVC convert @RequestParam values? -

i'm new spring framework, , symptom, want keep adoption of web mvc portions simple possible, i'm using annotation functions work spring. in past, i've used: int value = integer.valueof(request.getparameter("numbervalue")) to pull values parameters - explicitly converting string returned getparameter() . helpfully, i've noticed when use spring's terminology: @requestparameter("numbervalue") int numval conversion handled automatically. nice, "black box" me. tried looking @ questions on here or in spring documentation, information deals custom conversions (like converter) objects or formatting issues. want know how spring handles primitive type conversions @requestparam default. i've noticed when use spring's terminology: @requestparameter("numbervalue") int numval conversion handled automatically. here looking type conversion as per spring documentation given on link string-based value

php - xss_clean(set_value('field_name')) or set_value('field_name') is safe enough? -

as codeigniter3's documentation says , a largely unknown rule xss cleaning should applied output, opposed input data. should use xss_clean() before outputting user's data? or set_value me? yes, set_value() apply xss-sanitizing default. however, careful when using other form helper functions, because well, , don't want double-escaping. as explained in manual , can turn escaping off passing (boolean) false third parameter set_value() .

dataframe - single quote in cbind for appending data to data frame in R -

i trying understand syntax in following line of code. single quote inside cbind function here? please explain example, if possible. complete code sample, please visit site . type: 'after' : logical 'check' : vector if (after) cbind(data, ' ' = check) else cbind(' ' = check, data) it's handy way give appended column empty (looking) name in resulting data.frame. compare: > data <- data.frame(a=1:3, b=4:6) > cbind(data, 1:3) b 1:3 1 1 4 1 2 2 5 2 3 3 6 3 > cbind(data, ' '=1:3) b 1 1 4 1 2 2 5 2 3 3 6 3 ## , see column name not empty... > names(cbind(data, ' '=1:3)) [1] "a" "b" " "

asp.net - Visual Studio 2010 compile error -

i getting following error when compile release of web application. project ran fine on machine hard drive went out on. thinking there problem configuration. did research , made note of web deploy issue unable verify version in use on past machine. here error: the "iscleanmsdeploypackageneeded" task failed unexpectedly. system.invalidcastexception: [a]microsoft.web.deployment.deploymentprovideroptions cannot cast [b]microsoft.web.deployment.deploymentprovideroptions. type originates 'microsoft.web.deployment, version=9.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35' in context 'default' @ location 'c:\windows\assembly\gac_msil\microsoft.web.deployment\9.0.0.0__31bf3856ad364e35\microsoft.web.deployment.dll'. type b originates 'microsoft.web.deployment, version=7.1.0.0, culture=neutral, publickeytoken=31bf3856ad364e35' in context 'default' @ location 'c:\windows\assembly\gac_msil\microsoft.web.

c# - Save to DB in model method or controller -

i trying wrap head around mvc , how use it. appreciate question. i created model ef db first. application adds data db. question is, should conducting saving db? in controller or in method lives within partial class of model? in typical introductory book mvc present basic data-entry app simple data model, e.g: class personal data enter user, homecontroller index view called viewresult method called index , data entry view uses html helpers create form set of fields. that view handled pair of viewresult methods in same homecontroller , 1 decorated [httpget], 1 presents view editable form user , , other decorated [httppost] , 1 receive , bind data edited view. the binding done component of mvc called modelbinder , in viewresult method. there call ef's dbcontext save data. please keep in mind direct call dbcontext made in context of simple "learning app" , correct way create data manipulation layer it's own project , create service instantiated io

java - Why do i need library file with -sources suffix? -

Image
i don't understand why there 2 files in libraries, 1 -sources suffix. here's mean the sources useful if want step library when debugging. don't need them, might save if can't understand why library behaves in way.

javascript - Avoid overlapping divs horizontally -

i want modify css or javascript success 2 conditions: example: (------------------main div-----------------------------)(------right div -----) conditions: 1) if there div in right of main div, display main div example. 2) if right div dont exist, main div must width. i can set width determinated size dont meet conditions. somebody can me?. this answered here : 2 column div layout: right column fixed width, left fluid use width:auto , overflow:hidden css styles main div takes required width. example html : <div class="right"> right div fixed width </div> <div class="left"> left main div flexible width </div> css : .right { width: 180px; float: right; background: #aafed6; } .left { width: auto; background:blue; overflow: hidden; }​​

c# - Retrieving class property when reading from database -

i have following: using (sqlcommand cmd2 = new sqlcommand("", dbcon)) { cmd2.commandtext = @" select [pcmf04_pcbpocketname_n] ,[pcmf01_pcbconnectorname_n] ,[pcmf03_pcbheadername_n] ,[pcmf04_keyindex_c] ,[pcmf04_sortorder_r] [ardsqldev].[dbo].[wpcmf04_pcbpocket] pcmf03_pcbheadername_n = @pcmf03_pcbheadername_n order pcmf04_pcbpocketname_n"; cmd2.parameters.add("@pcmf03_pcbheadername_n", sqldbtype.nvarchar).value = header.headername; using (sqldatareader dr = cmd2.executereader()) { while (dr.read()) { var pocket = new pcbpocket(dr.g

javascript - Search if my HTMLCollection contains certain text -

i have search function properties allowing me search number of bedrooms, bathrooms, price (high , low) , trying tell me if customers search word, or words, in record. "river" or something. i have been playing .contains() , .indexof() , can not either work. here few have tried; for (var i=0;i<x.length;i++) { var item = x[i]; if (item.getelementsbytagname("bedrooms")[0].childnodes[0].nodevalue >= filterbed && item.getelementsbytagname("bathstotal")[0].childnodes[0].nodevalue >= filterbath && item.getelementsbytagname("listprice")[0].childnodes[0].nodevalue >= filterprl && item.getelementsbytagname("listprice")[0].childnodes[0].nodevalue <= filterprh && item.getelementsbytagname("publicremarks").text().tolowercase().contains(filterword) ) { and; && item.getelementsbytagname("publicremarks").indexof(filterword) i have tested key words coming throug

c# - Send email using asp.net and google smtp server -

i have written following code in codebehind aspx page send email.i want use google smtp server. how not receiving mails protected void btnsubmit_click(object sender, eventargs e) { // sender e-mail address. mailaddress = new mailaddress(txtfrom.text); // recipient e-mail address. mailaddress = new mailaddress(txtto.text); mailmessage msg = new mailmessage(from,to); msg.subject = txtsubject.text; msg.body = txtbody.text; // remote smtp server ip. smtpclient client = new smtpclient("smtp.gmail.com"); client.credentials = new system.net.networkcredential ("*******@gmail.com", "**********"); client.enablessl = true; client.port = 465; client.send(msg); client.d

c++ - Increment pointer returned by function -

hey experimenting bit c/c++ , pointers while reading stuff here i made myself function return pointer int @ place in global array. int vals[] = { 5, 1, 45 }; int * setvalue(int k) { return &vals[k]; } however able this int* j = setvalue(0); j++; *j = 7; to manipulate array but that: *(++setvalue(0)) = 42; din't work. notice *setvalue(0) = 42; works from understand call function , pointer increment make point 2nd element in array. lastly deference pointer , assign new value integer pointed to. i find c++ pointers , references can confusing maybe can explain me behavior. edit: question not duplicate of increment, preincrement , postincrement because not pre- vs. post-increment rather increment on pointers return of function. edit2: tweaking function int ** setvalue(int k) { int* x = &vals[k]; return &x; } you can use *(++(*setvalue(1))) = 42; you can't call unary operator ( ++ ) on not variable. setvalue(

HTML Form - How do I ensure a word I have searched for remains in the search box? -

in form (eg. search box), 1 @ top right of page, when write word , press enter, can see search results on page, word have searched remains in box too. can tell me attribute is? can't find one. aware "placeholder" word 'search' in box before search carried out, how ensure searched word stays in box after word searched , not disappear? thank you! https://stackoverflow.com/search?q=sea where q request parameter. can access server side scripting. suppose php it's: $_get echo $_get['q'];//sea you can't simple html . if aren't using serverside scripting can javascript: read how can query string values in javascript?

windows installer - Wix. Conditionally set text property of the control -

i have installed app (version 1.0) have change installer upgrade app 2.0 version. want set data specified user on previous installation. how can conditionally fill text field in wizard if have data in properties. something like: <?if <![cdata[isupgrade]]> ?> <property id="account" value="[account_from_registry]" /> <property id="password" value="******" /> <?endif?> <control id="account" type="edit" text="[account]" /> <control id="password" type="edit" text="[password]" /> you need implement the wix toolset's "remember property" pattern . however concern how plan on securing password. might best leave of out install , handle on application first run msi doesn't know it.

javascript - Increase serial number in php posting -

i using 1 html form fetch data in php code. below php code: for ($i = 0; $i < count($sl); $i++) { $email_body .= "sl:" . $sl[$i] . "name:" . $name[$i] . "email:" . $mail[$i] . "\n"; } this gives output in following format: sl name email 0 peter peterxyz@xyz.com 1 purker purker234@xyz.com but need in following format: sl name email 1 peter peterxyz@xyz.com 2 purker purker234@xyz.com i can rectify code writing "$i=1;" not correct solution, code again being used in javascript. hence, please advise me how can make sl 1 when $i =0. kindly me please? this should work in case: $a = 1; ($i = 0; $i < count($sl); $i++) { $email_body .= "sl:" . $a++ . "name:" . $name[$i] . "email:" . $mail[$i] . "\n"; } demo: https://eval.in/317273

sql server - How do you return all data in SQL based on specific number of rows -

i have column "country" in "address" table. i want return data countries have 10 rows. for example, if france has 10 rows (and other countries) want see them. if have italy 9 records don't want see it. thank you! create 1 group per country, , demand group has 10 rows: select country address group country having count(*) = 10 to return rows countries, can use subquery: select * address country in ( select country address group country having count(*) = 10 )

How to specify conditions before performing trigram search in PostgreSQL? -

i'm new fuzzy searching , trigrams in postgresql. have few hundred thousand products in database , want able select products name closest product's name. after few hours of experimenting , research, have installed pg_trgm extension , created trigram index this: create index simpleproduct_name_lowercase on simpleproduct using gist(lower(name) gist_trgm_ops); the following query executes in 0.07s, satisfying now: select 'coffee' <-> lower(name) distance, gtin, name simpleproduct order distance limit 10 the thing is, need further specify kind of products want searching through. imagined if that, faster before because not fuzzy searching whole database specific group of products. reason though, if e.g. following: select 'coffee' <-> lower(name) distance, gtin, name simpleproduct id < 10000 order distance limit 10 ... execution time doubles. explain why case? also, if experienced in area, recommend against using postgresql , going

asp.net - JavaScript runtime error: Member not found -

i faced error first time , never before i have asp.net login control , when press on , receive error says javascript runtime error: member not found. in aspx page debugger highlighted portion <script type="text/javascript"> //<![cdata[ var theform = document.forms['form1']; if (!theform) { theform = document.form1; } function __dopostback(eventtarget, eventargument) { if (!theform.onsubmit || (theform.onsubmit() != false)) { theform.__eventtarget.value = eventtarget; theform.__eventargument.value = eventargument; theform.submit(); << section in yellow highlight } } //]]> </script> so , why received error thank you i found error , because in default.aspx page have html button name submit , , button cause conflict between login control , submit button .

c - Delphi - How to pass a 'Type' as a parameter -

i know if possible pass declared type (in case record) function. not ask if not sizeof() function, because can take type parameter. i'm translating code c , keep close original possible. c program declares pusharray , pushstruct macros. since delphi not have macro support, i'm trying turn them functions. i've googled bit , seems possible use generic types. function pushstruct<t>(arena : pmemory_arena; dtype : <t>) can use in oop type application. function pushsize_(arena : pmemory_arena; size : memory_index) : pointer; begin assert((arena^.used + size) <= arena^.size); result := arena^.base + arena^.used; arena^.used := arena^.used + size; end; function pushstruct(arena : pmemory_arena; dtype : ?) : pointer; begin result := pushsize_(arena, sizeof(dtype)); end; function pusharray(arena : pmemory_arena; count: uint32; dtype : ?) : pointer; begin result := pushsize_(arena, (count)*sizeof(dtype)) end; here original c code:

javascript - How can i tell PHP which form is submitted -

is there way tell php form has been submitted? form 1 <form id="factory" action="bullets.php" method="post"> <input type="submit" value="kopen"> </form> and form 2 <form id="localfactory" action="bullets.php" method="post"> <input type="submit" value="kopen"> </form> these forms on 1 page. my javascript code: var url; $('form').submit(function (event) { event.preventdefault(); url = $(this).attr('action'); location.hash = url; $.ajax ({ url: url, method: 'post', data: $(this).serialize() }).done(function (html) { $('#content').html(html); }); }); if got input $_post variable. so need know of above forms has been submitted? thanks.. this work: var url; $('form'

group policy - Add USER GPO setting based on existence of a folder on the C: drive of the client machine -

i need add trusted location word user gpo setting, need 400 users out of 3000 on our network. the identifier have users want target software installed on pc. is there way of setting user gpo setting based on existence given folder, can target setting rather using blanket approach? no, cannot. @ least not gpo means. gpos applied if match ou , security filtering. latter addresses more or less static sets of users or computers configured in active directory. so need security group contains 400 relevant pcs in order let gpo address set of pcs. however, group rather static in ad , need fill yourself, either manually or external program or script. we example use wmi ask pcs of domain screen sizes , make security group contains pcs report size of 19" or larger. works because property require exposed pcs via wmi can access remotely. so need tool iterates pcs , can remotely determine whether pc has directory or not. 1 approach add login script via gpo machines checks

MongoDB id remains null after InsertOneAsync -

i have base class entity has string id member , derived class a. but when creating new instance of derived class , using insertoneasync add collection, document added database null id value. using objectid id seem work, i'm trying prevent mongodb dependency in models. i experimented following code, results same: bsonclassmap.registerclassmap<entity>(cm => { cm.mapidfield(x => x.id).setserializer(new stringserializer(bsontype.objectid)); }); i had same issue , got work (with 2.0 driver) these attributes: [bsonid] [bsonrepresentation(bsontype.objectid)] [bsonignoreifdefault] or equivalent bsonclassmap fluent interface: bsonclassmap.registerclassmap<entity>(cm => { cm.mapidfield(x => x.id) .setserializer(new stringserializer(bsontype.objectid)) .setignoreifdefault(true); }); i tried same working .replaceoneasync upsert on leaves id still null

sas dis - Referencing job path and name in SAS DIS -

in sas dis, want reference job name in code. know global variable etls_jobname contains information, when assign value field , view output, '.'. ultimately, i'd able path name (in folder structure of job) , i'm not sure sort of information lives. much gratitude. for job flow metadata path, can try using below code. code picks job name &etls_jobname macro variable , extracts metadata folder path of job. know more functions being used, please refer sas language interfaces metadata. hope helps! data path_output; length jobname $ 100 uri headuri $ 256 jobpath head_path $ 500 ; jobname="&etls_jobname"; rcjob =metadata_getnobj("omsobj:job?@name ='&etls_jobname'",1,uri); rchead=metadata_getnasn(uri,"trees",1,headuri); rcpath=metadata_getattr(headuri,"name",jobpath); rchead = 1; while(rchead>0); rchead=metadata_getnasn(headuri,"parenttree",1,headur

bash - Failed to echo on the same line after using sed -

i reading text file following code , want echo output on same line on screen. preceding that, want trimming sed @ end failed echo output on same line. while read line; { var="$(echo $line | sed 's/<[^>]*>//g')"; echo -n "$var" } done < file.txt so if echo -n "$line" prints output on same line when `sed' comes in failed so. doing wrong ?

javascript - Google maps marker parsed using ajax json -

can tell me why can't add multiple markers parsed via json inside , ajax request? i've build array should receive json array contains information required display markers on google map. strangely not work @ all! @ rate if try print in console length of array can see array looping correctly var map; function initialize() { var mapoptions = { zoom: 15, center: new google.maps.latlng(41.90832, 12.52407) }; map = new google.maps.map(document.getelementbyid('map-canvas'), mapoptions); } google.maps.event.adddomlistener(window, 'load', initialize); var xmlhttp = new xmlhttprequest(); var url = "json/prova.json"; xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate == 4 && xmlhttp.status == 200) { myfunction(xmlhttp.responsetext); } } xmlhttp.open("get", url, true); xmlhttp.send(); var infowindow = []; var marker = []; function myfunction(response) {

erlang - problems with converting to json -

i'm trying convert json via jiffy , exception, seem correct {"purchaseorder", [{"purchaseordernumber","99503"}, {"orderdate","1999-10-20"}, {"address", [[{"type","shipping"}, {"name",[{<<"#text">>,"ellen adams"}]}, {"street",[{<<"#text">>,"123 maple street"}]}, {"city",[{<<"#text">>,"mill valley"}]}, {"state",[{<<"#text">>,"ca"}]}, {"zip",[{<<"#text">>,"10999"}]}, {"country",[{<<"#text">>,"usa"}]}], [{"type","billing"}, {"name",[{<<"#text">>,"tai yee"}]}, {"street",[{<<"#text">>,"8 oak avenue"}]},

Java SQL Query - Hibernate -

so got query made list , pass list method should print it. query query = session.createquery("from osoba o fetch properties ((o.id) = (id_osoby)) , (lower(zainteresowania.zainteresowanie) ?) , (lower(zainteresowania.zainteresowanie) ?) , (lower(zainteresowania.zainteresowanie) ?) , (lower(zainteresowania.zainteresowanie) ?) , (lower(zainteresowania.zainteresowanie) ?)"); // query query = session.createquery("from osoba (lower(zainteresowania) ?)"); // stara, zachowana tymczasowo query.setstring(0,"%"+input1+"%"); query.setstring(1,"%"+input2+"%"); query.setstring(2,"%"+input3+"%"); query.setstring(3,"%"+input4+"%"); query.setstring(4,"%"+input5+"%"); list<osoba> osoby = query.list(); // robimy sobie liste na podst zapytania wyswietlwybrane(osoby);

serial port - java not seeing connected device COM4 -

java not seeing arudino on com4 code seems working package tester; import java.io.bufferedreader; import java.io.inputstreamreader; import java.io.outputstream; import gnu.io.commportidentifier; import gnu.io.serialport; import gnu.io.serialportevent; import gnu.io.serialporteventlistener; import java.util.enumeration; public class serialtest implements serialporteventlistener { serialport serialport; /** port we're going use. */ private static final string port_names[] = { "/dev/tty.usbserial-a9007ux1", // mac os x "/dev/ttyacm0", // raspberry pi "/dev/ttyusb0", // linux "com4", // windows }; /** * bufferedreader fed inputstreamreader * converting bytes characters * making displayed results codepage independent */ private bufferedreader input; /** output stream port */ private outputstream output; /** milliseconds block while waiting port open */ private static final int time_out =

php - SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails -

Image
i know common problem don't know what's wrong here. can see there's //return $user , shows valid id. checked in database well. $user = new user; $user->first_name = $data['first_name']; $user->last_name = $data['last_name']; $user->email = $data['email']; $user->phone_no = $data['phone_no']; $user->created_from = 'web app'; $user->save(); // return $user; session::put('user_id',$user->id); // return $user->id; $address = new address; $address->user_id = $user->id; $address->first_name = $data['receiver_first_name']; $address->last_name = $data['receiver_last_name']; $address->email = $data['receiver_email']; $address->address_line_1 =

java - how to avoid Listview data is clearing while switching from same activity to another -

i using adapter data stored in arraylist , added in adapter,hence calling adapter in ui thread,hence adapter calls when user clicks start button.when user switch activity same , returning same activity list view got cleared. button function ,while clicking start service. intent start_service = new intent(mytrip.this, applocationservice.class); startservice(start_service); hence call adapter every 5min my adapter adapter = new mytrip_listview_adapter(mytrip.this, location, date_array, imagesview, j, context, arrayplaces); listviewplace.setadapter(adapter); listviewplace.setselection(location.size() - 1); adapter.notifydatasetchanged(); i think i've understood you. you need when come activity, don't lose data on listview, isn't it? ok, have handle this: public boolean onoptionsitemselected(menuitem menuitem) { switch (menuitem.getitemid()) { case android.r.id.home: intent homeintent = getintent(); startactivity(homeintent); } ret

sql - different results when using query with variables and without variables -

i have query filter records in specific datetime range. testing purpose create query variables , not returning expected result. here query: declare @vtimefrom datetime = '2015-04-22 20:00:00.000' declare @vtimeto datetime = '2015-04-23 08:00:00.000' declare @ptime datetime = '2015-04-22 21:00:00.000' select @ptime convert(varchar(5),@ptime,108) between convert(varchar(5),@vtimefrom,108) , convert(varchar(5),@vtimeto,108) it outputs: no record found the above query returns nothing. but consider query : declare @vtimefrom datetime = '2015-04-22 20:00:00.000' declare @vtimeto datetime = '2015-04-23 08:00:00.000' declare @ptime datetime = '2015-04-22 21:00:00.000' select @ptime convert(varchar(5),'2015-04-22 21:00:00.000',108) between convert(varchar(5),'2015-04-22 20:00:00.000',108) , convert(varchar(5),'2015-04-23 08:00:00.000',108) it outputs: april, 22 2015 21:

powershell - Format SharePoint's <properties> node as list -

sharepoint 2010's listdata.srv service returns atom feed given picklist: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <entry xml:base="http://apps/requests/_vti_bin/listdata.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schem as.microsoft.com/ado/2007/08/dataservices/metadata" m:etag="w/&quot;28&quot;" xmlns="http://www.w3.org/2005/atom"> ... <content type="application/xml"> <m:properties> ... <d:name>last, first</d:name> <d:workemail>first.last@domain</d:workemail> ... </m:properties> </content> </entry> i have quick way display of nodes in /entry/content/properties node in list. i've tried: ps> get-url "http://apps/requests/_vti_bin/listdata.svc/list(1234)/requestor" | format-list -property entry.conten

arduino - Failure occurs when trying to connect my registered device to the IoT Foundation on BlueMix -

i can communicate iot in quickstart, after modify code include specific credentials registered device, "unsuccessful connection". have been using online recipes , tutorials connecting iot device bluemix. i can past first part of recipe , communicate iot foundation in bluemix using quickstart connection, part works me. encounter error , connection fails when try connection registered device. trying connect arduino device, followed tutorial: http://www.ibm.com/developerworks/cloud/library/cl-bluemix-arduino-iot1/index.html please let me know if have suggestion should check determine why connection fails. when connecting quickstart internet of things foundation there no authentication required. client must use valid client id , access permitted topic space. when connecting registered device, or api key, authentication required. important use ssl protect password in case. quickstart, client id must correct , reflect registered device being connected.