Posts

Showing posts from February, 2012

sql server - SQL reading from a comma delimited field and then bringing data back in comma delimited format -

i have data in string format 3,2,1 in table column. have lookup table tells me file name associated file table looks this id (int) name ------------------ 1 file 1 2 file 2 what want send string 3,2,1 , data file 1, file 2 separate column can refer in displaying. mind addition existing stored procedure that's why want 1 string row back thanks in advance help you may want write code this. below code it's example put on right track. let me know if have questions declare @input varchar(max) declare @index1 int declare @index2 int declare @id varchar(10) declare @str varchar(max) declare @result varchar(max) set @input = '3,2,1'; set @str = reverse(@input) set @index1 = 1; set @index2 = charindex(',', @str) set @id = substring(@str, @index1, @index2 -@index1) set @result = 'file ' + @id + ',' while (@index2 > 0 ) begin set @str = substring(@str, @index2 + 1, len(@str) -@index1) set @id = substrin

git - No branches in SourceTree -

Image
somehow managed make branches disappear in sourcetree (the section on left lists file status, branches, tags, remotes , stashes). see screenshot: how make them come back? to reveal hidden branches, had drag middle divider on so:

swift - Which files in my iOS Xcode project should I hide before uploading to github? -

in ruby on rails , know there's config/secrets.yml file shouldn't upload github . is there equivalent in ios app? i'm thinking uploading app github before submitting apple app store, , don't want accidentally share secret keys or else should remain private. github maintains public project .gitignore recommendations several languages: https://github.com/github/gitignore for xcode how file looks : # xcode # # gitignore contributors: remember update global/xcode.gitignore, objective-c.gitignore & swift.gitignore ## build generated build/ deriveddata ## various settings *.pbxuser !default.pbxuser *.mode1v3 !default.mode1v3 *.mode2v3 !default.mode2v3 *.perspectivev3 !default.perspectivev3 xcuserdata ## other *.xccheckout *.moved-aside *.xcuserstate *.xcscmblueprint ## obj-c/swift specific *.hmap *.ipa # cocoapods # # recommend against adding pods directory .gitignore. # should judge yourself, pros , cons mentioned at: # http://guides.cocoapods

javascript - Using d3 drag, why doesn't dragstart have d3.event.x set? -

i can access d3.event.x inside on("drag"...) x doesn't exist inside on("dragstart"...) ; why? , how can way, preferably not hackish? check console output example: d3.select("body").append("svg").append("rect") .attr("width", 100) .attr("height", 100) .style("color", "black") .call( d3.behavior.drag() .on("dragstart", function(){ console.log(d3.event); }) .on("drag", function(){ console.log(d3.event); }) .on("dragend", function(){ console.log(d3.event); }) ); jsfiddle @lars explains why, how do it? d3.mouse pretty slick: d3.behavior.drag() .on("dragstart", function(){ console.log('relative rect: ' + d3.mouse(this)); console.log('rela

c# - BinaryFormatter OptionalField with ISerializable -

i create test serializable object: [serializable] public class testobject : iserializable { public string firstname; public testobject() { } public testobject(serializationinfo info, streamingcontext context) { firstname = info.getstring("firstname"); } public void getobjectdata(serializationinfo info, streamingcontext context) { info.addvalue("firstname", firstname); } } and serialize it: var test = new testobject { firstname = "john" }; using (var stream = new filestream(@"c:\temp\test.dat", filemode.create, fileaccess.write)) { var formatter = new binaryformatter(); formatter.serialize(stream, test); } i change class has optionalfied , try deserialize old serialized object: [serializable] public class testobject : iserializable { public string firstname; [optionalfield] public string secondname; public testobject() { } public testobje

javascript - Liferay set the id of liferay-ui:search-container-row -

i want set id of tr result of tag liferay-ui:search-container-row , how can it? for example, resulting table row is: <tr id="aui_3_4_0_1_350" class="portlet-section-header results-header"> i want attach javascript resulting table , need refer various table row, id="aui_3_4_0_1_350" . use class selector , don't know how set it. it not posible set customized id value search-container-row. because generated based on input list , ids need unique. can access using selector starting search-container itself. depends on trying accomplish. if you're using jquery or similar should easy since there's variety of them: https://api.jquery.com/category/selectors/

Publish Android app to store using Visual Studio -

Image
how can publish android app store in visual studio? i see tools | options | publish android app. however, need tutorial on fields provided. any guidance? there instructions publishing xamarin.android application on xamarin developer portal . specifically, part 2 covers publish android app menuitem mentioned. it's little hard see - @ top-right of page there 'switch' between xamarin studio , visual studio instructions (click on visual studio see correct information , screenshots ide).

javascript - Replace apostrophes with regex except if separated by a comma -

i have string need clean using javascript. here below example of string giving me hell. need replace occurrences of ' not separated comma (like "apostrophe's" in example). here's example: var paitems = [ [ 38.20739, -85.76427, 1, 'asd', '314 iowa ave, louisville, ky', 'this apostrophe's', '2000', '2', '2', '1', 'yes', '', '', 'area tennis|satellite dish|controlled access', 'asd', 'asd', 'lorem ipsum dummy text of printing , typesetting industry. lorem ipsum has been industry's standard dummy text ever since 1500s, ', 'lorem ipsum dummy text of printing , typesetting industry. lorem ipsum has been industry's standard dummy text ever since 1500s, ', 'lorem ipsum dummy text of printing , typesetting industry. lorem ipsum has been industry's s

xcode - Resize label to fit text amount - Swift -

hey :) have label , need make width of label smaller or larger accourding text amount, , found how adjust text fit size how adjust size fit text, ideas ? you'll want this: mylabel.sizetofit() as seen here: https://developer.apple.com/documentation/uikit/uiview/1622630-sizetofit this update label's frame fit content. can place or make edits after want.

