Posts

Showing posts from January, 2011

Symfony 2 - When and why does a route parameter get automatically converted? -

i have route: pfs_platform_home: path: /{page}/{reset} defaults: { _controller: pfsplatformbundle:advert:index, page: 1, reset: true } requirements: page: \d* reset: true|false if use link without specifying reset , router uses default value , in indexaction, reset parameter automatically converted boolean true . i.e.: <li><a href="{{ path('pfs_platform_home') }}">inicio</a></li> but when that, time $reset appears string 'false' in indexaction, not boolean: <a href="{{ path('pfs_platform_home', {'page': p, 'reset': 'false'}) }}">{{ p }}</a> what missing? url paths , parameters strings. if have url like http://example.com/page/true?foo=2&bar=false the server cannot know true should interpreted boolean, while foo supposed integer , bar supposed boolean, too. if want process url parameters, pass , treat them strings. later, can vali...

swift - Xcode 6.3.2 runs all the tests instead of just the one I selected (KIF) -

Image
this question similar to: xcode run tests (even disabled ones) but different in i'm not disabling tests. i'm pressing single test icon next test function or test case: a friend of mine running kif in swift project , has no problem this. i'm guessing it's setup: i have main xcworkspace file contains main target, unit tests target, , automated tests target (which contains kif tests). workspace has pods project, using frameworks. that's it. here's scheme setup: i've experienced issue in released versions of xcode 6. edit i found workaround time being. you have modify each of test classes (white space changes fine). trigger xcode index files , recognize tests , test cases , generate symbols & icons them in test navigator. (it's recommended delete derived data first remove "ghost tests".) if don't each test case class, unrecognized test case classes run, if select 1 test run. once force xcode recognize test class...

Changing the GetOutput() Method so it returns details C# -

