Posts

Showing posts from July, 2013

c++ - How to do the conditional variable initialization at compiler time? -

c++11 standard have std::conditional<> template type selection boolean condition @ compiler time. how same operation select init value variable initialization? similar type = (exp) ? first_value : second_value; . i use template: template<bool b, typename t> inline constexpr t&& conditional_initialize(t&& i1, t&& i2) { return b ? std::move(i1) : std::move(i2); } but can used pod types: int = conditional_initialize<true>(1, 2); . array initialization template compiled error. wrong compile example: int a[] = conditional_initialize<true>({1, 2}, {3,4,5}); error message: no matching function call 'conditional_initialize(<brace-enclosed initializer list>, <brace-enclosed initializer list>)'; who can me template? template<class t, std::size_t n, std::size_t m, bool b> std::array<t, b?n:m> conditional_array( std::array<t, n>&& lhs, std::array<t, m>&& rhs

reportbuilder - How to find the 1st day of a previosu month in SQL Server Reporting services -

i trying set default date fist day of previous april. have found expressions 1st day of previous month =datevalue(dateadd("m",-1,dateadd("d",-(day(now)-1),now))) and have found expression 1st day of april current year ( =cdate("04/01/"+cstr(year(now()) ) need find previous april, not april of current year. is able please? try: =iif(today.month>=4,dateserial(today.year,4,1),dateserial(today.year-1,4,1)) note if run report in april or after current year april, if run report in march or before last year april. let me know if helps.

python - django auth system 'created' -

Image
i'm working django 1.7.11. have preexisting project , i've decided try use built in admin panel (i have not created superuser). when opened auth page saw : thinking there may problem tables decided delete sqlite database , rerun everything: $ python manage.py makemigrations app1 migrations 'app1': 0001_initial.py: - create model seller $ python manage.py migrate operations perform: synchronize unmigrated apps: crispy_forms apply migrations: admin, contenttypes, auth, app1, sessions synchronizing apps without migrations: creating tables... installing custom sql... installing indexes... running migrations: applying app1.0001_initial... faked $ python manage.py syncdb operations perform: synchronize unmigrated apps: crispy_forms apply migrations: admin, contenttypes, auth, app1, sessions synchronizing apps without migrations: creating tables... installing custom sql... installing indexes... running migrations: no migrations apply

OBIEE adding an integer to date -

i looking add number of days (column 1- integer) date (column 2- date) create date in future (column 3- date). what code required? try using formula column3 timestampadd(sql_tsi_day,cast("table"."column1_int" integer), "table"."column2_date")

javascript - get base64 by filename to view -

i saved name of files db, , store file in file server. can access file getting name , <img src='http://localhost/upload/abc.jpg'/> abc filename. how base64? because need actual file , pass somewhere. if image on same domain, can canvas.. function getbase64image(img) { var canvas = document.createelement("canvas"); canvas.width = img.width; canvas.height = img.height; var ctx = canvas.getcontext("2d"); ctx.drawimage(img, 0, 0); return canvas.todataurl("image/png"); } // if image on dom use var img = document.getelementbyid('img'); alert(getbase64image(img)); // if image isn't on dom this.. var img = new image(); img.onload = function(){ alert(getbase64image(img)); } img.src= "http://my/image/url.png";

slim - File Upload in Userfrosting -

we need have user upload image part of sign process. had tried accessing $_files['filename'] in controller, turns out undefined under slim. had seen slim's way of file uploading in couple of articles, reported working, hit wall. the twig part works fine bootstrap file input library for server part using file upload library slim controller code (modifications accountcontroller) looks this ... $storage = new \upload\storage\filesystem('c:/xampp/htdocs/userfrosting/public/images/'); $file = new \upload\file('imagefile', $storage); $new_filename = 'test.jpg'; $file->setname($new_filename); $file->addvalidations(array( // ensure file of type "image/jpg" new \upload\validation\mimetype('image/jpg'), // ensure file no larger 500k (use "b", "k", m", or "g") new \upload\validation\size('500k') )); // access data file has been uploaded $uploadfiledata = array(

audio - Stoping a sound as an action on a node with a key in SceneKit -

i've written function in scenekit plays background music action on node key stop music playing using key i have global variable can call stop action anywhere in class, (by way scenekit not spritekit, still using swift language though) var musicplayingaction = scnaction() however nothing stops it, either forkey or removeallactions in... this nothing scnscene.rootnode.removeactionforkey("bgmusickey") so try higher level , drill down, killing actions either on scene, view or node (depending on attach sound action). self.scnview.scene!.rootnode.removeallactions() still nothing... even if run sound action on specific node , try kill that.. guessed nothing or should music still playing. this function func playmusic() { if game.state == .playing { let music = scnaudiosource(filenamed: "art.scnassets/sounds/bgmusic.mp3")! music.volume = 0.3; music.loops = true music.shouldstream = true

javascript - react native router flux Encountered two children with the same key -

version(s) react-native-router-flux v3.31.2 react-native v15.2.1 i don't know i'm doing wrong when try call actions.dialog() multiple times, got error. i thought fix https://github.com/aksonov/react-native-router-flux/issues/327 fixed isn't, should else i'm out of ideas ... the time dont have this, when use pop() close it. unfortunalty, dont want pop (it may break other functionalities in app). could ? the error : `1:$dialog_1_dialog`. child keys must unique; when 2 children share key, first child used. in rctview (created view) in view (created modal) in modal (created defaultrenderer) in rctview (created view) in view (created defaultrenderer) in defaultrenderer (created sceneview) in sceneview (created navigationcard) in rctview (created view) in view (created animatedcomponent) in animatedcomponent (created navigationcard) in navigationcard (created container) in container (created navigationcomp

javascript - JQuery - Change $_GET variable on button click -

i'm trying create series of buttons update website's $_get['year'] variable. want buttons work on these pages: example.com example.com/?search=foo example.com/?search=foo&year=2015. so example if clicked on <a>2016</a> 'year' tag updated year=2016 , webpage show search results or year. i've tried using jquery ajax so: <ul class="dropdown-menu datedropdown"> <li><a>2016</a></li> <li><a>2015</a></li> <li><a>2014</a></li> </ul> <script> $(document).ready(function () { $(".datedropdown>li>a").each(function() { $(this).click(function() { alert("pressed"); $.get({

ios - How to move resizableUIView from its corner in Swift? -

enter image description here i have created screen using 4 rounded button on corners. , need resize view 4 button tapped event. on button direction this need do.

python - JWT integration with django -

i new django (not drf) , have hard time configuring authentication requirements. have external authentication service gets username , password , returns jwt. after have jwt how should save token , provide every request browser. , after can validate it? thanks! for every call service there should header call {'authorization':'token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'} and can use in views.py : if request.user.is_authenticated(): it has included in settings file of django project. jwt_auth = { # 'jwt_encode_handler': # 'rest_framework_jwt.utils.jwt_encode_handler', # 'jwt_decode_handler': # 'rest_framework_jwt.utils.jwt_decode_handler', # 'jwt_payload_handler': # 'rest_framework_jwt.utils.jwt_payload_handler', # 'jwt_payload_get_user_id_handler': # 'rest_framework_jwt.utils.jwt_get_user_id_from_payload_handler', # 'jwt_resp

knockout.js - Implement KoGrid.JS in SPEAK UI page -

i need integrate kogrid.js in 1 of speak ui custom component page. but facing below issues: getting ko undefined error because it's not getting reference of "knockout.js" reason found - speak ui renders knockout.js @ end after rendering our own custom js files. not able using knockout functions. how implement knockout grid having features kogrid.js? make sure you're not executing code until document loaded (javascript , everything). use jquery's document.ready handler : $(function() { var vm = new viewmodel(); ko.applybindings(vm); });

Using JNI or some other tool, is it possible to achieve Reflection of C code in Java? -

hello , taking time help, appreciated. i have many populated structs written in c. need convert them json name of variable key, , value value. have researched far, there no optimal way achieve this, , looks loop each struct need hard coded obtain json result. however, appears using reflection (not supported c), each of objects can accessed @ run-time in way making json string loop possible. is possible use java reflection using jni or other tool solve problem, , allow access structs @ runtime? short answer: no. long answer: fact concept (reflection; , meta data being available @ run time within java class files) exists in 1 language ... , fact 1 language (java) has concept call (or called) binaries build c doesn't mean first concept magically available on c side. know, having bridge on river doesn't move building located on 1 shore other side. it might more reasonable think building kind of parser analyses c code; , derives json information source (code)

java - How to handle invalid input when using Scanner.nextInt() -

i beginner , wrote java program allows enter n numbers , displays max, min , average if number -5 entered, program not displaying correctly , need help. want use try/catch catch errors when string entered instead integer. import java.util.scanner; public class average{ public static void main(string[]args){ system.out.print("enter integer numbers or -5 quit:"); scanner scan =new scanner(system.in); double avg = 0.0; int number = -1; double avg = 0.0; double sum = 0; int count = 0; int min = integer.max_value; int max = integer.min_value; try { while((scan.nextint())!= -5) { if (count != 0) { avg = ((double) sum) / count; count++; } if (number > max){ max = number; } if(number < min){ min = number; } catch (inputmismatchexception e) { system.out.println("please enter integer numbers"); system.out.println(

Transform or convert the column of a data frame in R -

in special case want convert data in data frame column boolean/logical values depending on condition. think question used every converstion/transformation own data frame column? example: > sleep group id 1 0.7 1 1 2 -1.6 1 2 3 -0.2 1 3 4 -1.2 1 4 5 -0.1 1 5 6 3.4 1 6 7 3.7 1 7 8 0.8 1 8 9 0.0 1 9 10 2.0 1 10 11 1.9 2 1 12 0.8 2 2 13 1.1 2 3 14 0.1 2 4 15 -0.1 2 5 16 4.4 2 6 17 5.5 2 7 18 1.6 2 8 19 4.6 2 9 20 3.4 2 10 > l = sleep$extra < 0 > l [1] false true true true true false false false false false false false [13] false false true false false false false false i want l column inside data frame (or new one). this add new column named l , assign values ( sleep$extra < 0 ) it. sleep["l"] <- sleep$extra < 0 # group id l #1 0.7 1 1 false #2 -1.6 1 2 true #3 -

jquery - CSS/HTML popup won't close -

i trying implement popup hand using html, css , jquery functions. my logic: when click initial div want increase size , make visible cancel button, works. not work close popup clicking remove button. my html: <div class="google-maps-div" id="popup"> <div class="google-maps-remove-button" id="popup-button"> <span class="glyphicon glyphicon-remove"></span> </div> </div> my scripts: $(function () { $(document).ready(function () { $('.google-maps-div').click(function () { $('#popup').removeclass('google-maps-div'); $('#popup').addclass('google-maps-div-popup'); $('.google-maps-remove-button').css("visibility", "visible"); }) }) }) $(function () { $('.google-maps-remove-button').click(function () {

vba - When trying to read #NAME? Value from excel to a string gives Type mismatch error -

i have macro reads description string excel , finds out particular string present in data or not. sometimes input file might contain value #name? in cell. when macro reaches cell gives error type mismatch run time error 13 on following line. i wanted ignore line , continue next line. how should give validation (if). i'm using 'do- loop until' loop. descriptionstring string variable. descriptionstring = currentwrkbk.worksheets(1).cells(i, 1).value use iserror, so if iserror(currentwrkbk.worksheets(1).cells(i, 1).value))....

logging - Python- How to configure the log to a file and print to console using ini file -

i'm new python , i'm trying log file , console, saw question: logger configuration log file , print stdout which helpful saw there way configure ini file , use in every module. problem seems doesn't take properties ini file , if don't explicitly define formatter in code uses default logging without format gave him in ini file: configfolder = os.getcwd() + os.sep + 'configuration' fileconfig(configfolder + os.sep + 'logging_config.ini') logger = logging.getlogger(__name__) # create file handler handler = logging.filehandler('logger.log') handler.setlevel(logging.info) # add handlers logger logger.addhandler(handler) logger.info('hello') output just: hello instead of : 2016-08-08 15:16:42,954 - __main__ - info - hello this ini file: [loggers] keys=root [handlers] keys=stream_handler [formatters] keys=formatter [logger_root] level=info handlers=stream_handler [handler_strea

dialog - How to zoom an image when we touch it and zoom out when touch releases android -

Image
i working on android application , want same effect on popup images facebook shows on reactions icons when click on button in feeds. please check below image. i using dialog box , recyclerview inside show these images. these images being shown using imageview in recyclerview. want apply such effect whenever touch image of recyclerview, should show view above image (zoom + description of image). how can apply effect on images. please provide me idea this, can proceed further. thanks lot in advanced.

multithreading - Android Service possible reuse? -

i doing project 2 people connect via wifi-hotspot (one hotspot, other 1 connects wifi) , can exchange messages (i make files later). i created socket connection using 2 services (with 2 threads inside, 1 send info, 1 read info), 1 server , 1 client. communication should bidirectional , can started of them , here have problem. basically in beggining, start service , start thread receive ( set action , check on method onstartcommand, know thread create). person has button, if press it, can send message. if person sends message, start service again (and set action send, can start thread send message). the problem if start service again (to send), exception of socket being in use (already tried doing setreuseaddress(true) , not working). similar problem streams, not "related" (the outputstream 1 side not correspondent 1 inputstream other side - exchange header every time created). how guys think solve this? put streams , socket's static, , check if created, doesn

How to solve the address issue if I restart an external service inside python with flask? -

i using flask build python web service, example, set flask port 8080 this: @app.route('/data', methods=['post']) def data_construct(): os.system('sh restart.sh') if __name__ == '__main__': app.debug = true app.run(host='0.0.0.0', port=8080) and restart.sh used restarting external service, after send http post request /data , restart completed, after while, error: traceback (most recent call last): file "hello.py", line 87, in <module> app.run(host='0.0.0.0', port=8080) file "/home/work/.jumbo/lib/python2.7/site-packages/flask/app.py", line 739, in run run_simple(host, port, self, **options) file "/home/work/.jumbo/lib/python2.7/site-packages/werkzeug/serving.py", line 613, in run_simple test_socket.bind((hostname, port)) file "/home/work/.jumbo/lib/python2.7/socket.py", line 224, in meth return getattr(self._sock,name)(*args) socket.error: [errno 98] address i

Amazon SES as an inbound smtp proxy -

has tried use ses spam removal service self-hosted e-mail server port 25 blocked? in case, i'd ses handle spam, i'd route message smtp:mydomain.net:2525 instead of normal port 25. i've seen arithmetric's ses forwarder, uses ses e-mail sender relaying message, hit same issue delivery failure when tries use standard port 25 mta. if haven't tried it, suggestions on node.js library taking message s3 , deliverying mx that's not listening on 25?

javascript - How does this js snippet work? -

function thunkify(fn) { var args = [].slice.call( arguments, 1 ); return function(cb) { args.push( cb ); return fn.apply( null, args ); }; } so [] returns array object. slice.call creates new array contents of arguments starting 1 if i'm right. but how function(cb) work? cb? function(cb) { ... } creates function. cb argument passed it. you when function called. var thunkified = thunkify(somefunction); thunkified("the value of cb");

sql server - Combine Multiple ID's as the variable SQL -

writing report , having issue hoping guide me in right direction i have 2 tables tbl_registermain_holding , lyndseycouncils in tbl_registermain_holding there 12 columns have la_id_build (1 -12) in them i want able use variable (5,12,23) = ‘east midlands’ variable bring rows have of numbers in. here data looks in lyndseycouncils table la_id listings 5 east midlands 12 east midlands 23 east midlands 15 east of england 21 east of england 25 east of england 79 london 80 london 201 london 3 london , home counties 11 london , home counties 13 london , home counties 352 north east 365 north east 372 north east here query i’m working on select rm.email,forname,surname,lc.listings dbo.tbl_registermain_holding rm inner join [dbo].[lyndseycouncils] lc on rm.la_id_live = lc.la_id (rm.la_id_build1 = @council or rm.la_id_build2 = @council or rm.la_id_build3 = @council or rm.la_id_build4 = @council or

xml - How to convert KG into LBS using XSLT -

i working on xslt, have huge xml on need perform rename , move , delete operation. of transformation done want convert kilo gram lbs. let : <main> <part> <weight>1</weight> <weightunits></weightunits> </part> </main> this part of xml. want convert value of <weight> in kg lbs , put inside <weightunits> . first possible , if yes how can that i guess want have like: <xsl:template match="weight"> <xsl:copy> <xsl:value-of select=". div 0.45359237"/> </xsl:copy> </xsl:template> <xsl:template match="weightunits"> <weightunits>lb</weightunits> </xsl:template> this assuming all weights given in kilograms. added: it whatever value there in <weight> needs convert lbs , put value in <weightunits> i convinced making mistake here because - said in comments - weightunits element suppos

c# - REST webservice WebAPI - create endpoint based on multiple entities -

i have need create rest webservice. followed tutorial: http://www.odata.org/blog/how-to-use-web-api-odata-to-build-an-odata-v4-service-without-entity-framework/ everything worked fine, added basicauth it, works glove. now, question... webservice work possible versions of it, decided implement sort of versions systems. also, want client applications choose database want perform actions. that, thought nice have uris style: http://localhost/connection/northwind/api/1/datarow this code have. used have entity datarow defined. have defined entity api , connection. how implement uri/endpoint want? code have, far. file: webapiconfig.cs using integration.models; using microsoft.odata.edm; using system.web.http; using system.web.odata.batch; using system.web.odata.builder; using system.web.odata.extensions; using integration.controllers; namespace integration { public static class webapiconfig { public static void register(httpconfiguration config) {

reactjs - Value empty in react UI but visible in the console -

Image
i using react flux. when checked in console, values coming when check in react developer tools, expected value empty. if sending single object working fine. if array sent, nothing displayed. can please tell problem? code , image of same below. code: var product = react.createclass({ render: function(){ var product = this.props.product; return (<div classname="col-md-8"><hr/> {product.map(function(items){ console.log(" items in field :"+json.stringify(items)); <div classname="col-sm-6"> <div classname="col-sm-4"> <img src={"/src/image/"+ items.image}/> </div> <div classname="col-sm-2"> <h2> {items.name} </h2> <p> {items.description} </p>

asp.net - System.Web.Globalization namespace introduced with .NET 4.6.2 conflicts at runtime with System.Globalization -

after installing windows 10 anniversary update on weekend, includes .net framework 4.6.2, code stopped working. i've gone version of 1 week ago make sure it's not related our code. at runtime, error thrown: error bc30561: 'globalization' ambiguous, imported namespaces or types 'system.web, system'. stack trace: system.web.httpcompileexception (0x80004005): c:\path\to\project\masterpages\sitemaster.master(71): error bc30561: 'globalization' ambiguous, imported namespaces or types 'system.web, system'. @ system.web.compilation.buildmanager.postprocessfoundbuildresult(buildresult result, boolean keyfromvpp, virtualpath virtualpath) @ system.web.compilation.buildmanager.getbuildresultfromcacheinternal(string cachekey, boolean keyfromvpp, virtualpath virtualpath, int64 hashcode, boolean ensureisuptodate) @ system.web.compilation.buildmanager.getvpathbuildresultfromcacheinternal(virtualpath virtualpath, boolean ensureisuptodate

Spring Data JPA auditing fails when persisting detached entity -

i've setup jpa auditing spring data jpa auditingentitylistener , auditoraware bean. want able persist auditor details on entities predefined identifiers. problem when jpa entity predefined id being persisted , flushed it's auditor details cannot persisted: object references unsaved transient instance - save transient instance before flushing: me.auditing.dao.auditordetails the interesting part when entity generated id saved - everything's fine. in both cases entities new. not pinpoint problem digging through hibernate code i've created sample project demonstrate (test class me.auditing.dao.auditedentityintegrationtest ) has both entities predefined , generated identifiers , should audited. the entities are: @entity public class auditedentitywithpredefinedid extends auditableentity { @id private string id; public string getid() { return id; } public auditedentitywithpredefinedid setid(string id) { this.id = id;

java - blank output on IndriRunQuery in lemur project -

i'm using lemur nlp project, , indexed data succesffully wanna run query on index files indrirunquery command parameter file: <parameters> <index>path-to-index-directory</index> <query> <number>1</number> <text>query sample string</text> </query> <count>50</count></parameters> there no error, there no answer. blank line in output i found answer myself documents in indexing step weren't in format lemur document told documents told make training document in format: <doc> <docno>document-id</docno> <text>dcoument-plain-text</text> </doc> and indexed documents again by: buildindex [parameterfile] user indrirunquery.exe , worked well

android - Appium locating child element with specific value in Java -

i struggling navigation drawer on native android app. so there 11 elements in drawer, 9 visible, rest have scroll down. appium inspector view those elements contain 2 child elements, first - imageview, second - textview element. appium inspector view what want do, create method iterate through visible drawer elements in search element specific name , tap on it, if elements invisible, scroll drawer down/up , repeat iteration. so need loop iterate through textview elements, locate 1 need using text attribute , click on parent element of textview. however i'm struggling locating elements using xpath , appium can not seem find them. can me understand how specify xpath dynamically can iterate through elements? thank you. you try have below. uses pageobject model, along selenium , appium. takes advantage of uiautomator, rather xpath. public class pageobjectxyz { private androiddriver driver; @androidfindby(uiautomator = "new uiselector().cl

javascript - Click Not Firing on Button -

i have html button hooked jquery function @ top of page, click not seem firing? there i'm missing? $(function(){ $('#ctl00_content_hidepast').click(function() { var dt = new date($.now() - 30 * 60000); var time = dt.gethours() + ":" + dt.getminutes() + ":" + dt.getseconds(); $("td.bgtime").each(function() { var bookingtime = ($(this).text().split(':')); var d = new date(); d.sethours(+bookingtime[0]); d.setminutes(bookingtime[1]); var state = $("#ctl00_content_hdnpastbookingtoggle").val(); if ($(d) > time) { var timerow = $(this).parent(); $(timerow).toggle("slow", function() {

visual studio - "Debugging is being stopped" but is not yet complete -

Image
all of sudden, visual studio has begun popup message every time want break asp.net project. how can rid of dialog? there nothing complete, debug session rid of. clicking "stop now" button not stop execution, wait seconds. from know, have not changed configuration dialog.

android ImageView in RecyclerView loads the same image in random positions -

the recyclerview using has imageview background emptyheart image initially.when touched should change filledheart image.i add checked positions arraylist using getadapterposition() of recyclerviewadapter , remove if arraylist contains touched position.but when scroll imageview's background changed @ random positions. recycleradapter: public class shopofferrecycadapter extends recyclerview.adapter<shopofferrecycadapter.shopofferholder> { view view;int counter=0;arraylist checkeditems; @override public shopofferholder oncreateviewholder(viewgroup parent, int viewtype) { view= layoutinflater.from(parent.getcontext()).inflate(r.layout.shop_offers_recycler_adapter,parent,false); return new shopofferholder(view); } @override public void onbindviewholder(shopofferholder holder, int position) { displayimageoptions options = new displayimageoptions.builder().showimageonloading(r.drawable.mobile) .showimageforempt

c++ - Declare var outside loop is bad? -

i wrote basic code dsp/audio application i'm making: double input = 0.0; (int = 0; < nchannels; i++) { input = inputs[i]; and dsp engineering expert tell me: "you should not declare outside loop, otherwise create dependency , compiler can't deal efficiently possible." he's talking var input think. why this? isn't better decleare once , overwrite it? maybe somethings different memory location used? i.e. register instead of stack? many people think declaring variable allocates memory use. not work that. not allocate register either. it creates name (and associated type) can use link consumers of values producers. on 50 year old compiler (or 1 written students in 3rd year compiler construction course), may implemented indeed allocating memory variable on stack, , using every time variable referenced. it's simple, works, , it's horribly inefficient. step putting local variables in registers when possible, uses registers i

What configuration to do in IDP to initiate SLO and how to consume IDP initiated SLO response in SP using SAML 2.0 -

we build sso in application login using saml 2.0. here want build idp initiated slo logout. question 1. configuration need in idp initiate slo? how consume idp initiated slo response in sp using saml 2.0? please me for second question recommend use onelogin toolkits . you can choose asp/.net, java, php, python , ruby. example php toolkit documentation shows in details how implement every step of login/logout process. there similar section ruby .

c++ - Perplexing non-trailing parameter pack behaviour -

i've come across interesting variadic template function behaviour. can point out relevant rules in standard define this? gcc , icc , msvc compile following code (clang doesn't, understand due compiler bugs). template<class a, class... bs, class c> void foo(a, bs..., c) { } int main() { foo<int, int, int, int>(1, 2, 3, 4, 5); } in call foo , template arguments provided a , bs , c deduced int . however, if flip last 2 template parameters: template<class a, class c, class... bs> void foo(a, bs..., c) { } then all three compilers throw errors. here 1 gcc: main.cpp: in function 'int main()': main.cpp:8:42: error: no matching function call 'foo(int, int, int, int, int)' foo<int, int, int, int>(1, 2, 3, 4, 5); ^ main.cpp:4:6: note: candidate: template<class a, class c, class ... bs> void foo(a, bs ..., c) void foo(a, bs..., c) { } ^~~ main.cpp:4:6: note:

file upload - move_uploaded_file php function is not working -

i know similar questions answered many times in site. google , search many forum bt can't solve problem. move_uploaded_file function not working, function cannot upload file due appropriate path. here code $targetpath = "/home/abc/public_html/uploads/"; let website abc.com move_uploaded_file($_files['filedata']['tmp_name'],$targetpath.$_files['filedata']['name']); i have upload file in /public_html/uploads/downloads move_uploaded_file function in /public_html/assets/uploadify input form in /public_html/application/modules/downloads/views/admin location note: code working fine in localhost can suggest path plz dnt mark dublicate assuming upload file in public_html directory, change $targetpath /uploads/ , change move_uploaded_file($_files['filedata']['tmp_name'],"$targetpath".$_files['filedata']['name']); this worked me.

angularjs - Angular2 library size -

Image
i have watched latest ng-conf , saw brad green says angular2 weight 45k, , angular1 56k. try understand number represent, without success. i saw this gist list angular1 , 2 frameworks size. , there different numbers there. the ng-conf youtube link (it's in 57:10). the relevant slide: i understand question ;-) in fact, it's after packaging application , using tree shaking. latter technique leverages modules keep used in application (apply third party libraries well). i think these 2 links you: http://blog.mgechev.com/2016/06/26/tree-shaking-angular2-production-build-rollup-javascript/ https://medium.com/@rich_harris/tree-shaking-versus-dead-code-elimination-d3765df85c80#.6s0vcyv49

model - Magento 1.9 custom module with custom database table not saving -

i have developed custom module has custom database table. however, cannot insert records since presented following error: fatal error: call member function begintransaction() on boolean in /httpdocs/includes/src/__default.php on line 6105 here code trying: $data = array( 'voucher' => 'voucher', 'customer_name' => 'customer_name', 'order' => 'order', 'value' => 'value', 'status' => 1, 'date' => '', ); $model = mage::getmodel('antikatavoles/antikatavoles')->setdata($data); and config file: <?xml version="1.0" ?> <config> <modules> <id_antikatavoles> <version>0.1.0</version> </id_antikatavoles> </modules> <frontend> <routers> <antikatavoles>

email - Autodiscover cannot process the given e-mail address. Only mailboxes and contacts are allowed -

Image
while sending email using exchangeservice throwing exception message is: "the autodiscover service returned error." , "autodiscover cannot process given e-mail address. mailboxes , contacts allowed". public void sendemail(string to, string cc, string subject, string body, string emailtype) { exchangeservice service = new exchangeservice(exchangeversion.exchange2010); service.credentials = new webcredentials("test@outlook.com", "test"); service.traceenabled = true; service.traceflags = traceflags.all; service.autodiscoverurl("test@outlook.com", redirectionurlvalidationcallback); emailmessage email = new emailmessage(service); email.torecipients.add(to); email.ccrecipients.add(cc); email.subject = subject; email.body = new messagebody(body); email.send(); }

jquery - Assign Ajax response to php variable -

how assign ajax response php variable, if possible? in laravel controller have method purpose: public function editproductpost(request $request) { return response()->json([ 'slidervalue' => $request->get('value') ]); } and ajax: /** * ajax post */ $.ajaxsetup({ headers: { 'x-csrf-token': $('meta[name="csrf-token"]').attr('content') } }); $.ajax({ type: 'post', contenttype: "application/json", url: "{{ route('editproductpost', $product->id) }}", headers: { 'x-requested-with': 'xmlhttprequest' }, data: json.stringify({ value: getsliderval, productid : getprid }), datatype: 'json', success: function(response) { // response console.log(response.slidervalue)

exception - Extending TypeError -

php7 introduced typeerror "exception" (i know implements throwable rather extends exception it's not strictly speaking exception, behave in same way far can tell) gets thrown if enable strict mode function parameter type hinting. declare (strict_types = 1); function square (int $val) : int { return $val * $val; } var_dump (square ("123")); the above code should throw typeerror, can optionally catch , attempt recover or terminate execution, depending on appropriate course of action take. however, typeerror seems bit generic, , nice if able extend convey bit more information failure occurred: class typenotinterror extends typeerror {} // throw when int expected class typenotfloaterror extends typeerror {} // throw when float expected class typenotstringerror extends typeerror {} // throw when string expected // etc it should possible extend typeerror because php documentation doesn't state it's final class. however, while can extend

c# - FB Comments Implementation in Windows Phone 8.1 -

i trying implement fb comments in windows phone. tried using web view below <webview x:name="fbcommentstest"></webview> code behind c# fbcommentstest.navigatetostring("<html><head></head><body><div id=\"fb-root\"></div><div id=\"fb-root\"></div><script>(function(d, s, id) {var js, fjs = d.getelementsbytagname(s)[0];if (d.getelementbyid(id)) return;js = d.createelement(s); js.id = id;js.src = \"http://connect.facebook.net/en_us/all.js#xfbml=1&appid=" + app_key + "\";fjs.parentnode.insertbefore(js, fjs);}(document, 'script', 'facebook-jssdk'));</script><div class=\"fb-comments\" data-href=\"" + mexternalurl + "\" data-width=\"500\"></div> </body></html>"); but didn't desired output. web view displays empty page. please guide achieve this

jni - Cannot add .so lib in Android Studio -

this error get: 08-08 12:05:37.198 3680-3680/? e/androidruntime: fatal exception: main process: com.vidyo.vidyoclient, pid: 3680 java.lang.unsatisfiedlinkerror: dalvik.system.pathclassloader[dexpathlist[[zip file "/data/app/com.vidyo.vidyoclient-1/base.apk"],nativelibrarydirectories=[/data/app/com.vidyo.vidyoclient-1/lib/arm, /vendor/lib, /system/lib]]] couldn't find "libvidyoclientapp.so" @ java.lang.runtime.loadlibrary(runtime.java:367) @ java.lang.system.loadlibrary(system.java:1076) @ com.vidyo.vidyoclientlib.lmiandroidappjni.<clinit>(lmiandroidappjni.java:692) @ java.lang.class.newinstance(native method) @ android.ap

javascript - jquery chosen select add vertical scrollbar on mobile devices -

i'm using chosen select (v.1.6.2) , 1 of selects country select. found out there different behavior on mobile devices, in case need same behavior on desktops, found in chosen.jquery.js file code detecting mobiles around line 546 , commented return false below: abstractchosen.browser_is_supported = function() { if ("microsoft internet explorer" === window.navigator.appname) { return document.documentmode >= 8; } if (/ip(od|hone)/i.test(window.navigator.useragent) || /iemobile/i.test(window.navigator.useragent) || /windows phone/i.test(window.navigator.useragent) || /blackberry/i.test(window.navigator.useragent) || /bb10/i.test(window.navigator.useragent) || /android.*mobile/i.test(window.navigator.useragent)) { //return false; <---- here } return true; }; but found out there no vertical scrollbar (which it's shown fine on desktop version) , can't scroll options finger, how fix on mobile? (i have input element filt

angularjs - Several ng-click on button angular? -

i have 1 button have ng-click, this <button type="button" class="btn btn-primary pull-right push-right-5" role="button" ng-click="model.assigntoprojects()">go</button> what need add new action ng-click, this ng-click="submitted=true" the problem have application big , need have common event first event, if valid allow second event, can :( here how html should like <button type="button" class="btn btn-primary pull-right push-right-5" role="button" ng-click="submitted=true ; model.assigntoprojects();">go</button> is possible way or must rewrite entire logic :(

android - Chronometer keep in background time spent -

i developing feature in app when click on button on activity launch service start,pause , resume chronometer . have problem how start , stop in background service . i created activity public class startworkactivity extends activitygeneraltoolbar { protected final void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate, r.layout.activity_start_work); chronometer chronometer = (chronometer) findviewbyid(r.id.chronometer); } @override protected void onstop() { super.onstop(); } public void startwork(view v){ intent msgintent = new intent(startworkactivity.this, worktimerservice.class); msgintent.setaction("start_timer"); getbasecontext().startservice(msgintent); } public void pausework(view v){ intent msgintent = new intent(startworkactivity.this, worktimerservice.class); msgintent.setaction("pause_timer"); } public void r

excel - Pivot Table Field has no items -

i working on series of pivot tables on excel, particular filter automated in following way: user inputs particular value in 1 cell, , filters across workbook refresh accordingly. have been reading posts in stack exchange explain how it. however, have come across issue have been unable solve. my data comes external microsoft access database. have created connexion between database , excel file; data imported excel file displayed table tblexcel . pivot tables linked tblexcel . to refresh filters, want use following line: item.visible = (item.caption = cd) where item pivotitems object , cd value inputted user. line wasn't working, wrote following subroutine check something: sub test() check = 0 each field in application.activeworkbook.worksheets("sheet1").pivottables("pivottable").pivotfields("[tblexcel].[field1].[field1]").pivotitems check = check + 1 next msgbox check end sub it turns out msgbox returns invariably 0, fields,

android - Sending datagram - network unreachable -

i'm trying broadcast udp packets between 2 android devices on hotspot. i have client set hotspot, , server connected hotspot. sending package client , receiving packet on server working. when try reply server, socketexception, saying network unreachable. i've checked ip address , port number , both should correct (i'm assuming port correct because taken packet itself). the code server , client below. can see code going wrong or if it's network connectivity issue? client: try { //open random port send package c = new datagramsocket(); c.setbroadcast(true); byte[] senddata = "discover_mv_request".getbytes(); try { inetaddress addr = getipaddress(); datagrampacket sendpacket = new datagrampacket(senddata, senddata.length, getbroadcast(addr), 8888); c.send(sendpacket); } catch (exception e) { c.close();