texts
sequence
tags
sequence
[ "Count number of time a class method is called in Objective-C", "There is already a topic there showing how to count the number of times a instance method is called within the program:\nCount the number of times a method is called in Cocoa-Touch?\n\nThe code described there is working well with an instance method, but it isn't working with a class method. Somebody knows how to do ?" ]
[ "objective-c", "counter", "class-method" ]
[ "How to use svg 'use' statement with Rails sprockets asset helpers?", "I have an svg in an external file that I want to reference with a use statement in Rails.\n\nIf I do:\n\n%svg\n %use{\"xlink:href\" => \"assets/icon.svg#test\"}\n\n\nwhich generates the html:\n\n<svg>\n <use xlink:href=\"assets/icon.svg#test\"></use>\n</svg>\n\n\nEverything works as expected.\n\nHowever I want this to be able to work with sprockets asset versioning in a similar way to how image_tag works.\n\nI tried to do:\n\n%svg\n %use{\"xlink:href\" => image_url(\"icon.svg#test\")}\n\n\nThis generates the html:\n\n<svg>\n <use xlink:href=\"http://0.0.0.0:5000/assets/icon.svg#test\"></use>\n</svg>\n\n\nThe asset certainly exists at http://0.0.0.0:5000/assets/icon.svg, but the icon does not show. \n\nWhat am I doing wrong? How do I use sprockets asset helpers with svg use statements?" ]
[ "ruby-on-rails", "svg", "sprockets" ]
[ "Continuous object creation in pygame?", "Okay, so I've researched this topic a bit. I'm creating a game in Python's Pygame, a replica of the famous \"Raiden 2\". My game loop is fairly similar to those I've seen around. What I'm trying to do is have the constructor create a bullet object (with my Bullet class) while the space bar is being held. However, the following code only creates a single bullet per keypress. Holding the button does nothing, just creates a single bullet.\n\nwhile game.play is True:\n for event in pygame.event.get():\n if event.type == pygame.KEYDOWN:\n if event.key == pygame.K_SPACE:\n b = Bullet(x, y)\n bullet_group.add(b)\n\n bullet_group.draw(screen)\n\n\nNot sure where to go from here. Any help is welcome and appreciated." ]
[ "python", "python-2.7", "pygame" ]
[ "UNION-ing results from N SQL Server databases", "I have a SQL Server with hundreds of identical databases. I need to be able to grab a subset of the databases and do a query against the first one, then union that with the second, third and so forth. I need to return a result that is just one set of data from all the selected databases.\n\nI want to avoid (if at all possible) doing this with outputting a script and then running that or creating a temp table and inserting values. I am thinking a pointer is my best best, but not really sure....\n\n-- doesn't have to be like this, but this is an example of \n-- one way I might attack the problem\nDECLARE C_CURSOR CURSOR FOR \n SELECT [Name] \n FROM sys.databases \n WHERE name like 'b%_db'\n ORDER BY name\n\nDECLARE @DB_Name AS NVARCHAR(200)\n\nOPEN C_CURSOR\n\nFETCH NEXT FROM C_CURSOR INTO @DB_Name\n\nWHILE(@@FETCH_STATUS = 0)\nBEGIN\n SELECT @DB_Name AS DbName, P.PersonID, P.FirstName, P.LastName, P.Email \n FROM People P\n\n -- UNION?? (doesn't work, but something along the lines of that)?\n\n FETCH NEXT FROM C_CURSOR INTO @DB_Name\nEND\n\nCLOSE C_CURSOR\n\n\nI would expect a result that was something like (represented as CSV)\n\nDbName, PersonID, FirstName, LastName, Email\nDB1, Guid1, Joe, Schmoe, [email protected]\nDB1, Guid2, Jack, Spratt, [email protected]\nDB2, Guid3, John, Doe, [email protected]" ]
[ "sql", "sql-server", "union" ]
[ "How to tell NHibernate that a trigger updates another table?", "I just got a TooManyRowsAffectedException while working with NHibernate and I've seen workarounds for that by injecting a different batcher like here TooManyRowsAffectedException with encrypted triggers, or by modifying the triggers in the database to use SET NOCOUNT ON (I can't use this one since I don't want to modify the database -- it is very complex with more than a hundred tables all related together and I don't want to go mess with it since other applications use it). What I don't understand is why this exception happens. All I do is that I have a Sample object that's got a couple of values that I check, and if the values fit with given criteria, I set the Sample.IsDone row to 'Y' (in our database all booleans are represented by a char Y or N). The code is very simple:\n\nIQueryable<Sample> samples = session.Query<Sample>().Where(s =­­> s.Value == desiredValue);\nforeach (Sample sample in samples)\n{\n sample.IsDone = 'Y';\n session.Flush(); // Throws TooManyRowsAffectedException\n}\nsession.Flush(); // Throws TooManyRowsAffectedException\n\n\nThe Flush call throws whether I put it inside the loop or outside. Is there something I am doing wrong or is it only related with the way the database is made? I tried calling SaveOrUpdate() on the sample before Flush(), but it didn't change anything. I know I can work around this exception, but I'd prefer understanding the source of the problem.\n\nNote: In the exception it tells me the actual row count is 2 and the expected is 1. Why does it update 2 rows since I only change 1 row?\n\nThanks all for your help!\n\nEDIT:\n\nI was able to find out that the cause of that is because there is a trigger in the database updating a row in the Container table (Containers contain Samples) when the sample is updated. Is there a way to configure NHibernate so that it knows about this trigger and expects the right number of rows to get updated?" ]
[ "c#", "nhibernate", "exception", "triggers" ]
[ "spoon gradle : Could not create plugin of type 'AppPlugin'", "my gradle project was build succeed, but when add spoon ,then i got this error (Could not create plugin of type 'AppPlugin')\n\nmy gradle version 1.9\n\nbuild.gradle :\n\nbuildscript {\n repositories {\n mavenCentral()\n }\n dependencies {\n classpath 'com.android.tools.build:gradle:0.7.+'\n classpath 'com.stanfy.spoon:spoon-gradle-plugin:0.9.+'\n }\n}\napply plugin: 'android'\napply plugin: 'spoon'\n\nrepositories {\n mavenCentral()\n}\n\nandroid {\n compileSdkVersion 19\n buildToolsVersion \"19.0.0\"\n\n defaultConfig {\n minSdkVersion 10\n targetSdkVersion 19\n }\n}\n\ndependencies {\n compile 'com.android.support:appcompat-v7:+'\n instrumentTestCompile 'com.jayway.android.robotium:robotium-solo:4.3.1'\n instrumentTestCompile 'com.squareup.spoon:spoon-client:1.0.5'\n}" ]
[ "java", "android", "gradle", "spoon" ]
[ "Iterate based on number provided in json", "I'm getting a number back from json that represents the number of divs I need to create in my template. Is there a way to iterate and create the elements in the template based on this number using dust?" ]
[ "dust.js" ]
[ "how to get a value of the state and manipulate it without changing the state itself in react?", "I'm developing an app with react native. I have an array of object in the state (lettersPosition) and I want to sort it temporally in a variable within a function (but I don't want the state itself to be sorted) : \n\nverifyWord = () => {\n const array = this.state.lettersPosition; \n array.sort(function (a, b) {\n return a.x - b.x;\n });\n var word = \"\";\n array.map(function (char) {\n word += char.letter\n })\n}\n\n\nI tested it and it appears that my state itself was updated after the sorting (even if I called the sort function on the temp array).\n\nIt is like if the 'array' variable contains the whole reference to the state and not only its value. And if I modify that variable, it modifies the state too. \n\nIs it a normal behaviour in react ?\n\nHow can I just get the value of the state and manipulate it without changing the state itself ?\n\nThanks" ]
[ "reactjs", "react-native" ]
[ "Call global variable within a class", "class test() {\n\n function get_signup($user)\n {\n global $hostid;\n foreach ($hostname as $host)\n {\n $hostid = $host->id;\n }\n return $hostid;\n }\n\n function get_login($user)\n {\n global $hostid;\n // get_signup($user);\n echo $hostid;\n } \n}\n\n\nIs that possible to pass a variable globally from one function to another without calling get_signup($user)." ]
[ "php" ]
[ "Passing get values mangles my urls", "Just upgraded from 1.3 to 2.0.3 and I'm trying to migrate all the changes. I'm noticing that the following line\n\necho $this->Html->link('Quote', array('controller'=>'crm_quotes', 'action'=>'index', $lead['id'].'/'.$crmContact['CrmContact']['id']), null);\n\n\nbuilds the url \"/crm_quotes/index/15/21\". When I click the link I'm taken to url:\n\n\"/crm_quotes/index/15%2F212\n\n\nso it's replacing the characters with the html # but it's ultimately breaking the link.\n\nWhen I manually edit the URL to the correct one:\n\n\"/crm_quotes/index/15/21\"\n\n\nthe page loads.\n\nCan someone enlighten me? Should I be using the url function rather than link?\n\nI have a lot of pages that need multiple parameters passed in the url. I was using named parameters but after reading some comments by Mark Story I decided to stop the named parameters as he hinted at their possible removal from future versions." ]
[ "php", "cakephp", "cakephp-2.0" ]
[ "Read XML element from free geo location service", "This is free service to get geo location of an ip address.\n\nI've build a class function to get the xml response. Here is the code.\n\n Public Shared Function GetGeoLocation(ByVal IpAddress As String) As String \n Using client = New WebClient()\n Try\n Dim strFile = client.DownloadString(String.Format(\"http://freegeoip.net/xml/{0}\", IpAddress))\n\n Dim xml As XDocument = XDocument.Parse(strFile)\n Dim responses = From response In xml.Descendants(\"Response\")\n Select New With {response.Element(\"CountryName\").Value}\n Take 1\n\n Return responses.ElementAt(0).ToString()\n Catch ex As Exception\n Return \"Default\"\n End Try\n End Using\n End Function\n\n\nRequesting the request I don't face any problem. The problem is to read return request from the service. For example, ip address 180.73.24.99 will return this value:\n\n<Response>\n<Ip>180.73.24.99</Ip>\n<CountryCode>MY</CountryCode>\n<CountryName>Malaysia</CountryName>\n<RegionCode>01</RegionCode>\n<RegionName>Johor</RegionName>\n<City>Tebrau</City><ZipCode/>\n<Latitude>1.532</Latitude>\n<Longitude>103.7549</Longitude>\n<MetroCode/>\n<AreaCode/>\n</Response>\n\n\nAnd my function GetGeoLocation(180.73.24.99) will return { Value = Malaysia }. How can I fix this function to only return Malaysia. I guess its something wrong with my linq statement.\n\nSolution\n\nDim responses = From response In xml.Descendants(\"Response\")\n Select response.Element(\"CountryName\").Value" ]
[ "xml", "vb.net", "linq" ]
[ "How to pass json data in xamarin forms web view android side", "I am using xamarin forms webview and want to pass username and password json body with url like below.\n\n\n\nI Implement Hybrid webview in xamarin forms\n\nMy PCL Code:\n\npublic class HybridWebView : WebView\n {\n Action<string> action;\n public EventHandler<bool> WebNavigating;\n\n\n public void RegisterAction (Action<string> callback)\n {\n action = callback;\n }\n\n public void Cleanup ()\n {\n action = null;\n }\n\n public void InvokeAction (string data)\n {\n if (action == null || string.IsNullOrEmpty(data)) {\n return;\n }\n action.Invoke (data);\n }\n }\n\n\nMy Android HybridWebViewRenderer Code : \n\n public class HybridWebViewRenderer : ViewRenderer<HybridWebView, Android.Webkit.WebView> \n{\n\n Context _context;\n\n public HybridWebViewRenderer(Context context) : base(context)\n {\n _context = context;\n }\n\n protected override void OnElementChanged(ElementChangedEventArgs<HybridWebView> e)\n {\n base.OnElementChanged(e);\n\n if (Control == null)\n {\n var webView = new Android.Webkit.WebView(_context);\n webView.Settings.JavaScriptEnabled = true;\n webView.SetWebViewClient(new MyWebViewClient(webView,e,this));\n SetNativeControl(webView);\n }\n }\n}\n\npublic class MyWebViewClient : WebViewClient\n{\n const string JavaScriptFunction = \"function invokeCSharpAction(data){jsBridge.invokeAction(data);}\";\n public Android.Webkit.WebView _webView;\n public Android.Webkit.WebView WebView\n {\n get\n {\n return _webView;\n }\n }\n\n public ElementChangedEventArgs<HybridWebView> _element;\n\n public MyWebViewClient(Android.Webkit.WebView view, ElementChangedEventArgs<HybridWebView> element, HybridWebViewRenderer x)\n {\n _webView = view;\n _element = element;\n\n if (_element.OldElement != null)\n {\n _webView.RemoveJavascriptInterface(\"jsBridge\");\n var hybridWebView = _element.OldElement as HybridWebView;\n hybridWebView.Cleanup();\n }\n if (_element.NewElement != null)\n {\n _webView.AddJavascriptInterface(new JSBridge(x), \"jsBridge\");\n\n string url = \"https://Myspecific.com/Account/MobileLogin\";\n string postData = \"{\\\"UserName\\\":\\\"User1\\\",\\\"Password\\\":\\\"pass123\\\",\\\"RememberMe\\\":false}\";\n _webView.PostUrl(url, Encoding.UTF8.GetBytes(postData));\n }\n }\n\n\noutput:\nIt shows wrong username and password\n\nPlease help...\n\nThanks in advance..." ]
[ "xamarin", "webview", "xamarin.forms", "xamarin.android", "android-webview" ]
[ "form notification html css", "I'm trying to create a form where validation hints appear once the user has focused on an input field. I created this originally for a different website but am having trouble converting it to function within a different website. The form hint lies within the .\n\nI think I've missed something out within the CSS marking, would be grateful if anyone had any ideas. \n\nAny help would be much appreciated, thanks in advance.\n\nHere's the HTML\n\n <body>\n<div id=\"container\">\n<div id=\"mast-head\">\n<div id=\"portal-logo\"></div>\n<div id=\"ramsay-logo\"></div>\n</div>\n<div id=\"nav\"><div id=\"logout\"><a href=\"#\">Log Out</a></div><a href=\"#\"><img src=\"images/home-icon.jpg\" width=\"20\" height=\"20\" /></a><span class=\"breadcrumb\">Login</span><span class=\"breadcrumb\">Your Treatment</span>\n</div>\n<div id=\"form-content\">\n <fieldset>\n <form name=\"your-treatment\" action=\"\" method=\"post\">\n <ul>\n <li>\n <label for=\"email\">Proposed operation</label>\n <input type=\"text\" name=\"email\" />\n<span class=\"hint\">This is the name your mama called you when you were little.<span class=\"hint-pointer\"> </span></span>\n </li>\n </ul>\n </form>\n </fieldset>\n</div>\n</div>\n</body>\n\n\nHere's the CSS\n\n .hint {\n display: none;\n position: absolute;\n right: -250px;\n width: 200px;\n margin-top: -4px;\n border: 1px solid #c93;\n padding: 10px 12px;\n /* to fix IE6, I can't just declare a background-color,\n I must do a bg image, too! So I'm duplicating the pointer.gif\n image, and positioning it so that it doesn't show up\n within the box */\n background: #ffc url(pointer.gif) no-repeat -10px 5px;\n}\n\n/* The pointer image is hadded by using another span */\n.hint .hint-pointer {\n position: absolute;\n left: -10px;\n top: 5px;\n width: 10px;\n height: 19px;\n background: url(pointer.gif) left top no-repeat;\n}\n\n\nHere's the Javascript...\n\n<script type=\"text/javascript\">\nfunction addLoadEvent(func) {\n var oldonload = window.onload;\n if (typeof window.onload != 'function') {\n window.onload = func;\n } else {\n window.onload = function() {\n oldonload();\n func();\n }\n }\n}\n\nfunction prepareInputsForHints() {\n var inputs = document.getElementsByTagName(\"input\");\n for (var i=0; i<inputs.length; i++){\n // test to see if the hint span exists first\n if (inputs[i].parentNode.getElementsByTagName(\"span\")[0]) {\n // the span exists! on focus, show the hint\n inputs[i].onfocus = function () {\n this.parentNode.getElementsByTagName(\"span\")[0].style.display = \"inline\";\n }\n // when the cursor moves away from the field, hide the hint\n inputs[i].onblur = function () {\n this.parentNode.getElementsByTagName(\"span\")[0].style.display = \"none\";\n }\n }\n }\n // repeat the same tests as above for selects\n var selects = document.getElementsByTagName(\"select\");\n for (var k=0; k<selects.length; k++){\n if (selects[k].parentNode.getElementsByTagName(\"span\")[0]) {\n selects[k].onfocus = function () {\n this.parentNode.getElementsByTagName(\"span\")[0].style.display = \"inline\";\n }\n selects[k].onblur = function () {\n this.parentNode.getElementsByTagName(\"span\")[0].style.display = \"none\";\n }\n }\n }\n}\naddLoadEvent(prepareInputsForHints);\n</script>\n\n\nThanks again guys!" ]
[ "validation", "css", "forms" ]
[ "MySQL Complex query not returning right results", "I have the following query:\n\n'SELECT * FROM posts LEFT JOIN taxi ON taxi.taxiID = posts.postID\n WHERE (taxi.value = 1 AND taxi.userID ='.$userID.') \n AND ??????????????\n ORDER BY taxi.ID DESC\n LIMIT 10'\n\n\nThe way the site works is the user can tag posts as being \"liked\". When a post is liked, the taxi table is given a new row with taxiID being the same as postID, userID to store the user that liked the post, and value which is set to 1. Disliking a post sets value to 0.\n\nI want to display all posts where value is 1 and userID is $userID - check. However, I also want the query to display all the posts where the user hasn't liked a post yet. Thing is, if the user hasn't liked a post yet, userID is NULL with a corresponding value of NULL. If I query for that, I'll be skipping those posts that other users have liked but the user hasn't.\n\nHere's the taxi table:\n\nID taxiID userID value\n1 1 1 1\n2 1 6 1\n3 1 4 0\n4 2 1 0\n5 2 6 1\n6 2 4 0\n7 3 6 1\n8 3 4 0\n\n\nAssuming $userID is 1, my query ought to display taxiID 1 and 3 (because user 1 liked ID 1 AND hasn't liked or disliked taxiID 3.\n\nThe code I've posted will only result in displaying taxiID 1.\n\nThe question is, what is my missing line in my query supposed to be given the above?" ]
[ "php", "mysql", "null" ]
[ "How can I draw a 3D shape using pygame (no other modules)", "How can I create and render a 3D shape using pygame and without using any other modules. I want to create my own simple 3D engine. I can draw a 3D box just don't know how to adjust the lengths and position of the lines to give the 3D effect when rotating the box. \n\nI struggle to understand the physics in shadowing, depth-perception and lighting when rotating an object\n\nSay I have a box:\n\nclass box1():\n x=100\n y=100\n z=100\n\n size = 150 #length for distance between each point\n\n point1 = 0,0,0 # top left front\n point2 = 0,0,0 # top right front\n point3 = 0,0,0 # bottom left front\n point4 = 0,0,0 # bottom right front\n point5 = 0,0,0 # top left back\n point6 = 0,0,0 # top right back\n point7 = 0,0,0 # bottom left back\n point8 = 0,0,0 # bottom right back\n\n\n\ndef set_points():\n x=box1.x\n y=box1.y\n z=box1.z\n\n size = box1.size\n\n #this part sets all the points x,y,x co-cords at the correct locations\n # _____ 4____6\n # |\\____\\ 1____2\n # | | | Middle [x,y,z]\n # |_| ` | 7____8\n # \\|____| 3____4\n #\n # the +50 is just a test to show the 'offset' of the behind points\n box1.point1 = [x-(size/2),y-(size/2),z-(size/2)] # top left front\n box1.point2 = [x+(size/2),y-(size/2),z-(size/2)] # top right front\n box1.point3 = [x-(size/2),y+(size/2),z-(size/2)] # bottom left front\n box1.point4 = [x+(size/2),y+(size/2),z-(size/2)] # bottom right front\n box1.point5 = [x-(size/2)+50,y-(size/2)+50,z+(size/2)] # top left back\n box1.point6 = [x+(size/2)+50,y-(size/2)+50,z+(size/2)] # top right back\n box1.point7 = [x-(size/2)+50,y+(size/2)+50,z+(size/2)] # bottom left back\n box1.point8 = [x+(size/2)+50,y+(size/2)+50,z+(size/2)] # bottom right back\n\n\ncamara_pos = [20,20,20] # I don't know how to make the points based off this\ncamara_angle = [45,0,0] # or this\n\n\n\nwhile True:\n set_points()\n g.DISPLAYSURF.fill((0,0,0))\n\n for event in pygame.event.get():\n if event.type == QUIT:\n exit()\n\n #draws all the lines connecting all the points .\n pygame.draw.line(g.DISPLAYSURF, (128,128,128), (box1.point1[0],box1.point1[1]),(box1.point2[0],box1.point2[1]))\n pygame.draw.line(g.DISPLAYSURF, (128,128,128), (box1.point3[0],box1.point3[1]),(box1.point4[0],box1.point4[1]))\n pygame.draw.line(g.DISPLAYSURF, (128,128,128), (box1.point2[0],box1.point2[1]),(box1.point4[0],box1.point4[1]))\n pygame.draw.line(g.DISPLAYSURF, (128,128,128), (box1.point1[0],box1.point1[1]),(box1.point3[0],box1.point3[1]))\n\n pygame.draw.line(g.DISPLAYSURF, (128,128,128), (box1.point5[0],box1.point5[1]),(box1.point6[0],box1.point6[1]))\n pygame.draw.line(g.DISPLAYSURF, (128,128,128), (box1.point7[0],box1.point7[1]),(box1.point8[0],box1.point8[1]))\n pygame.draw.line(g.DISPLAYSURF, (128,128,128), (box1.point6[0],box1.point6[1]),(box1.point8[0],box1.point8[1]))\n pygame.draw.line(g.DISPLAYSURF, (128,128,128), (box1.point5[0],box1.point5[1]),(box1.point7[0],box1.point7[1]))\n\n pygame.draw.line(g.DISPLAYSURF, (128,128,128), (box1.point1[0],box1.point1[1]),(box1.point5[0],box1.point5[1]))\n pygame.draw.line(g.DISPLAYSURF, (128,128,128), (box1.point2[0],box1.point2[1]),(box1.point6[0],box1.point6[1]))\n pygame.draw.line(g.DISPLAYSURF, (128,128,128), (box1.point3[0],box1.point3[1]),(box1.point7[0],box1.point7[1]))\n pygame.draw.line(g.DISPLAYSURF, (128,128,128), (box1.point4[0],box1.point4[1]),(box1.point8[0],box1.point8[1]))\n\n pygame.display.update()\n\n\n\n\nCould anyone please explain the theory?\nCould anyone please show me some code to do the math for the points?" ]
[ "python", "3d", "pygame", "theory", "shape" ]
[ "installing only one target in cmake", "I have totally 5 targets. one of them is static library. other 4 are executables.\nI don't want the library to be build for every time. so i just want to compile the library keep it in a particular location so that other executables can refer this library. i understood that we can do this by using install command.\nBut if i use install command, it is compiling all the targets. how to only compile one target and intall it into a location ?\nadd_compile_definitions(CMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_SOURCE_DIR})\nset(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY true)\ninstall(TARGETS mylib DESTINATION lib)" ]
[ "cmake", "cmake-modules", "cmake-language" ]
[ "How to group two rows together in rdlc?", "Top table in image is from generated pdf. I want last 4 rows to be grouped as two row groups like the top row group which is showing northing, easting and area. Effectively the line between header row and value row should not be there. \n\nBut for some reason when i add rows, its not happening the way i expected. How should this be done ?\n\nFor better understanding i have also added snapshot showing the visual cues for the tablix." ]
[ "rdlc" ]
[ "How to change background color of a single mat step icon?", "<mat-horizontal-stepper #stepper>\n <mat-step class=\"red-stepper\">\n <ng-template matStepLabel>\n <span>Step 1</span>\n </ng-template>\n </mat-step>\n <mat-step class=\"red-stepper\">\n <ng-template matStepLabel>\n <span>step 2</span>\n </ng-template>\n </mat-step>\n <mat-step>\n <ng-template matStepLabel>\n <span>Step 3</span>\n </ng-template>\n </mat-step>\n <mat-step>\n <ng-template matStepLabel>\n <span>Step 4</span>\n </ng-template>\n </mat-step>\n</mat-horizontal-stepper>\n\n\nFor example I have here 4 mat-steps, but I want to change the color of the first two of them, how can I achieve this? I know how to change the selected one, but this is not the case.\n\nI've tried applying the bg color of the stepper in different classes but with no success.\n\n.red-stepper {\n .mat-step-icon {\n span.ng-star-inserted {\n background-color: red !important;\n }\n }\n background-color: red !important;\n .mat-step-header .mat-step-icon {\n background-color: #007FAD !important;\n }\n}" ]
[ "css", "angular", "angular-material" ]
[ "R -generating values within an interval with mean value", "How can I generate a set of random values, in an interval [1:5], with mean value 1.8? I've tried sample but dont know how to include the mean value.. rpois keeps returning zero values" ]
[ "r" ]
[ "match 2 strings exactly except at places where there is a particular string in python", "I have a master file which contains certain text- let's say-\n\nfile contains x\nthe image is of x type\nthe user is admin\nthe address is x\n\n\nand then there 200 other text files containing texts like-\n\nfile contains xyz\nthe image if of abc type\nthe user is admin\nthe address if pqrs\n\n\nI need to match these files up. The result will be true if the files contains the text exactly as is in the master file, with x being different for each file i.e. 'x' in the master can be anything in the other files and the result will be true.What I have come up with is\n\narr=master.split('\\n')\nfor file in files:\n a=[]\n file1=file.split('\\n')\n i=0\n for line in arr:\n line_list=line.split()\n indx=line_list.index('x')\n line_list1=line_list[:indx]+line_list[indx+1:]\n st1=' '.join(line_list1)\n file1_list=file1[i].split()\n file1_list1=file1_list[:indx]+file1_list[indx+1:]\n st2=' '.join(file1_list1)\n if st1!=st2:\n a.append(line)\n i+=1\n\n\nwhich is highly inefficient. Is there a way that I can sort of map the files with master file and generate the differences in some other file?" ]
[ "python", "string-matching", "file-mapping" ]
[ "Bootstrap Website does not work on IE", "I have developed this website using Bootstrap. Now some of the javascript and styling is not recognised by IE, which is pretty weird!\n\nHere is the link :\n\n{http://--162.243.241.231--/blue/calculator.html}\n\nAny solutions or ideas are kindly appreciated!" ]
[ "javascript", "php", "html", "internet-explorer" ]
[ "Creating multiple querystrings from drop down lists - Could be 1, 2 or 3 querystrings. How do I do it?", "I have a gridview which can be filtered from one or more values in a querystring. That all works great: e.g. \"?subject=Maths&authorName=Bond_James&type=Magazine\"\n\nThe values passed to the query string come from 3 drop down lists: Subject, Author, Type.\nWhat I'd like is when the user presses \"Filter\" it will take the selected values from the drop down lists and pass them to the querystring - it could be 1 value, 2, or all 3 (like above).\n\nThe drop down lists have an item called \"All Subjects\" / \"All Author\" / \"All Type\" each with a value of -1. The idea being that if the user leaves these items selected then the Filter button just ignores them.\n\nHere is my code so far:\n\n Protected Sub buttonFilterGo_Click(ByVal sender As Object, ByVal e As EventArgs) Handles buttonFilterGo.Click\n\n Dim queryString As String\n Dim selectedAuthorString As String = \"author=\" & dropAuthorList.SelectedItem.Value\n Dim selectedSubjectString As String = \"subject=\" & dropSubjectList.SelectedItem.Value\n Dim selectedTypeString As String = \"type=\" & dropPaperType.SelectedItem.Value\n Const PATH As String = \"~/paper/browse/?\"\n\n\n\n\n\n\n queryString = selectedAuthorString & \"&\" & selectedSubjectString & \"&\" & selectedTypeString\n If IsNothing(queryString) Then\n labelFilterFeedback.Text = \"Apply some filters then press Go\"\n Else\n Response.Redirect(PATH & queryString)\n labelFilterFeedback.Text = \"\"\n End If\n\n\nEnd Sub\n\n\nAlso, one more thing. How do I get the drop down lists to have the filters selected when the page re loads?\n\nI'd really appreciate any help!\n\nEDIT: I changed the default values of the drop down lists to \"\" - this leaves the URL looking messy though ?author=&subject=&type= This works, is it the best way?" ]
[ "asp.net", "vb.net", "query-string" ]
[ "Trying to create a Dice game", "I need to trow a number of dice (based on user input) - two, three, four dice several times (again based on user input). Then I have to add result of each round so that in the end I have a winner. I can print out random numbers by the following code, but have no idea how to add them after several iterations. Please advise!\n\nimport random\n\nlist1 = []\ncount = 0\nnumber_of_dice = int(input(\"\\nHow many dice would ou like to use? \"))\nfor x in range(number_of_dice):\n print(random.randint(1,6))" ]
[ "python-3.x" ]
[ "Visual Studio: Quickly go to bracket's closing pair", "I'm working on Visual Studio 2017 and would like to know if there is any extension/shortcut to quickly go to a selected bracket's matching pair, or at least to get the closing bracket's line highlighted on the scroll bar on the right, so I can scroll there myself." ]
[ "visual-studio", "keyboard-shortcuts", "visual-studio-extensions", "curly-braces" ]
[ "Set up Heroku in Windows", "I am new to Heroku. I followed the tutorials from Heroku website to set up Heroku in Windows. I installed the Heroku Toolbelt. When I run the command $ heroku login, and type in the email and password, I get the following error:\n\nOwner@OWNER-PC ~\n$ heroku login\nEnter your Heroku credentials.\nEmail: qwe\nPassword (typing will be hidden):\n ! Heroku client internal error.\n ! Search for help at: https://help.heroku.com\n ! Or report a bug at: https://github.com/heroku/heroku/issues/new\n\nError: Unable to verify certificate, please set `Excon.defaults[:ssl_ca_path] = path_to_certs`, `Excon.defaults[:ssl_ca_file] = path_to_file`, or `Excon.defaults[:ssl_verify_peer] = false` (less secure). (Excon::Errors::SocketError)\nBacktrace: C:/Users/Owner/.heroku/client/vendor/gems/excon-0.22.1/lib/excon/ssl_socket.rb:55:in `connect'\n C:/Users/Owner/.heroku/client/vendor/gems/excon-0.22.1/lib/excon/ssl_socket.rb:55:in `initialize'\n C:/Users/Owner/.heroku/client/vendor/gems/excon-0.22.1/lib/excon/connection.rb:367:in `new'\n C:/Users/Owner/.heroku/client/vendor/gems/excon-0.22.1/lib/excon/connection.rb:367:in `socket'\n C:/Users/Owner/.heroku/client/vendor/gems/excon-0.22.1/lib/excon/connection.rb:105:in `request_call'\n C:/Users/Owner/.heroku/client/vendor/gems/excon-0.22.1/lib/excon/middlewares/mock.rb:42:in `request_call'\n C:/Users/Owner/.heroku/client/vendor/gems/excon-0.22.1/lib/excon/middlewares/instrumentor.rb:22:in `request_call'\n C:/Users/Owner/.heroku/client/vendor/gems/excon-0.22.1/lib/excon/middlewares/base.rb:15:in `request_call'\n C:/Users/Owner/.heroku/client/vendor/gems/excon-0.22.1/lib/excon/middlewares/base.rb:15:in `request_call'\n C:/Users/Owner/.heroku/client/vendor/gems/excon-0.22.1/lib/excon/connection.rb:246:in `request'\n C:/Users/Owner/.heroku/client/vendor/gems/heroku-api-0.3.11/lib/heroku/api.rb:76:in `request'\n C:/Users/Owner/.heroku/client/vendor/gems/heroku-api-0.3.11/lib/heroku/api/login.rb:9:in `post_login'\n C:/Users/Owner/.heroku/client/lib/heroku/auth.rb:80:in `api_key'\n C:/Users/Owner/.heroku/client/lib/heroku/auth.rb:189:in `ask_for_credentials'\n C:/Users/Owner/.heroku/client/lib/heroku/auth.rb:221:in `ask_for_and_save_credentials'\n C:/Users/Owner/.heroku/client/lib/heroku/auth.rb:84:in `get_credentials'\n C:/Users/Owner/.heroku/client/lib/heroku/auth.rb:41:in `login'\n C:/Users/Owner/.heroku/client/lib/heroku/command/auth.rb:31:in `login'\n C:/Users/Owner/.heroku/client/lib/heroku/command.rb:206:in `run'\n C:/Users/Owner/.heroku/client/lib/heroku/cli.rb:28:in `start'\n c:/Program Files (x86)/Heroku/bin/heroku:29:in `<main>'\n\nCommand: heroku login\nVersion: heroku/toolbelt/2.39.4 (i386-mingw32) ruby/1.9.3\n\n\nIt doesn't matter what email address I typed in, the error is still the same.\n\nI've tried searching it for similar issues, but don't seem to find a solution to fix my problem. Please help me, thank you very much!!" ]
[ "windows", "heroku" ]
[ "Clarification of the term \"Namespace\"", "My understanding of the term \"namespace\" is essentially that of a class; a container of methods and variables. Although that seems to be doubling up on what I consider to be the definition of a class. \n\nCan someone confirm or clarify that belief?" ]
[ "oop", "class", "object", "namespaces" ]
[ "PDO array result as php variable", "Is it possible to set a PDO result as a PHP $variable and use it outside the PDO query? Here is what I am trying to do:\n\nSQL database contains: \n\nnames:\nJohn\nPeter\nAllen\n\n\nMy code looks like this:\n\n$conn = new PDO(\"mysql:host=$host;dbname=$db_name\",$username,$password);\n$conn->query('SET NAMES UTF8');\n$sql = \"SELECT * FROM $tbl_name\";\n$q = $conn->prepare($sql);\n$q->execute(array($title));\n$q->setFetchMode(PDO::FETCH_BOTH);\n\nwhile($data = $q->fetch()){\n$phpvar = \"$data[names], \";\n}\n\necho $phpvar;\n\n\nThe result I want from \"echo $phpvar;\" is: \n\nJohn, Peter, Allen" ]
[ "php", "arrays", "variables", "pdo" ]
[ "ApiRTC: Is there a way to get a call duration, or hang up call at specific duration or time?", "I am working on a project that includes real-time communication through ApiRTC?\n\nLooking for a solution to destroy call at specific duration, or at specific time, for example at 6PM?\n\nIs there any way to get call duration and based on that destroy (hang up) a call?" ]
[ "javascript", "laravel", "webrtc", "real-time", "real-time-clock" ]
[ "jQuery spaces in id name", "I have the following html:\n\nHTML\n\n<span id=\"plus one\">Plus One</span>\n\n\njQuery\n\n$(\"#plus one\").hide();\n\n\nThe jQuery to hide the span doesn't work and I suspect it is because there is a space in the id name.\n\nI cannot change the id name or use a class orname as an alternative. Is there anyone other way to deal with this? All feedback welcomed - thanks." ]
[ "jquery", "html" ]
[ "Setting up react-bootstrap simple app", "I am setting up a getting-started app using react-bootstrap + requirejs + bower + php ( not nodejs). Very new to this spectrum of tools. so here is my app:\n\n.bowerrc\n\n{\n \"directory\": \"javascript/components/\",\n \"analytics\": false,\n \"timeout\": 120000\n}\n\n\nbower.json\n\n{\n \"name\": \"hello-react-bootstrap\",\n \"version\": \"1.0.0\",\n \"dependencies\": {\n \"requirejs\": \"*\",\n \"react\": \"~0.13.1\",\n \"react-bootstrap\": \"~0.20.0\"\n }\n}\n\n\nindex.html\n\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <title>Hello World</title>\n\n<!-- Bootstrap Core CSS --> \n <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css\"/>\n\n\n\n \n\n <!-- Require Js -->\n <script data-main=\"javascript/setup.js\" src=\"javascript/components/requirejs/require.js\"></script>\n\n</body>\n</html>\n\n\njavascript/setup.js\n\nrequirejs.config({\n baseUrl: \"javascript/components\",\n paths: {\n \"app\": \"../app\",\n 'classnames':'classnames/index',\n 'jquery': 'https://code.jquery.com/jquery-2.1.3.min',\n 'react':'react/react',\n 'react-bootstrap':'react-bootstrap/react-bootstrap'\n }\n});\n\nrequire.config({\n urlArgs: \"bust=\" + (new Date()).getTime()\n})\n\nrequirejs([\"app/main\"]);\n\n\njavascript/app/main.js\n\n//empty for now\n\n\napplication structure\n\n── bower.json\n├── index.html\n├── javascript\n│   ├── app\n│   │   └── main.js\n│   ├── components\n│   │   ├── classnames\n│   │   ├── react\n│   │   ├── react-bootstrap\n│   │   └── requirejs\n│   └── setup.js\n└── styles\n\n\nI tried sth like this:\napp/main.js\n\ndefine(['react-bootstrap'], function(ReactBootstrap){\n var React = require('react');\n var Button= ReactBootstrap.Button;\n React.render(Button,document.body)\n});\n\n\nwhich gives me :\nError: Invariant Violation: React.render(): Invalid component element. Instead of passing a component class, make sure to instantiate it by passing it to React.createElement.\n\nEdit\nDisregard my question following is working for me :\n\napp/main.js\n\ndefine(['react-bootstrap'], function(ReactBootstrap){\n var React = require('react'); \n React.render(React.createElement(ReactBootstrap.Button,{bsStyle:'info'},'Hello World' ), document.body)\n});" ]
[ "javascript", "requirejs", "reactjs", "bower", "react-bootstrap" ]
[ "add border to dynamic range vba", "I have a excel file with raw data broken into ranges, and what is fixed is the data has 6 columns and data starts with 2 rows below the headers.\n\nI am getting new data each week so each range (or chunk of data) has different sizes meaning last used row and last used column will vary. I have posted a sample data so you get an idea, and I only posted 3 ranges so it fits fine in the picture; and desired results.\n\nThis is part of the larger codes I have written, so I am hoping to achieve this by writing vba codes.\n\nMy task is to add border to each range but only the data portion, and I am getting error of Loop without Do. \n\nSub test()\n\nDim d, e As Long\nDim c As Range\n\nWith Sheet1.Rows(3)\n Set c = .Find(\"Status\", LookIn:=xlValues)\n\n If Not c Is Nothing Then\n firstAddress = c.Address\n With c\n d = Cells.SpecialCells(xlCellTypeLastCell).Row\n e = c.row\n End With\n Do\n With c.Offset(d-e+2, 6)\n With .Borders(xlEdgeLeft)\n .LineStyle = xlContinuous\n .Weight = xlMedium\n .ColorIndex = xlAutomatic\n End With\n With .Borders(xlEdgeTop)\n .LineStyle = xlContinuous\n .Weight = xlMedium\n .ColorIndex = xlAutomatic\n End With\n With .Borders(xlEdgeBottom)\n .LineStyle = xlContinuous\n .Weight = xlMedium\n .ColorIndex = xlAutomatic\n End With\n With .Borders(xlEdgeRight)\n .LineStyle = xlContinuous\n .Weight = xlMedium\n .ColorIndex = xlAutomatic\n End With\n\n Set c = .FindNext(c)\n Loop While Not c Is Nothing And c.Address <> firstAddress\n End With\n End If\n\nEnd With\nEnd Sub" ]
[ "vba", "excel" ]
[ "RealTime Data Update in Excel to Matlab", "I would like to know if someone has some experience in making Excel talk to Matlab in RealTime. I have data in Excel which are updated in realtime, but I want to see the same thing in Matlab.\n\nI know we can use the DDE connection or even the Spreadsheet Link Ex but its never realtime meaning you need to excute a command before this gets done.\n\nDo you have a way to do that automaticallY?" ]
[ "matlab", "excel" ]
[ "How to set line color of openpyxl ScatterChart", "I am trying to set the line of an openpyxl scatter chart to green:\n\nfrom openpyxl import *\n\nbook = workbook.Workbook()\nws = book.active\nxRef = chart.Reference(ws, min_col=1, min_row=2, max_row=22)\nyRef = chart.Reference(ws, min_col=2, min_row=2, max_row=22)\nchart.Series(yRef, xvalues=xRef, title='test')\nlineProp = drawing.line.LineProperties(solidFill = 'green')\nseries.graphicalProperties.line = lineProp \n\n\nWhile this code does not cause any problems, it does not change the line color from the default. What is the correct way to change the line color? \n\nInterestingly I have no problem setting the style to dashed or dotted using:\n\nlineProp = drawing.line.LineProperties(prstDash='dash')\nseries.graphicalProperties.line = lineProp" ]
[ "python", "openpyxl" ]
[ "access denied (\"java.net.SocketPermission\" when calling from another Thread", "I got some java fxml application and im sending some http request with apache httpclient. When I'm calling my function from DesignController (after clicking some layout element) everything works ok:\n\n@FXML\npublic void clickarea(MouseEvent event) {\n myFunction();\n}\n\n\nbut when i want to call it from my mail application class (i use runLater() becouse without it i got an exeption that i can modify UI from other thread):\n\nPlatform.runLater(() -> {\nDesignController dc = (DesignController) fxmlLoader.getController();\n dc.myFunction();\n });\n\n\nI get some error: access denied (\"java.net.SocketPermission\"....\nWhen I check a console I can see:\n\nnetwork: Connecting http://149.126.77.9:80/ with proxy=DIRECT\njava.io.IOException: Server returned HTTP response code: 503 for URL: http://149.126.77.9:80/crossdomain.xml\n\n\nI dont know why same function works diffrent in these cases. Why is it checking crossdomain file only when I call my function from main thread?\n\nI was trying to turn off checking for this file or set that 503 is not an error code but I dont know how.\n\nI also noticed that when i call this funtion from main thread i can see in console: network: Connecting http://IP..... but when i call it from DesignController instead of IP i can see domain" ]
[ "java" ]
[ "Getting distinct value of the _id field in mongo db", "I have a collection which is the result of a map_reduce that looks like this.\n\n[\n {\n _id: { id_field1: 'id_field_value1', ... }\n value: { value_field1: 'value_field_1' }\n },\n ... \n]\n\n\nNow I want to get the distinct values of _id.field1\nBut\n\ncollection.distinct('_id.id_field1') \n\n\nreturns an empty list.\n\nIf I do \n\ncollection.distinct('value.value_field1') \n\n\nI get the expected results. (As point out here : MongoDB: How to get distinct list of sub-document field values?)\n\nIs there any reason why I can't distinct values from the id of the document?\n\nEDIT:\nmongo 2.5.5\nactual document \n\n db.collection.findOne()\n\n { _id : { year : 2013, month : 11, date : 2, language : en-US},\n value : { sentence_eval : { Num : 36, PerfectMatch : 33} }\n }\ndb.collection.distinct('value.sentence_eval.Num)\n[36,...]\ndb.collection.distinct('_id.language')\n[]" ]
[ "mongodb" ]
[ "How to increase the value of y by one every time on this loop", "I am doing some basic Python in Blender and I want to add in a grid of cubes. If you can imagine that as count is 5 this creates a 5x5 grid of 25 cubes. However, I've got the code working so that the x axis increases each time but don't know how to edit the nested for loop so it does the same and increases along the y, as at the moment all that happens is you get a 5-long line of cubes with 5 more cubes layered on top of it.\n\n#how many cubes you want to add on each axis\ncount = 5\n\nfor i in range (0,count):\n for cube_instance in range(0,count):\n x = 1\n y = 1\n z = 0\n bpy.ops.mesh.primitive_cube_add(location=(x * cube_instance + 1,y,z))\n\n\nThanks for any help." ]
[ "python", "for-loop", "nested-loops", "blender" ]
[ "Web services for iOS application with C# using mysql?", "I am working on iPhone application with web services.\n\nUsing HTTP POST method I tried post the data. But data is saving in database. The response I'm getting is 404 or 400. here C# is used instead of PHP.\n\nNSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@\"\"]];\n\nNSString *userUpdate =[NSString stringWithFormat:@\"Name=%@,FirstName=%@,DateofBirth=%@,Sex=%@,Country=%@,City=%@,PhoneNumber=%@,IncumbentonPremimum=%@\",Name,FirstName,DateofBirth,Sex,Country,City,PhoneNumber,IncumbentonPremimum];\n\nNSData *data1 = [userUpdate dataUsingEncoding:NSUTF8StringEncoding];\n[request setHTTPMethod:@\"POST\"];\n\nNSString *postLength = [NSString stringWithFormat:@\"%d\",[data1 length]];\n\n[request setValue:postLength forHTTPHeaderField:@\"Content-Length\"];\n\n[request setValue:@\"application/x-www-form-urlencoded\" forHTTPHeaderField:@\"Current-Type\"];\n\n[request setHTTPBody:data1];\n\nNSURLConnection *conn = [[NSURLConnection alloc]initWithRequest:request delegate:self];\n\nNSString *resSrt = [[NSString alloc]initWithData:responseData encoding:NSASCIIStringEncoding];\n\n//This is for Response\nNSLog(@\"got response==%@\", resSrt);`" ]
[ "ios", "objective-c" ]
[ "INOUT parameter failure for stored procedure called from prepared statement", "Here's my stored procedure:\n\nDELIMITER $$\n\nCREATE DEFINER=`root`@`localhost` PROCEDURE `testProc`(INOUT num INT(11), INOUT num2 INT(11))\nBEGIN\n set num2 = num+7;\nEND\n\n\nHere's the code that calls it:\n\n$newId = 1;\n$type - 2;\n\nif ($stmt = mysqli_prepare($con, 'call testProc(?,?)')) {\n mysqli_stmt_bind_param($stmt, 'ii', $type,$newId);\n mysqli_stmt_execute($stmt);\n mysqli_stmt_bind_result($stmt, $type,$newId);\n echo $newId;\n exit;\n }\n\n\nI expected $newId to hold 9. It still holds 1.\n\nmysqli_stmt_bind_result() seems redundant, as I don't actually have a result set (and I think its existence causes bugs later because I don't have a result set), but this code falls over without it (My actual code doesn't but I don't know why). That's may be moot though.\n\nPlease can anyone show me how to change this code to make it work?" ]
[ "php", "mysql", "stored-procedures", "prepared-statement" ]
[ "maxConcurrency in Mule 4", "I am new to mule and trying to understand how max concurrency works? I understand that is to the determine how many simultaneous request can be received. But I have a question, in case I have huge incoming requests to the application, if I set the max concurrency will the subsequent requests be in queue or it error out or data will be lost?\nFor example, say I am getting around 10,000 requests to my application and I set the max concurrency to 1000. So the other 9000 will be in the queue or there is a chance of data loss?\nAlso what would be the ideal max concurrency that can be set for flow?\nThanks in advance." ]
[ "mulesoft", "mule4" ]
[ "YUI event listener for changes in a variable", "/* listen for the submit button press */\n\nYAHOO.util.Event.addListener(webserver.result_form, 'submit', webserver.result_submit);\n\n\nI have this event listener in my main.js. Is there any way in YUI so I can listen a variable, so when this variable changes the event occurs. I was wondering if there is something like :\n\nYAHOO.util.\"Variable\".addListener(webserver.result_form, 'submit', webserver.result_submit);" ]
[ "javascript", "jquery", "html", "yui" ]
[ "Umbraco 7, How to change a custom property in MemberService.Saved", "I am struggling with changing a simple true / false flag in member properties once the Is Approved flag is set to true for the first time. I can change the property but the value is not saved / committed. I have tried both MemberService.Saved and MemberService.Saving. I am quite new to Umbraco so may have missed something obvious. \n\nprotected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)\n{\n MemberService.Saved += MemberService_Saved;\n}\n\nvoid MemberService_Saved(IMemberService sender, Umbraco.Core.Events.SaveEventArgs<IMember> e)\n{ \n foreach (var member in e.SavedEntities)\n {\n if (!member.IsNewEntity())\n {\n var dirtyProperties = member.Properties.Where(x => x.WasDirty()).Select(p => p.Alias);\n if (dirtyProperties.Contains(\"umbracoMemberApproved\"))\n {\n if (member.IsApproved && !member.GetValue<bool>(\"approvalEmailSent\"))\n {\n //Send Email to Customer\n //new SmtpClient().Send(mail);\n\n var prop = member.Properties[\"approvalEmailSent\"];\n prop.Value = true;\n\n var propValue = member.GetValue<bool>(\"approvalEmailSent\");\n //Have verified propValue is now true\n\n sender.Save(member);\n } \n }\n }\n }\n}\n\n\nStrangely I can find another member, make the property change and save it fine, just not the member sent through in e.SavedEntities.\n\nTIA" ]
[ "c#", ".net", "umbraco", "umbraco7" ]
[ "Is the following approach correct to find \"Longest Path In a Tree\"?", "In the problem we have to find longest path in a tree LINK. My approach is as below: I am running dfs on a tree and calculating the depth from every vertex and adding that depth to vector of that vertex. Now we sort the vectors of all vertex. And longest path through any vertex will contain two different longest path from that vertex which will be returned by dfs. See code below for more understanding.\n\n#include<bits/stdc++.h>\nusing namespace std;\nconst int N=10000;\nvector<int> adjacencylist[N+1];\nbool visited[N+1]={false};\nvector<int> splitlist[N+1];\n\nint dfs(int u)\n{\n visited[u]=true;\n int answer=0;\n for(int i : adjacencylist[u])\n {\n if(!visited[i])\n {\n int r=1+dfs(i);\n splitlist[u].push_back(r);\n answer=max(answer,r);\n }\n }\n return answer;\n}\n\nint main()\n{\n int nodes;\n cin >> nodes;\n for(int i=0;i<nodes-1;i++)\n {\n int u,v;\n cin >> u >> v;\n adjacencylist[u].push_back(v);\n adjacencylist[v].push_back(u);\n }\n dfs(1);\n for(int i=1;i<=nodes;i++)\n {\n sort(splitlist[i].begin(),splitlist[i].end(),greater<int>());\n }\n int answer=0;\n for(int i=1;i<=nodes;i++)\n {\n if(splitlist[i].size()>1)\n answer=max(answer,splitlist[i].at(0)+splitlist[i].at(1));\n else\n if(splitlist[i].size()==1)\n answer=max(answer,splitlist[i].at(0));\n }\n cout << answer;\n\n}\n\n\nIs this approach correct?" ]
[ "algorithm", "data-structures", "graph", "tree", "theory" ]
[ "Expression Engine - Access Forbidden Issues", "Whenever I have create a new template group in EE I can access that template group's index file as follows:\n\nhttp://www.mysite.com/my_template_group/\n\nHowever, I am working on a project and for the first time ever if I use that link I get the following error message:\n\n\n You do not have permission to access this directory.\n\n\nIf I include the index in the url it works fine:\n\nhttp://www.mysite.com/my_template_group/index\n\n\nWhat would be causing this snafu and how can I resolve it? Using the /index in the link is unacceptable.\n\nThanks." ]
[ "expressionengine" ]
[ "Positioning Flutter widgets off screen", "As the title mentioned, I'm trying to position my widget off screen. Currently I have managed to offset the a widget image off screen however it is not the outcome I had expect. The image that is off screen is still visible on the status bar. \n\nThis is how it looked like \n\n\n\nThis is how i expect it should look like (designed in adobe XD)\n\n\n\nWidget build(BuildContext context) {\n return SafeArea(\n child: Scaffold(\n backgroundColor: Palette.primaryBackground,\n body: Container(\n width: double.infinity,\n height: double.infinity,\n child: Image.asset(\n 'assets/Splash.png',\n fit: BoxFit.scaleDown,\n alignment: new Alignment(1.4, -1.2),\n ),\n ),\n ),\n );\n}\n\n\nI have tried using a Positioned widget within a Stack, however it caused more issue of overflow when i try adding new widgets to the Stack's children.\n\nI'm sure there is a proper method of placing a widget in an absolute position. Anyone able to help me with that?" ]
[ "flutter" ]
[ "Google Charts - Change the color of column in clickable label ColumnChart", "This is jsfiddle example\n\n var chart = new google.visualization.ChartWrapper({\n chartType: 'ColumnChart',\n containerId: 'chart_div',\n dataTable: data,\n options: {\n // setting the \"isStacked\" option to true fixes the spacing problem\n isStacked: true,\n height: 300,\n width: 600,\n series: [{color: 'blue', visibleInLegend: false}, \n {color: 'red', visibleInLegend:false}]\n\n }\n});\n\n\nHow can I change the color column when clickable label on a google chart API bar chart?\nenter image description here\nThanks." ]
[ "javascript", "charts", "google-visualization" ]
[ "Why Vim is putting two indents here?", "Sometimes Vim puts two or more indents where I expect it to be just a single indent. For example when cursor is here (python code):\na = [█\n\nand I press enter, the result is such:\na = [\n █\n\nWhereas i expect it to be here:\na = [\n █\n\nMy vimrc at its least:\nfiletype plugin indent on\nset autoindent\nset expandtab\nset shiftwidth=4\nset tabstop=4\nset softtabstop=4\n\nHow to make vim indent as I expect? I've found nothing useful on the web so I thought it to be more appropriate to ask here." ]
[ "vim" ]
[ "What is the meaning of totalBytesProcessedAccuracy in Jobs.Insert API DryRun response", "I noticed a field called totalBytesProcessedAccuracy in the response of Jobs.Insert API when setting the query configuration to DryRun=true.\n\n\n \"query\": {\n \"totalBytesProcessed\": \"341880728292\",\n \"totalBytesBilled\": \"0\",\n \"totalBytesProcessedAccuracy\": \"UPPER_BOUND\",\n \"cacheHit\": false,\n \"referencedTables\": [\n {\n \"projectId\": \"mydata-1470162410749\",\n \"datasetId\": \"EVALUEX_PROD\",\n \"tableId\": \"tables\"\n }\n ]\n\n\nFrom my experiment I see 2 values for this field:\n\n\nUPPER_BOUND: when I use a query with a cluster field in the WHERE\nPRECISE: When I'm not using a query with a cluster field in the WHERE\n\n\nI search BigQuery documentation for this field to get a better explanation on this but couldn't find any reference\n\nAny ideas of how can I find more details about this field and what it means?" ]
[ "google-bigquery" ]
[ "Applescript to open spreadsheet, make changes, & save", "I have just begun using Applescript & have the following question: how to use applescript on OSX El Capitan to open a spreadsheet, make changes/additions/deletions, then save & replace file. Did not see anything on Stackoverflow that would answer my question. Thanks so much." ]
[ "macos", "applescript" ]
[ "How can I get my targets to be from unique values?", "So I have large csv file with multiple columns and rows. In my PCA plot I'm choosing City column to be my target value. How can I write a program that can choose the unique cities from the column as a target.\n\nimport pandas as pd\n\nX = pd.read_csv('ANNCitydata.csv')\n# load dataset into Pandas DataFrame\nX1 = X.drop(['ID','City'], axis=1)\ny = pd.read_csv('ANNCitydata.csv', usecols=[\"City\"])\n\nfrom sklearn.decomposition import PCA\npca = PCA(n_components=2)\nprincipalComponents = pca.fit_transform(X1)\nprincipalDf = pd.DataFrame(data = principalComponents\n , columns = ['principal component 1', 'principal component 2'])\n\nfinalDf = pd.concat([principalDf, y[['City']]], axis = 1)\n\nimport matplotlib.pyplot as plt\nfig = plt.figure(figsize = (10,10))\nax = fig.add_subplot(1,1,1) \nax.set_xlabel('Principal Component 1', fontsize = 15)\nax.set_ylabel('Principal Component 2', fontsize = 15)\nax.set_title('2 component PCA', fontsize = 20)\ntargets = ['Houston', 'St. Louis', 'Waterloo', 'Columbia', 'Rosario']\ncolors = ['r', 'g', 'b', 'c', 'm']\nfor target, color in zip(targets,colors):\n indicesToKeep = finalDf['City'] == target\n ax.scatter(finalDf.loc[indicesToKeep, 'principal component 1']\n , finalDf.loc[indicesToKeep, 'principal component 2']\n , c = color\n , s = 100)\nax.legend(targets)\nax.grid()\n\n\nAs you can see, currently I'm choosing the cities that are targets. But I want the program to by itself do that." ]
[ "python", "pandas" ]
[ "Subscribe multiple Angular2 components to a Service", "I am trying to make two Components to get notified through a Service when another Component reacts to a DOM event.\n\nThis should be achieved using RxJS Subject Observable, or its direct subclasses(BehaviorSubject or ReplaySubject probably).\n\nThis is the model:\n\n\nTriggerComponent\nNotificationService\nFirstListeningComponent\nSecondListeningComponent\n\n\nNeither of these three components are parent-child.\n\nI tried to follow these approaches:\n\n\nAngular2 Parent and Children communication via service \nRxJSObservable demo explanation\n\n\nbut I didn't manage to adapt them for my needs.\n\n\nPlease check my live example on plnkr.co \n\nAm I on the right path?\n\nThank you" ]
[ "angular", "rxjs", "observable" ]
[ "Duplicate React after downloading npm package", "I have an npm package (that I published) which causes duplicate React instances and hence the following Component Exception:\n"Invalid hook call. Hooks can only be called inside of the body of a function component..."\nWhat should I do in order to prevent this error from occurring in projects that download this package?" ]
[ "reactjs", "react-native", "npm", "react-hooks" ]
[ "HTML 5 video CSS: Force responsive ratio 16:9 on video poster image (for preload=\"none\" videos)", "Assuming that the poster size of an HTML 5 video should always be 16:9 but the height of the actual video is still auto. How can I make the poster image stick to those dimensions (it shall be cutted to fit the dimensions e.g. with object-fit)?\n\n\r\n\r\nvideo {\r\n width:100%;\r\n height:auto;\r\n}\r\n\r\nvideo[poster] {\r\n width:100%;\r\n}\r\n<video poster=\"https://i.imgur.com/LFgR8jD.png\" controls=\"controls\" class=\"pimcore_video\" preload=\"none\">\r\n<source type=\"video/mp4\" src=\"https://storage.coverr.co/videos/sksZ7cBoTBAJkB4Bul46QAI1c01x7lx18?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6IjExNDMyN0NEOTRCMUFCMTFERTE3IiwiaWF0IjoxNTg3MDMwNzIwfQ.moAIavql_5_ggd9hrKExX6iPeo2UM_CMya6Mozg4hyY\">\r\n</video>\r\n\r\n\r\n\n\nAs you can see in the snippet above the size of the poster image is different to the video itself." ]
[ "html", "css", "video", "html5-video", "aspect-ratio" ]
[ "Files won't upload in PGRFileManager when using a mac", "Hi we have been using PGRFileManager for a while with ckeditor but it has just come to light that when using a mac users can't upload files, does anyone know what could be the cause?\n\nUsers can get the file browser to appear and select a file but when they click the green arrow to upload the file just disappears.\n\nDoes anyone have any knowledge of this or how to fix it.\nI was thinking about giving something like the kc finder a go but as users are used to the pgr file manager thought that I should give it a bash to fix it.\n\nI've read around and I'm using a session var to set the location which has worked well.\nAnd it's an absolute location so that's fine. (One of the solutions was to make sure that this was the case)\n\nHas anyone got any further ideas?\nThanks\nRichard" ]
[ "macos", "file-upload", "ckeditor" ]
[ "Political Science Programming Question", "I am sorry I am being very descriptive here but I hope you could help me with the following problem (I try to program this in R):\n\nLet's say we have array where rows are parties and columns are parties' issue positions (measured as distance from the median issue position across all parties). I want to model parties announcing an issue platform. This goes like this: start with the issue on which the distance from the median issue position is smallest and announce that platform with probability (1 minus issue distance from median....parties announce that issue that issue as their platform with probability = 1 if they are the median party on that issue). If rbinom(1,1, prob) ==1 they will announce that issue (i.e, the column indicator) as their platform. If rbinom(1,1, prob) == 0, they will move on to the issue on which the distance from the median issue position is second-to-smallest (and draw from a binomial distribution) And so forth until a platform is announced. All parties go through the same steps to find a issue platform for that run of the model, but parties differ on the issues on which they are closest to the median party.\n\nWould you have advice on how to program such a set-up?" ]
[ "r" ]
[ "How do I change the default text for PublishingWebControls:RichHtmlField in Sharepoint 2010?", "By default is showing a text that looks like this:\n\nYOUR-FIELD-NAME-HERE field value. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." ]
[ "sharepoint", "sharepoint-2010" ]
[ "Split string with dot as delimiter", "I am wondering if I am going about splitting a string on a . the right way? My code is: \n\nString[] fn = filename.split(\".\");\nreturn fn[0];\n\n\nI only need the first part of the string, that's why I return the first item. I ask because I noticed in the API that . means any character, so now I'm stuck." ]
[ "java", "regex", "string", "split" ]
[ "SPSS: How to count number of digits in variable", "I need to count the number of digits in an SPSS numeric variable, and assign it to a different variable.\n\nI tried converting it to a string and counting the length of the string with char.length(), but this returns the defined length of the variable, rather than the length of the actual string in each line.\n\nAny ideas how this can be done?" ]
[ "spss" ]
[ "Python Test inheritance with multiple subclasses", "I would like to write a Python test suite in a way that allows me to inherit from a single TestBaseClass and subclass it multiple times, everytime changing some small detail in its member variables.\n\nSomething like:\n\nimport unittest\n\nclass TestBaseClass(unittest.TestCase):\n\n def setUp(self):\n self.var1 = \"exampleone\"\n\nclass DetailedTestOne(TestBaseClass):\n def setUp(self):\n self.var2 = \"exampletwo\"\n\n def runTest(self):\n self.assertEqual(self.var1, \"exampleone\")\n self.assertEqual(self.var2, \"exampletwo\")\n\nclass DetailedTestOneA(DetailedTestOne):\n def setUp(self):\n self.var3 = \"examplethree\"\n\n def runTest(self):\n self.assertEqual(self.var1, \"exampleone\")\n self.assertEqual(self.var2, \"exampletwo\")\n self.assertEqual(self.var3, \"examplethree\")\n\n... continue to subclass at wish ...\n\n\nIn this example, DetailedTestOne inherits from TestBaseClass and DetailedTestOneA inherits from DetailedTestOne.\n\nWith the code above, I get:\n\nAttributeError: 'DetailedTestOne' object has no attribute 'var1'\n\n\nfor DetailedTestOne and:\n\nAttributeError: 'DetailedTestOneA' object has no attribute 'var1'\n\n\nfor DetailedTestOneA\n\nOf course, var1, var2, var3 could be some members of a same variable declared in first instance in the TestBaseClass.\n\nAny ideas on how to achieve such behaviour?" ]
[ "python", "unit-testing", "inheritance", "subclass", "python-unittest" ]
[ "center UIActivityIndicator when keyboard is active", "I have a UITableView with a search bar and a search result display controller: \n\n[self.searchDisplayController.searchResultsTableView addSubview:searchIndicator];\nsearchIndicator.center = CGPointMake(self.view.frame.size.width / 2.0, self.view.frame.size.height / 2.0);\n\n\nThe code above places the indicator at the center of the screen. However I want to place the indicator at the center of the frame excluding the keyboard. How can I do this?\n\nThe indicator is defined like this:\n\n@property (retain, nonatomic) IBOutlet UIActivityIndicatorView *searchIndicator;" ]
[ "ios", "iphone", "uitableview", "uiactivityindicatorview", "uisearchbardisplaycontrol" ]
[ "Django: filter on a self-reference foreign key attribute", "In my Django 2.2 app, I have a model like this:\n\nclass Folder(models.Model):\n name = models.CharField(max_length=100)\n parent_folder = models.ForeignKey(\"Folder\", null=True, on_delete=models.SET_NULL)\n\n\nBasically, a folder can have a parent, this folder's parent itself can have a parent, and so on.\n\nSo what I would like to do is, order the folders on their name attributes and starting with the top-level folders (so, the folders with no parent_folder) and then descending in the folder hierarchy.\n\nTo illustrate, given the following objects in the table:\n\n+----+---------+---------------+\n| id | name | parent_folder |\n+----+---------+---------------+\n| 1 | fuel | <None> |\n| 2 | blabla | 1 |\n| 3 | volcano | 2 |\n| 4 | awful | 2 |\n| 5 | apple | 1 |\n| 6 | amazing | <None> |\n| 7 | wow | 6 |\n+----+---------+---------------+\n\n\nThe ordered output I except is:\n\n+----+---------+---------------+\n| id | name | parent_folder |\n+----+---------+---------------+\n| 6 | amazing | <None> |\n| 7 | wow | 6 |\n| 1 | fuel | <None> |\n| 5 | apple | 1 |\n| 2 | blabla | 1 |\n| 4 | awful | 2 |\n| 3 | volcano | 2 |\n+----+---------+---------------+" ]
[ "python", "django", "django-queryset" ]
[ "Not getting exact result using ul, li and a href from code behind", "I am trying to make nested ul & li tags in code behind. For that I wrote preliminary code in my .aspx page\n\nMy C# code:\n\nfor (int i = 0; i < ds.Tables[0].Rows.Count; i++)\n{\n HtmlGenericControl li = new HtmlGenericControl(\"li\");\n tabs.Controls.Add(li);\n HtmlGenericControl anchor = new HtmlGenericControl(\"a\");\n anchor.Attributes.Add(\"href\", \"#\");\n anchor.InnerText = ds.Tables[0].Rows[i][0].ToString();\n li.Controls.Add(anchor);\n HtmlGenericControl ul = new HtmlGenericControl(\"ul\");\n li.Controls.Add(ul);\n\n if (ds.Tables[0].Rows[i][2] != null)\n {\n HtmlGenericControl ili = new HtmlGenericControl(\"li\");\n ul.Controls.Add(ili);\n HtmlGenericControl ianchor = new HtmlGenericControl(\"a\");\n ianchor.Attributes.Add(\"href\",\"page.aspx\");\n ianchor.InnerText = ds.Tables[0].Rows[i][0].ToString();\n ili.Controls.Add(ianchor);\n HtmlGenericControl ul2 = new HtmlGenericControl(\"ul\");\n ili.Controls.Add(ul2);\n\n param = ds.Tables[0].Rows[i][2].ToString();\n LevelControl(param);\n }\n\n li.Controls.Add(ul);\n tabs.Controls.Add(li); \n }\n\n\nWhen I run my project and do inspect element on my menu I see something like this\n\n|page1|\n |page1|\n|page2|\n |page2|\n|page3|\n |page3|\n\n\nNo Nested ul tags are created inside li ?? Why ??\n\nFor example:\n\n|page1|\n |page2|\n |page3|\n\n\nWhat would I have to do to get the results I want?" ]
[ "c#", "html-lists" ]
[ "Non resourcefull route with bound parameter not clear. Not getting its behaviour", "I have route defined in my routes.rb\n\nget ':conroller(/:action)' => 'show/show_all#test'\n\n\nand in my ruby file i have following link \n\n<td><%= link_to 'Test non resourcefull route:show', :controller=\"fdsfdsf\" :action=\"fdsfds\" %></td>`enter code here`\n\n\nafter executing the link i am able to see my \n\n\n test.html.erb\n\n\nfile even though the spelling of controller is wrong in my route definition. But if i correct the spelling to 'Controller' i get following error \n\n\n uninitialized constant ShowAllController.\n\n\nPlease clear this behavior." ]
[ "ruby-on-rails", "ruby-on-rails-3", "ruby-on-rails-3.1" ]
[ "Sorting error for Time row value in Pivot Table", "I've encountered an issue with a pivot table that I occasionally use, though I don't update. Specifically there are three Row Fields applied Year, Day (d-mon format), and then Transaction Date/Time (which displays only the hour component of the value). The pivot table is supposed to sort by Year, then Day, then Hour. The first two sorts work fine, but the third has started to sort the Hour values as text rather than numbers, so it's ordered 1 AM, 1 PM, 10 AM, 10 PM, etc. I've checked and there are no non-time values in the source field, the column of the pivot table itself is still set to a Time format type, and there are no filters applied to the field.\n\nAt this point I'm not sure what else to look for. Any assistance would be much appreciated.\n\nUPDATE: The file is in Sharepoint so I tried taking the prior version (there are only two), dropping in the latest data from the current version, and refreshing the pivot table. The error dutifully appeared. So it does appear to be a data issue, but I can't imagine what's causing the issue. As stated above, I already checked that the values were Dates, specifically I used =IF(NOT(ISERROR(DATEVALUE(TEXT(C2, \"m/d/yyyy h:mm\"))), \"\", 1) and checked that all rows returned as blanks.\n\nSomething that may be causing issues is how the Year and Day fields come about. Specifically, there are no such fields in the Source Data, they are calculated Row Fields based on the one Transaction Date/Time column. I'm not even sure how this was done (to my knowledge calculated fields can only be columns) so I can't really look into if it may be causing the errors." ]
[ "excel", "sorting", "pivot-table" ]
[ "Excel Qn, Formula to check if a date falls within the upcoming week.", "I am trying to check if a date falls within the upcoming week.\n\nFor example, today is 9/14/2016.\n\nThe upcoming week is defined as anything that are through 9/23/2016.\n\nI was wondering if anyone can help me with it. Thanks." ]
[ "excel", "date", "excel-formula" ]
[ "SDL_SetColorKey doesn't set the background transparent", "it comes down to this code:\n\nSDL_Surface *smiley = SDL_LoadBMP(\"./images/smileys/normal_up.bmp\");\nprintf(\"Transparation worked: %i\\n\", SDL_SetColorKey(smiley, SDL_SRCCOLORKEY, SDL_MapRGB(smiley->format, 255, 0, 255)));\nSDL_BlitSurface(smiley, NULL, window, NULL);\nSDL_Flip(window);\n\n\nThis is the image I used.\nUsing SDL on Arch Linux." ]
[ "c", "image", "transparency", "sdl" ]
[ "Domain Mapping To Subdomain", "Im running SAAS where customer signs up and a script installation takes place in a subdomain, i.e., subdomain.mydomain.com and starts using the site. Now I want to allow my customers to map their FULL domain eg. www.customerdomain.com to subdomain.mydomain.com, something like bloggers.com or wordpress does. How I can do this. I am using Linux dedicated server. Help would be greatly appreciated. I dont want URL masking or redirection." ]
[ "linux", "mapping", "dns", "subdomain" ]
[ "win7 default printer is not selected printer", "I have to print some html documents from my program. Because of that I cannot use .NET's provided interfaces (like PrintDocument) but I do kind of workaround.\nFor that I do separate form with WebBrowser control for showing a document before printing with few basic controls for determining printing parameters such is choosing printer for print that document. \n\nParts of code:\nFilling printers to combobox:\n\nFor Each pkInstalledPrinter As String In System.Drawing.Printing.PrinterSettings.InstalledPrinters\n cboInstalledprinters.Items.Add(pkInstalledPrinter)\nNext pkInstalledPrinter\n\n''p_printer is determined by program but should be changable\n''if p_printer is empty then it should be system''s default printer\n\nIf p_printer = \"\" Then\n p_printer = getDefaultPrinter()\nEnd If\ncboInstalledprinters.SelectedItem = p_printer\n\n\nFor changing a desired printer user can use combobox cboInstalledprinters like this:\n\nPrivate Sub cboInstalledprinters_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboInstalledprinters.SelectedIndexChanged\n p_printer = cboInstalledprinters.SelectedItem.ToString\n SetDefaultPrinter(p_printer)\nEnd Sub\n\n\nPrinting of webBrowser content is like this:\n\n Dim MyWeb As Object = WebBrowser1.ActiveXInstance\n Try\n MyWeb.ExecWB(olecmdid.OLECMDID_PRINT, PromptUser, IntPtr.Zero, IntPtr.Zero)\n Catch ex As Exception\n MsgBox(ex.Message)\n End Try\n MyWeb = Nothing\n\n\nPromptUser is of execopt type and can be determined from outside a function when calling for a print. \n\nUsed functions:\ngetDefaultPrinter\n\nPublic Function getDefaultPrinter() As String\nDim oldPrinter As String\n Dim oPS As New System.Drawing.Printing.PrinterSettings\n Try\n oldPrinter = oPS.PrinterName\n Catch ex As System.Exception\n oldPrinter = \"\"\n End Try\n Return oldPrinter\nEnd Function\n\n\nsetDefaultPrinter\n\n<DllImport(\"winspool.drv\", EntryPoint:=\"SetDefaultPrinter\", _\n SetLastError:=True, CharSet:=CharSet.Auto, ExactSpelling:=False, CallingConvention:=CallingConvention.StdCall)> _\n Public Function setDefaultPrinter(ByVal strPrinterName As String) As Boolean\nEnd Function\n\n\nAll of that works good.\nBut what is a problem? \n\nWhen I switch (chose) different printers from combobox I can see how default printer changes in ControlPanel/Devices and Printers what mean that default printers are switched well (green checkmark moves according to chose from combobox).\n\nI thought that program will automatically use default printer for that printings, but when I press a print button to invoke printing my program don't print to default printer. Instead of that SELECTED one is used. When I call print function with execopt.OLECMDEXECOPT_PROMPTUSER I get additional dialog with printers where I can see which printer is default but that printer is NOT SELECTED.\n\nActually, with my changes on combobox default printer changes but SELECTED PRINTER doesn't change at all (remains remembered from first usage) and program wants to print through selected printer, not default printer. That behavior may be good but problem is that I can't set that selection with a program. I can change default printer with code but selected printer only by exiting a program and coming back.\n\nHow to select a printer with combobox cboInstalledprinters so program will use selected one automatically?" ]
[ ".net", "printing" ]
[ "Failed to build boost_python example code \"fatal error LNK1181: cannot open input file 'boost_python.lib'\"", "I am fairly new to boost python, and I am attempting to follow this tutorial: https://www.boost.org/doc/libs/1_63_0/libs/python/doc/html/tutorial/tutorial/hello.html . Following the tutorial exactly, I receive this error upon building the project using either b2 or bjam:\n\n\" fatal error LNK1181: cannot open input file 'boost_python.lib' \"\n\nI believe I have properly configured my user-config.jam, jamfile, and jamroot files.\n\nI also saw this thread here:\nLNK1181: cannot open input file 'boost_python.lib' in windows, boost_1_68_0\nbut no solutions to the issue seemed to have been provided. Instead it is suggested that bjam/b2 are not needed at all, which seems to contradict the tutorial in the boost documentation. \n\nThe same user then suggested \"linking\" with the boost python and python libraries, which I assume means to add their directories to system environment variables. I have already done this, but I believe I could be misunderstanding what he meant. \n\nThe thread also links to this page:\nhttps://docs.microsoft.com/en-us/visualstudio/python/working-with-c-cpp-python-in-visual-studio?view=vs-2017\ndetailing the creation of c++ extensions for Python, but after reading it I fail to see any mention of boost whatsoever except in passing at the very end of the article.\n\nI have also searched the entire boost directory for a 'boost_python.lib' file and it seems that it does not exist. Any help would be greatly appreciated." ]
[ "python", "boost", "build", "boost-python", "b2" ]
[ "How to debug classic asp page Visual Studio 2010 on IIS 7.5?", "I have tried attaching the debugger to the IIS worker process and have a break point on the asp page. But it never hits the breakpoint.\n\nI am able to debug the aspx pages in the same site using the above process." ]
[ "asp.net", "visual-studio", "visual-studio-2010", "asp-classic", "iis-7.5" ]
[ "Looking up the algorithm for commands: MATLAB", "Is it possible to see how MATLAB implements some of its commands? For example, the \"hess\" command on MATLAB reduces a matrix to its upper Hessenberg form. I want to see how it is written in MATLAB because every time I do it by hand, it is not the same as the one MATLAB spits out but according to WolframAlpha, I am doing it correctly." ]
[ "matlab" ]
[ "Can't connect wpdatatables to ms sql database", "I want to connect the Wordpress pluggin wpdatatables to my Ms sql database, but every time i try it appear the next message:\n"wpDataTables could not connect to mssql server. mssql said: There was a problem with your SQL connection - could not find driver"" ]
[ "sql-server", "database", "wordpress" ]
[ "To force beforeedit & edit both work in Controller?", "I'm using Extjs 4.1.1. Because I follow MVC I decided to move 'edit' & 'beforeedit' functions (rowEditing plugin) from grid i.e:\n\nlisteners: {'edit': function(editor, e) {\n ...\n },'beforeedit': function(editor, e) {\n ...\n }}\n\n\nand put it inside controller just like:\nExt JS 4 - How to control rowEditor inside controller\n\nMy new code looks like this:\n\ninit: function() {\n\n this.control({ \n\n 'myGrid': {\n edit: this.onRowEdit\n },\n\n 'myGrid': {\n beforeedit: this.onRowBeforeEdit\n },\n\n });\n\n},\n\nonRowEdit: function(editor, e) {\n ... // Fires only when 'beforeedit' not present in this.control\n},\n\nonRowBeforeEdit: function(editor, e) {\n ... // Always fires\n},\n\n\nNow, 'beforeedit' fires fine. My problem is that 'edit' fires only when 'beforeedit' is not present. Anyone had same problem? Of course old grid listener like way worked fine for both.\n\nEDIT\nI've just observed that if I define 'beforedit' first and 'edit' second in this.control(), the 'beforeedit' is the one which is not firing." ]
[ "extjs", "extjs4", "extjs4.1", "extjs-mvc" ]
[ "ios 11 custom navbar goes under status bar", "just downloaded xcode 9 and i'm having this weird issue, on ios 11 my custom navbar appears to be half in size and is under the status bar, on ios 10 works fine.\n\nso here is my code \n\nlet newNavbar: UINavigationBar = UINavigationBar(frame: CGRect(x: 0, y: 0, width: view.frame.width, height: 64))\nlet navItem = UINavigationItem()\n\n//create and assign the items\n\nnewNavbar.setItems([navItem], animated: false)\nview.addSubview(newNavbar)\n\n\nhere is a screenshot, ios11 on the left and ios10 on the right," ]
[ "swift", "ios11" ]
[ "Is there a way to create and train a model without transfer learning using tensorflow object-detection api?", "I'm using faster_rcnn_resnet50 to train a model which will detect corrosions in images and I want to train a model from scratch instead of using transfer learning. \n\nI don't know if this right but the reason I want to do this is that the already existing weights (which are trained on COCO) will affect my model trained on corrosion images.\n\nOne way I would like to do this is randomize or unfreeze the weights of the feature extractor on the resnet50 and then train the model on my images.\n\nbut there's no function or an option in the resnet50 config file to randomize or unfreeze weights. \n\nI've made a new labelmap with a single label and tried it with transfer learning. It's working but I would like to have a model is trained just on my images and the previous weights shouldn't affect my predictions. \n\nThis is the first time I'm working with object detection and transfer learning. Will the weights of the pre-trained model on COCO affect my model which is trained on custom images of corrosion? How do you use tensorflow object-detection API without transfer learning?" ]
[ "python-3.x", "tensorflow", "object-detection-api", "transfer-learning" ]
[ "Function to append a string after condition is met", "I'm trying to write scalar-valued function in SQL Server and I want to append a string after if condition is met.\nIf column gdpr_aj = 'a' then I need to append a string 'aj' when column gdpr_sa = 'a' then I need to append a string 'sa' when column gdpr_vs = 'a' then I need to append a string 'vs'.\nExample data\nid | gdpr_aj | gdpr_sa | gdpr_vs |\n1 | 'a' | 'a' | 'n' |\n2 | 'n' | 'n' | 'a' |\n3 | 'n' | 'n' | 'n' |\n4 | 'a' | 'a' | 'a' |\n\nDesired result set should be\nfirst row @myString = 'aj,sa'\nsecond row @myString = 'vs'\nthird row @myString = ''\nfourth row @myString = 'aj,sa,vs'\n\nMy function looks like this for now\nalter function dbo.fn_test (@id as int)\nreturns varchar(max)\nas\nbegin\n\ndeclare @myString varchar(max)\n\ndeclare\n@gdpr_aj char(1),\n@gdpr_sa char(1),\n@gdpr_vs char(1)\nselect\n@gdpr_aj = sz.gdpr_aj,\n@gdpr_sa = sz.gdpr_sa,\n@gdpr_vs = sz.gdpr_vs\nfrom dbo.sz sz where sz.id = @id\n\n\nif @gdpr_aj = 'a' set @myString = 'aj,'\nif @gdpr_sa = 'a' set @myString = 'sa,'\nif @gdpr_vs = 'a' set @myString = 'vs'\n\nreturn @myString\n\nend" ]
[ "sql", "sql-server" ]
[ "Get SQL data between two dates when date field has time and date in it", "I have data in my sql like: 2018-06-26 07:15:06\nRight now I am using: $sqlq = \"Select * from db WHERE date LIKE '$myDato' \";\n$myDato is set as: 2018-06-26%\nThis works like a charm. I am getting all rows starting with that day.\nNow i want to extract more days. I have tried:\n\n$sqlq = \"Select * from db WHERE date BETWEEN >= '$myDato' AND => '$myDato2'\";\n$sqlq = \"Select * from db WHERE date BETWEEN LIKE '$myDato' AND LIKE '$myDato2'\";\n$sqlq = \"Select * from db WHERE date BETWEEN '$myDato' AND '$myDato2'\";\n\n\nbut i can't find the right one." ]
[ "php", "mysql" ]
[ "Present custom View Controller in Storyboard?", "I am trying the following:\n\nUIStoryboard *storyboard = [UIStoryboard storyboardWithName:@\"MainStoryboard_iPhone\" bundle:nil];\n CustomVC *vc = [[CustomVC alloc] init];\n vc = [storyboard instantiateViewControllerWithIdentifier:@\"weddingDateViewController\"];\n [vc setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];\n [self vc animated:YES];\n\n\nI have build a view controller in my storyboard and have linked a custom class to it (CustomVC). When I run this code to present the view controller the screen fades to black and I see nothing. However, in my storyboard, if I remove the link to my custom class and run this code it fades in normally and I see the view controller I made in my storyboard.\n\nThe trouble is I need that custom class to be used. It's a fresh custom class with no changes made to it." ]
[ "iphone", "objective-c", "ipad", "uiviewcontroller", "storyboard" ]
[ "Is it good practice to use the latest versions of dependencies when publishing?", "I'm building a crate that uses a few dependencies and in order to publish it, I had to specify the dependencies' versions. I replaced my dep = \"*\" by dep = \">=N\" with N being for each dep the latest version that I could get after a cargo update.\n\nShould I relax/lower the versions required?\n\nHow could I do that? I've tried to set dep = \"M\" with M being a much lower version number but cargo keeps using the newer one. Is there a tool to find the minimum M required to build and test my crate?" ]
[ "rust", "dependency-management", "rust-cargo" ]
[ "Class variable instantiation process", "As shown in the picture:\n\npic1\n\nIn [1]: from datetime import datetime\n\nIn [2]: class A(object):\n ...: now = datetime.now()\n ...: def __init__(self):\n ...: pass\n ...: def p(self):\n ...: print(self.now)\n ...:\n\nIn [3]: datetime.now()\nOut[3]: datetime.datetime(2018, 5, 22, 17, 54, 4, 593295)\n\nIn [4]: a_1 = A()\n\nIn [5]: a_1.p()\n2018-05-22 17:53:57.597022\n\nIn [6]: datetime.now()\nOut[6]: datetime.datetime(2018, 5, 22, 17, 54, 29, 177489)\n\nIn [7]: a_2 = A()\n\nIn [8]: a_2.p()\n2018-05-22 17:53:57.597022\n\n\nI can't understand how Python initializes a class variable, and why I created two class objects, but the values of the class variables of these two classes are the same?\n\nThank you for your help." ]
[ "python" ]
[ "Convert ZIO Task to IO", "I have the next code:\nimport zio._\n\nimport scala.concurrent.Future\n\ncase class AppError(description: String) extends Throwable\n// legacy-code imitation\ndef method(x: Int): Task[Boolean] = {\n Task.fromFuture { implicit ec => Future.successful(x == 0) }\n}\n\ndef handler(input: Int): IO[AppError, Int] = {\n for {\n result <- method(input)\n _ <- IO.fail(AppError("app error")).when(result)\n } yield input\n}\n\n\nbut this code does not compile, because compiler says result type is:\nZIO[Any, Throwable, Int]\nHow to convert from Task (where I call method) to IO?" ]
[ "zio" ]
[ "Jvm crash :fatal error has been detected by the Java Runtime Environment", "I had a tomcat crash on live server , which generated hs_err_pid file .In this there is a Problematic frame -> _wordcopy_fwd_dest_aligned+0x54. I searched in all similar cases of jvm crash but couldn't find whats the meaning of this problematic frame.Any suggestions ?\n\n #\n# A fatal error has been detected by the Java Runtime Environment:\n#\n# SIGBUS (0x7) at pc=0x00007f61087e3cb4, pid=18886, tid=140051814115072\n#\n# JRE version: 6.0_37-b06\n# Java VM: Java HotSpot(TM) 64-Bit Server VM (20.12-b01 mixed mode linux-amd64 compressed oops)\n# Problematic frame:\n# C [libc.so.6+0x89cb4] _wordcopy_fwd_dest_aligned+0x54\n#\n# If you would like to submit a bug report, please visit:\n# http://java.sun.com/webapps/bugreport/crash.jsp\n#\n\n--------------- T H R E A D ---------------\n\nCurrent thread (0x00007f6044017000): JavaThread \"ajp-bio-10009-exec-97\" daemon [_thread_in_vm, id=28541, stack(0x00007f605a916000,0x00007f605aa17000)]\n\nsiginfo:si_signo=SIGBUS: si_errno=0, si_code=2 (BUS_ADRERR), si_addr=0x00007f6059d3f9f8\n\nRegisters:\nRAX=0x0000000000000038, RBX=0x00007f6059d3f9f9, RCX=0x0000000000000001, RDX=0x000000000000004c\nRSP=0x00007f605aa14298, RBP=0x00000006e903e928, RSI=0x00007f6059d3f9f8, RDI=0x00000006e903e928\nR8 =0x0000000000000008, R9 =0x00007f61085ecb38, R10=0x00007f60fd010ec1, R11=0x00007f61085d4090\nR12=0x00000006e903e928, R13=0x0000000000000268, R14=0x00007f61085f0bc0, R15=0x00007f605aa14430\nRIP=0x00007f61087e3cb4, EFLAGS=0x0000000000010202, CSGSFS=0x000000000000e033, ERR=0x0000000000000004\nTRAPNO=0x000000000000000e\n\nTop of Stack: (sp=0x00007f605aa14298)\n0x00007f605aa14298: 00007f6059d3f9f9 00000006e903e928\n0x00007f605aa142a8: 00007f61087dd8ae 0000000000000004\n0x00007f605aa142b8: 00007f605aa15b60 00007f605aa142e0\n0x00007f605aa142c8: 00007f6044017000 0000000000000268\n0x00007f605aa142d8: 00007f6107f313eb 00007f605aa14350\n0x00007f605aa142e8: 00007f6108392c00 0000000000000010\n0x00007f605aa142f8: 00007f6059d3f9f9 00007f6044017000\n0x00007f605aa14308: 00007f60a11b4338 00007f6044017000\n0x00007f605aa14318: 00000000ffffffff 00007f6108430701\n0x00007f605aa14328: 00000007e00cf808 0000000000000000\n0x00007f605aa14338: 00000007e00cf808 00007f605aa14450\n0x00007f605aa14348: 00007f6044017000 00007f605aa143f0\n0x00007f605aa14358: 00007f60fd010eee 0000000000000268\n0x00007f605aa14368: 00007f6107ef6a6c 0000000000000000\n0x00007f605aa14378: 00007f60a11b4338 0000000000000004\n0x00007f605aa14388: 00000000ffffffff 00007f6108430701\n0x00007f605aa14398: 0000000000001389 00007f605aa14460\n0x00007f605aa143a8: 00007f6107ef63ad 00007f605aa143b0\n0x00007f605aa143b8: 0000000000000000 00007f605aa14450\n0x00007f605aa143c8: 00000007e00d2508 0000000000000000\n0x00007f605aa143d8: 00000007e00cf808 0000000000000000\n0x00007f605aa143e8: 00007f605aa14410 00007f605aa14498\n0x00007f605aa143f8: 00007f60fd005a82 0000000000000000\n0x00007f605aa14408: 00007f60fd00df58 0000000000000268\n0x00007f605aa14418: 0000000400000002 0000000000000010\n0x00007f605aa14428: 00007f60a11b4340 00000006e903e918\n0x00007f605aa14438: 00007f6059d3f9f9 0000000000001389\n0x00007f605aa14448: 0000000000000000 000000071005d290\n0x00007f605aa14458: 00007f605aa14458 00000007e015e822\n0x00007f605aa14468: 00007f605aa14508 00000007e015f408\n0x00007f605aa14478: 0000000000000000 00000007e015e850\n0x00007f605aa14488: 00007f605aa14410 00007f605aa144c8 \n\nInstructions: (pc=0x00007f61087e3cb4)\n0x00007f61087e3c94: 1b 48 85 d2 74 42 4c 8b 1e 48 8b 6e 08 48 83 ef\n0x00007f61087e3ca4: 08 48 83 c6 08 e9 98 00 00 00 66 90 48 83 ea 01\n0x00007f61087e3cb4: 4c 8b 16 4c 8b 5e 08 0f 85 bf 00 00 00 0f 1f 80\n0x00007f61087e3cc4: 00 00 00 00 89 c1 49 d3 e3 44 89 c1 4c 89 d8 49 \n\nRegister to memory mapping:\n\nRAX=0x0000000000000038 is an unknown value\nRBX=0x00007f6059d3f9f9 is an unknown value\nRCX=0x0000000000000001 is an unknown value\nRDX=0x000000000000004c is an unknown value\nRSP=0x00007f605aa14298 is pointing into the stack for thread: 0x00007f6044017000\nRBP=" ]
[ "java", "linux", "tomcat", "fatal-error", "jvm-crash" ]
[ "CASE WHEN with condition met and all results - SQL Oracle", "I have a following table (clients):\n\nclient | status | email | phone\n---------------------------------\n001 | active | yes | yes\n002 | inactive | yes | yes\n003 | inactive | yes | no\n004 | deceased | no | no\n005 | active | yes | no\n006 | deceased | no | no\n007 | active | yes | yes\n008 | inactive | no | yes\n009 | active | no | no\n010 | inactive | yes | yes\n\n\nI need results to show stats of inactive clients compared to all clients, ie.\n\nstatus | email | phone | total\n--------------------------------\ninactive | yes | yes | 2\ninactive | yes | no | 1\ninactive | no | yes | 1\nall | yes | yes | 4\nall | yes | no | 2\nall | no | yes | 1\nall | no | no | 3\n\n\nSince CASE checks met conditions, I don't know how to get a fraction of results in first condition and then all results.\n\nI used these two selects:\n\nSELECT CASE WHEN STATUS = 'inactive' THEN STATUS \n WHEN STATUS IS NOT NULL THEN 'all' END \"STATUS\",\n EMAIL, PHONE,\n COUNT(CLIENT) TOTAL\nFROM CLIENTS\nGROUP BY CASE WHEN STATUS = 'inactive' THEN STATUS \n WHEN STATUS IS NOT NULL THEN 'all' END,\n EMAIL, PHONE\nORDER BY 1 DESC, 2 DESC, 3 DESC;\n-------\nSELECT 'all' AS STATUS, EMAIL, PHONE,\n COUNT(CLIENT) TOTAL\nFROM CLIENTS\nGROUP BY EMAIL, PHONE\nORDER BY 2 DESC, 3 DESC;\n\n\nObviously, first part is not working as intended, but I put it here to better showcase my question.\n\nIs it possible to do it in one query?" ]
[ "sql", "oracle" ]
[ "check whether a string contains only letters spaces and quotes (preferably no regex)", "I am trying to check if a string has only letters (both uppercase and lowercase), spaces and quotes (both double and single) in it. I can't quite come up with an elegant way of doing this. The only thing I could come up with is making a list of the allowed characters and checking if each character of the string is in that list." ]
[ "java", "string" ]
[ "NSThread to stop process", "I am using a navigation base application. When I go to next view or back to the previous view, the thread does not stop. Can someone give me a solution for stopping the thread when switching between views? When I switch to next or previous, the application crashes. I use thread like this for downloading the image\n\n- (void)viewWillAppear:(BOOL)animated {\n AppDeleget= [[UIApplication sharedApplication] delegate];\n ProcessView *Process=[[ProcessView alloc] init];\n [Process SearchProperty:AppDeleget.PropertyURL page:AppDeleget.Page];\n [Process release];\n for(NSDictionary *status in AppDeleget.statuses)\n { \n\n NSMutableString *pic_string = [[NSMutableString alloc] initWithFormat:@\"%@\",[status objectForKey:@\"picture\"]]; \n\n if([pic_string isEqualToString:@\"\"])\n {\n\n [ListPhotos addObject:@\"NA\"];\n\n }\n else\n {\n\n NSString *str= [[[status objectForKey:@\"picture\"] valueForKey:@\"url\"] objectAtIndex:0];\n [ListPhotos addObject:str]; \n\n\n }\n }\n [NSThread detachNewThreadSelector:@selector(LoadImage) toTarget:self withObject:nil];\n\n [AppDeleget.MyProgressView stopAnimating];\n [AppDeleget.Progress removeFromSuperview];\n [super viewWillAppear:animated];\n}\n-(void)LoadImage\n{\n for(int x=0;x<[ListPhotos count];x++)\n { \n NSData *imageData =[ListPhotos objectAtIndex:x]; \n id path = imageData;\n NSURL *url = [NSURL URLWithString:path];\n NSLog(@\"%@\",url);\n NSData *data = [NSData dataWithContentsOfURL:url];\n UIImage *img = [[UIImage alloc] initWithData:data];\n [self performSelectorOnMainThread:@selector(downloadDone:) withObject:img waitUntilDone:NO];\n\n }\n\n}\n-(void)downloadDone:(UIImage*)img {\n\n NSIndexPath *indexPath = [NSIndexPath indexPathForRow:count inSection:0];\n\n if(img == nil)\n {\n TableCell *cell = (TableCell *)[TableView cellForRowAtIndexPath:indexPath]; \n cell.myImageView.image=[UIImage imageNamed:@\"No_image.png\"];\n ++count;\n [TableView reloadData]; \n\n }\n else\n {\n TableCell *cell = (TableCell *)[TableView cellForRowAtIndexPath:indexPath]; \n cell.myImageView.image=img;\n ++count;\n [TableView reloadData]; \n } \n\n}" ]
[ "iphone", "uitableview", "nsthread" ]
[ "How do I set the background img over the footer", "I want the picture to cover everything on the page but the <header> however, there is always a white strip of space on the bottom.\nI used margin-right and margin-left to cover the sides, but margin-bottom does not fill in the white space on the bottom.\n\n\r\n\r\nheader {\r\n margin-bottom: 20px;\r\n}\r\nh1 {\r\n text-align: center;\r\n}\r\nnav {\r\n text-align: center;\r\n}\r\nul {\r\n list-style-type: none;\r\n}\r\nli {\r\n display: inline;\r\n padding-right: 5px;\r\n padding-left: 5px;\r\n}\r\nli a {\r\n color: black;\r\n text-decoration: none;\r\n}\r\n#wrapper {\r\n background-image: url(rome.jpg);\r\n -webkit-background-size: 100% 600px;\r\n background-repeat: no-repeat;\r\n height: 600px;\r\n margin-right: -8px;\r\n margin-left: -8px;\r\n}\r\n<header>\r\n <h1>Colin Bruin</h1>\r\n <nav>\r\n <ul>\r\n <li><a href=\"home.html\">Home</a>\r\n </li>|\r\n <li><a href=\"code.html\">Code</a>\r\n </li>|\r\n <li><a href=\"webpages.html\">Webpages</a>\r\n </li>|\r\n <li><a href=\"articles.html\">Articles</a>\r\n </li>|\r\n <li><a href=\"resume.html\">Resume</a>\r\n </li>\r\n </ul>\r\n </nav>\r\n</header>\r\n<div id=\"wrapper\">\r\n\r\n <main>\r\n\r\n </main>\r\n</div>" ]
[ "html", "css", "background-image" ]
[ "List all RGBA values of an image with PIL", "I need all RGBA values of an image in a list. I can use getpixel() function but I have to iterate for all pixels which is my aim and it does very slow. I need to do this in a few seconds.\nThis is my current code: \n\nimgobj = Image.open('x.png')\npixels = imgobj.convert('RGBA')\nlofpixels = []\nw = 1920\nh = 1080\nfor i in range(w):\n for j in range(h):\n r,g,b,a = pixels.getpixel((i,j))\n lofpixels.append(r)\n lofpixels.append(g)\n lofpixels.append(b)\n lofpixels.append(a)\n\n\nAny suggestions? Thanks." ]
[ "python", "image", "python-imaging-library", "pillow" ]
[ "How to handle multiple key board inputs despite of the number of inputs in python without an error?", "I want to get 3 keyboard inputs in python program of 3 countries from the user. But at least 1 or 2 countries are enough. How to handle the value error I'm getting.\n\ncountry1, country2, country3 = input(\"Write up to three comma-separated countries for which you want to extract data: \").split(\",\")\n\n\nWhen typed only one input, \n\nValueError: not enough values to unpack (expected 3, got 1)" ]
[ "python" ]
[ "Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Core.IRibbonUI'", "Hi I am new to excel addin. i had installed microsoft office 2010 and my addin used to work perfectly. To verify in 2013 i had installed 2013 and was running both version 2010 and 2013. Recently i installed 2013 and now if i open 2010 version my addin loads but gives following error. please help\n\nError \n\nAn exception was thrown with the folowing information: System.Runtime.CallbackException: A user callback threw an exception. Check the exception stack and inner exception to determine the callback that failed. ---> System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Core.IRibbonUI'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000C03A7-0000-0000-C000-000000000046}' failed due to the following error: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)).\nat System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, Boolean& pfNeedsRelease)\nat Microsoft.Office.Core.IRibbonUI.InvalidateControl(String ControlID)\nat myaddin.Wrappers.Office.Ribbon.Impl.Ribbon.InvalidateControl(String controlId) in c:\\iraddin\\IR_Addin\\myaddinOfficeLink\\Main\\src\\myaddin.Wrappers.Office\\Ribbon\\Impl\\Ribbon.cs:line 37\nat myaddin.Common.Ribbon.RibbonManager.InvalidateControl(String controlId) in c:\\iraddin\\IR_Addin\\myaddinOfficeLink\\Main\\src\\myaddin.Common\\Ribbon\\RibbonManager.cs:line 66\nat myaddin.Common.Ribbon.RibbonManager.OnControlChanged(Object sender, ControlChangedEventArgs e) in c:\\iraddin\\IR_Addin\\myaddinOfficeLink\\Main\\src\\myaddin.Common\\Ribbon\\RibbonManager.cs:line 360\nat myaddin.Wrappers.Office.Ribbon.ControlsProxy.RibbonControlsManager.OnControlChanged(Object sender, ControlChangedEventArgs e) in c:\\iraddin\\IR_Addin\\myaddinOfficeLink\\Main\\src\\myaddin.Wrappers.Office\\Ribbon\\ControlsProxy\\RibbonControlsManager.cs:line 57\nat myaddin.Wrappers.Office.Ribbon.ControlsProxy.ControlProxyBase.RaiseControlChanged() in c:\\iraddin\\IR_Addin\\myaddinOfficeLink\\Main\\src\\myaddin.Wrappers.Office\\Ribbon\\ControlsProxy\\ControlProxyBase.cs:line 110\nat myaddin.Wrappers.Office.Ribbon.ControlsProxy.ControlProxyBase.set_IsEnabled(Boolean value) in c:\\iraddin\\IR_Addin\\myaddinOfficeLink\\Main\\src\\myaddin.Wrappers.Office\\Ribbon\\ControlsProxy\\ControlProxyBase.cs:line 69\nat myaddin.Wrappers.Office.Ribbon.ControlsProxy.ButtonControlProxy.set_IsEnabled(Boolean value) in c:\\iraddin\\IR_Addin\\myaddinOfficeLink\\Main\\src\\myaddin.Wrappers.Office\\Ribbon\\ControlsProxy\\ButtonControlProxy.cs:line 34\nat myaddin.Modules.Views.SupportView.UpdateControls() in c:\\iraddin\\IR_Addin\\myaddinOfficeLink\\Main\\src\\myaddin.Modules\\Views\\SupportView.cs:line 115\nat myaddin.Modules.Views.SupportView.AuthenticationStateEventHandler(Object sender, AuthenticationStateChangedEventArgs e) in c:\\iraddin\\IR_Addin\\myaddinOfficeLink\\Main\\src\\myaddin.Modules\\Views\\SupportView.cs:line 183\nat System.EventHandler`1.Invoke(Object sender, TEventArgs e)\nat myaddin.Office.Service.Contract.ClientImpl.AuthenticationServiceClient.OnAuthenticationStateChanged(Object sender, AuthenticationStateChangedEventArgs e) in c:\\iraddin\\IR_Addin\\myaddinOfficeLink\\Main\\src\\myaddin.Office.Service.Contract\\ClientImpl\\AuthenticationServiceClient.cs:line 150\nat myaddin.Office.Service.Contract.ClientImpl.AuthenticationServiceClient.OnOpened(Object sender, EventArgs e) in c:\\iraddin\\IR_Addin\\myaddinOfficeLink\\Main\\src\\myaddin.Office.Service.Contract\\ClientImpl\\AuthenticationServiceClient.cs:line 122\nat System.ServiceModel.Channels.CommunicationObject.OnOpened()" ]
[ "c#", "excel", "comaddin" ]
[ "Sox: concatenate multiple audio files without a gap in between", "I am concatenating multiple (max 25) audio files using SoX with\n\nsox first.mp3 second.mp3 third.mp3 result.mp3\n\n\nwhich does what it is supposed to; concatenates given files into one file. But unfortunately there is a small time-gap between those files in result.mp3. Is there a way to remove this gap?\n\nI am creating first.mp3, second.mp3 and so on before concatenating them by merging multiple audios(same length/format/rate): \n\nsox -m drums.mp3 bass.mp3 guitar.mp3 first.mp3\n\n\nHow can I check and assure that there is no time-gap added on all those files? (merged and concatenated) \n\nI need to achieve a seamless playback of all the concatenated files (when playing them in browser one after another it works ok).\n\nThank you for any help.\n\nEDIT: \n\nThe exact example (without real file-names) of a command I am running is now:\n\nsox \"|sox -m file1.mp3 file2.mp3 file3.mp3 file4.mp3 -p\" \"|sox -m file1.mp3 file6.mp3 file7.mp3 -p\" \"|sox -m file5.mp3 file6.mp3 file4.mp3 -p\" \"|sox -m file0.mp3 file2.mp3 file9.mp3 -p\" \"|sox -m file1.mp3 file15.mp3 file4.mp3 -p\" result.mp3\n\n\nThis merges files and pipes them directly into concatenation command. The resulting mp3 (result.mp3) has an ever so slight delay between concatenated files. Any ideas really appreciated." ]
[ "audio", "concatenation", "sox" ]
[ "Address Book propertyID - unknown type?", "Working on an app that makes heavy use of the Address Book framework. There are a number of View Controllers that interact with Address Book data, and they all work just fine. Except for one, and it's killing me. \n\nI have a class that wraps address book access, in a method such as:\n\n- (NSDictionary*)labelsToValues:(ABPropertyID)propertyID {\nABAddressBookRef addressBook = ABAddressBookCreate();\nABRecordRef aRecord = ABAddressBookGetPersonWithRecordID(addressBook, [self recordIdFromAddressBookId]);\n\nNSMutableDictionary *entries = [NSMutableDictionary dictionary]; \n\nABMultiValueRef multiValueProperty = ABRecordCopyValue(aRecord, propertyID);\n// do some other stuff\n\n\nAnd then I call it in places like this:\n\n- (NSDictionary*)emailProperties {\nreturn [self labelsToValues:kABPersonEmailProperty];\n}\n\n\nAnd it works! Of course it does, I'm sending the message with an argument that is a Constant from the Address Book framework. So it should always work!\n\nBut that's not the case. This particular emailProperties: message is one that I'm calling in several places... and sometimes it works, but sometimes it doesn't. When things go awry, I put it through the debugger and I get something like this:\n\n\nHow is that possible!? Even odder, if I sort of \"prime\" the problematic View Controller by viewing other View Controllers where everything behaves as expected, and then I return to the problematic View Controller, everything works fine. So, I'm guessing this is some sort of linking error, but I'm not sure how to even begin with troubleshooting that." ]
[ "iphone", "ipad", "ios", "addressbook" ]
[ "Steps of multiple object tracking", "I am searching on people tracking and reading about detection based tracking. the steps as I understood is:\n\n1- detection\n\n2- position or any feature from bbox of detected person\n\n3- matching with next frame detection\n\n4- using tracker to connect tracklet to detected person\n\n5- repeat steps again\n\nthe question are these steps right? and how to benefit from dataset that provide detection information (can you please show which dataset provides detection information).\n\nAlso, is the tracker responsibility for connecting two matched bbox? or?\n\nRegards" ]
[ "matlab", "computer-vision", "tracking" ]
[ "How to pass route parameters as numbers?", "In the section Passing Props to Route Components of Vue documentation, they explain how to pass a parameter from the location path into the component, and they declare the props as an array. But in the Style guide, they mention it is preferable to have props define (at least) their data type. \n\nIf i were to listen to the style guide, and if i wanted my URL to define id's of the entities they want to refer to (for example /user/99), then how would i pass that parameter as a number, and avoid the console error telling me it expected a number, but got a string? There are no examples of this.\n\nIn the line { path: '/user/:id', component: User, props: true }, i would need some extra parameters specifying that id is of type Numeric. But how exactly?" ]
[ "vue.js", "vuejs2", "vue-router" ]
[ "Performing statistical test on every possible file combination in a folder", "I have a folder with about 100 csv files. I want to use a two sampled Kolmogorov-Smirnov test on every possible file combination. I can do this manually like this:\n\nimport pandas as pd \nimport scipy as sp\n\ndf=pd.read_csv(r'file1.csv')\ndf2=pd.read_csv(r'file2.csv')\nsp.stats.ks_2samp(df, df2)\n\n\nbut I don't want to manually assign all the variables. Is there a way to iterate through the files and compare all the possible combinations using the statistical test?" ]
[ "python", "pandas", "statistics" ]
[ "HTML Flickering when using JS function", "I am trying to change text in html using the DOM. I have a form with 2 radio buttons and a submit button. When submitted, it runs a JS function that should change text in HTML to reflect what answer they chose. However, whenever you click the submit button, it changes the text and then instantly flickers back to what the html shows. Why is it doing this? I've never seen this before. Here is the code...\n\n\r\n\r\nfunction answerNext()\r\n{\r\n if(document.getElementById(\"question1\").checked == true)\r\n {\r\n document.getElementById(\"qtext\").innerText=\"You chose the first option\";\r\n }else if (document.getElementById(\"question2\").checked == true)\r\n {\r\n documet.getElementById(\"qtext\").innerText=\"You chose the second option\";\r\n }else\r\n {\r\n document.getElementById(\"qtext\").innerText=\"You chose neither option\";\r\n document.getElementById(\"testdiv\").innerHTML=\"<h1>You clicked next</h1>\";\r\n }\r\n}\r\n<!doctype html>\r\n<html>\r\n <head>\r\n <title>Dog Personailty Quiz</title>\r\n <link href=\"css/style.css\" rel=\"stylesheet\" type=\"text/css\">\r\n <script src=\"js/script.js\"></script>\r\n </head>\r\n <body>\r\n <h1>Is now a good time to get a dog?</h1>\r\n <h2 id=\"qtext\">Do you like to run a lot</h2>\r\n <div id=\"testdiv\"></div>\r\n <form>\r\n <input type=\"radio\" id=\"question1\" value=\"option1\"> Option 1\r\n <input type=\"radio\" id=\"question2\" value=\"option1\"> Option 2\r\n <input type=\"submit\" value=\"Next\" onclick=\"answerNext();\">\r\n </form>\r\n </body>\r\n</html>" ]
[ "javascript", "html" ]
[ "Get cell style with phpExcel from ods file", "I'm using the PHPExcel lib to read spread sheets. With xlsx and xls files it works fine, but not with ods and ots.\n\nI'm trying to get the background color of the cell but with ods files I always get FFFFF instead of the actual cell color.\n\nHere is the code I'm working on:\n\n$cantCOL = 5;\ntry {\n //file route\n $rutaArchivo = $_FILES[\"archivo\"][\"tmp_name\"];\n //phpExcel Reader\n $objReader = PHPExcel_IOFactory::createReaderForFile($rutaArchivo);\n //ReadDataOnly false, to get cell color\n $objReader->setReadDataOnly(false);\n //load spreedsheet from file route\n $objLibro = $objReader->load($rutaArchivo);\n //set the active sheet\n $objLibro->setActiveSheetIndex(0);\n //get last row number\n $n = $objHoja->getHighestRow();\n //Loop through the rows\n for ($fila = 1; $fila <= $n; $fila++) {\n //Loop through the columns\n for($col = 0; $col < $cantCOL+2; $col++){\n $columnLetter = PHPExcel_Cell::stringFromColumnIndex($col);\n //get the cell color, RGB format\n $cellColor = $objLibro->getActiveSheet()->getStyle($columnLetter.$fila)\n ->getFill()\n ->getStartColor()\n ->getRGB();\n if($cellColor!='000000' && $cellColor!='FFFFFF' && !$error){\n //Show cell color\n echo '<script language=\"javascript\">alert(\"Color: \"'.$cellColor.'\");</script>';\n }else{\n echo '<script language=\"javascript\">alert(\"No Color\");</script>';\n }\n }\n }\n } catch (Exception $e) {\n echo '<script language=\"javascript\">alert(\"Error:\"'.$e.'\");</script>';\n }" ]
[ "php", "phpexcel", "ods" ]
[ "Cannot render another component within an Angular Material dialog/modal", "I'm using Material design components for my Angular application. For a few parts of my application, I'm opening a dialog/modal that covers the whole viewport and I want to nest components within that modal.\nFor example, here is the code to open a dialog/modal:\n openUserAccountModal(): void {\n const dialogRef = this.dialog.open(MyAccountModalComponent, {\n width: '100vw',\n height: '100vh',\n maxWidth: '100vw',\n maxHeight: '100vh',\n hasBackdrop: false\n });\n\n dialogRef.afterClosed().subscribe(result => {\n console.log('The dialog was closed');\n });\n}\n\nWhen this dialog/modal opens, I have two main sections, a side navigational menu with different section names and the content I want to display for each section. I'm using [NgSwitch] to display the different sections. Here is a code snippet of what I have now:\n <div *ngSwitchCase="'My Profile'">\n <div class="my-profile">\n <h4 class="my-profile__section-title">My Profile</h4>\n <p class="my-profile__section-description">Add details about your education, industry \n of interest,\n etc.\n </p>\n <mat-card class="my-profile__user-card u-no-shadow">\n <div class="edit-btn__wrapper">\n <button *ngIf="!editMode" mat-flat-button color="primary" class="edit-btn"\n (click)="editUserData()">Edit</button>\n </div>\n <div *ngIf="editMode" class="edit-form">\n <form action="" class="edit-form__image">\n <mat-list class="edit-form__list">\n <mat-list-item class="my-profile__user-list--item image-item">\n <img class="my-profile__user-list--image" matListAvatar \n [src]="userData.image"\n alt="...">\n </mat-list-item>\n </mat-list>\n </form>\n\nNow, onto the question: I want to organize each section into its own component, however, the component won't display when I do so. This is a code snippet of what I want:\n<div *ngSwitchCase="'My Profile'">\n <app-my-profile></app-my-profile>\n\nYet, this code won't render the component. My assumption is that is has to do with it being rendered within the dialog/modal. Any idea of how I can achieve this goal?" ]
[ "angular", "ng-switch" ]
[ "Remove adjacent duplicate characters in a String(java) i.e input:aaaabbbccdbbaae output: abcdbae", "my code does not give expected output,but dry run works fine.please give a look where is the problem\n\npublic static StringBuffer singleOccurence(String s)\n{\n StringBuffer sb = new StringBuffer(s);\n int length=s.length();\n\n\n for(int i=0; i< length ; i++)\n {\n for(int j=i; i<length&&j<length ; j++)\n {\n if(sb.charAt(i)!=sb.charAt(j+1)) \n i=j+1;\n else\n sb.deleteCharAt(j+1);\n } \n }\n\n return sb;\n}\n\n\nalso gives StringIndexOutOfBounds" ]
[ "java", "string" ]
[ "How can a certain structure be retrieved from a group of structures?", "So let's say I have a structure consisting of three elements - SPEED_OF_LIGHT, SPEED_OF_SOUND, and SPEED_OF_PERSON as shown below:\n\npublic struct Fast {\n public let speed: Double\n\n private init(speed: Double) {\n self.speed = speed\n }\n\n public static let SPEED_OF_LIGHT = Fast(speed: 300000000)\n public static let SPEED_OF_SOUND = Fast(speed: 340)\n public static let SPEED_OF_PERSON = Fast(speed: 1.5)\n}\n\n\nIf I have a double of let's say 340, how would I iterate through all of the possibilities until I find the correct match? To show exactly what I mean, I have a working code snippet that does what I want. This is done in Java.\n\npublic enum Fast {\n SPEED_OF_LIGHT(300000000),\n SPEED_OF_SOUND(340),\n SPEED_OF_PERSON(1.5);\n\n private double speed;\n\n private Fast(double speed) {\n this.speed = speed;\n }\n\n public static Fast getFast(double speed) {\n for (Fast f : Fast.values()) {\n if (f.speed == speed) return f;\n }\n throw new IllegalArgumentException();\n }\n}\n\n\nIn the above case, calling getFast(340) would return SPEED_OF_SOUND. How would I do something similarly in Swift?" ]
[ "swift", "struct" ]
[ "Unable to detect user pressing 'Cancel' from window.prompt()", "According to what I've researched, the function should be able to detect whether input is empty or not as well as if 'Cancel' is pressed. However, only the first two things work and whenever I click on 'Cancel', nothing happens.\n\nI've posted the whole function code, but my issue is with the if-else statement. I've tested this on IE7, Chrome and Firefox.\n\nJavaScript:\n\nfunction countStrings()\n{\n var sequence = [];\n sequence = window.prompt( \"Enter a sequence of values\", \"a 1 b 2\" ).split( \" \" );\n if ( sequence[ 0 ] === \"\" )\n {\n // user pressed OK or Return; input is empty\n }\n else if ( sequence )\n {\n // user pressed OK or Return; input not empty.\n }\n else\n {\n // User pressed Cancel; not being detected/not working.\n // Nothing happens.\n }\n}\n\n\nHTML:\n\n<!DOCTYPE HTML>\n<html>\n<head>\n <meta charset=\"UTF-8\">\n <title>Practice</title>\n <script type = \"text/javaScript\" src=\"./practice.js\"></script>\n</head>\n<body id=\"beach_ready\">\n <h1>Practising JavaScript functions</h1>\n <p>\n <input id=\"f\" type=\"button\" value=\"Function\" onclick=\"countStrings();\" />\n Click to the count number of strings in an array\n </p>\n</body>\n</html>" ]
[ "javascript" ]
[ "log4j2 not writing in the log files", "I want to use log4j2 for needs of my application. \nI'm using RollingAppender with variables in the ThreadContext.\n\nHere is my log4j2.xml\n\n<Configuration>\n<Appenders>\n <Routing name=\"RoutingAppender\">\n <Routes pattern=\"$${ctx:FlowName}\">\n <Route>\n <RollingFile name=\"Audit-${ctx:FlowName}\"\n fileName=\"logs/Audit-${ctx:FlowName}.log\"\n filePattern=\"logs/Audit-${ctx:FlowName}.%i.log.gz\"\n immediateFlush=\"true\">\n <PatternLayout>\n <pattern>\"%m%n\"<pattern/>\n </PatternLayout>\n\n <Policies>\n <TimeBasedTriggeringPolicy interval=\"6\" modulate=\"true\" />\n <SizeBasedTriggeringPolicy size=\"10 MB\" />\n </Policies>\n </RollingFile>\n </Route>\n </Routes>\n </Routing>\n</Appenders>\n<Loggers>\n <Root level=\"trace\">\n <appender-ref ref=\"RoutingAppender\" level=\"info\"/>\n </Root>\n <Logger name=\"AuditNippin\" level=\"info\" >\n <AppenderRef ref=\"myRoutingAppender\"/>\n </Logger>\n</Loggers>\n</Configuration>\n\n\nHere is the java code:\n\npackage be.myApp;\npublic class myClass{\n private static final org.apache.logging.log4j.core.Logger AUDITLOGGER = \n (org.apache.logging.log4j.core.Logger) org.apache.logging.log4j.LogManager.getLogger(\"myRoutingAppender\");\n\n public void doSomething(){\n ThreadContext.put(\"FlowName\", \"MyFlow\");\n AUDITLOGGER.info(\"coucou\");\n ThreadContext.remove(\"FlowName\");\n }\n}\n\n\nThis creates the file correctly depending on the context. But write nothing in the log file." ]
[ "java", "routing", "log4j2", "rollingfileappender" ]