texts
sequence | tags
sequence |
---|---|
[
"getting second newest version of source code",
"I’m new to Mercurial. I’m trying to clone the second newest commit from the web interface, and everything I’ve red says I need to enter the revision number. However, the web interface only shows “age”, “author”, “description” and at the bottom has “rev 27: (0) tip”\nI know which one I want based on the description, and it’s the second from the top. How do I get it? I assume when I did hg clone https://... it got the newest version"
] | [
"version-control",
"mercurial"
] |
[
"php form conditional checkboxes",
"I have made a php form that is submitted by email. I am trying to make conditional check boxes so that if one specific check box is selected two others cannot be selected and if one or two of those two check boxes are selected the first one cannot. My code looks like this\n\n<p>Ribeye Steak <input type=\"checkbox\" name=\"Ribeye steak\" value=\"Ribeye Steak\"/> </p>\n<p>Ribeye Roast (prime rib) <input type=\"checkbox\" name=\"Ribeye Roast\" value=\"ribeye roast\" /> </p>\n<p>Sirloin Steak <input type=\"checkbox\" name=\"Tenderloin roast\" value=\"Tenderloin roast\" /> </p>\n<p>T-bone steak <input type=\"checkbox\" name=\"T-bone\" value=\"T-bone steak\" /> \nor New York Strip steak <input type=\"checkbox\" name=\"NY\" value=\"New York Strip\" /> \nand/or Tenderloin Filets <input type=\"checkbox\" name=\"Filets\" value=\"Filets steaks\" /> </p>\n<?php\nif($_GET['T-bone steak'] == 'T-bone steak' AND $_GET['New York Strip'] == 'New York Strip') { \n echo \"You cannot select T-bone steak and NY Stip or Tenderloin. Please select T-bone or NY Strip and/or Tenderloin.\";\n } else if($_GET['T-bone steak'] == 'T-bone steak' AND $_GET['Filets steaks'] == 'Filets steaks'){\n echo \"You cannot select T-bone steak and NY Stip or Tenderloin. Please select T-bone or NY Strip and/or Tenderloin.\";\n }\n else{\n }\n?>\n\n\nWhen the file is opened nothing happens. It still allows me to select any or all three of the checkboxes. \nAny ideas? \nThank a bunch."
] | [
"php",
"forms",
"conditional",
"checkbox"
] |
[
"PrimeNG data table sorting and pagination clicks is scrolling the page to top",
"I am currently using PrimeNG Datatable with pagination enabled in it. When I try to sort any column or click on pagination butttons, the page scrolls to top.\n\nIt is because primeng anchor tags have href=\"#\" by default, for example\n\n<a class=\"ui-paginator-page ui-paginator-element ui-state-default ui-corner-all\" href=\"#\" ng-reflect-klass=\"ui-paginator-page ui-paginator\" ng-reflect-ng-class=\"[object Object]\">2</a>\n\n\nIs there a way I can override the href values to something else like href=\"#/\" which would stop the scrolling to top? PrimeNG does not provide any configuration option for updating href tags."
] | [
"angular",
"primeng"
] |
[
"Conditional formatting with cell values based on their row",
"I'm currently doing a small side project where I'm converting images into excel spreadsheets. I have a python program which turns each cell into a range between 0 and 255 (RGB color codes).\nI had made this a while back and don't actually remember how I colored each row with conditional formatting.\nEssentially, I need to select each row, turn it a shade of red. Then I need to select each alternate row (MOD 2 = 0) and turn each of those into a shade of green. Finally, I need to select each third row (MOD 3 = 0) and turn those into a shade of blue.\nAgain, to reiterate, I'm having trouble with actually selecting the rows. Is there any way I can do this (without doing it by hand)?"
] | [
"excel-formula"
] |
[
"How many threads do I really need?",
"I'm building a Java application with a GUI and a socket-based server, and I'm constantly running into problems with one part of the application getting stuck waiting for the other (mostly the GUI waiting for the server - no surprise there. The few times I manage to avoid these errors, I instead find myself reaching the end of my main method almost instantly after startup. (The app may or may not keep running, depending on if there is any GUI visible or not, but I though the main method wasn't supposed to return until the program is actually exiting...)\n\nMy requirements on the application are the following:\n\n\nIt should be able to handle an unspecified number of clients simultaneously\nCommunication between server and clients can go in either direction, and not necessarily every other turn; sometimes the server sends a bunch of messages and get replies from only some clients, other times it's the other way around.\nIt should never be \"too late\" for a client to connect - the serversocket needs to keep accepting connections continuously for as long as the server app is running.\nDuring the whole time, the GUI should be unaffected by the server and clients waiting for eachother. Updates to the GUI happens through event listeners on other objects (mostly the model) which are changed by the background threads.\n\n\nI've tried with the following, but I can't seem to get it right.\n\n\n1 thread for the main method and the \"regular\" work performed by objects it creates (Controller, Model etc). This is the thread I sometimes have problems with because it doesn't hold anywhere and returns from main prematurely.\nUsing EventQueue.invokeLater(new Runnable() { ... }); I perform all actual GUI manipulation on the UI thread, but none of these calls are \"surviving\" threads, so they basically just work asynchronically off the main thread.\n1 thread for the ServerSocket to be able to keep listening for new connections.\n1 thread for each client, to be able to listen to messages from clients. I'm unsure here if I need another thread here as well, to be able to send messages \"out of order\", i.e. without waiting to receive one first.\n\n\nI have never written a (real) multithreaded application before, so this is entirely new ground to me. However, I refuse to beleive that this problem has not been solved successfully before - even so many times that some sort of best practices have evolved.\n\nWhat are they? What is a good architecture for this application?"
] | [
"java",
"multithreading",
"sockets",
"user-interface"
] |
[
"Converting synonymous records in CSV file into MySQL DB entries",
"I have an application which populates a text file with information in CSV format. The problem is, the number of columns for each records should be flexible and it's not constant. I am trying to implement the same datastructure but in MySQL for faster reading and parallel writing from many nodes. \n\nHere is a sample taken from my CSV File\n\nlike|love|adore|admire\nhate|dislike\nrevive|resurrect\ninfo|information|pieces of information|data\nshoot|snipe|kill|hunt\n\n\nEach record represents words with the same meaning. Later on, I get the synonyms of a word using that CSV file. For example, I get the synonyms for the word hate which is dislike using a function in my application that parses the csv file and outputs the matching words. \n\nWhat options do I have to do the same implementation approach but using MySQL?"
] | [
"php",
"mysql",
"database-design"
] |
[
"Can not pass a list of strings to a Web API endpoint. Why?",
"Can not pass a list of strings to a Web API endpoint. Why?\nHere is my controller:\n[Route("[controller]")]\n[ApiController]\npublic class MyController\n{\n [HttpPost("foo")]\n public string MyMethod(List<string> strs)\n {\n return "foo";\n }\n}\n\nHere is how I am trying to call it:\nvar strs = new List<string> { "bar" };\nvar json = JsonConvert.SerializeObject(strs);\nvar content = new StringContent(json, Encoding.UTF8, "application/json");\nvar response = await httpCliet.PostAsync("/My/foo", content);\n\nBefore calling the endpoint I place a breakpoint on the return "foo"; line. Once the breakpoint is hit the strs list inside the MyController.MyMethod is empty. The strs is not null, but it contains no elements. While my intentions and expectations are to see the strs containing one element, i.e. the string "bar".\nI am using the ASP.NET Core 2.2 in project where I create and use the HttpClient. And I am using the same ASP.NET Core 2.2 in project where I have the endpoint.\nI am not sure what is wrong here. I have checked a few sources. E.g. the following:\nC# HTTP post , how to post with List<XX> parameter?\nhttps://carldesouza.com/httpclient-getasync-postasync-sendasync-c/\nhttps://blog.jayway.com/2012/03/13/httpclient-makes-get-and-post-very-simple/\nAnd I can not find what I am missing according to those resources.\nUPDATE\nThe following call works for me as expected:\nvar json = JsonConvert.SerializeObject(string.Empty);\nvar content = new StringContent(json, Encoding.UTF8, "application/json");\nvar response = await server.CreateClient().PostAsync("/My/foo?strs=bar", content);\n\nMaybe someone knows why the parameters in my case are read from the query string only, but not from body?"
] | [
"list",
"asp.net-core",
"post",
"parameters",
"httpclient"
] |
[
"how to combine multtiple values in preg_match_all",
"I have a preg_match_all function in PHP. Here is the code.\n\npreg_match_all('#\"sourceName\":\"(\\S+)\",\"verified\":false,\"targetId\":(\\S+),\"sourceId\"#',$html,$matches);\n$nu=$matches[1];\n$nuu=$matches[3];\n$n=implode($nu,\"<br>\");\n\n\nI am getting two values $nu(is equal to any name) and $nuu(is equal to a userid). I need to save both in this format, suppose $nu=vina and $nuu=73838833\nso the format will be @vina(73838833). Now how to do it please help me."
] | [
"php"
] |
[
"How to get a Tab's name in a GWT TabPanel",
"I have a tab panel where I add tabs dynamically. \n\nAt a given point it can look like:\n\ntabPanel.add(new HTML(\"Dashboard\"), new Hyperlink(\"Dashboard\", \"dashboard\")); \ntabPanel.add(new CashGameTabPage(this), new Hyperlink(\"Cash Games\", \"cash\"));\ntabPanel.add(new TournamentTabPage(this), new Hyperlink(\"Tournament\", \"tournament\"));\n\n\nI would like to check if a Tab already exists. If it exists, I should get its index. If it does not exist I should get 0. I was thinking as a function such as:\n\npublic static int getIndexIfAlreadyExists(DecoratedTabPanel tabPanel, String title) {\n int tabcount = tabPanel.getTabBar().getTabCount(); \n for(int i = 0; i < tabcount;i++) { \n if(/*TODO get a Tab Text */.equals(title))\n return i;\n return 0;\n}\n\n\nI would like to get \n\ngetIndexIfAlreadyExists(tabPanel, \"Dashboard\") -> 0\ngetIndexIfAlreadyExists(tabPanel, \"Cash Games\") -> 1\ngetIndexIfAlreadyExists(tabPanel, \"Tournament\") -> 2\n\n\nHowever I do not manage to find a method to retrieve the Text. Any idea how to achieve this behaviour. \n\nThanks in advance."
] | [
"gwt"
] |
[
"Sparql without FROM keyword",
"Glad if someone can clarify.\n\nI always read that SQL and SPARQL are very similar.\nHowever, a lot of times i have seen sparql query without the FROM keyword.\nYou would assume that you have to query the datasource 'FROM' somewhere in the database \nlike how SQL behaves.\n\nExample\n\nPREFIX foaf: <http://xmlns.com/foaf/0.1/>\nSELECT ?name\nWHERE \n{\n ?person foaf:name ?name .\n}\n\n\nHow does it know where to look for? Like in SQL, look in Database1 - table1\n\nCheers"
] | [
"database",
"semantics",
"semantic-web",
"sparql"
] |
[
"Adding images dynamically to scroller",
"i am new to flex.i am trying add images dynamically in flex using file referencei need to add images in scroller.i use this below code but adding image was not visible.can anyone help me regarding this issue pls.Thanks in advance\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<s:Application xmlns:fx=\"http://ns.adobe.com/mxml/2009\" \n xmlns:s=\"library://ns.adobe.com/flex/spark\" \n xmlns:mx=\"library://ns.adobe.com/flex/mx\" minWidth=\"955\" minHeight=\"600\"\n xmlns:net=\"flash.net.*\">\n <fx:Script>\n <![CDATA[\n import mx.controls.Alert;\n import mx.controls.Image;\n import mx.utils.ObjectUtil;\n private var myImage:Image;\n private function OnbuttonClick(evt:MouseEvent):void {\n var arr:Array = [];\n arr.push(new FileFilter(\"Images\", \".gif;*.jpeg;*.jpg;*.png\"));\n fileReference.browse(arr);\n }\n\n private function FileRefSelect(evt:Event):void {\n fileReference.load();\n }\n\n private function FileRefComplete(evt:Event):void {\n Alert.show(ObjectUtil.toString(fileReference));\n myImage = new Image();\n //img.source = fileReference.data;\n\n myImage.maxWidth = 100;\n myImage.maxHeight = 100;\n myImage.source = fileReference.data;\n vg.addChild(myImage);\n\n }\n ]]>\n </fx:Script>\n\n <fx:Declarations>\n <net:FileReference id=\"fileReference\"\n select=\"FileRefSelect(event);\"\n complete=\"FileRefComplete(event);\" />\n </fx:Declarations>\n\n\n\n <mx:ControlBar>\n <mx:Button id=\"btn\" label=\"Browse Your Image\" click=\"OnbuttonClick(event);\" />\n </mx:ControlBar>\n\n <s:Scroller id=\"scrllr\" x=\"50\" y=\"100\" width=\"100\" height=\"280\" focusEnabled=\"false\"\n hasFocusableChildren=\"true\">\n <s:VGroup id=\"vg\">\n\n </s:VGroup>\n </s:Scroller>\n\n\n</s:Application>"
] | [
"actionscript-3",
"apache-flex",
"flex4.5",
"mxml"
] |
[
"How to set the last point's position in Highcharts",
"Is there a way put the last point of a series at charts' center or set some right-margin in Highcharts StockChart\n\nlike this"
] | [
"javascript",
"highcharts",
"highstock"
] |
[
"Ubuntu Shell Script giving wrong output",
"I'm trying to learn basics of shell scripting when I run the following code my terminal return \"None of the condition met\" but when I run it on an online shell I get \"a is equal to b\" can anyone explain the reason for this.\n\nSource:\n\n#!/bin/sh\n\na=10\nb=10\n\nif [ $a == $b ]\nthen\n echo \"a is equal to b\"\nelse\n echo \"None of the condition met\"\nfi\n\n\nScreenshot:"
] | [
"shell",
"ubuntu",
"sh",
"scripting-language"
] |
[
"Web crawler for django app; should I write it in django or as separate script",
"I have Django app just for CRUD of some daily data.\nModel only have price and date.\n\nI should write some code that will automatically(daily) insert new data to my model.\n\nI am planning to use BeautifulSoup for web page parsing. \n\nSo I have few questions:\n\n\nI am planing to use crontab (manual edit with crontab -e) for setting task to run once daily. Is there smarter solution ?\nShould I use Django ORM or just write SQL in separate script ?\n\n\nI am looking for advices what is better in the long run. I will have more task like this one. \n\nThanks"
] | [
"python",
"django",
"web-crawler"
] |
[
"Remove an array element if one of the property contains certain values",
"I have following variable:\n\nvar data = [{id: '1', name: 'demo1'}, {id: '2', name: 'demo2'}, {id: '3', name: 'demo3'}]\n\n\nNow I have another list of ids, \n\nvar lookFor = [\"2\", \"3\"];\n\n\nNow, from data how will I remove the objects with id not available in the lookFor array of ids.\n\nI tried with following \n\n_.filter(data, function(item) {\n return _.contains(lookFor, 'id');\n});\n\n\nIs there any other way?"
] | [
"javascript",
"lodash"
] |
[
"show side bar for iPad like facebook in landscapemode in ios",
"I am having an iPad app in which I want to implement a Side Bar functionality like we have in facebook app.\n\nI am using this Demo for this.\n\nWith this I have successfully implemented the Side Bar functionality and its working well but with that my first view doesn't show me well.\n\nBelow is the screenshot.\n\n\n\nAs you can see from the screenshot, there is a black background and my whole view is not showing in full screen when the app launches.\n\nIt should be like below.\n\n\n\nAlso on clicking the button the Side View is showing like below.\n\n\n\nIt should be small as I have taken the view size with width = 300 and height = 768.\n\nBut it is showing bigger than that.\n\nHere is my code which I change in my appdelegate.\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions\n{\n self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];\n\n [self createEditableCopyOfDatabaseIfNeeded];\n\n // Override point for customization after application launch.\n self.viewController = [[ViewController alloc] initWithNibName:@\"ViewController\" bundle:nil];\n\n UINavigationController *navController = [[UINavigationController alloc]initWithRootViewController:self.viewController];\n\n SlidingViewController *slidingView = [[SlidingViewController alloc]initWithNibName:@\"SlidingViewController\" bundle:nil];\n\n self.slideMenuController = [[SlideMenuController alloc] initWithCenterViewController:navController];\n self.slideMenuController.leftViewController = slidingView;\n\n self.window.rootViewController = navController;\n [self.window makeKeyAndVisible];\n return YES;\n}\n\n- (IBAction)sideBarPressed:(id)sender\n{\n AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];\n if (appDelegate.slideMenuController.position == TKSlidePositionCenter) {\n [appDelegate.slideMenuController presentLeftViewControllerAnimated:YES];\n } else {\n [appDelegate.slideMenuController presentCenterViewControllerAnimated:YES];\n }\n}\n\n\nI want this for my iPad for Landscape mode only.\n\nPlease tell me What is wrong here? \n\nI am stuck here for quite a while. \n\nAny help will be appreciated.\n\nThanks in advance."
] | [
"ios",
"objective-c",
"ipad",
"ios7",
"sidebar"
] |
[
"Laravel 4.2 : Route (get) not work after another route (match)",
"I'm on Laravel 4.2 and I have a route (get) that does not work after another route (match).\n\nShe works before but not after.\n\nThe following code does not work\n\nRoute::group(array('prefix' => 'messages'), function(){\n ...\n Route::match(['GET','POST'], '/{id}', ['uses' => 'TestController@conversation', 'as' => 'test.messagerie.conversation']);\n Route::get('x', ['uses' => 'TestController@test']);\n});\n\n\nThe following code works\n\nRoute::group(array('prefix' => 'messages'), function(){\n ...\n Route::get('x', ['uses' => 'TestController@test']);\n Route::match(['GET','POST'], '/{id}', ['uses' => 'TestController@conversation', 'as' => 'test.messagerie.conversation']);\n});\n\n\nWhy ?"
] | [
"php",
"laravel",
"laravel-4",
"routes"
] |
[
"Python Webdriver IE11 Unable to find element on closed window",
"My Python Webdriver tests were working fine but I have reinstalled IE11 as i installed IE10 to verify some Jira defects.\nI have IE11 back on, my tests now fail. I get the following error:\nNoSuchWindowException: Message: Unable to find element on closed window\n\nHaving read other posts from people with similar issues. I have followed the instructions from: https://code.google.com/p/selenium/wiki/InternetExplorerDriver#Required_Configuration\n\nI don't have the following value in the reg editor so I have had to skip this part also:\nFor IE 11 only, you will need to set a registry entry on the target computer so that the driver can maintain a connection to the instance of Internet Explorer it creates. For 32-bit Windows installations, the key you must examine in the registry editor is HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BFCACHE\n\nAlso in IE11 Internet Options Advanced under Security I do not have the option Enhanced Protected Mode.\nI have hd to skip this part.\n\nTo turn off Enhanced Mode if the option does not exist in the browser options I followed the instructions from here:\nhttp://www.eightforums.com/tutorials/31977-internet-explorer-enhanced-protected-mode-turn-off.html\n\nTo Turn Off Enhanced Protected Mode in your IE10 or IE11\n\nA) Click/tap on the Download button below to download the file below, and go to step 4 below.\n\nTurn_Off_EPM_for_IE.reg\n\ndownload the file (there was a link provided)\n\n\nSave the .reg file to your desktop.\nDouble click/tap on the downloaded .reg file to merge it. \nClick/tap on Run, Yes (UAC), Yes, and OK when prompted to approve the merge.\nRestart the PC to apply.\n\n\nI am still getting the error.\n\nMy tests still do not run. Is there something I am missing?\n\nThe code i use to run is as follows:\n\n webdriver.DesiredCapabilities.INTERNETEXPLORER[\"unexpectedAlertBehaviour\"] = \"accept\" \nself.driver = webdriver.Ie(\"C:\\QA\\Automation\\Python_projects\\Selenium Webdriver\\IEDriverServer_Win32_2.46.0\\IEDriverServer.exe\")\nself.driver.get(\"http://riaz-pc.company.local:8080/clearcore\")\nself.login_page = login.LoginPage(self.driver)\nself.driver.implicitly_wait(30)\n\n\nIf i try with the following code:\n\n caps = DesiredCapabilities.INTERNETEXPLORER\n caps['ignoreProtectedModeSettings'] = True\n self.driver=webdriver.Ie(capabilities=caps)\n self.driver.maximize_window()\n\n\nI get the following error:\n \"IEDriver executable needs to be available in the path. \"\nWebDriverException: Message: IEDriver executable needs to be available in the path. Please download from http://selenium-release.storage.googleapis.com/index.html and read up at http://code.google.com/p/selenium/wiki/InternetExplorerDriver\n\nI have set the environment variable path as follows:\nFrom Control Panel\\System\\Environment Variables\nselect and edit Path from System Variables\nI set the value as follows C:\\QA\\Automation\\Python_projects\\Selenium Webdriver\\IEDriverServer_Win32_2.46.0;\n\nIEDriverServer.exe is in the folder IEDriverServer_Win32_2.46.0\n\nI am running Windows 7\nI have set Enable Protected Mode for all the zones from internet options.\n\nSome help appreciated, thanks."
] | [
"python",
"selenium",
"selenium-webdriver"
] |
[
"Obtain data from a form in wordpress",
"I'm building a wordpress website using Avada tamplate. I use the Avada login form in which the users insert their username and password. I would like to get the username of the user when he click on the form button and he's redirect to login.php page. I don't understand why I can't do that. \nThe code of the form (i removed \"class\" and \"style\" in order to reduce it) is: \n\n<form name=\"loginform\" id=\"loginform\" method=\"post\" action=\"http://www.mywebsite.com/es/wp-login.php\">\n <div>\n <div>\n <label for=\"user_login\">Username</label>\n <input type=\"text\" name=\"log\" placeholder=\"Username\" value=\"\" size=\"20\" id=\"user_login\" />\n </div>\n <div>\n <label for=\"user_pass\">Password</label>\n <input type=\"password\" name=\"pwd\" placeholder=\"Password\" value=\"\" id=\"user_pass\" />\n </div>\n </div>\n <div>\n <div>\n <button type=\"submit\" name=\"wp-submit\">Log in</button>\n <input type=\"hidden\" name=\"user-cookie\" value=\"1\" />\n <input type=\"hidden\" name=\"redirect_to\" value=\"login.php\" />\n <input type=\"hidden\" name=\"fusion_login_box\" value=\"true\" />\n <input type=\"hidden\" name=\"_wp_http_referer\" value=\"/es/area-privada/\" /><span></span></div>\n <div></div>\n </div>\n</form>\n\n\nThe login.php code is very simple:\n\n<?php\n $username = $_POST['log'];\n echo $username;\n?>\n\n\nhowever the variable $username is blank and doesn't capture the username. Someone can help me please? thanks!"
] | [
"wordpress",
"forms",
"post",
"button"
] |
[
"Compare two List on C#",
"My question is like this one: \nc# list compare\n\nbut the only thing to note is this:\n\nI'm using .NET Framework 2.0\n\nSo how can I compare two lists on C# framework 2 and return a boolean value if the items are different?\n\ninstance == anotherone fails\ninstance.Equals(anotherone) fails.\n\n\nEdit:\n\nThey are both List\n\nEdit 2\n\nI'm trying to compare if the list values are exactly. I can sort them, np for that. The problem is if the count or the values of the items changes. For example:\n\nList1->Item1 = \"A\"\nList1->Item2 = \"B\"\n\nList2->Item1 = \"B\"\nList2->Item2 = \"A\"\n\n//must return true\n\n\nList1->Item1 = \"A\"\nList1->Item2 = \"B\"\n\nList2->Item1 = \"B\"\nList2->Item2 = \"C\"\n\n//must return false\n\nList1->Item1 = \"A\"\nList1->Item2 = \"B\"\n\nList2->Item1 = \"B\"\nList2->Item2 = \"A\"\nList2->Item3 = \"A\"\n\n//must return false, etc.\n\n\nThanks and kind regards."
] | [
"c#",
"object",
"arraylist",
".net-2.0"
] |
[
"Flask and Chrome: route accessed without Enter",
"I need help on a behavior of Chrome that I cannot explain. \nI don't know the proper terms to google and any pointer is welcome.\n\nIn Flask I defined a route @app.route('/add/<page_id>')\n\nOn Chrome address bar, when a valid address has been typed (i.e. 0.0.0.0:5050/add/id101) the corresponding function is called BEFORE pressing Enter.\n\nOn Firefox this doesn't happen, and nothing is done till the Enter. \n\nIs there a way to set Flask to avoid this behavior, without the need to change the browser's settings?"
] | [
"python",
"google-chrome",
"flask"
] |
[
"NatvieScript Installation Error(windows)",
"I have a problem completing NativeScript installation requirement. I got stuck at number 5 in the installation guide available here.\n\nWhen i run the command \"tns doctor\" in the command prompt, i get the error message below:\n\n\n Cannot find a compatible Android SDK for compilation. To be able to\n build for An droid, install Android SDK 22 or later. Run $\n %ANDROID_HOME%\\tools\\android to manage your Android SDK versions.\n \n You need to have the Android SDK Build-tools installed on your system.\n You can i nstall any version in the following range: '>=23 <=27'. Run\n $ %ANDROID_HOME%\\tools\\android from your command-line to install\n required An droid Build Tools.\n \n You need to have Android SDK 22 or later and the latest Android\n Support Reposito ry installed on your system. Run $\n %ANDROID_HOME%\\tools\\android to manage the Android Support Repository.\n\n\nI have installed the required sdk and i am still getting the same error message and every time i execute this script in the console, it takes like forever to complete: \n\n\n \"%ANDROID_HOME%\\tools\\bin\\sdkmanager\" \"tools\" \"platform-tools\"\n \"platforms;android-25\" \"build-tools;25.0.2\"\n \"extras;android;m2repository\" \"extras;google;m2repository\""
] | [
"nativescript"
] |
[
"JpaRepository read many times lines from postgres table",
"I have a JpaRepository like this\npublic interface InfosRepository extends JpaRepository<Infos, String> {\n\n}\n\nand Infos class like this:\nimport javax.persistence.*;\n\n@Entity\n@Table(name = "infos")\n@EntityListeners(Infos .class)\npublic class Infos {\n\n @Id\n @Column(name = "name")\n private String name;\n\n @Column(name = "age")\n private String age;\n\n public Infos() { }\n\n public Infos(String name) {\n this.name= name;\n }\n\n public Infos(String name, String age) {\n this.age = age;\n this.name= name;\n }\n\n public String getName() {\n return name;\n }\n\n public void setName(String name) {\n this.name= name;\n }\n\n public String getAge() { return age; }\n\n public void setAge(String age) { this.age= age;}\n\n @Override\n public boolean equals(Object other) {\n return (this == other) || this.name.equals( ((Infos) other).name );\n }\n\n @Override\n public int hashCode() {\n return super.hashCode();\n }\n\n}\n\nSo this class should list a postgres table called infos with column name and age. The process work except that I don't retrieve all values that I have in postgres and there are someone duplicate. For example I have in postgres infos table:\n+-------+-----+\n| name| age|\n+-------+-----+\n|charles| 20|\n|charles| 32|\n|charles| 55|\n| ted| 43|\n| albert| 46|\n| clara| 23|\n+-------+-----+\n\nbut in my Object Info I see:\n+-------+-----+\n| name| age|\n+-------+-----+\n|charles| 55|\n|charles| 55|\n|charles| 55|\n| ted| 43|\n| albert| 46|\n| clara| 23|\n+-------+-----+\n\nI loose 20 and 30 since charles is in column id\nI have this class to instantiate my object which listen postgres\n@Service\npublic class ConsumerService {\n\n @Autowired\n private InfosRepository infosRepository ;\n\n @PostConstruct\n public void initializeConsumer() {\n InfosRepository infosRepositoryTest = infosRepository \n }\n}\n\nwhen I place a breakpoint at the line\nInfosRepository infosRepositoryTest = infosRepository \n\nin method initializeConsumer() I evaluate infosRepository which has the wrong element (lost and duplication)\nDo you have any idea?"
] | [
"java",
"spring"
] |
[
"Angular Router Guard not called on back button press",
"I have an Angular app running inside an iframe that has a route guard for the module that I'm running. The route guard is activated whenever I navigate to the page using links inside the app or through the address bar, and routes the app to the correct component. But for some reason, when I click the back button from within the components, the module's route guard fails to fire and the app is navigated to the base component of the module - which should not be happening.\nI've tested and confirmed that router events do get fired when I press the back button inside one of the components using this :\nexport class FourthComponent {\n\n constructor(private readonly router: Router) {\n this.router.events.subscribe((event: NavigationStart) => {\n if (event.navigationTrigger === 'popstate') {\n console.log('back or forward button clicked');\n }\n });\n }\n\nThe console log does print whenever I click the back button from the secondary component screen.\nHere is the child module's routing module routes array:\nconst routes: Routes = [\n {\n path: '',\n canActivate: [SubModuleGuard],\n children: [\n {\n path: 'first',\n component: FirstComponent\n },\n {\n path: 'second',\n component: SecondComponent\n },\n {\n path: 'third',\n component: ThirdComponent\n },\n {\n path: 'fourth',\n component: FourthComponent\n },\n {\n path: '**',\n component: BaseComponent\n }\n ]\n }\n];\n\nFor some reason every time I click back button from the FourthComponent I'm navigated to the BaseComponent (Possibly the case for all child components of SubModule). If I then click the back button again it does a back operation for the parent of the iframe too.\nPlease tell me why the route guard (in this case SubModuleGuard) won't fire and how do I force the route guard to fire when the back button is clicked."
] | [
"angular",
"angular-routing",
"angular-router",
"angular-router-guards"
] |
[
"How to round off a value but not in unit step",
"I am trying to round off couple of decimal values in bash using awk. Ex: if values is 6.79\n\nawk 'BEGIN {rounded = sprintf(\"%.0f\", 6.79); print rounded }'\n\n\nthis returns me 7.\n\nIs there a way in which I can round off not to nearest integer (1,2,3,..) but in steps of 0.5 (0,0.5,1,1.5,2,2.5...)\n\nAny alternate ways to work in python or perl are also fine. Current way in python \n\npython -c \"from math import ceil; print round(6.79)\"\n\n\nalso return 7.0"
] | [
"python",
"perl",
"bash",
"rounding"
] |
[
"In Appium Sendkeys didn't work as expected, it sends more than i give to it",
"I'm using Appium to write test cases of an Android application, when i tap the following code\n\n public void EnterQuantity() {\n wd.findElement(By.xpath(\"//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.RelativeLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[3]/android.widget.LinearLayout[3]/android.widget.LinearLayout[1]/android.widget.EditText[1]\")).sendKeys(\"1\"); \n } \n\n\nI get 11 in Quantity field instead of 1.\nHow can i reduce the speed of writing in order to be sure that only the number i gave is written not doubled."
] | [
"android",
"automated-tests",
"appium",
"sendkeys"
] |
[
"Avoid displaying returned data from Spring @ResponseBody on browser",
"Okay, curerntly I am displaying some data on a html page. I have used jquery ajax call which get the data from the specific url on spring MVC application and return data and then use javascript to display data in the table.\n\n@RequestMapping(value = \"/students\", method = RequestMethod.GET)\n@ResponseBody\n@JsonView(Views.PublicView.class)\npublic ArrayList<Student> getAdminsList(HttpSession session) {\n //return data\n}\n\n\nNow, my question is, I get data as I required via ajax, but I do get data displayed in the browser if I just go through url: www.example.com/students - will display JSON data.\n\nIs there anyway to avoid display this data not in browser but only in ajax call?"
] | [
"javascript",
"jquery",
"http",
"spring-mvc",
"url"
] |
[
"JPA with Maven - Customize DB properties on mvn package",
"I have a project JPA, with maven, that for each new customer, i generate a new war with mvn clean package. But before this, i have to customize the persistence.xml, and change the war, to something like baseproject_customerName.\nThere is any way to configure parameters on POM file, so it can automatically use this parameter to generate war name as i want and use a properties file like, to get database configuration?"
] | [
"java",
"maven",
"jpa"
] |
[
"Do I have to use the localized version of a directory?",
"Suppose I want to save something to the Pictures directory.\n\nI normally would get the path by doing this:\n\n NSArray * paths = NSSearchPathForDirectoriesInDomains (NSPicturesDirectory, NSUserDomainMask, YES);\n NSString *path = [paths objectAtIndex:0];\n\n\nBut now suppose the user is not using english. Is this approach OK for all languages or do I have to use the localized version by adding this line?\n\npath = [[NSFileManager defaultManager] displayNameAtPath:path];"
] | [
"macos",
"cocoa",
"directory",
"nsfilemanager"
] |
[
"OpenLayers features array is empty",
"I've got a map that displays a KML Vector layer with some markers. When you click on the marker it pops up an info box. I want to be able to automatically pop up an info box based on a parameter passed into the page.\nI think I need to do this by using getFeaturesByAttribute() to find a name, however the features array always seems to be empty. (Though I can see the contents when I use FireBug)\n\nWhat do I need to do to get items in the array?\n\nCode: \n\nfunction init()\n{\n var options = {\n projection: new OpenLayers.Projection(\"EPSG:900913\"),\n displayProjection: new OpenLayers.Projection(\"EPSG:4326\"),\n units: \"m\",\n };\n map = new OpenLayers.Map('map', options);\n var mapnik = new OpenLayers.Layer.OSM(\"OpenStreetMap\");\n var gmap = new OpenLayers.Layer.Google(\"Google\", {sphericalMercator:true});\n var gsat = new OpenLayers.Layer.Google(\n \"Google Satellite\",\n {type: google.maps.MapTypeId.SATELLITE, numZoomLevels: 22}\n );\n\n groups = new OpenLayers.Layer.Vector(\"Groups\", {\n projection: map.displayProjection,\n strategies: [new OpenLayers.Strategy.Fixed()],\n protocol: new OpenLayers.Protocol.HTTP({\n url: \"http://maps.google.co.uk/maps/ms?msa=0&msid=210450558816094618535.0004bd79ceb30e9acb9da&output=kml\",\n format: new OpenLayers.Format.KML({\n extractStyles: true,\n extractAttributes: true\n })\n })\n });\n\n map.addLayers([mapnik, gmap, gsat, groups]);\n\n select = new OpenLayers.Control.SelectFeature(groups);\n\n groups.events.on({\n \"featureselected\": onFeatureSelect,\n \"featureunselected\": onFeatureUnselect\n });\n\n map.addControl(select);\n select.activate(); \n\n map.addControl(new OpenLayers.Control.LayerSwitcher());\n\n var center = new OpenLayers.LonLat(-2.58789,51.52283).transform(map.displayProjection, map.projection);\n var zoom = 12\n map.setCenter(center, zoom);\n\n alert(groups.features.length); // is always 0\n\n }"
] | [
"openlayers"
] |
[
"SQL to get next monday in Presto",
"I need to get the date for next Monday irrespective of which day the sql is executed.\n\nI think the logic 7 - day_of_week(current_date)%7 + 1 would work, but then how to get the date.\n\nselect current_date;\n\n _col0\n1 2019-11-16\n\n\nselect (7 - day_of_week(current_date)%7+1)\n\n\n _col0\n1 2\n\n\n\nOr is there any other better way to do the same.\n\nI will appreciate any help!!"
] | [
"sql",
"datetime",
"presto",
"amazon-athena",
"date-arithmetic"
] |
[
"Will activity run onDestroy when system kill it?",
"I am wondering that will activity run the method \"onDestroy\" when killed by system?\n\nfor example, when the state of \"activity A\" is onStop ( user may press the Home button directly ), \nat the same time, system find out that the memory is not enough so system have to kill some background processes to keep foreground activity alife, say system kill activity A. \n\nWill activity A run the method \"onDestroy\" in this situation?"
] | [
"android",
"lifecycle",
"ondestroy"
] |
[
".htaccess redirect subdirectory as query string in php",
"This is hard to explain, so hopefully I'm understood in my question.\n\n(1) I want to create \"SEO friendly\" links that remove the query string from a web site. There is only one variable, let's call it \"page\". Here is the following code for my .htaccess file.\n\nOptions +FollowSymLinks\n\nRewriteEngine On\nRewriteRule ^(.*)$ index.php?page=$1\n\n\nThis works in providing the proper redirect. So /applications/ will send to index.php?page=applications.\n\n(2) My index.php will include a view page based on the value of $_GET['page']. Here is some sample code below:\n\nswitch ($_REQUEST['page']) {\n\n default:\n include (\"home.php\");\n break;\n\n case \"apps\":\n include (\"apps.php\");\n break; \n\n}\n\n\nThere seems to be no problems so far.\n\n(3) Let's make apps.php an exact copy of home.php. home.php loads just fine, but apps.php will not load linked CSS and JScript pages. When apps.php is loaded, it thinks it is in the /apps/ directory. To load the linked pages, I would need to insert a \"../\" in front of the file name. Then it displays correctly.\n\nSo my question is -- How can I properly write the .htaccess file so the home.php and apps.php page can be identical files and produce identical results, instead of the apps.php file being treated as if it were in the /apps/ directory?"
] | [
"php",
"apache"
] |
[
"In Java, Is there a way to get date with suffix by locale?",
"For Example, with a date of 02/01 without date suffix. \n\nGiven an input parameter of en_US(locale), it will return February 1st.\n\nGiven an input parameter of fr_CA(locale), it will return février 1er.\n\nGiven an input parameter of zh_CN(locale), it will return 二月 1日.\n\nThe thing that I really expect is date with suffix by locale. I have searched some java source online and I can get English date with suffix by doing something like this.\n\n switch (previousChar) {\n case '1': {\n return \"th\";\n }\n default: {\n switch (lastChar) {\n case '1':\n return \"st\";\n case '2':\n return \"nd\";\n case '3':\n return \"rd\";\n default:\n return \"th\";\n }\n }\n }\n\n\nHowever, this is not enough. Because for different locales/languages, the suffix for date are different.\n\nAny help will be really appreciated!"
] | [
"java",
"date",
"locale"
] |
[
"limit choices with dropdown in flask-admin",
"My SQLAlchemy model has a String field that I would like to limit to a few choices. \n\nI am wondering how I would be able to create a dropdown for this field in the Flask-Admin interface that would ensure that the db is only populated with one of my choices. If I let the user manually enter these fields, they may spell them incorrectly, etc."
] | [
"python",
"flask-admin"
] |
[
"How display content created by specific user using ASP.NET Core, Identity Framework with Entity Framework",
"I am trying to create an ASP.NET Core web application where people can create, edit, delete, and view goals. I was able to use Entity Framework with Identity Framework to authenticate users but I want to authorize/display content specifically recorded by that user. Right now, the page will display everything created by all users.\n\nThis is the index method in the Goals controller.\n\n[Authorize]\n// GET: Goals\npublic async Task<IActionResult> Index()\n{\n return View(await _context.Goal.ToListAsync());\n}\n\n\nHere is some Goals controller code that pulls in UserManager:\n\npublic class GoalsController : Controller\n{\n private readonly UserManager<ApplicationUser> _userManager;\n private readonly ApplicationDbContext _context;\n\n public GoalsController(ApplicationDbContext context, UserManager<ApplicationUser> userManager)\n {\n _context = context;\n _userManager = userManager;\n }\n\n\nI have read a few different approaches with regular old Asp.Net but nothing the says what the best practice is for ASP.NET Core. Should I be using a LINQ?\n\nHere is the goal model:\n\npublic class Goal\n{\n [Key]\n public int TaskID { get; set; }\n public string UserID { get; set; }\n [Display(Name = \"Description\")]\n public string Description { get; set; }\n public bool IsSubGoal { get; set; }\n [Display(Name = \"Due Date\")]\n [DisplayFormat(DataFormatString = \"{0:yyyy-MM-dd}\")]\n\n public DateTime? DueDate { get; set; }\n [Display(Name = \"Created On\")]\n [DisplayFormat(DataFormatString = \"{0:yyyy-MM-dd}\")]\n public DateTime CreatedOn { get; set; }\n [Display(Name = \"Last Modified\")]\n [DisplayFormat(DataFormatString = \"{0:yyyy-MM-dd}\")]\n\n public DateTime? LastModified { get; set; }\n}\n\n\nUserID is where the user id is being stored at the time a goal is created."
] | [
"entity-framework",
"asp.net-core",
"asp.net-identity"
] |
[
"Binding a dropdownlist and then adding a new listitem",
"I have a DropDownList which I initialize in a function called CreateChildControls before adding it to the Controls collections. I then override the Render() method and then render the DropDownList. The web part inherits from System.Web.UI.WebControls.WebParts.WebPart. \n\nI bind the DropDownList in my web part like this:\n\nprivate void BindClientTypes()\n{\n DataTable dt = DB.GetAllClientTypes();\n\n if (dt == null)\n {\n ltGlobalErrorMsg.Text = GlobalErrorMessage;\n ltGlobalErrorMsg.Visible = true;\n }\n else\n {\n ddlClient.DataSource = dt;\n ddlClient.DataValueField = \"ID\";\n ddlClient.DataTextField = \"Name\";\n ddlClient.DataBind();\n ddlClient.Items.Insert(0, PleaseSelectItem);\n }\n}\n\n\nIf I try to set the SelectedIndex of the DropDownList after calling DataBind, I get an error which says the control cannot have multiple selected items.\n\nThat code works fine, and I can set the SelectedIndex after the data bind if I comment out this line:\n\nddlClient.Items.Insert(0, PleaseSelectItem);\n\n\nCan anyone explain why this wouldn't work?\n\nThanks."
] | [
"c#",
"asp.net",
"sharepoint",
"web-parts"
] |
[
"Creating associations in Sequelize migration",
"Nodejs. Sequelize 4.41. Try to make 2 models with relation many-to-many through another table. Running with sequelize-cli, for example...\n\nsequelize model:generate --name Camera --attributes name:string,sn:string\n\n\nHere is models\n\n// Camera model\n\n'use strict';\n\nmodule.exports = (sequelize, DataTypes) => {\n const Сamera = sequelize.define('Сamera', {\n name: DataTypes.STRING,\n sn: DataTypes.STRING\n }, {});\n Сamera.associate = function(models) {\n // associations can be defined here\n Camera.belongsToMany(models.Relay, {through: 'CameraRelay'});\n };\n return Сamera;\n};\n\n\nAnd\n\n// Relay model\n\n'use strict';\n\nmodule.exports = (sequelize, DataTypes) => {\n const Relay = sequelize.define('Relay', {\n name: DataTypes.STRING,\n sn: DataTypes.STRING,\n channel: DataTypes.INTEGER\n }, {});\n Relay.associate = function(models) {\n // associations can be defined here\n Relay.belongsToMany(models.Camera, {through: 'CameraRelay'});\n };\n return Relay;\n};\n\n\nIn documentation there are phrase\n\n\n Belongs-To-Many associations are used to connect sources with multiple targets. Furthermore the targets can also have connections to multiple sources.\n \n Project.belongsToMany(User, {through: 'UserProject'});\n User.belongsToMany(Project, {through: 'UserProject'});\n \n This will\n create a new model called UserProject with the equivalent foreign keys\n projectId and userId.\n\n\nMigrations is\n\n// create-relay\n\n'use strict';\nmodule.exports = {\n up: (queryInterface, Sequelize) => {\n return queryInterface.createTable('Relays', {\n id: {\n allowNull: false,\n autoIncrement: true,\n primaryKey: true,\n type: Sequelize.INTEGER\n },\n name: {\n type: Sequelize.STRING\n },\n sn: {\n type: Sequelize.STRING\n },\n channel: {\n type: Sequelize.INTEGER\n },\n createdAt: {\n allowNull: false,\n type: Sequelize.DATE\n },\n updatedAt: {\n allowNull: false,\n type: Sequelize.DATE\n }\n });\n },\n down: (queryInterface, Sequelize) => {\n return queryInterface.dropTable('Relays');\n }\n};\n\n\nAnd\n\n//create camera\n'use strict';\nmodule.exports = {\n up: (queryInterface, Sequelize) => {\n return queryInterface.createTable('Сameras', {\n id: {\n allowNull: false,\n autoIncrement: true,\n primaryKey: true,\n type: Sequelize.INTEGER\n },\n name: {\n type: Sequelize.STRING\n },\n sn: {\n type: Sequelize.STRING\n },\n createdAt: {\n allowNull: false,\n type: Sequelize.DATE\n },\n updatedAt: {\n allowNull: false,\n type: Sequelize.DATE\n }\n });\n },\n down: (queryInterface, Sequelize) => {\n return queryInterface.dropTable('Сameras');\n }\n};\n\n\nWhy it doesn't create model CameraRelay and doesn't create migration for same model when I running migrate?"
] | [
"node.js",
"sequelize.js"
] |
[
"How to populate value based on the value entered in DateInput in RShiny",
"I am currently developing a Shiny App. Here, when I select a value from selectizeInput() and enter a date, then the date entered should be populated in the another dataInput(). For example if I selected \"M\" and if I entered a date, then the same date should be displayed in other dateInput(). I tried it using observeEvent(). But it did not work. \n\nHere is the code used:\n\nshinyApp(\n ui = fluidPage(\n selectizeInput('role', 'Select the Role',\n choices = c('VP','M','AC','C'),options = list(\n placeholder = \"Please select your Role\",\n onInitialize = I('function() { this.setValue(\"\"); }'))),\n dateInput('cus', label ='Enter Current role start date',value = \"\",format = \"mm/dd/yy\"),\n dateInput('m', label ='Enter M date',value = \"\",format = \"mm/dd/yy\")\n\n ),\n server = function(input, output,session) {\n observeEvent(input$role == \"M\",{\n updateDateInput(session, \"m\", value = (input$cus) )\n })\n }\n)\n\n\nCan anyone help me solve this issue? Thanks in advance!!"
] | [
"r",
"shiny"
] |
[
"Micronaut security with OKTA - OAUTH 2.0",
"I have a Micronaut rest endpoint which is secured by @Secured(SecurityRule.IS_AUTHENTICATED)\n@Secured(SecurityRule.IS_AUTHENTICATED)\n@Controller("/product")\n@Secured({"Admin"})\npublic record ProductController(IProducer iProducer) {\n @Get(uri = "/{text}")\n public Single<String> get(String text){\n return iProducer.sendText(text);\n }\n}\n\nI am using the Validation with remote JWKS https://micronaut-projects.github.io/micronaut-security/latest/guide/#jwks\nApplication.yml\nmicronaut:\n security:\n enabled: true\n token:\n jwt:\n enabled: true\n signatures:\n jwks:\n okta:\n url: 'https://xxx-xxxxxx.okta.com/oauth2/default/v1/keys'\n\nDecode JWT\n{\n "jti": "AT.Y4r-Hu9ss5FXJRomosJlJRSGSsv4vscLeGI5seM2BJA",\n "iss": "https://dev-6271510.okta.com/oauth2/default",\n "aud": "api://default",\n "iat": 1608187083,\n "exp": 1608190683,\n "cid": "0oa2lezagQ4wrRUnW5d6",\n "uid": "00u2kavl6tQtJ7NNj5d6",\n "scp": [\n "openid"\n ],\n "sub": "[email protected]",\n "Admin": "[email protected]"\n}\n\nQuestions\n\nSince I am using Validation with remote JWKS, is this is the only way to validate the OKTA JWT token. How can I validate the OKTA JWT without remote JWKS.\nIn the token I have a claim ADMIN, how can I secure my controller route with ADMIN claim.I tried @Secured({"Admin"}) it give me 403 forbidden\nIs there a way to create security requirement and handler for the requirement"
] | [
"java",
"micronaut",
"micronaut-client",
"micronaut-rest"
] |
[
"Ruby class initialize error - undefined method 'has_key?'",
"So I was following this Balanced Payments tutorial, and tried tweaking their Payment model to fit my application.\n\nOriginal:\n\nclass Payment\n\n def initialize(email, amount, credit_card_hash)\n @email = email\n @amount = (amount * 100).to_i\n @credit_card_hash = credit_card_hash\n @buyer = nil\n @card = nil\n @errors = []\n end\n\nend\n\n\nMy simplified version (Updated with code of full model):\n\nrequire 'balanced'\n\nclass Transaction < ActiveRecord::Base\n\n attr_reader :errors, :amount\n\n def initialize(amount)\n @amount = (amount * 100).to_i\n @buyer = nil\n @card = nil\n @errors = []\n end\n\n def charge\n begin\n find_or_create_buyer\n debit_buyer\n credit_owner\n return true\n rescue\n return false\n end\n end\n\n private \n\n def find_or_create_buyer\n begin\n @buyer = current_user.balanced_customer\n rescue\n @errors << 'Your account is invalid'\n end\n end\n\n def debit_buyer\n begin\n payment = @buyer.debit(@amount, \"Test transaction\")\n rescue\n @errors << 'Your credit card could not be charged'\n end\n end\n\n def credit_owner\n begin\n Balanced::Marketplace.my_marketplace.owner_account.credit(amount)\n rescue\n @errors << 'Your credit card payment did not go through.'\n end\n end\n\n\nend\n\n\nThe problem is I'm getting what seems like a pure ruby error every time I try to instantiate the class from the rails console,\n\n> payment = Transaction.new(0.01)\n output error: #<NoMethodError: undefined method `has_key?' for nil:NilClass>\n\n\nI've googled around and haven't been able to come up with a good answer.\n\nAny ideas?"
] | [
"ruby-on-rails",
"ruby"
] |
[
"Should a primary key in a table be a user-defined string or a UUID?",
"I am working on an app where users will be able to create listings for sale.\nMy table will hold data like: a title (string), a category (string), the price (number) and some other that are not as important.\nI also need a slug for the URLs, so my question is: Should I store the slug as the primary key (ID) or put it as a Global Secondary Index?."
] | [
"nosql",
"amazon-dynamodb"
] |
[
"python: TypeError: expected string or buffer: can't reproduce error with prompt",
"I am trying to debug this function:\n\ndef check_domains(url):\n global num_websites,domain_queue,domains,doc_queue,stanford_tagger\n the_domain = re.match(r'^(:?https?:\\/\\/[^.]*\\.)?([^/#?&]+).*$',url)\n if the_domain is not None:\n if the_domain.groups(0)[1] not in domains.keys():\n domains[the_domain.groups(0)[1]] = website(doc_queue,the_domain.groups(0)[1])\n domains[the_domain.groups(0)[1]].add_initial_url(url)\n domain_queue.append(domains[the_domain.groups(0)[1]])\n num_websites = num_websites + 1\n else:\n domains[the_domain.groups(0)[1]].add_url(url)\n\n\nerror:\n\n File \"web_crawler.py\", line 178, in getdoc\n check_domains(check)\n File \"web_crawler.py\", line 133, in check_domains\n the_domain = re.match(r'^(:?https?:\\/\\/[^.]*\\.)?([^/#?&]+).*$',url)\n File \"/usr/local/lib/python2.7/re.py\", line 137, in match\n return _compile(pattern, flags).match(string)\nTypeError: expected string or buffer\n\n\nI try and be a good boy and test in interactive mode:\n\n>>> def check_domains(url):\n... the_domain = re.match(r'^(:?https?:\\/\\/[^.]*\\.)?([^/#?&]+).*$',url) #right here\n... if the_domain is not None:\n... print the_domain.groups(0)[1]\n... else:\n... print \"NOOOO!!!!!\"\n... \n>>> \n>>> check_domains(\"http://www.hulu.com/watch/6704\")\nhulu.com\n>>> check_domains(\"https://docs.python.org/2/library/datetime.html\")\npython.org\n\n\nso this does what I want it to do and I didn't change that line. But why???"
] | [
"string",
"python-2.7"
] |
[
"Regex for finding between 1 and 3 character in a string",
"I am trying to write a regex which should return true, if [A-Za-z] is occured between 1 and 3, but I am not able to do this\n\npublic static void main(String[] args) {\n String regex = \"(?:([A-Za-z]*){3}).*\";\n String regex1 = \"(?=((([A-Za-z]){1}){1,3})).*\";\n\n Pattern pattern = Pattern.compile(regex);\n System.out.println(pattern.matcher(\"AD1CDD\").find());\n}\n\n\nNote: for consecutive 3 characters I am able to write it, but what I want to achieve is the occurrence should be between 1 and 3 only for the entire string. If there are 4 characters, it should return false. I have used look-ahead to achieve this"
] | [
"java",
"regex"
] |
[
"How to Convert base64 data of tiff (String) to base64 data of png (String) in Ruby?",
"I am trying to convert base64 of tiff to base64 of png in controller of Ruby on Rails.\nBut, failed...\nmy ruby code is\n@png_de =Base64.strict_encode64(IO.read('..//test1234.tif', mode: 'rb') ) \n\nthis code causes not display a png image but a load failed icon in chrome.\nI don't know how to fix the above issue"
] | [
"ruby-on-rails",
"ruby",
"base64"
] |
[
"Where are Queries performed in Yii Framework",
"Im using the Yii Framework (v 1.1.14). Where in the frame are the queries performaned (I want to measure the performance and build in a caching-system.\n\nThank you very much!"
] | [
"mysql",
"pdo",
"frameworks",
"yii"
] |
[
"sign request to AWS API gateway with Signature v4 from using AWS Cognito token",
"I created a AWS API Gateway set with authentication = AWS_IAM to call a Lambda function. Now, to call this API I understand that I need to sign the request and as stated in the AWS documentation the correct way is to add the Authorization header calculated using AWS Signature V4 which need an access_key and a secret_key. \nOn my client side the user authenticate with AWS Cognito first and receive the JWT tokens (id token access token and refresh token) but I cannot find the access_key/secret\n_key in them. How can I calculate the AWS Signature V4 from the tokens received from AWS Cognito?"
] | [
"aws-api-gateway",
"amazon-cognito"
] |
[
"Configure datapipeline to receive parameter values from a Lambda",
"I have a Lambda function that activates a datapipeline:\n\nclient.activate_pipeline(\n pipelineId='df-0680373LNPNFF73UDDD',\n parameterValues=[{'id':'myVariable','stringValue':'ok'}])\n\n\nHow do I configure the datapipeline to receive the parameterValues at activation. I want to pass the parameter value 'ok' to a ShellCommandActivity via Script Argument for example."
] | [
"amazon-web-services",
"amazon-data-pipeline",
"data-pipeline"
] |
[
"smart-table row selection enable disable using script",
"I am working on on page where I need to show row selected and I need to populate that selected row in form next to that grid, its working properly but I am trying to implement disable row selection when user is editing any existing row, please let me know how to resolve this. thanks."
] | [
"angularjs",
"smart-table"
] |
[
"Setup a link to a Region in Visual Studio / C# Comments",
"Is there a way to setup a link to an Region in C# / Visual Studio in the comments?\nSo you press the link and jump directly to the specified region?"
] | [
"c#",
"hyperlink",
"region"
] |
[
"Toggle NSStatusItem with NSMenu in Objective-C",
"I've got an application which toggle's a NSStatusItem from the preferences window. The preferences window has a checkbox \"enabled/disabled\" which calls the \"enabledStatusItem\" and \"disableStatusItem\"-methods in the class NSStatusItem.\n\nThis all works fine, my problem is adding a menu to this NSStatusItem. The code in the class NSStatusItem looks like this:\n\n-(void)enableStatusItem\n{\n //get icon\n theIcon = [NSImage imageNamed:@\"test.png\"];\n\n //create item\n statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];\n [statusItem setImage:theIcon];\n [statusItem setHighlightMode:YES];\n [statusItem setMenu:statusMenu];\n}\n\n-(void)disableStatusItem\n{\n [[NSStatusBar systemStatusBar] removeStatusItem:statusItem];\n}\n\n\nEverything works, except setMenu. At first I loaded the StatusItem in awakeFromNib, then setMenu worked. But the StatusItem has to stay off when the preference checkbox is \"off\", so I couldn't load it in awakeFromNib anymore. \n\nI suspect setMenu doesn't load because it isn't in awakeFromNib, but \"enableStatusItem\" is called after awakeFromNib, so in awakeFromNib there isn't a statusItem yet to add the menu to. And I can't \"preload\" the statusItem because it is created with \"[[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];\"\n\nI've tried a lot so far, even made a test-application where I added every piece of code one by one, so I could break it down. But without any success so far.\n\nI feel because it's such a simple thing, only one little NSMenu, isn't there a simple solution then?\n\nMaybe one of you guys has an idea?\n\nThanks in advance for your time,\nGreetings Frans"
] | [
"objective-c",
"macos",
"cocoa"
] |
[
"Python loop causing \"error: [Errno 105] No buffer space available\"",
"I have a loop that goes through a Range(300) and creates a Thread with 'import threading'.. So this creates 300 threads, which is correct. \n\nHowever I'm getting a problem where not all the threads start up, and a error is shown in console. as below \n\n File \"/usr/local/lib/python2.7/dist-packages/scapy/supersocket.py\", line 29, in send\nreturn self.outs.send(sx)\nerror: [Errno 105] No buffer space available\n\n\nQ: Is there a way I can increase the buffer?\n\nQ: Is this a python limit, or a process limit?"
] | [
"python",
"multithreading"
] |
[
"Depth of ternary tree - MLM Level",
"I am working on a MLM in php where every node can have only 3 children. the MLM have N Levels.\nthe Level of any parent node will be equal to the lowest level of its child node + 1. child at depth n has Level = 1.\n\nfunction calculate_level($starId=0) {\n\nif($starId == null) return 1;\n\n$result = getAllChildren($starId);\n\nif($result && count((array)$result) == 3){\n\n return 1 + min(calculate_level($result[0]->user_ref_id),calculate_level($result[1]->user_ref_id),calculate_level($result[2]->user_ref_id));\n\n}else{ return 1;}\n\n\n}\n\nfunction level_calculator($starId = 0) {\n\n$result = getAllParents($starId);\n\n//now we have all parents of current star now we need to find the level for each.\n\nforeach($result as $res){\n\n if($res->user_status == 3 ){\n\n //we only update level if status == 3\n\n $level = calculate_level($res->user_ref_id);\n\n echo $level .':' . $res->user_ref_id .',';\n\n\n }\n}\n\n\n}\n\ndatabase layout image.\n\n\n\nExpected Result\n\n\n\nHow can i achieve this. \n\nThanks."
] | [
"php",
"wordpress",
"tree",
"mlm",
"ternary-tree"
] |
[
"Passing className prop to Material-ui child/inner elements",
"Is it possible to assign a css class to the inner elements of a Material-UI component. Using the <RaisedButton /> component as an example, lets say that I want to apply a className to the label element within Raised Button. \n\n<RaisedButton labelStyle={{...}}. \n\nSince labelStyle is looking for an object, how would I apply a custom css class rather than adding inline code?"
] | [
"reactjs",
"material-ui"
] |
[
"How to Interpret an Enter KeyPress as a Tab in C#",
"I just recently began in C# development, and I was working on a forms-based project and I am trying to perform a \"tab\" action when the user is on a form and pressed the Enter key.\n\nI know the answer is probably quite simple, but I am a newbie in this realm."
] | [
"c#",
".net",
"winforms",
"keypress"
] |
[
"Sencha Touch 2 : A simple handler for HTML Button displayed insided panel is giving undefined error",
"I have a pretty simple html. This html is displayed inside Sencha Panel using panel.setHtml method.\nLayOut of the sample HTML is as below.\n\nHTML File\n\n<!DOCTYPE html>\n<html>\n<head>\n<script>\nfunction copyText()\n{\nalert('It is clicked');\n}\n</script>\n</head>\n<body>\n\nField1: <input type=\"text\" id=\"field1\" value=\"Hello World!\"><br>\nField2: <input type=\"text\" id=\"field2\">\n<br><br>\n<button onclick=\"copyText()\">Copy Text</button>\n\n</body>\n</html>\n\n\nBelow code sets html inside the panel.The above mentioned html is truncated into one line \nand is set inside the panel as below.\n\nvar res = '<!DOCTYPE html><html><head><script>function copyText(){}</script></head><body>Field1: <input type=\"text\" id=\"field1\" value=\"Hello World!\"><br>Field2: <input type=\"text\" id=\"field2\"><br><br><button onclick=\"copyText()\">Copy Text</button><p>A function is triggered when the button is clicked. The function copies the text from Field1 into Field2.</p></body></html>';\nExt.getCmp('dummyPanel').setHtml(res);\n\n\nISSUE :\n\nWhen the Button is clicked, I am getting 'Uncaught ReferenceError: copyText is not defined' Error.\n\nAny ideas of what wrong I am doing here? Cant we set the complete html with the inside the sencha panel.\n\nThe running code is at http://www.senchafiddle.com/#5LdC5\n\nPlease help.\n\nThank you,\nGendaful"
] | [
"javascript",
"extjs",
"sencha-touch",
"sencha-touch-2"
] |
[
"Replace content of an XML based on a lookup table in powershell",
"I have an XML file with some specific keywords I need to replace, here's an example:\n\n <?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--Exported at 23-09-2019 10:01:23-->\n<DEFTABLE xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"Folder.xsd\">\n <SMART_FOLDER JOBISN=\"1\" APPLICATION=\"6261\" SUB_APPLICATION=\"R001J_CMNOK\" JOBNAME=\"6261_R001J_CMNOK\" DESCRIPTION=\"Snapshot des jobs not ok de control-m ds intraprd2\" >\n <JOB JOBISN=\"2\" APPLICATION=\"6261\" SUB_APPLICATION=\"R001J_CMNOK\" MEMNAME=\"R010J.BAT\" JOBNAME=\"6261R001J010J_CMNOK\" DESCRIPTION=\"[07:00] Chargement job ended_notok\" CREATED_BY=\"Graf\">\n <VARIABLE NAME=\"%%LIBMEMSYM\" VALUE=\"%%VG_LIBMEMSYM./CTM.var\" />\n <RULE_BASED_CALENDARS NAME=\"*\" />\n </JOB>\n </SMART_FOLDER>\n</DEFTABLE>\n\n\nI need to replace \"Recette\" with \"Production\" and \"6261_R001J_CMNOK\" with \"6261_P001J_CMNOK\" and write the new XML in a copy of the file I made earlier like this:\n\n$CreateFileName = $($OriginalXMLFilePath -replace \".{4}$\") + \"_\" + $(Get-Date -UFormat \"%Y-%m-%d_%H%M%S\") + \".xml\"\n$CopyFile = Copy-Item $OriginalXMLFilePath -Destination $CreateFileName -Force\n# New file name is 6261_XML_2019-11-18_135100.xml\n\n\nI made the following variables:\n\n$A_Lookup = @(\"Recette\",\"6261_R001J_CMNOK\")\n$B_Replace = @(\"Production\", \"6261_P001J_CMNOK\")\n\n\nHere was the rest of my code to replace the XML:\n\n$Read = Get-Content -Path $OriginalXMLFilePath\nfor ($i = 0; $i -lt $A_Lookup.length; $i++) {\n $Read = $Read -replace $A_Lookup[$i], $B_Replace[$i]\n}\nRemove-Item -Path $OriginalXMLFilePath -Force \nAdd-Content -Path $OriginalXMLFilePath -Value $Read -Force\n\n\nProblem is, there was around 25+ items after the @( and that's not very optimized when we need to add more content there. So I decided to make a lookup table instead:\n\n$lookupTable = @{\n \"Recette\" = \"Production\"\n \"6261_R001J_CMNOK\" = \"6261_P001J_CMNOK\"\n}\n\n\nBut now my main issue is that the part of my code that would replace $A_Lookup by $B_Replace doesn't work anymore. I tried the \"Solution 4\" on this page and other solutions around Stack Overflow but none really worked for me. What's blocking me the most is that I can't seem to write anything into the new XML file. \n\nI'm running on the latest version of PowerShell."
] | [
"xml",
"powershell",
"powershell-2.0",
"powershell-3.0",
"powershell-4.0"
] |
[
"Finding average for columns with two values in pivot tables",
"I have created a pivot table with column labels having two values (i.e \"YES\" or \"NO\") and it also provides a grand total on the next column. \n\nI am trying to figure out a way to find the averages for the two values with respect to the grand total.\n\nHere is my table:"
] | [
"excel",
"pivot-table"
] |
[
"u3-tool in a bash pipe not works | Segmentation fault in C",
"I want to get the output of the u3-tool (http://u3-tool.sourceforge.net/) into a variable.\nThe result without redirect the streams is: \n\n$ echo \"pass\" | sudo -S sh -c \"u3-tool -i /dev/sdc\"\nTotal device size: 1.88 GB (2022703104 bytes)\nSegmentation fault\n\n\nBut If I redirect the pipe to a file: echo \"pass\" | sudo -S sh -c \"u3-tool -i /dev/sdc > /tmp/u3info 2>&1\", then I get only the second line Segmentation fault!\n\nDoes anyone have an idea? \nWhere is \"Total device size: 1.88 GB (2022703104 bytes)\" from the stdout?\n\nWhat is Segmentation fail of the language C? How I can solve it?\n\nKing regards and Merry Christmas!\n\nIn Using is Linux Mint 17.3"
] | [
"c",
"linux",
"bash",
"segmentation-fault",
"pipe"
] |
[
"Convert Json into CSV",
"I have json in this format and want to convert in to the CSV file. \n\n{\n \"extrapolationLevel\": 1,\n \"columnNames\": [\n \"name\",\n \"usersession.country\",\n \"application\",\n \"usersession.osFamily\",\n \"usersession.startTime\",\n \"visuallyCompleteTime\"\n ],\n \"values\": [\n [\n \"pdp\",\n \"Serbia\",\n \"Desktop\",\n \"Windows\",\n 1573215462076,\n 1503\n ],\n\n ]\n}\n\n\nI want to convert this json into CSV format here is my script \n\nimport csv\nimport json\n\nwith open('response_1573222394875.json') as infile:\n Data = json.loads(infile.read())\n\nwith open(\"q.csv\", \"w\") as outfile:\n f = csv.writer(outfile)\n f.writerow([\"name\",\"usersession.country\",\"application\",\"usersession.osFamily\",\"usersession.startTime\",\"visuallyCompleteTime\"])\n f.writerow([Data[\"name\"], Data[\"usersession.country\"],\n Data[\"application\"],\n Data[\"usersession.osFamily\"],\n Data[\"usersession.startTime\"],\n Data[\"visuallyCompleteTime\"]])\n\n\nExpected Output \n\n name usersession.country application usersession.osFamilyusersession.startTime visuallyCompleteTime\n pdp Serbia Desktop Windows 1573215462076 1503\n plp us APP Windows 1573215462076 1548\n startpage uk Site Windows 1573215462076 1639\n product india Desktop Windows 1573215462076 3194\n pdp Vietnam APP Windows 1573215462076 3299\n\n\ncan any one help me here please."
] | [
"python",
"json",
"file",
"parsing",
"export-to-csv"
] |
[
"http and non-www redirect to https",
"okay. i freaking hate it. i've been trying to resolve this for hours but i still can't figure out was wrong or what i am missing.\n\ni have this code:\n\nRewriteEngine On\nRewriteCond %{HTTPS} off [OR]\nRewriteCond %{HTTP_HOST} !^$ \nRewriteCond %{HTTP_HOST} !^www\\. [NC]\nRewriteRule ^ https://www.domain.com%{REQUEST_URI} [R=301,L,NE]\n\n\nit does redirects http request to https but\nwhenever i type domain.com it redirects to https://domain.com\nwhich throws an ssl error that says:\n\nThis is probably not the site you are looking for!\nYou attempted to reach domain.com, but instead you actually reached a server identifying itself as www.domain.com. This may be caused by a misconfiguration on the server or by something more serious. An attacker on your network could be trying to get you to visit a fake (and potentially harmful) version of domain.com."
] | [
".htaccess",
"http",
"redirect",
"https"
] |
[
"Google BigQuery clustered table not reducing query size when running query with WHERE clause on clustered field",
"I have a Google BigQuery table of 500,000 rows that I have setup to be partitioned by a TIMESTAMP field called Date and clustered by a STRING field called EventCategory (this is just a sample of a table that is over 500 million rows).\n\nI have a duplicate of the table that is not partitioned and not clustered. \n\nI run the following query on both tables:\n\nSELECT \n * \nFROM \n `table_name` \nWHERE\n EventCategory = \"email\"\n\n\nThere are only 2400 rows where EventCategory is \"email\". When I run the query on the non clustered table I get the following:\n\n\n\nWhen I run the query on the clustered table I get the following:\n\n\n\nHere is the schema of both the non clustered and the clustered table:\n\nDate TIMESTAMP NULLABLE\nUserId STRING NULLABLE\nEventCategory STRING NULLABLE\nEventAction STRING NULLABLE\nEventLabel STRING NULLABLE\nEventValue STRING NULLABLE\n\n\nThere is basically no difference between the two queries and how much data they look through and I can't seem to figure out why? I have confirmed that the clustered table is partitioned and clustered because in the BigQuery UI in table details it actually says so and running a query by filtering by Date greatly reduces the size of the data searched and shows the estimated query size to be much smaller. \n\nAny help here would be greatly appreciated!\n\nUPDATE:\n\nIf I change the query to:\n\nSELECT\n *\nFROM\n `table_name` \nWHERE\n EventCategory = \"ad\"\n\n\nI get the following result:\n\n \n\nThere are 53640 rows with EventCategory is \"ad\" and it looks like clustering did result in less table data being scanned, albeit not much less (529.2MB compared to 586MB).\n\nSo it looks like clustering is working but the data is not clustered properly in the table? How would I fix that? I have tried re-creating the table multiple times using DDL and even saving the table data to a JSON in GCS and then importing it into a new partitioned and clustered table but it hasn't changed anything.\n\nDoes the date partitioning sit on top of the clustering? Meaning that BigQuery first groups by date and then groups by cluster within those date groups? If so, I think that would probably explain it but it would render clustering not very useful."
] | [
"google-bigquery"
] |
[
"Add white breaking line after text in textarea",
"I want to have a breaking line or two breaking lines after the text in a textarea without the user hitting \"Enter\" for a new line so that empty line will show up in printed page\n\n\r\n\r\n<html >\r\n<head>\r\n\r\n<!-- script print button -->\r\n <script type=\"text/javascript\">\r\n function printTextArea() {\r\n \r\n childWindow = window.open('','childWindow','location=yes, menubar=yes, toolbar=yes');\r\n childWindow.document.open();\r\n childWindow.document.write('<html><head></head><body dir=\"rtl\">');\r\n childWindow.document.write(document.getElementById('targetTextArea').value.replace(/\\n/gi,'<br/>'));\r\n childWindow.document.write('</body></html>');\r\n childWindow.print();\r\n childWindow.document.close();\r\n childWindow.close();\r\n }\r\n </script>\r\n<style type=\"text/css\">\r\n\r\ntextarea {\r\ndirection: rtl; \r\n background-color: white;\r\n font-size: 1em;\r\n font-weight: bold;\r\n font-family: Verdana, Arial, Helvetica, sans-serif;\r\n border: 1px solid #00acee;\r\n resize: none;\r\n}\r\n\r\n</style>\r\n</head>\r\n\r\n<body>\r\n <p>\r\n <TEXTAREA name=\"thetext\" rows=\"20\" cols=\"80\"id=\"targetTextArea\" placeholder=\"قم بنسخ و لصق الطلب لملأه و التعديل عليه و طباعته بالزر أسفله ......\">\r\n</TEXTAREA>\r\n </p>\r\n <!-- print button -->\r\n <center> <input type=\"button\" onclick=\"printTextArea()\" value=\"طباعة\"/></center>\r\n</body>\r\n</html>"
] | [
"javascript",
"html",
"css",
"printing",
"textarea"
] |
[
"d3 zooming/panning behavior changes at millisecond intervals",
"I am working in a problem domain where I need to display data at millisecond time intervals. I have found that when you zoom in far enough on a graph, the behavior of the zoom/pan functions suddenly change! If you are using a time scale, this happens exactly when your axis starts displaying milliseconds.\n\nSpecifically, the behavior change is how d3 zooms around the mouse cursor. For intervals measured in seconds or above, the gridlines zoom with respect to the cursor position. i.e Mousing over 6PM and scrolling will cause 6PM to take up more space. But once you get to milliseconds, the grid seems to be zoomed from the far left, regardless of your cursor position. The panning also stops moving the axis around at all.\n\nI am not very experienced in d3, but to me, this looks like a bug. I see nothing in the zoom documentation about this. Is there a reason why it behaves this way, and if so, can it be overridden somehow?\n\nIn the links below, as soon as you zoom far enough that the x-axis labels change from :YY to .YYY (ie. :50 to .653) you should see the problem.\n\nThis shows the \"broken\" behavior: http://jsfiddle.net/JonathanPullano/LuYDY/3/\n\nThis shows the \"correct\" behavior: http://jsfiddle.net/JonathanPullano/LuYDY/2/\n\nEDIT: I have discovered that the problem is not in the zoom behavior, but rather the time.scale() itself. I made another fiddle which uses setTimeout to automatically rescale the axis without using zoom. The problem still persists. Try it here.\n\nhttp://jsfiddle.net/JonathanPullano/LuYDY/4/\n\nvar margin = {top: 20, right: 20, bottom: 30, left: 40},\n width = 600 - margin.left - margin.right,\n height = 400 - margin.top - margin.bottom;\n\nvar x = d3.time.scale()\n .domain([-5000, 5000])\n .range([0, width]);\n\nvar svg = d3.select(\"body\").append(\"svg\")\n .attr(\"width\", width + margin.left + margin.right)\n .attr(\"height\", height + margin.top + margin.bottom)\n .append(\"g\")\n .attr(\"transform\", \"translate(\" + margin.left + \",\" + margin.top + \")\");\n\nsvg.append(\"rect\")\n .attr(\"width\", width)\n .attr(\"height\", height);\n\nvar gXAxis = svg.append(\"g\")\n .attr(\"class\", \"x axis\")\n .attr(\"transform\", \"translate(0,\" + height + \")\")\n\nfunction chart(selection) {\n selection.each(function(data) {\n\n var xAxis = d3.svg.axis()\n .scale(x)\n .orient(\"bottom\")\n .ticks(5)\n .tickSize(-height);\n\n gXAxis.call(xAxis);\n });\n}\n\nupdate();\nfunction update() {\n var start = new Date(x.domain()[0].getTime() + 10);\n var end = new Date(x.domain()[1].getTime() - 10);\n if(start.getTime() < end.getTime()) {\n x.domain([start,end]);\n setTimeout(update,10);\n }\n svg.call(chart);\n}"
] | [
"javascript",
"d3.js"
] |
[
"How to produce Photoshop stroke effect?",
"I'm looking for a way to programmatically recreate the following effect:\n\nGive an input image:\ninput http://www.shiny.co.il/shooshx/ConeCarv/q_input.png\n\nI want to iteratively apply the \"stroke\" effect.\nThe first step looks like this:\nstep 1 http://www.shiny.co.il/shooshx/ConeCarv/q_step1.png\n\nThe second step like this:\nalt text http://www.shiny.co.il/shooshx/ConeCarv/q_step2.png\n\nAnd so on.\n\nI assume this will involves some kind of edge detection and then tracing the edge somehow.\nIs there a known algorithm to do this in an efficient and robust way?"
] | [
"graphics",
"2d",
"effects"
] |
[
"android.intent.action.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE what's the use?",
"I am trying to execute the OnReceive method when Android starts so that I can schedule\na task.\n\nUnfortunately onReceive of my BradcastReciever is called at boot only if I install the app on the\nroot system. I thought that android.intent.action.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE\nshould fix the problem. \n\nBut from this post it seems that it is not possible, though in certain tutorials\nthey say it is feasible.\n\nAndroid installLocation and BOOT_COMPLETED\n\nI should infer that I cannot do such a thing. \n\nIs that really so or there is a way to get the broadcast at startup with my app on the sd.\n\nIf it is not possible I wonder what's the use\nof android.intent.action.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE\n\nThis is my Manifest in case someone wnat to take a look.\nI am testing on Android 2.3.7\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n package=\"mypackage\"\n android:installLocation=\"preferExternal\"\n android:versionCode=\"1\"\n android:versionName=\"1.0\" >\n\n <uses-sdk\n android:minSdkVersion=\"9\"\n android:targetSdkVersion=\"17\" />\n\n <uses-permission android:name=\"android.permission.INTERNET\" />\n <uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" />\n <uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" />\n <uses-permission android:name=\"android.permission.RECEIVE_BOOT_COMPLETED\" />\n\n <uses-permission android:name=\"android.permission.VIBRATE\" />\n <uses-permission android:name=\"android.permission.WAKE_LOCK\" />\n\n............................. \n\n <receiver\n android:name=\"mypackage.MyNotificationReceiver\"\n android:enabled=\"true\"\n >\n <intent-filter android:priority=\"1\" >\n <action android:name=\"android.intent.action.BOOT_COMPLETED\" />\n <action android:name=\"android.intent.action.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE\" />\n </intent-filter>\n\n </receiver>\n\n\n </application>\n\n</manifest>\n\n\nThanks"
] | [
"android",
"broadcastreceiver",
"boot"
] |
[
"HTML img tags won't work in meteor",
"Its pretty simple, I've looked everywhere and no one has a solution for it. Basically, The html img tags don't seem to work. \n\n<img src=\"../client/app/public/genolagana.jpg\" alt=\"Profile Picture\" height=\"42\" width=\"42\"> \n\n\nThat's my code, And yes, The picture is in the correct file location that I have specified. Thank you in advance!"
] | [
"html",
"image",
"meteor"
] |
[
"Java Inverting Switch statement",
"So I have come across an interesting problem that I want to solve with an even more interesting method.\nSo I want to make a switch statement that works like this\nInserting weird looking fake code:\n\nint i = 5;\nswitch (i)\ncase 0:\nthis line works\nbreak;\ncase 1:\nthis line works\nbreak;\ncase 2:\nthis line works\nbreak;\ncase 3:\nthis line works\nbreak;\ncase 4:\nthis line works\nbreak;\ncase 5:\nthis line does not work\nbreak;\ncase 6:\nthis line works\nbreak;\n\n\nIgnoring the obivious missing code(we all know what switch statement looks like (if you don't then hi I guess, welcome to this weird programming place)) and the main problem here is the question of implementing such case statement that works as shown above.\nEdit: if you still don't understand my question, I want the case statement to output every other case but the one I selected."
] | [
"java",
"switch-statement"
] |
[
"Use custom color in C++Builder 6",
"I'm making an application in C++ Builder 6. I need to use my own color in the Caption of a TLabel. I mean not a standard color like clBlue, clRed, etc, but like \"8c8a8a\"(it's grey), \"dedcdc\"(it's white). There are some hue of colors that I need.\n\nI have searched the Internet but I have not found anything.\n Is there a way to do this?\n\nPlease don't say something like \"Yes, change to VS/QT or something modern\".\n I don't want to change away from C++Builder 6."
] | [
"c++",
"fonts",
"colors",
"c++builder",
"c++builder-6"
] |
[
"Cordova Splash screen preference name in config.XML",
"i have follow the instruction in this page http://cordova.apache.org/docs/en/3.1.0/cordova_splashscreen_splashscreen.md.html#Splashscreen to test out a splashscreen , it require me to add in this following code to the config , but following is not a valid CML, therefore when i build i got error on it.\n\n<preference name=\"splashscreen\", \"splash\" />\n<preference name=\"splashScreenDelay\", 10000 />\n\n\nI also try to change the preference name to a valid XML as below, it build successful with out error, but once after build the following preference is also remove from the config.XML automatically\n\n<preference name=\"splashscreen\", value=\"splash\" />\n<preference name=\"splashScreenDelay\", value=\"10000\" />\n\n\nIs that source of sample , so that I can follow it to get my splash screen works"
] | [
"cordova",
"cordova-3"
] |
[
"Change Highcharts Legend Display After Render",
"Is it possible to change the Highcharts Display settings after the chart has been rendered? Or do I always need to redraw the chart?\n\nSee, on screen resize, I wish to move the legend box from the right to the bottom, as shown in the picture:\n--Example Picture--\n\nProgrammatically, what I need is to change the code from\n\nfrom:\n\nlegend: { \n layout: 'vertical',\n align: 'right',\n verticalAlign: 'top',\n}\n\n\nto:\n\nlegend : {\n layout: 'horizontal',\n align: 'center',\n verticalAlign: 'bottom',\n}\n\n\nafter the chart has been rendered.\n\nMany thanks!"
] | [
"javascript",
"angularjs",
"highcharts"
] |
[
"auto populate corresponding data into different input fields after selecting a value to one input field javascript",
"I have al horizontal form which is being generated dynamically using javascript, and each input field has a jquery auto complete which populates data from DB using $.get method.\n\nI want to fill data to 2nd input field with the corresponding value when I select a data to first input field. Here the rows are being cloned and then the autocomplete functionality is also being cloned along with the rows.\n\nIn the image below, if I select the category set then I want the value field to be populated automatically:\n\n\n\nI am able to achieve the auto complete but not able to achieve to fill data to second input field.\n\nfunction loadcategorysetvalue(table,tabdata){\n var catsetlov=[];\n var catvalov=[];\n $.get(\"URL\",function(response){\n catsetlov=response;\n }).done(function(){\n var row =null;\n var newId=1;\n for(var i=0;i<catsetlov.length;i++){\n newId++;`enter code here`\n row=insertrow(table(table,tabdata,\"categories\");\n cell=row.cells[0];\n cell.children[0].value=catsetlov[i];\n setcatvalue(catsetlov[i]);\n addbtn(row);\n var id = cell.children[0].getAttribute(\"id\");\n var newId=(id+\"_\"+newId);\n cell.children[0].setAttribute(\"id\",newId);\n $('#'+newId).autocomplete({\n source:catsetlov,\n minLength:0\n }).focus(function(){\n $.get(\"url\",function(response){\n catsetlov=response;\n });\n $(this).autocomplete(\"search\",\"\");\n });\n }\n });\n }"
] | [
"javascript",
"jquery",
"html"
] |
[
"How to sort by timestamp difference in MySQL?",
"suppose I have the following table:\n\nname birth(timestamp) death(timestamp)\n-------- ---------------------- ---------------------\nperson1 22-05-2013 21:59:00 22-05-2013 21:59:00\nperson2 20-05-2013 21:58:58 27-06-2025 21:59:55\n\n\nhow can I sort this table in a way that it returns the longest-lived person first?"
] | [
"mysql",
"sorting",
"timestamp"
] |
[
"Table with CSS sprites as bg images won't display correctly on the iPhone",
"I've tried everything, but nothing seems to get me a consistent result...basically, I have an image grid of thumbnails that I set up in a table due to the fact that rowspan got me the effect that I needed very easily (it's set up like a grid, but some of the photos are double the size of others). It displays fine across every browser, but when it displays on the iphone, it's as if random images are chosen to show and in random positions, sometimes repeated, with no rhyme or reason...I thought it was just my cache or something, so i cleared it and tried it on other phones, but to no avail!\n\nAnyway, the page is: www.ivryaudio.com/index.html. Please! I beg your assistance. Here's a link to a screenshot of the problem as well."
] | [
"iphone",
"image",
"gallery"
] |
[
"pyscard - windows - How to re-open connection to a smartcard (open/close/open again)",
"On windows 8.1, Python 2.7, pyscard(latest) i list readers from my software like so:\n\nfor reader in readers():\n print \"list of readers:\"\n print readers\n try:\n conn = reader.createConnection()\n conn.connect()\n\n data, status = _cmd2(conn, 0, 0xa4, 0x04, 0x00, 'appletID'.decode('hex'))\n\n\nNow, when i remove the smart card and plug it back in and try to open the connection again with the same software (i didnt closed the software meanwhile) i get this error:\n\n> 'Failure to list readers: The Smart Card Resource Manager has shut\n> down. '\n\n\nIf instead I close the software and re-list readers and open the connection everything works fine.\n\nApparently Windows does something if the smart-card is removed and re-inserted that prevents to establish a new connection.\n\nAnyone can show me the way of the Ninja?\nThank you."
] | [
"windows",
"list",
"connection",
"smartcard",
"pyscard"
] |
[
"Is it possible to create KeyVault using ARM, generate password and use the password in other ARM resources?",
"I would like to create ARM Template\n\ncreate a resource group that contains KeyVault;\ngenerate new secret with predefined name, e.g AdminPassword.\nUse the password in other resources, e.g Master password when creating a SQL Database.\n\nWhen redeploying the template and KeyVault and the AdminPassword secret already exist, existing secret should be used.\nI have found samples where KeyVault secret is used as a parameter, however this is different, because KeyVault does not exist at the time parameters are resolved.\nCan you write sample ARM teplate that creates KeyVault and then uses sectets from it?"
] | [
"azure",
"azure-resource-manager",
"arm-template"
] |
[
"Firefox: Network Monitor: How to debug JSON payload?",
"I switched from Google Chrome to Firefox Developer's Edition because of memory leak issues and moving towards truly open-source solution.\n\nI want to debug the payload of my request which is JSON but Firefox does not show the user-friendly tree structure of JSON data. Is there any plugin? How can I improve the Network Monitor?"
] | [
"firefox",
"firefox-developer-edition"
] |
[
"Try Except in python :syntax issue",
"class ShortInputException(Exception):\n'''A user-defined exception class.'''\n def __init__(self, length, atleast):\n Exception.__init__(self)\n self.length = length\n self.atleast = atleast\ntry:\n s = raw_input('Enter something --> ')\n if len(s) < 3:\n raise ShortInputException(len(s), 3)\n\n\nexcept ShortInputException, x:\n print 'ShortInputException: The input was of length %d, \\\n was expecting at least %d' % (x.length, x.atleast)\n\n\nI dont understand the syntax of this line: except ShortInputException, x:\n\nwhat is x here for ??\nand why is it acting as an object ???\n\nwaht does this line do ? : Exception.__init__(self)\n\nThanks"
] | [
"python"
] |
[
"Going back to home page on refreshing/reloading or manually entering the URL in react",
"I am a beginner and trying to build a website using react.\nI created something similar to local:3000/University with the help of the code below\n\n<div>\n <BrowserRouter>\n <Route path=\"/University\" component={University}/>\n <Redirect to=\"/University\" />\n </BrowserRouter>\n</div>\n\n\nI then used a button to direct to the localhost:3000/University. However on refreshing the page or entering the URL manually, I find myself at the home page even though the url still says \nlocalhost:3000/University.\n\nAny suggestions on how to resolve this issue? Any help would be really appreciated."
] | [
"reactjs",
"react-router"
] |
[
"Unexpectedly found nil while unwrapping an Optional value swift",
"I'm getting an error message \"Unexpectedly found nil while unwrapping an Optional\" from Swift, with the below class. The error occurs on the line:\n\n(cell.contentView.viewWithTag(1) as UILabel).text = object[\"firstName\"] as? String\n\n\nI have a custom cell class with 2 UILabels tagged 1 and 2, the outlets are set\n\n import UIKit\n import Foundation\n\n class dictionaryTableViewController: UIViewController, UITableViewDelegate, UITableViewDataSource{\n\n var objects = NSMutableArray()\n var dataArray = [[\"firstName\":\"Debasis\",\"lastName\":\"Das\",\"email\":\"[email protected]\"],[\"firstName\":\"John\",\"lastName\":\"Doe\",\"email\":\"[email protected]\"],[\"firstName\":\"Jane\",\"lastName\":\"Doe\",\"email\":\"[email protected]\"],[\"firstName\":\"Mary\",\"lastName\":\"Jane\",\"email\":\"[email protected]\"]]\n\n @IBOutlet\n var tableView: UITableView!\n\n var items: [String] = [\"We\", \"Heart\", \"Swift\"]\n\n override func viewDidLoad() {\n super.viewDidLoad()\n self.tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: \"MyCell\")\n }\n\n override func didReceiveMemoryWarning() {\n super.didReceiveMemoryWarning()\n }\n\n\n func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n return dataArray.count;//self.items.count;\n }\n\n func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {\n //var cell:UITableViewCell = self.tableView.dequeueReusableCellWithIdentifier(\"cell\") as UITableViewCell\n //cell.textLabel?.text = self.items[indexPath.row]\n //return cell\n let cell = tableView.dequeueReusableCellWithIdentifier(\"MyCell\", forIndexPath: indexPath) as UITableViewCell\n let object = dataArray[indexPath.row] as NSDictionary\n (cell.contentView.viewWithTag(1) as UILabel).text = object[\"firstName\"] as? String\n (cell.contentView.viewWithTag(2) as UILabel).text = object[\"lastName\"] as? String\n return cell\n }\n\n func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {\n\n println(\"You selected cell #\\(indexPath.row)!\")\n\n }\n\n}"
] | [
"ios",
"uitableview",
"swift"
] |
[
"Cordova iOS build fails with 'edit-config' tag",
"I have an Ionic 3 app (Ionic CLI 3.19.0, Cordova CLI 8.0.0, android platform 7.0.0,\nios platform 4.5.4) that includes the native 'Geolocation' plugin. Since iOS 10+ requires the NSLocationWhenInUseUsageDescription property in the App-Info.plist file, the plugin's documentation (Geolocation iOS Quirks) says to include the following in the config.xml:\n<edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge">\n <string>need location access to find things nearby</string>\n</edit-config>\n\nSo I added that verbatim as the first entry within <platform name="ios">...</platform> tag of my config.xml.\nDuring the cordova iOS stage of the build, it fails with the following obscure errors:\n\n(node:60604)UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: doc.find is not a function\n(node:60604) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code."
] | [
"ios",
"cordova",
"ionic-framework",
"cordova-plugins"
] |
[
"view.invalidate invokes redraw of other view",
"If I invalidate view1 then my view2 is redrawn. I like to only redraw my view1.\n\nI have:\n2 Custom Views -> view1 & view2\n1 LinearLayout\n\nI visually switch between the view1 and view2 with:\n\nLinearLayout.removeAllViews();\nLinearLayout.addView(view2) or LinearLayout.addView(view1);\n\n\nHow can I invalidate view1 without triggering the drawing of view2 ?"
] | [
"android",
"android-custom-view"
] |
[
"How to handle command line validations in ant build?",
"I am new to ant build. I am trying to validate command line arguments. Following is my code:\nbuild.xml snippet for taking in args:\n<target name="run" depends="jar">\n <java jar="${BUILD}/jar/cmdBuildEx.jar" fork="true">\n <arg value="${arg0}"/> <!-- input file -->\n <arg value="${arg1}"/> <!-- modify file -->\n <arg value="${arg2}"/> <!-- output file 1 -->\n <arg value="${arg3}"/> <!-- output file 2 -->\n <arg value="${arg4}"/> <!-- output file 3 -->\n <arg value="${arg5}"/> <!-- error file -->\n <arg value="${arg6}"/> <!-- debug value -->\n </java>\n </target>\n\nand this is my condition for validation:\nif ((args.length != 7) || (args[0].equals("${arg0}")) || (args[1].equals("${arg1}")) || (args[2].equals("${arg2}")) || (args[3].equals("${arg3}")) || (args[4].equals("${arg4}")) || (args[5].equals("${arg5}")) || (args[6].equals("${arg6}"))) {\n System.err.printf("Error: Incorrect number of arguments. Program accepts %d arguments.", REQUIRED_NUMBER_OF_CMDLINE_ARGS);\n System.out.println();\n System.err.println("Args found:"+args.length);\n System.exit(0);\n }\n\nWhenever I am giving more than 7 arguments in cmd line, It doesn't throw any error but executes my code. I don't understand where i am making mistake. Can anyone help?"
] | [
"java",
"ant",
"antbuilder"
] |
[
"How to read a Progress database file .b1 in Python",
"I need to export information from a legacy database system. The database is a 'Progress' database and the information is stored in a file with extension .b1\n\nWhat is the easiest way to export all database tables to a text file?"
] | [
"python",
"progress-db"
] |
[
"Conditionally setting session variables in Laravel 5.2",
"I am new to Laravel. I have a table of information and a master view page (master.blade.php). All the other views extend it. I want to see if certain session variables exist and if not set them. This is to stop reading a table unnecessarily. In standard PHP I would write:\n\n<?php\nif ( !isset($_SESSION['name'] )) {\n $db = new smplPDO();\n $co = $db->get_row('config',array(), array() );\n $_SESSION['name'] = $co['name'] ;\n $_SESSION['thisyear'] = ReturnCurrentYear() ;\n}\n?>\n\n\nHow can I test the master view and set them if necessary so they can be used elsewhere?"
] | [
"laravel-5.2",
"session-variables"
] |
[
"Start multiple SparkContext Instances in Ipython",
"i have Ipython and 3.2(Jupiter) running against pyspark on rhel 6. I'm only able to launch one python2 script at a time because there is only one spark context. When I launch and run another script(kernel) in Ipython I receive an \"address already in use 0.0.0.0:4040\". \n\nTo be able to run multiple development efforts on the same spark+yarn cluster I believe I will need multiple SparkContext instances.\n\nHow can I achieve this parallel development effort on spark on the same Ipython notebook without having to continually shutdown a running instance ?"
] | [
"python",
"apache-spark",
"pyspark"
] |
[
"Does an added class in jQuery carry over after page reload?",
"I'm trying to remember which tabs were open in my menu after reload. Here's my js:\n\n$(document).ready(function () {\n $(\".sidebar div\").hide();\n $(\".sidebar li a\").click(function () {\n// alert($(this).attr(\"class\"));\n var myClass=$(this).attr(\"class\");\n\n if ($(\"#div\"+myClass).attr(\"class\")!='active') {\n $(\"#div\"+myClass).slideToggle(); //open tab\n $(\"#div\"+myClass).addClass('active');\n }\n else {\n $(\"#div\"+myClass).slideToggle(); //close tab\n $(\"#div\"+myClass).removeClass('active');\n }\n });\n});\n\n\nIt's constantly adding and taking away the class \"active\" each time I click on it. I also have this right below it: \n\n$(window).load(function () {\n $(\".active\").slideToggle();\n});\n\n\nWhenever I reload my page, even when a couple of tabs have an active class, they do not appear to be slideToggling. Am I doing this wrong? Is there an easy way around this?"
] | [
"javascript",
"jquery"
] |
[
"finding IOSurface headers",
"I'm getting this error when I try to compile my tweak. \n\n'IOSurface/IOSurfaceAPI.h' file not found\n#include <IOSurface/IOSurfaceAPI.h>\n\n\nI've tried this answer, but I can't find /System/Library/Frameworks/IOSurface.framework/Headers on my computer. I'm running osx 10.9.1. Thanks for the help."
] | [
"ios",
"objective-c",
"tweak",
"theos"
] |
[
"I want to route a key to a different view?",
"I'm reading the official documentation. However it only shows me how to route the model to a different view and I want to route a key? Experts any suggestions?"
] | [
"sapui5"
] |
[
"Reading files larger than 4GB using c++ stl",
"A few weeks back I was using std::ifstream to read in some files and it was failing immediately on open because the file was larger than 4GB. At the time I couldnt find a decent answer as to why it was limited to 32 bit files sizes, so I wrote my own using native OS API.\n\nSo, my question then: Is there a way to handle files greater than 4GB in size using std::ifstream/std::ostream (IE: standard c++)\n\nEDIT: Using the STL implementation from the VC 9 compiler (Visual Studio 2008). \nEDIT2: Surely there has to be standard way to support file sizes larger than 4GB."
] | [
"c++",
"file-io",
"iostream"
] |
[
"How to replace all capture groups if it is generated dynamically?",
"Consider the following code:\n\nfunction Matcher(source, search) {\n\n var opts = search.split('');\n\n for (var i = 0; i < opts.length; i++) {\n opts[i] = '(' + opts[i] + ')'; \n }\n\n opts = opts.join('.*');\n\n var regexp = new RegExp(opts, 'gi');\n\n source = source.replace(regexp, function () {\n console.log(arguments);\n return arguments[1];\n });\n\n return source;\n}\n\n\nYou call the function passing the source as the first parameter and what you need to match as the second one.\n\nWhat i need is to replace all capture groups with a bold tag around the coincidence.\n\nAs an example, consider the following:\n\nvar patt = /m([a-z0-9\\-_]*?)r([a-z0-9\\-_]*?)i([a-z0-9\\-_]*?)e([a-z0-9\\-_]*\\.[a-z]+)/gi;\nvar newFileName = fileName.replace(patt, \"<strong>m</strong>$1<strong>r</strong>$2<strong>i</strong>$3<strong>e</strong>$4\");\n\n\nThis code is an answer from Terry on my previous question but the problem here is that you need to know exactly what you want to replace, and i need it dynamically.\n\nAny thoughts?"
] | [
"javascript",
"regex"
] |
[
"How to pair with another BLE device using Ionic?",
"so in this question I asked how would I identify a bluetooth device after doing an scan. It seems that only those devices I have connected to show their name, all other devices are shown as unnamed.\n\nSo my question is, how do I pair all the unnamed devices using the Ionic Native BLE library? It doesn't matter if I need to do a manual process for each one (since this will be done only once). Thanks in advance."
] | [
"ios",
"bluetooth",
"bluetooth-lowenergy",
"ionic3",
"ionic-native"
] |
[
"In-App Purchase freshplanet-as3",
"i am trying to add in app purchase features in my iOS app. i use fresh planet nativeExtension(AirInAppPurchase.ane).while i compiling, it traces \"in app purchase is not supported\"... \n\nThings i used.\n\n\nAdobe Flash pro CS6(AS3).\nAdobe AIR SDK 17.\nWindow 7. \n\n\ni correctly link nativeExtension(AirInAppPurchase.ane) in my project.\n\ni correctly configured my iOS-app for in-app purchase in iTunes connection.\n\ni got the freshPlanet native extension from\"https://github.com/freshplanet/ANE-In-App-Purchase\"\n\ni think i made mistake in documentation...\n\nThings I want to know\n\n\nWhere to put my product id in my project(as3 classs).\nWhat is the use of \nCapabilities.manufacturer.indexOf('iOS') > -1 || Capabilities.manufacturer.indexOf('Android') > -1;\"\nwhich is in InAppPurchase.as.\nWhat is the use of ExtensionContext.createExtensionContext(\"com.freshplanet.AirInAppPurchase\", null);\nwhat is the clear documentation for in-app purchase for iOS-app.\n\n\nplease help me.... For this reason i am struggling. i couldn`t go further step.."
] | [
"ios",
"actionscript-3",
"in-app-purchase",
"flash-cs6"
] |
[
"Swapping keys and values of a map in C++",
"I'm looking for a function in C++ that for swap the contents of a map ... \nthat is:\nthose that were the keys now become the items and those that the items were now the keys. \nCan you tell me if there is something about this?"
] | [
"c++"
] |
[
"OpenDialog from Firefox add-on with external content can't access window arguments or go back in history",
"I have a small add-on that opens a dialog window with external content.\nI have not found a way to pass data to the child window to let it know it is a dialog window.\nI need to do this so that javascript code loaded into the dialog window knows it has to close.\n\nIs there some other way to achieve this?\n\nThe history.back() does not work for documents loaded into said window either but I don' know why.\n\nvar MACDialogExtension = {\n myListener: function(evt) {\n console.log(evt.target.ownerDocument);\n\n window.openDialog(evt.target.getAttribute(\"url\"),evt.target.getAttribute(\"name\"),evt.target.getAttribute(\"features\"),\"child\");\n } \n}\ndocument.addEventListener(\"MACDialogExtensionEvent\", function(e) { MACDialogExtension.myListener(e); }, false, true); \n\n\nI thought the document loaded into the dialog would get access to the window argumens, but it doesn't. \nCan you think other way to pass parameters into the window? I just need the document inside that window that they are inside a dialog window."
] | [
"javascript",
"firefox",
"modal-dialog",
"firefox-addon"
] |
[
"What is the git equivilant of merging a range of revisions in SVN - rebase or cherry pick?",
"Transitioning from SVN - what sometimes happens, is that either a 2nd branch or maybe trunk has had a specific range of revisions committed and I need to merge those revisions into my local branch. \n\nCorrect me if Im wrong, but I think I would possibly do a merge with rebase? I also was reading about VSTS and \"cherry pick\"\neg. git cherry-pick d34bcef...86d2aec \nhttps://docs.microsoft.com/en-us/vsts/git/tutorial/cherry-pick?tabs=command-line"
] | [
"git",
"version-control"
] |
[
"Unable to change bootstrap navbar \"color\". Can change other elements inside class?",
"I am trying to change the \"color\" attribute on the bootstrap navigation bar. I can change every other feature of the element (\"text-decoration\", etc ) but, for some reason I can not override the color? \n\n<nav class=\"nav navbar-default\">\n <div class=\"container-fluid\">\n <div class=\"navbar-header\">\n <button type=\"button\" class=\"navbar-toggle collapsed\" data-toggle=\"collapse\" data-target=\"#defaultNavbar1\" aria-expanded=\"false\"><span class=\"sr-only\">Toggle navigation</span><span class=\"icon-bar\"></span><span class=\"icon-bar\"></span><span class=\"icon-bar\"></span></button>\n </div>\n\n <div class=\"collapse navbar-collapse\" id=\"defaultNavbar\">\n <ul class=\"nav navbar-nav\">\n <li><a href=\"[-- VAR.URL --]/sage.html\">SACRED HERBS<span class=\"sr-only\">(current)</span></a></li>\n\n ...\n\n\n <li><a href=\"[-- VAR.URL --] /specials.html\">SALE</a></li>\n</ul>\n\n </div>\n\n</div></nav>\n\n\nAnd, here is the CSS I am using:\n\n.navbar-default {\n background-image:none;\n width:100%;\n}\n\n\n.navbar-nav {\n background-color: #29bbdb;\n width: 100%;\n }\n\n\n.navbar-default .navbar-nav > li > a {\n color: #ffffff;\n font-weight:600;\n text-decoration:underline;\n background-color: transparent;\n\n }\n.navbar-default .navbar-nav > li > a:hover,\n.navbar-default .navbar-nav > li > a:focus {\n font-weight:600;\n color: #D1D4D4;\n background-color: transparent;\n text-decoration:overline;\n\n}"
] | [
"twitter-bootstrap"
] |
[
"Sql Conditional Not Null Constraint",
"I am curious to know is it possible to create a conditional not null constraint in sql? In otherwords is it possible to create a constraint such that a column B can be null as long column A contains lets say 'NEW' but if the contents of column A changes to something else then column B is no longer allowed to be null? \nAnd to extend on that, it is then possible to make it so that column B must be null or empty as long as column A says 'NEW'?\nThanks All :D"
] | [
"sql",
"constraints",
"notnull"
] |
[
"How to use grid in angular.js",
"I need to implement following functionality in angular grid.\n\nPaging.\nFiltering.\nSorting column wise.\n\nPlease suggest me which angular js grid should I use."
] | [
"angularjs"
] |
[
"Android split Text / Numbers from SMS string",
"im making a gps tracking program and i receive an sms message with the following content \n\nsmsMessage=\"http://maps.google.com/maps?q=42.396068,13.45201,17 phone is outside the area\"\n\nCould anybody be so kind and tell me how i can split out only the needed longitude and the latitude from the sms string ? \n\nthanx in advance"
] | [
"android",
"string",
"sms",
"strip"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.