css - Is it possible to generate a file with javascript and send it to server? -

is possible generate file javascript , send server? have section in web page user can modify style of page, , want generate css file style configuration before send server. possible? thanks! var blob = new blob(["css content"],{type:"text/css"}); var formdata = new formdata() formdata.append("file",blob,"filename"); var xhr = new xmlhttprequest(); xhr.open('post', '/server', true); xhr.onload = function(e) { /**get answer server*/}; xhr.send(formdata);

single sign on - How to implement SAML logout to ADFS with openSaml? -

i created logout request using opensaml library , added signature <samlp:logoutrequest id="_f576971e-5123-49e4-8152-80653dcdfb1a" issueinstant="2015-07-23t15:21:42.254z" reason="urn:oasis:names:tc:saml:2.0:logout:user" version="2.0" xmlns:samlp="urn:oasis:names:tc:saml:2.0:protocol"> <samlp:issuer xmlns:samlp="urn:oasis:names:tc:saml:2.0:assertion">https://my_host/logout</samlp:issuer> <ds:signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> <ds:signedinfo> <ds:canonicalizationmethod algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> <ds:signaturemethod algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/> <ds:reference uri="#_f576971e-5123-49e4-8152-80653dcdfb1a"> <ds:transforms> <ds:transform algorithm="http://www.

html - UL under LI inspite of block under Inline -

i have idea placing block under inline incorrect. while building tree structure use ul under li . please explain why valid html? the default display value li property not inline , it's list-item . , ul designed nested in list, there's no problem placing ul within li . furthermore, of html5, placing block elements inside inline elements valid html. from mdn : the distinction of block-level vs. inline elements used in html specifications 4.01. in html5, binary distinction replaced more complex set of content categories. "block-level" category corresponds category of flow content in html5, while "inline" corresponds phrasing content, there additional categories. if, however, don't want put block element within inline element rendering or other reasons, have option change display value: <span style="display: block"> <div style="display: inline"> ... </div> </span>

c++ - Qt Creator doesn't load my custom widget plugin -

my os win7 , i've installed qt 5.5.0 i create simple custom widget plugin new project->other project -> qt custom designer widget after creating dll , copy in d:\qt\qt5.5.0\tools\qtcreator\bin\plugins\designer , d:\qt\qt5.5.0\5.5\mingw492_32\plugins\designer but in qt creator designer not appear widget in widget box but if run designer .exe, all ok , widget displayed i read qt designer doesn't load custom widget plugin , read how promote custom widget in qt creator i came conclusion qt creator not work correctly sorry not have enough reputation comment. there many possible reasons, why plugin not load. can further information opening *.ui file in qt creator , take in menu: tools->form editor->about qtdesigner plugins. if plugin listed there, copied in right folder , hint why not load. in experience, common mistake is, qt-creator not build mingw, trying load plugin built mingw. need use same compiler both.

javascript - ES6 tagged templates practical usability -

