Posts

Showing posts from March, 2015

adding reference to native visual c++ project -

i have 2 visual c++ projects in solution. first 1 (lets call main) native code. second 1 (test), has main added reference. test contains unit tests methods in main. when add main reference test , try compile - errors library not found. adding project reference , not add output target path of main library directories of test ? i don't know vc doing under hood, adding reference project doesn't seem have effect of linking libraries unlike c#. you can use code project including , linking via usual method of c++ .

typescript - Javascript Promise.all confusion -

i using javascript/typescript in order format password value on collection of personmodel objects. executing promise on each element in collection. i using promise.all allow promises complete, , want return formatted collection. however, error @ build time. personservice.ts private decryptpersons(persons: personmodel[]): promise<personmodel[]> { return new promise<personmodel[]>(resolve => { let promises: array<promise<string>> = []; let decryptedpersons: personmodel[] = []; (let i: number = 0; < persons.length; i++) { let ciphertext: string = persons[i].password; promises.push(this.decrypt(ciphertext).then((password: string) => { // <== line 357 persons[i].password = password; decryptedpersons.push(persons[i]); })); } promise.all(promises).then(() => { resolve(decryptedpersons); }); }); } privat

java - Scala - error: value max is not a member of my custom class -

i've got own class class foo { mycustomclass value; ... } which consists of mycustomclass java enum following signature: enum mycustomclass{ one(1), two(2), three(3) private int nominal; mycustomclass(int nominal) { this.nominal = nominal; } public int nominal() { return nominal; } } for define ordering as: implicit val mycustomclassordering = new ordering[foo] { override def compare(c1: foo, c2:foo): int = { c1.value.nominal.compareto(c2.value.nominal) } } import mycustomclassordering ._ and i'm able use function max sequence of objects ofmycustomclass type. got error trying use max fucntion in reduceoption function val l = list[foo](...) l.reduceoption(_ max _) got error message: value max not member of ... what should able use in reduceoption max function? max method delegated mycustomclass. either add ordering foo or add method returns foo object according result of max method call

python - Softlayer api: How to check that a VSI has been created an cancelation request on "Anniversary Date"? -

Image
for newly created vsi, can cancel on "anniversary date". api billing_item.cancelitem can helps accomplish it. in website/devicelist of softlayer, canceldevice button unable. my question how check vsi has been created cancelation request on "anniversary date" or not api ? ohter word, want api status of vsi has been submit cancelation request or not. you need see "cancelationdate" property of vsi's billing item if value of property "null" means vsi has not been cancelled. in case vsi has been cancelled in "anniversary date" value of property equals date when machine going canceled see example below "cancelationdate" property of particular vsi: import softlayer username = 'set me' api_key = 'set me' vsiid = 123 client = softlayer.client(username=username, api_key=api_key) vsiservice = client['softlayer_virtual_guest'] objectmask = "mask[id, cancellationdate]" try:

Solr wildcard query with whitespace and synonym -

this problem this: solr wildcard query whitespace have wildcard query looks like: q=location:los a* i'd match "los angeles" , "los altos". query like: q=location:los\ a* works fine, if have synonym logic:(synonym.txt) los,las and use "los l*" match "las lu".seems not work.how can this? the filetype , file config: <fieldtype name="ngram" class="solr.textfield" positionincrementgap="100"> <analyzer type="index"> <tokenizer class="solr.whitespacetokenizerfactory"/> <filter class="solr.worddelimiterfilterfactory" stemenglishpossessive="0" generatewordparts="0" generatenumberparts="0" catenatewords="1" catenatenumbers="0" catenateall="0" splitonnumerics="0" preserveoriginal="1"/> <filter class="solr.asciifoldingfilterfactory"

c# - How to set universal path in method's attribute -

i wrote test. use data driven unit tests. method declaration looks follow: [testcategory("integrationtest")] [datasource("microsoft.visualstudio.testtools.datasource.csv", "c:\\myprojectpath\\file.csv", "file#csv", dataaccessmethod.sequential), deploymentitem("file.csv"), testmethod] public void read_csv_file_attribute() i want commit changes source control. problem have hardcoded path in datasource attribute: "c:\myprojectpath\file.csv". if latest version of code repository person have change path in attribute. how make universal path work c-workers? i've tried change path using: methodinfo method = typeof(testclass).getmethod("read_csv_file_attribute"); method.customattributes.elementat(1).constructorarguments.elementat(1).value = _newpath; it doesn't work because value read-only. [testcategory("integrationtest")] [datasource("microsoft.visualstudio.testtools.datasourc

c# - Webforms and Dependency Injection -

i in process of introducing dependency injection framework existing webforms application (using castle windsor). i have pretty deep experience di, , tend favor constructor injection on setter injection. if familiar webforms, know asp.net framework handles construction of page , control objects, making true constructor injection impossible. my current solution register container in application_start event of global.asax, , keep container public static variable in global well. resolve each service need directly in page or control when need them. @ top of each page, end code this: private readonly imyservice _exposuremanager = global.ioc.resolve<imyservice>(); private readonly imyotherservice _tencustomersexposuremanager = global.ioc.resolve<imyotherservice>(); obviously, don't having these references container scattered application or having page/control dependencies non-explicit, have not been able find better way. is there more elegant solution using d

ssl - How to add a certificate to a sub-sub-domain with Cloudflare? -

i'm wondering how add ssl certificate sub-sub-domain on cloudflare example maintenance.login.example.com i've added sub-sub-domain site keep getting error this site can’t provide secure connection maintenance.login.example.com sent invalid response. try running windows network diagnostics. err_ssl_protocol_error our default/free certificates—"universal ssl"—cover apex of domain (example.com) , 1 level of wildcard (*.example.com). if you'd cover additional levels beyond that, e.g., *.test.example.com or maintenance.login.example.com, can either purchase dedicated certificate custom hostnames or can upload custom certificate business plan or higher. i wrote blog post describing dedicated certificates here: https://blog.cloudflare.com/dedicated-ssl-certificates .

javascript - ng-repeat, link item with another arrays item -

i trying create unsorted list (organizational structure) 2 data arrays (department, employees) use ng-repeat dynamically display departments unable populate each department employees. both of arrays have common departmetntid field here dummy.html <div ng-app="myapp" ng-controller="myctrl"> <div ng-repeat="dept in mydata" > <ul class="list"> <%--level 1--%> <li>{{dept.ouname}} <span ng-if="dept.children.length > 0"> <ul> <%--level 2--%> <li ng-repeat="a in dept.children">{{a.ouname}} <%--level 3--%> <span ng-if="a.children.length > 0"> <ul> <li ng-repeat="b in a.children">{{b.ouname}} <%--level 4--%> <span ng-if="b.children.length > 0"> <ul> <li ng-repeat="c in b.children"&g

python - How to real-time filter with scipy and lfilter? -

disclaimer : not dsp should , therfore have more issues getting code work should have. i need able filter incoming signals happen. i've tried make code work, can not life of me work. referencing scipy.signal.lfilter doc import numpy np import scipy.signal import matplotlib.pyplot plt lib import fnlib samples = 100 x = np.linspace(0, 7, samples) y = [] # unfiltered output y_filt1 = [] # real-time filtered nyq = 0.5 * samples f1_norm = 0.1 / nyq f2_norm = 2 / nyq b, = scipy.signal.butter(2, [f1_norm, f2_norm], 'band', analog=false) zi = scipy.signal.lfilter_zi(b,a) zi = zi*(np.sin(0) + 0.1*np.sin(15*0)) this sets zi zi*y[0 ]initially, in case 0. taken example code in lfilter doc. not sure if correct @ all. then comes point i'm not sure intial few samples. , b coefficients len(a) = 5 here. lfilter needs input values n-4, pad zeroes, or need wait until 5 samples has gone by, sample block, continually sample each next step? for in range(0, len(a)-1): # appen

c++ - Why doesn't boost regex '.{2}' match '??' -

i'm trying match chunks if interesting data within data stream. there should leading < 4 alphanumeric characters, 2 characters of checksum (or ?? if no shecksum specified) , trailing > . if last 2 characters alphanumeric, following code works expected. if they're ?? though fails. // set pre-populated data buffer example std::string haystack = "fli<data??>bble"; // set regex static const boost::regex e("<\\w{4}.{2}>"); std::string::const_iterator start, end; start = haystack.begin(); end = haystack.end(); boost::match_flag_type flags = boost::match_default; // try , find of interest in buffer boost::match_results<std::string::const_iterator> what; bool succeeded = regex_search(start, end, what, e, flags); // <-- returns false i've not spotted in the documentation suggests should case (all null , newline should match aiui). so have missed? because ??> trigraph , converted } , code equivalent to:

How a service administrator get enough permission to create azure custom roles -

i'm trying create custom role in azure (rbac). when execute powershell command new-azurermroledefinition here message saying i'm not authorized create it. > new-azurermroledefinition .\developer_access_rbac.json new-azurermroledefinition : authorizationfailed: client 'admin@company.com' object id '{guid}' not have authorization perform action 'microsoft.authorization/roledefinitions/write' on scope '/providers/microsoft.authorization/roledefinitions/{guid}'. @ line:1 char:1 + new-azurermroledefinition .\developer_access_rbac.json + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : closeerror: (:) [new-azurermroledefinition], cloudexception + fullyqualifiederrorid : microsoft.azure.commands.resources.newazureroledefinitioncommand i asked 1 of our administrators in our organization , says account admin@company.com global administrator. , in active directory admin@company.com displayed

apache spark - Scala - Dynamic Code generation using scala reflection -

i have requirement need add multiple columns spark dataframe. i using dataframe.withcolumn adding new column. want code dynamically generated @ run time new columns added defined user @ run time. i'm using eval.scala in below link dynamic execution eval.scala https://gist.github.com/xuwei-k/9ba39fe22f120cb098f4 the code below works: val df: dataframe = sqlcontext.read.load("somefile.parquet") val schema = structtype( structfield("k", stringtype, true) :: structfield("v", integertype, false) :: nil) //create empty dataframe var df2: dataframe = sqlcontext.createdataframe(sc.emptyrdd[row], schema) //add new column eval[unit](s"${df2 = df.withcolumn("""segment""", lit("""soft drinks"""))}") //displays dataframe content df2.show when try build code above string , pass eval, fails var strdf: string= "df2 = df.withcolumn(" + ""

Bitrix Tasks report -

i pull report of tasks start date, end date, status of tasks created in bitrix of users. i have administrative access of bitrix in self hosted version. how can this. pl advice. regards, param pandya it not clear question whether question bitrix site manager cms or bitrix24 collaboration platform. if mean bitrix site manager, mean tasks 2.0. there no information available on in english, can visit page https://www.1c-bitrix.ru/products/intranet/features/tasks.php#tab-report-link describes on how make reports on tasks, , translate automatically, example via google chrome browser.

javascript - Vue.js - Inconsistencies between model and rendered content -

i have following minimum example: <html> <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.1/jquery.min.js"></script> <script src="https://unpkg.com/vue/dist/vue.js"></script> </head> <body> <div id="app"> <ol> <li v-for="series in currentseries" v-bind:data-id="series.id"> id <% series.id %> <a href="javascript:;" class="removeseries">x</a> </li> </ol> </div> </body> <script> vm = new vue({ el: '#app', delimiters: ["<%", "%>"], data: { currentseries: [{id: "1"}, {id: "2"}, {id: "3"}] }, methods: { removeseries: function(id) { this.currentseries = this.currentseries.filter(function(element) {

c++ - QT: Scrolling 2 QPlainTextEdits at the same time -

Image
i want create internal tool usage 2 qplaintextedits. want make functionality when scroll 1 text edit other scrolled also. tried figure out http://doc.qt.io/qt-4.8/qt-widgets-codeeditor-example.html not work expected here code: customedit.h #ifndef customedit_h #define customedit_h #include <qplaintextedit> class customedit : public qplaintextedit { q_object public: customedit(qwidget *parent = 0); public slots: void updateposition(const qrect &, int); }; #endif // customedit_h customedit.cpp #include "customedit.h" customedit::customedit(qwidget *parent) : qplaintextedit(parent) { } void customedit::updateposition(const qrect &rect, int position) { if (position) { this->scroll(0, position); this->update(0, rect.y(), this->width(), rect.height()); } else { this->update(0, rect.y(), this->width(), rect.height()); } } mainwindow constructor mainwindow::mainwindow(qwidget

Jenkins issue with docker push to private repo -

i'm running jenkins server on dc/os, , got private registry in same dc. the private registry not have ssl certificate , push images mac used following command ocker-machine ssh default "echo $'extra_args=\"--insecure-registry \"' | sudo tee -a /var/lib/boot2docker/profile && sudo /etc/init.d/docker restart" so worked fine. on jenkins tried set docker_opts see https://docs.docker.com/registry/insecure/ but figured build running on agent, how configure jenkins worker trust private registry? if installed jenkins mesosphere universe, default jenkins agent container uses docker-in-docker. see dc/os jenkins service guide how configure docker run parameters add environment variables: https://docs.mesosphere.com/1.8/usage/service-guides/jenkins/advanced-configuration/

Get adress of 2d Array to IntPtr in C# -

i have c program want reprogram in c#. in c program, function used accesses address of 2d array. dll.h int fg_addmem(fg_struct * fg, void *pbuffer, const size_t size, const frameindex_t bufferindex, dma_mem *memhandle); programm.cpp: #include "dll.h" . . #define buffers 4 #define buffersize(1024*1024) static char buf[buffers+1][buffersize] (int i=0; i<buffers; i++) { int ret = fg_addmem(fg, buf[i], buffersize, i, mhead); . . } now want programm in c# first, created class import dll function on pinvoker addon cam_siso.cs: [dllimport ("fglib5.dll", setlasterror = true, callingconvention = callingconvention.cdecl)] public extern static int fg_addmem(intptr fg, intptr pbuffer, int size, int bufferindex, intptr memhandle); i'm created backgroundworker for-loop application.cs: int bufcnt=4; int buffersize = 1024*1024; backgroundworker worker_current_add_mem; . this.load += new eventhandler(this.add_mem_backgroundworker); . private void

javascript - Gulp Task completes with no error but no file is saved to destination -

i stuck in kind of trivial issue , can not hang of it. here scenario: i using gulp task convert html templates javascript using gulp-html2js environment node v6.9.1, gulp 3.9.1, windows 7 here gulpfile.js var gulp = require('gulp'); var concat = require('gulp-concat'); var html2js = require('gulp-html2js'); var sourcedir = "d:\programs_insalled\nodejs\nodeapps\myapp" gulp.task('templates', function() { return gulp.src( 'd:\programs_insalled\nodejs\nodeapps\myapp\templates\*.html'). pipe(html2js({outputmodulename: 'templates'})). pipe(concat('templates.js')). pipe(gulp.dest('d:\programs_insalled\nodejs\nodeapps\myapp\bin')); }); when run task, completes, in few m-sec templates.js not generated in bin directory d:\programs_insalled\nodejs\nodeapps\myapp>gulp templates [15:28:45] using gulpfile d:\programs_insalled\nodejs\nodeapps\myapp\gulpfile.js [15:28:45] starting 'templat

javascript - Bootstrap4 Tooltip toogle -

i'm looking have toggle bootstrap tooltip when video has been watched tooltip has green background, when it's unselected has red backgronund. i've got half working when start clicking through tabs doesn't update propertly. full jsfiddle: https://jsfiddle.net/an437a2l/2/ js: $(".input-group__btn").on("click", function() { $(this).children(".fa-arrow-right").toggleclass("fa-arrow-down"); $(this).siblings(".results").fadetoggle(); }); $(".results__selection").on("click", function() { $(this).children(".fa-check").toggle(); $(this).children(".results__deselect").toggleclass("results__show"); if ($(".results__deselect").hasclass("results__show") && $(this).children(".results__deselect").css("display") === "inline") { $("body").addclass("tooltip-deselected"); } else {

Scope of temporary tables in SQL Server -

i wrote stored procedure import , transform data 1 database another. each import take single company id , import data related company. to transformation step use temporary tables. part of script review, told use table variables rather temporary tables. reviewer claims if run 2 different imports @ same time, temporary table shared , corrupt import. questions: is true temporary table shared if run 2 different imports @ same time? does each call exec create new scope? here contrived example of script. create proc [dbo].[importcompany] ( @companyid integer ) exec [dbo].[importaddress] @companyid = @companyid --import other data create proc [dbo].[importaddress] ( @companyid integer ) create table #companies (oldaddress nvarchar(128), newaddress nvarchar(128)) insert #companies(oldaddress, newaddress) select address oldaddress, 'transformed ' + address newaddress [olddb].[dbo].[addresses] companyid =

PostgreSQL SHOW work_mem shows 16GB but configured to 1024MB -

i'm working on postgresql 9.4 , wondering work_mem . if query show work_mem; i get: work_mem text 16gb however if grep config file (the file show config_file ) get: work_mem = 838860kb # min 64kb work_mem = 1024mb # pgtune wizard the configuration option 16gb temp_buffers . change work_mem value?

php - MySQL Workbench 6.0 - incorrect syntax template -

Image
i new using mysql workbench, discovering now. i can't find clear tutorial or documentation explain why syntax. i have table, called chefs, id, name , country columns. want populate table, using mysql workbench, following tutorial, end doing right click on table want insert, click "send sql editor", , click on "insert statement". when this, template appears on query screen this: insert `cooking_book_new`.`chefs` (`id`, `name`, `country`) values (<{id: }>, <{name: }>, <{country: }>); i have checked , verified, if use regular syntax use use mysql inserts row: insert chefs (id, name, country) values (1, 'chef1', 'country1'); but, whole point of trying use software make easier, know why prepares query, , how should introduce data there. i have tried this: insert `cooking_book_new`.`chefs` (`id`, `name`, `country`) values (<{1}>, <{'chef1'}>, <{'country1'}>); and this: insert

bash - Returning only a part of the string from a grep result -

this question has answer here: can grep show words match search pattern? 13 answers i'm using grep on text file containing simple logs in following form:- [abc.txt] 1=abc|2=def|3=ghi|4=hjk|5=lmn|6=opq 8=rst|9=uvx|10=wyz . . . . and on the values tags 1,2,3,4 etc different throughout file , include special characters in case too. there way can retrieve value tag 4 , no other tags via grep? btw,this log file result of grep .so please advice if should redirect output first , apply second grep or apply second grep on first one,considering it's large file. you pipe result of grep cut, split fields "|" , select fourth field [your grep command] | cut -d | -f 4 if want "4=" gone can same using cut second time time using "=" delimiter. http://pubs.opengroup.org/onlinepubs/009695399/utilities/cut.html

algorithm - F# syntax with sets and updating -

in f# im trying remove occurence in set if condition met, it's not working way i'd to. the trick removing elements set function set.filter , takes function argument - filter feed in every value of set function, , add new set if function returns true . example implementation might be: let filter f (original : set<'t>) = set [ value in original if f value yield value ] which has type filter : ('t -> bool) -> set<'t> -> set<'t> . example of using be filter (fun x -> x % 2 = 0) (set [ 1; 2; 3; 4; 5 ]) this filters set numbers, return value set [ 2; 4 ] . i'm not entirely sure problem you're having exactly, here solution game mastermind using knuth's algorithm, albeit random starting guess, rather choice of "1122". i thought quite nice exercise, though writing checkguess function hardest part of me! you can run test opening in f# interactive running function playmastermind () , s

Fixed effects in R for a Stata user -

i've looked similar question haven't yet found i'm looking for. in stata, can run model below panel data (school , time fixed effects): xi: areg total i.year*group_dummy, absorb(school) cluster (school) how run similar regression in r using plm package? this tried: model1 <- plm(total ~ group_dummy, na.action = na.omit, data = pdlong, method = "within", index = c("school", "year"), effect = "twoway") but error message (and unsure how should interpreted): error in x[, ii] : subscript out of bounds

php - cURL error 60: laravel cant send notification -

i using guzzle in laravel send email , slack notification. getting error : requestexception in curlfactory.php line 187: curl error 60: ssl certificate problem: unable local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) how can fix it?

java - android class missing in Android project -

i'm trying sqlite database work, i'm following this youtube guide . i'm having trouble implementing database helper class. can see photo, have db_controller class cannot use newcustomer class won't resolve symbol. i've tried cleaning , rebuilding project cannot resolve problem. screenshot there no such class in android sdk. please watch video more carefully, , see on 1:55 time author starts implement db_controller class manually.

Android Wear App Development -

i want develop custom app in android wear (below 2.0 version). possible below 2.0 versions ? note: tried app using 2.0 preview version. working fine yes, possible use older version develop custom apps in android wear. however, there limitations in using older version , unlike version 2.0 can access internet directly on bluetooth, wi-fi or cellular relying on data layers apis . there numerous updates in can find in version 2.0. below link of what's new in android wear 2.0: http://android-developers.blogspot.com/2016/05/android-wear-20-developer-preview.html

c++ - Why my string isn't taking the input correctly the second time? -

my code takes string , displays index position letters after space shows odd indexed letters. if give input hacker should give hce akr . here code isn't giving me right answer second input. on giving 2nd input rank should give rn ak . instead of gives k .here misses r . #include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> using namespace std; void f(string a) { string odd,even; for(int i=0; a[i] != '\0'; i++) { if(i % 2 == 0) { = + a[i]; } else { odd = odd + a[i]; } } cout << << " " << odd << "\n";//<<<<<<i think \n //problem need \n.i obeserved on removing \n, codes // works correctly. } int main() { /* enter code here. read input stdin. print output stdout */ string str; int t; cin >> t; for(int i=0; < t; i++) {

mysql - Activerecord group/order by existing array -

my db schema user (id,name etc) video-stream (id ,userid, viewercount) - one-to-one (a user can have 1 video stream) followed_streams (userid,streamid) - many many table (a user can follow many streams , streams can followed multiple users) my /streams url has below way sort data recieved mysql @streams = stream.order(viewers: :desc).page(params[:page]).per_page(16) basically, results being sorted viewer count i want add function sorts initial table showing followed streams first followed streams show in first result. i have below gives me array of streamids user has followed this @followed_streams = followed_streams.where('user_id': @user.id) is there way can cross-reference @followed_streams initial stream table , sort followed ids top?

ios - When we upload the build on iTunes we have facing that Build on iTunes always show processing -

Image
when upload binary build xcode succesed not show on itunes build when upload build on itunes have facing build on itunes show processing please resolve issue. can't release build after long time. try upload app application loader. using xcode face issue often.

javascript - Copy the text to clipboard using any language in ios other than native language -

running code there textbox has text in , button. when press button, should copy of text in textbox clipboard.it running in except ios doesn't support document.execcommand( came know using thread ). know states "it's not possible programmatically copy text/value in clipboard on ios device using javascript". bt still want ask if there method directly or indirectly this.

maximo anywhere - Customization mixin Best Practice for StatusChangeHandler.commitWOStatusChange -

i tried best practice posted here: https://www.ibm.com/developerworks/community/blogs/a9ba1efe-b731-4317-9724-a181d6155e3a/entry/best_practices_for_customizing_maximo_anywhere_javascript?lang=en customizing statuschangehandler.commitwostatuschange function. took copy of original function described: var originalcommitwostatuschange = statuschangehandler.commitwostatuschange then wanted use such: commitwostatuschange: function(eventcontext) { if(conditionsarefalse) { message user fix conditions; } else { originalcommitwostatuschange(eventcontext); } essentially want ensure allowed perform status change according custom conditions (worklog entered example). however when framework hits code, executes original function without testing conditions. seems variable store function causes run , ignore rest of code. am doing in right manner or need follow different process control running of change status? if remove variable can hit code calling original function dir

algorithm - How to Sort given Array in sorted odd and Sorted Even in same array In C++? -

the given array a[]={200,100,25,67,3,56,10,78,7,11} the expected output a[] ={3,7,11,25,67,10,56,78,100,200} where first 5 numbers odd numbers in ascending order, , next 5 numbers in ascending order. if knew algorithm please share here. consider std::vector, need provide custom comparer std::sort indicating odds "less" numbers: auto odd_even_comparer =[](int a, int b){ if( % 2 == b % 2 ) return < b; else if(a % 2 == 1 && b % 2 == 0 ) return true; else if(a % 2 == 0 && b % 2 == 1 ) return false; // in case return a<b; } and make call: std::sort(a.begin(), a.end(), odd_even_comparer); output: 3, 7, 11, 25, 67, 10, 56, 78, 100, 200

sql server - SQL query diversification -

how can diversify sql query in following manner: if condition_a select * x if condition b select * b x it seems trivial operation, cannot find or figure out solution. you can use if condition if condition_a begin select * x end if condition_b begin select * b x end if there can 1 condition satisfied out of two, change second if else statement

java - put method in the json object adds value to the first of the jsonobject; -

consider following piece of code: jsonobject json = new jsonobject(); json.put("one", 1); json.put("two", 2); json.put("three", 3); if print jsonobject prints this {"three":"1","two":"2","one":"1"} but want this. {"one":"1","two":"2","three":"3"} please help. in advance. the documentation @ http://www.json.org/javadoc/org/json/jsonobject.html says: a jsonobject unordered collection of name/value pairs. in other words, properties of object accessed name, not position , default serialized form not guarantee specific order. strict positioning comes arrays: jsonarray json = new jsonarray(); json.put("1"); json.put("2"); json.put("3"); json.tostring(); // results in ["1", "2", "3"] the easiest workaround solve problem use sortedkeys() me

sql - Code SSRS report to format -1 to Yes -

i have sql query displaying "-1" when selection made (this done through external script writing table) i'm wondering if can me code apply ssrs report auto format "yes"? thanks in advance two possible solutions can think of: modify query returns data report returns correct string in additional column depending on column of "boolean" column. in report, display value of new column. instead of displaying field value in report element directly, use expression report element , set =iif(dataset!field.value = -1, "yes", "no") .

c++ - Fill runtime data at compile time with templates -

i have specific situation in prepare runtime structures @ compile time without need duplicate code. i have 2 structs use register @ compile time types compiler wrote: using typeid = u8; template<typename t, typename type_id, type_id i> struct typehelper { static constexpr type_id value = std::integral_constant<type_id, i>::value; }; template<typename t> struct type : typehelper<t, u8, __counter__> { static_assert(!std::is_same<t,t>::value, "must specialize type!"); }; these used in config header macro specialize type<t> multiple types require: using type_size = unsigned char; #define get_nth_macro(_1,_2,_3, name,...) name #define register_type(...) get_nth_macro(__va_args__, register_type3, register_type2, register_type1)(__va_args__) #define register_type1(_type_) register_type2(_type_, _type_) #define register_type2(_type_,_name_) \ constexpr typeid type_##_name_ = __counter__; \ template<> struct type<_type_&

c# SetCompatibleTextRenderingDefault must be called before the first -

i tried search exception couldn't find solution on case i'am using code below invoke .net application : assembly assem = assembly.load(data); methodinfo method = assem.entrypoint; var o = activator.createinstance(method.declaringtype); method.invoke(o, null); the application invoked has form , in entrypoint of application : [stathread] static void main() { application.enablevisualstyles(); application.setcompatibletextrenderingdefault(false); //exception application.run(new form1()); } setcompatibletextrenderingdefault must called before first iwin32window object created in application. edit : assembly = assembly.load(data); methodinfo method = a.gettype().getmethod("start"); var o = activator.createinstance(method.declaringtype); method.invoke(o, null); you should create new method skips initialization

apache - Codeigniter - removing index.php causes links to break -

i experiencing issue index.php in url whereby when removed links controller no longer working ? i have modified following: config.php: $config['index_page'] = ''; uri protocol was: $config['uri_protocol'] = 'request_uri'; .htaccess: rewriteengine on rewritebase /ampp/ rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php/$1 [l] i have verified phpinfo(); module mod_rewrite loaded. current url in format: http://localhost:100/ampp/ the login form on main page: <form class="form-signin" method="post" action="<?php echo site_url('auth/login') ?>"> <span id="reauth-email" class="reauth-email"></span> <input type="email" id="inputemail" class="form-control" placeholder="email" name="email" required autofocus> <input type="password

bash - list all files matching a given pattern -

i have directory /folder1/folder2 containing 2 type of files: file.txt file.txt0* (* means number) i wrote script list files matching pattern "file.txt0*" occurrencies in folder "/folder1/folder2": find -wholename /folder1/folder2/file.txt0* but returns nothing. any suggestion? make sure in proper relative directory. below should work, if in root folder , folder1/folder2 present in / (root) find /folder1/folder2 -iname file.txt0* -i case-insensitive search.

angular - error with interpretation of CSS resources in Django REST + Angular2 -

i'm try deploy app on pythonanywhere , stuck problem. i'm have error: resource interpreted stylesheet transferred mime type text/html i don't know why it's happening. in localhost working fine. full stack trace: resource interpreted stylesheet transferred mime type text/html: " http://rodion.pythonanywhere.com/static/node_modules/bootstrap/dist/css/bootstrap.min.css ". rodion.pythonanywhere.com/:12 resource interpreted stylesheet transferred mime type text/html: " http://rodion.pythonanywhere.com/static/bower_components/alertify.js/themes/alertify.core.css ". rodion.pythonanywhere.com/:13 resource interpreted stylesheet transferred mime type text/html: " http://rodion.pythonanywhere.com/static/bower_components/alertify.js/themes/alertify.bootstrap.css ". rodion.pythonanywhere.com/:14 resource interpreted stylesheet transferred mime type text/html: " http://rodion.pythonanywhere.com/static/styl

video.captureStream not supported chrome 54 -

when try run example code from: https://webrtc.github.io/samples/src/content/capture/video-pc/ on google chrome version 54.0.2840.90 (64-bit) on linux mint, it's not working. firefox works fine. what's problem? i noticed same issue , seems have enable "experimental web platform features" in chrome in order demo work. go chrome://flags search "experimental web platform features" enable , relaunch. unfortunately still doesn't work properly, @ least when loading page initially. if drag player location though, seems work.

javascript - Parse JSON array to object -

i need parse json array object in angular, if correct got no idea how that. have read few posts, , there many on subject reason can not right. link json: http://wingfield.vmgdemo.co.za/webapi/view_stock_complete //js app.controller('showroom', function($scope, $http) { $http.get('http://wingfield.vmgdemo.co.za/webapi/view_stock_complete'). then(function(response) { $scope.view_stock_complete = response.data; }); }); //html <div class="container" ng-controller="showroom"> <div><span>variant: {{view_stock_complete.stock_id}}</span></div> </div> your data array, you'll need loop on them using ng-repeat , or access first entry using view_stock_complete[0] (function(){ 'use strict'; angular.module('test', []) .controller('testcontroller', testcontroller); testcontroller.$inject = ['$http']; function testcontro

mysql - Combining two tables - database OLEDB -

i have 2 tables in 1 database file: first table: clientid firstname middlename lastname contactnum emailadd 200 xxxxx yyyyyy zzzzz 00000000 example@yahoo.com second table: employeeid firstname middlename lastname contactnum emailadd 100 xxxxx yyyyyy zzzzz 00000000 example@yahoo.com how can connect it? i tried using innerjoin there's wrong database or code? objcomm = new oledbcommand("select tblclient.clientid, tbllawyer.employeeid tblclient inner join tbllawyer on tblclient.clientid = tbllawyer.employeeid", objconn) objadap = new oledbdataadapter(objcomm) objadap.fill(objdt) if objdt.rows.count > 0 dgregister.datasource = objdt dgregister.columns(0).visible = false objdt = new datatable objcomm = new oledbcommand("select tblclient.clientid, tbllawyer.employeeid tblclient inner join tbllawyer on tblclient.clienti

Letterpress effect with CSS -

Image
i want make letterpress effect this: in css. can't seem find right text-shadow it. color of word: #2f4050 color of background: #4f6478 i've tried with: .letterpress { color:#2f4050; font-family:tahoma, helvetica, arial, sans-serif; font-size:70px; font-style:normal; font-variant:normal; font-weight:normal; line-height:normal; text-align:center; text-shadow:#4f6478 0 1px 5px; } but doesn't seem trick. .letterpress { color:#2f4050; font-family:tahoma, helvetica, arial, sans-serif; font-size:70px; text-align:center; text-shadow: 0 1px 1px #fff; } that should it. btw. don't have declare "normal" value pairs

php - Automate mailto process -

how can automate mailto process, instead of new compose window pop in 1 of mail clients possible have email send in background, not having user click send. overall want receive email 1 of customers contains there choice "approved" or "rejected" , have them press on either button , email sent automatically , maybe after have clicked on button have redirect them page stating decision made etc. if it's not possible automatically send email there inbox without there permission speak it'll automated there way capture or there email along there choice , have send orders@macwearembroideryclothing.com approve & reject button code: <a href="mailto:orders@macwearembroideryclothing.com?subject=review&body=rejected" style="background: #222222; border: 15px solid #222222; padding: 0 10px;color: #ffffff; font-family: sans-serif; font-size: 13px; line-height: 1.1; text-align: center; text-decoration: none; display: block; border-radius

MySQL Union and JOIN -

i have following tables purchase_order item ------------------ ------------ id (pk) id (pk) deleted deleted name name purchase_order_id (fk) how return list of items linked non-deleted, non-null purchase_order, , purchase_orders have no items linked them, either deleted or not. e.g example tables purchase_order id name deleted --------------------------- 1 big sale 0 2 other sale 1 3 empty sale 0 item id name deleted purchase_order_id ---------------------------------------------- 1 fruit 1 1 2 bread 0 1 3 water 0 2 the correct query gives me this: po_id name item_id name ------------------------------------ 1 big sale 2 bread 3 other sale null null edit: i've got problem stipulating i.deleted = 0, stops rows don't join o

swift3 - swift 3 override init does not override / cannot find overloads -

i can't seem extend class cocoapod ra1028/former in application right initializers parent class. why this? see below situation divided code pod , application code (extendedformlabelheaderview class) // ra1028/former cocaopod class signatures public protocol formableview: class {} public protocol labelformableview: formableview {} open class formheaderfooterview: uitableviewheaderfooterview { required public init?(coder adecoder: nscoder) { super.init(coder: adecoder) } override public init(reuseidentifier: string?) { super.init(reuseidentifier: reuseidentifier) } } open class formlabelheaderview: formheaderfooterview, labelformableview { required public init?(coder adecoder: nscoder) { super.init(coder: adecoder) } override public init(reuseidentifier: string?) { super.init(reuseidentifier: reuseidentifier) } } // app code open class extendedformlabelheaderview: formlabelheaderview { required pub