texts
sequence
tags
sequence
[ "Silverlight Client-Server Communication", "I have a WPF application, that I want to port to Linux/Mac. The most logic way seems to split the application in two parts: client and server, and use Silverlight for the client UI, and run the server-part (as an invisible console-app) in Mono. \n\nBut what's the best way to let those two parts communicate? Silverlight 4 supports COM interop, but I cant use that because it will fail in Moonlight. So I was thinking about socket-connection to localhost, and use JSON or something similar. Or is there a better way which doesn't require me to write dozens of wrappers for all the function contained in the server-dll? Because communication will be between Mono<>Moonlight, maybe i can use something similar as COM interop that is cross-platform?" ]
[ "silverlight", "architecture", "client", "communication" ]
[ "Serverless querying NodeJS MSSQL and cannot get result back to callback", "I'm writing a small Serverless function to query a MSSQL db using the node mssql library (https://www.npmjs.com/package/mssql#callbacks)\n\nI've read the documentation and I think I'm doing everything right but getting confused - I can see the result in my logs, but the main function callback is not being called and therefore data not being outputted by the API (basically the whole thing times out)\n\nHeres my Lambda function:\n\nimport {success, error} from './libs/response-lib';\nimport {EPDBConfig} from \"./libs/Database-lib\";\nimport sql from \"mssql\";\nimport config from \"./config\";\n\nexport function main(event, context, callback) {\n\n console.log(\"start\");\n\n EPDBConfig().then(dbConfig => {\n\n if(config.debug) console.log(\"Hello!\");\n\n let EPDBconfig = {\n user: dbConfig.dbuser,\n password: dbConfig.dbpassword,\n server: dbConfig.dbhost,\n database: dbConfig.dbname\n };\n\n sql.connect(EPDBconfig)\n .then(pool => {\n return pool.request()\n .input('student_no', sql.Int, 129546)\n .query('select * from Student where StudentNo = @student_no')\n }).then(result => {\n console.log(\"success!\");\n if(config.debug) console.log('result', result);\n return result;\n }).catch(err => {\n if(config.debug) console.log('err1', err);\n return err;\n });\n\n sql.on('error', err => {\n if(config.debug) console.log('err2', err);\n return callback(null, error(err));\n });\n\n sql.on('done', result => {\n if(config.debug) console.log('done', result);\n return callback(null, success(result));\n });\n\n }).catch(err => {\n if(config.debug) console.log('err3', err);\n return callback(null, error(err));\n })\n}\n\n\nDB Config is pulled from AWS KMS for secure vars\n\nimport AWS from \"aws-sdk\";\nimport config from \"../config\";\n\nconst kms = new AWS.KMS({\n region: AWS.config.region\n});\n\nexport function EPDBConfig() {\n //DECRYPT THE DATABASE CONNECTION DETAILS\n\n return new Promise((resolve, reject) => {\n let params = {\n CiphertextBlob: Buffer(process.env.epdb, 'base64')\n };\n kms.decrypt(params, function(err, data) {\n if (err) {\n reject(err);\n } // an error occurred\n else {\n let dbParams = JSON.parse(String(data.Plaintext));\n resolve(dbParams);\n }\n\n });\n });\n}\n\n\nand response lib:\n\nexport function success(data, message) {\n return buildResponse(200, true, data, message);\n}\nexport function error(data, message) {\n return buildResponse(400, false, data, message);\n}\nexport function unauthorized(data, message) {\n return buildResponse(401, false, data, message);\n}\nexport function forbidden(data, message) {\n return buildResponse(403, false, data, message);\n}\nexport function exception(data, message) {\n return buildResponse(500, false, data, message);\n}\n\nfunction buildResponse(statusCode, successState, data, message) {\n var body = {\n success: successState,\n message: message\n };\n\n if (successState) {\n body.data = data;\n }\n return {\n statusCode: statusCode,\n headers: {\n 'Access-Control-Allow-Origin' : '*',\n 'Access-Control-Allow-Credentials': true\n },\n body: JSON.stringify(body)\n };\n}\n\n\nCan anyone point out where I'm going wrong here? I think I have a whole pile of promises going on. The sql.on('done', result => { ... doesn't appear to work, and I tried adding 'return callback(null, success(result));' in the area where I have 'success'\n\nPlease help me!" ]
[ "javascript", "sql-server", "node.js", "serverless" ]
[ "Does anyone know how google analytics processes data?", "Anyone have any idea or know of any articles that discusses how google analytics stores and processes the data that comes in from the urchin calls? Curious about the architecture. \n\nthanks!" ]
[ "google-analytics" ]
[ "How to handle IE security alert pop up in Selenium", "I am getting \"Alert data: When you send information to the Internet, it might be possible for others to see that information. Do you want to continue?\" while running the login script. I am able to capture the security alert data but not able to accept that alert and proceed further.\n\n@Test\n public void f() \n {\n driver.get(\"http://www.demo.guru99.com/V4/\"); \n String title= driver.getTitle();\n System.out.println(title);\n WebElement element = driver.findElement(By.xpath(\"html/body/form/table/tbody/tr[1]/td[2]/input\"));\n element.sendKeys(\"mngr57377\");\n WebElement element1 = driver.findElement(By.xpath(\"html/body/form/table/tbody/tr[2]/td[2]/input\"));\n element1.sendKeys(\"yzUdAtu\");\n WebElement elementClick=driver.findElement(By.xpath(\"html/body/form/table/tbody/tr[3]/td[2]/input[1]\"));\n elementClick.click();\n try {\n click(elementClick);\n } catch (UnhandledAlertException f) {\n try {\n Alert alert = driver.switchTo().alert();\n alert.accept();\n String alertText = alert.getText();\n System.out.println(\"Alert data: \" + alertText);\n\n } catch (NoAlertPresentException e) {\n e.printStackTrace();\n }\n }\n\n }" ]
[ "selenium", "alert" ]
[ "Linq query to get child records", "I have \n\nstring inputXml = @\"<?xml version='1.0' encoding='UTF-8'?>\n <Parent>\n <Child>\n <Child1 value='10' /> \n <Child2 value= '20' /> \n </Child>\n <Child>\n <Child1 value='30' /> \n <Child2 value='40' /> \n <Child3 value='50' /> \n </Child> \n </Parent>\";\n\n\nNeed a linq query that will fetch all teh values from the inner childs.\n\nOutput will be\n\nChild1 : 10\nChild2: 20\nChild1: 30\nChild2 : 40\nChild3: 50\n\n\nI am lost after this\n\nXDocument source = null;\nsource = XDocument.Parse(inputXml);\n\n\nvar res = (from data in source.Descendants(\"Child\")\n select data);\n\n\nHelp needed" ]
[ "linq", "c#-4.0" ]
[ "Performance difference between generic and non generic method", "Let's say for the sake of the example that we want to work on linear algebra, with different type of matrices. And that we have a custom Matrix class that implements :\n\ninterface IMatrix\n{\n double this[int i, int j] { get; set; }\n int Size { get; }\n}\n\n\nI want to implement Matrix multiplication. I was under the impression that both methods :\n\nstatic void Multiply<TMatrix>(TMatrix a, TMatrix b, TMatrix result) where TMatrix : IMatrix\n\n\nand\n\nstatic void Multiply(Matrix a, Matrix b, Matrix result)\n\n\n(with similar implementation of course) Would internally produce the exact same IL and hence the same performances. It is not the case : the first one is four times slower than the second one. Looking at the IL, it seems the generic one is similar to a call through interface :\n\nstatic void Multiply(IMatrix a, IMatrix b, IMatrix result)\n\n\nAm I missing something ? Is there any way to get the same performances with generics than with a direct call ?\n\n\n\nInstalled Framework 4.8, Target Framework : 4.7.2 (also tested with .Net Core 3)\n\nMethod implementation :\n\nstatic void Multiply(Matrix a, Matrix b, Matrix result)\n{\n for (int i = 0; i < a.Size; i++)\n {\n for (int j = 0; j < a.Size; j++)\n {\n double temp = 0;\n for (int k = 0; k < a.Size; k++)\n {\n temp += a[i, k] * b[k, j];\n }\n result[i, j] = temp;\n }\n }\n}\n\n\nMinimal reproductible example" ]
[ "c#", ".net", "generics", ".net-core", ".net-4.7.2" ]
[ "Cross apply to fill down values with multiple columns", "I have a table with a few columns. I want to fill down values to replace nulls, but this is complicated by the additional columns. Here is a sample of what I have:\n\ndate id1 id2 id3 id4 value\n1/1/14 a 1 1 1 1.2\n1/2/14 a 1 1 1 NULL\n1/8/14 a 1 1 1 2.3\n1/1/14 a 2 1 1 10.1\n1/2/14 a 2 1 1 12.3\n1/17/14 a 2 1 1 NULL\n1/18/14 a 2 1 1 10.8\n1/1/14 a 2 3 1 100.3\n1/2/14 a 2 3 1 NULL\n1/6/14 a 2 3 1 110.4\n\n\nI want to copy down value while the value remains within a \"group\" of id1-4. For example, all of the \"A-1-1-1\" should be isolated from \"a-2-1-1\" in terms of what values to copy down. The output I need is:\n\ndate id1 id2 id3 id4 value\n1/1/14 a 1 1 1 1.2\n1/2/14 a 1 1 1 1.2\n1/8/14 a 1 1 1 2.3\n1/1/14 a 2 1 1 10.1\n1/2/14 a 2 1 1 12.3\n1/17/14 a 2 1 1 12.3\n1/18/14 a 2 1 1 10.8\n1/1/14 a 2 3 1 100.3\n1/2/14 a 2 3 1 100.3\n1/6/14 a 2 3 1 110.4\n\n\nI can do this for a single column using CROSS APPLY but the syntax for the multiple columns is confusing me. The SQL to generate the temp data is:\n\nDECLARE @test TABLE\n (\n date DATETIME\n ,id1 VARCHAR(1)\n ,id2 INT\n ,id3 INT\n ,id4 INT\n ,value FLOAT\n )\n\n INSERT INTO @test VALUES\n ('2014-01-01','a','1','1','1','1.2')\n ,('2014-01-02','a','1','1','1',NULL)\n ,('2014-01-08','a','1','1','1','2.3')\n ,('2014-01-01','a','2','1','1','10.1')\n ,('2014-01-02','a','2','1','1','12.3')\n ,('2014-01-17','a','2','1','1',NULL)\n ,('2014-01-18','a','2','1','1','10.8')\n ,('2014-01-01','a','2','3','1','100.3')\n ,('2014-01-02','a','2','3','1',NULL)\n ,('2014-01-06','a','2','3','1','110.4')\n ;\n\n SELECT * FROM @test;" ]
[ "sql", "sql-server-2008" ]
[ "Cocoa binding programmatically + not updating value?", "I have a custom class (subclass of NSView - actually let's say a modified editor, but NOT a subclass of NSTextView) which I'm binding to an NSArrayController programmatically (I most definitely canNOT do it via Interface Builder), like this :\n\n[myEditor bind:@\"string\" \n toObject:myController \n withKeyPath:@\"selection.content\" \n options:nil];\n\n\nThe above works, however when the value is changed, it is NOT updated to my NSArrayController - it's as if it doesn't \"stick\".\n\nI've even tried, using the options below, but to no avail :\n\nNSDictionary* options = [NSDictionary dictionaryWithObjectsAndKeys:\n [NSNumber numberWithBool:YES],NSContinuouslyUpdatesValueBindingOption, \n [NSNumber numberWithBool:YES],NSAllowsEditingMultipleValuesSelectionBindingOption,\n [NSNumber numberWithBool:YES],NSConditionallySetsEditableBindingOption,\n [NSNumber numberWithBool:YES],NSRaisesForNotApplicableKeysBindingOption,\n nil];\n\n\nAny ideas?" ]
[ "objective-c", "cocoa", "cocoa-bindings" ]
[ "Automating telric controls with selenium rc and junit", "I need to automate a web application that is built in asp.net.This is mandatory that I have to use Selenium RC along with Junit or TestNG.\n\nHere I am facing big trouble in dealing with telric controls and silverlight controls.\nCan somebody please suggest me some ways to overcome it.." ]
[ "java", "selenium", "junit", "selenium-rc", "testng" ]
[ "Form designer view is not available in visual studio 2019 C# CMake project", "I'm trying to port my C# Windows Form project from .csproj to CSharp CMake CMakeLists.txt. I successfully made CMakeLists.txt similar to here. The only problem is when the project opened with CMakeLists.txt, the Form Designer is not available (as shown below). Is it any way to fix the problem?\n\ncsproj:\n\n\n\nCMakeLists.txt:" ]
[ "c#", "winforms", "cmake", "visual-studio-2019" ]
[ "Select From Where Not Exists query", "Memberships table:\n\nCREATE TABLE `Consultant_Memberships` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `title` varchar(255) DEFAULT NULL,\n `membership_url` varchar(255) DEFAULT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;\n\n\nMemberships_List table:\n\nCREATE TABLE `Consultant_Memberships_List` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `consultant_id` int(11) DEFAULT NULL,\n `membership_id` int(11) DEFAULT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;\n\n\nWithin the Memberships table, there is a list of 'Societies' which the member can become a part of. On selection, this is then added to the 'Memberships_List' in the form of:\n\n\nid - Auto increment\nconsultant_id - The unique ID of the user who's added the societies\nmembership_id - Refers to the 'id' from the memberships table.\n\n\nI want to be able to show in a drop down list only the memberships which the user hasn't chosen yet. So far I've got:\n\n$query = $db->query(\"SELECT `Consultant_Memberships.`id`, `Consultant_Memberships`.`title` `FROM `Consultant_Memberships \nWHERE NOT EXISTS (SELECT `Consultant_Memberships`.`id`, `Consultant_Memberships`.`title` \nWHERE `Consultant_Memberships`.`id` = $user_id)\");\n\n\nI'm currently getting this error, and also unsure if this is the correct query:\n\nPHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `Consultant_Memberships_List`.`id` = )' at line 1' in /Users/Sites/pages/medical.php:72\nStack trace:\n#0 /Users/Sites/pages/medical.php(72): PDO->query('SELECT `Consult...')\n#1 /Users/Sites/index.php(18): include('/Users/Site...')\n#2 {main}\n thrown in /Users/Sites/pages/medical.php on line 72" ]
[ "mysql", "sql" ]
[ "Maven test runs local fails in CI environment", "I have a file src/test/resources/ConfigTest.json with my test configuration. My maven test helper class (an enum) has the following 2 lines:\n\nClassLoader c = this.getClass().getClassLoader();\nFile configFile = new File(c.getResource(\"ConfigTest.json\").getFile());\n\n\nWhen I run mvn test from Eclipse or local command line, works as expected. However when run from a Bitbucket pipeline it throws a NullPointerException for not finding the file. My bitbucket-pipelines.yml file:\n\nimage: maven:3.3.9\nclone:\n depth: full\npipelines:\n default:\n - step:\n caches:\n - maven\n script:\n - mvn -B verify\n\n\nI also tried:\n\n\nuse the class: this.getClass().getResource(\"/ConfigTest.json\")\nuse the Thread: ClassLoader c = Thread.currentThread().getContextClassLoader()\n\n\nFull example class:\n\nimport java.io.File;\nimport org.junit.Assert;\nimport org.junit.Test;\n\npublic class ClassLoaderTest {\n\n @Test\n public final void test() {\n ClassLoader c = this.getClass().getClassLoader();\n File configFile = new File(c.getResource(\"ConfigTest.json\").getFile());\n Assert.assertTrue(configFile.exists());\n }\n}\n\n\nWhat do I miss? How is the Bitbucket runtime different from my local environment when it comes to resource loading?\n\nUpdate The POM.XML\n\n <project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n <modelVersion>4.0.0</modelVersion>\n <groupId>io.projectcastle</groupId>\n <artifactId>io.projectcastle.tjwt2sfoauth</artifactId>\n <version>0.0.1-SNAPSHOT</version>\n <name>Authentication using custom JWT</name>\n <description>Translates custom JWT into OAuth session</description>\n\n <properties>\n <java.version>1.8</java.version>\n </properties>\n\n <build>\n <plugins>\n <plugin>\n <artifactId>maven-compiler-plugin</artifactId>\n <version>3.3</version>\n <configuration>\n <source>${java.version}</source>\n <target>${java.version}</target>\n </configuration>\n </plugin>\n </plugins>\n </build>\n\n <dependencies>\n\n <dependency>\n <groupId>junit</groupId>\n <artifactId>junit</artifactId>\n <version>4.12</version>\n <scope>test</scope>\n </dependency>\n\n </dependencies>\n </project>" ]
[ "java", "maven", "bitbucket", "bitbucket-pipelines" ]
[ "How to use Woocommerce Api's using JWT token in Laravel?", "I am using Woocommerce for getting data in Laravel. I am using the package:\nhttps://github.com/woocommerce/wc-api-php\nNow I am using consumer key and consumer secret for getting data. But now requirement has been change. Now i want to get API's data using JWT Auth token. This time I am creating object as,\n $this->client = new Client(\n Cookie::get('site_url'),\n Cookie::get('key'),\n Cookie::get('secret'),\n [\n 'timeout' => 120,\n 'version' => config('woocommerce.api_version'),\n ]\n );\n\nAnd then call method to get, post, etc.\n$this->client->get($endpoint, $parameters);\n\nBut I want to pass the JWT token to get data." ]
[ "wordpress", "laravel", "woocommerce" ]
[ "XAML animation moving countdown", "I have the following TextBlock which will be a moving countdown timer:\n\n <TextBlock x:Name=\"countdown\">\n <TextBlock.RenderTransform>\n <TranslateTransform x:Name=\"countdownTransform\" />\n </TextBlock.RenderTransform>\n </TextBlock>\n\n\nThe following triggers should move the TextBlock and set the countdown text:\n\n<Grid.Triggers>\n <EventTrigger SourceName=\"PlayButton\" RoutedEvent=\"Button.Click\">\n <BeginStoryboard>\n <Storyboard>\n <DoubleAnimation Storyboard.TargetName=\"songProgressBar\" \n Storyboard.TargetProperty=\"Value\"\n From=\"0:30:0\" To=\"0\" Duration=\"0:30:0\" />\n <DoubleAnimation Storyboard.TargetName=\"countdownTransform\" \n Storyboard.TargetProperty=\"X\" AutoReverse=\"True\" \n From=\"0.0\" To=\"{Binding ElementName=countdown, Path=Width}\" Duration=\"0:30:0\" />\n </Storyboard>\n </BeginStoryboard>\n </EventTrigger>\n</Grid.Triggers>\n\n\nHowever, the DoubleAnimation's From property doesn't accept (obviously) TimeSpan and for the second trigger, To property isn't binding to the TextBlock's Width. Is there a custom type of animation that accepts TimeSpan at To property?\n\nI want to be able to do this in XAML, I know this is possible in c# code." ]
[ "wpf", "xaml", "animation", "triggers" ]
[ "JSF (PrimeFaces) page doesn't work with single form", "I am developing a simple page using PrimeFaces that list informations about some projects. I wanted to add a button that open a dialog with detailed information. The code is quite simple. However it doesn't work:\n\n<h:form id=\"projectForm\"> \n <p:dataTable id=\"projectDataTable\" var=\"project\" value=\"#{projectMB.projects}\" > \n <p:column sortBy=\"name\" headerText=\"Name\"> \n <h:outputText value=\"#{project.name}\" /> \n </p:column> \n <p:column sortBy=\"status\" headerText=\"Status\"> \n <h:outputText value=\"#{project.status}\" /> \n <h:outputText value=\" (#{project.progress}%)\" /> \n </p:column>\n <p:column style=\"width:4%\"> \n <p:commandButton update=\":projectForm:display\" id=\"selectButton\" oncomplete=\"PF('projectDialog').show()\" icon=\"ui-icon-search\" title=\"View\"> \n <f:setPropertyActionListener value=\"#{project}\" target=\"#{projectMB.selectedProject}\" /> \n </p:commandButton> \n </p:column> \n </p:dataTable> \n <center>\n <p:commandButton id=\"refreshProjectsButton\" actionListener=\"#{projectMB.refreshProjectList}\" icon=\"ui-icon-refresh\" update=\"projectDataTable\"/>\n </center>\n\n <p:dialog header=\"Project Detail\" widgetVar=\"projectDialog\" resizable=\"false\" id=\"projectDlg\" showEffect=\"fade\" modal=\"true\"> \n <h:panelGrid id=\"display\" columns=\"2\" cellpadding=\"4\" style=\"margin:0 auto;\"> \n <h:outputText value=\"Name:\" /> \n <h:outputText value=\"#{projectMB.selectedProject.name}\" style=\"font-weight:bold\"/> \n <h:outputText value=\"Description:\" /> \n <h:outputText value=\"#{projectMB.selectedProject}\" style=\"font-weight:bold\"/> \n </h:panelGrid> \n </p:dialog> \n</h:form>\n\n\nI found a solution by adding extra form which enclose dialog:\n\n<h:form id=\"projectForm\"> \n <p:dataTable id=\"projectDataTable\" var=\"project\" value=\"#{projectMB.projects}\" > \n <p:column sortBy=\"name\" headerText=\"Name\"> \n <h:outputText value=\"#{project.name}\" /> \n </p:column> \n <p:column sortBy=\"status\" headerText=\"Status\"> \n <h:outputText value=\"#{project.status}\" /> \n <h:outputText value=\" (#{project.progress}%)\" /> \n </p:column>\n <p:column style=\"width:4%\"> \n <p:commandButton update=\":projectForm2:display\" id=\"selectButton\" oncomplete=\"PF('projectDialog').show()\" icon=\"ui-icon-search\" title=\"View\"> \n <f:setPropertyActionListener value=\"#{project}\" target=\"#{projectMB.selectedProject}\" /> \n </p:commandButton> \n </p:column> \n </p:dataTable> \n <center>\n <p:commandButton id=\"refreshProjectsButton\" actionListener=\"#{projectMB.refreshProjectList}\" icon=\"ui-icon-refresh\" update=\"projectDataTable\"/>\n </center>\n\n</h:form> \n<h:form id=\"projectForm2\"> \n\n <p:dialog header=\"Project Detail\" widgetVar=\"projectDialog\" resizable=\"false\" id=\"projectDlg\" showEffect=\"fade\" modal=\"true\"> \n <h:panelGrid id=\"display\" columns=\"2\" cellpadding=\"4\" style=\"margin:0 auto;\"> \n <h:outputText value=\"Name:\" /> \n <h:outputText value=\"#{projectMB.selectedProject.name}\" style=\"font-weight:bold\"/> \n <h:outputText value=\"Description:\" /> \n <h:outputText value=\"#{projectMB.selectedProject}\" style=\"font-weight:bold\"/> \n </h:panelGrid> \n </p:dialog> \n</h:form>\n\n\nMy question is: why the first code doesn't work - method projectMB.refreshProjectList that refresh the list in java bean is never called. I don't get any errors in javascript and java." ]
[ "java", "jsf", "primefaces", "xhtml" ]
[ "Entry box inside toplevel window in tkinter", "I have written a code to show Entry widget inside top-level window in tkinter but it is not showing anything when I run it.\nBelow is the code from where I am calling the top-level window:\n#file: app.py\n\n# enter new racer\nbtnNewRacer = Button(app, text = "Enter New Racer", style = 'W.TButton', command = EnterRacer)\nbtnNewRacer.grid(row = 0, column = 0, pady = 50, padx = 50)\n\nAnd this is the code where I have written the code for Entry widget:\n#file: new_racer.py\n\ndef EnterRacer(): \n \n # Toplevel object which will \n # be treated as a new window \n racerWindow = Toplevel() \n racerWindow['background']='#2A3132'\n \n # sets the title of the \n # Toplevel widget \n racerWindow.title("Enter New Racer") \n \n # sets the geometry of toplevel \n racerWindow.geometry("700x500") \n \n # A Label widget to show in toplevel \n Label(racerWindow, text ="Enter new racer window").pack()\n Label(racerWindow, text="First Name").pack()\n Label(racerWindow, text="Last Name").pack().grid(row=5)\n\n entry_1 = Entry(racerWindow)\n entry_1.pack()\n entry_1.grid(row=5)\n\nWhen I run the app.py and I click on the "Enter New Racer" button I don't see any entry widget. Can anyone please help? Thanks." ]
[ "python", "tkinter" ]
[ "How to reuse a JSP with a controller?", "I'm new to web development with Java, so please excuse me if I'm butchering the terminology:\n\nI'm building a web app with JSPs/servlets using the Java MVC model. I'm including a register/login option on the top menu that will of course need to communicate with the server (handle registering/logging in or retreiving the user's name).\n\nI want to reuse both the JSP and controller code for the top menu as it should be on every page. I'm able to reuse the menu page using <c:import>. However, the menu will appear on pages that have their own functionality and therefore their own controllers. I can't figure out how to reuse the controller code for the menu on these pages as I can only map one servlet to a URL.\n\nI don't have much code to show as an example at this point. What's the best practice for reusing common functionality like this without interfering with page specific functionality?" ]
[ "java", "jsp", "servlets", "model-view-controller", "controller" ]
[ "How to create a folder if it doesn't exist?", "I'm trying to create a folder if it doesn't exist, but the code creates a new folder every time I run it. I don´t know if my code is right. \n\nHere is my code:\n\nvar alumnopath = DocsList.getFolderById ('0Bzgw8SlR34pUbFl5a2tzU2F0SUk');\nvar alumno2 = alumno.toString();\nLogger.log(alumno2);\ntry {\n var folderalumno = alumnopath.getFolder(alumno2);\n if (folderalumno == undefined){\n var folderalumno = alumnopath.createFolder(alumno2);\n }\n else {\n var folderalumno = alumnopath.getFolder(alumno2);\n }\n}\ncatch(e) {\n var folderalumno = alumnopath.createFolder(alumno2);\n}\nfolderalumno.createFile(pdf.getAs('application/pdf')).rename( alumno + \" , \" + fechafor);\n\n\nThanks for your help!!" ]
[ "google-apps-script", "google-drive-api" ]
[ "Wordpress, Disqus comments and the wrong URL", "I have a Wordpress page that uses Disqus comments. At the bottom of the page I have this:\n\n<!-- DISQUS COMMENTs -->\n <div id=\"comments\">\n <div id=\"disqus_thread\"></div>\n <script>\n\n /**\n * RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.\n * LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/\n\n var disqus_config = function () {\n this.page.url = '<?php the_permalink(); ?>'; // Replace PAGE_URL with your page's canonical URL variable\n this.page.identifier = '<?php the_ID(); ?>'; // Replace PAGE_IDENTIFIER with your page's unique identifier variable\n };\n\n (function() { // DON'T EDIT BELOW THIS LINE\n var d = document, s = d.createElement('script');\n s.src = 'https://example.disqus.com/embed.js';\n s.setAttribute('data-timestamp', +new Date());\n (d.head || d.body).appendChild(s);\n })();\n </script>\n <noscript>Please enable JavaScript to view the <a href=\"https://disqus.com/?ref_noscript\">comments powered by Disqus.</a></noscript>\n </div>\n <!-- /#comments -->\n\n\nand in my page I display how many comments have been made on the current post like so:\n\n<a href=\"<?php the_permalink(); ?>#disqus_thread\">0 Comments</a>\n\n\nThe trouble is, it's not working. The comments always appear as zero even though there are comments on the page. And I think I know why this happens, but I'm not sure how to property resolve it.\n\nSo:\n\nMy 'comments' anchor renders like so:\n\n<a href=\"https://www.example.com/blog/my-post-name#disqus_thread\">0 Comments</a>\n\n\nAnd in my JavaScript code at the bottom, the page URL gets set correctly like so:\n\nthis.page.url = 'https://www.example.com/blog/my-post-name'\n\n\nHowever if I post a comment and log in to my Disqus control panel and hover over the post URL, the URL format is like so:\n\nhttps://www.example.com/blog/?p=232\n\n\nSo it seems like the Disqus JavaScript is reading the URL of the page before the URL has been rewritten! Does that make sense?\n\nA potential way to resolve it is to make my comments anchor render like so:\n\n<a href=\"https://www.example.com/blog/?p=232#disqus_thread\">0 Comments</a>\n\n\nBut that feels a bit hacky. Any ideas anyone?\n\nThanks!\n\nUPDATE\n\nI can confirm that rendering my comments anchor like so will work:\n\n<a href=\"<?php echo home_url(); ?>/?p=<?php echo get_the_ID(); ?>#disqus_thread\">0 Comments</a>\n\n\nHowever this is more of a workaround. How can I make Disqus store my rewritten (cleaner looking) URLs instead of the Wordpress 'Plain' (and ugly) URL?" ]
[ "wordpress", "disqus" ]
[ "Are there any good custom allocators for C++ that maximize locality of reference?", "I am running a simulation with a lot if bunch of initial memory allocations per object. The simulation has to run as quickly as possible, but the speed of allocation is not important. I am not concerned with deallocation.\n\nIdeally, the allocator will place everything in a contiguous block of memory. (I think this is sometimes called an arena?)\n\nI am not able to use a flattened vector because the allocated objects are polymorphic.\n\nWhat are my options?" ]
[ "c++", "stl", "memory-management" ]
[ "can.routing : triggering a change to go from #!/foo/bar to #!/foo", "I am trying to understand CanJS' routing. So far, I have the following routes set up.\n\ncan.route('plant/:plant/', {\n plant : undefined,\n day : undefined\n});\ncan.route('plant/:plant/day/:day', {\n plant : undefined,\n day : undefined\n});\n\n\nI have no listeners set up yet, as I am just trying this out in the console. The following works fine:\n\ncan.route.attr({plant : 1}) // ==> #!plant/1/\ncan.route.attr({plant : 1, day : 3}) // ==> #!plant/1/day/3\n\n\nBut after I have done this, I would like to trigger an event to go \"up\" in the hierarchy, back to the #!/plant/1 level. I tried doing can.route.attr({plant : 1, day : undefined}), but that did not do anything. can.route.attr({plant : 1, day : null}) just resulted in #!plant/1/day/null. \n\nSo how do I \"reset\" the route to now \"know\" anything about which day it is?" ]
[ "javascript", "url-routing", "canjs", "canjs-routing" ]
[ "solve following regex", "Please consider the following text : \n\n String tempStr =\n \"$#<div style=\\\"text-align:left;\\\">$#Order-CAS No#$</div>$#abc#$\";\n\n Pattern p = Pattern.compile(\"(?<=\\\\$#)(\\\\w*)(?=#\\\\$)\");\n Matcher m = p.matcher(tempStr);\n\n List<String> tokens = new ArrayList<String>();\n while (m.find()) {\n System.out.println(\"Found a \" + m.group() + \".\");\n\n\nbut it give me just abc..i want answer as Order-CASNo and abc." ]
[ "java", "regex" ]
[ "EF Lazy load proxy interceptor", "I'm looking for a way to intercept Entity Framework's lazy load proxy implementation, or otherwise control what is returned when accessing a Navigation property that may have no value in the database. \n\nAn example of what I'm looking for is this Contact class with mailing address, business phone, etc. that may or may not have a contact person.\n\npublic partial class Contact\n{\n private Nullable<System.Guid> _personId;\n public Nullable<System.Guid> PersonId \n { \n get { return _personId; } \n set { SetProperty(ref _personId, value); } \n }\n\n public virtual Person Person{ get; set; }\n\n // mailing address, other properties...\n}\n\npublic partial class Person\n{\n private string _firstName;\n public string FirstName \n { \n get { return _firstName; } \n set { SetProperty(ref _firstName, value); } \n }\n\n private string _lastName;\n public string LastName \n { \n get { return _lastName;} \n set { SetProperty(ref _lastName;value); } \n }\n}\n\n\nIt is very useful in ASP.net Razor pages, WPF or ad-hoc reporting tools, to be able to use expressions like:\n\nContact c = repo.GetContact(id);\nConsole.WriteLine(\"Contact Person \" + c.Person.FirstName);\n\n\nWhich of course fails if there is no PersonId, and hence contact.Person is null.\n\nTools like Ideablade Devforce have a mechanism to return a \"NullEntity\" for Person in this case, which allows the WriteLine to succeed. Additionally, the NullEntity for Person can be configured to have a sensible value for FirstName, like \"NA\".\n\nIs there some way to override the Dynamic Proxy mechanism in EF, or otherwise intercept the reference to Person from Contact to enable this scenario?\n\nI have investigated IDbCommandInterceptor, but that does not seem to intercept virtual navigation to individual entity properties, only navigation to entity collections.\n\nUpdate _____________________________________\n\nTo elaborate on my original question, I can't modify the expression by introducing null conditional operators into the them, as these expressions are incorporated into WPF, ASP.Net Razor binding expressions, and/or report data fields, created by other developers or authors. Also, there may be multiple layers of null properties to deal with, e.g. Contact.Person.Spouse.FirstName, where either Person and/or Spouse might be a \"null\" property. The Devforce Ideablade implementation deals with this perfectly, but is unfortunately not an option on my current project." ]
[ "entity-framework", "entity-framework-6", "devforce" ]
[ "How to read new lines from a file as another process is appending them?", "So I have ffmpeg writing its progress to a text file, and I need to read the new values (lines) from the said file. How should I approach this using Qt classes in order to minimize the amount of code I have to write?\nI don't even have an idea where to start, other than doing ugly things like seeking to the end, storing this pos, then seeking to the end again a bit later and comparing the new pos to the previous one. It's unclear to me if QTextStream can be used here or not, for instance." ]
[ "qt", "qt5", "qfile", "qtextstream" ]
[ "Is It Possible To Transfer Session From HttpWebResponse To Browser?", "I need find some way to transfer the session value in the next order:\n\nWebApp1 (WebForms) -> WCF -> WebApp2 (WebForms / Browser)\n\nThe reason for this is because the WCF service must validate the request before this arrives to WebApp2 / Browser.\n\nBasically I need get the HTML and session through the WCF and then pass these to an Iframe in WebApp2\n\nI have the next code:\n\nWebApp1:\n\n-Default.aspx\n\nPublic Class _Default\n Inherits Page\n\n Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load\n\n Dim pUser As String = Request.QueryString(\"user\")\n\n If Not String.IsNullOrEmpty(pUser) Then\n System.Web.HttpContext.Current.Session(\"user\") = pUser\n End If\n\n Dim user As String = System.Web.HttpContext.Current.Session(\"user\")\n\n If String.IsNullOrEmpty(user) Then\n Response.Write(\"sesion no iniciada\")\n Else\n Dim a As String = \"<a href='http://localhost:64852/About.aspx'>ir a otra pagina</a>\"\n Response.Write(String.Format(\"{0} ha iniciado sesion {1} pagina 1\", user, a))\n End If\n End Sub\nEnd Class\n\n\n-About.aspx\n\nPublic Class About\n Inherits Page\n\n Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load\n\n Dim user As String = System.Web.HttpContext.Current.Session(\"user\")\n\n If String.IsNullOrEmpty(user) Then\n Response.Write(\"sesion no iniciada\")\n Else\n Dim a As String = \"<a href='http://localhost:64852/Default.aspx'>ir a otra pagina</a>\"\n Response.Write(String.Format(\"{0} ha iniciado sesion {1} pagina 2\", user, a))\n End If\n End Sub\nEnd Class\n\n\nWCF:\n\n-Service.svc (I'll skip the Interface for practicality)\n\nPublic Function abrirAplicacion(ByVal url As String, ByVal idPermiso As String, ByVal lenguaje As String) As System.IO.Stream Implements IServiceAAM.abrirAplicacion\n\n Dim r As String = url & \"idPermiso=\" & idPermiso & \"&lang=\" & lenguaje\n\n Return Utilities.Net.getHttpStream(r, \"GET\")\n 'WebOperationContext.Current.OutgoingResponse.ContentType = \"text/html\"\nEnd Function\n\n\n-The function Utilities.Net.getHttpStream\n\nFriend Shared Function getHttpStream(ByVal url As String, ByVal method As String, Optional ByVal request As String = \"\", Optional ByVal contentType As String = \"\") As System.IO.Stream\n\n url = \"http://localhost:64852/Default.aspx?user=diego\"\n Dim ba As Byte() = Encoding.Default.GetBytes(request)\n Dim lg As Integer = ba.Length\n Dim rq As HttpWebRequest = HttpWebRequest.Create(url)\n Dim cookies As New CookieContainer()\n\n With rq\n .ContentType = contentType\n .Method = method\n .Proxy = New WebProxy()\n .ContentLength = lg\n .CookieContainer = cookies\n End With\n\n If method <> \"GET\" Then\n Dim qs As Stream = rq.GetRequestStream()\n qs.Write(ba, 0, lg)\n qs.Flush()\n qs.Close()\n End If\n\n Dim qr As Stream\n\n Dim response As HttpWebResponse = rq.GetResponse()\n response.Cookies = cookies.GetCookies(rq.RequestUri)\n qr = response.GetResponseStream()\n\n Return qr\nEnd Function\n\n\nWebApp2:\n\nDim st As System.IO.Stream = oClient.abrirAplicacion(url, Server.UrlEncode(Encrypt(pIdPermiso)), lenguaje)\noClient.Close()\n\n'IframeApp.Attributes(\"src\") = url & \"idPermiso=\" & Server.UrlEncode(Encrypt(pIdPermiso)) & \"&lang=\" & lenguaje\n'IframeApp.Attributes(\"height\") = listSistema.First.tamano\nDim str As New System.IO.StreamReader(st)\nIframeApp.Attributes(\"srcdoc\") = str.ReadToEnd()\n\n\nThe problem is that returns plain text (no HTML) without any session" ]
[ "c#", "asp.net", "vb.net", "wcf", "session" ]
[ "Trigger Script Need Assistance", "I am looking for assistance in setting up a script trigger specifically based on when a Google Site list page is updated. I can only find triggers based on changes in a spreadsheet not a google site." ]
[ "triggers", "google-apps-script", "google-sites" ]
[ "pythonic way to wrap xmlrpclib calls in similar multicalls", "I'm writing a class that interfaces to a MoinMoin wiki via xmlrpc (simplified code follows):\n\nclass MoinMoin(object):\n token = None\n\n def __init__(self, url, username=None, password=None):\n self.wiki = xmlrpclib.ServerProxy(url + '/?action=xmlrpc2')\n if username and password:\n self.token = self.wiki.getAuthToken(username, password)\n # some sample methods:\n def searchPages(self, regexp):\n def getPage(self, page):\n def putPage(self, page):\n\n\nnow each of my methods needs to call the relevant xmlrpc method alone if there isn't authentication involved, or to wrap it in a multicall if there's auth. Example:\n\ndef getPage(self, page):\n if not self.token:\n result = self.wiki.getPage(page)\n else:\n mc = xmlrpclib.MultiCall(self.wiki) # build an XML-RPC multicall\n mc.applyAuthToken(self.token) # call 1\n mc.getPage(page) # call 2\n result = mc()[-1] # run both, keep result of the latter\n return result\n\n\nis there any nicer way to do it other than repeating that stuff for each and every method?\n\nSince I have to call arbitrary methods, wrap them with stuff, then call the identically named method on another class, select relevant results and give them back, I suspect the solution would involve meta-classes or similar esoteric (for me) stuff. I should probably look at xmlrpclib sources and see how it's done, then maybe subclass their MultiCall to add my stuff...\n\nBut maybe I'm missing something easier. The best I've come out with is something like:\n\ndef _getMultiCall(self):\n mc = xmlrpclib.MultiCall(self.wiki)\n if self.token:\n mc.applyAuthToken(self.token)\n return mc\ndef fooMethod(self, x):\n mc = self._getMultiCall()\n mc.fooMethod(x)\n return mc()[-1]\n\n\nbut it still repeats the same three lines of code for each and every method I need to implement, just changing the called method name. Any better?" ]
[ "python", "class", "methods" ]
[ "SQL Server 2008 Indexes for a relatively large table ( 700.000 rows )", "I have here a relatively big table with 700.000 records that I use a lot. I have two indexes on this table, Index1 is Orders and Index2 is DB_YEAR.\n\nThe selects I do in this table are like this \n\nselect * \nfrom bigtable \nwhere Order=:Order and DB_YEAR=:DB_YEAR\n\n\nNow this is quite fast, but I was thinking about speeding it up even more. I could use another 3rd Index Archived which could divide this table into 10.000 records with Archive 0 and the rest with Archive 1 .\n\nMy question is if I add this third index to this 700.000 row table. And do a select like this: \n\nselect * \nfrom bigtable \nwhere Order=:Order and DB_YEAR=:DB_YEAR and Archive=0\n\n\nwill it be faster? Will SQL only locate the 10.000 records first and then look there for the Order and DB_YEAR?\n\nThank you." ]
[ "sql-server-2008" ]
[ "How to specify workspace to use in command line", "I am trying to write a Powershell script where I may need to checkout items into different workspaces. How can I specify in the tf command which workspace to use?" ]
[ "powershell", "tfs" ]
[ "Running behat test under different browsers", "I want run behat tests in certain browsers so when I type something like this bin/behat firefox or bin/behat chrome or bin/behat opera tests should be run under respective browsers. Is it possible? If so, how should I modify my yml below or anything else? The reason I need such thing is that the selenium sometimes doesn't like some browsers based on its version.\n\nI read thru this post but I didn't quiet get it to apply to my behat.yml\n\nbehat.yml:\n\ndefault:\n context:\n class: Football\\LeagueBundle\\Features\\Context\\FeatureContext\n parameters:\n output_path: %behat.paths.base%/test/report/behat/output/\n screen_shot_path: %behat.paths.base%/test/report/behat/screenshot/\n extensions:\n Behat\\Symfony2Extension\\Extension:\n mink_driver: true\n kernel:\n env: test\n debug: true\n Behat\\MinkExtension\\Extension:\n base_url: 'http://symfony.local/app_test.php/'\n files_path: %behat.paths.base%/test/dummy/\n browser_name: firefox\n goutte: ~\n selenium2: ~\n paths:\n features: %behat.paths.base%/src\n bootstrap: %behat.paths.features%/Context\n\n\nexample feature\n\nFeature: Visit Home Page\n In order to see hello message\n As a user\n I should be able to visit home page\n\n #SUCCESS\n @javascript\n Scenario: I visit home page\n When I go to \"/\"\n Then I should see \"Hello Symfony!\"\n\n #FAIL\n @javascript\n Scenario: I visit home page\n When I go to \"/\"\n Then I should not see \"Hello Behat!\"" ]
[ "selenium", "behat", "mink" ]
[ "json data not showing", "i'm trying to connect mysql database server xampp to android studio,i wrote php code and when i run the code ,the result not showing anything.\nhere is my code:\n\nconnection.php\n\n<? php\ndefine ('hostname','localhost');\ndefine ('user','root');\ndefine ('password','1993');\ndefine ('dbname','mat');\n\n$connect = mysqli_connect(hostname,user,password,dbname);\n\n$mysqli->query(\"set character_set_server='utf8'\");\n$mysqli->query(\"set NAMES 'utf8'\");\n?>\n\n\nphp to fetch data from database:\n\nshow.php\n\n<?php\nif($_SERVER[\"REQUEST_METHOD\"]==\"POST\"){\ninclude 'connection.php';\nShowMat();\n}\n\nfunction ShowMat()\n{\nglobal $connect;\n\n$query = \"Select * from mat;\";\n$result = mysqli_query($connect, $query);\n$number_of_rows = mysqli_num_rows($result);\n\n$temp_array = array();\n\nif($number_of_rows > 0) {\n\nwhile ($row = mysqli_fetch_assoc($result))\n{\n$temp_array[] = $row;\n}\n\n\n}\nheader('Content-Type: application/json');\necho json_encode(array(\"mata\"=>$temp_array));\n\nmysqli_close($connect);\n}\n\n\n\n\nHow can I solve this?" ]
[ "php", "android" ]
[ "How to get signal sender type when using multi authorization providers?", "In my app I am using standard auth module and social auth plugin.\nI want to detect if user is registering via oauth or standard method\n\nI have function registered to post_save signal:\n\ndef create_user_profile(sender, instance, created, **kwargs):\n if created:\n key, expires = UserProfile.generate_activation_data()\n return UserProfile.objects.create(user=instance, activation_key=key, key_expires=expires)\n\npost_save.connect(create_user_profile, sender=User)\n\n\nBut when user is registered via oauth I would to avoid creating activation data, instead set some field indicated that user is register by oauth. \n\nCould someone give me any advice?" ]
[ "django", "django-authentication", "django-signals", "django-socialauth" ]
[ "Pagefile-backed memory-mapped files vs. Heap -- what's the difference?", "What is the advantage of using a memory-mapped file backed by the system paging file (through CreateFileMapping(INVALID_HANDLE_VALUE, ...), instead of just allocating memory from the heap the usual way (malloc(...), HeapAlloc(...), etc.)?\n\ni.e. When should I use which?" ]
[ "c++", "c", "winapi", "heap", "memory-mapped-files" ]
[ "Rails NoMethodError: undefined method `password_digest=", "I am new to rails and have seen all possible answers for my problem, as this is asked quite frequently by other developers, yet I'm unable to resolve it. Please have a look.\n\nI am getting this error when I try to add a data from the console \n\nUser.create(name: \"Michael Hartl\", email: \"[email protected]\", phone: \"0123456789\", password: \"foobar\", password_confirmation: \"foobar\")\n\n\nERROR SHOWN \n\nundefined method `password_digest=' for #<User:0x0000000375c788>\nDid you mean? password=\n\n\nController\n\n def create\n @candidate = User.new(user_params)\n if @candidate.save\n flash[:notice] = \"New Candidate Added Successfully\"\n redirect_to(users_path)\n else\n render('new')\n end\n end\n\n private\n\n def user_params\n #Whitelisting for strng parameters\n params.require(:user).permit(:name, :email, :password, :password_confirmation, :qualification, :college, :stream, :phone)\n end\n\n\nMigration:\n\nclass CreateUsers < ActiveRecord::Migration[5.1]\n def change\n create_table :users do |t|\n t.string :name, null: false\n t.boolean :admin_user, default: false\n t.string :email, null: false\n t.string :password_digest, null: false\n t.string :qualification\n t.string :college\n t.string :stream\n t.string :phone\n t.timestamps\n end\n end\nend\n\n\nModel\n\nrequire 'bcrypt'\nclass User < ApplicationRecord\n include BCrypt\n has_many :results, dependent: :destroy\n has_many :exams, through: :results\n accepts_nested_attributes_for :results\n\n VALID_EMAIL_REGEX = /\\A[\\w+\\-.]+@[a-z\\d\\-.]+\\.[a-z]+\\z/i\n\n before_save { self.email = email.downcase }\n\n has_secure_password\n\n validates :email, presence: true\n validates :email, presence: true, length: { maximum: 255 },format: { with: VALID_EMAIL_REGEX },uniqueness: { case_sensitive: false }\n validates :password, presence: true, length: { minimum: 6 }\n validates_confirmation_of :password\n validates_presence_of :password_confirmation\n validates :name, presence: true\n validates :phone, numericality: {only_integer: true}, length: {is: 10 , message: \"length should be 10\"} \n\n scope :visible, lambda { where(:visible => true) }\n scope :invisible, lambda { where(:visible => false) }\n scope :sorted, lambda { order(\"id ASC\") }\n scope :newest_first, lambda { order(\"created_at DESC\") }\n scope :search, lambda {|query| where([\"name LIKE ?\", \"%#{query}%\"]) }\n\n\nend" ]
[ "ruby-on-rails", "bcrypt" ]
[ "Counting duplicate ID", "I have two tables\nCREATE TABLE Customer\n(\n CustomerID VARCHAR\n)\n\nCREATE TABLE [Transaction]\n(\n TransactionID VARCHAR,\n CustomerID VARCHAR REFERENCES Customer.CustomerID\n)\n\nINSERT INTO Customer VALUES ('CO1')\nINSERT INTO Customer VALUES ('C02')\nINSERT INTO Customer VALUES ('C03')\n\nINSERT INTO [Transaction] VALUES ('T01', 'C01')\nINSERT INTO [Transaction] VALUES ('T02', 'C01')\nINSERT INTO [Transaction] VALUES ('T03', 'C01')\nINSERT INTO [Transaction] VALUES ('T04', 'C02')\nINSERT INTO [Transaction] VALUES ('T05', 'C02')\nINSERT INTO [Transaction] VALUES ('T06', 'C03')\n\nI want to select CustomerID, COUNT(TransactionID) where the customer has done more than one transactions, so it should be C01 and C02 that appear.\nHere's what I've come up with\nSELECT \n CustomerID, [Total Transaction] = COUNT(TransactionID)\nFROM\n Customer a\nJOIN \n [Transaction] b ON a.CustomerID = b.CustomerID\nWHERE \n (SELECT COUNT(TransactionID) \n FROM [Transaction] a \n JOIN Customer b ON a.CustomerID = b.CustomerID) > 1\nGROUP BY \n CustomerName\n\nThe problem is C03 keeps appearing so there must be some error on my subquery I don't know about" ]
[ "sql", "sql-server", "tsql" ]
[ "How do I deal with dots in MongoDB key names?", "I'm developing this piece of software in Node and MongoDB in which I essentially want to store versions of packages with the following structure:\n\n{\n \"versions\":\n {\n \"1.2.3\": { stuff }\n }\n}\n\n\n(similar to how npm does things in couch)\n\nThe issue is that when I updated MongoDB I discovered that it doesn't allow dots in key names (due to dot notation existing), causing my code to fail. After researching this, all I could find is that you need to transform the dots to some other character before storing in the db, then transform them back again when accessing. Is there really no better way to deal with this?\n\nIf there isn't, how can I do this transformation without copying the data over to another key and deleting the original?" ]
[ "javascript", "node.js", "mongodb" ]
[ "SQL Server : get average per week for the past 30 weeks", "I'm trying to figure out how to get the average CHECK_AMOUNT per week for the past/last 30 weeks in SQL Server 2008.\n\nI tried something like this (see below) but I I think that is for months and not for weeks. \n\nSELECT TOP 30\n AVG(CHECK_AMOUNT) AS W2 \nFROM \n CHECKS \nWHERE \n NOT UNT='256' \nGROUP BY \n YEAR(DATE_GIVEN), MONTH(DATE_GIVEN) \n\n\nCan anyone show me how I can make that possible please,\n\nThank you..." ]
[ "sql", "sql-server-2008" ]
[ "React 16 - ES6 - Webpack - Error: Module is not a loader (must have normal or pitch function)", "I have a react app written in ES6 code.\n\nI get this error after upgrading my react version (15.4.2 -> 16.4.0), along with react-hot-loader (1.3.1 -> 4.3.0).\n\nThis is my package.json before: \n\n\"dependencies\": {\n ...\n \"react\": \"^15.4.2\",\n \"react-bootstrap\": \"^0.30.7\",\n \"react-dom\": \"^15.4.2\",\n ...\n},\n\"devDependencies\": {\n ...\n \"react-hot-loader\": \"^1.3.1\",\n ...\n}\n\n\nThis is my package.json after: \n\n\"dependencies\": {\n ...\n \"react\": \"^16.4.0\",\n \"react-bootstrap\": \"^0.32.1\",\n \"react-dom\": \"^16.4.0\",\n ...\n},\n\"devDependencies\": {\n ...\n \"react-hot-loader\": \"^4.3.0\",\n ...\n}\n\n\nMy webpack version is set to : \"webpack\": \"^3.11.0\".\n\nMy webpack config is set to:\n\nmodule: {\n rules: [\n {\n test: /\\.js$/,\n use: ['react-hot-loader', 'babel-loader', 'eslint-loader'],\n exclude: /node_modules/,\n },\n ...\n ],\n},\n\n\nAfter I refreash my app, I get the following error message:\n\n\n Error: Module '...\\node_modules\\react-hot-loader\\index.js' is not a loader (must have normal or pitch function)\n\n\nHow can I get react-hot-loader to work again?" ]
[ "javascript", "reactjs", "webpack", "babeljs", "react-hot-loader" ]
[ "How to get AngularJS Login form post reqest", "Given the AngularJS example login form here, how can I know what post request is it sending when I click the Login button?\n\nI try to use Chrome's Developer Tools Network tab, but all I got is a GET request.\n\nThanks!" ]
[ "angularjs", "google-chrome" ]
[ "Issue with Javascript Intl.NumberFormat", "Can someone please explain why the following code does not work unless I hard code the json? I would like to be able to swap various locale, currency values in.\n\n<html>\n<body>\n<script>\n\n currency = 'GBP';\n locale = 'en-GB';\n\n var json = `{ style: 'currency', currency: '${currency}', minimumFractionDigits: 0, maximumFractionDigits: 0 }`;\n console.log(json);\n cf = new Intl.NumberFormat(locale, json);\n document.write(cf.format(1887732.233) + \"<br>\");\n\n</script>\n</body>\n</html>" ]
[ "javascript", "currency" ]
[ "Find the length of the longest substring", "I see questions similar like this ones, but eventually, for different programming languages. I'm trying to solve this little problem:\n\n\n Given a string, find the length of the longest substring without\n repeating characters. For example, the longest substring without\n repeating letters for abcabcbb is abc, which the length is 3. For\n bbbbb the longest substring is b, with the length of 1.\n\n\nI don't need the anwer to it but why what I have so far fails in the second iteration.\n\n1> longest_substring:main(\"abcabcbb\").\nH: 97, T: \"bcabcbb\", Sub: []\nIs 97 in []? false\nH: 98, T: \"cabcbb\", Sub: 97\n** exception error: no function clause matching string:chr(97,98,1) (string.erl, line 99)\n in function longest_substring:process/2 (src/leetcode/algorithms/longest_substring.erl, line 28)\n2>\n\n\nThis is the source code:\n\n-module(longest_substring).\n\n-export([main/1]).\n\n-spec main(S :: string()) -> string().\n\n%%%==================================================================\n%%% Export\n%%%==================================================================\nmain(S) -> process(S, \"\").\n\n%%%==================================================================\n%%% Internal\n%%%==================================================================\nprocess([], Sub) -> string:len(Sub);\nprocess([H | T], Sub) ->\n io:format(\"H: ~w, T: ~p, Sub: ~p~n\", [H, T, Sub]),\n Found = string:chr(Sub, H),\n io:format(\"Is ~w in ~p? ~p~n\", [H, Sub, Found =/= 0]),\n % Don't know how to make this `if` thing better...\n if\n Found > 0 -> process(T, H);\n _ -> process(T, string:concat(Sub, H))\n end." ]
[ "erlang" ]
[ "CameraX - crash app on onPause() while recording video", "if minimize app while recording video - everything all right, but once I deploy the application, ерут getting this error:\n\nE/AndroidRuntime: FATAL EXCEPTION: CameraX-video encoding thread\nProcess: <pkgname>, PID: 12340\njava.lang.IllegalStateException\n at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method)\n at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:2698)\n at androidx.camera.core.VideoCapture.videoEncode(VideoCapture.java:604)\n at androidx.camera.core.VideoCapture$2.run(VideoCapture.java:348)\n at android.os.Handler.handleCallback(Handler.java:873)\n at android.os.Handler.dispatchMessage(Handler.java:99)\n at android.os.Looper.loop(Looper.java:214)\n at android.os.HandlerThread.run(HandlerThread.java:65)\n\n\nOr\n if I stopped recording on onPause videoCapture?.stopRecording(), then getting this error:\n\nE/AndroidRuntime: FATAL EXCEPTION: CameraX-\nProcess: <pkgname>, PID: 9489\njava.lang.IllegalStateException\n at androidx.core.util.Preconditions.checkState(Preconditions.java:96)\n at androidx.core.util.Preconditions.checkState(Preconditions.java:108)\n at androidx.camera.camera2.impl.Camera.openCaptureSession(Camera.java:874)\n at androidx.camera.camera2.impl.Camera.onUseCaseReset(Camera.java:625)\n at androidx.camera.camera2.impl.Camera$11.run(Camera.java:611)\n at android.os.Handler.handleCallback(Handler.java:873)\n at android.os.Handler.dispatchMessage(Handler.java:99)\n at android.os.Looper.loop(Looper.java:214)\n at android.os.HandlerThread.run(HandlerThread.java:65)\n\n\nHow right stop record video while minimize app???\n\nhere's my code:\nI collect configurations:\n\nCameraX.unbindAll()\n getDisplayMetrics()\n setPreviewConfig()\n\n when (typeCapture) {\n TYPE_IMAGE -> {\n setImageCapture()\n CameraX.bindToLifecycle(this, preview, imageCapture)\n }\n TYPE_VIDEO -> {\n setVideoCapture()\n CameraX.bindToLifecycle(this, preview, videoCapture)\n }\n }\n\n\nset videoConfig and videoCapture:\n\nval videoCaptureConfig = VideoCaptureConfig.Builder().apply {\n setLensFacing(lensFacing)\n setTargetAspectRatioCustom(screenAspectRatio)\n setTargetRotation(rotation)\n }.build()\n\n videoCapture = VideoCapture(videoCaptureConfig)\n\n\nthen I start recording video: \n\nvideoCapture?.startRecording(videoFile, \nCameraXExecutors.mainThreadExecutor(), recordListener)\n\n\non onPause() the errors I get are described above\n\nThanks" ]
[ "android", "android-camera2", "android-camerax", "android-mediacodec" ]
[ "How to decrypt a cakephp 3 cookie", "Assume that you have a cookie string like this:\n\nQ2FrZQ==.AAAAAAAAAAAABBBBBBBBBBBBBCCCCCCCCCCCCCCDDDDDDDDDDDDD\n\n\nHow can you decrypt this in cakephp 3 by using AES ?\n\nIt seems like Cake\\Utility\\Security::decrypt($cipher, $key, $hmacSalt = null) does it:\n\nhttp://book.cakephp.org/3.0/en/core-libraries/security.html#Cake\\Utility\\Security::decrypt\n\nBut what about the parameters ? hmacSalt is application's salt value, but what's the key value in second argument ?" ]
[ "php", "cookies", "cakephp-3.0" ]
[ "Server cannot read HTTPS POST request parameters using Retrofit2", "I'm trying to POST request to our AWS lambda server (https://) using Retrofit2 but the server cannot read the parameters I passed. But when I tried to use the same code pointing to our local network (http://) it works. Below is my code, please help.\n\nGradle Dependencies:\n\ncompile \"com.squareup.retrofit2:retrofit:2.3.0\"\ncompile \"com.squareup.retrofit2:converter-gson:2.3.0\"\ncompile 'com.squareup.okhttp3:logging-interceptor:3.10.0'\n\n\nRequest Class:\n\npublic class LoginRequest {\n\n @SerializedName(\"login_credential\")\n private String credential;\n @SerializedName(\"password\")\n private String password;\n\n public LoginRequest(String credential, String password) {\n this.credential = credential;\n this.password = password;\n }\n}\n\n\nRetrofit initialization:\n\npublic class ServerClient {\n\n public static Login getClient() {\n HttpLoggingInterceptor logger = new HttpLoggingInterceptor();\n logger.setLevel(HttpLoggingInterceptor.Level.BODY);\n OkHttpClient client = new OkHttpClient.Builder()\n .addInterceptor(logger)\n .build();\n\n Retrofit retrofit = new Retrofit.Builder()\n .baseUrl(\"https://my.server.ap-southeast-1.amazonaws.com/dev/\")\n .client(client)\n .addConverterFactory(GsonConverterFactory.create())\n .build();\n\n return retrofit.create(Login.class);\n }\n\n public interface Login {\n @Headers(\"Accept: application/json\")\n @POST(\"login\")\n Call<LoginResponse> login(@Body LoginRequest request);\n }\n\n}\n\n\nThe way I trigger the request:\n\nCall<LoginResponse> call = ServerClient.getClient().login(new LoginRequest(email, password));\n call.enqueue(new Callback<LoginResponse>() {\n @Override\n public void onResponse(@NonNull Call<LoginResponse> call, @NonNull Response<LoginResponse> response) {\n if (response.body() != null) {\n Log.e(\"response\", \"success\");\n }\n }\n\n @Override\n public void onFailure(@NonNull Call<LoginResponse> call, @NonNull Throwable t) {\n Log.e(\"response\", \"failed\");\n }\n });\n\n\nHere's the log:\n\nD/OkHttp: --> POST https://my.server.ap-southeast-1.amazonaws.com/dev/login\nD/OkHttp: Content-Type: application/json; charset=UTF-8\nD/OkHttp: Content-Length: 69\nD/OkHttp: Accept: application/json\nD/OkHttp: {\"login_credential\":\"[email protected]\",\"password\":\"password\"}\nD/OkHttp: --> END POST (69-byte body)\n\nD/OkHttp: <-- 400 https://my.server.ap-southeast-1.amazonaws.com/dev/login (966ms)\nD/OkHttp: content-type: application/json\nD/OkHttp: content-length: 138\nD/OkHttp: date: Wed, 07 Mar 2018 05:16:54 GMT\nD/OkHttp: x-amzn-requestid: c05224a1-21c6-11e8-b75f-3bdafa88fe40\nD/OkHttp: access-control-allow-origin: *\nD/OkHttp: x-amzn-remapped-content-length: 138\nD/OkHttp: x-amzn-trace-id: sampled=0;root=1-5a9f75c6-a3b5a7897c5b8f9b73dbb419\nD/OkHttp: x-cache: Error from cloudfront\nD/OkHttp: via: 1.1 0932afdebb722b4465fd681f0h67865a.cloudfront.net (CloudFront)\nD/OkHttp: {\nD/OkHttp: \"message\": {\nD/OkHttp: \"login_credential\": \"Missing required parameter in the JSON body or the post body or the query string\"\nD/OkHttp: }\nD/OkHttp: }\nD/OkHttp: <-- END HTTP (138-byte body)" ]
[ "android", "aws-lambda", "retrofit2" ]
[ "Idiomatic way to write a method that operates on a generic type", "What's the idiomatic way to write a method that operates on a \"generic\" array?\n\nI have a typed array:\n\na := make([]int, 0)\n\n\nI want to write a simple method that could operate on an array of any type:\n\nfunc reverse(a []interface{}) []interface{} {\n for i, j := 0, len(a)-1; i < j; i, j = i+1, j-1 {\n a[i], a[j] = a[j], a[i]\n }\n return a\n}\n\n\nUsing this method a = reverse(a) gives me 2 errors:\n\ncannot use a (type []int) as type []interface {} in argument to reverse\ncannot use reverse(a) (type []interface {}) as type []int in assignment" ]
[ "go", "generics", "slice", "go-2" ]
[ "Smooth scroll in iOS web browsers", "I recently wanted to use scroll-behavior: smooth CSS rule or any other form of the same (eg. scrollTo with behavior: smooth) in a web app on iOS but this scroll option is apparently not exposed by the platform, so it is in effect unavailable in any of the browsers like Safari or Chrome for iOS.\n\nWhy isn’t this option allowed? Is there any philosophy behind that decision? Or is maybe implementation of this feature on the roadmap already (I didn’t find it)? I found that smooth scroll as an option is implemented in WebKit, but couldn’t find any info on why Apple doesn’t allow you to use it." ]
[ "ios", "browser", "scroll" ]
[ "Devise - sign in by email OR username", "I've done all of the this tutorial: Devise wiki\n\nBut when I try to log in I get error in the browser:\n\nSQLite3::SQLException: no such column: users.login: SELECT \"users\".* FROM \"users\" WHERE \"users\".\"login\" = 'jan12345' ORDER BY \"users\".\"id\" ASC LIMIT 1\n\n\nWhere could be a problem? How to debug this?\n\nI don't have login field on the users table but I have username field.\n\nMy model file:\n\nclass ApplicationController < ActionController::Base\n # Prevent CSRF attacks by raising an exception.\n # For APIs, you may want to use :null_session instead.\n attr_accessor :login\n protect_from_forgery with: :exception\n\n before_action :configure_permitted_parameters, if: :devise_controller?\n\n protected\n\n def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:username, :email, :password, :password_confirmation, :remember_me, :first_name, :last_name, :expiration_date) }\n devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:login, :username, :email, :password, :remember_me) }\n end\nend" ]
[ "ruby-on-rails", "ruby-on-rails-4", "devise" ]
[ "Why is CSS file canceled?", "I'm doing a simple node project to practice but i can't manage to serve html file with its css styles. I asked the same question before on SO but I didn't mention that the status of css file was \"canceled\" in the developer tools. When I edited it nobody answered about why it is canceled, so i wish someone help me with this. It is making me crazy.\nHere is my app.js code:\n app.use(\"/signup\", express.static(\"public\"));\n\napp.get(\"/\", (req, res)=>{\n res.send(\"Welcome to our website\");\n});\n\napp.get(\"/signup\", (req, res)=>{\n res.sendFile(`${__dirname}/index.html`)\n})\n\n\nHere is my html code: \n\n<head>\n <title>testapp</title>\n <link href=\"./public/styles.css\" type=\"text/css\" rel=\"stylesheet\"/>\n</head>\n<body>\n <form method=\"post\" action=\"/signup\">\n <input type=\"text\" placeholder=\"*First Name\" required></input>\n <input type=\"text\" placeholder=\"*Last Name\" required></input>\n <input type=\"number\" placeholder=\"*Age\" required></input>\n <input type=\"email\" placeholder=\"*Email\" required></input>\n <input type=\"submit\" value=\"Submit\" required></input>\n </form>\n</body>\n\n\nWhen I remove the get method of \"/signup\", and put my index.html in the public directory while updating the link to css, it works just fine, but i don't want it in the '/' route. And also when opening the index.html file without the localhost, it works fine.\nI searched about it and found someone who had kind of the same issue asked about on SO, I think that the answers aren't right in my case, i'm not sure and i didn't understand well.What does status=canceled for a resource mean in Chrome Developer Tools?.\n\nThank you in advance." ]
[ "html", "css", "node.js", "express" ]
[ "How to filter a select nodeset with a PHP function?", "I wonder if and how it is possible to register a PHP userspace function with the XSLT processor that is able not only to take an array of nodes but also to return it?\n\nRight now PHP complains about an array to string conversion using the common setup:\n\nfunction all_but_first(array $nodes) { \n array_shift($nodes);\n shuffle($nodes);\n return $nodes;\n};\n\n$proc = new XSLTProcessor();\n$proc->registerPHPFunctions();\n$proc->importStylesheet($xslDoc);\n$buffer = $proc->transformToXML($xmlDoc);\n\n\nThe XMLDocument ($xmlDoc) to transform can for example be:\n\n<p>\n <name>Name-1</name>\n <name>Name-2</name>\n <name>Name-3</name>\n <name>Name-4</name>\n</p>\n\n\nWithin the stylesheet it's called like this:\n\n<xsl:template name=\"listing\">\n <xsl:apply-templates select=\"php:function('all_but_first', /p/name)\">\n </xsl:apply-templates>\n</xsl:template>\n\n\nThe notice is the following:\n\n\n Notice: Array to string conversion\n\n\nI don't understand why if the function gets an array as input is not able to return an array as well?\n\nI was also trying other \"function\" names as I've seen there is php:functionString but all tried so far (php:functionArray, php:functionSet and php:functionList) did not work.\n\nIn the PHP manual it's written I can return another DOMDocument containing elements, however then those elements aren't from the original document any longer. That does not make much sense to me." ]
[ "php", "xslt" ]
[ "Render issue for Symbol(react.element) type in React", "I am trying to render one variable inside a function which is of Symbol(react.element) type:\n\nconsole statement of variable.\n{$$typeof: Symbol(react.element), type: \"844.444.4410\", key: null, ref: null, props: {…}, …}\n$$typeof: Symbol(react.element)\nkey: null\nprops: {}\nref: null\ntype: \"844.444.4410\"\n_owner: FiberNode {tag: 0, key: null, stateNode: null, elementType: ƒ, type: ƒ, …}\n_store: {validated: false}\n_self: null\n_source: null\nproto: Object\n\nI want to render the value which is inside type property. I used ReactHtmlParser but not working." ]
[ "reactjs" ]
[ "ngbBootstrap DatePicker Configuration Set firstDayOfWeek", "I'm trying to configure the ngbBootstrap datepicker to use Sunday as the first day of the week. Seems like this should be super simple according to the docs. I am using NgbBootstrap v1.1.2, but the documentation in code is the same as the current docs:\n\n\n Configuration service for the NgbDatepicker component. You can inject this service, typically in your root component, and customize the values of its properties in order to provide default values for all the datepickers used in the application.\n\n\nimport { NgbDatepickerConfig } from '@ng-bootstrap/ng-bootstrap';\n\n@Component({\n selector: 'app-root',\n templateUrl: './app.component.html',\n styleUrls: ['./app.component.scss']\n})\nexport class AppComponent implements OnInit {\n //...\n\n constructor(\n private ngbDatepickerConfig: NgbDatepickerConfig\n ) {\n ngbDatepickerConfig.firstDayOfWeek = 7;\n }\n\n //...\n}\n\n\nAny ideas why it's still set to Monday?\n\nUpdate\n\nSeems to work if I override the service defaults:\n\n{\n provide: NgbDatepickerConfig,\n useClass: class Test {\n dayTemplate: TemplateRef<DayTemplateContext>;\n dayTemplateData: (date: NgbDateStruct, current: { year: number, month: number }) => any;\n footerTemplate: TemplateRef<any>;\n displayMonths = 1;\n firstDayOfWeek = 7;\n markDisabled: (date: NgbDateStruct, current: { year: number, month: number }) => boolean;\n minDate: NgbDateStruct;\n maxDate: NgbDateStruct;\n navigation: 'select' | 'arrows' | 'none' = 'select';\n outsideDays: 'visible' | 'collapsed' | 'hidden' = 'visible';\n showWeekdays = true;\n showWeekNumbers = false;\n startDate: { year: number, month: number };\n }\n}" ]
[ "angular", "ng-bootstrap" ]
[ "How to set GIT_DIR & GIT_WORK_TREE when maintaining multiple repositories", "Much like this SO post, I have the following workflow that i would like to maintain with git:\n\n\nMultiple people develop locally \nCommit a few things \nCommit more things \nPush to Staging \nTest new code on Staging \nPush to Production\n\n\nOur staging server serves many different sites. I would like to set up the repository for each in a different folder in a user's home directory. Each repository will have a post-receive hook (ala the Daniel Messier article) that checks out the changes into the web root for that site/repository.\n\nIt's number six that is giving me trouble. \n\nWhen I try to run any git commands, I get the error \"fatal: This operation must be run in a work tree\". I get this error whether I am running 'git status' from the repository (/home/gituser/website1.git - which I don't believe should work anyway..) or from the web root (/var/www/website1). \n\nHowever, if I specify the GIT_DIR and GIT_WORK_TREE, then I am able to run git commands. Both of these work:\n\n$ git --git-dir /home/gituser/website1.git --work-tree /var/www/website1 status\n$ GIT_DIR=/home/gituser/website1.git GIT_WORK_TREE=/var/www/website1 git status \n\n\nSo I need:\n\n\nAn alternative to typing the directory and work tree along with every command\nAn alternative to setting them as persistent environment variables, because that would only work for website1, not website2, website3, etc\n\n\nAm I going about this correctly? How can I get git the directory info it needs for each repository?" ]
[ "git", "repository" ]
[ "Exluding files from updating in composer.json", "I have a magento 2 deployment script with capistrano.\nHow to exclude files from replacing during composer create-project command?" ]
[ "composer-php", "magento2" ]
[ "Opencv_createsamples fails with segmentation fault", "I am currently trying to make a HAAR classifier. I have made an annotation file and have done everything as described in the official openCV tutorial: https://docs.opencv.org/3.3.0/dc/d88/tutorial_traincascade.html . \nHowever, when I try to create the samples with opencv_createsamples, I get an error. My command:\n\n opencv_createsamples -vec /some_dirs/samples/samples.vec -info /some_dirs/annotations/annotations.dat -w 8 -h 8 -num 100 \n\nThe error:\n\n Info file name: /home/nikifaets/code/pointsProcessing/annotations/annotations.dat\nImg file name: (NULL)\nVec file name: /home/nikifaets/code/pointsProcessing/samples/samples.vec\nBG file name: (NULL)\nNum: 100\nBG color: 0\nBG threshold: 80\nInvert: FALSE\nMax intensity deviation: 40\nMax x angle: 1.1\nMax y angle: 1.1\nMax z angle: 0.5\nShow samples: FALSE\nWidth: 8\nHeight: 8\nMax Scale: -1\nRNG Seed: 12345\nCreate training samples from images collection...\nOpenCV Error: Assertion failed (ssize.width > 0 && ssize.height > 0) in resize, file /build/opencv/src/opencv-3.4.0/modules/imgproc/src/resize.cpp, line 4044\nterminate called after throwing an instance of 'cv::Exception'\n what(): /build/opencv/src/opencv-3.4.0/modules/imgproc/src/resize.cpp:4044: error: (-215) ssize.width > 0 && ssize.height > 0 in function resize\n\nAborted (core dumped)\n\n\nHowever, if I try to do only two samples (no idea why exactly 2...), it runs and creates the .vec file, although my dataset includes about 300-400 pictures.\n\nPastebin of annotations.dat\n\nThank you in advance for the support!" ]
[ "linux", "opencv", "image-recognition", "training-data", "haar-classifier" ]
[ "Match input field with pattern", "Im using a java script method to check if fields are valid so that the form can continue. This works fine until it gets to the post code because that has to be a specific pattern .\n\nIs there anyway to check if the value of the field matches the pattern and then allow the form to continue.\n\nAs you can see , its set to only let the form progress if the lengths are greater than 0 , which is not good for the form , but worse for the postcode part.\n\nJavascript:\n\nfunction processPhase2(){\nhouseN = _(\"Hnumber\").value;\nlineone = _(\"Caddress1\").value;\nlinetwo = _(\"Caddress2\").value;\ncityC = _(\"Ccity\").value;\ncountyC = _(\"Ccounty\").value;\npostalcodeC = _(\"Cpostalcode\").value;\nif(houseN.length > 0 && lineone.length > 0 && cityC.length > 0 && countyC.length > 0 && postalcodeC.length > 0){\n _(\"phase2\").style.display = \"none\";\n _(\"phase3\").style.display = \"block\";\n _(\"progressBar\").value = 66;\n _(\"status\").innerHTML = \"Phase 3 of 3\";\n} else {\n\n}\n\n\n}\n\nInput field:\n\n <label for=\"postalcode\">Postal Code</label>\n<input type=\"text\" name=\"Cpostalcode\" id=\"Cpostalcode\" size=\"20\" required pattern=\"[A-Za-z]{1,2}[0-9Rr][0-9A-Za-z]? [0-9][ABD-HJLNP-UW-Zabd-hjlnp-uw-z]{2}\" placeholder=\"eg: W1C 8LT\" title=\"Must match pattern\">" ]
[ "javascript", "html" ]
[ "Extract SQL Query with Python", "SELECT [Date]\n ,[Time]\n ,[Date_B]\n ,[A]\n ,[B]\nFROM [ZEN].[dbo].[test]\nwhere ([Date] between '2012-01-01' and '2013-12-31') \nand ([Time] between '10:00:00' and '12:30:00') \nand (((DATEDIFF (day, Date, Date_B) < 20)\nand (DATEDIFF (day, Date, Date_B) > 5)\nand ([A] = 'X'))\nor ([B] = 'Y'))\n\n\nIs it possible to extract this Query (SQL 2017) with Python?\n\nI´ve tried with pyodbc, but my code doesn´t work. \n\nimport pyodbc \na = pyodbc.connect(\"Driver={SQL Server Native Client 11.0};\"\n \"Server=server_name;\"\n \"Database=ZEN;\"\n \"Trusted_Connection=yes;\")\n\n\ncursor = a.cursor()\ncursor.execute('SELECT [Date] ,[Time] ,[Date_B] ,[A] ,[B] FROM ZEN where ([Date] between '2012-01-01' and '2013-12-31' and ([Time] between '10:00:00' and '12:30:00') and (((DATEDIFF (day, Date, Date_B) < 20) and (DATEDIFF (day, Date, Date_B) > 5) and ([A] = 'X')) or ([B] = 'Y')))')" ]
[ "python", "sql" ]
[ "Discussion on the implementation of read function for a 2D BIT", "I recently read about 2D Binary Indexed Trees from\n ( http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=binaryIndexedTrees) \n\nin order to solve a question on Codeforces,\n ( http://codeforces.com/problemset/problem/341/D )\nAs can be seen , the question looks for intermixed Update and Read Operations on a 2 Dimensional fixed size array. \n\nWhile implementing the functions for the 2D BIT, I implemented the read function by myself, and found the update function on Topcoder. \n\nIn the read function, I have applied the extension to a 1D BIT by reading the tree (of responsibility ) at that point to get a cumulative frequency from (1,1) uptil (x,y), and then in order to remove the values not required, I repeatedly XOR with the rectangular portions whose values I do not require inorder to eliminate them. \n\nThe regions in choice 1 , I read are the subrectangle (1,1,x1,y1), which I subsequently then XOR with all values within the two subrectangles (1,1,x0-1,y1) and (1,1,x1,y0-1). The 2 subrectangles are themselves being subjected to read operations. Then since the subrectangle (1,1,x0-1,y0-1) is being XORed an odd number of times, I XOR the result with a final read operation to (1,1,x0-1,y0-1). This according to me should be the standard approach to this problem. Where am I faltering in this, and more importantly am I implementing any functon incorrectly?\n\nPlease throw some insight into any error, as I am not making any headway. \n\nP.S.: When I display the tree[][] , it is displaying correctly, I am not getting why is the answer being reported incorrect.\n\nThe link to my solution ( at ideone ) is : http://ideone.com/vJIxHZ\n\nand the attached code is:\n\n#include <bits/stdc++.h>\n#define ll long long int\nll tree[1002][1002];\nusing namespace std;\nll read(ll x,ll y,ll n)\n{\n ll sum=0;\n while(x>0 )\n {\n ll y1=y;\n while(y1>0)\n {\n sum ^= tree[x][y1];\n y1-=(y1&-y1);\n }\n x-=(x&-x);\n }\n return sum;\n}\nvoid update(ll x , ll y , ll val, ll n){\n ll y1;\n while (x <= n){\n y1 = y;\n while (y1 <= n){\n tree[x][y1] ^= val;\n y1 += (y1 & -y1); \n }\n x += (x & -x); \n }\n}\nint main() {\n // your code goes here\n #define int long long int\n int n,m,x0,y0,x1,y1,v;\n //scanf(\"%I64d%I64d\",&n,&m);\n cin>>n>>m;\n/* for(int i=0;i<=n;i++)\n for(int j=0;j<=n;j++)\n {\n tree[i][j]=0;\n } */\n while(m--)\n {\n int choice;\n //scanf(\"%I64d\",&choice);\n cin>>choice;\n if(choice==1)\n {\n //scanf(\"%I64d%I64d%I64d%I64d\",&x0,&y0,&x1,&y1);\n cin>>x0>>y0>>x1>>y1;\n cout<<(read(x1,y1,n)^read(x0-1,y1,n)^read(x1,y0-1,n)^read(x0-1,y0-1,n))<<\"\\n\";\n //printf(\"%I64d\\n\",\n }\n else\n {\n // scanf(\"%I64d%I64d%I64d%I64d%I64d\",&x0,&y0,&x1,&y1,&v);\n cin>>x0>>y0>>x1>>y1>>v;\n update(x0,y0,v,n);\n update(x0,y1+1,v,n);\n update(x1+1,y0,v,n);\n update(x1+1,y1+1,v,n);\n }\n }\n/* for(int i=0;i<=n;i++)\n {\n for(int j=0;j<=n;j++)\n {\n cout<<read(i,j,n)<<\" \";\n\n }\n cout<<\"\\n\";\n } */\n return 0;\n}" ]
[ "c++", "arrays", "algorithm", "data-structures", "language-agnostic" ]
[ "iOS Unit testing with specta on AWS device farm", "I'm using today specta to do unit tests.\nI'm want to start using AWS device farm but when I try to upload the xctest folder it doesn't work.\nMy first fought it that it becouse I'm using specta. \nDo you know if this might be the problem?\nMaybe someone know if it is possible to convert all my test to KIF that is supported by amazon?\n\nThank you" ]
[ "ios", "unit-testing", "kif", "aws-device-farm", "specta" ]
[ "How to use this library called bezierjs?", "I have a canvas draw that has curves and I want to know the size of it like one of the examples of this library.\n\nhttps://github.com/Pomax/bezierjs\n\nExample: Size of a curve\n\nHow can I combine your example with my canvas draw?\n\nThis is my javascript code:\n\n<script type=\"text/javascript\">\nvar canvas=document.getElementById(\"canvas\");\nvar ctx=canvas.getContext(\"2d\");\n\nc_size = 650;\n\nctx.canvas.width = c_size;\nctx.canvas.height = c_size;\n\nctx.beginPath();\nctx.strokeStyle = 'blue';\nctx.moveTo(535,105);\nctx.quadraticCurveTo(585,44,620,115);\nctx.quadraticCurveTo(628,155,643,155);\nctx.quadraticCurveTo(628,195,643,360);\nctx.lineTo(550,368);\nctx.lineTo(538,302);\nctx.lineTo(552,285);\nctx.quadraticCurveTo(528,195,535,105);\nctx.stroke();\n</script>\n<canvas id='canvas' width='650' height='650' style=\"border: 1px solid #000\">\nCanvas not supported\n</canvas>" ]
[ "javascript", "html", "canvas", "bezier" ]
[ "Can't load CSS to my django local website", "I am running through django tutorial on book \"Try Django\".\nEverything was ok until CSS chapter. I have created basic site and now I want to change some colors but I am unable to do it.\n\nDjango 1.10. I have created directory in my app 'static' and inside is file 'style.css' with some basic instruction to change color of h1 text.\n\nInside settings.py I have: \n'django.contrib.staticfiles' and my app installed,\nDebug is True,\nSTATIC_URL = '/static/'\n\nhtml of site: http://pastebin.com/PBhZieRe\n\nUnfortunately h1 text is still black.\nI tried to read through documentation on https://docs.djangoproject.com/en/1.10/howto/static-files/ but everything looks ok there.\nWhen I simply type url 127.0.0.1:8000/static/style.css in my command line I get 304 code.\n\nNeed some advice on that.\n\nRegards." ]
[ "html", "django" ]
[ "How to convert Unicode to Preeti (ASCII) using javascript or php?", "I am new to javascript and recently joined Bachelor.In my first semester,I was given project to convert Unicode to Preeti (Nepali font) which is ASCII code.The Dictionary for conversion was listed as :\n\nunicodeToPreetiDict = \\\n\n{\n \"अ\": \"c\",\n \"आ\": \"cf\",\n \"ा\": \"f\",\n \"इ\": \"O\",\n \"ई\": \"O{\",\n \"र्\": \"{\",\n \"उ\": \"p\",\n \"ए\": \"P\",\n \"े\": \"]\",\n \"ै\": \"}\",\n \"ो\": \"f]\",\n \"ौ\": \"f}\",\n \"ओ\": \"cf]\",\n \"औ\": \"cf}\",\n \"ं\": \"+\",\n \"ँ\": \"F\",\n \"ि\": \"l\",\n \"ी\": \"L\",\n \"ु\": \"'\",\n \"ू\": '\"',\n \"क\": \"s\",\n \"ख\": \"v\",\n \"ग\": \"u\",\n \"घ\": \"3\",\n \"ङ\": \"ª\",\n \"च\": \"r\",\n \"छ\": \"5\",\n \"ज\": \"h\",\n \"झ\": \"´\",\n \"ञ\": \"`\",\n \"ट\": \"6\",\n \"ठ\": \"7\",\n \"ड\": \"8\",\n \"ढ\": \"9\",\n \"ण\": \"0f\",\n \"त\": \"t\",\n \"थ\": \"y\",\n \"द\": \"b\",\n \"ध\": \"w\",\n \"न\": \"g\",\n \"प\": \"k\",\n \"फ\": \"km\",\n \"ब\": \"a\",\n \"भ\": \"e\",\n \"म\": \"d\",\n \"य\": \"o\",\n \"र\": \"/\",\n \"रू\": \"?\",\n \"ृ\": \"[\",\n \"ल\": \"n\",\n \"व\": \"j\",\n \"स\": \";\",\n \"श\": \"z\",\n \"ष\": \"if\",\n \"ज्ञ\": \"1\",\n \"ह\": \"x\",\n \"१\": \"!\",\n \"२\": \"@\",\n \"३\": \"#\",\n \"४\": \"$\",\n \"५\": \"%\",\n \"६\": \"^\",\n \"७\": \"&\",\n \"८\": \"*\",\n \"९\": \"(\",\n \"०\": \")\",\n \"।\": \".\",\n \"्\": \"\\\\\",\n \"ऊ\": \"pm\",\n \"-\": \" \",\n \"(\": \"-\",\n \")\": \"_\"\n}\n\n\nLeft part of character is Unicode whereas right part is Preeti font maybe.\n\nYou can check the conversion after writing code in this sample site:\nhttp://unicode.shresthasushil.com.np/\n\nIf we give input as कलम (unicode),it must be converted to Preeti.I need source code in javascript or php to convert unicode to preeti." ]
[ "javascript", "php", "unicode" ]
[ "can't start android virtual devices after eclipse pachages update", "I don't have experience with Eclipse, but some time ago, I've followed some tutorials and I have successfully build 2 android applications. After 6 months of not using Eclipse, when I opened I had to make some updates, but my virtual devices doesn't start. I get the following message error:\n\n\n Adb connection Error:An existing connection was forcibly closed by the remote host\n Connection attempts: 1\n\n\nI've tried the following, but the end results are the same:\n- deleted and made new virtual device\n- reset adb from DDMS\n- adb kill-server from cmd\n\nI assume that I didn't install the right packages in Android SDK Manager." ]
[ "android", "eclipse", "android-emulator", "updates", "android-sdk-tools" ]
[ "Need fully transparent status bar", "Hi Friends I want to know can I change status bar color or make it completely transparent.\n\nI've tried so many things but I can't get the fully transparent status bar, so here is my code..\n\nv21/style.xml\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.NoActionBar\">\n <!-- Customize your theme here. -->\n <item name=\"colorPrimary\">@color/colorPrimary</item>\n <item name=\"colorPrimaryDark\">@color/colorPrimaryDark</item>\n <item name=\"colorAccent\">@color/colorAccent</item>\n\n <item name=\"android:windowTranslucentStatus\">true</item>\n\n <item name=\"android:windowNoTitle\">true</item>\n <item name=\"android:statusBarColor\">@android:color/transparent</item>\n <item name=\"android:windowTranslucentNavigation\">true</item>\n </style>\n</resources>\n\n\nand style.xml\n\n <resources>\n\n <!-- Base application theme. -->\n <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.NoActionBar\">\n <!-- Customize your theme here. -->\n <item name=\"colorPrimary\">@color/colorPrimary</item>\n <item name=\"colorPrimaryDark\">@color/colorPrimaryDark</item>\n <item name=\"colorAccent\">@color/colorAccent</item>\n\n </style>\n</resources>\n\n\nafter it my screen is displayed as...\n\n\nand I want it like this..\n\n\n\ncan anyone help?Thanks." ]
[ "android", "android-studio", "statusbar", "transparent" ]
[ "IndexError: list index out of range but the program working", "I need to change a nucleotide in a DNA. So I want to change DA to DG. I wrote the following program. The program is partially work but I am getting the following error:\n\nTraceback (most recent call last):\n File \"DNA.py\", line 18, in <module>\n if NUM != line.split()[5]:\nIndexError: list index out of range\n\n\nI know I have a problem in the following section but I can not find the reason. \n\nfor line in lines:\n if NUM != line.split()[5]:\n OT.writelines(line)\n\n\nI would be happy if you can let me know.\nThanks" ]
[ "python" ]
[ "Java - concurrent clear of the list", "I am trying to find a good way to achieve the following API:\n\nvoid add(Object o);\nvoid processAndClear();\n\n\nThe class would store the objects and upon calling processAndClear would iterate through the currently stored ones, process them somehow, and then clear the store. This class should be thread safe.\n\nthe obvious approach is to use locking, but I wanted to be more \"concurrent\". This is the approach which I would use:\n\nclass Store{\n private AtomicReference<CopyOnWriteArrayList<Object>> store = new AtomicReference<>(new CopyOnWriteArrayList <>());\n\n void add(Object o){\n store.get().add(o);\n }\n\n void processAndClear(){\n CopyOnWriteArrayList<Object> objects = store.get();\n store.compareAndSet(objects, new CopyOnWriteArrayList<>());\n for (Object object : objects) {\n //do sth\n }\n }\n}\n\n\nThis would allow threads that try to add objects to proceed almost immediately without any locking/waiting for the xlearing to complete. Is this the more or less correct approach?" ]
[ "java", "multithreading", "locking", "copyonwritearraylist" ]
[ "Read file line by line and do regex replace", "I've written a program that reads a text file into a variable, does a regex replace on the text, and writes it back to the file. Obviously this is not scalable for large text files; I want to be able to read the text file line-by-line and do a regex replace for a desired pattern.\n\nHere is my non-scalable code:\n\nstatic void Main(string[] args) {\n var fileContents = System.IO.File.ReadAllText(\"names.txt\");\n string pattern = \"Ali\";\n string rep = \"Tyson\";\n\n Regex rgx = new Regex(pattern);\n fileContents = rgx.Replace(fileContents, rep);\n\n System.IO.File.WriteAllText(\"names.txt\", fileContents);}\n\n\nI know how to use StreamReader for reading a file line-by-line but when I tried nest StreamWriter inside of StreamReader so I could write to the file while searching line-by-line I ran into an unhandled exception error.\n\nDoes anyone know how to solve this?" ]
[ "c#", "regex", "file-io", "scalability" ]
[ "AutocompleteSource in datagridviewtextBoxColumn", "I'm trying to add AutoCompleteSource in datagridViewtextBoxColumn. I'm trying two methods.In the first one i'm directly adding AutoCompleteSource to datagridViewColumn. And in the second i created a textBox on the desired cell and added AutocompleteCustome Source. But none of this working with no exception.\n\n private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)\n {\n DataGridViewCell cel = dataGridView1.CurrentCell;\n DataGridViewRow row = dataGridView1.CurrentRow;\n if (e.Control.GetType() == typeof(DataGridViewTextBoxEditingControl))\n {\n if (cel == row.Cells[1])\n {\n\n DataGridViewTextBoxEditingControl t = e.Control as DataGridViewTextBoxEditingControl;\n AutoCompleteStringCollection ccl = new AutoCompleteStringCollection();\n foreach (DataRow rw in bowoniDataSet17.item.Rows)\n {\n\n ccl.Add(rw.ToString());\n }\n t.AutoCompleteSource = AutoCompleteSource.CustomSource;\n t.AutoCompleteCustomSource = ccl;\n t.AutoCompleteMode = AutoCompleteMode.SuggestAppend;\n\n }\n\n }\n }\n TextBox tb = new TextBox();\n\n private void dataGridView1_KeyDown(object sender, KeyEventArgs e)\n {\n\n DataGridViewRow row = dataGridView1.CurrentRow;\n DataGridViewCell cel = dataGridView1.CurrentCell;\n Rectangle rect=dataGridView1.GetCellDisplayRectangle(dataGridView1.CurrentCell.ColumnIndex,dataGridView1.CurrentCell.RowIndex,true);\n tb.Size = new Size(rect.Width, rect.Height);\n tb.Location = new Point(rect.X, rect.Y);\n tb.TextAlignChanged += new EventHandler(tbtx_OnTextChanged);\n if (cel == row.Cells[1])\n {\n\n\n AutoCompleteStringCollection ccl = new AutoCompleteStringCollection();\n foreach (DataRow rw in bowoniDataSet17.item.Rows)\n {\n\n ccl.Add(rw.ToString());\n }\n tb.AutoCompleteSource = AutoCompleteSource.CustomSource;\n tb.AutoCompleteCustomSource = ccl;\n tb.AutoCompleteMode = AutoCompleteMode.SuggestAppend;\n\n }\n }\n\n private void tbtx_OnTextChanged(object sender, EventArgs e)\n {\n dataGridView1.CurrentCell.Value = tb.Text;\n }" ]
[ "c#" ]
[ "Testing REST web service client when the services don't yet exist", "I have already read the posts link text and link text but these are covering the use case of building a REST service on the server and requiring a rapid client in order to test those services.\n\nWe have the opposite problem, we are building a web client that will communicate to the server via REST, but the decision has been taken to let the client drive the format of the services on the server, this means the client is being implemented first and the services on the server second.\n\nI am trying to look for a tool which would allow me to very quickly knock up REST web services, which the client could then be tested against. Effectively mocking the server.\n\nDoes anyone know of such a tool?" ]
[ "javascript", "rest" ]
[ "Executing terminal command in objective C with Dynamic path", "May be my question is a repeated question but I searched a lot of it on the internet and can't find the appropriate and helpful solution.\nI want to run the terminal command 'mv' for moving a folder from the root '~/' to another folder but its not working command is running properly using the NSTask library but I think the path is not correct my xcode compiler doest find '~/Desktop',\n\nSample Code:\n\nNSTask *task = [[NSTask alloc]init];\n[task setLaunchPath:@\"/bin/mv\"];\n[task setArguments:@[ @\"~/Desktop/Script\",@\"~/Desktop/Script2\"]];\n[task launch];\n\n\nand it gives error:\n\nmv: rename ~/Desktop/Script to ~/Desktop/Script2: No such file or directory\n\n\nI think the '~/' is not working and xcode cant find the file,\nplease help\nThanks in advance" ]
[ "objective-c", "xcode", "terminal" ]
[ "Determine who call stateChanged", "I have a few sliders that look like this:\n\n//Create the slider\n JSlider speedSlider = new JSlider(JSlider.VERTICAL, MIN_SPEED, MAX_SPEED, initValue);\n speedSlider.addChangeListener(controller);\n speedSlider.setMajorTickSpacing(MAJOR_TICK_SPACING);\n speedSlider.setPaintTicks(true);\n\n panel.add(speedSlider);\n\n\nin my View.java class\n\nthere is Controller.java\n\npublic class Controller implements ControllerInterface {\n\n //...\n\n @Override\n public void stateChanged(ChangeEvent e) {\n JSlider source = (JSlider)e.getSource();\n if (!source.getValueIsAdjusting()) {\n int speed = (int)source.getValue();\n if (0 == speed) {\n // stop\n }\n else {\n model.setSpeedBody(speed);\n }\n }\n }\n}\n\n\nThe problem is that I can not determine from what it was exactly the slider event, how to do it?\n(ControllerInterface extends ChangeListener)" ]
[ "java", "swing", "model-view-controller", "actionlistener", "changelistener" ]
[ "Android: locationManager requestSingleUpdate working on one device but not on the other", "First of all: This is my first question on Stackoverflow so please tell me if i make any mistakes :)\n\nI want my Activity to get the users location everytime it is started. \nI don't need periodic updates so I try to use requestSingleUpdate.\nAfter following this tutorial:\nhttp://androidexperinz.wordpress.com/2012/04/19/current-location-update/\n\nIt worked perfectly on Samsung Galaxy S2 and Samsung Galaxy Tab 3 the first day, but when I tried it today the S2 doesn't load the location and the receiver never gets fired,\nalthough I didn't change my code and the settings are exactly the same. \nI also rebooted my phone and reinstalled the Application. \nStill no difference, but it is still working on the tablet.\n\nI noticed that there are many problems wit the Location API reported in different forums so could it be a bug in Google Location API similar to this:\nhttps://code.google.com/p/android/issues/detail?id=57707\n\nOr do I have problems with my settings or my code (posted below):\n\nProgressBar PBLoad;\n@Override \npublic void onStart()\n{\n super.onStart();\n boolean isGPSEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);\n ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);\n boolean dataConnection= cm.getActiveNetworkInfo()!=null;\n int resultCode =GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);\n if (!isGPSEnabled||!dataConnection||ConnectionResult.SUCCESS != resultCode) \n {\n //Show Dialog and ask user to enable GPS or Internet\n }\n else\n {\n registerReceiver(singleUpdateReceiver,new IntentFilter(SINGLE_LOCATION_UPDATE_ACTION));\n Intent updateIntent = new Intent(SINGLE_LOCATION_UPDATE_ACTION);\n singleUpatePI = PendingIntent.getBroadcast(this, 0, updateIntent, PendingIntent.FLAG_UPDATE_CURRENT);\n locationManager.requestSingleUpdate(LocationManager.GPS_PROVIDER, singleUpatePI);\n PBLoad.setVisibility(View.VISIBLE);\n }\n}\n\n\nAnd this is the receiver:\n\nprotected BroadcastReceiver singleUpdateReceiver = new BroadcastReceiver() \n{\n @Override\n public void onReceive(Context context, Intent intent) {\n context.unregisterReceiver(singleUpdateReceiver);\n String key = LocationManager.KEY_LOCATION_CHANGED;\n Location location = (Location)intent.getExtras().get(key);\n if (location != null) {\n onLocationReceived(location);\n }\n locationManager.removeUpdates(singleUpatePI);\n }\n};" ]
[ "android", "broadcastreceiver", "locationmanager", "updating" ]
[ "Im having problems in WordPress theme", "enter image description here\nstrong text**\nHello, I'm having a problem with my WooCommerce project. When I show a product on my page I have this error\n"Warning: Undefined array key "before_widget" \nin C:\\xampp\\htdocs\\thoitrang\\wp-content\\plugins\\elementor-addon-widgets\\vendor\\codeinwp\\elementor-extra-widgets\\widgets\\woo\\recent-products.php on line 76"\n\nThe code:\n if ( '' == $title ) {\n $title = __( 'New In', 'elementor-addon-widgets' );\n }\n\n $limit = ( ! empty( $instance['limit'] ) ) ? absint( $instance['limit'] ) : 4;\n if ( '' == $limit ) {\n $limit = 4;\n }\n $columns = ( ! empty( $instance['columns'] ) ) ? absint( $instance['columns'] ) : 4;\n\n if ( '' == $columns ) {\n $columns = 4;\n }\n\n $args = apply_filters(\n 'elementor-addon-widgets_product_categories_args', array(\n 'limit' => $limit,\n 'columns' => $columns,\n 'title' => $title,\n )\n );\n\n echo $args['before_widget']; // line 76" ]
[ "php", "wordpress", "woocommerce", "wordpress-shortcode" ]
[ "Getting inconsistent datatypes error while fetching data from ref cursor into a nested table", "I'm getting an error while fetching data from ref cursor into a nested table. Here is what I'm doing.\n\nObject and table types:\n\nCREATE OR REPLACE TYPE obj_report_org IS OBJECT\n(dummy1 VARCHAR2(50),\ndummy2 VARCHAR2(50),\ndummy3 VARCHAR2(50),\ndummy4 NUMBER(10));\n\nCREATE OR REPLACE TYPE tab_report_org IS TABLE OF obj_report_org;\n\n\nProcedure:\n\nCREATE OR REPLACE PROCEDURE areaReport_test(v_name1 VARCHAR2,\n v_name2 VARCHAR2, tab_report_set OUT tab_report_org)\nIS\n str VARCHAR2(2000);\n v_num NUMBER := 1;\n recordset SYS_REFCURSOR;\n lv_tab_report_set tab_report_org := tab_report_org();\nBEGIN\n\n str := ' SELECT tab2.dummy1 ,tab3.dummy2,tab2.dummy3,tab1.dummy4 '||\n ' FROM tab1,tab2, tab3, tab4'||\n ' WHERE <JOIN CONDITIONS>';\n\n OPEN recordset FOR \n str||' START WITH tab1.name = :name1'||\n ' CONNECT BY PRIOR tab1.id = tab1.parent_id'||\n ' UNION '||\n str||' START WITH tab1.name = :name2'||\n ' CONNECT BY PRIOR tab1.id = tab1.parent_id'\n USING v_name1,v_name2;\n\n FETCH recordset BULK COLLECT into lv_tab_report_set;\n\n CLOSE recordset;\n\n tab_report_set := lv_tab_report_set;\nEND;\n\n\nThen I have an anonymous block to call the procedure:\n\nDECLARE\n l_tab_report_set tab_report_org;\nBEGIN\n areaReport_test('PRASHANT',null,l_tab_report_set);\n FOR i in 1 .. l_tab_report_set.count\n LOOP\n DBMS_OUTPUT.PUT_LINE(\n l_tab_report_set(i).dummy1|| ' | ' ||\n l_tab_report_set(i).dummy2|| ' | ' ||\n l_tab_report_set(i).dummy3|| ' | ' ||\n l_tab_report_set(i).dummy4|| );\n END LOOP;\nEND;\n\n\nAfter running the anonymous block, I'm get this error:\n\nORA-00932: inconsistent datatypes: expected - got -\nORA-06512: at \"AREAREPORT_TEST\", line 36\nORA-06512: at line 5\n00932. 00000 - \"inconsistent datatypes: expected %s got %s\"\n\n\nIt seems we cannot bulk fetch data into nested table formed from a SQL object. While sequence of fields and datatypes in object match with select query.\n\nPlease advise." ]
[ "oracle", "collections", "plsql" ]
[ "delete row from database - syntax error", "I found this code that does exactly what i need\n\nhttp://www.daveismyname.com/tutorials/php-tutorials/delete-rows-from-a-mysql-database-with-a-confirmation/\n\nWhen i copy the code into a new dreamweaver php file, it states that there is a syntax error in this part:\n\n<?php\n$result = mysql_query(\"SELECT * FROM news\")or die(mysql_error());\nwhile($row = mysql_fetch_object($result))\n{\necho \"<ul>n\";\necho \"<li>$row->newsTitle <a href=\"javascript:delnews('$row->newsID','$row->newsTitle')\">Delete</a></li>n\";\necho \"</ul>n\";\n}\n?>\n\n\nmore specifically in the echo <li>$row line.\n\nif I try to upload it anyways it says:\n\n\n Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/asbj1076/public_html/testdel/admin.php on line 39\n\n\ni can save it as a html5 file without that syntax error, but the code still aint working properly.\n\nAny suggestions?\n\nI know there has been a lot of similar questions already, sorry for that.\nI'm just a noob who's in over my head, so i need really specific help.\n\nThanks. Asbjørn" ]
[ "php" ]
[ "Kotlin: How are a Delegate's get- and setValue Methods accessed?", "I've been wondering how delegated properties (\"by\"-Keyword) work under-the-hood. I get that by contract the delegate (right side of \"by\") has to implement a get and setValue(...) method, but how can that be ensured by the compiler and how can those methods be accessed at runtime? My initial thought was that obviously the delegates must me implementing some sort of \"SuperDelegate\"-Interface, but it appears that is not the case. So the only option left (that I am aware of) would be to use Reflection to access those methods, possibly implemented at a low level inside the language itself. I find that to be somewhat weird, since by my understanding that would be rather inefficient. Also the Reflection API is not even part of the stdlib, which makes it even weirder.\n\nI am assuming that the latter is already (part of) the answer. So let me furthermore ask you the following: Why is there no SuperDelegate-Interface that declare the getter and setter methods that we are forced to use anyway? Wouldn't that be much cleaner?\n\n\nThe following is not essential to the question\n\n\n\nThe described Interface(s) are even already defined in ReadOnlyProperty and ReadWriteProperty. To decide which one to use could then be made dependable on whether we have a val/var. Or even omit that since calling the setValue Method on val's is being prevented by the compiler and only use the ReadWriteProperty-Interface as the SuperDelegate.\n\nArguably when requiring a delegate to implement a certain interface the construct would be less flexible. Though that would be assuming that the Class used as a Delegate is possibly unaware of being used as such, which I find to be unlikely given the specific requirements for the necessary methods. And if you still insist, here's a crazy thought: Why not even go as far as to make that class implement the required interface via Extension (I'm aware that's not possible as of now, but heck, why not? Probably there's a good 'why not', please let me know as a side-note)." ]
[ "reflection", "delegates", "kotlin" ]
[ "Button Notification Android", "The purpose of the notification is to show a question to the user, and the user has two answer options, \"YES\" or \"NO\".\n\nThe problem is knowing which button the user has uploaded.\n\nOne other thing that I did not intend but that happens, is that the user is redirected to an activity, and I did not want that.\n\nIf it clicks one of the buttons it is redirected to MainActivty, and what I intend to do only this action is that mainActivity only receives any information about which button the user has uploaded, in order to make the necessary registrations. My intention is only that the user responds to the question without being redirected to anything.\n\nI leave here the piece of code where all this happens. I hope I have been as explicit as possible, and I wonder if what I have described above is possible.\n\npublic class MainActivity extends Activity {\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n ....\n int id = (int) System.currentTimeMillis();\n\n Calendar calendar = Calendar.getInstance();\n calendar.setTimeInMillis(System.currentTimeMillis());\n calendar.set(Calendar.DAY_OF_MONTH, 29);\n calendar.set(Calendar.MONTH, 5);\n calendar.set(Calendar.YEAR, 2017);\n calendar.set(Calendar.HOUR_OF_DAY, 17);\n calendar.set(Calendar.MINUTE, 38);\n calendar.set(Calendar.SECOND, 00);\n\n AlarmManager alarm = (AlarmManager) this.getSystemService(this.ALARM_SERVICE);\n\n Intent newintent = new Intent(this, Notification_Create.class);\n intent.putExtra(\"id\", id);\n PendingIntent pending = PendingIntent.getBroadcast(this, id, newintent, PendingIntent.FLAG_UPDATE_CURRENT);\n\n alarm.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pending);\n }\n}\n\npublic class Notification_Create extends BroadcastReceiver {\n @Override\n public void onReceive(Context context, Intent intent) {\n int id = extras.getInt(\"id\");\n\n Bundle extras = intent.getExtras();\n\n Intent intentTPC = new Intent(context, MainActivity.class);\n intentTPC.putExtra(\"id\", String.valueOf(id));\n PendingIntent resultPendingIntent =\n PendingIntent.getActivity(context,\n 0,\n intentTPC,\n PendingIntent.FLAG_CANCEL_CURRENT\n );\n NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)\n .setContentTitle(\"Student: \")\n .setContentText(\"Have work?\")\n .setContentIntent(resultPendingIntent)\n .setAutoCancel(true);\n mBuilder.setSmallIcon(R.drawable.ic_button);\n mBuilder.addAction(R.drawable.ic_button,\"YES\",resultPendingIntent);\n mBuilder.addAction(R.drawable.ic_button,\"NO\",resultPendingIntent);\n mBuilder.setPriority(Notification.PRIORITY_MAX);\n\n NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);\n mNotificationManager.notify(id, mBuilder.build());\n }\n}" ]
[ "java", "android", "android-notifications" ]
[ "Angular Tour of Heroes tutorial getHeroes() function", "I have a question regarding the getHeroes() functiion in the Heroes tutorial for Angular:\n\ngetHeroes(): void {\n this.heroService.getHeroes()\n .subscribe(heroes => this.heroes = heroes);\n }\n\n\ncan somebody explain to me what the syntax \"heroes => this.heroes = heroes\" is doing? I'm coming from java and python and have never seen such an expression\n\nthe same goes for this:\n\n<ul class=\"heroes\">\n <li *ngFor=\"let hero of heroes\"\n [class.selected]=\"hero === selectedHero\"\n (click)=\"onSelect(hero)\">\n <span class=\"badge\">{{hero.id}}</span> {{hero.name}}\n </li>\n</ul>\n\n\nwhat is [class.selected]=\"hero === selectedHero\" doing?" ]
[ "angular" ]
[ "Can I keep the application settings when updating with installshield?", "I finally managed to get my application updating through installshield LE, without the user having to uninstall manually first, what I am now wondering is:\n\n\nCan I get the installer to use the application settings from the previous install, so the users saved settings don't change, causing the user to enter their settings every time there is an update. But at the same time, add any new settings to the config file.\nIs there anyway to get the installer to not update certain files, for example, the database file is held in a folder called 'db' inside the program files directory, I obviously don't want the users database getting overwritten with a blank one.\n\n\nThank you." ]
[ "installshield-le" ]
[ "How do I make sure a URL is an image using JavaScript + jQuery?", "In my web application, users can post text to a feed, and the text may include URL's. My code scans for URL's and replaces them which anchor tags pointed at the URL's. I want to change this so that my code can detect whether or not the URL points to an image, and if it does, render an image tag inside the anchor tag, instead of just the URL text.\n\nI can do this on server side code by sending a quick 'HEAD' request to the URL to see what the Content-Type is on the response, and this works reliably. However, it doesn't scale well for obvious reasons.\n\nWhat would be better is if I could push this logic onto the client's browser. I'd like to use JavaScript + jQuery to send the 'HEAD' request to the specified URL, and read the Content-Type header from the response.\n\nI know that cross-domain requests are an issue. Could I somehow use JSONP? What options do I have?\n\nEDIT - SECURITY RISK\n\nI got some good answers to my question, but I wanted to point out something in big bold letters. As Adam pointed out in the comments, this is a security risk. If you can guarantee the URL's of the images are all coming from trusted domains, you're good to go with this solution. However, in my scenario, users can enter whatever URL they want. This means they could create their own site which requires basic authentication, and then when the jQuery runs to set the src attribute on the created image, the user is presented with a username/password dialog, and that's obviously a huge risk." ]
[ "javascript", "jquery" ]
[ "Refreshing canvas erases previous data", "I'm making something like Battleships game on Canvas.\nLet's see the field:\n\n\nThe problem is: when I press another cell, the yellow one will become black again. And I want to save it's state, so that this yellow cell won't become black again.\n\nHere's the code what to do when hit: \n\n// it's some method A\ncase 1:\n drawHit = true;\n this.draw_x = x;\n this.draw_y = y;\n invalidate();\n break;\n\n\nand \n\n// It's in onDraw() method\nif (drawHit == true) {\n Log.d(TAG, \"drawHit! drawX = \" + draw_x + \", drawY = \" + draw_y);\n Paint ship = new Paint();\n ship.setColor(getResources().getColor(R.color.ship_color));\n Rect r = new Rect(draw_x*rebro_piece, draw_y * rebro_piece, (draw_x+1) * rebro_piece, (draw_y+1)*rebro_piece);\n canvas.drawRect(r, ship);\n drawHit = false; }" ]
[ "java", "android", "android-canvas" ]
[ "Ember RESTAdapter not populating my store", "i'm trying to write a simple ember application based on RESTful API. My code looks like that:\n\nstore.js.coffee\n\nDS.RESTAdapter.reopen\n namespace: 'api/v1'\n\nEmberClient.Store = DS.Store.extend\n adapter: DS.RESTAdapter.create()\n\n\nroutes/songs.js.coffee\n\nEmberClient.SongsRoute = Ember.Route.extend\n model: ->\n @get('store').findAll('Song')\n\n\nmodels/song.js.coffee\n\nEmberClient.Song = DS.Model.extend\n title: DS.attr('string')\n\n\napi response:\n\n{\"songs\":[{\"id\":10,\"title\":\"Intro\"},{\"id\":12,\"title\":\"Fantasy\"}]}\n\n\nThe thing is, i'm not able to loop through the results in my template cause the store is null. Request to my API is fired, api response is returned but EmberInspector says, that EmberClient.Song has 0 records." ]
[ "javascript", "ember.js", "ember-data" ]
[ "Is there something like a detail view in JSF?", "I'm trying to achieve something like this:\n\n<f:detailview item=\"#{bean.getOne()}\" var=\"p\">\n <h:outputText value=\"#{p.name}\" />\n</f:detailview>\n\n\nThe detailview tag will get hold of one object in the scope so that child components can use its properties. Is there something like that in JSF?" ]
[ "jsf" ]
[ "Dynamic JFormattedTextFields in JXDatePicker", "I require a field that accepts 4 types of formats: integer, float, string and date. When the user requires a date input the UI will present a date picker.\n\nSo to simplify the UI to have a singular textfield I created a JXDatePicker with JFormattedTextfield as it's editor and dynamically assign the formatted factory of the JFormattedTextfield to handle Integer, Float, String and Date input. Following is a code snippet of the implementation:\n\n public void setFormat(String format)\n {\n // requires integer format\n if (IntegerAttribute.TYPE_NAME.equals(format)) {\n setBoundFormatFactory(new DefaultFormatterFactory(new NumberFormatter(NumberFormat.getInstance())));\n }\n // requires float format\n else if (FloatAttribute.TYPE_NAME.equals(format)) {\n setBoundFormatFactory(new DefaultFormatterFactory(new NumberFormatter(new DecimalFormat(FLOAT_FORMAT))));\n }\n else if (DateAttribute.TYPE_NAME.equals(format)\n || DateTimeAttribute.TYPE_NAME.equals(format)\n || TimeAttribute.TYPE_NAME.equals(format)) {\n // requires date format\n setDateFormat(model.getDateFormat());\n }\n else {\n // otherwise set to us string\n setBoundFormatFactory(new DefaultFormatterFactory()); \n }\n }\n\n public void setDateFormat(String dateFormat)\n {\n setBoundFormatFactory(new DefaultFormatterFactory(new DateFormatter(new SimpleDateFormat(dateFormat))));\n }\n\n private void setBoundFormatFactory(DefaultFormatterFactory factory)\n {\n m_formattedTextfield.setFormatterFactory(factory);\n }\n\n\nThe implementation works for string and date formats however for integers and floats it seems like the JXDatePicker is trying to cast it into a Date data type and therefore causes a class cast exception:\n\njava.lang.ClassCastException: java.lang.Long cannot be cast to java.util.Date\nat org.jdesktop.swingx.plaf.basic.BasicDatePickerUI$Handler.editorPropertyChange(BasicDatePickerUI.java:1359)\nat org.jdesktop.swingx.plaf.basic.BasicDatePickerUI$Handler.propertyChange(BasicDatePickerUI.java:1336)\nat java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:339)\nat java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:276)\nat java.awt.Component.firePropertyChange(Component.java:8163)\nat javax.swing.JFormattedTextField.setValue(JFormattedTextField.java:782)\nat javax.swing.JFormattedTextField.commitEdit(JFormattedTextField.java:513)\n\n\nIs there a way to stop the date picker from trying to cast the value into a date when the field is a number format? Or is there another work around?" ]
[ "java", "swing", "datepicker", "swingx", "jformattedtextfield" ]
[ "WebView using loadDataWithBaseURL and loadUrl interchangeably", "I am experimenting the communication feasibility of Java and JavaScript in Android..\n\n\nLoad the page:\n\nwebview.loadDataWithBaseURL(base_url, html, \"text/html\", \"utf-8\", null);\n\nWhen the page finished loading, call JavaScript:\n\n@Override\npublic void onPageFinished(WebView view, String url)\n{\n webview.loadUrl(\"javascript:doSomething()\");\n}\n\nThe JavaScript has a callback interface, then reload the page:\n\n@JavascriptInterface\npublic void onJavaScriptExecuted()\n{\n webview.loadDataWithBaseURL(base_url, html, \"text/html\", \"utf-8\", null);\n}\n\n\n\nAfter step 3, I expected the onPageFinished() to be called again, but it does not..\n\nWhat is wrong with the 2nd call to loadDataWithBaseURL()?" ]
[ "javascript", "android", "interface" ]
[ "Retrive an image from a field database path to a datagrid", "i need to put the logo team next to the team name, i have a table with the team name and a field named logo, how to retrive the logo who is stored in folder images directly from the path that is stored in a field in a table, \nI share a image of my table in order for you experts give me an orientation of how achive that!\nregards \nenter image description here" ]
[ "asp.net", "visual-studio", "datagrid" ]
[ "Implementin SRWebSocketDelegate in Swift", "I am implementing:\n\n@protocol SRWebSocketDelegate <NSObject>\n\n- (void)webSocket:(SRWebSocket *)webSocket didReceiveMessage:(id)message;\n\n@optional\n\n- (void)webSocketDidOpen:(SRWebSocket *)webSocket;\n- (void)webSocket:(SRWebSocket *)webSocket didFailWithError:(NSError *)error;\n- (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean;\n\n\nin Swift. All functions I can implement ok and works, but didCloseWithCode I just can't make it to work.\n\nI am having trouble implementing\n\n- (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean;\n\n\nin Swift.\n\nI am trying:\n\nfunc webSocket(webSocket: SRWebSocket!, didCloseWithCode code: NSInteger!, reason: NSString!, wasClean: Bool!) {\n println(\"websocket closed: \\(reason)\")\n self.connect(5.0)\n}\n\n\nwith no luck." ]
[ "ios", "objective-c", "swift", "socketrocket" ]
[ "Detecting if Windows Login Screen is visible to user in VB.NET", "Hey StackOverflow VB.NET members,\n\nAfter running the following code (which locks the computer), what code must I be applying to see if the user has successfully logged into the computer and that \"Lock Screen\" I'd so called has disappeared?\n\nPrivate Declare Function LockWorkStation Lib \"user32.dll\" () As Long\n\nPrivate Function LockComputer()\n LockWorkStation()\nEnd Function\n\n\nI will call \"LockComputer\", after that what do I do to see if the Lock screen so called by this function (after say 2 minutes) has disappeared or is still there asking for the password from the user!\n\nThanks,\nAkshit Soota" ]
[ "windows", "vb.net", "locking", "user32" ]
[ "Angular JS: include partial HTML inside another ng-include", "I'm using an index.html created with Yeoman, that looks something like this:\n\n<html>\n <head>...</head>\n <body>\n\n <div ng-include=\"'views/main.html'\"></div>\n\n </body>\n</html>\n\n\nNow, I know that I cannot use an ng-include inside another ng-include, so I don't even try that, but that's the objective that I want to achieve. \n\nI'm using ui.router in my main.html for the nested views, but I cannot do something like this:\n\n<header class=\"header\">\n <!-- Rather long HTML code that I would like to put in\n a separate file like 'views/parts/header.html' -->\n\n</header>\n\n<div ui-view=\"\" class=\"container\"></div>\n\n\n\n\nOne naive solution would be to eliminate the first ng-include and use it in the main.html for header, footer and stuff like that. \n\nSo, hit me with what you've got, but not with that!\n\n\n\nEdit: this is what I would love to have (but can't, since I'm already inside an ng-include)\n\n <div ng-include=\"'views/parts/header.html'\"></div>\n <div ui-view=\"\" class=\"container\"></div>" ]
[ "javascript", "angularjs", "angular-ui-router", "angularjs-ng-include" ]
[ "C Socket programming on Linux", "I am new to socket programming and linux I could find some code about socket programming I want to use this code to connect to a printer , this code is using gethostbyname function which is responsible for getting hostent I think everything is fine except that I have not the host name I just have an IP address (of printer), So what function should I use to connect to the printer by IP ?\n\nthis is the code\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <unistd.h>\n#include <string.h>\n#include <sys/types.h>\n#include <sys/socket.h>\n#include <netinet/in.h>\n#include <netdb.h> \n\nvoid error(const char *msg)\n{\nperror(msg);\nexit(0);\n}\n\nint main(int argc, char *argv[])\n{\nint sockfd, portno, n;\nstruct sockaddr_in serv_addr;\nstruct hostent *server;\n\nchar buffer[256];\nif (argc < 3) {\n fprintf(stderr,\"usage %s hostname port\\n\", argv[0]);\n exit(0);\n}\nportno = atoi(argv[2]);\nsockfd = socket(AF_INET, SOCK_STREAM, 0);\nif (sockfd < 0) \n error(\"ERROR opening socket\");\nserver = gethostbyname(argv[1]);\nif (server == NULL) {\n fprintf(stderr,\"ERROR, no such host\\n\");\n exit(0);\n}\nbzero((char *) &serv_addr, sizeof(serv_addr));\nserv_addr.sin_family = AF_INET;\nbcopy((char *)server->h_addr, \n (char *)&serv_addr.sin_addr.s_addr,\n server->h_length);\nserv_addr.sin_port = htons(portno);\nif (connect(sockfd,(struct sockaddr *) &serv_addr,sizeof(serv_addr)) < 0) \n error(\"ERROR connecting\");\nprintf(\"Please enter the message: \");\nbzero(buffer,256);\nfgets(buffer,255,stdin);\nn = write(sockfd,buffer,strlen(buffer));\nif (n < 0) \n error(\"ERROR writing to socket\");\nbzero(buffer,256);\nn = read(sockfd,buffer,255);\nif (n < 0) \n error(\"ERROR reading from socket\");\nprintf(\"%s\\n\",buffer);\nclose(sockfd);\nreturn 0;\n}" ]
[ "c", "linux", "sockets" ]
[ "LDAP server is unavailable exception", "I trying to implement LDAP authentication in C# Web Application. \n\nI tried is using the below code.\n\ntry\n{\n using (LdapConnection conn = new LdapConnection(this.Server))\n {\n string uname = userName;\n if (!string.IsNullOrEmpty(this.UsernamePrepend))\n {\n uname = string.Concat(this.UsernamePrepend, userName);\n }\n NetworkCredential cred = new NetworkCredential(uname, password, null);\n conn.SessionOptions.SecureSocketLayer = true;\n conn.SessionOptions.VerifyServerCertificate = (LdapConnection con, X509Certificate cer) => true;\n conn.SessionOptions.ProtocolVersion = 3;\n conn.AuthType = AuthType.Basic;\n conn.Bind(cred);\n }\n}\ncatch (LdapException ldapException)\n{\n LdapException ex = ldapException;\n if (!ex.ErrorCode.Equals(49))\n {\n this.LogError(ex, userName);\n throw ex;\n }\n}\nflag = true;\n\n\nEvery time I run it, it goes into catch block with exception LDAP server is unavailable. \n\nAm I missing something?" ]
[ "c#", "asp.net", "active-directory", "ldap" ]
[ "How to compare lists and get total matching items count", "Garage.cars: object garage has a FK of cars\n\nPerson.carwishlst: object Person has FK of cars they would like.\n\nIn Django how to I achieve the following, loop?...\n\nGet the total number of cars x the Person has which match the ones the Garage has.\n\nOutcome:\ni.e. Grange has 4 cars you want\n\nHypothetical, but lets say Grange model has an FK cars = models.ManyToManyField(Cars) \n\nPerson also has a FK cars_wishlist = models.ManyToManyField(Cars)" ]
[ "django", "django-views" ]
[ "Discord.py Bot is not online, but still works", "i have a problem with my discord bot, whenever i run the code below using apraw to get the titles of the recent submissions on a subreddit the bot doesn't appear online anymore but still returns the titles in CMD :\n\nBot is not online when i execute this but still asks for subreddit name & prints the titles of the new posts of the subreddit in CMD:\n\nimport asyncio\nimport apraw\nfrom discord.ext import commands\n\nbot = commands.Bot(command_prefix = '?')\n\[email protected]\nasync def on_ready():\n print('Bot is ready')\n await bot.change_presence(status=discord.Status.online, activity=discord.Game('?'))\n\[email protected]()\nasync def online (ctx):\n await ctx.send('Bot is online !')\n\nreddit = apraw.Reddit(client_id = "CLIENT_ID",\n client_secret = "CLIENT_SECRET",\n password = "PASSWORD",\n user_agent = "pythonpraw",\n username = "LittleBigOwl")\n\[email protected]\nasync def scan_posts():\n xsub = str(input('Enter subreddit name : '))\n subreddit = await reddit.subreddit(xsub)\n async for submission in subreddit.new.stream():\n print(submission.title)\n\nif __name__ == "__main__":\n loop = asyncio.get_event_loop()\n loop.run_until_complete(scan_posts())\n\n\nbot.run('TOKEN')\n\n\nBut is online when i execute this but obviously doesn't ask for sub name... :\n\nimport asyncio\nimport apraw\nfrom discord.ext import commands\n\nbot = commands.Bot(command_prefix = '?')\n\[email protected]\nasync def on_ready():\n print('Bot is ready')\n await bot.change_presence(status=discord.Status.online, activity=discord.Game('?'))\n\[email protected]()\nasync def online (ctx):\n await ctx.send('Bot is online !')\n\n\nbot.run('TOKEN')\n\nSo reddit is the problem here. But what exaclty do i ahve to change in order to make my bot apear online whilst still being able to retreive the titles of new submissions on a given subreddit? The code doesn't return any error:/" ]
[ "discord.py", "offline", "reddit", "praw" ]
[ "How to return values from a QDialog instance in Python?", "I'm trying to open a QtGui.QDialog, request a set of values from the user, then return the values after \"save\" is clicked.\n\nThe following code should run without modification.\n\nimport sys\nfrom PySide import QtCore, QtGui\nimport numpy as np\n\nclass MyQDialog(QtGui.QDialog):\n\n def __init__(self, parent=None):\n super(MyQDialog, self).__init__(parent)\n\n ## Default values\n\n self.eta1 = 1.0\n self.eta2 = 1.0\n\n ## Create labels and buttons\n\n frameStyle = QtGui.QFrame.Sunken | QtGui.QFrame.Panel\n\n self.eta1__QL = QtGui.QLabel(str(self.eta1))\n self.eta1__QL.setFrameStyle(frameStyle)\n self.eta1__QBtn = QtGui.QPushButton(\"Set eta1:\")\n\n self.eta2__QL = QtGui.QLabel(str(self.eta2))\n self.eta2__QL.setFrameStyle(frameStyle)\n self.eta2__QBtn = QtGui.QPushButton(\"Set eta2:\")\n\n self.cancel__QBtn = QtGui.QPushButton(\"Cancel\")\n self.save__QBtn = QtGui.QPushButton(\"Save\")\n\n self.eta1__QBtn.clicked.connect(self.set_eta1)\n self.eta2__QBtn.clicked.connect(self.set_eta2)\n self.cancel__QBtn.clicked.connect(self.cancel)\n self.save__QBtn.clicked.connect(self.save)\n\n ## Set layout, add buttons\n\n layout = QtGui.QGridLayout()\n layout.setColumnStretch(1, 1)\n layout.setColumnMinimumWidth(1, 250)\n\n layout.addWidget(self.eta1__QBtn, 1, 0)\n layout.addWidget(self.eta1__QL, 1, 1)\n layout.addWidget(self.eta2__QBtn, 2, 0)\n layout.addWidget(self.eta2__QL, 2, 1)\n layout.addWidget(self.cancel__QBtn, 3, 0)\n layout.addWidget(self.save__QBtn, 3, 1)\n\n self.setLayout(layout)\n\n self.setWindowTitle(\"Thank you for reading!\")\n\n ## Button functions\n\n def set_eta1(self):\n self.eta1, ok = QtGui.QInputDialog.getDouble(self,\n \"Change of variable\", \"Rate (type 1):\", 0.1, 0, 1e8, 3)\n if ok:\n self.eta1__QL.setText(str(self.eta1))\n\n def set_eta2(self):\n self.eta2, ok = QtGui.QInputDialog.getDouble(self,\n \"Change of variable\", \"Rate (type 2):\", 0.3, 0, 1e8, 3)\n if ok:\n self.eta2__QL.setText(str(self.eta2))\n\n def cancel(self):\n self.close()\n\n def save(self):\n return self.eta2, self.eta2\n\n\nif __name__ == '__main__':\n app = QtGui.QApplication(sys.argv)\n edit_params__QD = MyQDialog()\n\n if edit_params__QD.exec_():\n value1, value2 = edit_params__QD.save()\n\n print 'Success!', value1, value2\n else:\n print 'I shouldn\\'t print, but I do.'\n\n sys.exit()\n\n\nThank you very much for your time! Any suggestions for improvement are greatly appreciated!" ]
[ "python", "pyqt4", "pyside", "qdialog" ]
[ "Visible Scrollbar for EditText", "I know how to make EditText scrollable by setting \n\n e=(EditText)findViewById(R.id.editText2);\n e.setScroller(new Scroller(AndroidExplorer.this)); \n e.setVerticalScrollBarEnabled(true); \n e.setMovementMethod(new ScrollingMovementMethod()); \n\n\nbut it's just showing a scrollbar.How can i Scroll Using that Scrollbar,How to accomplish that?\n\nNow i can scroll by scrolling my edittext ,scrollbar also moves with that.But my need is to scroll using scrollbar." ]
[ "android", "android-edittext", "scrollbar" ]
[ "how to get addressable labels assigned in the addressable window within script", "With the new addressable introduced in Unity we can assign each asset that falls into a different group with a label in the Addressable window.\n\n\n\nIs there a way to get these labels in the script?" ]
[ "unity3d" ]
[ "How to execute multiple artisan commands without waiting for one to end execution?", "I have a huge amount of data that I want to process in fast and get most out of my server. So, I have created one parent artisan command and one child artisan command.\n\nParent artisan command: Gets the value from the database, does all kind of calculations, divides data into chunks and executes multiple instances of child artisan command using the following code.\n\nforeach($arrayOfData as $chunk){ // $arrayOfData is an array of Chunks\n $this->call('process:data',[\n 'data' => $chunk // Chunk is an array containing data\n ]);\n\n $this->info('Chunk Processed');\n}\n\n\nBut it waits for one instance to stop execution which means it is not executing multiple instances of child artisan commands at once which I want! I know that calling it this way will wait for one instance of child artisan command to stop the execution. Is there any way I can execute multiple instances of child artisan command without waiting for one instance to stop the execution?\n\nI already searched for different ways to do this, I can execute child artisan commands using exec() and similar functions but it will also return some exit code for which my code will wait for.\n\nBy Executing just 2 instances at once, I can divide time taken to process data by 2. And I want to execute 3 instances at once! Is there any way to do this?\n\nMore information\n\nChild artisan command: Gets an array of data and processes it. Basically, it updates some information in the database for the given data." ]
[ "php", "laravel", "laravel-5", "laravel-artisan" ]
[ "missing dependencies in jboss 7.1 while deployment", "I am running jboss 7.1 in domain mode\n i have created a server namely nodeOne in main-server-group. kept auto-start as true, port-offset as 800 and jvm is default jvm.\nserver got created successfully and shown in running state when checked on console.however when I tried to deploy a war file on this server group, deployment failed. please find below error logs to further understand the issue.\n\n2018-03-02 15:12:54,359 ERROR [org.jboss.as] (Controller Boot Thread) WFLYSRV0026: JBoss EAP 7.1.0.GA (WildFly Core 3.0.10.Final-redhat-1) started (with errors) in 28900ms - Started 232 of 561 services (47 services failed or missing dependencies, 358 services are lazy, passive or on-demand)\n2018-03-02 15:54:28,825 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) WFLYSRV0027: Starting deployment of \"kau.adjxrs.11.war\" (runtime-name: \"kau.adjxrs.11.war\")\n2018-03-02 15:54:32,177 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 16) WFLYCTL0013: Operation (\"add\") failed - address: ([(\"deployment\" => \"kau.adjxrs.11.war\")]) - failure description: {\"WFLYCTL0288: One or more services were unable to start due to one or more indirect dependencies not being available.\" => {\n \"Services that were unable to start:\" => [\"jboss.deployment.unit.\\\"kau.adjxrs.11.war\\\".PARSE\"],\n \"Services that may be the cause:\" => [\n \"jboss.http-upgrade-registry.default\",\n \"org.wildfly.network.interface.public\"\n ]\n}}\n2018-03-02 15:54:32,181 ERROR [org.jboss.as.server] (ServerService Thread Pool -- 16) WFLYSRV0021: Deploy of deployment \"kau.adjxrs.11.war\" was rolled back with the following failure message: \n{\"WFLYCTL0288: One or more services were unable to start due to one or more indirect dependencies not being available.\" => {\n \"Services that were unable to start:\" => [\"jboss.deployment.unit.\\\"kau.adjxrs.11.war\\\".PARSE\"],\n \"Services that may be the cause:\" => [\n \"jboss.http-upgrade-registry.default\",\n \"org.wildfly.network.interface.public\"\n ]\n}}\n2018-03-02 15:54:32,242 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) WFLYSRV0028: Stopped deployment kau.adjxrs.11.war (runtime-name: kau.adjxrs.11.war) in 59ms\n\n\nplease help me understanding how to address this issue." ]
[ "jboss7.x" ]
[ "Create New User in Winforms Using HDI Membership Provider", "I have a website with login and register forms using custom HDI Membership provider where Users can login or register new account.\n\nNow I have a desktop software and trying to have two forms for login and register where my users can able to login or register for user convenience and not by going to the website and make them register online.\n\nSo, I have these to know in order to go further.\n\n1) Can I use HDI membership provider as I have used it in my web application?\nIf so how can I do that?\n\nAs previously I have done and I faced many problems and still didn't get clarified here\n\n2) If No, how do I make use in order to make use the same HDI Membership.\n\nFinally I need to use the same database for my desktop software as well as my web application with all the possibilities (i.e. I need to validate each parameter of my membership class).\n\nI am able to register the user but it is not using the Membership and I'm unable to know why it is not picking up the membership provider from the app.config file.\n\nOnce again I am providing my Users database Structure:" ]
[ ".net", "vb.net", "winforms", "custom-membershipprovider" ]
[ "command line compilation for connection to Oracle db", "I managed to compile and run the following code in netbeans but I wanted to compile and run using command line statement:\n\njavac –cp \"C:\\Program Files\\Java\\jdk1.8.0_45\\db\\lib\\odbc7.jar\" OracleDBConnect.java\n\n\nthen run:\n\njava OracleDBConnect.java\n\n\nBut I get the error \n\nno suitable driver found for jdbc:oracle:thin:@localhost:1521:XE\n\n\nWhat am I doing wrong?\n\nimport java.util.*;\nimport java.sql.*;\n\npublic class OracleDBConnect {\n\n public OracleDBConnect() {\n\n try {\n // Load MS access driver class\n // Class.forName(\"sun.jdbc.odbc.JdbcOdbcDriver\");\n }\n catch (Exception e)\n {\n System.out.println( e.getMessage() );\n // System.exit(0);\n }\n String url = \"jdbc:oracle:thin:@localhost:1521:XE\";\n String userid = \"HR\"; // Username here\n String password= \"HR\"; // Password here \n\n String sql = \"SELECT * FROM EMPLOYEES\";\n\n try (Connection connection = DriverManager.getConnection( url, userid, password);\n Statement stmt = connection.createStatement();\n ResultSet rs = stmt.executeQuery( sql ))\n {\n ResultSetMetaData md = rs.getMetaData();\n }\n catch (SQLException e)\n {\n System.out.println( e.getMessage() );\n }\n }\n\n public static void main(String[] args) {\n new OracleDBConnect();\n }\n}" ]
[ "java" ]
[ "Selecting top of word document using VBA", "I am using excel VBA to populate data onto a word template from an excel spreadsheet. The problem I am having is selecting the top of the word document so the information goes into the right spot. \n\nI have tried using Selection.HomeKey wd:=Story and Selection.MoveUp Unit:=wdScreen, count:=1 both with no success as I am consistently getting \n\n\n runtime error 4120" ]
[ "excel", "runtime-error", "ms-word", "vba" ]