i understand syntax of es6 tagged templates . don't see practical usability. when better passing object parameter, settings in jquery's ajax ? $.ajax('url', { /*this guy here*/ }) right see tricky syntax don't see why need/use it. found typescript team chose implement (in 1.5) before other important features. concept behind tagged string templates? you can use tagged templates build apis more expressive regular function calls. for example, i'm working on proof-of-concept library sql queries on js arrays: let admins = sql`select name, id ${users} ${user => user.roles.indexof('admin') >= 0}` notice has nothing string interpolation; uses tagged templates readability. hard construct reads intuitively plain function calls - guess you'd have this: let admins = sql("select name, id $users $filter", { $users: users, $filter: (user) => user.roles.contains('admin') }) this example fun si

r - How to cut/crop/mask autoKrige result with boundary polygon? -

i busy developing module implements autokrige (automap library) on soil sample data 20x20m cell-size. once kriging complete crop/mask kriging result field's boundary. the problem cropping/masking (because of 20x20 cells) border of field gives "step" effect. looking smooth boundary (cutting through cells). below code generate 2 scenarios explained above: library(sp) library(rgeos) #create polygon r1 <- cbind(c(641777, 642290, 642276, 641794), c(7036885, 7036743, 7036154, 7036146)) r2 <- cbind(c(642320, 642478, 642494, 642314), c(7036732, 7036699, 7036296, 7036290)) sr1 <- polygons(list(polygon(r1)),"r1") sr2 <- polygons(list(polygon(r2)),"r2") boundary.sp <- spatialpolygons(list(sr1,sr2)) boundary.sp@proj4string <- crs('+proj=utm +zone=35 +south +datum=wgs84 +units=m +no_defs') #create bounding box grid bbox <- bbox(boundary.sp) boundary.grid <- expand.grid(x = seq(from = bbox[1], = bbox[3], = 20), y = seq(fro

c++ - Matrix manipulation using CUDA -

i trying write program matrix calculations using c/cuda. have following program: in main.cu #include <cuda.h> #include <iostream> #include "teste.cuh" using std::cout; int main(void) { const int ndofs = 2; const int nel = 4; double *gh = new double[ndofs*nel*ndofs*nel]; double *gg; cudamalloc((void**)& gg, sizeof(double)*ndofs*nel*ndofs*nel); (int ii = 0; ii < ndofs*nel*ndofs*nel; ii++) gh[ii] = 0.; cudamemcpy(gh, gg, sizeof(double)*ndofs*nel*ndofs*nel, cudamemcpyhosttodevice); integrag<<<256, 256>>>(nel, gg); cudamemcpy(gg, gh, sizeof(double)*ndofs*nel*ndofs*nel, cudamemcpydevicetohost); (int ii = 0; ii < ndofs*nel*ndofs*nel; ii++) cout << ii + 1 << " " << gh[ii] << "\n"; return 0; } in mtrx.cuh #ifndef teste_cuh_ #define teste_cuh_ __global__ void integrag(const int n, double* g) { const int szmodel = 2*n; int idx = threadidx.x + blockidx.x*blockdim

sql - mysql where clause wrong -

this question has answer here: check constraint in mysql not working 6 answers select c.course_id ,c_title ,start_date ,start_date + duration ,location course c ,offering o o.course_id = c.course_id , o.start_date > sysdate -200; assuming want rows have cost between £300 , £2000: select * [table] cost between 300 , 2000 fill in * columns need.

vb.net - Distinct List(Of String) from two Lists -

