texts
sequence
tags
sequence
[ "TypeError 'builtin_function_or_method' is not iterable during heroku deployment", "I'm trying to deploy my first django app to heroku. I have followed all the settings steps in the guide but I run into the following Traceback during deployment:\n\nif 'DATABASES' not in config:\nTypeError: argument of type 'builtin_function_or_method' is not iterable\n\n\nIf I disable collectstatic then deployment runs without errors but as soon as I try to migrate my database it raises the same error. Can anyone help please?" ]
[ "django", "heroku", "heroku-postgres" ]
[ "EF 4.1 OnModelCreating not called", "I have a problem with EF 4.1 not calling OnModelCreating so that I can configure tables etc. I have an existing database. Here is my connection string:\n\n<add name=\"AcmeDBContext\"\n connectionString=\"metadata=res://*/|res://*/|res://*/;\n provider=System.Data.SqlClient;\n provider connection string="\n data source=[server];\n initial catalog=Acme;integrated security=True;\n multipleactiveresultsets=True;App=EntityFramework"\"\n providerName=\"System.Data.EntityClient\" />\n\n\nHere is my class inherited from DbContext:\n\npublic class AcmeDBContext : DbContext\n{\n public AcmeDBContext()\n : base()\n {\n Database.SetInitializer<AcmeDBContext>(null); \n }\n\n protected override void OnModelCreating(DbModelBuilder modelBuilder)\n {\n modelBuilder.Conventions.Remove<IncludeMetadataConvention>();\n modelBuilder.Conventions.Remove<PluralizingTableNameConvention>(); \n modelBuilder.Entity<Vehicle>().ToTable(\"tblVehicle\");\n modelBuilder.Entity<VehicleMake>().ToTable(\"tblVehicleMake\");\n modelBuilder.Entity<VehicleModel>().ToTable(\"tblVehicleModel\");\n base.OnModelCreating(modelBuilder);\n }\n\n }\n\n\nI have read and read online, but I cannot point out what the problem is. The OnModelCreating is never called and hence the exceptions saying that the entity/classes (Vehicle, VehicleMake, VehicleModel) do not exist in the current context when I try to query anything." ]
[ "c#", "entity-framework-4.1", "dbcontext" ]
[ "gulp-If. How to check if js file contains specific property?", "I am using gulp.js. But I want to add a condition that if request.debug = true; in any of my js file then gulp task should fail. I have found gulp-if and gulp-fail that I can use for this purpose but I don't know that how can I check the specific condition?\nThanks" ]
[ "javascript", "jquery", "node.js", "gulp", "gulp-if" ]
[ "C# WebBrowser, injecting JavaScript doesn't update HtmlDocument", "I'm trying to resolve an issue that's disconcerting me. It might be something obvious but I can't really figure out what's wrong.\n\nI have a winform with a WebBrowser which I load this way and it works fine:\n\n WebBrowser.DocumentText = someHtmlCode;\n\n\nIn my winform's webbrowser I can right-click to get the HTML source and check out that the code is the same I set in the DocumentText property... everything's ok at this point.\n\nSo once I get it loaded and working, I inject some JavaScript code into it, something like this:\n\n HtmlElement head = WebBrowser.Document.GetElementsByTagName(\"head\")[0];\n HtmlElement scriptEl = WebBrowser.Document.CreateElement(\"script\");\n IHTMLScriptElement element = (IHTMLScriptElement)scriptEl.DomElement;\n element.text = \"function sayHello() { alert('hello') }\";\n head.AppendChild(scriptEl);\n\n\nSo I'm adding a new JavaScript function named \"sayHello\" that I can call this way, and it's still working properly:\n\n WebBrowser.Document.InvokeScript(\"sayHello\");\n\n\nSo everything's ok at this point, I can run the JavaScript function and getting the alert inside the WebBrowser, but what's disconcerting me is that when I right-click on the WebBrowser to get the source code, I get the same code I set at the beginning. No trace about the JavaScript code added later, although it's there because it's working when I invoke it.\n\nOf course, if I look into the WebBrowser.HtmlDocument, I can't see the JavaScript either, it's the same that I get looking at the source code.\n\nSo my question is: where's the new JavaScript code going and how can I get it back? I need to get the updated HTML code.\n\nThanks!" ]
[ "c#", "winforms", "browser" ]
[ "Error: \"git\" command line tool is not installed: make sure it is accessible on your PATH", "I'm not able to add the cordova barcode plugin. It shows \n\n\n Error: git command line tool is not installed: make sure it is\n accessible on your PATH.\n\n\nI separately downloaded and installed git and I also set the environment variables C:\\Program Files\\Java\\jdk1.7.0_21\\bin;C:\\Program Files\\Java\\jre7\\bin;C:\\Users\\h117953\\AppData\\Roaming\\npm; C:\\Program Files\\Git\\bin;C:\\Users\\h117953\\AppData\\Roaming\\npm\\node_modules\\git;C:\\Program Files (x86)\\Git\\cmd;) \nI also reseted my machine a lot of times but it still shows that error.\n\nC:\\Users\\h117953\\myapp>cordova plugin add https://github.com/wildabeast/BarcodeS\ncanner.git\nFetching plugin \"https://github.com/wildabeast/BarcodeScanner.git\" via git clone\n\nError: \"git\" command line tool is not installed: make sure it is accessible on y\nour PATH.\n at Object.clone (C:\\Users\\h117953\\AppData\\Roaming\\npm\\node_modules\\cordova\\n\node_modules\\cordova-lib\\src\\gitclone.js:36:25)\n at Object.module.exports.clonePluginGitRepo (C:\\Users\\h117953\\AppData\\Roamin\ng\\npm\\node_module\n\ns\\cordova\\node_modules\\cordova-lib\\src\\plugman\\util\\plugins.js:\n 42:18)\n at Object.module.exports.clonePluginGit (C:\\Users\\h117953\\AppData\\Roaming\\np\n m\\node_modules\\cordova\\node_modules\\cordova-lib\\src\\plugman\\util\\plugins.js:32:3\n 1)\n at C:\\Users\\h117953\\AppData\\Roaming\\npm\\node_modules\\cordova\\node_modules\\co\n rdova-lib\\src\\plugman\\fetch.js:83:28\n at _fulfilled (C:\\Users\\h117953\\AppData\\Roaming\\npm\\node_modules\\cordova\\nod\n e_modules\\q\\q.js:787:54)\n at self.promiseDispatch.done (C:\\Users\\h117953\\AppData\\Roaming\\npm\\node_modu\n les\\cordova\\node_modules\\q\\q.js:816:30)\n at Promise.promise.promiseDispatch (C:\\Users\\h117953\\AppData\\Roaming\\npm\\nod\n e_modules\\cordova\\node_modules\\q\\q.js:749:13)\n at C:\\Users\\h117953\\AppData\\Roaming\\npm\\node_modules\\cordova\\node_modules\\q\\\n q.js:509:49\n at flush (C:\\Users\\h117953\\AppData\\Roaming\\npm\\node_modules\\cordova\\node_mod\n ules\\q\\q.js:108:17)\n at process._tickCallback (node.js:355:11)" ]
[ "git", "cordova", "phonegap-plugins", "cordova-plugins", "ngcordova" ]
[ "In a Spring boot test, how can I create a bean and injects by @Autowired?", "When I test my Spring boot service I don't know how I can inject an @Autowired bean.\n\nMy bean (Spring fills @Value from application.yml):\n\n@Component\npublic class NavigatorProperties {\n @Value(\"${timerDelay}\")\n private String timerDelay;\n\n public String getTimerDelay() {\n return timerDelay;\n }\n public void setTimerDelay(String timerDelay) {\n this.timerDelay = timerDelay;\n }\n}\n\n\nMy api:\n\npublic class ListenerApi implements IRestListenerApi {\n @Autowired\n private NavigatorProperties np;\n\n public String doSomething (...) { // This is my service method.\n // Here np.getTimerDelay() will return application.yml value.\n int timerDelay = Integer.decode(np.getTimerDelay());\n ...\n }\n}\n\n\nThis works fine and int value is correct. Here is my test:\n\n@RunWith(SpringRunner.class)\n@SpringBootTest(classes = {ListenerApiTest.class, NavigatorProperties.class})\n@FixMethodOrder(MethodSorters.NAME_ASCENDING)\npublic class ListenerApiTest {\n @Autowired\n private NavigatorProperties np; // Can be autowired or a new Object.\n\n // Object to test.\n private ListenerApi listenerApi;\n\n @Test\n public void test01ForceNumberFormatException() {\n np.setTimerDelay(\"NumberFormatException\");\n // Inyect into ListenerApi\n }\n\n @Test\n public void test02ForceNullPointerException() {\n np.setTimerDelay(null);\n // Inyect into ListenerApi\n }\n\n\nIn this test comments, how I can inyect into ListenerApi by @Autowired?\n\nThanks." ]
[ "java", "spring", "spring-boot", "testing" ]
[ "Mac verify failure on ruby on rails", "I am getting an error with my ruby on rails application.\n\nI am trying to use this repository :https://github.com/nomad/dubai to generate a pkpass.\n\nHowever, I am getting a pcks12Error::Mac verify failure at this step:\n\nDubai::Passbook.certificate, Dubai::Passbook.password = \"/resources/certificate.p12\", \"mypassword\"\n\n# Example.pass is a directory with files \"pass.json\", \"icon.png\" & \"[email protected]\"\nFile.open(\"Example.pkpass\", 'w') do |f|\n f.write Dubai::Passbook::Pass.new(\"Example.pass\").pkpass.string\nend\n\n\nI looked on the web but founded nothing about this kind of error in RoR.\n\nEDIT:\nI am pretty sure that this is an OpenSSL error. My certificates are coming from another machine. Is that thing can influence this error? Do I have to create a certificate on my machine? To configure OpenSSL?" ]
[ "ruby-on-rails", "ruby-on-rails-3", "security", "web", "passbook" ]
[ "Regex for find bold text", "I want to fetch the text between ** and **.\n\nThis is what I am trying with:\n\n/\\**(.*)\\**/ig\n\n\nThis is the sample string\n\n** The ** *quick* ~~brown~~ fox ** jumped **\n\n\nplease ignore the space after ** and before **\n\nAs a result, I am getting the whole string fetched" ]
[ "javascript", "regex" ]
[ "Ajax.BeginForm partial view replace whole page", "I had some problem in my MVC application, when I use button (submit) everything is okay but if I use onchange, partial view opened in the same window not replaced any div, I use all methods what I see here, but nothing help, here all code (any does not work correctly).\nWhy its Happens?\n\nController:\n\npublic class HomeController : Controller\n{\n public ActionResult Index()\n {\n List<string> Year = new List<string>();\n Year.Add(\"1\");\n Year.Add(\"2\");\n Year.Add(\"3\");\n Year.Add(\"4\");\n ViewBag.Years = new SelectList(Year);\n return View();\n }\n public PartialViewResult testt()\n {\n return PartialView();\n }\n [HttpPost]\npublic PartialViewResult testTwo()\n {\n return PartialView();\n }\n}\n\n\nView (I am include on my page all scripts unobtrusive ajax, microsoft ajax, jquery and many others):\n\n<script src=\"~/Scripts/respond.min.js\"></script>\n<script src=\"~/Scripts/_references.js\"></script>\n<script src=\"~/Scripts/bootstrap.js\"></script>\n<script src=\"~/Scripts/jquery-1.10.2.intellisense.js\"></script>\n<script src=\"~/Scripts/jquery-1.10.2.js\"></script>\n<script src=\"~/Scripts/jquery.unobtrusive-ajax.js\"></script>\n<script src=\"~/Scripts/jquery.validate-vsdoc.js\"></script>\n<script src=\"~/Scripts/jquery.validate.js\"></script>\n<script src=\"~/Scripts/jquery.validate.unobtrusive.js\"></script>\n<script src=\"~/Scripts/MicrosoftAjax.debug.js\"></script>\n<script src=\"~/Scripts/MicrosoftAjax.js\"></script>\n<script src=\"~/Scripts/MicrosoftMvcAjax.js\"></script>\n<script src=\"~/Scripts/MicrosoftMvcValidation.js\"></script>\n<script src=\"~/Scripts/modernizr-2.6.2.js\"></script>\n<script src=\"~/Scripts/respond.js\"></script>\n@using (Ajax.BeginForm(\"testt\", new AjaxOptions { HttpMethod = \"GET\", UpdateTargetId = \"testDiv\", InsertionMode = InsertionMode.Replace }))\n\n{\n<div>\n <div >\n @Html.DropDownList(\"UnitsNames\", (SelectList)ViewBag.Years, new { onchange = \"$(this.form).onsubmit()\" })\n </div>\n <div >\n @Html.DropDownList(\"Years\", (SelectList)ViewBag.Years, new { onchange = \"$(this.form).submit()\" })\n </div>\n <div>\n @Html.DropDownList(\"Years\", (SelectList)ViewBag.Years, new { onchange = \"this.form.submit()\" })\n </div>\n <div>\n @Html.DropDownList(\"Years\", (SelectList)ViewBag.Years, new { onchange = \"this.form.onsubmit()\" })\n </div>\n</div>\n}\n\n@using (Ajax.BeginForm(\"testTwo\", new AjaxOptions { HttpMethod = \"POST\", UpdateTargetId = \"testDiv\", InsertionMode = InsertionMode.Replace }))\n\n{\n<div>\n <div>\n @Html.DropDownList(\"Years\", (SelectList)ViewBag.Years, new { onchange = \"$(this.form).onsubmit()\" })\n </div>\n <div>\n @Html.DropDownList(\"Years\", (SelectList)ViewBag.Years, new { onchange = \"$(this.form).submit()\" })\n </div>\n <div>\n @Html.DropDownList(\"Years\", (SelectList)ViewBag.Years, new { onchange = \"this.form.submit()\" })\n </div>\n <div>\n @Html.DropDownList(\"Years\", (SelectList)ViewBag.Years, new { onchange = \"this.form.onsubmit()\" })\n </div>\n</div>\n}\n\n<br>\n<div id=\"testDiv\">\n <h4>here i need a partial view</h4>\n</div>\n\n\nThanks!" ]
[ "c#", "asp.net-mvc", "asp.net-ajax", "asp.net-mvc-5" ]
[ "Authenticate a user with Django", "I have the login html page and an index html page but when i write down username and password the page only refresh without doing anything.\nI use Django 2.x and Python 3.4\n\nThe code in login html:\n\n <form class=\"form-signin\" action='{% url 'myapp:index' %}' method=\"post\">\n {% csrf_token %}\n\n <img class=\"mb-4\" src='{% static 'app/img/logo.png' %}' alt=\"\" width=\"300\" height=\"100\">\n\n <h1 class=\"h3 mb-3 font-weight-normal\">mysite</h1>\n <br>\n <div class=\"group\">\n <input type=\"username\" id=\"inputUser\" name=\"username\" class=\"form-control\" placeholder=\"Username\" required autofocus alt=\"\" width=\"300\" height=\"100\">\n </div>\n\n <div class=\"group\">\n <input type=\"password\" id=\"inputPassword\" name=\"password\" class=\"form-control\" placeholder=\"Password\" required alt=\"\" width=\"300\" height=\"100\">\n </div>\n\n <div>\n <button class=\"btn btn-lg btn-primary btn-block\" type=\"submit\">Accedi</button>\n </div>\n\n </form>\n\n\nand here my view:\n\ndef index(request):\n username = request.post[\"username\"]\n password = request.post[\"password\"]\n user = authenticate(request, username=username, password=password)\n if user is not None:\n login(request, user)\n return render(request, \"myapp/index.html\")\n\n\nWhat I'm doing wrong?\nThanks\n\nEDIT:\n\nMy error.log\n\n\n AH00558: httpd.exe: Could not reliably determine the server's fully qualified domain name, using fe80::1c06:8ac5:1b1e:aa2f. Set the 'ServerName' directive globally to suppress this message\n [Thu Aug 02 12:35:17.911829 2018] [mpm_winnt:notice] [pid 4196:tid 452] AH00455: Apache/2.4.34 (Win64) mod_wsgi/4.6.4 Python/3.6 configured -- resuming normal operations\n [Thu Aug 02 12:35:17.912829 2018] [mpm_winnt:notice] [pid 4196:tid 452] AH00456: Apache Lounge VC15 Server built: Jul 11 2018 13:09:01\n [Thu Aug 02 12:35:17.912829 2018] [core:notice] [pid 4196:tid 452] AH00094: Command line: 'c:\\Apache\\bin\\httpd.exe -d C:/Apache'\n [Thu Aug 02 12:35:17.913829 2018] [mpm_winnt:notice] [pid 4196:tid 452] AH00418: Parent: Created child process 2112\n AH00558: httpd.exe: Could not reliably determine the server's fully qualified domain name, using fe80::1c06:8ac5:1b1e:aa2f. Set the 'ServerName' directive globally to suppress this message\n AH00558: httpd.exe: Could not reliably determine the server's fully qualified domain name, using fe80::1c06:8ac5:1b1e:aa2f. Set the 'ServerName' directive globally to suppress this message\n [Thu Aug 02 12:35:18.335853 2018] [mpm_winnt:notice] [pid 2112:tid 472] AH00354: Child: Starting 64 worker threads.\n\n\nMy access.log:\n\n\n myip - - [02/Aug/2018:12:35:28 +0200] \"GET /myapp/ HTTP/1.1\" 200 2633\n myip - - [02/Aug/2018:12:35:48 +0200] \"POST /myapp/ HTTP/1.1\" 200 2633\n\n\nEDIT2:\nI changed in the url.py from path to url and resolve the problem...now the page load correctly, thanks to all of you" ]
[ "django", "python-3.x" ]
[ "Unable to run an interactive shell script using conda run", "I have this script "/home/prod/test.sh"\n#!/bin/bash\necho Hello, who am I talking to?\nread varname\necho It\\'s nice to meet you $varname\n\nI was expecting that when I run this command\nconda run -n myenv /home/prod/test.sh\n\nI will see a prompt waiting for me to enter the value for varname , instead I got\n(base) prod@dev-box:~$ conda run -n reportz /home/prod/test.sh\nHello, who am I talking to?\nIt's nice to meet you\n\n(base) prod@dev-box:~$\n\nWould very much appreciate a response detailing, how I can use conda to run an inetractive shell script ?\n[Edit]\nReplaced read varname with read -r varname < /dev/tty\nIt did wait for my input, but without displaying the output resulting from the echo statement echo Hello, who am I talking to?\nSolution I'm looking for - the script should run with conda run command exactly as it would in a typical shell env." ]
[ "bash", "conda" ]
[ "How to find all fields being used in my Crystal Reports from SQL?", "I'm trying to clean up my SQL database and find out which fields are not being used. Is it possible to find all fields from SQL that are being used in Crystal Reports without manually looking in each query? \n\nThank you!" ]
[ "sql", "crystal-reports" ]
[ "ScrollToIndex out of range : requested index NaN but maximum is 3 -- SwiperFlatList", "this is my swiperflatlist component in which i am rendering the images from api but why i am getting this error i coundn't understand pls let me know why i am getting this error? \n\nindex nan should but the components are called as map of flatlist ? \n\n <SwiperFlatList\n autoplayDelay={2}\n autoplay\n autoplayLoop\n index={0}\n data={this.state.achhamall}\n renderItem={({item}) => // Standard Image\n <View style={[styles.child, { }]}>\n\n\n <Image\n style={{height:400, width: width , resizeMode:'contain'}}\n source={{uri: item.image}}\n />\n </View>\n }\n showPagination\n />" ]
[ "react-native", "react-native-flatlist" ]
[ "Azure B2C: Using Azure's e-mail verification system while overriding DisplayClaim in Technical Profile?", "I think I'm getting close to answering my original question, but I noticed that when I add a REST API technical profile to the list of ValidationTechnicalProfiles, I can't collect data on the custom claim extension_organizationName. How come this is the case? Is it possible to inherit the technical profile and expand upon it?\nAs an alternative, I found out that I can use a DisplayClaim. However, I can no longer use the Azure's e-mail verification system. Is there a way to use Azure e-mail verification system while using DisplayClaims?\nHere's what my technical profile looks like so far:\n <TechnicalProfile Id="LocalAccountAdminSignUpWithLogonEmail">\n <DisplayName>Email signup</DisplayName>\n <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.SelfAssertedAttributeProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />\n <Metadata>\n <Item Key="IpAddressClaimReferenceId">IpAddress</Item>\n <Item Key="ContentDefinitionReferenceId">api.localaccountsignup</Item>\n <Item Key="language.button_continue">Create</Item>\n </Metadata>\n <CryptographicKeys>\n <Key Id="issuer_secret" StorageReferenceId="B2C_1A_TokenSigningKeyContainer" />\n </CryptographicKeys>\n <InputClaims>\n <InputClaim ClaimTypeReferenceId="email" PartnerClaimType="Verified.Email"/>\n </InputClaims>\n <DisplayClaims>\n <DisplayClaim ClaimTypeReferenceId="email" />\n <DisplayClaim ClaimTypeReferenceId="displayName" Required="true" />\n <DisplayClaim ClaimTypeReferenceId="givenName" Required="true" />\n <DisplayClaim ClaimTypeReferenceId="surName" Required="true" />\n <DisplayClaim ClaimTypeReferenceId="extension_organizationName" Required="true" />\n <DisplayClaim ClaimTypeReferenceId="newPassword" Required="true" />\n <DisplayClaim ClaimTypeReferenceId="reenterPassword" Required="true" />\n </DisplayClaims>\n <OutputClaims>\n <OutputClaim ClaimTypeReferenceId="objectId" />\n <OutputClaim ClaimTypeReferenceId="email" PartnerClaimType="Verified.Email" Required="true" />\n <OutputClaim ClaimTypeReferenceId="newPassword" Required="true" />\n <OutputClaim ClaimTypeReferenceId="reenterPassword" Required="true" />\n <OutputClaim ClaimTypeReferenceId="executed-SelfAsserted-Input" DefaultValue="true" />\n <OutputClaim ClaimTypeReferenceId="authenticationSource" />\n <OutputClaim ClaimTypeReferenceId="newUser" />\n\n <!-- Optional claims, to be collected from the user -->\n <OutputClaim ClaimTypeReferenceId="displayName" />\n <OutputClaim ClaimTypeReferenceId="givenName" />\n <OutputClaim ClaimTypeReferenceId="surName" />\n <OutputClaim ClaimTypeReferenceId="extension_organizationName" />\n </OutputClaims>\n <ValidationTechnicalProfiles>\n <ValidationTechnicalProfile ReferenceId="REST-API-SignUp" />\n <ValidationTechnicalProfile ReferenceId="AAD-UserWriteUsingLogonEmail" />\n </ValidationTechnicalProfiles>\n <UseTechnicalProfileForSessionManagement ReferenceId="SM-AAD" />\n </TechnicalProfile>" ]
[ "azure", "azure-active-directory", "azure-ad-b2c", "azure-ad-b2c-custom-policy" ]
[ "DataType Mismatch on UnionQuery | MS Access", "Essentially I have the following Union Query:\nSELECT ID, ProductID, AssignedColour AS D, "Assigned" AS Cat, "Colour" & DCount("*","ProductColor","ProductID=" & ProductID & " AND ID<" & ID)+1 AS GrpSeq FROM ProductColor\nUNION SELECT ID, ProductID, ColourFinding, "Finding", "Colour" & DCount("*","ProductColor","ProductID=" & ProductID & " AND ID<" & ID)+1 & "_Capacity" FROM ProductColor;\n\nBased on the following Table:\n\nThe issue I am having is ProductID was changed from a DataType Number to DataType Short Text.\nAfter the change I get the following error:\nDataType Mismatch.\nHow can the above query be modified to account for this change?" ]
[ "ms-access" ]
[ "rails update with array of params", "I have following params\n\npost[:name]\npost[:title]\npost[:unique][:comment]\npost[:unique][:date]\n\n\nI tried update\n\ntest = post[:unique][:comment]\[email protected]_attribute(:contest, test)\n\n\nAnd getting error as \n\nundefined local variable or method `post'\n\n\nBut normal update are working that is\n\[email protected]_attribute(:name, :name) #This works" ]
[ "ruby-on-rails", "ruby-on-rails-3", "ruby-on-rails-4" ]
[ "Error Installing Nodejs on OSX Maverick", "Last month, I used to install new nodejs in my laptop and it's fine, but now there is error with the installation.\nI'm using the .pkg file which latest nodejs (v 0.10.32)\n\nThe error said :\n\n\"There were errors with the installation. You may want to try i\"\n\n\"The installation failed\"\n\n\"The Installer could not install the software.\"\n\n\"The Installer could not install the software because there was no software found to install\"\n\nIs there is solution with this error ?" ]
[ "node.js", "macos", "osx-mavericks" ]
[ "git add auto-complete filename", "I am working on a git project.\nSince I have a lot of folder deepness, I would like to improve my auto-completion to work with filenames and not only paths.\n\nHere is an example:\n\n$git status 1 ↵ ✹master \nOn branch master\nChanges not staged for commit:\n (use \"git add <file>...\" to update what will be committed)\n (use \"git checkout -- <file>...\" to discard changes in working directory)\n\n modified: app/src/main/java/fr/pasteque/client/BaseFlavor.java\n modified: app/src/main/java/fr/pasteque/client/widgets/RestaurantTicketsAdapter.java\n\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\n\nI obviously have to add a file with:\n\ngit add app/src/main/java/fr/pasteque/client/BaseFlavor.java\n\nBut I would love to be able to write: git add BaseFlavor.java\n\ngit add **/BaseFlavor.java works!\n\nBut the completion, like git add **/Base<tab>, doesn't..\n\nAny ideas how it can works with completion ?\n\nThanks in advance!" ]
[ "git", "zsh", "zshrc", "zsh-completion" ]
[ "Correct way to reopen TCP connection with PHP after remote party closes?", "I'm having issues reopening a TCP socket connection after its remotely closed. Specifically this is for Apple Push Notification service - when Apple encounters a device token from you that pairs with a device that deleted your application they close the secure TCP socket to their push gateway. I need to immediately reopen this connection (or start a new one) when this issue occurs so I can continue sending notification to other users who still do have the app installed. I have some code using which I try to sort this out but it's freezing my entire Apache server and I have to restart manually to get things running again and I have no idea why. Below is the code with which I attempt to reopen a socket with Apple:\n\nif($error_response == \"InvalidToken\"){\n $results .= \"\\ntried to restart\";\n fclose($fp);\n usleep(20000);\n $ctx = stream_context_create();\n stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck_real.pem');\n stream_context_set_option($ctx, 'ssl', 'passphrase', '****');\n $fp = stream_socket_client('ssl://gateway.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx);\n}" ]
[ "php", "ios", "tcp", "apple-push-notifications" ]
[ "Align Textview drawable and text to baseline bottom?", "I have a textView with an image and text, I want to align text with the baseline of the image. I am trying but unable to do this. How can I do this? Thanks in advance. \n\n<TextView\n android:id=\"@+id/date\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_gravity=\"bottom\"\n android:drawablePadding=\"4dp\"\n android:text=\"Hello\"\n android:drawableStart=\"@drawable/date\"\n android:gravity=\"bottom\"\n android:textColor=\"@color/black\"\n android:textSize=\"10sp\" />\n\n\n\n\nI want to text and image like this, they share the same baseline:" ]
[ "android" ]
[ "Checking whether a string contains some characters in python", "I want to check if a string only contains A-Z and a-z and 0-9 and underscore and dash (_ -)\n\nAny other special signs like !\"#\\% should not be contained\n\nHow can I write the regular expression?\n\nand use match or ?\n\nMy strings look like these: QOIWU_W QWLJ2-1" ]
[ "python" ]
[ "SignOutAsync is not working for microsoft authentication in asp.net core 2.1", "I've created a ASP.NET Core MVC application with microsoft authentication. here, I'm using following code to signout the user account.\n\n public async Task<IActionResult> LogoutAsync()\n {\n await _signInManager.SignOutAsync();\n return RedirectToAction(\"Index\", \"Home\");\n }\n\n\nbut, user account still signed in. what's the problem?. Is there any possibilities to signout the account completely including microsoft web sites.\n\nI have already tried following code from thislink\n\npublic async Task LogoutAsync()\n {\n await SignOut(\"Home/Index\");\n }\n\n\n public async Task SignOut(string redirectUri)\n {\n await _signInManager.SignOutAsync();\n await HttpContext.SignOutAsync(\"Cookies\");\n var prop = new AuthenticationProperties()\n {\n RedirectUri = redirectUri\n };\n await HttpContext.SignOutAsync(\"Microsoft\", prop);\n }\n\n\nit still signedin click here to check it." ]
[ "c#", "authentication", "asp.net-core", "asp.net-core-mvc", "asp.net-core-identity" ]
[ "Login Failed for user 'MicrosoftAccount\\xxx'. (Microsoft SQL Server, Error:18456)", "So I'm asking this question the nth time. That is because I didn't still came up with a solution from all the solutions out there.\n\nMy error log reads this:-\n\n2018-06-02 18:32:54.02 Logon Error: 18456, Severity: 14, State: 5.\n2018-06-02 18:32:54.02 Logon Login failed for user 'MicrosoftAccount\\[email protected]'. Reason: Could not find a login matching the name provided. [CLIENT: <local machine>]\n\n\nMy problem is that I don't know where to find this login ID and how to change it. \n\nPS: Already googled a lot. Nothing helpful found. :(" ]
[ "sql", "sql-server" ]
[ "How to write a function (in flutter-dart) so that it accepts certain parameters when we call that function?", "This is my code:\nText ButtonText = Text(\n _buttonText, style: TextStyle(\n color: Colors.white,\n fontFamily: 'San francisco',\n //fontSize: 21.0.ssp,\n letterSpacing: 2.0,\n wordSpacing: 2.0\n),\n);\n\nwhen I use this Text in my button widget, I want to set font size explicitly. How can I do that?" ]
[ "flutter", "dart", "flutter-dependencies" ]
[ "can you help me with this error on my project?", "when click button run...\nin output....\n\njava.lang.OutOfMemoryError\nOpenCV Error: Insufficient memory (Failed to allocate 6220800 bytes) in unknown function, file ..\\..\\..\\src\\opencv\\modules\\core\\src\\alloc.cpp, line 52\nException in thread \"Thread-4\" java.lang.RuntimeException: ..\\..\\..\\src\\opencv\\modules\\core\\src\\alloc.cpp:52: error: (-4) Failed to allocate 6220800 bytes \n at com.googlecode.javacv.cpp.opencv_core.cvCloneImage(Native Method)\n at com.googlecode.javacv.cpp.opencv_core$IplImage.clone(opencv_core.java:521)\n at vidtracking.MainView.backgroundSubtraction(MainView.java:666)\n at vidtracking.MainView.access$1000(MainView.java:32)\n at vidtracking.MainView$8.run(MainView.java:461)" ]
[ "java", "opencv", "netbeans", "javacv" ]
[ "How to close requests.Session()?", "I am trying to close a requests.Session() but its not getting closed.\n\ns = requests.Session()\ns.verify = 'cert.pem'\nres1 = s.get(\"https://<ip>:<port>/<route>\")\ns.close() #Not working\nres2 = s.get(\"https://<ip>:<port>/<route>\") # this is still working which means s.close() didn't work.\n\n\nHow do I close the session? s.close() is not throwing any error also which means it is a valid syntax but I am not understanding what exactly it is doing." ]
[ "python", "session", "https", "get", "python-requests" ]
[ "Displaying int variables on an NSString with [[NSString alloc]initWithString", "I have and NSString called \"health\" and i have an int called \"healthInt\" I m doing this in my Appdelegates because other files have to access it. What i want to do is have the NSString \"health\" be assigned the value of \"healthInt\". That way in another class i can set a label to the NSString \"health\" and have \"healthInt\" be displayed on that label. Here's the code sorry the code isn't pasting properly.\n\nAppdelegate.h\n\n@interface AppDelegate : UIResponder <UIApplicationDelegate>{\nNSString * health;\nint healthInt;\n}\n-(void)take2Damage;\n-(void)tellHealth;\n@property (strong, nonatomic) UIWindow *window;\n@property (strong, nonatomic) ViewController *viewController;\n@property (nonatomic, retain) NSString * health;\n@end\n\nAppdelegate.m\n\n@synthesize health;\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions\n{\n\nhealth = [[NSString alloc]initWithString:@\"%d\", healthInt];\n\n\nBut doing this gives me the error \"Too many arguments to method call, expected 1, have 2\"\n\nI'm an amateur to objective c so try to explain it simply :)\n\nThanks!" ]
[ "iphone", "nsstring", "int" ]
[ "Python:Group By Multiple Column Pandas", "I'm trying to group by a flattened data such as 2 columns group as list & the third one should be the sum of rows of that column .\n\nSuppose data frame looks like \n\nColA ColB ColC ColD\nA Hi Hello 2\nA There You 4\nB Okay Tap 4\nB Bye Here 6\n\n\nI want the output dataframe to look like: \n\nColA ColB ColC ColD\nA [Hi,There] [Hello,You] 6\nB [Okay,Bye] [Tap,Here] 10" ]
[ "python", "pandas", "dataframe", "pandas-groupby" ]
[ "Matching user meta fields with custom post meta fields", "I am trying to create a function that matches user's that have the same expertise as a custom post custom field. So if a custom author meta has an expertise of 'Ninja' and the custom post type has a custom field that also has 'Ninja', my email will go out to all those matching user's.\n\nI have the following bit of wp_mail code and can also create user queries using get_users but cannot get the two to work as i need. Any ideas?\n\nadd_action('future_to_publish', 'send_emails_on_new_event');\nadd_action('new_to_publish', 'send_emails_on_new_event');\nadd_action('draft_to_publish', 'send_emails_on_new_event');\nadd_action('auto-draft_to_publish', 'send_emails_on_new_event');\n\nfunction send_emails_on_new_event($post) {\n global $post;\n $expertise = get_field('expertise', $postid);\n $emails = MATCHING USER EMAIL ADDRESSES TO GO HERE;\n $message = '<p>Email content will go here ...</p>';\n if (get_post_type($post->ID) === 'custom_post_type') {\n wp_mail($emails, \"Email title will go here ...\", $message);\n }\n}" ]
[ "php", "wordpress", "function" ]
[ "Rufus Scheduler not running", "I want to do something simple with the gem rufus-scheduler:\nhttps://github.com/jmettraux/rufus-scheduler\n\nbut, i can't get it to work.\n\nI have a regular rails app. I created a .rb file:\n\n# test_rufus_scheduler.rb\nrequire 'rubygems'\nrequire 'rufus/scheduler'\n\nscheduler = Rufus::Scheduler.start_new\n\nscheduler.in '1s' do\n puts \"hello world\"\nend\n\n\nThen, when I try ruby test_rufus_scheduler.rb, nothing happens. Am i doing it right? gem list shows rufus-scheduler.\n\nThanks." ]
[ "ruby-on-rails", "cron", "rufus-scheduler" ]
[ "VTK Problem at producing a complete opaque volume rendering", "Hello,\nI am currently playing around with VTK and its volume rendering algorithms.\nI want to create a volume where parts are transparent, translucent and some are opaque/solid.\nI tested all unstructured grid volume renderer, but for each of them, I can't get to work a complete opaque result.\nMy Code:\nvtkNew<vtkPiecewiseFunction> opacityTransferFunction; \nopacityTransferFunction->AddPoint(0, 1.0);\nopacityTransferFunction->AddPoint(255, 1.0);\n\nvtkNew<vtkColorTransferFunction> colorTransferFunction;\ncolorTransferFunction->AddRGBPoint(0, 0.0, 0.0, 1.0);\ncolorTransferFunction->AddRGBPoint(255, 1.0, 0.0, 0.0);\n\nvtkNew<vtkVolumeProperty> volumeProperty;\nvolumeProperty->ShadeOff();\nvolumeProperty->SetInterpolationType(0);\nvolumeProperty->SetColor(colorTransferFunction);\nvolumeProperty->SetScalarOpacity(opacityTransferFunction);\n\nvtkNew<vtkOpenGLProjectedTetrahedraMapper> volumeMapper;\n/// Adding a dataset with pointwise scalar array all set to 255\nvolumeMapper->SetInputData(dataset);\n\nvtkNew<vtkVolume> volume;\nvolume->SetProperty(volumeProperty);\nvolume->SetMapper(volumeMapper);\n\nrenderer->AddVolume(volume);\n\nAnd here a screenshot of the problem:-\n\nAs you can see that the opacity of area 1 is higher than of area 2 since there is more material to penetrate. Also, you can see lines up and right next to the label of area 1 which are behind the volume and should not be visible at all.\nI would be glad if you can help me, thanks!" ]
[ "c++", "c++11", "vtk" ]
[ "Onclick toggle class of individual list items icon Angular 4 5 Todo application", "I am battling with this and tried to find solution but failed.\n\nI have this piece of code that list all items from input and I need for check icon to be toggled on and off on click. For now its toggle ALL icons and not individual.\n\n <p *ngFor=\"let task of tasks; let i = index\" class=tasks @fade>\n <span class=\"task\">\n <fa name=\"check\" (click)=\"status=!status\" \n[ngClass]=\"status ? 'check' : 'uncheck'\"></fa>\n{{task}}</span>\n<button class=\"remove\" (click)=\"removeItem(i)\"><fa name=\"trash\" \nclass=\"delete\"></fa></button>\n</p>\n\n\nCSS:\n\n.check{\n color: rgb(81, 255, 0);\n cursor: pointer;\n}\n.uncheck{\n color: red;\n cursor: pointer;\n}\n\n\nAny suggestions would be helpful.\nHave a great day\n\nUPDATE:\n\nFor someone who have similar problem I found workaround. Just place input tag in your list item and style it how you wish. It will work independently for each item." ]
[ "javascript", "angular", "toggle", "ngfor" ]
[ "How to stop build from executing from the pipeline script?", "everyone! Sorry if the question is stupid, I'm just learning how to deal with Jenkins :)\nFor the testing task I'm doing I need to start server, start Tomcat, then perform some actions, after which I need to stop tomcat and server from running to continue with another task. Otherwise, they run forever. That's why I need to kill build job from the same pipeline that started it. Can anyone advise how can I do this? \n\nparallel (\"Start tomcat\" : {\n sleep(10)\n build job: 'tomcat_master'\n\nThanks in advance for your help!" ]
[ "jenkins", "jenkins-pipeline", "qa" ]
[ "Apache .htaccess file redirect", "Should be easy for someone.\n\nMy files are in this directory: /user/home/peter/mygame/production/\n\nI am required to access my site using: www.foo.com/peter (which brings me to /user/home/peter/)\n\nHow do I tell apache:\n\nwww.foo.com/peter reads from /user/home/peter/mygame/production/\n\nThanks." ]
[ "apache", "mod-rewrite" ]
[ "Can I destructure (pattern extract) a Scala list into a reused var?", "I have a Scala list. I can destructure the list into some variables thus:\n\nvar a :: b :: tail = myList\na should be (\"A1\")\nb should be (\"B1\")\ntail should be ('empty)\n\n\nHowever, I do not seem to be able to reuse the same variables for another destructuring:\n\na :: b :: tail = anotherList\na should be (\"A2\")\nb should be (\"B2\")\ntail should be ('empty)\n\n\nThe compiler tells me that it expected a semi-colon but found an equals sign. Why is this? \nIs it impossible to use already-declared variables when destructuring? Am I doing something stupid?" ]
[ "scala", "destructuring" ]
[ "Why are ARFaceAnchor and ARImageAnchor the only anchor types which are conforming to protocol ARTrackable?", "In the documentation of the protocol ARTrackable (https://developer.apple.com/documentation/arkit/artrackable), it says that Conforming Types are: ARFaceAnchor, ARImageAnchor. \n\nIs there a specific reason why these are the only two anchor types conforming to the protocol? Why aren't ARAnchor, ARObjectAnchor and ARPlaneAnchor conforming to ARTrackable?" ]
[ "ios", "arkit" ]
[ "Getting duration and creation date from video from ios library", "I'm trying to select/compress a video from the photo library but when I go to get the duration and creation date, they both are returning null (for duration this defaults to 0.0 sec). I'm not sure if I'm doing something wrong here.\n\n- (void)imagePickerController:(UIImagePickerController *)uploadPick didFinishPickingMediaWithInfo:(NSDictionary *)info {\nNSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];\n\n if (CFStringCompare (( CFStringRef) mediaType, kUTTypeMovie, 0) == kCFCompareEqualTo)\n {\n NSURL *videoURL = [info objectForKey:UIImagePickerControllerMediaURL];\n\n //Video Duration:\n MPMoviePlayerController *mp = [[MPMoviePlayerController alloc]\n initWithContentURL:videoURL];\n\n VideoTime.text = [NSString stringWithFormat:@\"Time: %.2f\", mp.duration];\n\n //Video Creation Date\n NSDictionary *metadataDictionary = (NSDictionary *)[info valueForKey:UIImagePickerControllerMediaMetadata];\n NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];\n [dateFormatter setDateStyle:NSDateFormatterMediumStyle];\n NSString *stringDate = [dateFormatter stringFromDate:metadataDictionary.fileCreationDate];\n [dateFormatter release];\n VideoDateTaken.text = [NSString stringWithFormat:@\"Date Taken: %@\", stringDate];\n\n }\n}" ]
[ "ios", "objective-c", "cocoa-touch", "video" ]
[ "how to isolate html element from being affected by multiple css files", "I have a chrome extention that inserts HTML code into a webpage, but its design gets affected by the host webpage's css.\njs\nvar button = document.createElement("button ");\nbutton.id = "btn_btn_btn";\nbutton.innerText = "pres button";\n\ndocument.getElementsByTagName("html")[0].prepend(button);\n\ncss\n#btn_btn_btn{\n background-color: rgb(229, 97, 97) !important;\n border: none !important;\n height: 100px !important;\n color: white !important;\n font-size: 15px !important;\n text-align: center !important;\n}\n\nis there a way of having it only be affected by my css file without adding important to every attribute an element can have." ]
[ "javascript", "html", "css", "google-chrome-extension" ]
[ "SQL query base on field of migration time", "Table\n\nThe Data Structure such as the following:\n\n\n[Table] Members, including member profile\n[Table] Departments, including department for member\n[Table] Migrate, Record Member migration between department\n\n\nSchema\n\n\nMembers\n\nid (int)\nname (char)\n\nDepartments\n\nid (int)\nname (char)\n\nMigrate\n\nid (int)\nmember_id (int)\ndepartment_id (int)\nupdate_time (datetime) - Default: CURRENT_DATETIME\n\n\n\nData Examples\n\n\nMembers\n\n1, Tom\n2, Gary\n\nDepartment\n\n1, A\n2, B\n\nMigrate\n\n1, 1, 1, 2013-05-01 00:00:00 (New Member in Department A joined on 2013/05/01)\n2, 2, 1, 2013-05-02 00:00:00 (New Member in Department A joined on 2013/05/02)\n3, 1, 2, 2013-05-08 00:00:00 (Migrate to Department B)\n\n\n\nQuestion\n\nWhen a member created, I insert a row to Migrate table with inserted time.\n\nI can query by:\n\nSELECT name \nFROM department WHERE id = (SELECT Top 1 department_id \n FROM Migrate\n WHERE update_time <= GETDATE() \n ORDER BY update_time DESC)\n\n\ngetting user department name.\n\nAnd if member migrate from department A to department B, I will insert a new row to record with department B id and migrating time (that now).\n\nBut the question is how could I get the department's member list at a specific time like '2013-05-01' \n\nI need a SQL Server solution, thanks for your read." ]
[ "sql", "sql-server", "database", "database-schema" ]
[ "ObjC parsing a xml and stock values in NSArray", "I have a problem with a xlm reader. I have some currency rider I'd like to stock in a array but ther's something wrong in my code.\n\nHere is the feed I'd like to read:\nhttp://www.ecb.int/stats/eurofxref/eurofxref-daily.xml\n\nThe error is in\n\nheader file\n\n@class Convertisseur;\n\n\n@interface Convertisseur1ViewController : \n UIViewController <UITextFieldDelegate>{\n\n IBOutlet UILabel *usd;\n IBOutlet UILabel *euro;\n Convertisseur *convertisseur;\n\n\n // parser XML\n NSXMLParser *rssParser;\n // elenco degli elementi letti dal feed\n NSMutableArray *elencoFeed;\n\n //variabile temporanea pe ogni elemento\n NSMutableDictionary *item;\n\n // valori dei campi letti dal feed\n NSString *currentElement;\n NSMutableString *currentCube;\n\n NSArray *currency;\n}\n\n\n//Dichiarazion del parser\n - (void)parseXMLFileAtURL:(NSString *)URL;\n@end\n\n\nImplementation file\n\n#import \"Convertisseur1ViewController.h\"\n#import \"Convertisseur.h\"\n\n@implementation Convertisseur1ViewController\n\n\n\n\n- (void)parseXMLFileAtURL:(NSString *)URL {\n // inizializziamo la lista degli elementi\n elencoFeed = [[NSMutableArray alloc] init];\n\n // dobbiamo convertire la stringa \"URL\" in un elemento \"NSURL\"\n NSURL *xmlURL = [NSURL URLWithString:URL];\n\n // inizializziamo il nostro parser XML\n rssParser = [[NSXMLParser alloc] initWithContentsOfURL:xmlURL];\n\n [rssParser setDelegate:self];\n\n // settiamo alcune proprietà\n [rssParser setShouldProcessNamespaces:NO];\n [rssParser setShouldReportNamespacePrefixes:NO];\n [rssParser setShouldResolveExternalEntities:NO];\n\n // avviamo il parsing del feed RSS\n [rssParser parse];\n}\n\n\n\n\n- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict{ \n\n currentElement = [elementName copy];\n if ([elementName isEqualToString:@\"item\"]) {\n // inizializza tutti gli elementi\n item = [[NSMutableDictionary alloc] init];\n currentCube = [[NSMutableString alloc] init];\n }\n}\n\n- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{ \n\n if ([elementName isEqualToString:@\"Cube\"]) {\n /* salva tutte le proprietà del feed letto nell'elemento \"item\", per\n poi inserirlo nell'array \"elencoFeed\" */\n [item setObject:currentCube forKey:@\"Cube\"];\n\n [elencoFeed addObject:[item copy]];\n }\n}\n\n\n\n\n- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{;\n // salva i caratteri per l'elemento corrente\n if ([currentElement isEqualToString:@\"Cube\"]){\n [currentCube appendString:string];\n }\n}\n\n\n\n\n\n\n- (void) parserDidEndDocument:(NSXMLParser *)parser {\n\n\n for(int i=1;i<[elencoFeed count];i++) {\n\n [currency setvalue:[[elencoFeed Objectatindex:i] valueforkey:@\"rate\"] forkey:[[elencoFeed Objectatindex:i] valueforkey:@\"currency\"]];\n //currency[i]= [elencoFeed Objectatindex:i] valueforkey:@\"rate\"] forkey:[[elencoFeed Objectatindex:i] valueforkey:@\"currency\"];\n\n }\n\n}\n\n\n\n - (void)viewDidLoad {\n [super viewDidLoad];\n convertisseur = [[Convertisseur alloc] init];\n\n\n self.title = @\"Convertisseur\";\n\n NSString *path = @\"http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml\";\n [self parseXMLFileAtURL:path];\n euro.text = currency.text;\n }\n\n\n\n- (void)viewDidUnload {\n // Release any retained subviews of the main view.\n // e.g. self.myOutlet = nil;\n self.labelEuro = nil;\n self.labelDollar = nil;\n self.convertisseur = nil;\n\n }\n\n\n\n- (void)dealloc {\n [super dealloc];\n}\n\n\nI have a warning here:\n\n [currency setvalue:[[elencoFeed Objectatindex:i] valueforkey:@\"rate\"] forkey:[[elencoFeed Objectatindex:i] valueforkey:@\"currency\"]];\n\n\nNSMutable array may not respond to '-objectindex'\n\nAnd an error here:\n\neuro.text = currency.text;\n\n\nRequest for member 'text' in something not a structure or union (currency is an array and euro a label)" ]
[ "iphone", "objective-c", "xml", "arrays", "nsarray" ]
[ "How to move value from the stack to ST(0)?", "I am having trouble believing the following code is the most efficient way to move a value from the stack to ST(0):\n\n.data\nvar dd 4.2\ntmp dd ?\n\n.code\nmov EAX, var\npush EAX\n; top of stack now contains a value\n\n; move it to ST(0)\npop EAX\nmov tmp, EAX\nfld tmp\n\n\nIs the temporary variable really necessary? Further, is there an easier way to get a value from the stack to ST(0)?\n\nUpdate: In the example above, I'm moving floating-point values around - not integers." ]
[ "assembly", "floating-point", "x86" ]
[ "Crash while making call in pjsip-2.6 in iphone", "I have successfully compiled pjsip for all the architectures and able to register sip. But when i try to make call using pjsua_call_make_call then app is crashing. \n\nBelow the method which i am using to make call.\n\n- (void)makeCallTo:(char*)destUri\n{\n pj_status_t status;\n pj_str_t uri = pj_str(destUri);\n\n status = pjsua_verify_sip_url(destUri);\n if (status != PJ_SUCCESS)\n {\n PJ_LOG(1,(THIS_FILE, \"Invalid URL \\\"%s\\\".\", uri));\n pjsua_perror(THIS_FILE, \"Invalid URL\", status);\n return;\n }\n\n status = pjsua_call_make_call(_acc_id, &uri, 0, NULL, NULL, NULL);\n if (status != PJ_SUCCESS) {\n error_exit(\"Error making call\", status);\n }\n}\n\n\nBelow is the sip trace,\n\n13:15:21.513 pjsua_call.c !Making call with acc #0 to sip:[email protected]\n13:15:21.513 pjsua_aud.c .Set sound device: capture=-1, playback=-2\n13:15:21.513 pjsua_aud.c ..Opening sound device (speaker + mic) PCM@16000/1/20ms\n13:15:21.514 coreaudio_dev. ...Using VoiceProcessingIO audio unit\n13:15:23.655 coreaudio_dev. !...core audio stream started\n13:15:23.656 pjsua_media.c .Call 0: initializing media..\n13:15:23.656 pjsua_media.c ..RTP socket reachable at 192.168.0.103:4000\n13:15:23.656 pjsua_media.c ..RTCP socket reachable at 192.168.0.103:4001\n13:15:23.657 pjsua_media.c ..RTP socket reachable at 192.168.0.103:4002\n13:15:23.657 pjsua_media.c ..RTCP socket reachable at 192.168.0.103:4003\n13:15:23.657 pjsua_media.c ..Media index 0 selected for audio call 0\nAssertion failed: ((status=pjmedia_sdp_validate(local))==PJ_SUCCESS), function pjmedia_sdp_neg_create_w_local_offer, file ../src/pjmedia/sdp_neg.c, line 111.\n\n\nAny help will be very appreciated!" ]
[ "ios", "iphone", "sip", "voip", "pjsip" ]
[ "How to add a baseline and written values next to the bars in a bar chart", "I am trying to work out how to add a physical baseline at 0 in my bar chart, and how to write P values to the right of each of my bars.\nHere is my code so far:\nimport pandas as pd\nimport matplotlib.pyplot as plot\n\nFirstandtotalorder = {"First order indices": [0.081, -0.05, 1.11],\n "Total order indices":[0.013, 0.047, 1.212]};\n\nindex = ["BOD1", "BOD2", "BOD3"];\n\ndataFrame = pd.DataFrame(data = Firstandtotalorder);\n\ndataFrame.index = index;\n\ndataFrame.plot.barh(rot=15, title="First and total order sobol indices", xlim = -0.2);\n\nplot.show(block=True); \n\nPlot requiring further formatting\nP values for First order indices = 0.01, 0.02, 0.03 (for example)\nP values for Total order indices = 0.04, 0.05, 0.06 (for example)\nAny guidance is much appreciated." ]
[ "python", "pandas", "matplotlib" ]
[ "pagination query returns nothing", "my query is like this,but it returns nothing\n@value0,@value1,@value2,@value3,@field0 changable fields they could be null value or a value depends on the parameters coming from form.\nfor example when I put these values ,it return nothing\n@page = 1,@size = 20,@sort = N'Id',@ts = N'DESC',@field0 = N'Name',@value2 = N'2000-1-1',@value3=null,@value1=null,@value0=null\nam I doing something wrong?\n\n @page INT,\n @size INT,@sort nvarchar(50) ,\n @ts nvarchar(50) ,\n @totalrow INT OUTPUT,\n @value0 nvarchar(50),\n @value1 nvarchar(50),\n @value2 nvarchar(50),\n @value3 nvarchar(50),\n @field0 nvarchar(50)\n\n AS\n BEGIN\n DECLARE @offset INT\n DECLARE @newsize INT\n DECLARE @sql NVARCHAR(MAX)\n\n\n IF(@page=0)\n begin\n SET @offset = @page;\n SET @newsize = @size\n end\n ELSE \n begin\n SET @offset = @page+1;\n SET @newsize = @size-1\n end\n\n SET NOCOUNT ON;\n SET @sql = '\n WITH OrderedSet AS\n (\n SELECT Ks.Id,c.Name,c.CId,Ks.RegisterDate,ROW_NUMBER() \n OVER (ORDER BY ' + @sort + ' '+@ts+') AS ''Index''\n FROM Ks LEFT OUTER JOIN Car c On c.CId=Ks.CId WHERE \n AND (Ks.RegisterDate >'''+@value2+''' OR '''+@value2+''' IS NULL)\n AND (Ks.RegisterDate <'''+@value3+''' OR '''+@value3+''' IS NULL)\n AND (Ks.RegisterDate ='''+@value1+''' OR '''+@value1+''' IS NULL)\n AND ('+@field0+' LIKE ''%'+@value0+'%'' OR @value0 IS NULL)\n )\n SELECT * FROM OrderedSet WHERE [Index] BETWEEN ' + \nCONVERT(NVARCHAR(12), @offset) + ' AND ' + CONVERT(NVARCHAR(12), (@offset + @newsize))\n\n EXECUTE (@sql)\n\n SET @totalrow = (SELECT COUNT(*) FROM [dbo].[Ks])\n print @sql" ]
[ "sql", "tsql" ]
[ "Using a class in a header file without access to its definition?", "This is excerpt from google's c++ coding guidelines.\n\n\n How can we use a class Foo in a header\n file without access to its definition?\n \n \n We can declare data members of type Foo* or Foo&. \n We can declare (but not define) functions with arguments, and/or\n return values, of type Foo. (One\n exception is if an argument Foo or\n const Foo& has a non-explicit,\n one-argument constructor, in which\n case we need the full definition to\n support automatic type conversion.)\n We can declare static data members of type Foo. This is because static\n data members are defined outside the\n class definition.\n \n\n\nWhat I'm curious about is exception in the second bullet. Why is this so? Why is the full definition needed if we want to support automatic type conversion?\n\nMy guess is that compiler needs the full definition of the destination type because of the temporary object that is created in the implicit conversion. Am I guessing correctly? Is there more to it?\n\nEDIT:\n\nAs I see it, the exception in the guideline is addressed to situation like this:\n\nclass A\n{\n public:\n A( int );\n};\n\nclass B\n{\n public:\n B( A const &a );\n};\n\nint main()\n{\n B b(2);\n}\n\n\nHere we have only one user-defined implicit conversion (from int to A), and call to constructor that accepts A const &. Only thing that makes sense in this exception is to support direct conversion from e.g. int to A, and then to B via constructor that accepts A const &, allowing client code to use this conversion chain without need to explicitly include header file where A class is declared." ]
[ "c++", "implicit-conversion", "google-style-guide" ]
[ "how to perform subplot in loop for seaborn charts", "I have code that generates four subplots, but i want to generate those charts through loops , Currently i am following this piece of code to generate the chart\nCode:\n\nplt.figure(figsize=(20, 12))\nplt.subplot(221)\nsns.barplot(x = 'Category', y = 'POG_Added', data = df)\nxticks(rotation = 90)\nplt.xticks(size = 11)\nplt.yticks(size = 11)\nplt.xlabel(\"Category\",size = 13)\nplt.ylabel(\"POG_Added\",size = 13)\n\nplt.subplot(222)\nsns.barplot(x = 'Category', y = 'Live_POG', data = df)\nxticks(rotation = 90)\nplt.xticks(size = 11)\nplt.yticks(size = 11)\nplt.xlabel(\"Category\",size = 13)\nplt.ylabel(\"Live_POG\",size = 13)\n\nplt.subplot(223)\nsns.lineplot(x = 'Category', y = 'D01_CVR', data = df)\n#sns.barplot(x = 'Category', y = 'D2-08-Visits', data = df,label='D2-08_Visits')\nxticks(rotation = 90)\nplt.xticks(size = 11)\nplt.yticks(size = 11)\nplt.xlabel(\"Category\",size = 13)\nplt.ylabel(\"D01_CVR\",size = 13)\n\nplt.subplot(224)\n\nplt.xticks(rotation='vertical')\nax = sns.barplot(x='Category',y='D2-08-Units',data=df)\nax2 = ax.twinx()\nax2.plot(ax.get_xticks(), df[\"D01_CVR\"], alpha = .75, color = 'r')\n\nplt.subplots_adjust(hspace=0.55,wspace=0.55)\nplt.show()" ]
[ "python", "loops", "graph", "seaborn" ]
[ "How to get this Python method to return a string instead of writing it to stdout?", "I'm trying to extract text out of a pdf using Python. For this I found pdfminer, which does a fairly good job, using the pdf2txt.py command line tool as follows:\n\nkramer65 $ pdf2txt.py myfile.pdf\nall the text contents\nof the pdf\nare printed out here..\n\n\nBecause I want to use this functionality in my program, I want to use this as a module rather than a command line tool. So I managed to adjust the pdf2txt.py file to the following:\n\n#!/usr/bin/env python\nimport sys\nfrom pdfminer.pdfdocument import PDFDocument\nfrom pdfminer.pdfparser import PDFParser\nfrom pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter\nfrom pdfminer.pdfpage import PDFPage\nfrom pdfminer.converter import TextConverter\nfrom pdfminer.cmapdb import CMapDB\nfrom pdfminer.layout import LAParams\n\ndef main(fp):\n debug = 0\n pagenos = set()\n maxpages = 0\n imagewriter = None\n codec = 'utf-8'\n caching = True\n laparams = LAParams()\n\n PDFDocument.debug = debug\n PDFParser.debug = debug\n CMapDB.debug = debug\n PDFPageInterpreter.debug = debug\n\n resourceManager = PDFResourceManager(caching=caching)\n outfp = sys.stdout\n device = TextConverter(resourceManager, outfp, codec=codec, laparams=laparams, imagewriter=imagewriter)\n interpreter = PDFPageInterpreter(resourceManager, device)\n for page in PDFPage.get_pages(fp, pagenos, maxpages=maxpages, caching=caching, check_extractable=True):\n interpreter.process_page(page)\n fp.close()\n device.close()\n outfp.close()\n return # Here I want to return the extracted text string\n\n\nI can now call it as a module as follows:\n\n>>> from my_pdf2txt import main\n>>> main(open('myfile.pdf', 'rb'))\nall the text contents\nof the pdf\nare printed out here..\n\n\nIt currently prints out the resulting strings using sys.stdout.write(), but I actually want it to return those strings using the return statement on the last line of my code. But since the use of that sys.stdout.write is hidden deep on lines 165-167 in converter.py, I don't really know how to get this method to return those strings instead of writing it to stdout.\n\nDoes anybody know how I could get this method to return the found strings instead of writing them to stdout? All tips are welcome!" ]
[ "python", "pdf", "return", "stdout", "pdfminer" ]
[ "Why can't I use an alias used in a subquery in a where clause in a select clause in mysql?", "For example, there is below.\nSELECT cost, min_cost \nFROM item WHERE item.cost > (SELECT MIN(cost) FROM item) AS min_cost;\n\nWhat was wrong with this?\nI'm curious what's wrong with grammar.\nAlias can't allowed at where clause?" ]
[ "mysql" ]
[ "How do I set the caret/cursor position on a specific contenteditable div?", "I need another function that calls window.getSelection() so this needs to return an appropriate value based on the cursor position in the CED" ]
[ "javascript" ]
[ "Optimisation for a brainfuck interpreter", "As an exercise to help me learn about interpreters and optimisation, neither of which I know anything about, I have written a brainfuck interpreter in C. It appears to work flawlessly thus far, though it does not compete well in execution speed compared to other fast interpreters.\n\nWhat are some ways that I can change this interpreter to improve performance (or otherwise)?\n\nOne interesting aspect of my interpreter (though most others probably do this as well) is that I run one loop that reads through the source input and converts each instruction into a\n\nstruct { long instruction; long loop; }\n\n\nThe loop value is the index of the matching ] instruction, if the instruction is a [, and the index of the matching [ instruction, if the instruction is a ], allowing quick jumping. I'd imagine that this 'parsing' process (which doesn't take long) improves execution times over doing redundant reparsing to find matching square brackets every time they are needed.\n\nAn interesting test of brainfuck interpreter speed is this program:\n\n++++++++[->-[->-[->-[-]<]<]<]>++++++++[<++++++++++>-]<[>+>+<<-]>-.>-----.>\n\n\n\nthe first version of the interpreter\nthe interpreter after implementing Jerry Coffin's answer, which removes the giant switch in the runtime loop, by making the instruction struct's instruction a direct pointer to an operation function - this runs slower than the previous version (function call overhead?)\nthe interpreter after reversing the previous change and adding an optimisation to 'collapse' multiple consecutive non-loop operations, reducing loop cycles - this runs slightly faster than the original" ]
[ "c", "optimization", "interpreter", "brainfuck" ]
[ "Can't upload photo using paper clip", "I used paper clip in my web application, I use this to make a new product:\n\n<% semantic_form_for @product do |f| %> \n <% f.inputs do %> \n <%= f.input :title %> \n <%= f.input :price %> \n <%= f.file_field :photo %>\n\n\n <%= f.input :category , :include_blank => false %> \n <% end %> \n <%= f.buttons %> \n<% end %>\n\n\nAnd this to show product:\n\n<% semantic_form_for @product do |f| %> \n<%= image_tag @product.photo.url%>\n\n <% f.inputs do %> \n <%= f.input :title %> \n <%= f.input :price %> \n <%= f.file_field :photo %>\n\n <%= f.input :category , :include_blank => false %> \n <% end %> \n <%= f.buttons %> \n<% end %>\n\n\nAnd his is my product.rb:\n\nclass Product < ActiveRecord::Base\n validates_presence_of :title, :price\n validates_numericality_of :price\n validates_uniqueness_of :title\n\n has_attached_file :photo\n attr_accessible :name, :category_id, :price, :title, :photo\n belongs_to :category\n has_many :order_items\n\nend\n\n\nBut after I upload the photo, it show my image path like this :\n\n\n http://localhost:3000/photos/original/missing.png\n\n\nIt seems that it can't upload the photo with this error:\n\n\nNo route matches \"/photos/original/missing.png\" with\n\n \n {:method=>:get}" ]
[ "ruby-on-rails", "ruby", "upload", "file-upload" ]
[ "Filter for column value if another column contains a value", "Essentially I would like to filter a column if another column contains a value. Here is an example:\n\nmy_df <- data.frame(x = c(1,1,1,2,2,2),\n y = c(1,2,3,4,5,6)) \n> my_df\n x y\n1 1 1\n2 1 2\n3 1 3\n4 2 4\n5 2 5\n6 2 6\n\n\nLet's filter x!=1 if and only if y!=1. Here is my expected result:\n\n x y\n1 1 1\n2 2 4\n3 2 5\n4 2 6" ]
[ "r", "filter", "dplyr", "conditional-statements" ]
[ "Proper use of context within inner class when using openFileOutput?", "I am trying to adapt the Android BluetoothChat example to save the InputStream to file using openFileOutput from within the BluetoothChatService class. When using the Environment.getExternalStorageDirectory and saving to the sdcard using filewriter there is no problem, but using the openFileOutput method with MODE_PRIVATE returns a nullPointerException as mentioned in several other questions/answers. I cant for the life of me figure out the correct way to get the correct context. \n\n private class ConnectedThread extends Thread {\n private final BluetoothSocket mmSocket;\n private final InputStream mmInStream;\n private final OutputStream mmOutStream;\n private Context mContext;\n\n public ConnectedThread(BluetoothSocket socket) {\n Log.d(TAG, \"create ConnectedThread\");\n mmSocket = socket;\n InputStream tmpIn = null;\n OutputStream tmpOut = null;\n\n // Get the BluetoothSocket input and output streams\n try {\n tmpIn = socket.getInputStream();\n tmpOut = socket.getOutputStream();\n } catch (IOException e) {\n Log.e(TAG, \"temp sockets not created\", e);\n }\n\n mmInStream = tmpIn;\n mmOutStream = tmpOut;\n }\n\n public void run() {\n Log.i(TAG, \"BEGIN mConnectedThread\");\n byte[] buffer = new byte[1024];\n int bytes;\n\n // Keep listening to the InputStream while connected\n while (true) {\n try {\n // Read from the InputStream\n bytes = mmInStream.read(buffer);\n // Save to file\n String FILENAME = \"chat.txt\";\n\n FileOutputStream fos = mContext.openFileOutput(FILENAME, Context.MODE_PRIVATE);\n fos.write(bytes);\n fos.close();\n // Send the obtained bytes to the UI Activity\n mHandler.obtainMessage(BluetoothChat.MESSAGE_READ, bytes, -1, buffer)\n .sendToTarget();\n } catch (IOException e) {\n Log.e(TAG, \"disconnected\", e);\n connectionLost();\n break;\n }\n }\n }" ]
[ "java", "android", "inner-classes", "android-context" ]
[ "How do I group this list of dicts by the same month? (A follow-up)", "I just asked a very similar question here and both answers worked. However, when I have > 2 dictionary keys in each dictionary, the value of the 3rd key always comes up as 0. For instance:\n\nmyList = [{'date':'2008-04-23','value':'1','value2':'2'}, {'date':'2008-04-01','value':'8','value2':'5'}, {'date':'2008-04-05','value':'3','value2':'4'}, {'date':'2009-04-19','value':'5','value2':'1'}, {'date':'2009-04-21','value':'8','value2':'1'},{'date':'2010-09-09','value':'3','value2':'1'},\n {'date':'2010-09-10','value':'4','value2':'9'},\n ]\n\n\na modified version of mgilson's answer:\n\nimport itertools\nfrom itertools import groupby\nmyList.sort(key=lambda x:x['date'][:7])\nfor k,v in groupby(myList,key=lambda x:x['date'][:7]):\n print k, list(v)\nfor k,v in groupby(myList,key=lambda x:x['date'][:7]):\n print {'date':k+'-01','value':sum(int(d['value']) for d in v),'value2':sum(int(d['value2']) for d in v)}\n\n\nresult:\n\n{'date': '2008-04-01', 'value2': 0, 'value': 12}\n{'date': '2009-04-01', 'value2': 0, 'value': 13}\n{'date': '2010-09-01', 'value2': 0, 'value': 7}\n\n\nA modified version of Pavel's answer:\n\nimport itertools\nkey = lambda datum: datum['date'].rsplit('-', 1)[0]\nmyList.sort(key=key)\nresult = [{\n 'date': key + '-01',\n 'value': sum(int(item['value']) for item in group),\n 'value2': sum(int(item['value2']) for item in group)\n } for key, group in itertools.groupby(myList, key=key)]\n\nprint result\n\n\nresult:\n\n[{'date': '2008-04-01', 'value2': 0, 'value': 12}, {'date': '2009-04-01', 'value2': 0, 'value': 13}, {'date': '2010-09-01', 'value2': 0, 'value': 7}]\n\n\nWhere am I going wrong here?" ]
[ "python" ]
[ "Program keeps failing bc of list index out of range error", "I am doing an assignment for school and I keep failing. I think my solution mostly makes sense but the code has a problem that I don't know how to fix. \n\nThe problem is the following: \n\n\nWrite a function modify_column(m, i, l) that takes three arguments: a matrix m, an index i and a list l. \nThe function should replace values in the i-th column of the matrix by values from the list l. \n\n\nMy idea is the following: First pop all the excess elements of l so two lists are the same length. \nThen, while l is non empty, iterate through matrix m and then take the i-th element of each row and change it into the first element of the list l and then pop the first element off the list l.\n\nCode: \n\nmy_matrix = [\n[ 5, 4, 6, -3],\n[ 4, 7, 10, 9],\n[12, 6, 11, 5],\n[ 2, -2, 1, 3],\n[ 1, 7, -1, 5], \n]\ndef modify_column(m, i, l):\n if len(l) >= len(m): \n while len(l) != len(m) :\n l.pop()\n print(l)\n while l != []:\n for el in m: \n el[i] = l[0]\n l.pop(0)\n return m\nprint(modify_column(my_matrix, 2, [2, -5, 6]))\n\n\nIt keeps returning this error: \n\nprint(modify_column(my_matrix, 2, [2, -5, 6]))\nFile \"/home/tdota/Desktop/Faks/CS_1/MyScripts/manipulating_matrices.py\", line 35, in modify_column\nel[i] = l[0]\nIndexError: list index out of range\n\n\nWhat am I doing wrong?" ]
[ "python", "list", "matrix" ]
[ ".NET Remoting threading", "I have a class which inherits from MarshalByRef on which I make several calls. What I require is some sort of thread affinity for all calls to the object. That is to say every method which I call from my client is marshalled to the same thread on the \"server\" side. Does anyone know how or indeed if I could achieve this using .NET remoting, or would a more custom approach be required." ]
[ ".net", ".net-remoting" ]
[ "define routes for directories in public laravel folder", "I have a directory named fileManager in public laravel folder. now I want to control access it via middlewares So that unsign or not logged users can not access it directly.\n\nBy Default any user can type name of directory in browser and navigate to it.\nI want to able to define a route like this that can apply and authentication middleware : \n\nRoute::get('/fileManager', ['middleware' => 'auth', function () {\n //\n}]);\n\n\nThis is not only, I have many directories in public folder that maybe I want to control users access to those. \n\nHow Can I do that ?" ]
[ "php", "laravel" ]
[ "How to find if my codebase is upto date?", "We have svn repository with a structure like\n\n-- trunk\n|\n-- tags\n |\n - 4.0.0\n |\n - 4.0.1\n |\n - 4.0.2\n |\n - 4.0.2b\n\n\nNow if I go to production site into a directory with the tag 4.0.2b and do svn info I get what you can see below. What I understood is that the revision numbers (Revision: 13107 and Last Changed Rev: 13104) are different because somebody committed something somewhere.\n\nMy question is how can I know that the 4.0.2b is upto date = tag with the latest code? Can I find out without doing svn up?\n\nURL: svn+ssh://[email protected]/sever/lib/svne2/edumate2/tags/4.0.2b\nRepository Root: svn+ssh://[email protected]/var/lib/svne2/edumate2\nRepository UUID: edccd8aa-08f3-0310-ac9a-cddb71435de8\nRevision: 13107\nNode Kind: directory\nSchedule: normal\nLast Changed Author: kon\nLast Changed Rev: 13104\nLast Changed Date: 2012-02-17 13:31:43 +1100 (Fri, 17 Feb 2012)\n\n\nNOTE:\nWe commit to tags quick fix of bugs." ]
[ "svn", "version-control" ]
[ "Closure Compiler: How to separate and control compilation/minification passes?", "The Google Closure Compiler is a powerful compiler and minifier for JS, which gives a lot of optimization options such as renaming variables, removing dead codes, collapsing variable declarations, rewriting control flow structures and etc.\n\nWhat I want is to separately apply one or some of these optimizations on an input JS program. For example, I may want to rename variables with short names, but not to remove dead codes. How can I achieve this kind of detailed compilation pass control? Does the source code of CC expose specific interfaces to do this customization, or I should write my own pass(If so, how am I supposed to start?).\n\nThe command line features do offer several options for controlling the compilation, but are insufficient to fit what I want above. Since the source code is kinda complicated and few detailed design documentation can be found, I am truly stuck here. Any insights would be appreciated, thanks :)" ]
[ "javascript", "obfuscation", "compiler-optimization", "google-closure-compiler", "deobfuscation" ]
[ "VB6 CreateObject and IsReference to C#.Net", "I am trying to recreate this existing VB6 program on C# winforms. I got 90% done but stuck here with creating Object and referencing section. All this sub is doing is load the program according to the given file location.\nI read few post related to VB6 to C# CreateObject equivalent functions and etc but I am not sure how to approach to this, any help would be appreciated. All i am trying to do is convert this sub to C#\n\nPublic Sub Send(str As String)\n\n Dim RTB As Object\n Dim RTBData As Object\n Dim strNewprogram As String\n Dim Results As Short\n Dim Count As Short\n RTB = CreateObject(\"RTB.Comm\", \"10.15.1.81\") \n If IsReference(RTB) Then\n\n Label1.Text = RTBData.ToString()\n strNewprogram = \"N:\\RBT\\Program\\xx\" & str & \".pgm\"\n Results = RTB.getvalue(7) \n Do While Results <> 0 And Count < 5\n Results = RTB.setvalue(2, 0) \n Thread.Sleep(20)\n If Results = 1 Then \n MsgBox(\"Cycle Stop Attempt\")\n End If\n If Results = 5 \n MsgBox(\"Cycle Stop failed\")\n End If\n Results = RTB.getvalue(7) \n Count = Count + 1\n end if\n Loop\n If Count < 5 Then\n Results = RTB.setvalue(0, strNewprogram) \n If Results = 1 Then \n MsgBox(\"Load Program attempted \")\n End If\n If Results = 2 Then \n MsgBox(\"File not found\")\n End If\n If Results = 3 Then \n MsgBox(\"Program error\")\n End If\n If Results = 4 Then\n MsgBox(\"Cycle is Active \")\n End If\n Results = RTB.setvalue(1, 0)\n If Results = 1 Then \n MsgBox(\"Cycle Start \")\n End If\n If Results = 8 Then \n MsgBox(\"Stroke mode \")\n End If\n If Results = 3 Then \n MsgBox(\"Program error\")\n End If\n If Results = 4 Then \n MsgBox(\"Cycle is Active\")\n End If\n Results = RTB.getvalue(7) \n Count = 0\n Do While Results <> 1 And Count < 5 \n Thread.Sleep(20)\n Results = RTB.getvalue(7)\n Count = Count + 1\n Loop\n If Results <> 1 Then\n MsgBox(\"Cycle is Idle \")\n\n End If\n Else\n MsgBox(\"Cycle Stop failed \")\n\n End If\n Else\n MsgBox(\"Communication failed\")\n\n End If\n\n End Sub" ]
[ "c#", "winforms", "vb6", "vb6-migration", "createobject" ]
[ "Circle and line intersecting points", "I'm trying to find the intersecting points where a straight line and a circle intersect. But it is not working for me. Please see the image.\n\n\n\nThe other two small circles in the image are where I should get the intersecting points. Following is my Function to calculate intersection. \n\nPrivate Function FindLineCircleIntersections(ByVal cx As Single, ByVal cy As Single, ByVal radius As Single, ByVal x1 As Single, ByVal y1 As Single, ByVal x2 As Single, ByVal y2 As Single) As Integer\n Dim dx As Single\n Dim dy As Single\n Dim A As Single\n Dim B As Single\n Dim C As Single\n Dim det As Single\n Dim t As Single\n Dim ix1, iy1, ix2, iy2 As Single\n\n dx = x2 - x1\n dy = y2 - y1\n\n A = dx * dx + dy * dy\n B = 2 * (dx * (x1 - cx) + dy * (y1 - cy))\n C = (x1 - cx) * (x1 - cx) + (y1 - cy) * (y1 - cy) - _\n radius * radius\n\n det = B * B - 4 * A * C\n If (A <= 0.0000001) Or (det < 0) Then\n MsgBox(\"No intersection\")\n ElseIf det = 0 Then\n ' One solution.\n t = -B / (2 * A)\n ix1 = x1 + t * dx\n iy1 = y1 + t * dy\n Graphics.FromImage(PictureBox1.Image).FillRectangle(Brushes.Red, ix1 - 2, iy1 - 2, 4, 4)\n Else\n ' Two solutions.\n t = (-B + Sqrt(det)) / (2 * A)\n ix1 = x1 + t * dx\n iy1 = y1 + t * dy\n t = (-B - Sqrt(det)) / (2 * A)\n ix2 = x1 + t * dx\n iy2 = y1 + t * dy\n Graphics.FromImage(PictureBox1.Image).FillRectangle(Brushes.Red, ix1 - 2, iy1 - 2, 4, 4)\n Graphics.FromImage(PictureBox1.Image).FillRectangle(Brushes.Blue, ix2 - 2, iy2 - 2, 4, 4)\n End If\n End Function" ]
[ "vb.net", "vb.net-2010", "intersection" ]
[ "How to modify a function in local R package?", "I have an R package made by someone else. I want to add an additional function to it, how can I do that?" ]
[ "r", "package" ]
[ "iPhone refresh a view from another class", "I want to be able to refresh a view from another class, but nothing I have tried is working. My application is a tabbed application with several tabs set up. I have a method called refresh in my ViewController1 class that looks like this\n\n-(void)TestMe{\n\n\n NSString *filePath = [[NSBundle mainBundle] pathForResource:@\"widgjson\" ofType:@\"json\"]; \n NSData *myData = [NSData dataWithContentsOfFile:filePath]; \n\n NSString *responseString = [[NSString alloc] initWithData:myData encoding:NSUTF8StringEncoding];\n\n NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);\n NSString *docDir = [paths objectAtIndex: 0];\n NSString *docFile = [docDir stringByAppendingPathComponent: @\"json.txt\"];\n [responseString writeToFile:docFile atomically:NO encoding:NSUTF8StringEncoding error:Nil];\n\n [self loadView];\n [self viewDidLoad];\n}\n\n\nThis works fine. When the application first loads up, it loads a different json, then when I click this button it loads a new JSON and then updates the view. This is just temporary to test out refreshing. However if I try to call this method from another class, or from the AppDelegates ApplicationDidEnterForeground methods, nothing happens. I tried calling it like this \n\n -(void)TestMe{\n\n\n ViewController1 *vc = [[ViewController1 alloc] init];\n\n\n NSString *filePath = [[NSBundle mainBundle] pathForResource:@\"widgjson\" ofType:@\"json\"]; \n NSData *myData = [NSData dataWithContentsOfFile:filePath]; \n\n NSString *responseString = [[NSString alloc] initWithData:myData encoding:NSUTF8StringEncoding];\n\n NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);\n NSString *docDir = [paths objectAtIndex: 0];\n NSString *docFile = [docDir stringByAppendingPathComponent: @\"json.txt\"];\n [responseString writeToFile:docFile atomically:NO encoding:NSUTF8StringEncoding error:Nil];\n\n [vc loadView];\n [vc viewDidLoad];\n\n}\n\n\nSo why does this method not work from any other classes. All I want to is to be able to refresh a view from another class or when the application loads up, but just can't seem to find anything that works.\n\nWould be very grateful if someone could point me in right direction!\n\nEDIT: UPDATING TO CLARIFY\n\nOkay, what I have done for the time being which I don't like is put this\n\nexit(0);\n\n\nInside AppDelegates ApplicationDidEnterBackground. This works to an extent, but is not an ideal solution.\n\nWhat I would like to have happen is that when application is opened again, the AppDelegate gets run again which sets up the tabs. The JSON pulled from the server can affect the order of the tabs which is why I need the AppDelegates ApplicationDidFinishLaunching method to reload itself again. \n\nAlso I would like to know can I do this from another class in the application. The first time my application is loaded it asks for the users phone number, which is sent to the server which then generates an PIN. After this is done, then I want the AppDelegate method to load up and begin setting up the tabs and the order etc." ]
[ "iphone", "xcode" ]
[ "JQuery selector affects its child", "How can I make the Jquery code select only the main div(.post)?\nIt also affects it's child, the inside div.\n\nI'm using this:\n\n$(document).ready(function() {\n$( \".post\" )\n .mouseover(function() {\n $(this).animate({\n height: 180,\n width: 160\n }, 200, function() {\n // Animation complete.\n });\n })\n .mouseout(function() {\n $(this).animate({\n height: 150,\n width: 150\n }, 200, function() {\n // Animation complete.\n });\n });\n\n\n});\n\nHere's the code: http://jsfiddle.net/q5g4xrqf/" ]
[ "jquery" ]
[ "Error: Uncaught SyntaxError: Unexpected token &", "I get an error when sending JSON data to JavaScript from the models. It looks like encoding is causing the error, but all the examples I have found work for other people. How can I properly send model data from my view to JavaScript?\n\nview code:\n\ndef home(request):\n import json\n info_obj = Info.objects.all()\n json_data = serializers.serialize(\"json\", info_obj)\n return render_to_response(\"pique/home.html\", {'json_data':json_data}, context_instance=RequestContext(request))\n\n\nJavaScript code:\n\nvar data = jQuery.parseJSON('{{json_data}}');\nconsole.log(data);\n\n\nThe error Uncaught SyntaxError: Unexpected token &: \n\nvar data = jQuery.parseJSON('[{"pk": 1, "model": "pique.eat" ..." ]
[ "javascript", "python", "django", "json", "serialization" ]
[ "Why does error handler trigger with no error?", "I am running one line of code to open a PDF when a button is clicked. I put an error handler on there in case the file doesn't exist. The problem is that the code works and the file is opened but the error handler still runs. \n\nWhen I disable the error handling code it runs fine and VB doesn't generate an error. I even tried using Err.Description for the message box and it just pops up with nothing displayed. Here is my code:\n\nPrivate Sub cmdOpenPDF_Click()\n\nOn Error GoTo Errorhandler\n Application.FollowHyperlink \"E:\\groups\\folder\\folder2\\\" & Dir(\"E:\\groups\\folder\\folder2\\*\" & Me.txtInvNum & \"*\")\n\nErrorhandler:\n MsgBox \"Unable to locate the file. I'm sorry this has happened.\", vbOKOnly\n Exit Sub\n\n\nEnd Sub\n\n\nSince the PDF opens with no problem I would expect there to be no error. It's also really puzzling that there is no error when run without the error handler. Does anyone know why it's doing this?" ]
[ "vba", "ms-access" ]
[ "Loading Text from a .rtf", "Hei guys,\nI'm trying to load a long text from a .rtf file and I want to show this text in a UITextView.\nI store all the .rtf files in a folder called \"rtf\" into the \"Supporting Files\" folder.\nThis is my code.\n\n- (void)setDetailItem:(id)newDetailItem\n{\n if (_detailItem != newDetailItem) {\n _detailItem = newDetailItem;\n\n // Update the view.\n [self configureView];\n }\n\n}\n\n- (void)configureView\n{\n // Update the user interface for the detail item.\n if (self.detailItem) \n {\n self.textView.text = [self setTextForTextView:[self.detailItem description]];\n }\n\n}\n\n-(NSString *)setTextForTextView:(NSString *)description\n{\n NSString *path = [NSString stringWithFormat:@\"rtf/%@.rtf\" ,description];\n NSLog(@\"%@\" ,path);\n NSString *myText = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];\n\n return myText;\n\n}\n\n- (void)viewDidLoad\n{\n [super viewDidLoad];\n\n self.navigationItem.title = @\"Text\";\n // Do any additional setup after loading the view, typically from a nib.\n [self configureView];\n}\n\n\nBut It doesn't show me the text and I don't understand why...\nThanks!" ]
[ "text", "load", "uitextview", "rtf" ]
[ "c# Accessing specific members of a class with a list without Reflection", "I want to check specific fields of a class for content. If there is no value, it should give a message. The current example is working. But I am looking for a way to to the same without Reflection.\nusing System;\nusing System.Reflection;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n TableDescription table1 = new TableDescription { BUYER_AID = 0, DESCRIPTION_LONG = 3, EAN = 2, SUPPLIER = 17};\n TableDescription table2 = new TableDescription();\n string [] members = new string[] { "BUYER_AID", "DESCRIPTION_LONG", "EAN" };\n CheckAndSetValue(table1, table2, members);\n }\n\n static void CheckAndSetValue(TableDescription t1, TableDescription t2, string[] list)\n {\n foreach (string name in list)\n {\n Type type = typeof(TableDescription);\n FieldInfo typeinfo = type.GetField(name);\n short value = Convert.ToInt16(typeinfo.GetValue(t1));\n if (0 != value)\n {\n typeinfo.SetValue(t2, value);\n }\n else\n { \n Console.WriteLine($"Value for {name} is missing!");\n }\n }\n }\n }\n public class TableDescription\n {\n public short BUYER_AID = 0;\n public short DESCRIPTION_LONG = 0;\n public short EAN = 0;\n public short SUPPLIER = 0;\n }\n}\n\nIs there a way to to it something like:\nvar[] members = new var[]{TableDescription.BUYER_AID, TableDescription.DESCRIPTION_LONG, TableDescription.EAN};\n\nI am looking for a solution to work without stings. Working with Strings will make trouble with refactoring and on error it will crash during runtime." ]
[ "c#", "reflection", "member" ]
[ "Problem with linking forms using Flask and WTForms", "I'm trying to set up a web app that runs methods based on user input.\nThe first page takes the image and amount of images and runs a method with them, the user is then sent to the next form which is a conformation button that confirms they have completed a task outside of the application. However when the confirmation button is pressed the user is redirected the first page where it is shown that they are required to input information into the form even though it has been previously filled out \n\[email protected](\"/\", methods=['GET', 'POST'])\ndef Home():\n form = SelectImageForm()\n if form.validate_on_submit():\n Label_Required = form.ImageLabel.data\n Amount_Required = form.Amount.data\n Cloud_Transfer(form.ImageLabel.data, form.Amount.data)\n flash(f'Searching Labels for {form.ImageLabel.data}!', 'success')\n form = SelectXMLConversion()\n return Stage2()\n return render_template('home.html', title = 'Label Selection', form=form )\n\[email protected]('/stage2', methods=['GET','POST'])\ndef Stage2():\n form = SelectXMLConversion()\n if form.validate_on_submit():\n return render_template('stage2.html', title ='Label Selection', form=form)\n\n\nif __name__ == '__main__':\n app.run(debug='true')\n\n\nAt the moment its expected just to reload the stage 2 page however it is sending them back to the first page prompting them to fill in the required fields" ]
[ "python", "flask", "wtforms" ]
[ "Callisto FlipViewIndicator Is Not Working", "Here is my MainPage.xaml.cs\n\nusing System;\nusing Windows.UI.Xaml.Controls;\nusing Windows.UI.Xaml.Media.Imaging;\n\nnamespace FlipViewTest\n{\n public sealed partial class MainPage : Page\n {\n public MainPage()\n {\n this.InitializeComponent();\n this.addItemsToFlipView();\n }\n\n private void addItemsToFlipView()\n {\n for(int i = 0; i < 9; i++)\n {\n string imageUri = String.Format(@\"ms-appx:///Assets/Images/Screens-0{0}.jpg\",i+1);\n Uri uri = new Uri(imageUri);\n BitmapImage image = new BitmapImage(uri);\n mainFlipView.Items.Add(image);\n }\n }\n }\n}\n\n\nHere is my MainPage.xaml\n\n<Page\n x:Class=\"FlipViewTest.MainPage\"\n xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n xmlns:local=\"using:FlipViewTest\"\n xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n xmlns:callisto=\"using:Callisto.Controls\"\n mc:Ignorable=\"d\">\n\n <Grid Background=\"{ThemeResource ApplicationPageBackgroundThemeBrush}\">\n <FlipView x:Name=\"mainFlipView\">\n <FlipView.ItemTemplate>\n <DataTemplate>\n <Image Source=\"{Binding}\"/>\n </DataTemplate>\n </FlipView.ItemTemplate>\n </FlipView>\n <callisto:FlipViewIndicator FlipView=\"{Binding ElementName=mainFlipView}\" />\n </Grid>\n</Page>\n\n\nWhen I remove the \n\n `<callisto:FlipViewIndicator FlipView=\"{Binding ElementName=mainFlipView}\" />` \n\n\nfrom xaml the app works and when I add it back it just show the first image with no controls and I am unable to flip images.\n\nHow do I properly add callisto flip view indicator?" ]
[ "c#", "wpf", "xaml", "windows-8.1" ]
[ "C# XNA - I want to access the Board(instance of a class) that this particular Block(instance of a class) exists in", "I thought about it for a long time, and I couldn't come up with a better title. I'm not sure what specific thing I need to figure out in order to solve this problem. This is the code I have minus anything I think is unnecessary for this question.\n\nstatic class GameManager\n{\n public static List<Board> Boards = new List<Board>();\n // let's say there are 2 boards\n}\n\nclass Board\n{\n public Dictionary<Vector2, Block> Blocks = new Dictionary<Vector2, Block>();\n //each board has a bunch of blocks in it.\n{\n\nclass Block\n{\n //I want to access the Board that this particular Block exists in.\n}\n\n\nSee, I used to have just one board, so if I was a block in the block class, and I wanted to access, say, the number of blocks in a board, I could just use GameManager.Board.Blocks.Count. I wanted to add multiplayer, so I made a list of boards each with their own set of blocks. Now I need to somehow make a block know which board it's in.\n\nIs there maybe a way I can go backwards in terms of accessing different levels of code? For example, if I started at GameManager, I could go forward through levels by saying GameManager.Boards[0].Blocks[new Vector2(0, 0)] with a . for every level I go down. If I'm starting at the Block class, am I able to go up to access the particular instance of Board that the current instance of Block exists within? I don't want to turn this into an XY problem so what do you think I should do? It seems like storing and passing a variable that keeps track of the current board that's being updated is sloppy code because each block should already know which board it exists in since I did in fact initiate multiple boards each containing their own separate set of blocks. Do you think perhaps I need to nest the Block class within the Board class?" ]
[ "c#", "xna" ]
[ "Two physics bodies do not contact if physicsBody.dynamic property is NO", "There are two physics bodies: an AirplaneNode:\n\n- (id)initAirplaneNode {\n self = [super initWithImageNamed:@\"airplane.png\"];\n if (self) {\n self.name = @\"player\";\n self.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:self.frame.size];\n self.physicsBody.dynamic = NO;\n self.physicsBody.affectedByGravity = NO;\n self.physicsBody.categoryBitMask = AIRPLANE_CATEGORY;\n self.physicsBody.contactTestBitMask = BULLET_CATEGORY;\n }\n return self;\n}\n\n\nand a BulletNode:\n\n- (id)initBulletNode { \n self = [super initWithImageNamed:@\"bullet.png\"];\n if (self) {\n self.name = @\"bullet\";\n self.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:self.frame.size];\n self.physicsBody.dynamic = NO;\n self.physicsBody.usesPreciseCollisionDetection = YES;\n self.physicsBody.categoryBitMask = BULLET_CATEGORY;\n self.physicsBody.contactTestBitMask = AIRPLANE_CATEGORY;\n }\n return self;\n}\n\n\nBoth of them have physicsBody.dynamic property set to NO. \n\nThe problem is when a bullet hits an airplane, my SKScene doesn't call didBeginContact method. However, if I specify physicsBody.dynamic property to YES for either AirplaneNode or BulletNode, didBeginContact is firing.\n\nIs there a way to fix that?\n\nPS: I really don't need my nodes to be dynamic, because it causes an unwanted behaviour: an airplane slightly moves when getting damaged and a bullet sometimes rotates when flying." ]
[ "ios", "objective-c", "collision-detection", "game-physics", "sprite-kit" ]
[ "How to open a new window with a button click in python?", "import sys\nfrom PyQt5.QtCore import *\nfrom PyQt5.QtGui import *\nfrom PyQt5.QtWidgets import *\nfrom PyQt5.uic import *\nclass new1(QDialog):\n def __init__(self):\n super(new1, self).__init__()\n loadUi('gui.ui',self)\n self.setWindowTitle(\"New Window\")\n self.pushButton.clicked.connect(self.clicked1)\n def clicked1(self):\n loadUi('gui2.ui',self)\n\n\napp=QApplication(sys.argv)\nwidget=new1()\nwidget.show()\n\nsys.exit(app.exec_())\n\n\nI want to open \"gui2.ui\" when pushButton is clicked.This code is not working .Any help?" ]
[ "python", "pyqt5" ]
[ "Given year, month, day and monthwise weeknumber, how can I find the date?", "I have \n\nYear : 2011\nMonth: Nov\nDay: Sun\nWeekNumber(Monthwise): 4\n\n\nDesire Output:\n\nDate\n--------\n2011-11-20\n\n\nHow can I do so in a single SQL statement?\n\nThanks" ]
[ "sql", "oracle", "oracle10g" ]
[ "Android Application is still working after exit", "I'm using only an application that uses SMS_Receive Intent Filter and based on receiving an SMS , and it does few calculations , the problem is when going back or home , the application still responds to the incoming SMS which has a special tag and it shows the toasts to the desktop of the android screen , how do I close the application completely ?" ]
[ "android" ]
[ "Spark UDAF dynamic input schema handling", "I know how to pass a struct with inner struct to a UDAF from this -\nPass a struct to an UDAF in spark\n\nBut how do I handle cases where the inner struct schema is unknown or dynamic in the sense that it changes based on the data. Some of the fields may or may not exists as the input data does not adhere to a specific schema. Let's say one data set has \n\n root\n |-- id:string (nullable = false)\n |-- age: long (nullable = true)\n |-- cars: struct (nullable = true)\n | |-- car1: string (nullable = true)\n | |-- car2: string (nullable = true)\n | |-- car3: string (nullable = true)\n |-- name: string (nullable = true)\n\n\nAnd the other data set does not have car3\n\nroot\n |-- id:string (nullable = false)\n |-- age: long (nullable = true)\n |-- cars: struct (nullable = true)\n | |-- car1: string (nullable = true)\n | |-- car2: string (nullable = true)\n |-- name: string (nullable = true)\n\n\nHow do I write a UDAF that accepts the schema that changes based on the input data." ]
[ "scala", "apache-spark", "hadoop", "apache-spark-sql", "user-defined-functions" ]
[ "Switch String with Enum variables", "I have got an Enum with different values and want to switch a string variable. Now I hit a wall trying to convert the Enum values to Strings, that I can use as case constant. \n\nMy best try was to convert the Enum to a String array, but the switch doesn't seem to accept array values as a case constant. (IntelliJ says: \"constant expression required\")\n\nEnum myEnum = {FOO, BAR}\n\nString input = \"foo\"\n\nfinal String[] constant = Arrays.stream(myEnum.values()).map(Enum::name).toArray(String[]::new); \n//converts Enum to String[]; made it final, so it is \"constant\" \n\n switch (input) {\n case constant[0]:\n System.out.println(\"foo\");\n break;\n case constant[1]:\n System.out.println(\"bar\");\n break;\n }\n\n\nIs there an elegant way to make this switch depend on the Enum?" ]
[ "java", "enums", "switch-statement" ]
[ "PostgreSQL convert a string with commas into an integer", "I want to convert a column of type \"character varying\" that has integers with commas to a regular integer column. \n\nI want to support numbers from '1' to '10,000,000'.\n\nI've tried to use: to_number(fieldname, '999G999G999'), but it only works if the format matches the exact length of the string.\n\nIs there a way to do this that supports from '1' to '10,000,000'?" ]
[ "postgresql" ]
[ "cordova - push notification to device statusbar", "I'm trying to push notification to the device status bar (like when you receive a text message) http://developer.android.com/guide/topics/ui/notifiers/notifications.html\n\nBack in the old phonegap days I was using https://github.com/nremond/phonegap-plugins-official/tree/master/Android/StatusBarNotification\n\nAt some upgrade in time it stopped working.\n\nNow I'm trying to make it work again -\nI'm searching the web and all I can find is some broken pieces of code, deprecated plugins, and half answered questions.\n\nCan someone provide a decent example of how to implement it?\ni.e. an example of clicking a button and displaying a string in the device notification bar.\n\nplease supply end-to-end solution that include:\n\n\nwhich plugin u use\nhow u install/config them\n\n\nsome plugin ask for a mysterious SENDER_ID that should 'maps to the project number in the Google Developer Console' (e.g. https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/INSTALLATION.md).\n\nPlease explain what is this and how exactly do I get it.\n\nPlease supply a Cordova solution (not only phonegap).\n\nPlease explain android/ios quirks.\n\n10x." ]
[ "cordova" ]
[ "When to use const keyword for variable vs when to traverse the object", "I am working on a JavaScript application where I have to access a big object at many places. I am wondering what is the better way to go for it in terms of time and space optimisation.\nFor example, let's say I have on object (this is just an example, my objects will be much bigger and deeply nested):\n\nfamily: {\n person: {\n firstName: Sherlock,\n lastName: Holmes,\n age: 22,\n address: {\n building: 221B,\n addressLine1: Baker Street,\n city: London,\n }\n }\n}\n\n\nNow, if I want to access the address here and print it on my webpage, then what is the good approach:\n\nShall I do this:\n\n<div>{family.person.address.building}</div>\n<div>{family.person.address.addressLine1}</div>\n<div>{family.person.address.city}</div>\n\n\nor, I store them in consts and then display here like:\n\nconst address = family.person.address\nconst {\n building, addressLine1, city\n} = address\n<div>{building}</div>\n<div>{addressLine1}</div>\n<div>{city}</div>\n\n\nIn the former one, I am not creating new variable but traversing the object in depth each time I have to access something.\n\nIn the latter one, I don't have to do that traverse but have created 4 new variables\n\nI feel second one is the fast approach (takes less time) because object is not traversed multiple times but I didn't find any articles supporting it.\n\nWhich approach will give me better time or space optimisation in my application?" ]
[ "javascript", "performance", "javascript-objects" ]
[ "Private API Gateway with Serverless Framework", "I have my internal network in AWS VPC(10.0.0.0/16) and I want to create AWS API Gateway within this private network, thus no public hostnames/ips. \n\nHere is what I tried\n\nservice: apollo-lambda1\nprovider:\n name: aws\n runtime: nodejs8.10\n role: arn:aws:iam::xxx:role/admin-api-lambda-role\n region: ap-southeast-1\n private: true\n vpc:\n securityGroupIds:\n - sg-xxxxx\n subnetIds:\n - subnet-xxx\n\n\nsg-xxxxx is a security group that allows only ips from 10.0.0.0/16 .It doesn't help.\n\nI also tried adding, but it sill exposes a public IP to the world... \n\nresourcePolicy:\n - Effect: Allow\n Principal: \"*\"\n Action: execute-api:Invoke\n Resource:\n - execute-api:/*/*/*\n Condition:\n IpAddress:\n aws:SourceIp:\n - \"10.0.0.0/16\"\n\n\nUPD: Tried this combination, didn't work out. Now dns name cannot be resolved\n\nendpointType: PRIVATE\n resourcePolicy:\n - Effect: Allow\n Principal: '*'\n Action: execute-api:Invoke\n Resource:\n - execute-api:/*/*/*\n Condition:\n IpAddress:\n aws:SourceIp:\n - some ip here" ]
[ "amazon-web-services", "aws-api-gateway", "serverless-framework" ]
[ "Does R have issues with numerical stability?", "I am trying my hand at writing a simulation of a ranking model in R. I seem to have run into something that may have to do with \"numerical stability\". I was wondering if someone could suggest some workaround or way to handle it.\n\nranking_algo_fn<- function(old_rank, website_choice,kappa)\n { \n v<- (kappa/ (1+ kappa))\n new_rank<- (v*old_rank)+((1-v)*website_choice)\n return(new_rank)\n }\n\n\nI've traced the problem to this function. Basically this is an updating function, which iterates over the agents performing some action - website choice \n\nRanks are a vector of probabilities (summing to 1 - as it should). Starting with a uniform distribution - so if there were 20 websites, this would be 0.05 for each. ie [0.05,0.05,0.05,0.05,0.05,....]\n\nThe problem is that intuitively, each subsequent new_rank should sum to 1, but it doesn't. Plotted it basically takes a life of it's own, (different behavior based on different parameters, but never what it should). See the attached image for one such instance.\n\n\n\nThe plot of the sum of website_choice and all other things ingredients coming before, is always a straight line. Any workaround?\n\nI've been told that it's better to use other softwares like MATLAB or Mathematica for this kind of stuff. Is that true?" ]
[ "r", "numerical" ]
[ "Confidence intervals for Caret package", "I am using the Caret package to do some regression analysis. I have looked online but have now been able to find a solution. My code is below. Is there a way to compute the confidence intervals for this model?\n\nset.seed(123)\n# Set up repeated k-fold cross-validation\ntrain.control <- trainControl(method = \"cv\", number = 10,\n predictionBounds = c(0, NA), verboseIter = TRUE)\n# Train the model\nstep.model <- train(`likes` ~., data = reduced_Data,\n method = \"leapSeq\", \n tuneGrid = data.frame(nvmax = 1:13),\n trControl = train.control)\n\n\nstep.model$results\n\nstep.model$bestTune\n\nsummary(step.model$finalModel)\n\ncoef(step.model$finalModel, 2)\n\n\nI have tried using the predict function from the base package, but had no luck\n\npredict(step.model$finalModel, my_data, interval = \"confidence\")" ]
[ "r", "regression" ]
[ "ionic2 Refresher dose not show the pullingIcon and refreshingIcon", "i'm working on and angularjs2/ionic2 mobile app , and i need to integrate the refresher to make a pull to refresh from this tutorial .the refresher works fine but i cant get the icons to show's up ? here is my code :\n\n<ion-refresher (starting)=\"doStarting()\"\n (refresh)=\"doRefresh($event, refresher)\"\n (pulling)=\"doPulling($event, amt)\" \n pullingIcon=\"ion-loading-c\"\n pullingText=\"pull to refresh\" \n refreshingIcon=\"add\" \n refreshingText=\"loading\" >\n</ion-refresher>\n\n\nand here is what i get : \n\n\n\ncan any one help me ?" ]
[ "ionic-framework", "angular", "ionic2" ]
[ "MySQL - order rows with a column from another table and don't repeat data", "update -\nnevermind i fix it with php side and use \"distinct\" the final query (solution) is this :\n\nSELECT Distinct m.idDenuncia FROM denunciaMedicamentos AS m JOIN denuncias AS p WHERE p.id=m.idDenuncia ORDER BY m.medicamento\n\n\n\n\nSELECT * FROM denunciaMedicamentos AS m\nJOIN denuncias AS p\nWHERE p.id=m.idDenuncia\nORDER BY m.medicamento\n\n\nAnd it works, but it repeats columns id and idDenuncia. This is the result :\n\n\n\nidDenuncia is the reference to denuncias table.\n\nI want to know, what can I do so it doesn't repeat data (id)?" ]
[ "mysql", "join", "distinct", "repeat" ]
[ "Android email SQLite database", "I am hoping to be able to email the SQLite database I use within my app as a form of backup that the user can perform. My current code is below, the database shows up as an attachment in the email intent and the email will send, but the attachment is not sent. \n\nFile file = new File(Environment.getDataDirectory(), \"/data/com.app/databases/databaseName\");\nIntent intent = new Intent(Intent.ACTION_SEND);\nintent.putExtra(Intent.EXTRA_EMAIL, new String[]{\"\"});\nintent.putExtra(Intent.EXTRA_SUBJECT, \"Backup\");\nintent.putExtra(Intent.EXTRA_TEXT, \"\");\nintent.setType(\"application/octet-stream\");\nintent.putExtra(Intent.EXTRA_STREAM, file.toURI());\nstartActivity(Intent.createChooser(intent, \"Send Email\"));" ]
[ "android" ]
[ "Emogrify HTML and CSS files (not emails)", "I have been searching for information on how to use Emogrifier to convert an HTML, with CSSv3 linked, into inline HTML formatting. So far, I keep finding things pertaining to sending emails to sites that don't allow CSS.\n\nMore information on my problem set: I have an HTML document, with linked CSS, that is nicely formatted and I need to open it as a doc(x). Word doesn't support CSS above v1. I am using v3. As of now, the formatting is horribly off when converting due to the lack of CSS. I have multiple HTML documents and CSS files to convert to inline and would like to not do it by hand.\n\nI have attempted to use Emogrifier, but seem to always get an error page from my server (using MAMP). The page works until it gets to the Emogrify portions. I have attempted the constructor with and without args. When without, I supplied the HTML and CSS with the set functions. I have also attempted to pass the files with both fopen() and file_get_contents().\n\nElements and Version:\n\n\n \n MAMP Version 2 \n Apache 2.0.64\n PHP 5.4.10\n \n\n\nQuestion 1: Can Emogrifier work on things other than emails?\n\nQuestion 2: Is there another product/program that would better suite my needs?\n\nQuestion 3: Is there something wrong with my code?\n\n<?php\n include(emogrifier.php);\n\n $site = file_get_contents('file.html');\n $link = file_get_contents('file.css');\n\n $emog = new Emogrifier($site,$link);\n\n /* alternate call\n $emog = new Emogrifier;\n $emog->setHTML($site);\n $emog->setCSS($link);\n */\n $result = $emog->emogrify();\n\n print($result);\n\n ?>\n\n\nEDIT\n\nI have attempted to pass three types of variables to the constructor:\n\n\n \n file path \n file pointer (fopen()) \n string (file_get_contents())\n \n\n\nWhen attempting to access the php page I get a Server Error in the browser:\n\n\n The website encountered an error while retrieving\n http:// localhost/file.php. It may be down for maintenance or\n configured incorrectly.\n\n\nI have commented out the constructor and function call which allow the page to \"work\" with echo statements for testing purposes. Yet uncommenting even just the constructor causes an error.\n\nWhen \"running\" the emogrifier.php file, the page loads just fine (white screen, no printouts).\n\nThis is all the information that I have for this problem.\n\nFinal Edit\n\nI just wanted to wrap this one up.\n\nI never got an emogrifier to work for my problem set. I ended up using Word Macros with heavy VisualBasic editing to get the formatting we wanted. This was a complicated solution as the Macro system is not well documented. Also, since I had a lot of tables and cell alterations to make, google searches were of little help since everything came up for Excel when searching for cell.\n\n... and then they moved the report format to something else and my work wasn't use anyway! LOL" ]
[ "php", "html", "css" ]
[ "Django Foreign Key Reverse Filtering", "I am still relatively new to Django and still struggle somewhat with ForeignKey filtering and I'd appreciate any help with my problem. I have 2 models below and in my PositionUpdateForm I need the 'candidate' field choices to be only the applicants to that position. \n\nclass Position(models.Model):\n title = models.CharField(max_length=128)\n candidate = models.ForeignKey('careers.Applicant',\n on_delete=models.SET_NULL,\n related_name='candidates',\n blank=True,\n null=True\n )\n\nclass Applicant(models.Model):\n first_name = models.CharField(max_length=128)\n blank=False,\n )\n position = models.ManyToManyField(Position,\n related_name='applicants',\n blank=True\n )\n\n\nIn my form I was trying each of the following:\n\nclass PositionUpdateForm(forms.ModelForm):\n candidate = forms.ModelChoiceField(queryset=Applicant.objects.filter(???))\n\ndef __init__(self, *args, **kwargs):\n super(PositionUpdateForm, self).__init__(*args, **kwargs)\n self.fields['candidate'].queryset = Applicant.objects.filter(???)\n\n\nThank you for any assistance." ]
[ "python", "django" ]
[ "Question on preventing SQL with magic_quotes off and XSS with htmlentities", "On my server I have magic_quotes turned off.\nWhen a user save content as article in my DB from a form, I use \n\n$text = mysql_real_escape_string($_POST['text']); to prevent SQL Injecion. \n\nThis is my input <img src=\"image.png\"></img> and this is what it is saved in the DB <img src=\"image.png\"></img> \n\nWhen I echo htmlentities($row['text']); i get <img src=\"image.png\"></img> printed on screen, on view source I get <img src="image.png"></img>.\n\nMy questions are\n\n\nIsn't supposed to be saved in DB like <img src=\\\"image.png\\\"></img> to prevent SQL Injections ?\nIs htmlentities is a good candidate to prevent XSS attacks?\nShould I turn on magic_quotes?" ]
[ "php", "html-entities", "htmlspecialchars", "strip-tags" ]
[ "Why thymleaf is not displaying image after running the whole application?", "I am just trying to display image in spring boot boot application with very small code. What I have done is created a controller bellow which simple return a thymeleaf page which contains two statements mention below,to display image. I have placed the image inside the resources/static/image directory in application.\n\r\n\r\n<img src=\"../static/images/img1.jpg\" width=\"1000\" th:src=\"@{images/img1.jpg}\"/>\r\n\r\n\r\n\nAnd\n\r\n\r\n<img src=\"~/static/images/img1.jpg\" width=\"1000\" th:src=\"@{images/img1.jpg}\"/>\r\n\r\n\r\n\nSimple Controller:-\n@GetMapping("/show")\n public String showimage(){\n return "showimage";\n }\n\nFirst one is working fine if I am testing it just by clicking chrome icon in .html file.\nAnd no one is working if I am running the whole application and passing http://localhost:8080/show in browser.\nThanks..\nplease help." ]
[ "thymeleaf" ]
[ "Create an angular service with a typescript rest Client", "I am using Angular 1.4.7 with typescript\nI have an autogenerated Client with Swagger in typescript to call a rest service like this:\n\nmodule API.Client {\n'use strict';\n\nexport class DefaultApi {\n ...\n\n\nI am trying to use it by doing:\n\nimport TDRService = API.Client.DefaultApi;\n\nexport class ListaTrtController {\n private tdrservice: TDRService;\n\n/* @ngInject */\nconstructor(service: TDRService) {\n this.tdrservice = service;\n}\n\n\nBut I receive the error \"Unknown provider: serviceProvider <- service <- ListaTrtController\".\nHow can I fix this problem?" ]
[ "angularjs", "typescript", "swagger" ]
[ "Combining rows with mutiple ids to single row involving clob columns", "I am using DB2 database. My problem is this\n\nI have table like this\n\n ID Msg1(CLob) Msg2(Clob) Msg3(Clob)\n\n 1 SomeTex1 NULL NULL\n 1 NULL SomeText2 NULL\n 2 NULL NULL NULL\n 2 SomeText3 SomeText4 NULL\n 3 SomeText5 NULL NULL\n 3 NULL NULL SomeText6\n\n\nI need outupt like this\n\n ID Msg1(CLob) Msg2(Clob) Msg3(Clob)\n 1 SomeTex1 SomeText2 NULL\n 2 SomeText3 SOmeText4 NULL\n 3 SomeText5 NULL Somtext6\n\n\nBasically I need to group by Ids but the same time need to eliminate null values by combining rows." ]
[ "sql", "db2" ]
[ "Issues after upgrading Hot Towel NuGet Package", "I recently ran into a problem upgrading a project I created that was based on the Hot Towel SPA Visual Studio Template. I had a \"moment\" and accidentally ran the update-package command in the NuGet Package Manager Console, which triggered an update of ALL my NuGet packages - including the Hot Towel NuGet package. \n\nThis had the effect of upgrading my project to the latest Hot Towel version and re-adding all the sample views, view models, etc... that I previously deleted or renamed from the original starter project that Hot Towel created. The NuGet upgrade also failed to refresh files that had I had changed intentionally (\\scripts\\_references.js, \\App_Start\\BundleConfig.cs) or unintentionally (where VS had normalized tab\\whitespace in some files I had opened in the IDE). \n\nHas anyone else experienced this? \n\nIt seems pretty unlikely you would ever update the Hot Towel NuGet package for any project that takes root and was built off of the template. I could see later in the project lifecycle updating the dependencies like Breeze, Bootstrap, Toastr, etc..., but just not Hot Towel.\n\nIs it best to just unhook NuGet for Hot Towel once you create your project? This would prevent accidental updates of Hot Towel from re-introducing starter code into your project.\n\nDespite this challenge, Hot Towel is proving to be a great starting point for SPAs. I'm really enjoying working with it.\n\nThanks,\nRichard" ]
[ "hottowel" ]
[ "log4net 2.0.8 pattern for client ip address", "I tried to log ip address of the incoming request. I tried following configuration but it does not working for me its log in as \"DEBUG\".\n\nGlobal.aspx\n\n void Application_BeginRequest(object sender, EventArgs e)\n{\n log4net.ThreadContext.Properties[\"addr\"] = Request.UserHostAddress;\n} \n\n\nRollingFileAppender\n\n <layout type=\"log4net.Layout.PatternLayout\">\n <param name=\"ConversionPattern\" value=\"%p{addr} %date [%thread] %-5level %logger - %message%newline\"/>\n </layout>\n\n\nLog look like this\n\nDEBUG 2018-11-20 06:22:50,328 [40] DEBUG Conference - loging successfully" ]
[ "log4net", "ip-address" ]
[ "WriteConsole and ReadConsole Example - Doesn't read and write successfully", "I have written the following program to print a message to the user and also get a password from it. Then I wanted to check and to verify the input password with my preferred password. Finally, I wanted to show a message to the user. However, my program doesn't work. It prints garbage characters to the user or when I give it input, it shows the wrong message. I think I have defined variables incorrectly, however, I don't know what is the best way to work with these APIs.\n#include <Windows.h>\n#include <stdio.h>\n\nvoid PasswordCheck()\n{\n char message_console[MAX_PATH];\n char key_accepted[MAX_PATH];\n char bad_key[MAX_PATH];\n char password_store[MAX_PATH];\n DWORD chars_read;\n\n strcpy(message_console, "Enter password for this malware: ");\n WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE), message_console, sizeof(message_console), NULL, NULL);\n ReadConsoleA(GetStdHandle(STD_INPUT_HANDLE), password_store, MAX_PATH, &chars_read, NULL);\n \n if (!strcmp(password_store, "password"))\n {\n strcpy(key_accepted, "Key Accepted");\n WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE), key_accepted, sizeof(key_accepted), NULL, NULL);\n }\n else\n {\n strcpy(bad_key, "Bad key");\n WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE), bad_key, sizeof(bad_key), NULL, NULL);\n }\n}\n\nint main(int argc, char* argv[])\n{\n PasswordCheck();\n\n return 0;\n}" ]
[ "c", "winapi" ]
[ "changing vim's vertsplit character to │", "This is, I assume, codepage related, but doesn't hurt asking.\n\nHow would one, on windows xp's cmd, gvim 7.2 change vertsplit character, so that instead of default | it is │ (so that it makes a full, and not an splitted line) ?\n\nThat character is usually changed with\n\nset fillchars=vert:\\|\n\n\nand I can copy paste the ascii graphics line there, but it comes out as garbage. I suppose I would have to change vim's internal codepage for it to show correctly ?\n\nAnyone knows how to do this ?" ]
[ "vim" ]
[ "Edmx update model add blank lines from autogeneration", "I have an annoying problem and can't seem to figure out what's causing it. On my machine when I try to use Update Model from Database... on Edmx file in EF Database first approach the autogenerated model has blank lines between properties. This doesn't seem to occure on other developers machines even though we have same versions of VS , extensions etc. \n\nProblem is that even when I add for example one new table the refresh automatically adds blank lines for all mapped tables. Later all of this is visible as conflict during merge operations in GIT.\n\nWould really appreciate any help since I did't find a single shred of information on this issue anywhere and this really disrupts work." ]
[ "entity-framework" ]
[ "Java 8 filter with method call", "I am learning Java 8 lambda and streams and trying some examples. But facing problem with it. here is my code\n\nfillUpdate(Person p){\n List<Address> notes = getAddress();\n notes.stream().filter( addr -> addr !=null).map( this::preparePersonInfo,p,addr);\n}\nprivate void preparePersonInfo(Person p, Address addr){\n // do some stuff\n}\n\n\nAm getting compilation error in .map addr(second argument) field.\nwhat wrong in it and could you please provide links to learn java 8 streams.\nFYI am following this link Java 8 lambda" ]
[ "java", "java-8", "java-stream" ]
[ "How to make auto generated id function?", "I try to create a function for generate the id in sql table. but i don't know how to set parameter for select table and columns please help me \n\nPublic Function autoid(ByVal col As String, ByVal txt As TextBox, ByVal tb As String)\n Dim cmd As New SqlCommand\n Dim id As Integer\n cn.Open()\n cmd.Connection = cn\n cmd.CommandText = \" SELECT MAX('\" & col & \"') FROM '\" & tb & \"' \"\n\n Try\n If IsDBNull(cmd.ExecuteScalar) Then\n\n id = 1\n txt.Text = id\n Else\n id = cmd.ExecuteScalar + 1\n txt.Text = id\n\n End If\n cmd.Dispose()\n cn.Close()\n Catch ex As Exception\n\n MsgBox(ex.ToString)\n\n End Try\n\n\nit show this error Incorect syntax near ..my tb value .." ]
[ "vb.net", "function", "module" ]
[ "Single, Concurrent Job Spanning Multiple Nodes", "Given several nodes available Jenkins nodes (NodeA, NodeB, ...), is there a way to define a job such that it gets 2 nodes?\n\nFor example, Job1 gets assigned to NodeA & NodeD." ]
[ "jenkins" ]