texts
sequence | tags
sequence |
---|---|
[
"Using After Effects expressions to trigger an audio file",
"Is there a way to trigger an audio file to play in the After Effects timeline when a layer has visible content.\n\nIt's a small click sound and when the text layer IN point is reached, I simply want the click wav file to play. Any help would be appreciated."
] | [
"audio",
"expression",
"after-effects"
] |
[
"Selecting an item from drop down menu when the menu uses input, not select",
"I'm trying to learn how to use Selenium with Python. I'm writing some code that will run a search on www.kijiji.ca. I'm able to select the search field and enter my query, but I can't figure out how to select the city from the list. In the Selenium documentation, I found where it says to use:\n\nfrom selenium.webdriver.support.ui import Select\nselect = Select(driver.find_element_by_name('name'))\n\n\nHowever, when I try to use the code, I get an error that says \"Select only works on select elements, not on input\"\n\nI inspected the page again and it does seem like the drop down menu uses an input rather than a select. Can anyone help me figure out how to use Selenium to select the city here?"
] | [
"python",
"selenium"
] |
[
"Shell script CP cannot overwrite directory",
"our users have written a shell script to copy an application into into the /Applications folder on OSX. it works great the first time, but the second time they get an error. This is a new development, it apparently used to work fine before we changed the App name.\n\nThe shell script runs the following:\n\ncp -a ApplicationName.app /Applications\nopen -a '/Applications/ApplicationName.app/Contents/MacOS/ApplicationName' --args -LSRC autolaunch\n\n\nThe first time it runs, it works fine, the application is copied over and then it launches. the second time it comes back with the following errors\n\n[jrivera@chamomile] $ sudo ./InstallScript.sh /SRNM ABC1234567\ncp: cannot overwrite directory /Applications/ApplicationName.app/Contents/Frameworks/Sparkle.framework/Headers with non-directory ApplicationName.app/Contents/Frameworks/Sparkle.framework/Headers\ncp: cannot overwrite directory /Applications/ApplicationName.app/Contents/Frameworks/Sparkle.framework/Resources with non-directory ApplicationName.app/Contents/Frameworks/Sparkle.framework/Resources\ncp: cannot overwrite directory /Applications/ApplicationName.app/Contents/Frameworks/Sparkle.framework/Versions/A/Resources/fr_CA.lproj with non-directory ApplicationName.app/Contents/Frameworks/Sparkle.framework/Versions/A/Resources/fr_CA.lproj\ncp: cannot overwrite directory /Applications/ApplicationName.app/Contents/Frameworks/Sparkle.framework/Versions/A/Resources/pt.lproj with non-directory ApplicationName.app/Contents/Frameworks/Sparkle.framework/Versions/A/Resources/pt.lproj\ncp: cannot overwrite directory /Applications/ApplicationName.app/Contents/Frameworks/Sparkle.framework/Versions/Current with non-directory ApplicationName.app/Contents/Frameworks/Sparkle.framework/Versions/Current\n\n\nI'm not exactly sure why that's happening. it's the exact same script in the exact same location copying the exact same things 30 seconds apart. I dug into each and the directories and files all appear the exact same file type. I tried adding other commands to the cp to force it (-RfXv) but got the same thing. Any ideas? maybe it's a strange thing with sparkle?"
] | [
"macos",
"shell",
"terminal",
"cp",
"sparkle"
] |
[
"ResultSet: Retrieving column values by index versus retrieving by label",
"When using JDBC, I often come across constructs like \n\nResultSet rs = ps.executeQuery();\nwhile (rs.next()) {\n int id = rs.getInt(1);\n // Some other actions\n}\n\n\nI asked myself (and authors of code too) why not to use labels for retrieving column values: \n\nint id = rs.getInt(\"CUSTOMER_ID\");\n\n\nThe best explanation I've heard is something concerning performance. But actually, does it make processing extremely fast? I don't believe so, though I have never performed measurements. Even if retrieving by label would be a bit slower, nevertheless, it provide better readability and flexibility, in my opinion.\nSo could someone give me good explanation of avoiding to retrieve column values by column index instead of column label? What are pros and cons of both approaches (maybe, concerning certain DBMS)?"
] | [
"java",
"optimization",
"jdbc",
"resultset",
"maintenance"
] |
[
"Why does Ridge model fitting show warning when power of the denominator in the alpha value is raised to 13 or more?",
"I was trying to create a loop to find out the variations in the accuracy scores of the train and test sets of Boston housing data set fitted with a Ridge regression model.\nThis was the for loop:\nfor i in range(1,20):\n Ridge(alpha = 1/(10**i)).fit(X_train,y_train)\n\nIt showed a warning beginning from i=13.\nThe warning being:\nLinAlgWarning: Ill-conditioned matrix (rcond=6.45912e-17): result may not be accurate.\n overwrite_a=True).T\n\nWhat is the meaning of this warning?\nAnd is it possible to get rid of it?\nI checked to execute it separately without a loop, still didn't help.\n#importing libraries and packages\n\nimport mglearn\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.linear_model import Ridge\n\n#importing boston housing dataset from mglearn\nX,y = mglearn.datasets.load_extended_boston()\n\n#Splitting the dataset\nX_train,X_test,y_train,y_test = train_test_split(X,y,random_state=0)\n\n#Fitting the training data using Ridge model with alpha = 1/(10**13)\nrd = Ridge(alpha = 1/(10**13)).fit(X_train,y_train)\n\nShoudn't display the warning mentioned above for any value of i."
] | [
"python",
"scikit-learn",
"linearmodels"
] |
[
"Send TAB key Event using PostMessage, mfc",
"I have code which PostMessage() which pastes the Text from Clipboard text to Notepad. Now in another application their are two Edit box, in this case i want to Paste the text then Enter TAB Key Press event (i.e Using PostMessage() send TAB key event)will take , so that me to next edit control and then again I will sent the PostMessage() to paste the text from clipboard.I am able to do it for One text box. how can i do it with two or say three edit box. Here is what i have tried.\n\n//CWnd *pWnd=FindWindow(NULL,_T(\"Untitled - Notepad\"));\n CWnd *pWnd=FindWindow(NULL,_T(\"Visual SourceSafe Login\"));\n HWND mainHwnd = pWnd->GetSafeHwnd();\n CString csNameOfWin;\n pWnd->GetWindowTextA(csNameOfWin);\n\n CWnd *EditHwnd = FindWindowEx(mainHwnd,NULL,\"edit\",NULL);\n EditHwnd->PostMessageA(WM_PASTE,0,0);\n EditHwnd->PostMessageA(VK_TAB,0,0);\n EditHwnd->PostMessageA(WM_PASTE,0,0);\n\n\nBut this doesn't work for me can someone please tell me what is the problem with the code.\nPlease guide me through the right path. Thanks in Advance."
] | [
"c++",
"mfc",
"paste"
] |
[
"Compiling a groovy template to a class file i tomcats work dir",
"I just installed tomcat (6.0.20) with groovy-all.jar (1.7.2) in my WEB-INF/lib\n\nMy web.xml file looks like this\n\n<web-app>\n\n <servlet>\n <servlet-name>Groovlet</servlet-name>\n <servlet-class>groovy.servlet.GroovyServlet</servlet-class>\n </servlet>\n <servlet>\n <servlet-name>Template</servlet-name>\n <servlet-class>groovy.servlet.TemplateServlet</servlet-class>\n </servlet>\n\n <servlet-mapping>\n <servlet-name>Groovlet</servlet-name>\n <url-pattern>*.groovy</url-pattern>\n </servlet-mapping>\n <servlet-mapping>\n <servlet-name>Template</servlet-name>\n <url-pattern>*.gsp</url-pattern>\n </servlet-mapping>\n\n</web-app>\n\n\nWhen i run an ordinary jsp file, it constructs a java file in my tomcat work dir and compiles it to class. \n\nfx. test.jsp becomes test_jsp.java and test_jsp.class.\n\nWhen i run a groovelet or a groovy template, it does not create any files in work.\n\nAre the result compiled to another folder, or is it compiled every single request?\nIf so, is there a way to configure groovy to compile classes to work?"
] | [
"tomcat",
"groovy",
"gsp"
] |
[
"C# Class library - resource files not loading",
"I am working on adding localisation to my class library. Currently I have two resource files: Strings.resx and Strings.es.resx.\n\nBoth files are under the 'internal' access modifier, although I have tried setting both to 'public' without any help.\n\nMy problem is that the Spanish resource file (Strings.es.resx) is not being loaded; and this problem will repeat with any more resource files I add for other languages. The Strings.resx works fine as it is the default resource file.\n\nThis code is used to grab which string resource files have been loaded; currently only the default file is loaded. Spanish does not appear:\n\nprivate static void LoadLanguages()\n {\n var cultures = CultureInfo.GetCultures(CultureTypes.AllCultures);\n\n foreach (var culture in cultures)\n {\n try\n {\n var rs = Properties.Lang.Strings.ResourceManager.GetResourceSet(culture, true, false);\n if (rs != null) SupportedLanguages.Add(culture.Name.ToLower(), culture.NativeName);\n }\n catch (Exception)\n {\n // ignored\n }\n }\n\n Log.Info(\"Loaded languages: \" + SupportedLanguages.Count); //OUT: 1\n }\n\n\nI have made a discovery though. In my build output, there is a folder \"es\", and within that folder is a DLL called Project.resources.dll. If I copy that DLL to the root folder of the build output, the resource gets loaded.\n\nThe solution to this problem is to get those resource files loaded from the folders. For some reason this is not happening. Is there a known solution to this? Thanks."
] | [
"c#",
"localization",
"resources",
"assemblies",
"resx"
] |
[
"c# LINQ to Entities: retrieve custom objects",
"I've got an easy entity model\n\nBank 1---∞ User 1---∞ Session\n\nIn partial class Bank i've got to store an object Clock set during Bank creation.\nIs it possible to retrieve this Clock object from inside a Session method and, of course, no Bank parameter passed?\n\nSome code\n\npublic partial class Bank : IBank\n{\n private IClock _bankClock;\n\n public IClock Clock\n {\n get { return _bankClock; }\n set { _bankClock = value; }\n } \n\n\n}\n\npublic partial class Session : ISession\n public bool MyMethod()\n {\n var test = (dc.Session.Include(\"User.Bank\").Where(t => t.session_id == session_id));\n var temp = test.First().User.Bank.Clock.Now();\n }\n\nwhen calling MyMethod i get Object reference not set to an instance of an object. and it is referred to the Clock property. Have you got any hints to retrieve a custom object from a LINQ query?\n\nThank you, Best Regards\n\nmore code\n//CreateBank\n\n\n\npublic IBank CreateBank(string bankName, int valuePassedInCreateMethod, Clock bankClock)\n{using (var dc = new Database1Entities(Functions.ToEntitiesConnectionString(connectionString)))\n {\n _dbField=valuePassedInCreateMethod;\n bankReturn=(from c in dc.Bank\n where c.bank_name == bankName\n select c).First();\n bankReturn.Clock = bankClock;\n dc.SaveChanges();\n return bankReturn;\n\n }\n\n\n}"
] | [
"linq-to-entities"
] |
[
"What is the difference between getProviders() and getAllProviders() methods (Android)",
"The documentation says - \ngetAllProviders ()\nReturns a list of the names of all known location providers.\n\ngetProviders (boolean)\nReturns a list of the names of location providers.\n\nWhat actually is the difference ?"
] | [
"android",
"geolocation",
"location"
] |
[
"WPF - Setting corner radius in code behind",
"I want to bring a some rectangles to my WPF-Pages, these Rectangles should have rounded corners. To bring a few of the rectangles to the page without having to write every single one in xaml I decided to do it with a loop in the code.\nI tried this one:\nfor (int i = 0; i < 5; i++)\n{ \n Rectangle rect = new Rectangle();\n rect.Fill = System.Windows.Media.Brushes.Green;\n\n var style = new Style(typeof(Border));\n style.Setters.Add(new Setter(Border.CornerRadiusProperty, new CornerRadius(12.0, 0, 0 , 0)));\n rect.Resources.Add(typeof(Border), style);\n\n Grid.SetColumn(rect, 1);\n Grid.SetRow(rect, 1);\n mainGrid.Children.Add(rect); \n}\n\nbut the corner radius of my rectangles won´t change. Do you have any suggestion?\nThanks for your help in advance!"
] | [
"c#",
"wpf",
"rectangles",
"rounded-corners",
"cornerradius"
] |
[
"ValueError: ctypes objects containing pointers cannot be pickled",
"I am new to Python (2 month of programing/learining exp in total).\nIn this code all i do is get some data from MSSQL database and transfer it to DynamDB.\nI just want to know why i getting this error: ValueError: ctypes objects containing pointers cannot be pickled\nIts happaning it this line : p.map(self.import_sample_data_dynamo, list_to_batch).\nimport_sample_data_dynamo: its a function for Dynamo batch.\nlist_to_batch: its a list of dictionaries.\ncan some one plz tell me what I am doint wrong. \n\nclass GetSensorsSamplesSetToDynamoDBTable:\n\n def __init__(self):\n self.client = None\n self.db = None\n\n # MSSQL\n self.connection = None\n self.cursor: Cursor = None\n\n def init(self):\n # MSSQL\n connect_string = 'Driver={SQL Server};' \\\n 'Server=xxxx;' 'Database=xxx;' \\\n 'uid=xxx;pwd=xxx'\n self.connection = pypyodbc.connect(connect_string)\n self.cursor = self.connection.cursor()\n\n # DynamoDB\n dynamodb = boto3.resource('dynamodb')\n self.table = dynamodb.Table('xxx')\n\n def cleanup(self):\n # MSSQL\n self.cursor.close()\n self.connection.close()\n\n def do_work(self):\n self.init()\n data = []\n samples = self.get_files_received_by_ftp_prod2_data()\n for sample in samples:\n sample_id = sample['id']\n project_id = sample['projectid']\n sensor_id = sample['sensorid']\n sample_time = sample['sampletime']\n row = {\"_id\": sample_id, 'ProjectID': project_id, 'SensorID': sensor_id,\n 'Sample_Time': sample_time,\n 'Z_Fields': sample}\n data.append(row)\n self.split_for_batch(data)\n # self.import_sample_data_dynamo(data)\n\n def get_files_received_by_ftp_prod2_data(self):\n sql_cmd = f\"SELECT TOP (1000) * FROM FilesReceivedByFTP_Prod2\"\n self.cursor.execute(sql_cmd)\n records = self.cursor.fetchall()\n samples = []\n records = list(records)\n for res in records:\n samples_data = {self.cursor.description[i][0]: res[i] for i in range(len(res))}\n self.fix_bad_fields(samples_data)\n samples.append(samples_data)\n return samples\n\n def split_for_batch(self, data):\n temp_list = []\n list_to_batch = []\n\n while len(data) > 0:\n temp_list.append(data[0])\n data.pop(0)\n if len(temp_list) > 24 or len(data) is 0:\n list_to_batch.append(temp_list)\n temp_list = []\n print(len(data))\n print(len(list_to_batch))\n start_time = time.time()\n num_workers = multiprocessing.cpu_count()\n p = Pool(num_workers - 1)\n p.map(self.import_sample_data_dynamo, list_to_batch)\n p.close()\n p.join()\n elapsed = time.time() - start_time\n print(f\"read_all_samples elapsed {elapsed:.0F} Seconds\")\n\n def import_sample_data_dynamo(self, data):\n with self.table.batch_writer() as batch:\n for item in data:\n ddb_data = json.loads(json.dumps(item, default=json_util.default),\n parse_float=Decimal, object_hook=json_util.object_hook)\n batch.put_item(Item=ddb_data)\n return True\n\n def fix_bad_fields(self, data):\n for k, v in data.items():\n if v == '':\n data[k] = '---'\n # elif type(v) == type(datetime.datetime.now()):\n # # data[k] = v.strftime(\"%d/%m/%Y, %H:%M:%S\")\n # data[k] = v.timestamp()\n elif type(v) is bytearray:\n data[k] = \"bytearray\"\n\n\nif __name__ == '__main__':\n freeze_support()\n worker = GetSensorsSamplesSetToDynamoDBTable()\n worker.do_work()"
] | [
"python-3.x",
"multiprocessing"
] |
[
"Is there a way in iOS to record an animated drawing in a UIView?",
"I'm writing an iOS app in swift where I create drawings in a UIView using UIBezierPath's, and the drawings themselves are animated as they're created over a several-second period. I then allow the user to save their drawings. \nWhat I'm trying to figure out if whether it's possible to save the animation that occurs while the drawing is being created - and not just the final drawing. \nWould love any input."
] | [
"ios",
"swift",
"animation",
"video",
"recording"
] |
[
"Do I need to open the firefox browser manually from the command prompt with -jssh extension and run the tests in firefox",
"I have installed firewatir 1.8.0, jssh 0.9 addon.\n\nDo I need to open the firefox browser manually from the command prompt with -jssh extension every time I want to run the tests in firefox?\n\nWhen I try to run the tests without manually opening the browser I am getting the following error:\n\n\n C:/Ruby192/lib/ruby/gems/1.9.1/gems/firewatir-1.8.0/lib/firewatir/firefox.rb:156:in `rescue in set_defaults': Unable to connect to machine : 127.0.0.1 on port 9997. Make sure that JSSh is properly installed and Firefox is running with '-jssh' option(Watir::Exception::UnableToStartJSShException)\n\n\nAlso I tried running the tests by changing the path from \"C:\\Program Files\\Mozilla Firefox\\firefox.exe\" to \"C:\\Program Files\\Mozilla Firefox\\firefox.exe\" -jssh in the Target text box of the Mozilla Firefox Properties window."
] | [
"watir",
"jssh"
] |
[
"Disable a button to connect to the database",
"I am working on my php script to connect to mysql database. I want to disable a button and add a spinner image when I click on a submit button so I can connect to a database.\n\nHere is the code:\n\n<?php\n// Initialize the session\nsession_start();\n\n// Check if the user is already logged in, if yes then redirect him to index page\nif(isset($_SESSION[\"loggedin\"]) && $_SESSION[\"loggedin\"] === true){\n header(\"location: /dashboard/\");\n exit;\n}\n\nif($_SERVER[\"REQUEST_METHOD\"] == \"POST\"){\n // Include config file\n require_once \"config.php\";\n\n // Validate credentials\n if(empty($username_err) && empty($password_err)){\n // Prepare a select statement\n $link = mysqli_connect('localhost', 'mydbusername', 'mydbpassword', 'mydbname');\n $sql = \"SELECT id, username, password, firstname, lastname, email FROM users WHERE username = ?\";\n\n if($stmt = mysqli_prepare($link, $sql)){\n // Bind variables to the prepared statement as parameters\n mysqli_stmt_bind_param($stmt, \"s\", $param_username);\n\n // Set parameters\n $param_username = $username;\n\n // Attempt to execute the prepared statement\n if(mysqli_stmt_execute($stmt)){\n // Store result\n mysqli_stmt_store_result($stmt);\n\n // Check if username exists, if yes then verify password\n if(mysqli_stmt_num_rows($stmt) == 1){ \n // Bind result variables\n mysqli_stmt_bind_result($stmt, $id, $username, $hashed_password, $firstname, $lastname);\n\n // Store data in session variables\n $_SESSION[\"loggedin\"] = true;\n $_SESSION[\"id\"] = $id;\n $_SESSION[\"username\"] = $username; \n $_SESSION[\"firstname\"] = $firstname;\n $_SESSION[\"lastname\"] = $lastname;\n\n // Redirect user to index page\n header(\"location: /dashboard/\");\n }\n }\n }\n }\n?>\n\n\n<div class=\"container\">\n <div class=\"input-group\">\n <span class=\"input-group-addon\"><i class=\"fa fa-user\"></i></span>\n <input type=\"text\" name=\"username\" class=\"form-control form-size\" value=\"<?php echo $username; ?>\" placeholder=\"Username\">\n </div>\n\n\n <div class=\"input-group\">\n <span class=\"input-group-addon\"><i class=\"fa fa-lock\"></i></span>\n <input type=\"text\" name=\"password\" class=\"form-control form-size\" value=\"<?php echo $password; ?>\" placeholder=\"Password\">\n </div>\n <button type=\"submit\" class=\"btn btn-primary btn-block button-size\" onclick=\"this.disabled = true\">Log In To My Account</button>\n</div>\n\n\nWhen I try this:\n\n<button type=\"submit\" class=\"btn btn-primary btn-block button-size\" onclick=\"this.disabled = true\">Log In To My Account</button>\n\n\nIt will disable the button, but it will not connect to the database. If I remove the disable, I can be able to connect to the database without any problem.\n\nCan you please show me an example how I could use to disable a button to display the spinner image using fa fa-spinner fa-spin for bootstrap while I could connect to a database?\n\nThank you."
] | [
"php",
"css",
"bootstrap-4"
] |
[
"How to apply SQL query in Django?",
"Following is a SQL query\n\nupdate myModel set name=\"new name\", age=24 where id==2\n\nHow can I apply above type of query in Django??"
] | [
"django"
] |
[
"Simplifying SQL Select (att1, att2) union (att2, att1) to avoid copy and paste",
"I try to simplify the following code, but I can't seem to get the syntax right other than to copy and paste which makes the code hard to read. Can someone point me in the right direction please.\n\nselect att1, att2 from LONG EXPRESSION \nunion\nselect att2, att1 from LONG EXPRESSION\n\n\nI was hoping to do \n\nselect att1, att2 union select att2, att1\nfrom LONG EXPRESSION\n\n\nor something like\n\nselect att1, att2 from LONG EXPRESSION X\nunion\nselect att2, att1 from X\n\n\nThanks a lot"
] | [
"sql",
"sqlite"
] |
[
"Batch script to extract part of a string",
"I need a batch script that will read in another batch script (batch2) and:\n\n\nlook for the string \"configout:\" OR \"configin:\"\nIf it encounters one of these two strings, extract what's after it until the string \".xml\"\ncopy paste it in a new text file.\nand do this for each line of batch2.\n\n\nFor exemple:\nIf this is my first line in the batch script\n\n/configin:%faxml%fm_sellin_in.xml /configout:%faxml%transco_fm_sellin_out%col_transco%.xml /inputfile:\n\n\nI should have this in my text file:\n\n%faxml%fa_sellin_in.xml\n%faxml%transco_fm_sellin_out%col_transco%.xml\n\n\nI have seen a good code in Here:\n\nfor /f \"tokens=1-2 delims=~\" %%b in (\"yourfile.txt\") do (\n echo %%b >> newfile.txt\n echo removed %%a)\n\n\nbut i don't know how to adapt it to my specific case."
] | [
"batch-file"
] |
[
"angular 1.6.1 http request from service",
"angular 1.6.1 has removed .success and .error in service $http for use .then and .catch.\nNow my answer is:\nIt makes sense that I have written in my code? because now I'm confused on how the controller talks to the service\n\nI have a controller for login (example):\nLoginCTRL\n\nUser.login(data).then(\n function(response){ \n //do something \n },function(err){\n //do somethig\n});\n\n\nAnd I have User service:\n\nmyapp.service('User', function User($q, $http) {\n return {\n login: function(credentials){\n return $http.post('login',{data:data}).then(function onSuccess(response) {\n return response;\n }).catch(function onError(response){\n return response;\n });\n },\n}\n\n\nIt's correct write service.method().then in controller, now that there is no more $q.defer().resolve(data) or $q.defer().reject(reason)"
] | [
"angularjs"
] |
[
"Parsing with jsoup throws error (NetworkOnMainThreadException)",
"I downloaded the jsoup library jsoup-1.7.1.jar core and imported it to my project using the Project -> Properties->Java Build Path -> Add external Jars and I pasted the library file to my libs folder. However there seems to be some problem about importing the Jsoup library to my project. When I run my app, upon launching I get this error. \n\n12-26 22:59:24.133: E/AndroidRuntime(6710): FATAL EXCEPTION: main\n12-26 22:59:24.133: E/AndroidRuntime(6710): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.jsouptest/com.example.jsouptest.MainActivity}: android.os.NetworkOnMainThreadException\n\n\nAfter searching and asking I found out that eclipse sees the jsoup.jar, but unable to package it to APK file for the app to run. I tried to organize Imports by pressing Shift+Alt+O and I would get the same error. At this point, I am unsure about what is wrong and have no idea how to fix it. I have only hope someone will lead me toward the solution. Appreciate your time! \n\nThis is my code: \n\npackage com.example.jsouptest;\n\nimport java.io.IOException;\n\nimport org.jsoup.Jsoup;\nimport org.jsoup.nodes.Document;\n\nimport android.app.Activity;\nimport android.os.Bundle;\nimport android.view.Menu;\n\npublic class MainActivity extends Activity {\n\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n Document doc;\n try {\n doc = Jsoup.connect(\"http://google.com/\").get();\n String title = doc.title();\n System.out.print(title);\n } catch (IOException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }\n\n\n\n\n @Override\n public boolean onCreateOptionsMenu(Menu menu) {\n // Inflate the menu; this adds items to the action bar if it is present.\n getMenuInflater().inflate(R.menu.activity_main, menu);\n return true;\n }\n\n}"
] | [
"android",
"parsing",
"jsoup"
] |
[
"Client side XForms processing tools",
"What would be the best client side javascript based XForms processor?\n\nI'm trying to migrate plugin (activeX) based Xforms processing solution to a javascript based client side processor. But the migrating XForm does not work properly in any of the client side solutions I found. They give various unfriendly errors and its very hard to find why as it is unable to debug. Ideally migration should work without any changes isn't it? How should I approach my goal ?"
] | [
"javascript",
"xforms"
] |
[
"Merging local git repo changes to a already created github repository",
"I am new to git. We are converting our project from svn to git. \n\nWe have a github. We started converting demo projects. I started the conversion process like this\n\n\nConverted svn project to git using git svn clone command in my MAC\nSo I got a local repo now with all svn log\nCreated a repo in github. I want to upload my local git repository changes to github repository\n\n\nHow do I do that? Or else please suggest me if there is a different way"
] | [
"git",
"github"
] |
[
"Error at node_modules/@types/react-dom/.... Subsequent variable declarations must have the same type. Variable 'a'",
"I have installed @types/react-dom along with typescript and @types/react and @types/meteor but when I try to run the typechecker from command line I get the below error\n\nYou can reproduce the error and see all my configuration here: https://github.com/Falieson/react15-meteor1.5\n\nThanks for your help!\n\n$ meteor npm run type:client\n\n> [email protected] type:client /Users/sjcfmett/Private/ReactMeteorExample\n> tslint -p ./tsconfig.json --type-check './client/**/*.{ts,tsx}'\n\nError at node_modules/@types/react-dom/node_modules/@types/react/index.d.ts:3422:13: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>', but here has type 'DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>'.\nError at node_modules/@types/react-dom/node_modules/@types/react/index.d.ts:3423:13: Subsequent variable declarations must have the same type. Variable 'abbr' must be of type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>', but here has type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>'.\nError at node_modules/@types/react-dom/node_modules/@types/react/index.d.ts:3424:13: Subsequent variable declarations must have the same type. Variable 'address' must be of type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>', but here has type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>'.\nError at node_modules/@types/react-dom/node_modules/@types/react/index.d.ts:3425:13: Subsequent variable declarations must have the same type. Variable 'area' must be of type 'DetailedHTMLProps<AreaHTMLAttributes<HTMLAreaElement>, HTMLAreaElement>', but here has type 'DetailedHTMLProps<AreaHTMLAttributes<HTMLAreaElement>, HTMLAreaElement>'.\n... (shortened)\n\n\npackage.json (for reference)\n\n{\n \"name\": \"react-meteor-example\",\n \"version\": \"0.1.0\",\n \"private\": true,\n \"scripts\": {\n \"start\": \"meteor run\",\n \"lint:client\": \"tslint --fix -c ./tslint.json -p ./tsconfig.json './client/**/*.{ts,tsx}'\",\n \"lint:imports\": \"tslint --fix -c ./tslint.json -p ./tsconfig.json './imports/**/*.{ts,tsx}'\",\n \"lint:server\": \"tslint --fix -c ./tslint.json -p ./tsconfig.json './server/**/*.ts'\",\n \"lint\": \"npm run lint:client && npm run lint:server && npm run lint:imports\",\n \"type:imports\": \"tslint -p ./tsconfig.json --type-check './imports/**/*.{ts,tsx}'\",\n \"type:client\": \"tslint -p ./tsconfig.json --type-check './client/**/*.{ts,tsx}'\",\n \"type:server\": \"tslint -p ./tsconfig.json --type-check './server/**/*.ts'\",\n \"type\": \"npm run type:client && npm run type:server && npm run type:imports\",\n \"precommit\": \"npm run lint && npm run type\"\n },\n \"dependencies\": {\n \"babel-runtime\": \"^6.20.0\",\n \"meteor-node-stubs\": \"~0.2.4\",\n \"react\": \"^15.6.1\",\n \"react-dom\": \"^15.6.1\"\n },\n \"devDependencies\": {\n \"@types/meteor\": \"^1.4.2\",\n \"@types/react\": \"^15.6.0\",\n \"@types/react-dom\": \"^15.5.1\",\n \"babel-preset-react\": \"^6.24.1\",\n \"babel-preset-stage-1\": \"^6.24.1\",\n \"husky\": \"^0.14.3\",\n \"tslint\": \"^5.5.0\",\n \"tslint-react\": \"^3.1.0\",\n \"typescript\": \"^2.4.2\"\n }\n}"
] | [
"reactjs",
"typescript",
"meteor",
"typescript-typings",
"react-dom"
] |
[
"How to use tamil characters as a slug in laravel route?",
"I'm working on tamil siddha project, but im stuck, because i don't know how to use tamil character as a slug.\n\nroutes.web\n\nuse Illuminate\\Support\\Facades\\Route;\n\n/*\n|--------------------------------------------------------------------------\n| Web Routes\n|--------------------------------------------------------------------------\n|\n| Here is where you can register web routes for your application. These\n| routes are loaded by the RouteServiceProvider within a group which\n| contains the \"web\" middleware group. Now create something great!\n|\n*/\n\nRoute::get('/', 'user\\HomeController@index')->name('index');\nRoute::get('/home', 'HomeController@index')->name('home');\nRoute::resource('/questions', 'User\\PostController', ['except' => ['show']]);\nRoute::get('/questions/{slug}', 'User\\PostController@show')->name('post');\nRoute::resource('/tags', 'User\\TagController');\n\n\nHow i created my slug:\n\ncombined my title and post_id,\nBut while i'm using tamil character as a title, i could not combine it.\n\npost controller\n\npublic function store(Request $request)\n {\n $this->validate($request,[\n\n 'title' => 'required',\n 'body' => 'required',\n ]);\n\n $post = new Post;\n\n $post -> title = $request -> title;\n $post -> body = $request -> body;\n $post -> tags = implode(', ', $request -> tags);\n $post -> posted_by = 1;\n $post -> save();\n $post_ID = $post->post_id;\n $post -> slug = $post_ID.'-'.str_slug($post -> title, '-');\n $post -> save(); \n\n return redirect(route('questions.index'));\n }\n\n\nhow do i resolve this problem?"
] | [
"php",
"laravel",
"laravel-5",
"laravel-6",
"laravel-7"
] |
[
"How to unpublish social media icons from a single article in joomla 3?",
"It's a simple form and does not need social sharing. How to remove social media icons from an article in joomla3?"
] | [
"joomla3.0"
] |
[
"How to create categories and sub-categories in left side in opencart?",
"I am beginner in open-cart.I currently working in web2print extension in open-cart.I need to create categories and sub categories in left side.I already display categories menu in left side via admin panel,but i need to create display categories and sub-categories in left side bar with similar manner.\n\n <div class=\"box clsLeft_menu\">\n <div class=\"box-heading\">Some of our specialties:</div>\n <div class=\"box-content\">\n <ul class=\"box-category\">\n <?php foreach ($categories as $category) { ?>\n <li>\n <?php if ($category['category_id'] == $category_id) { ?>\n <a href=\"<?php echo $category['href']; ?>\" class=\"active\"><?php echo $category['name']; ?></a>\n <?php } else { ?>\n <a href=\"<?php echo $category['href']; ?>\"><?php echo $category['name']; ?></a>\n <?php } ?>\n <?php if ($category['children']) { ?>\n <ul>\n <?php foreach ($category['children'] as $child) { ?>\n <li>\n <?php if ($child['category_id'] == $child_id) { ?>\n <a href=\"<?php echo $child['href']; ?>\" class=\"active\"> - <?php echo $child['name']; ?></a>\n <?php } else { ?>\n <a href=\"<?php echo $child['href']; ?>\"> - <?php echo $child['name']; ?></a>\n <?php } ?>\n </li>\n <?php } ?>\n </ul>\n <?php } ?>\n </li>\n <?php } ?>\n </ul>\n </div>\n</div>\n\n\nI want to display categories and sub-categories in opencart.\nexample:\n\n--main categories\n\n--sub 1\n--sub 2\n--sub 3 \n\n\n--main categories\n\n--sub 1\n--sub 2\n\n\nhow to solve it ?Please guide me..."
] | [
"php",
"opencart"
] |
[
"Python bs4: If entry A has “form-groups”, scrape it; for entries other than A, don't scrape “form-groups”",
"I’m trying to scrape information off the Oxford dictionary. The problem is that there are same class name for the class "form-groups".\nI only want to scrape the class "form-groups" above the entry 1. For the word "acclimatize", my code works.\nBut for the word "peculiar", it scrapped the class "form-groups" under entry 2, which is not what I want. I only want to scrape the class "form-groups" above the entry 1.\nSo basically:\nIf "form-groups" above the entry 1 doesn't exist, print("none"); but not to scrape other "form-groups" in different entries.\nHere's my code:\nfrom bs4 import BeautifulSoup\nimport urllib.request\nimport requests\nimport time\n\n\nword = ["peculiar"]\nsource = "https://en.oxforddictionaries.com/definition/"\nfor word in word:\n try:\n with urllib.request.urlopen(source + word) as url:\n s = url.read()\n soup = BeautifulSoup(s, "lxml")\n try:\n form_groups = soup.find('span', {'class': 'form-groups'}).text\n y = form_groups\n except:\n y = "no form_groups"\n\n print(word + "#" + y)\n time.sleep(2)\n except:\n print("No result for " + word)\n time.sleep(2)\n\nAny input is much appreciated! Thank you very much!"
] | [
"python",
"beautifulsoup"
] |
[
"Show parent in label of select option",
"I have one select box\n<%=simple_form_for order_item do |oi|%>\n <%= order_item.association :category, label: false, collection: current_company.categories, placeholder: 'Category', input_html: { class: 'form-control form-control-sm drop_down_input order_item_category} %>\n<%end%>\n\nand this select box is bind with select2\ncurrently, when I search anything this shows results like this: -\n\nBut I want to results like show search and with a label that showing item's parent (note: - category has one parent. and one category has many children)\n\nhowever I tried with option_groups with this the issue is I cant select option_group(which is parent), but I want to select all category.\nCategory model\nbelongs_to :parent, class: 'category', foreign_key: 'parent_id'\nhas_many :children, class: 'category'\n\nAny help would be appreciated. thanks."
] | [
"ruby-on-rails",
"jquery-select2",
"simple-form"
] |
[
"export excel with a query using maatwebsite with laravel",
"Hello i'm really new using maatwebsite already read the documentation but cant find it, can someone give me an idea about executing query after exporting excel using maatwebsite? here is my code :\npublic function export()\n{\n Excel::download(new KodePosExport, 'KodePos.xlsx');\n KodePos::query()->truncate();\n return redirect('/')->with('success', 'All good!');\n}\n\nit's able redirect to the page that i wanted and truncate the data but not exporting the excel, how can i do it? Thank you\nIf using this function exporting excel working perfectly, but not query included\npublic function export()\n{\n return Excel::download(new KodePosExport, 'KodePos.xlsx');\n //KodePos::query()->truncate();\n // return redirect('/')->with('success', 'All good!');\n}"
] | [
"php",
"laravel",
"maatwebsite-excel"
] |
[
"How do I set headers on Flutter/Dart http Request object?",
"I need a way to set the headers of the dart http Request object to application/JSON.\n\nI want to build a Request object to send to my backend API. I set the body to my JSON object, but when it gets sent, it defaults the headers to text/html instead of application/json.\n\nI have tried using the built-in method\n\nhttp.post(url,dynamic body);\n\n\nbut unfortunately this method places the body in the parameters of the URL and I need it in the actual body of the request.\n\nSo instead I built an http Request object, and manually set the URL and body but like I said, it sets the headers to text/html.\nI have read the docs for https://pub.dev/documentation/http/latest/http/Request-class.html, but unfortunately, I haven't found a way to set the headers. \n\npostRequest(uri) async {\n\n Uri url = Uri.tryParse(\"https://ptsv2.com/t/umt4a-1569012506/post\");\n\n http.Request request = new http.Request(\"post\", url);\n\n request.body = '{mediaItemID: 04b568fa, uri: https://www.google.com}';\n\n var letsGo = await request.send();\n\n print(letsGo.statusCode);\n}\n\n\n\n\nMuch thanks for any possible solutions!\n\nPs. this is my first ask on Stack Overflow so I apologize if I made any errors in posting."
] | [
"http",
"flutter",
"dart"
] |
[
"`bcp in` fails with \"INSERT failed because the following SET options have incorrect settings: 'QUOTED_IDENTIFIER'\"",
"I exported a table (created with EF Core 2.2) with bcp %database%.MyTable out MyTable.dmp -n -T -S %sqlserver%. \n\nOn reimporting it with bcp %database%.MyTable in MyTable.dmp -n -T -S %sqlserver% I get this error:\n\nSQLState = 37000, NativeError = 1934\nError = [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]INSERT failed because the following SET options have incorrect settings: 'QUOTED_IDENTIFIER'. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or filtered indexes and/or query notifications and/or XML data type methods and/or spatial index operations.\n\n\nThe table is created with QUOTED_IDENTIFIER = ON and does not contain any computed column:\n\nSET ANSI_NULLS ON\nGO\n\nSET QUOTED_IDENTIFIER ON\nGO\n\nCREATE TABLE [MyTable](\n [Id] [bigint] IDENTITY(1,1) NOT NULL,\n [OwnerLoginId] [bigint] NOT NULL,\n [RowVersion] [timestamp] NULL,\n [CreatedAt] [datetime2](7) NOT NULL,\n [DataId] [bigint] NOT NULL,\n [SomeString] [nvarchar](30) NOT NULL,\n [AnotherString] [nvarchar](30) NULL,\n CONSTRAINT [PK_MyTable] PRIMARY KEY CLUSTERED \n(\n [Id] ASC\n)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]\n) ON [PRIMARY]\nGO\n\nALTER TABLE [MyTable] WITH CHECK ADD CONSTRAINT [FK_MyTable_SomeOtherTable_DataId_SomeString] FOREIGN KEY([DataId], [SomeString])\nREFERENCES [SomeOtherTable] ([DataId], [SomeString])\nGO\n\nALTER TABLE [MyTable] CHECK CONSTRAINT [FK_MyTable_SomeOtherTable_DataId_SomeString]\nGO\n\nALTER TABLE [MyTable] WITH CHECK ADD CONSTRAINT [FK_MyTable_DataTable_DataId] FOREIGN KEY([DataId])\nREFERENCES [DataTable] ([Id])\nGO\n\nALTER TABLE [MyTable] CHECK CONSTRAINT [FK_MyTable_DataTable_DataId]\nGO"
] | [
"sql-server",
"bcp",
"sql-server-2017"
] |
[
"JS Charts: drawing trend lines",
"IVe been trying to use http://www.jscharts.com/ (JS Charts) for plotting stock market stats. But I was wondering if JS charts has an option to add pattern lines or trend lines in order to mark down the daily patterns or trend of the graph. I want to know if JS Charts provides that option or is there any other javascript charts that provides this option?"
] | [
"javascript",
"charts"
] |
[
"Set libstdc++.so.6 location for compiler",
"While build c++ package with GCC4.9 I am getting below error message.\n\n'/usr/lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /local/p4clients/pkgbuild-S1NVe/workspace/build\n\n\nI have overridden the CC and CXX with different Gcc compiler location in makefile, which also has the same so file under different folder.\nI have added that folder location also in LD_LIBRARY_PATH still compiler is using /usr/lib64/ instead of /mypath/lib64.\n/usr/lib64/ is GCC4.5.\nHow can i tell compiler to use so file from differenet location."
] | [
"c++",
"gcc",
"libstdc++"
] |
[
"What is the Ember way of converting retrieved Ember Data records into plain objects?",
"I have retrieved a series of records using var items = store.find('model');. The returned object is an instance of RecordArray, and contains several entries, each with an Ember object that allows me to get and set properties into the records.\n\nIt all looks pretty good.\n\nNow I need to feed the returned objects into a third party library, and of course I cannot send Ember objects there since it expects plain objects.\n\nI looked on pages and pages of related material but I can't find any generic way of doing this. I'm pretty sure there is one since this seems to be a very basic use case, so I don't \nwant to reinvent the wheel and write it all again.\n\nIs there a facility in Ember for that? How can I obtain a simple array with plain JavaScript objects (just hashes, I mean) from this RecordArray I got? \n\nUPDATE\n\nOf course I can do JSON.parse(JSON.stringify(recordArray)); but for large objects that doesn't seem too performant with so many conversions. I'm wondering if Ember provides a more direct way (with better performance) of doing this.\n\nThanks!"
] | [
"javascript",
"ember.js"
] |
[
"Autoincrement end of filename if previous set of files exist",
"I need to create x number of files (a set) but I must first check to see if the files exist with a similar name. \n\nFor example, tiftest1.tif, tiftest2.tif, ... exist and I must write tiftest again to the same directory. I'd like to append _x to the end of the filename, where x is a number that is auto-incremented, each time that I want to create the set. So I can have tiftest1_1.tif,tiftest2_1.tif, tiftest1_2.tif, tiftest2_2.tif, tiftest1_3.tif, tiftest2_3.tif and so forth.\n\nHere is what I have so far:\n\n...\nDirectoryInfo root = new DirectoryInfo(fileWatch.Path);\nFileInfo[] exist = root.GetFiles(fout + \"*.tif\");\n\nif (exist.Length > 0)\n{\n int cnt = 0;\n do\n {\n cnt++;\n DirectoryInfo root1 = new DirectoryInfo(fileWatch.Path);\n FileInfo[] exist1 = root.GetFiles(fout + \"*\" + \"_\" + cnt + \".tif\");\n\n arg_proc = \"-o \" + \"\\\"\" + fileWatch.Path\n + \"\\\\\" + fout + \"%03d_\" + cnt + \".tif\\\" -r \" + \"\\\"\" + openDialog.FileName + \"\\\"\";\n\n } while (exist1.Length > 0); //exist1 is out of scope so this doesn't work\n}\nelse\n{\n\n arg_proc = \"-o \" + \"\\\"\" + fileWatch.Path\n + \"\\\\\" + fout + \"%03d.tif\\\" -r \" + \"\\\"\" + openDialog.FileName + \"\\\"\";\n}\n...\n\n\nexist1.length is out of scope so the loop will continually run. I'm not certain how to correct this. My method was to originally scan the directory for a match and see if the length of the array is greater than 0. If it is > 0 then the _x will autoincrement until a match isn't found. arg_proc is a string used in a function (not included) which will create the files."
] | [
"c#"
] |
[
"Force Netbeans to generate partially-qualified javadoc",
"several methods I have return Map objects like (partially-qualified)\n\nMap<Integer,String>\n\n\nwhich turn out in the NetBeans (7.0.1) generated javadoc as fully-qualified:\n\njava.util.Map<java.lang.String,java.lang.Integer>\n\n\nDo you know whether it's possible (and how) to tell NetBeans javadoc generator to use partially-qualified class names? Through Google I was only able to find related Oracle's naming convetion but there seems to be no useful option switch.\n\nThanks in advance!"
] | [
"netbeans",
"javadoc"
] |
[
"How to generate session id and auth bearer token for a payment sandbox http request and it is not available in any of the previous request",
"There is a ecommerce application in which I have to add product and make payment for checkout. Payment mode is sandbox for now.\nSo, Payment.sandbox.api http request url is having session id in the payload and auth bearer token in http request header, but these are not available in any of the previous response ,so that I can fetch it from the response but that is not available\n\nSo further it is giving me authentication issue,that credentials are invalid, that may be because of session id and auth token. So how to handle them or how to populate them automatically as I am not getting in any of the previous request?"
] | [
"jmeter",
"performance-testing",
"payment-gateway",
"braintree-sandbox"
] |
[
"Is there a better way to write a right-recursive grammar's production rules than this?",
"Scenario: Give production rules for a RIGHT-recursive grammar that\ndescribes the set of all non-empty strings made from the characters\nR and N, which may contain arbitrarily many contiguous\nrepetitions of R, but precisely two or precisely three contiguous\nrepetitions of N.\n\nAnswer:\n\nA -> N B | R+ A\n\nB -> N D | N C | N ε\n\nC -> N D | N ε\n\nD -> R+ D | R ε"
] | [
"recursion",
"compiler-construction",
"grammar"
] |
[
"How to convert from boost::multiprecision::cpp_int to cpp_dec_float (rather than to cpp_dec_float_50, etc.)?",
"As is made clear in the Boost Multiprecision library documentation, it is straightforward to convert from a boost::multiprecision::cpp_int to a boost::multiprecision::cpp_dec_float:\n\n// Some interconversions between number types are completely generic,\n// and are always available, albeit the conversions are always explicit:\n\ncpp_int cppi(2);\ncpp_dec_float_50 df(cppi); // OK, int to float // <-- But fails with cpp_dec_float<0>!\n\n\nThe ability to convert from a cpp_int to a fixed-width floating-point type (i.e., a cpp_dec_float_50) gives one hope that it might be possible to convert from a cpp_int to an arbitrary-width floating-point type in the library - i.e., a cpp_dec_float<0>. However, this doesn't work; the conversion fails for me in Visual Studio 2013, as the following simple example program demonstrates:\n\n#include <boost/multiprecision/number.hpp>\n#include <boost/multiprecision/cpp_int.hpp>\n#include <boost/multiprecision/cpp_dec_float.hpp>\n\nint main()\n{\n boost::multiprecision::cpp_int n{ 0 };\n boost::multiprecision::cpp_dec_float<0> f{ n }; // Compile error in MSVC 2013\n}\n\n\nIt does succeed to convert to cpp_dec_float_50, as expected, but as noted, I am hoping to convert to an arbitrary precision floating point type: cpp_dec_float<0>.\n\nThe error appear in the following snippet of code from the internal Boost Multiprecision code, in the file <boost/multiprecision/detail/default_ops.hpp>:\n\ntemplate <class R, class T>\ninline bool check_in_range(const T& t)\n{\n // Can t fit in an R?\n if(std::numeric_limits<R>::is_specialized && std::numeric_limits<R>::is_bounded\n && (t > (std::numeric_limits<R>::max)()))\n return true;\n return false;\n}\n\n\nThe error message is:\n\n\n error C2784:\n 'enable_if::result_type,detail::expression::result_type>,bool>::type\n boost::multiprecision::operator >(const\n boost::multiprecision::detail::expression\n &,const\n boost::multiprecision::detail::expression &)' :\n could not deduce template argument for 'const\n boost::multiprecision::detail::expression &'\n from 'const next_type'\n\n\nMight it be possible to convert a boost::multiprecision::cpp_int to a boost::multiprecision::cpp_dec_float<0> (rather than converting to a floating-point type with a fixed decimal precision, as in cpp_dec_float_50)?\n\n(Note that in my program, only one instance of the floating-point number is instantiated at any time, and it is updated infrequently, so I am fine with having this one instance take up lots of memory and take a long time to support really huge numbers.)\n\nThanks!"
] | [
"c++",
"c++11",
"boost",
"multiprecision"
] |
[
"Dereferencing structure instance element using structure instance pointer",
"I have this function:\n\nstatic pair_t * // not visible outside this file\npair_new(const int key)\n{\n\n pair_t *pair = malloc(sizeof(pair_t));\n\n if (pair == NULL) {\n // error allocating memory for pair; return error\n return NULL;\n } else {\n\n\n printf(\"key is %d\\n\",key);\n\n *(pair->key) = key;\n *(pair->count) = 1;\n pair->next = NULL;\n return pair;\n\n }\n}\n\n\nbut the way I am trying to dereference the key element of the instance of pair is giving me a seg fault. I think it is because 'pair' is a pointer.\n\nthe pair structure is defined as follows:\n\ntypedef struct pair {\n int *key; // search key for this item\n int *count; // pointer to data for this item\n struct pair *next; // children\n} pair_t;\n\n\nAny suggestions on how to properly change the value of key would be much appreciated"
] | [
"c",
"pointers",
"struct"
] |
[
"Object Allocations going crazy",
"I have CFArray and CFString allocations going all red while checking on the Instruments Object Alloc. \n\nObject seem to be alive but not being used, this because the used part of the histogram is 1/10th of the total histogram (which has turned red) in both cases.\n\nthe app is a photo library application with 7 view controllers. Loading up thumbnail images for each individual view controller, and then loading the image on need basis. Just going back and forth between two view controllers keeps pushing the CFArray histogram up.\n\nlet me know if posting the code here would help.\n\nThanks,\nP"
] | [
"objective-c",
"memory-management",
"dynamic-memory-allocation"
] |
[
"Checkbox preference using .java",
"I am currently working on an android project where I need to create a SettingsActivity where I will have a variable number of checkboxes depending on an int from an SQLite database. I figured that the best way to do this was to create a for loop inside the SettingsActivity .java code, which would create a new checkbox preference for each time it runs the loop(as of now I only have a theoretical idea of how it would work). My problem would be to create the checkbox preference in .java rather than the XML. I searched the internet and could only find one example that had about 300 lines of code in it, and I can't believe that it needs to be as complicated as it was in that example. Does anyone have a helpful link, an idea how to do this or even knows a better way to make a variable number of checkboxes?\n\nSorry that I don't have any relevant code to post, but here is the link to the example I found http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/1.5_r4/android/preference/CheckBoxPreference.java"
] | [
"java",
"android",
"checkbox",
"settings",
"preference"
] |
[
"Using JButtons as Tabs",
"Could I use JButtons as tabs? Since the JTabbedPane cannot hold the same component in multiple tabs, would there be a way for a JButton to be a tab? I know it looks like tiDE(Website) uses the JButtons as a tab. How would I do that? \n\nI could make something like this\n\nJButton newTab = new JButton(\"New Tab\");\nnewTab.addActionListener(\n new ActionListener() {\n public void actionPerformed(ActionEvent evt) {\n JButton tab = new JButton(\"Tab 1\");\n JToolBar.add(tab) \n tab.addActionListener(\n new ActionListener() {\n public void actionPerformed(ActionEvent e) {\n makeTextAreaTab();\n }\n } \n );\n }\n }\n);\n\n\nBut, how would I make the method makeTextAreaTab()? It would have to be the same component as my other editor(JTextArea), and have the same functionality as a JTabbedPane."
] | [
"java",
"swing",
"jbutton",
"jtextarea",
"jtabbedpane"
] |
[
"Eclipse Export Jar file not working",
"So I've been using java and eclipse for a little while, mostly for my AP class at school. The class is all over now and I've done development on my own. I built a game and I would like to publish it. I looked online on how to do that and I know how to export as a jar file and stuff, but it's not fully running. When I open up the file, it just has my driver and I cannot interact with it. I don't know if it has to do with multiple classes or something like that, but when I open the jar to run my game, it has just the menu screen and then you can't do anything with it. It runs perfectly in eclipse, but not as an export. I'm sure there's an easy solution, but I couldn't find one. I use a mac by the way."
] | [
"java",
"eclipse"
] |
[
"Inserting rows for specific missing values",
"I know how to insert rows for sequential missing values, but how can I do this for unique values that I store in a range? For example:\n\nRange of all needed values New list with missing values\n2 2\n3 5\n5 7\n6 15\n7\n10\n15\n\n\nThe code below adds rows in a sequence (i.e. if list is 2 3 5, it adds 4) so it's not what I need but I don't know how to make it loop through a range and take values only from it\n\nSub RowsInSequence()\n Dim i As Long, j As Long\n i = Cells(Rows.Count, \"A\").End(xlUp).Row\n Application.ScreenUpdating = False\n For j = i To 1 Step -1\n If Cells(j + 1, 1) <> \"\" Then\n If Cells(j + 1, 1).Value - Cells(j, 1).Value > 1 Then\n x = Cells(j + 1, 1).Value - Cells(j, 1).Value\n Rows(j + 1 & \":\" & x + j - 1).Insert\n End If\n End If\n Next j\n With Range(\"A1:A\" & Range(\"A\" & Rows.Count).End(xlUp).Row)\n .Formula = \"=Row()\"\n .Value = .Value\n End With\n Application.ScreenUpdating = True\nEnd Sub"
] | [
"excel",
"vba"
] |
[
"timing out a method call",
"The original method calling is like:\n\npublic string AskAPI(string uri)\n{\n return api.Query(uri);\n}\n\n\nwhere the api is simply a imported dll reference.\n\nRight now I want to add a time out feature to the AskAPI method, so that if the api.Query takes longer than, say 30 seconds, AskAPI will throw an exception.\n\nSeems I won't be able to get it working. Can anyone share their thoughts about this?\n\nThanks!"
] | [
"c#",
"multithreading"
] |
[
"Django rest framework Database thread pool management",
"How does django rest framework internally manage Database connection pool. Does it persist a DB connection or it is one DB connection for each DB call? Can we configure Database thread pool connection in Django ?"
] | [
"django",
"database",
"django-models",
"django-rest-framework",
"django-orm"
] |
[
"WooCOmmerce backend - product categories menu, wrong category tree",
"I have a unusual problem with my WooCommerce store. On my backend in menu edit section some of sub-categories (children of first level category) are not displayed as a childern, but as first level category in View All TAB.\nIt makes a little difficulty to create menu tree because I have few sub-categories (from different parents) with the same name.\nThe problem is only in Wordpress MENU edit page. Category tree is created correctly, and nested in a right way. Categories are not empty. Each one has at least few products.\nDoes anyone have an idea what can be wrong?\nThis is my custom theme build on ACF Pro, pure PHP files and WooCommerce plugin Only. No other backend plugins etc."
] | [
"wordpress",
"woocommerce",
"wordpress-theming",
"custom-wordpress-pages",
"woocommerce-theming"
] |
[
"Extract tables from pdf files that goes over one page in R",
"I want to extract a table from a pdf file and analyze it in R. I´m using tabulizer::extract_tables() function.\n\nThe table goes over more than one page (page 6 to 9). When I use extract_table function I receive a list object with 12 elements. The table I want is in the elements out[[1]] to out[[4]]\n\nThe problems are: my table doesn´t have a header in all pages and the document has its own header. Therefore, the function cannot delimitate the right number of columns. The element out[[1]] has 4 columns, out[[2]] and out[[3]] have 2 columns and out[[4]] has 1 column. Is there any way to at least get the right number of columns in all 4 elements?\n\nCode:\n\nlibrary(tabulizer)\n\narquivo <- \"1236_Pombos_PE.pdf\"\nout <- extract_tables(arquivo, output = \"data.frame\", encoding = \"UTF-8\")"
] | [
"r",
"tabulizer"
] |
[
"Android TextView with multiple click events",
"In my android app i have to show tags on Textview.\nThere can be multiple tag in same textView and i want to add click event to each tag.\nThere may be some other text in same textview.How can i formate text in such a way all tags are clickable with bold text and other text as normal text.\nSuppose Text \"#tag1 text message #tag2 #tag3 normal text\" is to be set in text view with #tag1,#tag2 and #tag3 with bold text and remaining text with normal text style,so how can i achieve this.\n\nThanks in advance."
] | [
"android",
"textview",
"spannable",
"text-styling"
] |
[
"Return Image URL from Paperclip using RABL",
"I have a user model with Paperclip for avatars and I need to be able to return the image_url for each size (small, medium, large) using RABL.\n\nIn mongoid model i would simply do self.avatar(:original) but now nothing works, I just get an empty response in the attachment \n\n\"user\" : {\n \"id\" : \"50b204e10eae9c55fa000028\",\n \"paperclip::attachment\" : {},\n \"name\" : \"My Name\"\n}\n\n\n/models/user.rb\n\nhas_mongoid_attached_file :avatar,\n :styles => {\n :original => ['1000x1000>', :jpg],\n :small => ['64x64#', :jpg],\n :medium => ['250x250', :jpg],\n :large => ['500x500>', :jpg]\n }\n\n\n/views/posts/base.json.rabl\n\nchild :user do\n attributes :id, :name\n\n child :avatar do\n attributes :original\n end\nend"
] | [
"mongoid",
"paperclip",
"rabl"
] |
[
"\"Order by\" degraded performance in sql",
"Hi i have one problem while executing sql in postgresql.\n\nI have a similar query like this:\n\nselect A, B , lower(C) from myTable ORDER BY A, B ;\n\nWIthout ORDER BY clause, I get the result in 11 ms , but with order by , it took more than 4 minutes to retrieve the same results.\n\nThese column contains lots of data (1000000 or more) and has lot of duplicate data \nCan any one suggest me solution?? \n\nThank you"
] | [
"postgresql"
] |
[
"ASP.Net MVC - How to associate control made visible by jquery action to web model",
"I have a DropDownList populated with countries. \n\nWhen the user picks US I need to show dropdown with US states. If user picks CA - show dropdown with CA provinces...else show a TextBox. Depending on the country picked I hide/show using jQuery. That works ok. The problem is in the ActionResult when user submits.\n\n\nHtml.DropDownList(\"State\", ViewData[\"States\"] as SelectList, \n new { @class = \"states\", @style = \"display:none;\" })\nHtml.DropDownList(\"State\", ViewData[\"Provinces\"] as SelectList, \n new { @class = \"provinces\", @style = \"display:none;\" })\nHtml.TextBox(\"State\", null, new { @class = \"stateFreeForm\" })\n\n\nI pre-load the 2 dropdowns with US and CA data\nThe web model has a string member called State but it is mapping to the first DropDownList (US states). So even though on the page I have a TextBox visible the listing.State member contains the data picked from the US dropdown. I'm using Validation and the State is required so I want to have just one State (not State, Province, Other). Is there something I can do in the jQuery to set change the mapping between web model and control. \n\nI'd prefer to have the the dropdowns pre loaded and just toggle them via scripting rather make an ajax call to reload dropdowns etc.\n\n\npublic ActionResult Post(MyApp.Web.Models.Listing listing)\n{\n}\n\n\nThanks..."
] | [
"jquery",
"asp.net-mvc"
] |
[
"Automapper The interface has a conflicting property ID Parameter name: interfaceType",
"This is my model Heirarchy :\n\npublic interface INodeModel<T> : INodeModel\nwhere T : struct\n{\n new T? ID { get; set; }\n}\n\npublic interface INodeModel\n{\n object ID { get; set; }\n string Name { get; set; }\n}\n\npublic class NodeModel<T> : INodeModel<T>\n where T : struct\n{\n public T? ID { get; set; }\n public string Name { get; set; }\n\n object INodeModel.ID\n {\n get\n {\n return ID;\n }\n\n set\n {\n ID = value as T?;\n }\n }\n}\n\npublic class NodeDto<T> where T : struct\n{\n public T? ID { get; set; }\n public string Name { get; set; }\n}\n\n\nand these are my mappings and test : \n\n class Program\n{\n private static MapperConfiguration _mapperConfiguration;\n\n static void Main(string[] args)\n {\n _mapperConfiguration = new MapperConfiguration(cfg =>\n {\n\n cfg.CreateMap(typeof(NodeDto<>), typeof(NodeModel<>));\n cfg.CreateMap(typeof(NodeDto<>), typeof(INodeModel<>));\n cfg.CreateMap(typeof(INodeModel<>), typeof(NodeModel<>));\n\n });\n\n var dto = new NodeDto<int> { ID = 1, Name = \"Hi\" };\n\n var obj = _mapperConfiguration.CreateMapper().Map<INodeModel<int>>(dto);\n\n\n Console.Write(obj.ID);\n Console.ReadLine();\n }\n}\n\n\nand here is the exception :\n\nAutoMapper.AutoMapperMappingException:\n\nMapping types:\n\nNodeDto1 -> INodeModel1 NodeDto`1[[System.Int32] ->\n\nINodeModel`1[[System.Int32]\n\nMessage:\n\nThe interface has a conflicting property ID Parameter name: interfaceType\n\nStack:\n\nat AutoMapper.Internal.ProxyGenerator.CreateProxyType(Type interfaceType)\n\nat AutoMapper.Internal.ProxyGenerator.GetProxyType(Type interfaceType)\n\nat AutoMapper.MappingEngine.CreateObject(ResolutionContext context)"
] | [
"c#",
"generics",
"automapper-4"
] |
[
"How to edit MS Word document file properties in Android?",
"How can I edit Microsoft Word document file properties? (e.g. Title, Author, Subject, etc.)"
] | [
"android",
"ms-word"
] |
[
"How to trigger cron Job from Dot Net Core API/ C# Application?",
"I am having the following use case.\n\n\n We already have a cron job deployed on a Linux server which runs continuously.\n \n Now we need to trigger this job on-demand/ some button click event/ through API.\n\n\nFor example, we have a screen to get the export data request from the user and once user placed this request, we need to trigger the cron job which will export file and send it to the user by email. Exporting the file is a long-running process that's why we have created a job.\n\nI have one solution that is to use QuartzNet but I do not want to modify or change the job implementation. Is there any way that we can trigger this cron job from C# code?\n\nAny help will be appreciated."
] | [
"c#",
"asp.net-web-api",
"cron",
".net-core",
"crontrigger"
] |
[
"How to regularly restore/ flush Wordpress database to Snapshot?",
"I am building a demo for my WordPress plugin. I want this demo database to restore/flush to a particular snapshot/point in time ever hour or so, so that if users change settings/posts, they are restored every hour back to normal\n\nHow can I achieve this?\nI am currently using multisite for the demo website"
] | [
"wordpress",
"plugins",
"wordpress-theming",
"custom-wordpress-pages"
] |
[
"Why does pairplot show as a variable when specified as hue?",
"import pandas as pd\nimport seaborn as sns\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport os\n\nhaberman = pd.read_csv('datasets_474_966_haberman.csv', names = ['age', 'op_year', 'axil_nodes', 'surv_status'])\n\n# source of data = "https://www.kaggle.com/gilsousa/habermans-survival-data-set/kernels"\n\nhaberman.head()\n\n age op_year axil_nodes surv_status\n0 30 64 1 1\n1 30 62 3 1\n2 30 65 0 1\n3 31 59 2 1\n4 31 65 4 1\n\nsns.set_style("whitegrid");\nsns.pairplot(haberman, hue="surv_status", height=2);\nplt.show()\n\n\nWhy does it show surv_status as another variable in pair plot when it has been specified as 'Hue'?"
] | [
"python",
"python-3.x",
"matplotlib",
"seaborn"
] |
[
"How to parse through folders and files using PowerShell?",
"I am trying to construct a script that moves through specific folders and the log files in it, and filters the error codes. After that it passes them into a new file.\nI'm not really sure how to do that with for loops so I'll leave my code bellow.\nIf someone could tell me what I'm doing wrong, that would be greatly appreciated.\n$file_name = Read-Host -Prompt 'Name of the new file: '\n\n$path = 'C:\\Users\\user\\Power\\log_script\\logs'\n\nAdd-Type -AssemblyName System.IO.Compression.FileSystem\nfunction Unzip\n{\n param([string]$zipfile, [string]$outpath)\n\n [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath)\n}\n\nif ([System.IO.File]::Exists($path)) {\n Remove-Item $path\n Unzip 'C:\\Users\\user\\Power\\log_script\\logs.zip' 'C:\\Users\\user\\Power\\log_script'\n} else {\n Unzip 'C:\\Users\\user\\Power\\log_script\\logs.zip' 'C:\\Users\\user\\Power\\log_script'\n}\n\n$folder = Get-ChildItem -Path 'C:\\Users\\user\\Power\\log_script\\logs\\LogFiles'\n\n$files = foreach($logfolder in $folder) {\n $content = foreach($line in $files) {\n if ($line -match '([ ][4-5][0-5][0-9][ ])') {\n echo $line\n }\n }\n}\n\n\n$content | Out-File $file_name -Force -Encoding ascii \n\nInside the LogFiles folder are three more folders each containing log files.\nThanks"
] | [
"powershell",
"logging"
] |
[
"RubyMine quick doc on intellisense?",
"Is it possible to show quick documentation about highlighted item on the intellisense menu in RubyMine like Eclipse does for Java?"
] | [
"rubymine"
] |
[
"group and combine NSMutableArray",
"I have an NSMutableArray called matches which contains other objects called games. Games is a collection of games.title, games.players, games.dates.\n\nmy code is as follows;\n\n for (int i=0; i<json.count; i++)\n {\n games = [[Games alloc] init];\n games.title= [[json objectAtIndex:i] objectForKey:@\"titleJson\"];\n games.date= [[json objectAtIndex:i] objectForKey:@\"dateJson\"];\n NSString *players=[[json objectAtIndex:i] objectForKey:@\"playersJson\"];\n arrayPlayers= [[NSMutableArray alloc] initWithObjects:playersJson, nil];\n play.players=players; \n [matches addobject: games]\n }\n\n\nI am able to print this on uitableview well as well as players on detail view, however there are repeating values such as \n\n[Match 1, May 2013, striker 1]\n[Match 1, May 2014, striker 2]\n[Match 2, May 2014, striker 1]\n\n\nHow do I combine match 1, so that I can have this result;\n\n[Match 1, May 2013, May2014, striker 1, sticker 2]\n[Match 2, May 2014, striker 1]"
] | [
"ios",
"objective-c",
"uitableview",
"nsmutablearray"
] |
[
"FreeSwitch very slow",
"I've installed a default out of the box FreeSwitch instance but when I try to make an internal call (extension to extension) it take around 12 seconds before the call is established and I can hear the ring tone.\n\nWhen I look at the log I see the connection request almost instantly but then no activities and after 10 seconds or more the call starts and I hear the phone ringing.\nHere is the log file it it helps, please see the 10 seconds delay between 130:08:07 to 13:08:17.\n\[email protected]> 2015-09-26 13:07:41.591949 [CONSOLE] mod_voicemail.c:4091 Event Thread Started \n2015-09-26 13:08:02.171949 [NOTICE] switch_channel.c:1075 New Channel sofia/internal/[email protected] [25229804-6471-11e5-9558-f1a7477c5309] \n2015-09-26 13:08:07.331948 [INFO] mod_dialplan_xml.c:635 Processing BSmarter.CA <1001>->1000 in context default \n2015-09-26 13:08:07.331948 [CRIT] mod_dptools.c:1670 WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING \n2015-09-26 13:08:07.331948 [CRIT] mod_dptools.c:1670 Open /usr/local/freeswitch/conf/vars.xml and change the default_password. \n2015-09-26 13:08:07.331948 [CRIT] mod_dptools.c:1670 Once changed type 'reloadxml' at the console. \n2015-09-26 13:08:07.331948 [CRIT] mod_dptools.c:1670 WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING \n2015-09-26 13:08:17.371961 [INFO] switch_ivr_async.c:3932 Bound B-Leg: *1 execute_extension::dx XML features \n2015-09-26 13:08:17.371961 [INFO] switch_ivr_async.c:3932 Bound B-Leg: *2 record_session::/usr/local/freeswitch/recordings/1001.2015-09-26-13-08-17.wav \n2015-09-26 13:08:17.371961 [INFO] switch_ivr_async.c:3932 Bound B-Leg: *3 execute_extension::cf XML features \n2015-09-26 13:08:17.371961 [INFO] switch_ivr_async.c:3932 Bound B-Leg: *4 execute_extension::att_xfer XML features \n2015-09-26 13:08:17.391951 [NOTICE] switch_channel.c:1075 New Channel sofia/internal/[email protected]:63329 [2e34333a-6471-11e5-957b-f1a7477c5309] \n2015-09-26 13:08:17.571984 [NOTICE] sofia.c:6760 Ring-Ready sofia/internal/[email protected]:63329! \n2015-09-26 13:08:17.591949 [INFO] switch_ivr_originate.c:1193 Sending early media \n2015-09-26 13:08:17.591949 [INFO] switch_core_media.c:5395 Activating RTCP PORT 4003 \n2015-09-26 13:08:17.591949 [NOTICE] sofia_media.c:92 Pre-Answer sofia/internal/[email protected]! \n2015-09-26 13:08:18.631986 [NOTICE] sofia.c:7580 Hangup sofia/internal/[email protected] [CS_EXECUTE] [ORIGINATOR_CANCEL] \n\n\nAny idea what the problem might be?"
] | [
"sip",
"voip",
"freeswitch"
] |
[
"Multiple fields in fact table referring to one dimension Qlikview",
"I am new to Qlikview.\nI have a fact table Fact_Transaction with fields CheckinDate and CheckoutDate. and I have a dimensional table Dim_Time with Date_ID as PK.\n\n//-------- Start Multiple Select Statements ------\nLOAD \"Property_SK\",\n TotalNoOfDays,\n PerDayCost,\n TotalCost,\n \"Guest_FName\",\n \"Guest_LName\",\n \"Host_FName\",\n \"Host_LName\",\n CurrRecInd,\n \"User_SK_Guest\",\n \"User_SK_Host\",\n \"CheckInDate_SK\",\n \"CheckOutDate_SK\";\nSQL SELECT *\nFROM \"Airbnb database\".dbo.\"Fact_Transaction\";\n\nLOAD \"Date_ID\",\n \"Calender_Date\",\n \"Day_of_Week\",\n WeekoftheYear,\n WeekoftheMonth,\n DayoftheMonth,\n CalenderYear,\n CalenderMonth,\n CalenderQuarter,\n FiscalYear,\n FiscalQuarter,\n FiscalMonth;\nSQL SELECT *\nFROM \"Airbnb database\".dbo.\"Dim_Time\";\n\n\n//-------- End Multiple Select Statements ------\n\n\nNow i want to link the fields CheckinDate and CheckoutDate with Dim_Time on Date_ID.\nHow do i implement the same in Qlikview? Any ideas?"
] | [
"qlikview",
"dimensional-modeling"
] |
[
"iTunes connect adding glossy effect by default",
"I am submitting app to app store. In this process i have uploaded 1024 x 1024 pixel large app icon with glossy effect in itunes connect.\n\nEven though my app icon has glossy effect, itunes connect is also adding glossy to it. Because of this we can see the glossy curve twice for my app icon in \"iTunes connect\".\n\nHow to say not to apply glossy to my app icon in itunes connect.\n\nThanks\nJithendra"
] | [
"iphone",
"ios",
"app-store",
"icons",
"app-store-connect"
] |
[
"Creating a unique 8 character string from a sequential integer",
"I need to generate a unique 8 character string from a sequential integer (0, 1, 2, 3, etc).\n\nI tried hashing the int with md5/sha256/sha512 and then shortening it to 8 characters but there are quite a lot of collisions which I want to try and avoid if possible.\n\nI've looked into algorithms such as crc32 but the hash produced from that contains too many numbers for my liking.\n\nCan anybody suggest an alternative method of doing what I need?"
] | [
"hash",
"unique",
"sequential",
"hash-collision"
] |
[
"SIGHUP equivalent in powershell",
"I am interested in knowing if we can catch SIGINT, SIGHUP equivalent signals in Powershell and how to do it?\n\nI also could not find if there is anything equivalent in powershell like \"stty -echo\" in unix environment.\n\nThanks,"
] | [
"windows",
"unix",
"powershell",
"signals"
] |
[
"Angular location path for navbar, cant change color.",
"I am using Angular $location.path() to determine the path on my blog which then highlights, on the navbar, which path is being used. The highlighting works except I want to change the color of the highlighted text when the path is being used. In the CSS below I've tried using :hover and :active to make the color of the text change. When you hover over the path link in the navbar the color changes, but when you click it initally changes to the color I assigned using :active but then when you move the mouse it goes back to the default active color. Any thoughts? Thanks. \n\nHTML - NAVBAR \n\n<div ng-controller='NavbarCtrl'>\n <div class=\"navbar navbar-default\" role=\"navigation\" id='navbar'>\n <div class=\"container\">\n <div class=\"navbar-header\">\n <button type=\"button\" class=\"navbar-toggle\" data-toggle=\"collapse\" data-target=\".navbar-collapse\">\n <span class=\"sr-only\">Toggle navigation</span>\n <span class=\"icon-bar\"></span>\n <span class=\"icon-bar\"></span>\n <span class=\"icon-bar\"></span>\n </button>\n <a id='headerTitle' class=\"navbar-brand\" ng-href=\"#/\">Teewinot</a>\n </div>\n <div class=\"collapse navbar-collapse\">\n <ul class=\"nav navbar-nav\">\n <li ng-class=\"{ active: isActive('#/portfolio')}\"><a class='navSubHeadings' ng-href=\"#/portfolio\">Portfolio</a></li>\n <li ng-class=\"{ active: isActive('#/philosophy')}\"><a class='navSubHeadings' ng-href=\"#/philosophy\">Philosophy</a></li>\n <li ng-class=\"{ active: isActive('#/about')}\"><a class='navSubHeadings' ng-href=\"#/about\">About The Partners</a></li>\n <li ng-class=\"{ active: isActive('#/teewinot-blog')}\"><a class='navSubHeadings' ng-href=\"#/teewinot-blog\">Blog</a></li>\n </ul>\n </div>\n </div>\n </div>\n</div>\n\n\nCONTROLLER \n\nangular.module('Teewinot').controller('NavbarCtrl', function($scope, $location) {\n 'use strict'\n\n $scope.isActive = function (viewLocation) {\n return viewLocation === $location.path();\n };\n});\n\n\nCSS\n\n.navbar-default .navbar-nav > li > a {\n color: red;\n}\n.navbar-default .navbar-nav > li > a:hover {\n color: yellow;\n}\n.navbar-default .navbar-nav > li > a:active {\n color: yellow;\n}"
] | [
"html",
"css",
"angularjs",
"twitter-bootstrap"
] |
[
"\"No such module 'Firebase'\" // framework not found FirebaseUI",
"I previously had Firebase connected to my app with the below pods (excluding pod 'Firebase/DynamicLinks) and it was working just fine. I was using the line 'import Firebase' at the top of each view controller to import the relevant frameworks.\n\nHowever, today I went to add pod 'Firebase/DynamicLinks' and when I went to run pod install, it got stuck 'analyzing dependencies'. I read through other forums on stackoverflow to fix this issue. I ended up removing cocoapods from my project and reinstalling them. I now have reinstalled the pods, but when I open Xcode I get the message 'No such module 'Firebase'. It essentially wants me to import specific Firebase modules [import FirebaseDatabase, import FirebaseAnalytics, etc.] instead of just [import Firebase]. After updating the import on all of my view controllers, there is 1 issue remaining -> 'Framework not found FirebaseUI'. \n\nQuestions\n\n\nIs going from 'import Firebase' to 'import FirebaseDatabase, etc.' recommended or is this a step backwards?\nHow can I resolve 'Framework not found FirebaseUI'? I have the pod installed already.\n\n\nOther info that may help\n\n\nWhen running pod install, I get a warning notification: [!] [Xcodeproj] Generated duplicate UUIDs\nWhen trying to build project, I also get: ld: warning: directory not found for option '-F/Users/[myNameHere]/Library/Developer/Xcode/DerivedData/[AppName]-dtipemvgjzrgzvephbatansalrwu/Build/Products/Debug-iphonesimulator/Firebase'\nAs well as: ld: warning: directory not found for option '-F/Users/[myNameHere]/Library/Developer/Xcode/DerivedData/[AppName]-dtipemvgjzrgzvephbatansalrwu/Build/Products/Debug-iphonesimulator/FirebaseUI'\n\n\nMy podfile\n\n\npod 'FirebaseUI'\npod 'FirebaseUI/Auth'\npod 'Firebase/Core'\npod 'Firebase/Database'\npod 'Firebase/Messaging'\npod 'Firebase/Analytics'\npod 'Firebase/Storage'\npod 'Firebase/Auth'\npod 'FirebaseUI/Google'\npod 'FirebaseUI/Facebook'\npod 'Firebase/DynamicLinks' (new)"
] | [
"xcode",
"firebase",
"firebase-realtime-database",
"firebase-authentication",
"cocoapods"
] |
[
"More efficient way to use cursor loop, insert into and commit for each row (Oracle)",
"I writed something like this below (it works), but in my case for 1,5 milions rows it is not so effective as I need (it will run maybe 2 days) \nI saw something like BULK COLLECT FETCH FORALL etc. but I am not managing to rewrite my code to this without errors. Can you help me with it?\n\nThank you\n\n--It is my code for rewriting\n DECLARE\n cnt NUMBER;\n d_min NUMBER;\n d_max NUMBER;\n i NUMBER := 0;\n CURSOR ts_metatata_cur IS select * from (select rownum as rn, id_profile from ts_metadata where typ=7 and per=3600 order by id_profile) where rn between 1 and 100000;\n BEGIN\n for metadata_rec in ts_metatata_cur\n LOOP\n XTS.GET_PROFILE_AGGR(metadata_rec.id_profile, cnt, d_min, d_max); --procedure with one IN parameter and three OUT parameter cnt, d_min, d_max\n Execute immediate 'insert into TMP_PROFILES_OVERVIEW (id_profile, cnt, d_min, d_max) values (' || metadata_rec.id_profile || ', ' || cnt || ', ' || d_min || ', ' || d_max ||')';\n i := i+1;\n if (i > 10000) then\n commit;\n i := 0;\n end if;\n END LOOP;\n commit;\n END;\n\n\nIf it is necessary I give here procedure which I call:\n\n--this is procedure, which I call in my script\nCREATE OR REPLACE PROCEDURE XTS.GET_PROFILE_AGGR(id_prof IN NUMBER, cnt OUT NUMBER, d_min OUT NUMBER, d_max OUT NUMBER)\nAS \n res varchar2(61);\nBEGIN\n select cluster_table_name into res FROM XTS.TIME_SERIES TS where TS.id=id_prof;\n Execute immediate 'select nvl(count(*),0), nvl(min(time),0), nvl(max(time),0) from '|| res || ' where time_series_id=' || id_prof || ' ' into cnt, d_min, d_max;\n\nEXCEPTION\n\n when others then\n null;\n\nEND;"
] | [
"loops",
"cursor",
"commit",
"bulk-collect"
] |
[
"asp.net retrieving/persisting session object from SQL server",
"I have an application that is using SQL Server to store sessions. I have a session object in the base page wrapped as a Property that I am using through out the application. The property is retrieving the session as:\n\nDim myObj As Customer = CType(HttpContext.Current.Session(\"CustomerSession\"), Customer)\n\n\n1) Is myObj is a Reference object or is a local variable?\n\n2) Also, if I get/set properties of myObj as:\n\nDim firstName as String = myObj.FirstName\nmyObj.FirstName = \"test 12313\"\n\n\nDoes the above Get/Set FirstName makes a call to database? Or it is only Retrieving/Setting the value to local variable until the object is persisted back to the Session which means saving to the SQL Server database like this:\n\nHttpContext.Current.Session(\"CustomerSession\") = myObj"
] | [
"asp.net",
"session-state"
] |
[
"Update database from ADF Table",
"I'm coming from ASP.net and I am having trouble understanding how to simply update a database from an ADF table.\n\nHow do I commit changes to a table in a database using data entered by user in an ADF Table?"
] | [
"java",
"oracle-adf"
] |
[
"How to write Unicode output to .csv to be used in Excel?",
"I have a data set containing Chinese characters that I worked on using UTF-8 is processed. Part of the data looks like this:\n\nencod cKeyword\nUTF-8 <U+5169><U+7528> <U+5305> 27 bloide herme\nUTF-8 <U+593E> <U+62C9><U+934A> <U+9577> loewe\nUTF-8 <U+5169><U+7528> <U+5305> <U+8FF7><U+4F60> 31 lim pashli phillip\nUTF-8 <U+5305> <U+624B><U+62FF> givenchy pandora\n\n\nWhen I use write.csv(data, \"file.csv\", fileEncoding = \"UTF-8\") , I get a .csv file that when opened displays the exact same thing in Excel. But I need the Unicode to be displayed as its Chinese character.\n\nHow can I get it to write Chinese characters instead?"
] | [
"r",
"excel",
"unicode",
"utf-8"
] |
[
"Where is my index.html that I already created?",
"I have a site already. I am moving it to google hosting in firebase. I followed everything when testing it out and was able to get a database working. Just a sample one. So during that process, I set up Firebase and I used a public directory - this is where my question comes in. How do you change public directories for projects? I created three different subdirectories on my macbook, added the files for my previously created sites into public directories of their own, followed all the instructions and once deployed, I only get the google page saying everything is ok and go read the docs now."
] | [
"firebase",
"deployment",
"firebase-hosting",
"firebase-tools"
] |
[
"How to find middle of string to insert a word",
"I am trying to write a caesar cipher code, but make it harder than normal. The actual encryption is on a file that is then split into lines. For each line, I want to add a word to the beginning, middle, and end before doing the shift. So far I have this but it isn't working: \n\nfile = str(input(\"Enter input file:\" \"\"))\nmy_file = open(file, \"r\")\nfile_contents = my_file.read()\n#change all \"e\"s to \"zw\"s \n for letter in file_contents:\n if letter == \"e\":\n file_contents = file_contents.replace(letter, \"zw\")\n#add \"hokie\" to beginning, middle, and end of each line\n lines = file_contents.split('\\n')\n def middle_message(lines, position, word_to_insert):\n lines = lines[:position] + word_to_insert + lines[position:]\n return lines\n message = \"hokie\" + middle_message(lines, len(lines)/2, \"'hokie'\") + \"hokie\"\n\n\nI am getting \n\nTypeError: slice indices must be integers or None or have an __index__ method\n\n\nWhat am I doing wrong?I thought len() returns an int?"
] | [
"python-3.x",
"caesar-cipher"
] |
[
"Flattening list in python without flatten the individual strings in the list",
"This is the list i am trying to flatten.\n\npp=['a1b0c00',['00ffbcd','c2df']]\nflat_list = [item for sublist in pp for item in sublist]\nflat_list: ['a', '1', 'b', '0', 'c', '0', '0', '00ffbcd', 'c2df']\n\n\nExpected result is a single list:['a1b0c00','00ffbcd','c2df'] . \n\nHow to flatten this kind of lists in python?"
] | [
"python",
"list"
] |
[
"json_decode returns json string not an array",
"<?php\n\n$json=file_get_contents('php://input',true);\n$data = json_decode($json, true);\n\nprint_r($data);\n?>\n\n\nOutput given is {\"EventTitle\":\"Game\",\"EventBody\":\"body\",\"EventDate\":\"20 November, 2016\",\"EventType\":\"party\"} \n\nJson Data posted is:\n\n {\"EventTitle\":\"Game\",\"EventBody\":\"body\",\"EventDate\":\"20 November, 2016\",\"EventType\":\"party\"}\n\n\nWriting the json data in a variable and passing it to json_decode works but posting the same from the \"php://input\" returns a JSON data instead of associative array."
] | [
"php",
"json",
"ajax"
] |
[
"PHP MySQL insert statement not executing",
"Apologies, for the noobie question. Is there an insert limit for the number of records in a SQL statement? \n\nI'm using a web form to add rows of data. I'm not using limit in the insert statement. I checked 'max_allowed_packet' which is currently 268435456 and I don't think that's the problem.\n\nHere is a sample of my insert statement, which works fine if there are fewer than 100 rows.\n\nINSERT INTO tbl_sample (id, status_timestamp, submit_ts, status_desc, comment) VALUES ('', now(), now(), 'Submitted', '')\n\nAfter entering the form data, I am losing variables after submit and the insert never executes. I've never had this happen before and can't figure it out. Variables are there before submitting. Would appreciate suggestions."
] | [
"php",
"mysql",
"insert"
] |
[
"Reflip checkbox if error",
"I have a checkbox that has some style on it so it looks like it's flipping. When the user presses the button it flips visually on the client side but I send a request off to the server to save that change to a database. If some error happens I'd like to reflip it on the client side. I'll know if something happens because the error callback of the http.post() will be raised. The question I have is how would I flip that checkbox back to it's original state?\n\nHere is the visual I'm using for the checkbox. I'm using the flipable one:\nhttps://codepen.io/anon/pen/yXNopJ?editors=1100\n\nHere is an example of the checkbox (one for each month)\n\n<input class=\"tgl tgl-flip\" id=\"cbJan_{{ s.MFGName }}\" type=\"checkbox\" ng-model=\"s.Jan\" ng-change=\"vm.monthValueChanged(s.MFGName, 'Jan', s.Jan)\" />\n<label class=\"tgl-btn\" data-tg-off=\"OFF\" data-tg-on=\"ON\" for=\"cbJan_{{ s.MFGName }}\" ></label>\n\n\nIn my javascript code I tried to use jquery to build the id and check it but that didn't do anything. It didn't error and it didn't revert the checkbox.\n\nfunction (error, status) {\n alertify.delay(0).maxLogItems(3).closeLogOnClick(true).error('Error: ' + error.data.Message + ' <a href=\"#\" class=\"close-icon\"></a>');\n var data = JSON.parse(error.config.data);\n\n var name = 'cb' + data.Month + '_' + data.MFG;\n console.log(name);\n $(name).prop('checked', !data.Value);\n // todo: negate data.Value to get the original value and set the checkbox to that state programmatically\n }"
] | [
"javascript",
"css",
"angularjs"
] |
[
"Inserting one array into 2 tables based off of array index",
"I have one array, and it has 10+ indexes. \n\nWhat I want to do is set variable $table based on the index's, so that it will insert \n\nArray[0] - Array[9] to $table = table1\n\n\nand it would insert \n\nArray[10] - Array[14] to $table = table2\n\n\nI don't want to use an if statement because I need them both inserted\n\nI was hoping to keep this all in one query and use $table (if it's possible)\n\nHow could I achieve this?"
] | [
"php",
"arrays"
] |
[
"Focus into a newly replaced text field using jQuery",
"I am using jQuery to replace the HTML of a text field when it gets focus. My code looks like this: \n\n<div id=\"my_field\">\n <%= f.text_field :first_name, :value => \"Enter Name\" %>\n</div>\n\n\nMy jQuery used to replace the HTML inside my_field:\n\n$(\"#my_field\")\n .delegate('#my_field input', 'focus', function(e){\n if($(this).attr('type') == 'text'){\n $(this).parent().html('<input type=\"text\" value=\"\" name=\"...\" id=\"name\">');\n }\n });\n\n\nJust after replacing the HTML, the newly created text box does not get the focus. What should I do to get the cursor on the text box?"
] | [
"jquery"
] |
[
"Transferring Win32 API WndProc Key messages from one window to the other",
"I'm developing for Windows Mobile in C++, and I'm running into a problem - I added my window\nclass, and in it I the keyboard input with my WndProc implementation. The problem is\nthat I'm getting the wrong codes, and identifying keys such as the func key incorrectly, and to make it worse, the values I'm getting (the wParam of the WM_KEYDOWN message) as different values between the two phones I have here for testing - who knows what will happen on other phones.\n\nAfter playing around with it for ages, I found out that if I only create a window from the \npredefined \"EDIT\" class, I actually do get the input correctly (in terms of letters/keys). \n\nSo the problem must not be in the phone, but rather the modes of getting messages (a bit of a newbie in win32, excuse me for lack of knowledge). I tried playing around with input modes, but sending a message to my window using EM_NUMBERS and the such, always failed. \n\nSo what I would want to do (though I'm open for suggestions), is somehow just get the characters from some hidden EDIT window, and forward them to my window. (Though I still need my window to have the focus so it would react correctly to messages different from WM_KEYDOWN and the like)\n\nIs there any way to do this?\n\nThis is the 3'rd time I'm asking regarding this issue, i am eternally grateful to everyone who tried to help so far (though would be even more grateful if i had managed to solve my problem)\n\nHere are the relevant code excerpts:\n\nClass registration : \n\nWNDCLASS wc; wc.style = CS_HREDRAW | CS_VREDRAW; \nwc.lpfnWndProc = WndProc; \nwc.cbClsExtra = 0; \nwc.cbWndExtra = 0; \nwc.hInstance = hInstance; \nwc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ROADMAP)); \nwc.hCursor = 0; \nwc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); \nwc.lpszMenuName = 0; \nwc.lpszClassName = szWindowClass; \n\nwindow creation \nif (width == -1) width = CW_USEDEFAULT; \nif (height == -1) height = CW_USEDEFAULT; \nRoadMapMainWindow = CreateWindow(g_szWindowClass, szTitle, OVERLAPPEDWINDOW, \n CW_USEDEFAULT, CW_USEDEFAULT, width, height, \n NULL, NULL, g_hInst, NULL); \n\nMessageLoop \n// Main message loop: \nwhile (GetMessage(&msg, NULL, 0, 0)) \n{\n if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) \n { \n TranslateMessage(&msg); \n DispatchMessage(&msg); \n } \n} \n\n\nWNDPROC excerpt :\n\ncase WM_KEYDOWN: \n{ \n WORD Code = (WORD)wParam; \n int iRepeatTimes = (lParam & 0x0000FFFF); \n int iScanCode = (lParam & 0x00FF0000) >> 16; \n BOOL bALT_IsDown = (lParam & 0x20000000)? TRUE: FALSE; \n BOOL bAlreadyPressed= (lParam & 0x40000000)? TRUE: FALSE; \n BOOL bNowReleased = (lParam & 0x80000000)? TRUE: FALSE; \n return DefWindowProc(hWnd, message, wParam, lParam); \n}"
] | [
"windows",
"windows-mobile",
"winapi",
"keyboard",
"wndproc"
] |
[
"Opening different pages of app using cordova deeplinking",
"I am trying to apply deep-linking in my cordova android app but didn't able to make it work properly.\n\nI have used this link.\n\nUsing this i am able to get my app launched on clicking on the page with link.\n\n<a href=\"mycoolapp://\">Open my app</a>\n\n\nWhat do i have to do for providing links of other pages of app such as profile page, about us etc.\n\nI have found the following configuration json file\n\n {\n \"defaultRoute\": {\n \"class\": \"com.myorg.myapp.DefaultActivity\"\n },\n \"routes\": {\n \"reservations\": {\n \"class\": \"com.myorg.myapp.ReservationFeedActivity\"\n },\n \"reservations/:reservationId\": {\n \"class\": \"com.myorg.myapp.ReservationDetailsActivity\"\n },\n \"account/:userId\": {\n \"class\": \"com.myorg.myapp.AccountActivity\"\n }\n }\n}\n\n\nhow to define such route and use in our cordova app."
] | [
"cordova",
"deep-linking"
] |
[
"i need to filter rows by full name",
"I have a column with a full name I need to filter like this :\n\nfor example, this is my grid : \n\nName | Phone \ndan liza | 9758856526\ndana Lori | 8855656264\n\n\nif I type in the filter textbox: Lori dana I want it to find it \nI can type only dana or Lori or the full name but Lori and then dana not in the same order as in the grid"
] | [
"sql",
".net"
] |
[
"HTML Formatting a Data-Container of a SPAN in a Bootstrap Popover",
"I am using a SPAN as a popover\n:\n\n<div class=\"col-xs-2 pull-right\">\n <span class=\"icon-help tooltip-help pull-right\" data-container=\"body\" data-toggle=\"popover\" data-placement=\"bottom\" data-content=\"<b>This</b> is Photoshop's version of Lorem Ipsum...\" data-trigger=\"hover\">\n </span>\n</div>\n\n\nI would like to format the data-content string using HTML. It doesn't appear to allow formatting. Is there a data-container setting that will enable me to format the data-content with HTML?"
] | [
"html",
"twitter-bootstrap",
"string-formatting"
] |
[
"one argument default value depends on the len(otherArgument)",
"def find (myStr,end=len(mystr)):\n ....\n\n\nThe default value of end should be len(myStr),\nbut that doesn't work. The default values are evaluated when the function is defined, not when it is called. When find is defined, myStr doesn't exist yet, so you can't find its length."
] | [
"python"
] |
[
"Why is a number casted automatically to double?",
"I use spring boot for my webservice. Each method returns Map<Object, Object> because it is a general type and the methods are able to return any response, either a primitive int or complex custom object of User. Also I used Map<Object, Object> to eliminate backslash \"\\\" in JSON, instead of using String.\n\nBut I got problem with variable casting in client (Android app).\n\nNumber variables in Map are automatically casted to double (1.0, 2.0, 3.0, 5.0, ...) while it is long in server.\n\nIf I cast number to string at server, then casting at client is right e.g. 1, 2, 3, 5, ...\n\nreturn String.valueOf(u.getId())\n\n\nServer side variable:\n\nlong id;\n\n\nServer side method:\n\npublic final static String SUCCESS = \"0\";\npublic final static String NOT_FOUND = \"-1\";\n\nMap<Object, Object> m = new HashMap<>();\n\n@RequestMapping(\"/getUser\")\nMap<Object, Object> getUser(@RequestParam(value = \"phoneNumber\", defaultValue = \"\") String phoneNumber,\n @RequestParam(value = \"hash\", defaultValue = \"\") String hash) {\n\n m.clear();\n\n User user = userRepository.findByPhoneNumberAndHash(phoneNumber, hash);\n if (user != null) {\n m.put(ERROR_JSON, SUCCESS);\n m.put(VALUE_JSON, user);\n } else {\n m.put(ERROR_JSON, NOT_FOUND);\n }\n return m;\n}\n\n\nJSON:\n\n[{\"id\":1}] and [{\"id\":\"1\"}]\n\n\nAndroid code. Retrofit\n\nuserService.getUser(phoneNumber, hash).enqueue(new Callback<Map<Object, Object>>() {\n\n @Override\n public void onResponse(Call<Map<Object, Object>> call, Response<Map<Object, Object>> response) {\n Map<Object, Object> m = response.body();\n }\n @Override\n public void onFailure(Call<Map<Object, Object>> call, Throwable t) {\n t.printStackTrace();\n }\n});"
] | [
"java",
"android",
"json",
"casting"
] |
[
"How to implement element-wise 1D interpolation in Tensorflow?",
"I would like to apply 1D interploation to each element of a tensor in Tensorflow.\n\nFor example, if it is a matrix, we can use interp1d.\n\nfrom scipy.interpolate import interp1d\nq = np.array([[2, 3], [5, 6]]) # query\nx = [1, 3, 5, 7, 9] # profile x\ny = [3, 4, 5, 6, 7] # profile y\nfn = interp1d(x, y)\n# fn(q) == [[ 3.5, 4.], [5., 5.5]]\n\n\nIf we have a tensor q,\n\nq = tf.placeholder(shape=[2,2], dtype=tf.float32)\n\n\nHow can I have equivalent element-wise 1D interpolation?\nCould anyone help?"
] | [
"python",
"tensorflow",
"interpolation"
] |
[
"sem_post() fails with errno = bad file descriptor in iOS",
"I am trying the following code:\n\nif (sem_post(sem) == -1)\n{\n printf(\"syncr_release error %d\\n\", errno);\n perror(\"Error:\");\n return ERROR;\n}\n\n\nand it's giving the following output:\n\nsyncr_release error 9\nError:: Bad file descriptor\n\n\nI cannot find anything about that error code in the documentation about sem_post(). How can I solve this?"
] | [
"ios",
"synchronization",
"semaphore"
] |
[
"Babel is examining the package.json of a target module for configuration when transpiling",
"I have an issue where I want to transpile the ...spread operator of a package I'm using.\nNote that I'm using babel 6, in the context of ejected create-react-app at scripts version 1.1.5. I have a minimal reproduction for this.\nI can't find it now, but I'm using the technique suggested by some babel documentation, where I add this to my webpack config:\n {\n test: /\\.m?js$/,\n exclude: {\n test: /(node_modules)/, // Exclude libraries in node_modules ...\n not: [\n\n /@monaco-editor\\/react/\n ]\n },\n use: {\n loader: require.resolve('babel-loader'),\n options: {\n\n "plugins": [\n [require.resolve("babel-plugin-transform-object-rest-spread"), { "useBuiltIns": true }]]\n \n }\n }\n },\n\nBasically saying 'Don't transpile anything in node_modules, except for that one package, and transpile that using this plugin'.\nThe issue I have when you run this, you get this error:\n./node_modules/@monaco-editor/react/lib/es/index.js\nModule build failed: Error: Couldn't find preset "@babel/preset-env" relative to directory "/Users/djohnston/git/cra1/node_modules/@monaco-editor/react"\n at Array.map (<anonymous>)\n\n\nNote that the babel preset it is complaining about is the babel 7 @babel/preset-env preset, whereas I'm using babel 6.\nHowever - if you navigate into node_modules/@monaco-editor/react/package.json and remove the following babel property from it:\n "babel": {\n "presets": [\n "@babel/preset-env",\n "@babel/preset-react"\n ]\n },\n\nThen the code starts working.\nWhat this suggests to me is that babel is examining the package.json and decides to start using @babel/preset-env to start transpiling it, rather than using just the config I had specified in my webpack config.\nWhy is babel doing this, and is there a configuration option I can use to solve this?\nMinimum repro for this issue: https://github.com/dwjohnston/cra1-monaco/tree/eject-solve-attempt\nIssue on @monaco-editor/react I've raised about this issue (requesting that they transpile the spread operator: https://github.com/suren-atoyan/monaco-react/issues/221)"
] | [
"webpack",
"babeljs",
"babel-6"
] |
[
"Promise and subscribe",
"I have an Angular2 (ionic2) application. I have a function that request cities but I get an error that Property subscribe does not exists on this.cityService.getAllCities().\n\ncityPage.ts has a function like this:\n\ngetCities(){\n this.cityService.getAllCities()\n .subscribe(cityData => { this.cityList = cityData; },\n err => console.log(err),\n () => console.log('Complete!')\n );\n}\n\n\nmy cityService.getAllCities() function looks like this:\n\ngetAllCities(){\n\n return new Promise (resolve => {\n this.storage.ready().then(() => {\n\n this.storage.get('authData').then(authData => {\n let hdr = new Headers({'Content-Type': 'application/json', 'Authorization': 'Bearer ' +\n authData.access_token });\n let opt = new RequestOptions({ headers: hdr });\n return this.http.get(AppSettings.API_GET_CITIES).map(res => <CityModel[]> res.json(), opt);\n }).catch(() => {\n //resolve(false);\n });\n\n });\n\n });\n\n }\n\n\nEdit\n\nBased on the comment I've changed my function like this:\n\ngetAllCities(){\n\n return Observable.create(resolve => {\n this.storage.ready().then(() => {\n\n this.storage.get('authData').then(authData => {\n let hdr = new Headers({'Content-Type': 'application/json', 'Authorization': 'Bearer ' +\n authData.access_token });\n\n console.log('access_token ' + authData.access_token);\n let opt = new RequestOptions({ headers: hdr });\n return this.http.get(AppSettings.API_GET_CITIES,opt).map(res => <CityModel[]> res.json()).subscribe((result) => {\n console.log(result);\n resolve = result;\n });\n }).catch(() => {\n //resolve(false);\n });\n\n });\n\n });\n\n }\n\n\nIn my console.log(result) I receive data, but the data is never returned to my getCities() function. Also the console.log('Complete!') is not called."
] | [
"angular",
"ionic2",
"angular2-services"
] |
[
"CLion freeze when compiles",
"I'm trying to run a basic hello world on cLion, but when I run the application it's freeze complete.\nHere is a screen capture that you can see the console, and the code.\n\n\nand here the version that I am using for the compiler, the CMake and the GDB\n\nI tried to use cygwin64, but the version they have for the GDB is 7.7x, and is incompatible for cLion, they need 1.8.x"
] | [
"c++",
"windows",
"clion"
] |
[
"Trying to create dynamic textview from fragment.Getting null pointer exception error?",
"I am created a Linear layout in java code and connected to the XML code so that it will add the required number of text views in the the layout.\n\nI tested it out by adding one textview gave assigned text, size etc. It was giving me.\n\nI just been pulling my hair out over this.\n\npackage com.example.user.navigationdrawer;\n\nimport android.app.Fragment;\nimport android.os.AsyncTask;\nimport android.os.Bundle;\nimport android.support.annotation.Nullable;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.widget.EditText;\nimport android.widget.LinearLayout;\nimport android.widget.TextView;\n\nimport org.jsoup.Jsoup;\nimport org.jsoup.nodes.Document;\nimport org.jsoup.select.Elements;\n\nimport java.io.IOException;\nimport java.text.SimpleDateFormat;\nimport java.util.ArrayList;\nimport java.util.Calendar;\nimport java.util.Date;\nimport java.util.Locale;\n\npublic class FirstFragment extends Fragment {\n\n View myView;\n static final String url = \"https://website.com\";\n ArrayList<String> outPut = new ArrayList<>();\n LinearLayout diaryLayout = (LinearLayout) myView.getRootView().findViewById(R.id.connections); // compiler giving error here.\n\n //ArrayList<String> h4 = new ArrayList<>();\n\n @Nullable@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\n\n myView = inflater.inflate(R.layout.first_layout, container, false);\n\n new Ann().execute();\n return myView;\n }\n\n private class Ann extends AsyncTask<Void, Void, Void> {\n\n @Override\n protected Void doInBackground(Void...params) {\n try {\n\n // Connect to the web site\n Document document = Jsoup.connect(url).get();\n // Get the html document title\n Elements notificationWall = document.select(\"div[class=flex_column av_one_fifth flex_column_table_cell av-equal-height-column av-align-top av-zero-column-padding \" + \"avia-builder-el-11 el_after_av_one_fifth el_before_av_one_third]\"); //Connect to website.The Notification wall.\n\n Elements sectionTag = notificationWall.select(\"section\"); //Get section tag.\n Elements contentTitles = sectionTag.select(\"h4\"); // Get H4\n Elements bodyText = sectionTag.select(\"p\"); //Get P\n Elements linkTag = sectionTag.select(\"a\"); //Get links\n Elements images = sectionTag.select(\"img\"); // get image.\n\n for (int section = 0; section < sectionTag.size(); section++) {\n outPut.add(sectionTag.get(section).text());\n }\n\n } catch(IOException e) {\n e.printStackTrace();\n }\n return null;\n }\n\n @Override\n protected void onPostExecute(Void result) {\n // Set title into TextView\n //here.\n TextView dynamicTextView = new TextView(diaryLayout.getContext());\n dynamicTextView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));\n dynamicTextView.setText(\"TEST\");\n dynamicTextView.setTextSize(30);\n\n diaryLayout.addView(dynamicTextView);\n\n }\n }\n}"
] | [
"android",
"textview"
] |
[
"AngularJS: Include and scope inheritance = broken bindings?",
"In an attempt to clean up my partials I recently moved some of my global menus into seperate templates which I now include in the views which need them. As the menu (including a search bar) is global I have created a service which keeps track of the state of the menu and so on.\n\nProblem is something funny happened after I started including.\n\nHTML (Jade) of the View\n\ndiv(ng-controller='HeroUnitCtrl', ng-include src='heroTemplate')\ndiv(ng-controller='MainSearchBarCtrl', ng-include src='searchBarTemplate')\n\ndiv.row-fluid\n div.span12\n table.table.table-striped.table-bordered\n tr\n th\n a(ng-click='setOrder(\"id\")') ID#\n th\n a(ng-click='setOrder(\"client.name\")') Kunde\n th\n a(ng-click='setOrder(\"technician.name\")') Tekniker\n th\n a(ng-click='setOrder(\"createdAt\")') Opprettet\n th\n a(ng-click='setOrder(\"statusString\")') Status\n\n tr(ng-repeat='record in records | orderBy:orderProp | filter:searchBar')\n td\n a(ng-href='#/records/show/{{record.id}}') {{record.id}}\n td {{record.client.name}}\n td {{record.technician.name}}\n td {{record.createdAt}}\n td {{record.statusString}}\n\n\nHTML (Jade) searchBarTemplate\n\ninput#searchField.input-xxlarge(type='text', placeholder='placeholder', ng-change='searchBarUpdated()', ng-model='searchBar')\n\n\nNow to the bit I really don't understand,\n\nMainSearchBarCtrl\n\nfunction MainSearchBarCtrl(MainSearchBarService, $scope, $location) {\n $scope.searchBarTemplate = 'partials/main-searchbar';\n $scope.searchBar = 'Hello World!';\n\n $scope.searchBarUpdated = function() {\n console.log('Search bar update: ' + $scope.searchBar);\n MainSearchBarService.searchBarUpdated($scope.searchBar);\n } \n}\n\n\nInitially the value of searchBar is as expected \"Hello World\". However, if I append any text it still only prints \"Hello World\". Or, if I replace the text it prints undefined. So it seems the binding is broken, but I don't really see why this is happening. Worth mentioning is that this wasn't case before I moved my search bar into a separate template.\n\nAny help is greatly appreciated."
] | [
"angularjs"
] |
[
"DFA delete not acceptable characters",
"So i represent this DFA:\n\n\n\nLike this \n\ninitial(0).\nfinal(2).\narc(0,a,1).\narc(0,b,0).\narc(1,a,1).\narc(1,b,2).\narc(2,a,2).\narc(2,b,2). \n\n\nAnd i have a predicate that parse a string and returns true if is acceptable:\n\ntransition(X,[A|B]) :- arc(X,A,T),transition(T,B). \ntransition(X,[]) :- final(X).\nparse(X) :- initial(S),transition(S,X).\n\n\nNow i want to make a predicate check(X,Y) thats take a list and delete all the indexes that is not a or b. Y will be a new list that doest contain the wrong indexes.\n\neg:\n\n?-check([a,1,b,c,b],Y).\nY=[a,b,b];\nfalse\n\n\nI am not into Prolog and i tried a lot of stuff, but nothing did what i need.\nCan you give me a guideline how to make the check predicate ?"
] | [
"list",
"prolog",
"dfa"
] |
[
"Kubernetes: Hit readinessProbe only once",
"I have following setting for readiness probe:\n\n readinessProbe:\n httpGet:\n path: /xyzapi/health\n port: 8888\n initialDelaySeconds: 30\n periodSeconds: 30\n timeoutSeconds: 30\n successThreshold: 2\n failureThreshold: 5\n\n\nI want this readiness probe to be hit only once. It should fail or pass my deployment base on one try only.\n\nI did some googling, but not much of help. Any kube expert? please help."
] | [
"kubernetes",
"kubernetes-health-check"
] |
[
"Looping and comparing ViewData data with DropDownListFor using Jquery",
"Via controller, I am sending a ViewData to my View (.cshtml) with the name of several other ViewDatas. On the controller side, I am creding and sending this way:\n\nList<string> Names = new List<string>();\nNames.Add(NameForViewBag.ToString());\nViewData[\"ViewDataNames2\"] = Names;\n\n\nSo, this stores all the name of the ViewDatas that I am creating.\n\nThen, and where I am struggling, is how to work with this ViewData, using Jquery, on my .cshtml side. My idea is to \n\n\nGet each of this ViewData[\"ViewDataNames2\"] strings;\nCompare the name of each string with the name of a DropDownListFor;\nIf part of the name of the DropDownListFor matches one of the ViewData string name, I should print (eventually, I will do more work but for now I am trying to print it).\n\n\nInside my script, I am sucesufull getting the name of my DropDownListFor this way:\n\nconsole.log($(\"#SeriesTypeId option:selected\").text().replace(\" \", \"\"));\n\n\nBut this is where I am getting stuck. I wanna do some sort of foreach loop to compare this dropdown with each string of the ViewData[\"ViewDataNames2\"]. What I tried:\n\nRetrieve the ViewData like this:\n\nvar yValue = \"@ViewData[\"ViewDataNames2\"]\";\n\n\nFor my Loop I tried this way:\n\n @foreach (var myName in (List<string>)ViewData[\"ViewDataNames2\"])\n {\n <td class=\"text-center\">FormatName('@myName.NameOfViewData2', 1);</td>\n }\n\n\nI also tried this approach:\n\n // If I try this way, on the console it will give error: SyntaxError: unexpected token: keyword 'class'\n /var xValue = @ViewData[\"ViewDataNames\"];\n\n // If I try this way, on the console it will give error: SyntaxError: expected property name, got '&'\n //var check = @(Newtonsoft.Json.JsonConvert.SerializeObject(ViewData[\"ViewDataNames\"]));"
] | [
"jquery",
"razor",
"viewdata"
] |
[
"Eclipse autocomplete always adds diamond brackets",
"Eclipse Version:2018-09 (4.9.0)\nPlugin \"Code Recommenders for Java Developers\": 2.5.4.v20180909-1131\n\n\nMy Eclipse autocompletion does a little more than I like when it completes generic classes.\n\nExample:\n\nwhen(component.method(param)).thenReturn(Opt... [Press Strg+Enter])\n\n\nCurrent Behavior\n\nwhen(component.method(param)).thenReturn(Optional<Type>)\n\n\nWanted Behavior\n\nwhen(component.method(param)).thenReturn(Optional)\n\n\nI only want to complete the class name in order to call a static method (Optional.of(...)), but now I first have to delete the type and the diamond brackets.\n\nWhat I found so far\n\nThis is old but partly similar: Eclipse Auto Complete: Java 1.7 Generics Diamond\n\nThe wanted behavior in this case is an empty diamond operator when creating a new instance. This issue seems to be fixed since 2014.\n\nThe plugin Code recommenders is mentioned there and that you can specify what eclipse will offer as autocompletion at\n\nEclipse -> Window -> Preferences\n-> Java -> Editor -> Content Assist -> Advanced\n\n\nTurning of the options \"Java Proposals\" and/or \"Java Proposals (Code Recommenders)\" will stop this behavior... because it turns of absolutely all Java Code recomendations.\n\nMay the force be with you!"
] | [
"java",
"eclipse",
"autocomplete"
] |
[
"Change eclipse's default launch configuration for all C/C++ projects",
"Although there might be questions on SO that appear similar to this one I assure you that none of those have been able to answer mine.\n\nI've been figuring out a way to sort of \"automate\" (I guess you could say) my eclipse projects. To elaborate, let's say I create a C++ project in eclipse using the project creation dialog. This creates two (default) build configurations for the project (Debug and Release). \n\nThe annoyance I have run into is that when launching the project, every time I want to switch build configurations (i.e. Debug or Release) I have to manually change the path to the respective \".exe\" in the project's launch config, which is rather cumbersome. (See image below...)\n\n\n\nby replacing the \"C/C++ Application\" field with the following:\n\n${config_name:${project_name}}/${project_name}.exe\n\nThe appropriate .exe is launched based on the currently active configuration. This is exactly what I was looking for.\n\nCurrently, however, I have to set the launch config this way for every C/C++ project I make since eclipse only generates a run configuration as seen in the image (which is not what I want). My question is, how can I make eclipse automatically produce this launch configuration for every C/C++ project I make?"
] | [
"c++",
"c",
"eclipse"
] |
[
"Macro iterating and returning value",
"I came across the following macro:\n\n#define ITERATE_MACRO(type, entries, size, n) \\\n({ \\\n unsigned int __i, __n; \\\n int __ret = 0; \\\n type *__entry; \\\n for (__i = 0, __n = 0; __i < (size); \\\n __i += __entry->next_offset, __n++) { \\\n __entry = (void *)(entries) + __i; \\\n __ret = fn(__entry); \\\n if (__ret != 0) \\\n break; \\\n } \\\n __ret; \\\n})\n\n\nDoes it use GCC extensions, or is it completely ANSI C compliant?\n\nI understand what the macro is doing, but I don't understand the last line (__ret;). What exactly is it for?"
] | [
"c",
"gcc"
] |
[
"ASP.NET Core MVC consuming Internal Web API without using Http request",
"I'm using ASP.NET Core MVC and Web API and trying to consume the internal Web API (done using ApiController, prepare for future cross-platform application use), I saw an answer which doesn't need to use HttpClient or any Http Request features to get data from Web API, refer: Consuming web api controller action from mvc controller\n\nI'm trying to do the similar thing, but my auto generated Web API Controller comes with DBContext parameter, which causing me unable to follow what is mentioned from the link.\n\nBelow is what i have in my Controller which caused me unable to follow actions mentioned in the link above:\n\n private readonly MyTestDBContext _context;\n\n public MfgProductsController(MyTestDBContext context)\n {\n _context = context;\n }\n\n\nIf the \"MyTestDBContext context\" parameter supposed to remain, what should I write in my Controller in order to pass the DBContext in? \n\nOr if there's a way to remove \"MyTestDBContext context\" from the parameter, how the constructor supposed to change to?"
] | [
"asp.net-mvc",
"asp.net-core",
"model-view-controller",
"asp.net-web-api2"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.