this sort of last resort kind of thing. given question on 1 of labs i'm having issues , can't sort out or understand i'm bad @ c#! anyway initial question is: in class dogchorus , change getoutput() method returns details of dogs created including number of legs dogs have. there hint 'you need call static nooflegs property created through class name. help/ tips can give me appreciated! code below both classes: namespace hellodogs { class dog { private string barksound; private string breed; private int dogheight; private static int nooflegs; public static int nooflegs { { return dog.nooflegs; } set { dog.nooflegs = value; } } public int dogheight { { return dogheight; } set { dogheight = value; } } private string dogcolour; public string dogcolour { { return dogcolour; } set { dogcolour = value...

mysql - Should I use a single table for many categorized rows? -

i want implement user event tracking in website statistics etc. thought creating table called tracking_events contain following fields: | id (int, primart) | | event_type (int) | | user_id (int) | | date_happened (timestamp)| this table contain large amount of rows (let's assume @ least every page view tracked event , there 1,000 daily visitors site). is practice create table event_type field differentiate between different, yet identically structured rows? or better idea make separate table each type ? e.g.: table pageview_events | id (int, primart) | | user_id (int) | | date_happened (timestamp)| table share_events | id (int, primart) | | user_id (int) | | date_happened (timestamp)| and on 5-10 tables. (the main concern performance when selecting rows where event_type = ... ) thanks. it depends. if need have them separated, because querying them separately, splitting them 2 tables should fine. saves having store discriminator column. but....

python 3.x - Call multiple numbers sequentially using twilio outgoing call -

so i'm using twilio api outgoing calls list nums = ['xxx-xxx-xxxx', 'jjj-jjj-jjjj'] num in nums: c = make_call(num, "hi-how-are-you!!!") and make_call function contains twillio code def make_call(to_number, mesg): global call_status = ['completed', 'failed', 'busy', 'no_answer'] # put own credentials here account_sid = "--------------------" auth_token = "--------------------" client = twiliorestclient(account_sid, auth_token) call = client.calls.create( to=to_number, from_=from, url=url+"/voice/reply/"+mesg, method="post", status_callback=url+"/voice/status", status_callback_method="post", timeout=10 ) return call no idea i'm doing wrong, queues both , calls them both @ same time. if pick on call, other 1 ends. want call sequentially, , putting ti...

cordova-plugin-whitelist request cordova iOS 4.0.0 or above -

i wanted add plugin : https://github.com/apache/cordova-plugin-whitelist requires cordova ios 4.0.0 or above. i able update ios 3.8.0 how can ? thank help. i found solution : cordova platform add ios@4.0.x --usegit

r - Removing repeated letters/alphabets -

input : kdff455556tfkkkw output1 : kdf[2]45[4]6tfk[3]w hint: repeated "alphnum" alphnum[no_of_repetition] s <- c('kdff455556tfkkkw','abc','abbccc'); sapply(strsplit(s,''),function(x) paste(with(rle(x),ifelse(lengths==1,values,paste0(values,'[',lengths,']'))),collapse='')); ## [1] "kdf[2]45[4]6tfk[3]w" "abc" "ab[2]c[3]"

ssh - copy key pair to amazon -

i have run trouble i have ec2 instance. connected via ssh. wanted set post hook git. , accidentally removed authorised_keys /.ssh directory my question : if still connected aws instance can copy mykey.pem /.ssh directory ? i want omit instance restore process thank in advance !)) if can't find public key corresponds current .pem file, generate new key pair, , add public key ~/.ssh/authorized_keys file! use aws generate new key pair, or check out these popular instructions github: help.github.com/articles/generating-ssh-keys.

node.js - Understanding Proper Structure of a Node Application -

Image
i'm trying figure out how best architect app. starters trying understand typical practices respect put things, , how app should wire things server.js, how server.js should work, , how keep persistent connection open website, , backend services or modules. this general question let me try more specific, specific can since new node.. , basis start on question. lets plan on designing simple express app. i've got kind of structure example far: right in server.js , playing around trying connect mysql database. i've got connection pool i'm creating, 1 call store retrieve data, requires @ time node-mysql middleware i'm using, etc. app.js has simple code, it's not modular yet, or production ready that's me playing code, spiking things out. in have you're typical stuff setting view, var app = express();, importing express route definition module in routes\index.js, stuff that. if i'm going keep database connection open, or other things o...

java - Spring MVC + Mosquitto + MQTT Integration can't get any message -

with spring's integration libraries, trying connect mosquitto , read/send messages... there things couldn't figure out. 1 - when initilazing app, app connects mosquitto, mosquitto receives hundreds of connection requests again same app same id in seconds. example of log : new connection 127.0.0.1 on port 1555. client springclient connected, closing old connection. client springclient disconnected. new client connected 127.0.0.1 springclient (c1, k60). sending connack springclient (0, 0) received subscribe springclient 0001/001/inf (qos 1) springclient 1 0001/001/inf sending suback springclient new connection 127.0.0.1 on port 1555. client springclient connected, closing old connection. client springclient disconnected. 2 - can't messages mosquitto using configuration : spring xml : <!-- reading messages --> <bean id="mqttinbound" class="com.mobistech.drc.m2mproject.mqtt.mqttcustominboundadapter"> ...

python - Constrained Optimization with Scipy for a nonlinear fucntion -

i trying maximize x^(0.5)y^(0.5) st. x+y=10 using scipy. i can't figure out method use. appreciate if guide me on this. here 2 possible ways: the first version uses fmin_cobyla , therefore not require derivative of f . from scipy.optimize import fmin_cobyla f = lambda x : - (x[0]**0.5 * x[1]**(0.5)) # x + y = 10 <=> (x + y - 10 >= 0) & (-x -y + 10 >= 0) c1 = lambda x: x[0] + x[1] - 10 c2 = lambda x: 10 - x[0] - x[1] fmin_cobyla(f, [0,0], cons=(c1, c2)) and get: array([ 4.9999245, 5.0000755]) the second version uses fmin_slsqp , exploits can calculate partial derivatives analytically: from scipy.optimize import fmin_slsqp f = lambda x : - (x[0]**0.5 * x[1]**(0.5)) def f_prime(x): ddx1 = 0.5 * x[0]**-0.5 * x[1]**0.5 ddx2 = 0.5 * x[1]**-0.5 * x[0]**0.5 return [ddx1, ddx2] f_eq = lambda x: x[0] + x[1] - 10 fmin_slsqp(f, [0.01,0.01], fprime=f_prime, f_eqcons=f_eq) this output: optimization terminated successfully. ...

Implementing an interpreter in Haskell exercise CIS194 -

i'm lerning haskell material can found here . i'm begining homework 3 in objective write interpreter simple language i'm stuck in first exercise: before can start evaluating expressions , statements need way store , state of variable. define state function of type string -> int . makes easy value of variable; value of "a" in state , call state "a" . whenever assign variable, want update program state . implement following function: extend :: state -> string -> int -> state hint: can use input state black box variables other 1 assigning. example: let st’ = extend st "a" 5 in st’ "a" == 5 i don't i'm supposed doing here. in hint i'm not sure "black box" means. in example st' state, i'm not sure in st' "a" == 5 doing. if clarify both hint , example me think able solve exercise. "black box" means can i...

c# - send property value to server after stabilization -

i have code looks this: class myvm : vmbase { public myvm(imyserverproxy proxy) { _proxy = proxy; _proxy.valuechanged += onvaluechangedfromserver; } private void onvaluechangedfromserver(int value){ _value = value; raisepropertychanged(() => value); } public int value { // bound slider { return _value; } set { _value = value; // need here send stable values server _proxy.modifyvalue(value); // async } } } the problem this: value bound slider control. slider triggers lot of changes. don't want send server. want send stable value. essentially, want insert value setter calls proxy after value has not changed full second. (i have secondary concern server route out-of-date value change me, think mitigated if delay on send server.) i looked using task.delay method. however, throws exception if cancel delay, , constructing new cancellationsource on every update didn't seem ideal either. there better way? ...

c# - Dataset Loading a WPF Combobox -

dataset dataset = new dataset(); using (sqlconnection connection = new sqlconnection("server=server; database=database; user id=user; password=user")) { connection.open(); using (sqlcommand command = new sqlcommand("select distinct id table order id asc", connection)) { sqldataadapter reader = new sqldataadapter(command); reader.fill(dataset); idcombobox.datacontext = dataset; --> doesn't work idcombobox.itemsource = dataset.tables[0].columns[0].tostring() --> doesn't work idcombobox.itemsource = dataset.tables[0].rows[0].tostring() --> doesn't work idcombobox.itemsource = dataset.tables[0].rows --> doesn't work idcombobox.itemsource = dataset.tables[0].columns --> doesn't work don't work me pairing idcombobox.datacontext = dataset.tables[0].rows[0] or columns[0] } connection.close(); connection.dispose(); } i n...

mongodb - CouchBase NOSQL announced JOIN support. What are the disadvantages to use them? -

i assumed nosql (cassandra, couchdb, couchbase, mongodb, etc.) document oriented (no join). typical sentence: " if need join, use sql database (mysql, postgresql, etc.)" but now, couchbase announced n1ql (developer preview 4) join support: http://blog.couchbase.com/introducing-developer-preview-for-couchbase-server-4.0 try online: http://query.pub.couchbase.com/tutorial/#42 so, confusing. couchbase first nosql database join support? there disadvantages in using it? why others nosql database (like mongodb, couchdb, cassandra, etc.) did not implement it? yes, several nosql databases use json document model (e.g. couchbase, mongodb). however, document-oriented not have mean "no joins". rdbmss postgresql , mysql expect disassemble objects flat tables writing, , use joins reassemble objects reading. called impedance mismatch. json document databases can store full objects directly, there no impedance mismatch. however, objects have relationships ...

arrays - Matlab bsxfun alternative cause wrong result -

i have run matlab code on old version doesn't support bsxfun , need write equivalent expression of matx = bsxfun(@rdivide, matx, reshape(f, 1, 1, length(f))); i have tried this matx=matx./ones(size(reshape(f, 1, 1, length(f)),1)); but wrong result matx size 246x301x81 f size 1x81 before invocation of istruction use bsxfun since matx 3d array , f row vector of length equal number of elements in dim-3 of matx , can perform bsxfun equivalent expansion/replication repmat , perform elementwise division - % size of matx [m1,n1,r1] = size(matx); %// replicate f size of matx , perform elementwise division matx = matx./repmat(permute(f,[1 3 2]),[m1 n1 1])

linux - Executing an if statement after a specific output in expect script -

is there way execute if statement if see specific output? example, when console says "bad interpreter permission denied" want execute command "dos2unix file_name"? logic following, if (output "bad interpreter permission denied") { send dos2unix file_name } fi this expect script. edit: hi guys able in expect script? if (grep -cim1 '^m$' lruload.sh) -eq 1; send dos2unix filename fi how logic/psuedo-code? export cmdtext=`mycmd param1 param2 2>&1` if ($cmdtext "bad interpreter permission denied") { send dos2unix file_name } fi the permission denied text went stderr, not stdout, redirect 2>&1 lumps both of them together, making test simple.

sql - Sort by Acct # then delete based on specified text then subtract time variable for each Acct # Code attached -

i needing figure out time takes complete account. first data needs sorted "id" smallest largest "act_updated oldest newest (like excel sort) however, need delete data begins "editing begin" doesnt make change "editing end" directly below "editing begin". id act_note updated_by act_updated 1651 editing end name1 may-18-2015 13:05:07 46485 editing end name4 may-15-2015 16:38:35 111213 comment name3 may-19-2015 15:34:09 111213 editing end name3 may-19-2015 15:34:16 111213 editing begin name3 may-19-2015 15:34:33 111213 comment name3 may-19-2015 15:35:00 111213 editing end name3 may-19-2015 15:35:00 556456 editing begin name2 may-18-2015 12:05:53 556456 editing end name2 may-18-2015 12:06:00 in short, hope have data aligned as: id act_note updated_by act_updated 111213 editing begin name3 5/19/...

simple java regex with backreference does not work -

i have trouble replace string backreference of regular expression: nothing replaced , end input. code: string input="a12.3 bla bla input"; input = stringutils.replacepattern( input, "^([a-z]\\d{2}\\.\\d)", "$1"); system.out.println(input); the main problem can not change java code input, regex , group reference. do have suggestions other regex pattern matches needs or going wrong? stringutils of apache commons lang you replacing same matched pattern itself. meant: string input="a12.3 bla bla input"; input = stringutils.replacepattern( input, "^([a-z]\\d{2}\\.\\d).*$", "$1"); // ^^^ system.out.println(input); .*$ match input till end.

objective c - Adding Strings to NsMutableSets -

if have 2 string objects both have value "hi", , add them nsmutableset, treated different objects or not? bunch! beside correct comment of @rmaddy, there fundamental problem it: impossible guarantee no objects equal in set. (it easy guarantee not identical.) imply recheck equaty of objects (expensive), when 1 changes (mostly impossible detect). is, because nsset not copy content objects. let's have example: nsmutablestring *first = [@"amin" mutablecopy]; nsmutablestring *second = [@"amin negm" mutablecopy]; nsset *set = [nsset setwithobjects:first, second]; [first appendstring:@" negm"]; both objects equal than, none removed. (which one?)

java - How come not implementing some Methods are allowed in WindowAdapter? -

the windowadapter class of java defined abstract class , has many abstract methods, including: windowclosing() windowclosed() windowactivated() all of these methods empty , java says class exists convenience not want create classes implementing windowlistener . because unlike windowlistener interface, windowadapter gives choice implement 1 of abstract methods defined in it. for example if add below code class inherits window , make window closeable through 'x' button on upper right corner: addwindowlistener(new windowadapter() { public void windowclosing(windowevent we) { dispose(); } }); however confuses me. first of happening here? creating inner class extends windowadapter ? new keyword used create instance, not allowed instantiate abstract class. why new keyword here? second, why away implementing 1 of abstract methods in windowadapter ? in java if define abstract class: public abstract class upperclassa...

oracle - How to INSERT values to table after updating information SQL -

Image
create table invoice ( inv_number char (10) not null, inv_date varchar2 (8) not null, order_number varchar2 (10) not null, r_date varchar2 (8) not null, f_date varchar2 (8) not null, arrive_time number not null ); this invoice table and added it select * invoice; alter table invoice add inv_total number (2); this result after (select * invoice) how can re-enter values "invoice table" without getting error? assume have update somehow able enter values. thank you. update: insert statement. insert invoice (inv_number, inv_date, order_number, r_date, f_date) values ('s104011041',to_date ('15/03/2015', 'dd/mm/yyyy'),'s004-011152',to_date ('15/03/2015', 'dd/mm/yyyy'),to_date ('15/03/2015','dd/mm/yyyy'));

Rails sum query with hstore -

i have got table hstore column. need sumarize of entries of specific hstore key. one stat record looks this: id: 2041, tenant_name: "isabela", totals: {"value1"=>"31", "value2"=>"21", "value3"=>"38", "value4"=>"28", "value5"=>"0"}, created_at: tue, 05 may 2015 23:31:01 utc +00:00, updated_at: tue, 05 may 2015 23:31:01 utc +00:00>, with totals being hstore column. find sum of every records value1 specific day. far got: string = []; dates.each |date| count = stat.where(created_at: datetime.parse(date).midnight..datetime.parse(date).midnight + 1.day)) string.push(count) end //(dates = array of dates) does have idea how this? update got work with: .sum("(totals->'value1')::integer") you should : sums = dates.map |date| stat.where(created_at: datetime.parse(date).midnight..datetime.parse(date).midn...

ubuntu - How to set default directory for when I open a new gnome-terminal with zsh? -

when open new gnome terminal loads zsh , puts me in home directory ( ~ ). if cd around , press ctrl + shift + t opens new tab in same directory last tab. behaviour, instead of starting in home dir, want start in other dir. how can this? i can't put cd command in ~/.zshrc because run when open new tab, , can't put in ~/.zprofile because doesn't run when open new terminal. how do it?

reporting services - SSRS calculating IF THEN ELSE with nulls -

i trying create calculated field in ssrs dataset fields need summed have nulls , can't formula correct. below description of trying do if value.field1 = 1 , value.field2 not null, use value.field2 otherwise use value.field3 i sure there simple answer this, new ssrs , can't seem find right answer. you should able this. check value of field1 , boolean value of whether or not field2 null. iif(fields!field1.value = 1 , isnothing(fields!field2.value) = 0, fields!field2.value, fields!field3.value) the iif() statement ssrs structured in way: iif(conditional logic , executed if evaluated true, executed if evaluated false)

Using "Get all latest" function of Enterprise-Architect outside of the EA -

is there way acces ea function "get latest" package of eap file outside of running enterprise architect. for example via batch file? all methods in object model api available com client, yes. write code in c#, can work in script if prefer. ea.repository , basic ea interaction class, has showwindow() method can use control whether or not main window displayed. version control functions available through ea.package.versioncontrol*() methods.

python - Why does Order matter in Kwarg parameters in MagicMock asserts? -

i have test mocking filter call on manager. assert looks this: filter_mock.assert_called_once_with(type_id__in=[3, 4, 5, 6], finance=mock_finance, parent_transaction__date_posted=tran_date_posted) and code being tested looks this: agregates = balance.objects.filter( finance=self.finance,type_id__in=self.balance_types, parent_transaction__date_posted__lte=self.transaction_date_posted ) i thought since these kwargs, order shouldn't matter, test failing, though values each pair match. below error seeing: assertionerror: expected call: filter(type_id__in=[3, 4, 5, 6], parent_transaction__date_posted=datetime.datetime(2015, 5, 29, 16, 22, 59, 532772), finance=) actual call: filter(type_id__in=[3, 4, 5, 6], finance=, parent_transaction__date_posted__lte=datetime.datetime(2015, 5, 29, 16, 22, 59, 532772)) what heck going on? kwarg order should not matter, , if order match test asserting, test still fails. your keys no...

json - why the error: fatal error: Array index out of range? [swift] -

Image
please find error location in below image : the number of values in tripoption change in each request. there logic problem in code tripoption example outputs 2 values.. loop keeps going , says array out of index.. have no idea how fix issue. var arrayofflights : [flightdatamodel] = [flightdatamodel]() if json != nil { //insert airline data arrayofflights if let myjson = json as? [string:anyobject] { if let trips = myjson["trips"] as? [string:anyobject] { if let data = trips["data"] as? [string:anyobject] { if let carriers = data["carrier"] as? [[string:string]] { (index, carriername) in enumerate(carriers) { var myflight = flightdatamodel(airline: carriername["name"] string!, price:nil) self.arrayofflights.append(myflight) ...

javascript - Isolating JS from other JS in the same HTML document -

consider code: <script>var foo = 'bar';</script> <div id='isolated'> <script>console.log(foo)</script> </div> this return 'bar' console. i'd foo , other variables declared outside #isolated undefined within it. how can achieved? cross-browser, lightweight , native solution preferable. that's not how javascript works. doesn't scope because of html element block. you're declaring foo @ global scope, declare in scope used when needed. using es6 (harmony), using let instead of var (proposed, not supported) declare variable proposes block level variable instead of global scoped variable. as stands however, javascript has no idea foo being logged inside isolated div unless use logic.

excel - Formula bar should show the text instead of cell reference -

i have specific width column has long text partly hidden due values in adjacent columns. hoping user might able read entire text formula bar once clicked on cell. since referencing text pivottable formula bar shows cell reference , not text. text dynamic , hence referencing important me. is there way display text in formula bar instead of cell reference? i did cell referencing in background vba instead of excel. vba populated cells , once cell selected entire text shows in formula bar

In SVN is there a straighforward way to merge back each change individually? -

i've got long-running feature branch has become incompatible trunk -- there lots of binary files have been modified on both sides i've got tree conflicts out wazoo. in past when we've run these issues, we've diffed branches against each other, blended in changes trunk using diff tool, , committed 1 huge "all changes feature branch" commit. gets job done, because it's not proper merge lose intricate histories of affected files. i'd try different route, git-style "rebase" svn, each change re-applied on top of trunk. so i'm looking process efficiently (i.e. semi-automated) merging every change feature branch one-at-a-time on trunk , comitting them, trunk once again contains full changelist history. can suggest such process? i should mention, i'm on windows, in case matters. you can use svn mergeinfo --show-revs eligible find revisions merge. , use svn merge -c rev merge each revision. check out --accept option mer...

java - Thirdy party dependencies in custom class loader(SpringBoot, tomcat). -

i hosting springboot1.2.3 app on tomcat, compiles , run java classes dynamically. i have custom class-loader compiles , load source code @ run-time, using java compiler api. now want allow third party dependencies in compilable code. i tried using urlclassloader load dependencies jar files. however, urlclassloader doesnt work when deployed on tomcat, security policy of tomcat prohibiting this. i tried adding dependencies in application , sharing custom class-loader(which again doesn't work) e.g. if want compile , run following code dynamically package a.test; import a.aclass; import org.junit.test; import static org.hamcrest.corematchers.is; import static org.junit.assert.assertthat; public class atestclass { @test public void testme() { assertthat(1, is(new a.aclass().getone())); } @test public void testmeagain() { assertthat(1, is(new aclass().gettwo())); } } now, how can provide junit dependencies compilation ?

c# - Issue with session parameter "Must declare the scalar variable" -

i have issue code. <asp:sqldatasource id="reservationradschedualersqldatasource" ondeleting="reservationradschedualersqldatasource_deleting" runat="server" connectionstring="<%$ connectionstrings:nmrconstr %>" selectcommand="getreservationappointments" selectcommandtype="storedprocedure" insertcommand="insert [reservationappointments] (subject , description, start, [end], recurrencerule , username , machinepkid) values (@subject , @description, @start, @end, @recurrencerule , @username , @macpkid)" updatecommand="exec updatereservationappointment @subject , @description , @start , @end , @recurrencerule , @username , @id , @macpkid" deletecommand="exec deleteappointmentbyuser @id , @username" > <updateparameters> <asp:controlparameter controlid="reservations...

oozie - Azkaban : Conditional executions in the workflow -

i have requirement inject conditional execution in workflow. ex: if particular condition met, particular workflow should executed. if not, different workflow should executed. from understanding, there no direct feature in azkkaban supports this. oozie supports it. wanted know how azkkaban users dealing this? sure must facing in form or other. thanks, kranthi azkaban's roadmap says feature there in future roadmap , hence cannot configured easily. option left handle programatically. if has better suggestions, please let me know. thanks, kranthi

Rails: Multiple dropdown menus collection_select -

Image
super rails n00b here: have form following code: <%= f.collection_select :account_ids, @accounts, :id, :name, include_blank: true %> and works how want have multiple drop down menus can select multiple accounts. not want multiple select on same dropdown. if this: <%= f.collection_select :account_ids, @accounts, :id, :name, include_blank: true %> <%= f.collection_select :account_ids, @accounts, :id, :name, include_blank: true %> <%= f.collection_select :account_ids, @accounts, :id, :name, include_blank: true %> only last selection appears in params. how can make params this: "journal"=>{"account_ids"=>["1","2","3"]} can collection.select or should using different? appreciated. thanks! you need add 1 option :multiple : <%= f.collection_select :account_ids, @accounts, :id, :name, { include_blank: true }, { multiple: true } %>...

c++11 - Forbid linking against a c++ method -

i try forbid use of method, have compile error if piece of code use it. this proprietary legacy module, know methods problematic. have headers files, , dlls. i can't figure out use of method in huge project use (lot of defines, implicit cast...) can compiler stop (or warn) if detect use of method? you can use __declspec(deprecated) in visual c++ generate warnings use of specific function. can use #pragma deprecated deprecate usage of symbol (including macros). see more information on msdn . can generate warnings or errors (depending on computer flags) can supress them needed additional #pragma s

C++ Client Proxy header file not generated by soapcpp2.exe in gSoap -

after run wsdl2h.exe generate header file 'calc.h', below- c:\users\tushar\desktop\gsoap_2.8.22\gsoap-2.8\gsoap\bin\win32>wsdl2h -o calc.h calc.wsdl ** gsoap wsdl/schema processor c , c++, wsdl2h release 2.8.22 ** copyright (c) 2000-2015 robert van engelen, genivia inc. ** rights reserved. product provided "as is", without warranty. ** wsdl2h tool released under 1 of following licenses: ** gpl or commercial license genivia inc. use option -l details. saving calc.h cannot open file "typemap.dat" problem reading type map file 'typemap.dat'. using internal type definitions c++ instead. reading file 'calc.wsdl'... done reading 'calc.wsdl' complete process, compile with: > soapcpp2 calc.h or generate c++ proxy , object classes: > soapcpp2 -j calc.h next, have run gsoap compiler 'soapcpp2' on gsoap header file 'calc.h' produce source code stub , skeleton implement client application. follows- c...

excel - How do I do a sum of contents in an adjacent cell equal a set value -

what formula use sum of contents of range of cells, provided contents of adjacent cell equal cell. the example give is, if have set of invoices quote purchase order, want see sum of invoices given purchase order, have included link excel spreadsheet have tried 2 different formulas can't seem grips need do. formulas in column j. https://www.dropbox.com/s/xw9aun1cblro9ix/test.xlsx?dl=0 you'd better lock references use absolute column references this: put formula in j , copy down: =sumif($c$2:$c$4,$h2,$b$2:$b$4) add $ sign column refs.

html - Clip-path not working on videos -

i have been trying display image , on hover, video start replacing image, used javascript hover functions. i did using "poster" in video tag this:` <div class="video"> <video id="videotest" poster="images/img.jpg"> <source src="images/bkg.mp4" type="video/mp4"></source> can't use videos here. </video> </div> however, video same size image. video 1280*720, , image 677-611. tried use clip-path adapt video doesn't work, here css: .video { text-align:center; margin:0 auto; height:auto; clip-path:inset(0 978px 611px 301px); -webkit-clip-path:inset(0 978px 611px 301px); } i tried applying style .video, #videotest , source, still didn't work expected. is impossible use clip-path videos in html5? if so, how can it, , if not, how can make work? i explain myself little more: don't want image resize, keeping proportions or ...

json - Why do we need to explicitly use the implicit method on map value? -

this working example: import spray.json._ trait jsonsupport { implicit def string2jsvalue(s: string): jsvalue = { jsstring(s) } implicit def map2jsobject(m: map[string, jsvalue]): jsobject = { jsobject(m) } implicit def mapstring2jsobject(m: map[string, string]): jsobject = { jsobject(m.map { case (k,v) => (k,string2jsvalue(v)) }) } } as stands now, working. if replace implicit def mapstring2jsobject(m: map[string, string]): jsobject = { jsobject(m.map { case (k,v) => (k,string2jsvalue(v)) }) } with implicit def mapstring2jsobject(m: map[string, string]): jsobject = { jsobject(m) } then following error occurs: expected: map[string, jsvalue] , actual: map[string, string] why implicit method not doing work , need call implicitly? is possible use implicits in way such there no need write implicit methods every possible nesting of map ? e.g.: implicit def map1string2jsobject(m: map[string, string]): jsobject imp...

ruby gosu moving image to the direction is pointed at -

i have been trying make image move direction pointed at. keeps moving in random directions :( cant figure out why... here's code: require 'gosu' class game < gosu::window def initialize super(1280, 720, true) @image = gosu::image.from_text ':', 100 @ang = 1 @x = 640 - @image.width @y = 360 - @image.height end def update @sngx = (10.0/math.cos(@ang.to_f)).to_i @sngy = (10.0/math.sin(@ang.to_f)).to_i @n = gosu::image.from_text @ang.to_s, 50 end def draw @image.draw_rot @x, @y, 0, @ang @n.draw 0, 0, 0 end def button_down id close if id == gosu::kbescape if id == gosu::kbe @ang += 10 end if id == gosu::kbq @ang -= 10 end if id == gosu::kbw @x += @sngx @y += @sngy end end end game.new.show it not behave random. i'd bet issue ma...

glassfish - NetBeans - The module has not been deployed -

im trying run java web project netbeans, went fine yesterday, today when tried running again got error : ant -f f:\\אינטרנט\\officalproject -dnb.internal.action.name=redeploy -ddirectory.deployment.supported=true -dforceredeploy=true -dnb.wait.for.caches=true -dbrowser.context=f:\\אינטרנט\\officalproject run-deploy init: deps-module-jar: deps-ear-jar: deps-jar: library-inclusion-in-archive: library-inclusion-in-manifest: compile: compile-jsps: starting glassfish server 4.1 glassfish server 4.1 running. in-place deployment @ f:\אינטרנט\officalproject\build\web glassfish server 4.1, deploy, connection refused: connect, false f:\אינטרנט\officalproject\nbproject\build-impl.xml:1045: module has not been deployed. see server log details. i have searched solution read didnt work, uninstalled netbeans , glassfish pc , installed again, tried running project, , worked, after closed netbeans , tried again, same thing happend. server log: [2015-05-29t17:33:20.142+0300] [glassfish 4.1] ...

c - Reading binary file to a string but the types are mixed -

i'm trying read binary file when read characters doesn't looks it's formatted char type example numbers don't have ascii value instead, actual value letters have ascii value. why that? also, when create binary file, doesn't hold '\0' padding, nor \x behind every number, , why show up? this how i'm reading file: file * fp = fopen("file.bin", "rb"); char foo[20]; fread(foo, sizeof(char), 20, fp); which can see in vs, fills foo this: [0]: 5 '\x5' [1]: 0 '\0' [2]: 0 '\0' [3]: 0 '\0' [4]: 97 'a' [5]: 66 'b' [6]: 67 'c' [7]: 100 'd' [8]: 101 'e' [9]: 6 '\x6' [10]: 0 '\0' [11]: 0 '\0' [12]: 0 '\0' [13]: 97 'a' [14]: 97 'a' [15]: 66 'b' [16]: 84 't' [17]: 82 'r' [18]: 121 'y' [19]: 4 '\x4' is there way read characters such hold ascii values? there way not read \0 ...

activerecord - Rails 4 respond_with include association with WHERE -

i'm using rails respond_with send json response client, , i'm trying figure out how use includes option in respond_with along where clause in association here models: class user < activerecord::base has_many :ratings has_many :movies, through: :ratings end class rating < activerecord::base belongs_to :user belongs_to :movie end class movie < activerecord::base has_many :ratings has_many :users, through: :ratings end in controller action, have: def create movies = movie.order("random()").limit(3) respond_with(movies, include: :ratings) // i'd // respond_with(movies, include: :ratings user: current_user) end however, responding ratings 3 movies. want restrict ratings of particular user you this: def create movies = movie.order("random()").limit(3) # edit # movies = movies.merge(current_user.movies).includes(:ratings) movies = movies.joins(:ratings).merge(current_user.ratings).i...

c# - How to use EditorFor with DateTime in ASP.NET MVC5 with EF? -

i building little crud application in asp.net mvc5. instead of own model using autogenerated models of ef. table (named "tablex") accessed ef has datetime value (named "inserted"). controller: // show edit public async task<actionresult> edit(int? id) { tablex x = await db.tablex.findasync(id); return view(x); } // edit public async task<actionresult> edit([bind(include = "id,...,updated")] tablex x) { if (modelstate.isvalid) { x.inserted = datetime.now; db.entry(x).state = entitystate.modified; await db.savechangesasync(); return redirecttoaction("index"); } return view(x); } this shortened controller. can see override datetime field anyway. view: @model databaseef.models.tablex @using (html.beginform()) { <div....> //more fields <div ...> @html.label("inserted ", ...) <div ...> @html.editorfor(model ...

java - Error running gae appcfg.sh with --severity parameter -

i'm trying deploy application google appengine appcfg.sh tool. using parameter --severity process fails. appengine-java-sdk-1.9.15/bin/appcfg.sh --severity=0 update . the output error : encountered problem: com.google.appengine.tools.admin.appcfg$updateaction cannot cast com.google.appengine.tools.admin.appcfg$requestlogsaction please see logs [/tmp/appcfg5275118373648282055.log] further information. could bug in appcfg.sh ? the severity switch supplied when using request_logs argument. eg: $ /path/to/appcfg.sh --severity=0 request_logs to deploy in case, should use: $ appengine-java-sdk-1.9.15/bin/appcfg.sh update . more here: https://cloud.google.com/appengine/docs/java/tools/uploadinganapp

ios - CloudKit: "There is no operation associated with this request" -

when attempting save cloudkit ckrecord, ckerror returned gives following description: <ckerror 0x7fd3d24e1810: "internal error" (1/2005); "there no operation associated request"> any ideas might cause this? google not return results @ error. this error mentioned in cloudkit constants reference here . sort of internal issue in ck. issue recurring? doing special in operation?

sql - how do I mark one row and store its particular value in Hive using standard Query or using UDF? -

i need write query in hive or define function needs followings: the dataset: student || time || comuputerpool ------------------------------------- || 9:15am || pool1.machine2 ------------------------------------- || 9:45am || pool1.machine7 ------------------------------------- || 10:15am|| pool1.machine9 ------------------------------------- || 11:00am|| pool2.machine2 ------------------------------------- || 12:05 || pool2.machine3 ------------------------------------- || 12:40 || pool3.machine5 ------------------------------------- || 13:10 || pool1.machine3 ------------------------------------- || 13:50 || pool1.machine10 ------------------------------------- b .......................... so query should find out how long particular student has spent in particular computer pool calculating difference of when first used machine in pool , when first start using machine in pool. example time spent di...

ios - Can't pop UIImagePickerController -

i have uiimagepickercontroller custom overlay. trying implement cancel button pop uiimagepickercontroller . code setup below: - (void)tapphoto { //setup picker self.picker = [[uiimagepickercontroller alloc] init]; self.picker.delegate = self; self.picker.sourcetype = uiimagepickercontrollersourcetypecamera; self.picker.cameradevice=uiimagepickercontrollercameradevicefront; self.picker.showscameracontrols=no; self.cameraoverlay = [[cameraoverlay alloc] init]; uiimage *camoverlayimage = self.cameraoverlay.cameraoverlayimage; uiimageview *camoverlayimageview = [[uiimageview alloc] initwithimage:camoverlayimage]; camoverlayimageview.frame=cgrectmake(0, 0, self.cameraoverlay.previewsize.width , self.cameraoverlay.previewsize.height); //init control view uiview *cameracontrols= [[uiview alloc] initwithframe:cgrectmake(0, 0, [[uiscreen mainscreen] bounds].size.width, [[uiscreen mainscreen] bounds].size.height)]; [cameracontrols a...

php - Code completion of my classes in netbeans 8 -

how enable code completion clases , methods create in code in netbeans 8. thanks, dion you should google kinda thing, i'm in mood answer question :-) anyway, ide's read code in pretty same way. can't attest netbeans (i use phpstorm), general idea make sure add docblocks classes, methods etc. ide reads these , can provide decent code-completion. <?php namespace app; /** * class myclass * stuff * @package app */ class myclass extends someotherclass { /** * var * @var string */ public $myvar = 'some val'; /** * method * @param string $yourstring * @return somethingelse */ public function mymethod ($yourstring) { $this->myvar = $yourstring; return new somethingelse($this->myvar); } } have @ phpdoc site tag syntax. ide's have way of generating well.

How do I pass my access token via javascript with IdentityServer3? -

i have asp.net mvc app lot of javascript calls. i've protected mvc action, redirected identity server, login, , redirected client. can make subsequent calls through mvc, how access token , use in ajax calls? here's startup.cs file: public void configuration(iappbuilder app) { // tell microsoft not try map .net's claimstypes jwtsecuritytokenhandler.inboundclaimtypemap = new dictionary<string, string>(); app.usecookieauthentication(new cookieauthenticationoptions { authenticationtype = "cookies" }); const string svcurl = "https://localhost/svc.security"; app.useopenidconnectauthentication(new openidconnectauthenticationoptions { authority = svcurl, clientid = "nedd_client", redirecturi = "http://localhost:61207/", responsetype = "code id_token token", // ask 'roles' claims & access web services scope = "op...