i have 2 list(of string) named methodcodes , methoddescriptions . create unique values. e.g. have these values in lists... methodcodes (45, 45, 46a, 46b, 47, 47) methoddescriptions (meth45, meth45, meth46, meth46, meth47, meth47) i need reduce lists this... methodcodes (45, 46a, 46b, 47) methoddescriptions (meth45, meth46, meth46, meth47) actually, unique must values in methodcodes list, count of items must same in both lists. tomas if values in these 2 list have association better idea keep them associated in appropriate data structure such class. a simple class it: private class method public property code string public property description string public sub new(code string, description string) me.code = code me.description = description end sub end class this allows add values this: dim methods new list(of method) methods.add(new method("45", "meth45")) methods.add(new method("45",

Visual Studio 2015 Publish WebJobs Issue -

using right-click, publish azure webjob... option in visualstudio 2015, job published runmode seems ignored. in file, have following settings, job continually set on demand job in portal after publishing: { "$schema": "http://schemastore.org/schemas/json/webjob-publish-settings.json", "webjobname": "myjob", "starttime": "2015-07-21t00:30:00-08:00", "endtime": null, "jobrecurrencefrequency": "day", "interval": 1, "runmode": "scheduled" } using visual studio 2015 azure sdk .net 2.7 here error in output windows after publishing error : error occurred while creating webjob schedule: not load type 'microsoft.identitymodel.clients.activedirectory.activedirectoryauthenticationexception' assembly 'microsoft.identitymodel.clients.activedirectory, version=2.16.0.0, culture=neutral, publickeytoken=31bf3856ad364e35'. based off of

First letter in android keyboard, in an html input text, to lowercase -

i'd first letter on android keyboard appear lowercase when user taps on html text input https://stackoverflow.com/a/5171812/4575543 i found answer. seems work (but apparently not keyboard apps on android , not older browsers). @ least ios covering , chrome since version 43: https://developers.google.com/web/updates/2015/04/autocapitalize additionally set css property text-transform: lowercase; , convert input value on keyup value.tolowercase() – in case.

regex - 8-20 characters, but no spaces allowed anywhere in HTML5 validation -

i trying restrict space entry in html5 validation. tried with ^[a-za-z0-9\*\!\\?\(\)]{8,20}$ and ^[^-\s]{8,20}$. problem restricting @ if try space. if after space enter other space allows space @ starting also. i want no white space should allowed. you may try ^\s{8,20}$ 8 20 non whitespace char.

python - Interpret data listen on socket -

i have code python server listen on port 5000 , interpret data. here code : # -*- coding: utf-8 -*- import binascii import socket udp_ip = "" udp_port = 5000 sock = socket.socket(socket.af_inet, socket.sock_dgram) sock.bind((udp_ip, udp_port)) while true: data, addr = sock.recvfrom(150) currently can't interpret data, try funtion : binascii.b2a_uu() without result. data in frame have same size, , coded on 32 bits. thank help. nicolas. edit : use python 2.7 solution : after recvfrom, store data on tab. each information coded on 32 bits, read table 4 bytes per 4 bytes , use function : struct.unpack(">l", data[0:4])[0] retrive informations. thid allow have ip address on long format

facebook - How do I enable cookies with python requests -

Image
i trying sign facebook python requests. when run following code: import requests def get_facebook_cookie(): sign_in_url = "https://www.facebook.com/login.php?login_attempt=1" #need post: email , pass payload = {"email":"xxxx@xxxx.com", "pass":"xxxxx"} headers = {"accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "user-agent":"mozilla/5.0 (x11; linux x86_64) applewebkit/537.36 (khtml, gecko) chrome/43.0.2357.132 safari/537.36"} s = requests.session() r1 = s.get(sign_in_url, headers = headers, timeout = 2) r = s.post(sign_in_url, data = payload, headers = headers, timeout = 2, cookies = r1.cookies) print r.url text = r.text.encode("ascii", "ignore") fbhtml = open("fb.html", "w") fbhtml.write(text) fbhtml.close() return r.headers print get_facebook_cookie()

c - Storage duration when calling constructor from another function -

i have struct looks this: struct matrix { size_t nrow; size_t ncol; double *data; }; and corresponding constructor: struct matrix *matrix_create(const size_t nrow, const size_t ncol) { struct matrix *m; m = malloc(sizeof(struct matrix)); if (!m) { fprintf(stderr, "memory allocation failed\n"); return null; } m->data = malloc(sizeof(double) * nrow * ncol); if (!m->data) { fprintf(stderr, "memory allocation failed\n"); return null; } m->nrow = nrow; m->ncol = ncol; return m; } now want have function calls constructor , returns pointer struct : struct matrix *matrix_dostuff(const struct matrix *m1, const struct matrix *m2) { struct matrix *dostuff = matrix_create(m1->nrow * m2->nrow, m1->ncol * m2->ncol); /* stuff */ return dostuff; } is well-defined behaviour aka dostuff guaranteed exist after function returns?

scala - Spark Streaming - Create RDD based on delimiter -

i working spark , have stream of messages flowing seperated message-start delimiter, i create seperate rdd each message ie. each time see delimiter character. is possible in spark streaming? edit: class routeconsumer extends actor actorhelper consumer { def endpointuri = "rabbitmq://host:5672/xchange?queue=hl7" def receive = { case msg: camelmessage => val m = msg.withbodyas[string] store(m.body) } } val ssc = new streamingcontext(sparkconf, seconds(3)) val dstream = ssc.actorstream[string](props(new routeconsumer()), "sparkreceiveractor") val dstreamsplit = dstream.flatmap(_.split("msh|^~\\&")) thanks

opendata - SPARQL group by a substring and average -

i querying large data set (temperatures recorded hourly 20 years) , i'd rather summary, e.g. daily temperatures. an example query here: http://www.boisvert.me.uk/opendata/sparql_aq+.html?pasteid=hu5rbc7w prefix opensheff: <uri://opensheffield.org/properties#> select ?time ?temp { ?m opensheff:sensor <uri://opensheffield.org/datagrid/sensors/weather_mast/weather_mast.ic> ; opensheff:rawvalue ?temp ; <http://purl.oclc.org/net/ssnx/ssn#endtime> ?time . filter (str(?time) > "2011-09-24") } order asc(?time) and results this: time temp "2011-09-24t00:00z" 12.31 "2011-09-24t01:00z" 11.68 "2011-09-24t02:00z" 11.92 "2011-09-24t03:00z" 11.59 now group part of date string, daily average temperature: time temp "2011-09-24" 12.3 # or whatever "2011-09-23" 11.7 "2011-09-22" 11.9 "2011-09-21" 11.6 so, how grou

json - Elasticsearch Jackson Date type -

i'm using elasticsearch in order create index. fasty. i chose jackson in order generate elasticsearch index documents so, i've created serializer: public class digitalinputserializer extends jsonserializer<digitalinput> { @override public void serialize(digitalinput value, jsongenerator gen, serializerprovider serializers) throws ioexception, jsonprocessingexception { gen.writestartobject(); gen.writenumberfield("timestamp", value.gettimestamp().gettime()); <<<<<<<<<<<<<<< gen.writestringfield("matter", value.getmatter()); gen.writestringfield("comment", value.getcomment()); gen.writestringfield("channel_id", value.getchannelid()); gen.writeendobject(); } } i've had surprise, when looked writedatefield !!! isn't there! chose index field using long field, i'm losing date type indexabl

logstash - How do I exclude the "fingerprint" field from elasticsearch -

i'm using fingerprint filter in logstash create fingerprint field set document_id in elasticsearch output. configuration follows: filter { fingerprint { method => "sha1" key => "key" } } output { elasticsearch { host => localhost document_id => "%{fingerprint}" } } this results in redundant fingerprint field in elasticsearch that's same value _id . how prevent redundant field being saved es? if you're using logstash 1.5 or higher, can put field in metadata , not sent elasticsearch part of regular message. example: filter { fingerprint { ... target => "[@metadata][fingerprint]" } } output { elasticsearch { ... document_id => "%{[@metadata][fingerprint]}" } }

How can I send an Excel file by email on C#? -

This summary is not available. Please click here to view the post.

jar - Gradle specify build binaries names from command line -

i need specify build binaries names command line in gradle. like: gradle -arg: filename.jar i use in jar{ archivename = "something.jar" } and war{ war.archivename = "something.war" } just how pass parameter build.gradle , use string command line argument. in build.gradle: jar { archivename = myname } in command line: gradle jar -pmyname=customname.jar

wso2 - ERROR - EmbeddedRegistryService Failed to configure the embedded registry -

i want setup cluster wso2esb,i have done database setup specified in link https://docs.wso2.com/display/cluster420/setting+up+the+database . i used postgresql database,i getting below error stack while starting wso2server in cluster mode command sh wso2server.sh -dsetup in linux machine. code in registry.xml <dbconfig name="sharedregistry"> <datasource>jdbc/wso2registrydb</datasource> </dbconfig> <dbconfig name="wso2registry"> <datasource>jdbc/wso2carbondb</datasource> </dbconfig> remote instance code registry.xml <remoteinstance url="https://localhost:9443/registry"> <id>instanceid</id> <dbconfig>sharedregistry</dbconfig> <readonly>false</readonly> <enablecache>true</enablecache> <registryroot>/</registryroot> <cacheid>regadmin@jdbc:postgresql://ip

jquery - How to add Google translate box (single word/sentence, not whole page) to website? -

how add google translate box (single word/sentence, not whole page) website https://translate.google.com/ i got solution. not exact google providing. please improve answer if have better solution. <div class="translate"> <form method="post"> <input type="text" name="input_element" id="target" placeholder="type germen word"> </form> <br> <div class="inpt-el"></div><br> <div class="translate_control" lang="de"></div> </div> <script> function googlesectionalelementinit() { new google.translate.sectionalelement({ sectionalnodeclassname: 'translate', controlnodeclassname: 'translate_control', background: '#f4fa58' }, 'google_sectional_element'); } </script> <script

decode - Deciphering/Decoding Javascript? -

i have script got off web page , i'm trying decipher/decode , figure out doing. did research , unsure how such thing. i'm curious if there tool of sort help? have posted code below. var _0x5490=["length"," ","offsecphun1.gif","offsecphun2.png","getseconds","floor","<img src='","'>","write","offsecphun5.bmp","231ced7347e593276b","-","51e342ff63d20c","20201/"];var sillydate=0;var sillyvar=0;function stringarray(_0x5b7ex4) {this[_0x5490[0]]=_0x5b7ex4;for (var _0x5b7ex5=1;_0x5b7ex5 <= _0x5b7ex4;_0x5b7ex5++) {this[_0x5b7ex5]=_0x5490[1];};};image=new stringarray(10);image[0]=_0x5490[2];image[1]=_0x5490[3];image[2]=_0x5490[2];image[3]=_0x5490[3];image[4]=_0x5490[2];image[5]=_0x5490[3];image[6]=_0x5490[2];image[7]=_0x5490[3];image[8]=_0x5490[3];image[9]=_0x5490[3];var ran=60/image[_0x5490[0]];function _0x5491() {sillydate=new

java - Multiple Response from Single Request using Spring Boot -

is there way achieve multiple responses single request using spring boot ? if yes, please provide me link. http not work way. http request has 1 response. spring boot not let send more 1 response, because against http specification , no http clients able figure out going on. there may way accomplish underlying goals, whatever is, won't involve sending more 1 http response single http request.

javascript - passing data using AngularJS $http.get method -

i'm building application using mean stack make use of data retrieved external api. measure hide api key, want make api request server, having problems passing search term angular front-end server. the code below part of angular controller, should pass request server search term: myapp.controller('maincontroller', ['$scope','$http', '$location', function($scope, $http, $location){ $scope.submit = function(){ $location.path('/results'); $http({method: 'get', url: '/makesearch', data: {term: $scope.term} }); } }]); and following server code parse request using body-parser middleware: app.get('/makesearch', function(req, res) { console.log("i received command!"); console.log(req.body); }); however once try pass/submit search term front-end, empty object on server console. tips on i'm doing wrong? appreciated. i figured out! @rikky made point body of http req

mysql - SQL sort data based on different columns -

Image
i need sql problem. i'm not sure it's possible do, have table: obtained sql statement: select distinct account.box, account.name, account.currency, account.lastupdated, account.lastupdatedby, transactions.totals account left join transactions on account.accountguid = transactions.accountguid what end result: so comparing totals each groups of name or currency, obtain highest totals each group. (null values replaced zeroes). you seem want group by : select a.box, a.name, a.currency, a.lastupdated, a.lastupdatedby, max(t.totals) totals account left join transactions t on a.accountguid = t.accountguid group a.box, a.name, a.currency, a.lastupdated, a.lastupdatedby; note: added table aliases make query easier understand.

vba - Excel does not recognize combo box when file is opened -

i have 9 text boxes, 2 command buttons , 4 combo boxes excel chooses not recognize 1 of combo boxes (combobox4 in case) when file opened after saving. not code complicated either. following error upon opening file: "run-time error '424': object required" line 3 or line 5 depending on combobox1's value when file saved. private sub combobox1_change() if combobox1.value = "single fitment" combobox4.enabled = false else combobox4.enabled = true end if end sub thank you.

javascript - SAPUI5 Deep Insert from Kapsel Offline App on OData V2 Model -

question: how can "deep insert" performed sapui5 client application on odata v2 model? situation: i want deep insert "operation" "components" odata v2 model in sapui5 client application. // request data "operationset" : { "orderid" : "13700090", "operationcomponentset" : [ { "orderid" : "13700090", "activity" : "0010", "subactivity" : "", "componentitem" : "000010" } ] } this.getview().getmodel().create("/operationset", requestdata); i cannot use function create(spath, odata, mparameters?) on odata v2 model documentation says: "please note deep creates not supported , may not work." see https://sapui5.netweaver.ondemand.com/sdk/do

javascript - Modify Twitter Bootstrap collapse plugin to keep accordions open -

i'm trying modify bootstrap collapse plugin allow me specify whether clicking accordion (to open) should automatically close other items in accordion (so more 1 item in accordion can open @ time) i want create new data attribute on accordion, data-collapse-type="auto|manual" the bootstrap jquery plugins bit advanced skill level. relevant part of need mess seems on line 52, actives.collapse('hide') . don't want happen if 'data-collapse-type="manual"' set (omitting attribute or setting auto should keep default behavior). i've created jsfiddle i've been experiementing . can me on right track this? i have forked , updated fiddle. just go .show function, have written comments. http://jsfiddle.net/2rnpz/

javascript - Select2 save current list and values .. -

i using select2.js widget site drop-down selection of long list here i have use ajax loading option ..but when open/click drop-down looses old search text + loaded list , star new .. don't want that.. wanted keep old search text if there if list loaded wanted keep , new @ end of scroll ... code same in select2 example fiddle test var $ajax = $(".js-example-data-ajax"); $ajax.select2({ ajax: { url: "https://api.github.com/search/repositories", datatype: 'json', delay: 250, data: function (params) { return { q: params.term?params.term:"a", // search term page: params.page }; }, processresults: function (data, params) { params.page = params.page || 1; return { results: data.items, pagination: { more: (params.page * 30) < data.total_count } }; }, cache: true }, escapemarkup: function (markup) { return markup; }, minimuminputlength: 0, templateresult:

Oracle SQL - If Exists, Drop Table & Create -

can 1 please guide me what's wrong query? in sql server check presence of object_id of table drop , re-create it. new oracle , wrote query: declare table_exists integer; begin select count(*) table_exists sys.all_tables table_name='tablename1'; exception when no_data_found table_exists :=0; if(table_exists)=1 execute immediate 'drop table tablename1;' 'create table tablename1;'; dbms_output.put_line('table dropped , re-created!'); else execute immediate 'create table tablename1;'; dbms_output.put_line('new table created!'); end if; end; i output - anonymous block completed, table not created. table existing, dropped check if pl/sql creating table, no. wrong here? missing? please guide. the exception clause lasts till next end , not next statement. if want continue after catching exception need add additional begin/end: declare table_exists integer; begin

python - Django: can't add image from site, but it works from Django Administration page -

i try add image form, on site. forms work trough, django administration site perfectly. on site, when press submit button, page reload, , information need add image again. informations, after reload page, stay was, added image disappear. models.py class urlupload(models.model): """docstring """ title = models.charfield(max_length=255) photo = models.imagefield(upload_to='/home/mariusz/web/moje/moje/static/covers/') timestamp = models.datetimefield(auto_now_add=true, auto_now=false) description = models.textfield() category = models.charfield(max_length=100) def __unicode__(self): return self.title forms.py from django import forms .models import urlupload class urluploadform(forms.modelform): class meta: model = urlupload fields = ['title', 'description', 'category','photo'] views.py @login_required def profile(request): if request.method

Spring Boot + JPA2 + Hibernate - enable second level cache -

i'm using spring boot 1.2.5 jpa2 annotate entities (and hibernate underlaying jpa implementation). i wanted use second level cache in setup, entities annotated @javax.persistence.cacheable i added following in application.properties: spring.jpa.properties.hibernate.cache.use_second_level_cache=true spring.jpa.properties.hibernate.cache.use_query_cache=true spring.jpa.properties.hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.ehcacheregionfactory during bootup hibernate complained lack of ehcacheregionfactory added pom: <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-ehcache</artifactid> </dependency> but still queries entitymanager.find(clazz.class, pk) firing db query instead of using cached data. any idea missing? well after more digging here's missing in application.properties : spring.jpa.properties.javax.persistence.sharedcache.mode=all hope helps :)

python - Killing process on Ubuntu with os.system() issue -

i try send command python shell ubuntu os define process existed on particular port , kill it: port = 8000 os.system("netstat -lpn | grep %s" % port) output: tcp 0 0 127.0.0.1.8000 0.0.0.0:* listen 22000/python then: os.system("kill -sigterm 22000") but got following trace sh: 1: kill: illegal option -s for reason command can not transferred os full signal -sigterm , -s . can kill process directly terminal , seems it's python or os issue... how can run kill command using python? appreciated you try using import signal os.kill(process.pid, signal.sigkill) documentation can found here . you use signal.ctrl_c_event , corresponds ctrl+c keystroke event.

javascript - If element has class and another element is empty change class on another element -

i have html structure, snippet there lots more in same structure. <button id="showempty">press</button> <div class="children"> <div class="package"> <span class="name"></span> <span class="value"></span> </div> <div class="package array"> <span class="name"></span> <span class="value"></span> </div> <div class="package"> <span class="name"></span> <span class="value"></span> </div> <div class="package array"> <div class="children"> <div class="package array"> <span class="name"></span> <span class="value"></span> <

c# - Linq every occurrence of value, bind to ViewModel -

i need list of players , every team said player associated , add viewmodel. viewmodel public class playersviewmodel { public long playerid { get; set; } public string playername { get; set; } public list<long> teamid { get; set; } //players can assigned 1 or more teams } i have few different datatables going on: playersinteams (linking table) +------------+---------+ | playerid | teamid | +------------+---------+ | 1 | 10001 | | 1 | 10002 | | 2 | 10002 | | 3 | 10001 | +------------+---------+ players +------------+---------+-----------+ | playerid | forename| surname | +------------+---------+-----------+ | 1 | john | doe | | 2 | pete | noe | | 3 | evan | soe | +------------+---------+-----------+ so above example tables, player 1 - john doe should have array of 2 teamids in viewmodel [10001, 10002]. aim i'm trying have list<p

c# - How to write quotes (" or ') and quoted strings to a Razor view -

i have bunch of constants used in js saved in resx file, such as: date_picker_format yyyy-mm-dd datetime_format yyyy-mm-dd hh:mm:ss month_picker_format yyyy-mm i wrote simple class write js on razor view: public static class javascriptresourcerenderer { private static string render(resourceset resources) { string resourcestring = ""; foreach (dictionaryentry resource in resources) { resourcestring += string.format("var {0} = '{1}'; ", resource.key, resource.value); } return resourcestring; } public static string renderpageconstants() { resourceset resources = pageconstants.resourcemanager.getresourceset(cultureinfo.currentuiculture, true, true); return render(resources); } } and in view, i'm doing this: @section scripts { <script> @javascriptresourcerenderer.renderpageconstants() </script> } the constant

java - How does an interface communicate - Need a detailed answer -

i have fragment class: public class uploadfragmentone extends fragment {} i have subclassed: public interface communicator { void communicate(int position); } in oncreateview: ((communicator) getactivity()).communicate(1); the hosting activity signature: public class detailspager extends fragmentactivity implements uploadfragmentone.communicator {} member function in above activity: public void communicate(int position) { toast.maketext(detailspager.this, "clicked " + position, toast.length_long).show(); } this works charm, dont understand how? sorry might dumb, want know how control flows in this? you should have on following link once.- come query (myactivity)activity.some_method() now suppose going attach same fragment activity mainactivity need - (mainactivity)activity.some_method() now suppose other activity implementing same fragment each time need use instanceof check , call method , add it. agai

Interpret and display different Encodings for email bodies in ruby: -

i using email gem in rails app encountering problems encoding: i working on mail presents way: .... message-id: <22d41f1a16cd5a5719309a96f8c95d50@vcrfnyjsz> from: "=?utf-8?b?iowfqowbvealvowhpowfvoibjowwj+wnkos/oeabrw==?=" <info@nks-media.ru> to: ... ... mime-version: 1.0 content-type: text/html; charset="utf-8" content-transfer-encoding: base64 x-priority: 5 x-msmail-priority: low x-mailer: microsoft outlook express 6.00.2900.5512 x-mimeole: produced microsoft mimeole v6.00.2900.5512 pcfet0nuwvbfiehutuwgufvcteldicitly9xm0mvl0rurcbive1midqumcbucmfuc2l0aw9uywwv l0voij4ncjxive1mihhtbg5zom8gpsaidxjuonnjagvtyxmtbwljcm9zb2z0lwnvbtpvzmzpy2u6 b2zmawnlij48sevbrd4ncjxnrvrbignvbnrlbnq9inrlehqvahrtbdsgy2hhcnnldd11dgytocig ahr0cc1lcxvpdj1db250zw50lvr5cgu+dqo8tuvuqsbuyw1lpudftkvsqvrpuibjb250zw50psjn u0hutuwgoc4wmc42mdaxljizntg4ij48l0hfquq+dqo8qk9ewsbiz0nvbg9ypwfxdwe+dqo8ud48 rk9ovcbjb2xvcj1ncmf5ihnpemu9nj7lhajlm73lsi/lp5dkv6hmga/vvizlrabnlj/lprnkv6hm ga/