Posts

Showing posts from September, 2014

How to correctly use ng-View with md-tabs in AngularJS and Angular Material -

i trying use angular material md-tabs in web site each tabs represents different url determined using ng-view tag. web site here: here . visually works i'm noticing pages loaded 5 times every time change tab .... once each tab location. is there setting or need change correctly? the code tabs follow: <div class="tabsdemodynamicheight"> <md-content class="md-padding"> <md-tabs md-dynamic-height md-border-bottom md-selected="selectedindex"> <md-tab label="featured"> <md-content class="md-padding"> <div ng-view></div> </md-content> </md-tab> <md-tab label="art sale"> <md-content class="md-padding"> <div ng-view></div> </md-cont

php - MassAssignmentException in laravel5 -

i used laravel5...and want store data in database , when press submit error appeared > massassignmentexception in c:\xampp\htdocs\marriage\vendor\laravel\framework\src\illuminate\database\eloquent\model.php line 417: _token my controller code public function store(request $request) { $custom =request::all(); custom::create($custom); return redirect('custom'); } model code class custom_table extends model { protected $fillable=[ 'skin_color', 'cast', 'residence', 'family_members', 'hieght', 'created_at', 'updated_at' ]; } please me how resolve error you running error, because request passing "_token" attribute, , not mass assignable. you can exclude using except method, such: public function store(request $request) { $custom = request::except('_token'); // exclude _token attribute custom::create($custom); return redi

Sum notation in julia? -

Image
i wondering if knew of julia equivalent function sum using sigma. example if wanted sum of sort (unsure of how show sigma notation, here picture of looking for): both c , x matrices define earlier in code. know how code in julia or whether julia has equivalent function? have used sum more simple vector sums, not sure if translate larger matrices. ideas? if talking plain-old-julia variables c = rand(5,3) x = rand(5,3) @show sum(c.*x) but if referring jump (based on previous questions), use sum{} : using jump m = model() @variable(m, 0 <= x[i=1:5,j=1:3] <= 1) c = rand(5,3) @constraint(m, sum{c[i,j]*x[i,j],i=1:5,j=1:3} <= 10)

python - django - how to implement a 2-step publish mechanism -

i'm new both web development , django maybe that's noob question. i want following: ask user fill form , submit it. then, parse , format content , display user let him verify it. user can accept result or go previous view, update data , resend. this far can think: views.py def add_content(request): if request.method == 'post': form = addcontentform(request.post) if form.is_valid(): content = form.save(commit=false) return verify_content(request, content) else: form = addcontentform() return render(request, 'myapp/add_content.html', {'form' : form}) def verify_content(request, content): return render(request, 'myapp/verify_content.html', {'content' : content}) the verify_content template contain 2 buttons ('back', 'ok'), don't know how pass content object view saving in db, or send previous view there. should use js? can server side cod

driver - What happens when a Python program exits and a library is loaded using ctypes? -

i have tried find information on this, nothing far. scenario python program uses c based library loaded ctypes , encounters unhandled exception. python unlioad library? or matter? the main reason why issue library in question device driver, , want avoid leaving hardware in wrong state should go wrong.

mysqli - How to search a word on two table if have or not by php query -

i want find out userid 2 table username username have stayed in table2 or not. means if username match in table query collect userid. table 1: username --- userid > john --- 100 table 2: username --- userid > colin --- 101 i read many article here nut cannot understand should do. now think: need john's uesrid, so tried: $username = "john"; $q = "select userid table1,table2 table1.username = '$username' or table2.username = '$username'"; $result = mysqli_query($this->connection, $q); from understand want check if name exist in 1 of tables. here easy php code: <?php session_start(); include 'db_connect.php'; $check_1 = mysqli_query("select * table_1 username = '$username'"); $check_2 = mysqli_query("select * table_2 username = '$username'"); if(mysqli_num_rows($check_1)==0){ //didnt exist in table 1 } else if(mysqli_num_rows($check_2)==0){

how to list all pdf files in my android device -

i found code how images. can tell me how can .pdf files in internal storage , external storage? final string[] columns = { mediastore.images.media.data, mediastore.images.media._id }; final string orderby = mediastore.images.media._id; //stores images gallery in cursor cursor cursor = getcontentresolver().query( mediastore.images.media.external_content_uri, columns, null, null, orderby); //total number of images int count = cursor.getcount(); //create array store path images string[] arrpath = new string[count]; (int = 0; < count; i++) { cursor.movetoposition(i); int datacolumnindex = cursor.getcolumnindex(mediastore.images.media.data); //store path of image arrpath[i]= cursor.getstring(datacolumnindex); log.i("path", arrpath[i]); } possible solution can go every folder , check if .pdf exists or not if yes can whaterver want file public void search_dir(

ios - How to use Objective-C Cocoapods in a Swift Project? -

is there way can use cocoapod written in objective c in swift project using swift? do make bridging header? , if so, can access objects, classes, , fields defined libraries in cocoapod in swift? there lot of cocoapods out there written in objective c. know swift, , i'm wondering if there's way me still use cocoapods. basic answer question yes, can use objective-c code built cocoapods. more important question "how use such libs?" answer on question depends on use_frameworks! flag in podfile : let's imagine want use objective-c pod name coolobjectiveclib . if pod file uses use_frameworks! flag: // podfile use_frameworks! pod 'coolobjectiveclib' then don't need add bridge header files. need import framework in swift source file: // myclass.swift import coolobjectiveclib now can use classes presented in lib. if pod file doesn't use use_frameworks! flag: // podfile pod 'coolobjectiveclib' then need

javascript - how can I compare dates in array to find the earliest one? -

i have variable called datearray dates in example ["09/09/2009", "16/07/2010", "29/01/2001"] and want find earliest 1 loop result be "29/01/2001" - or datearray[2] the language javascript sometimes basic approach best: var dates = ["09/09/2009", "16/07/2010", "29/01/2001"]; var min = dates[0]; for(var = 1; < dates.length; i++) { if (fdate(dates[i]) < fdate(min)) min = dates[i]; } alert(min); // create proper date object string function fdate(s) { var d = new date(); s = s.split('/'); d.setfullyear(s[2]); d.setmonth(s[1]); d.setdate(s[0]); return d; } the code wrote above converts each string date object, , finds minimum (the earliest date) them. no string hacks, straightforward date comparison. returns original string array.

bonjour - How to get MACaddress using Android - jmdns -

i need mac-address of particular device.i'm using android - jmdns service scan devices , ip-address need mac-address of particular device.can mac-address while getting ip-address using android - jmdns service or other way mac-address ip-address? you need permission in androidmanifest.xml // androidmanifest.xml permissions <uses-permission android:name="android.permission.access_wifi_state"></uses-permission> <uses-permission android:name="android.permission.update_device_stats"></uses-permission> <uses-permission android:name="android.permission.change_wifi_state"></uses-permission> you can try fist solution wifimanager wifimanager = (wifimanager) this.getsystemservice(context.wifi_service); if(wifimanager.iswifienabled()) { // wifi enabled. grab mac address here wifiinfo info = wifimanager.getconnectioninfo(); string address = info.getmacaddress(); } else { // enable wifi first

php - Not able to install Sonata Project -

i came across sanota project , wanted give try. trying install bundles of sanota project following quick installation steps mentioned here and when run website php app/console server:run see white screen. dont see error in app_dev.log i cross checked if bundles enabled in appkernel.php , seem be. public function registerbundles() { $bundles = array( // symfony standard edition new symfony\bundle\frameworkbundle\frameworkbundle(), new symfony\bundle\securitybundle\securitybundle(), new symfony\bundle\twigbundle\twigbundle(), new symfony\bundle\monologbundle\monologbundle(), new symfony\bundle\swiftmailerbundle\swiftmailerbundle(), new sensio\bundle\frameworkextrabundle\sensioframeworkextrabundle(), new jms\aopbundle\jmsaopbundle(), new jms\securityextrabundle\jmssecurityextrabundle(), new symfony\bundle\asseticbundle\asseticbundle(),

malware - wcf and the plague called Hao123 -

i have wcf service uses http (and specific port, of course) communicate on network. whenever service installed on computers "application" hao123 (and other types such termblazer, ad-search, etc), not work right, because requests made him not reach contracts created. what protect application of type of malware? believe unfeasible create "removal tool" each type of pest such can find in user's machine. failing install service not option.

mysql - Should I use the commands My Sql in capital letters? -

this question has answer here: is sql syntax case sensitive? 10 answers please excuse me if question simple. because when see the examples php , mysql in internet, use capital letters commends mysql . is necessary use the capital letters in mysql ? $sql = "insert myguests (firstname, lastname, email) values ('john', 'doe', 'john@example.com')"; it not required use capital letters. use small letters too. however structure of code, beautify code , show highlights better use capital letters in syntax such insert instead of insert. identify when write complicated scripts subqueries. and per human nature, capital letters fast visible small letters. hope helps.

php - Codeigniter 3 : 404 page error, .htaccess not working -

it may old , regular query codeigniter + 404 page error. have tried answered previous stackoverflow questions this. but, couldn't solve problem. have copied codeigniter project system (ubuntu os 64 bit) ubuntus os system. but, getting 404 page default.if give http://localhost/project/index.php/admin/login working not http://localhost/project/admin/login or http://localhost/project . here configuration: config.php $config['base_url'] = 'http://localhost/html/project'; $config['modules_locations'] = array( apppath.'modules/' => '../modules/', ); $config['index_page'] = ''; $config['uri_protocol'] = 'auto'; and .htaccess file: options followsymlinks <ifmodule mod_rewrite.c> rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?/$1 [l] </ifmodule> <ifmodule !mod_rewrite.

javascript - Modal Windows and Div Refresh -

i have problem prototype.js modals , function <div> refresh. i try create modals clicking on link in top menu. when modal function executes, <div> elements disappear. why happen? $(document).ready(function() { $("#presenti").load("presenti.php"); var refreshid = setinterval(function() { $("#presenti").load('presenti.php?randval=' + math.random()); }, 5000); }); $(document).ready(function() { $("#sms").load("message.php"); var refreshid = setinterval(function() { $("#sms").load('message.php?randval=' + math.random()); }, 10000); }); $(document).ready(function() { $("#lallero"); var refreshid = setinterval(function() { $("#lallero").load(location.href + " #lallero"); }, 3000); }); whole html <html> 0) { echo "(".$nonletti .") teen wolf gdr";} else { echo "teen wolf gdr"; }?>

linux - Check for errors in a script command -

how check error in command before run it, example, if wanted run iptables command, input wrong variable of script made, example "asdiojaosdi" $port variable, , when script tries plug iptables command, returns error, want echo "error" i want syntax check huge command iptables -t nat -a prerouting -p tcp -d $filip --dport $port -j dnat --to-destination $cusip && iptables -a forward -p tcp -m state --state new,established,related -j accept && iptables -t nat -a postrouting -d $cusip -j snat --to-source $secip && iptables -t nat -a postrouting -j snat --to-source $filip in ixish environments, programs commonly return value different 0 in case of failure. error messages expected logged standard error, can captured via redirecting file descriptor 2 . you can test so: #!/bin/bash program option1 option2 2>error.log.$$ result=$? if [ $result -ne 0 ]; echo program failed result=$result: $(cat error.log.$$) rm error.l

Extra zero in Android version code -

Image
i'm building release android apk, have following attributes in androidmanifest.xml, inside <widget> declaration: version="1.0.0" android-versioncode="11" when upload developer console i'm seeing following: why getting trailing 0 @ end? normal? version code , name defined in build.gradle file. change them there (within defaultconfig part) , should show properly.

mvc mini profiler - Can't get MVC MiniProfiler to show on ASP.net website -

my web.config file: <?xml version="1.0" encoding="utf-8"?> <configuration> <configsections> <section name="rewriter" requirepermission="false" type="intelligencia.urlrewriter.configuration.rewriterconfigurationsectionhandler, intelligencia.urlrewriter" /> </configsections> <system.web> <customerrors mode="on" redirectmode="responserewrite"> <error statuscode="500" redirect="~/content/errorpages/500.aspx" /> <error statuscode="404" redirect="~/content/errorpages/404.aspx" /> </customerrors> <compilation debug="true" targetframework="4.5.1" /> <httpruntime targetframework="4.5.1" /> <httpmodules> <add type="intelligencia.urlrewriter.rewriterhttpmodule, intelligencia.urlrewriter" name="urlrewriter"

c# - SqlDependency/Query notification - SQL Server reboot -

i have application running on server has sqldependency / query notification - monitoring changes on table on different server. it works fine until reboot/restart sql server. when sql server rebooted due maintenance , patches, other application throws following errors , stops. can stops because not monitor changes once sql server , running. i have restart application resubscribe query notification. not throwing exception inside code stop application. catching exception , sending email. system.data.sqlclient.sqlexception (0x80131904): transport-level error has occurred when sending request server. (provider: tcp provider, error: 0 - existing connection forcibly closed remote host.) ---> system.data.sqlclient.sqlexception (0x80131904): network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. i new sqldependency /

c# - How can I detect if my app is running on Windows 10 -

Image
i'm looking means detect if c# app running on windows 10. i had hoped environment.osversion trick, seems return version of 6.3.9600.0 on windows 8.1 , windows 10. other solutions such this don't seem distinguish between windows 8 , windows 10 either. any suggestions? why need this? because i'm using winforms webbrowser control host oauth page crashes , burns in older ie versions (my app connects user's nest account ...). by default, webbrowser control emulates ie7. using registry key, can tell emulate latest version of ie installed on host pc. however, value worked windows 8.1 (and pre-releases of windows 10) not work in final version of windows 10. if @ registry found environment name: hkey_local_machine\software\microsoft\windows nt\currentversion\productname for example product name windows 10 home : with code if windows 10: static bool iswindows10() { var reg = registry.localmachine.opensubkey(@"software\microsof

c++ - What are copy elision and return value optimization? -

what copy elision? (named) return value optimization? imply? in situations can occur? limitations? if referenced question, you're looking the introduction . for technical overview, see the standard reference . see common cases here . introduction for technical overview - skip answer . for common cases copy elision occurs - skip answer . copy elision optimization implemented compilers prevent (potentially expensive) copies in situations. makes returning value or pass-by-value feasible in practice (restrictions apply). it's form of optimization elides (ha!) as-if rule - copy elision can applied if copying/moving object has side-effects . the following example taken wikipedia : struct c { c() {} c(const c&) { std::cout << "a copy made.\n"; } }; c f() { return c(); } int main() { std::cout << "hello world!\n"; c obj = f(); } depending on compiler & settings, following outputs are valid : he

group by - Pandas: expanding_apply with groupby for unique counts of string type -

i have dataframe: import pandas pd id = [0,0,0,0,1,1,1,1] color = ['red','blue','red','black','blue','red','black','black'] test = pd.dataframe(zip(id, color), columns = ['id', 'color']) and create column of running count of unique colors grouped id final dataframe looks this: id color expanding_unique_count 0 0 red 1 1 0 blue 2 2 0 red 2 3 0 black 3 4 1 blue 1 5 1 red 2 6 1 black 3 7 1 black 3 i tried simple way: def len_unique(x): return(len(np.unique(x))) test['expanding_unique_count'] = test.groupby('id')['color'].apply(lambda x: pd.expanding_apply(x, len_unique)) and got valueerror: not convert string float: black if change colors integers: colo

instagram API media popular by Hashtag -

is possible have filter specific hashtag in instagram api media/popular ? work (if possible): /tags/tag-name/media/recent sorted likes their documentation doesn't state possible, wondering easiest way it... instagram doesn't provides filter media/recent, provide number of likes of each picture. can them save on database , sort it. remember have update database likes updated.

jquery - Refresh the page on a browser resize using JavaScript when difference is more than 100px -

i have code website jquery refresh page on browser resize works fine sensitive on mobile devices. shoud add margin of error. how tu use code when difference in browser width more 100px if browser width smaller , larger //refresh page on browser resize $(window).bind('resize', function(e) { if (window.rt) cleartimeout(window.rt); window.rt = settimeout(function() { this.location.reload(false); /* false page cache */ }, 200); }); i'm assuming "when difference in browser width more 100px" means you're attempting detect window has changed in size more 100px. you'll need store original width of window , compare against that: var originalwidth = $(window).width(); $(window).bind('resize', function(e) { if (window.rt) cleartimeout(window.rt); window.rt = settimeout(function() { if (math.abs($(window).width() - originalwidth) > 100) { this.location.reload(false); /* false page cache */

java - How do I serialize a JAXBElement? -

i using: gson 2.3.1 apache-cxf-3.1.1 jboss eap 6.4 i using wsdl2java create webservice client wsdl. i generate classes with: @xmlelementref(name = "fmla_code", namespace = "http://www.ultipro.com/contracts", type = jaxbelement.class) protected jaxbelement<string> fmlacode; when getting object webservice call want make json response caller employmentinformationgetresponse response = port.getemploymentinformationbyemployeeidentifier(employeenumberidentifier); gsonbuilder gsonbuilder = new gsonbuilder(); gsonbuilder.registertypehierarchyadapter(employmentinformationgetresponse.class, new employmentinformationgetresponseadapter()); gson gson = gsonbuilder.disablehtmlescaping().create(); string s = gson.tojson(response); system.out.println(s); the result contains fmlacode=javax.xml.bind.jaxbelement@3191394e what best way me value? i can prefer not alter generated classes, might need generated again later. i tried create typ

javascript - How to detect intervals between keydowns in plain js -

i have tried detect interval between keydowns on div this: window.onload = function() { var p = document.getelementbyid('input'); p.addeventlistener('keydown', function() { if (document.queryselector('.rps')) { p.removeattribute('class') clearinterval('me') } if (!document.queryselector('.rps')) { p.setattribute('class', 'rps') var me = setinterval('interval()', 10) } }, false) } var z = 0; function interval() { z += 1 document.getelementbyid('isp').innerhtml = z; } html: test the problem , start interval() on first key press, not remove class rps required determine whether start or end setinterval . the solution should in plain js - , work on more 1 keypress. don't use setinterval . doing every n milliseconds. you want when key pressed. bind keydown event handler environment (

android - How to force WearableListView.Adapter to redraw? -

i have android wear app has list of 10 items. in mainactivity.oncreate() set listview adapter this: listview.setadapter(new adapter(this, items)); however, items filled dummy data (for debugging purposes) because wear sends message paired phone real data server. once phone sends message wear appropriate data, populate items data. no refresh/redraw occurs though. not if call listview.setadapter() again. know items being updated correctly because once scroll down list, on wear, real data visible (thanks recycle views). appreciated. thanks.

postgresql - How to turn a column of ints into one array in postgres -

i have table 1 column , 400 rows; each row has integer. how can create int array of these integers preserves order? i using postgresql-9.2. select array_agg(int_column order some_column) int_array_column the_table; where some_column column defines "order" of integer values. rows in relational database not have "an order", request "that preserves order" makes sense if have column defines sort order try preserve.

asp.net - Simple ASPX cannot bind to vb.net codebehind -

i have aspx page in vs 2013 solution: <%@ page language="vb" autoeventwireup="false" codebehind="default.aspx.vb" inherits="paypaltester._default" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="head1" runat="server"> <title>source page</title> </head> <body> <form id="form1" runat="server"> </form> </body> </html> and codebehind: namespace paypaltester partial public class _default inherits system.web.ui.page protected sub btnrun_click(sender object, e eventargs) end sub end class end namespace when try compile error could not load type 'paypaltester._default'. if remove inherits="paypaltester._defaul

python - Display a huge file on GUI -

i new programming world. have started learning python. trying develop program gets user input, runs commands in background , display output on web interface. although little more complex, simplicity, can consider as: user enters filename python code runs "cat filename" output displayed on screen. i have python + django + apache setup. using html to display output. working fine long output being returned reasonably small. have huge output (~700 mb) , having difficulty displaying on web interface. code snippet: op = subprocess.check_output(cmd,universal_newlines=true) return render (request, 'display.html', {'op': op}) what best approach display such large content on web? points wanted put on table: store output in file rather string. read file in chunks.in case, can have code write file , read file display simultaneously? don't think idea wanted check. are there python packages intended resolve such problem? django feature? when have hu

javascript - Animation in KineticJS -

i have circle added layer. in top of layer added text. run animation when mouse on circle, when mouse reaches text mouseout callback function called. how can prevent that? var circle = new kinetic.circle({ x: j * xcenterstep + xshift, y: * ycenterstep + yshift, radius: t_radius, fill: t_fill, stroke: t_stroke, strokewidth: t_stroke_w, strokeopacity: 0.1, opacity: 0.3 + t_number * 0.05, }); if (t_number) { circle.tw; circle.on("mouseover", function () { this.tw = new kinetic.tween({ node: this, duration: 0.3, strokewidth: 6 }); this.tw.play(); }); circle.on("mouseout", function () { this.tw.reverse(); }); } // adding text var radiustext = new kinetic.text({ x : circle.getx(), y : circle.gety(), text : t_number, fontsize : radius, fill : '#fff', fontstyl

c++ - Find button clicked event's cause in WindowProc -

i'm learning windows-based gui in c++, set simple project window inside button (and i'm able detect when button clicked). now, in window's windowproc , i'd find "cause" fired wm_command, cause mean want find if button clicked mouse, or if user set on focus , pressed enter(or space) here piece of windowproc : int ucontrol::wndproc(hwnd hwnd, uint message, wparam wparam, lparam lparam) { outputdebugstringnewline((uwindowsdebughelper::getmessagestring(message) + text(" ") + this->gettype()).c_str()); //this writes on vs output window code of message string, example writes "wm_command" when received, instead of "273" switch (message) { case wm_close: destroywindow(hwnd); break; case wm_destroy: postquitmessage(0); break; case wm_command: if(lparam != 0) { if(hiword(wparam) == bn_click

javascript - IE textbox loses focus after DOM modification -

i have search box(normal text box) changes html table after each keypress. on chrome works on ie input box loses focus whenever html table changes. i tried set focus using focus() method makes cursor go beggining of textbox, , don´t want put cursor end of word in textbox, wanted or prevent lose of focus or make cursor behave normally. eg. in case user types 3 letters , goes 1 letter , type new letter don´t want cursor go end of word stay @ same position after typing. got no idea of happend morning ie stopped losing focus , behaved normally. haven´t change code. if possible moderator please close topic.

android - Move marker in Google map when latitude longitude changes -

in application creating array list containing latitude , longitude json , adding marker in map buy suing array list when lat long changes marker moves 1 position create 2 marker instead of moving,if give map.clear(),the whole marker getting disable , enabling want remove old marker how possible without using map.clear(),please help private void setupmapifneeded(view inflatedview) { if (mmap == null) { mmap = ((mapview) inflatedview.findviewbyid(r.id.mapview)).getmap(); mmap.setmylocationenabled(true); location mylocation = mmap.getmylocation(); if (mmap != null) { //mmap.clear(); // setupmap(); mmap.setonmylocationchangelistener(new googlemap.onmylocationchangelistener() { @override public void onmylocationchange(location arg0) { // todo auto-generated method stub final lat

visual studio - How to keep VS2015 NuGet from adding packages to TFS -

vs2013 had bug nuget add packages pending changes, if told not .tfignore . there workaround , doesn't work vs2015/nuget3, , nuget old tricks. there "nu" workaround? :-) microsoft connect item: nuget adds packages tfs despite .tfignore it looks fixed in version 3.2 rc of nuget visual studio 2015 extension - updating version worked me, @ least. a discussion issue can found here recommended update nuget 3.1 3.2 rc. update version 3.2 of extension has been released (found here ) includes fix. clarification to working need 2 things: a nuget.config file containing disablesourcecontrolintegration setting a version of nuget visual studio 2015 extension respects disablesourcecontrolintegration setting (versions 3.2 onward should work) as indicated in docs : nuget first loads nuget.config default location, loads file named nuget.config starting root of current drive , ending in current directory. this means can specify <solution>&l

javascript - Front end profiling -

i trying open source project determine cause of front end slowdown. i seeing long load times on end, full page load takes 10-15 seconds, button clicks can take 30 seconds respond, etc. service running on local network. the load on server quite low (0.1) i'm positive issue rendering, dom processing, , whatever other code running. curl shows extremely fast response, know issue front end. they cannot reproduce on end, can consistently reproduce on end. what else should profiled besides javascript? tools should into? os debian 8, browsers firefox , chromium. thanks! if need profile mobile performance, use chrome on dev machine tool, run app on mobile device.

c++11 - Why does std::make_shared<class T, class...Args>(Args&&... args) require T to have copy constructor? -

i don't understand why class has deleted copy constructor (or contains member, ifstream, has deleted copy constructor , there it, too, has deleted copy constructor) can't used make_shared()? code shows i'm talking class x { private: x(const x&) = delete; int x; public: x(int an_int) : x{an_int} {}; x() : x{10} {} }; int main(int argc, char** argv) { // fails because x has no copy constructor shared_ptr<x> ptr { make_shared<x>( x{8} ) }; shared_ptr<x> ptr2 { new x{10} };// works fine return 0; } you may missing fact make_shared forward arguments constructor of x. in case passing x{8} constructor argument, make_shared forced attempt copy or move construction. in particular example, deleting copy constructor has implicitly deleted move constructor, preventing construction temporary x{8} . what want write this: shared_ptr<x> ptr { make_shared<x>(8) };