texts
sequence
tags
sequence
[ "onesignal plugin initialization", "Hello I am facing problem during onesignal init, please help how to solve this error. I can't find anything related to onesignal in my config.xml file. I installed onesignal plugin in my ionic app as per documentation provided and it installed successfully. \n\nI am developing Ionic app on android platform." ]
[ "ionic-framework", "onesignal" ]
[ "Why my file content change when i Get it?", "I want to get a binary file who are in my asset folder : \n\nthis.http.get('../../../assets/files/CarteLoraWan.maj', { responseType: 'text' }).subscribe((content) => {\n console.log(this.stringToBytes(content));\n})\n\npublic stringToBytes(string) {\n var array = new Uint8Array(string.length);\n for (var i = 0, l = string.length; i < l; i++) {\n array[i] = string.charCodeAt(i);\n }\n return array.buffer;\n }\n\n\nThe probleme is that my file (when i open it on my computer) start by : \n\n494e4e4fece802003e6f83b0000000004c4f5241010000000000000000000000f0\n\nThe result of my function start by : \n\n494e4e4ffdfd02003e6ffdfd000000004c4f5241010000000000000000000000fd\n\nWhat is wrong in my code to transform the content file ?\n\nThanks \n\nEDIT : Add subscribe content + stringToBytes function." ]
[ "angular", "file", "http" ]
[ "Display login username after login? (PHP/JavaScript/HTML)", "I am using JavaScript/HTML and a little bit of Jquery for a test app I am making using PhoneGap/Cordova.\n\nWhat I would like to do is display the username on all pages once the user has signed in, I believe it is best to avoid using JavaScript and therefore I would ideally like to use PHP for this.\n\nCan someone give me a helping hand here and tell me how to go about this?\n\nPlease see below different sections of my code that may be of help to you.\n\nLogin Function: \n\n function loginDB(tx)\n {\n var Username = document.getElementById(\"username\").value;\n var Password = document.getElementById(\"password\").value;\n tx.executeSql(\"SELECT * FROM SoccerEarth WHERE UserName='\" + Username + \"' AND Password= '\" + Password + \"'\", [], renderList);\n\n }\n function renderList(tx,results) {\n if (results.rows.length > 0) {\n navigator.notification.alert(\"You are in!\");\n $( \":mobile-pagecontainer\" ).pagecontainer( \"change\", \"#page4\" );\n }\n else\n {\n navigator.notification.alert(\"Incorrect Password, Please try again!\");\n $( \":mobile-pagecontainer\" ).pagecontainer( \"change\", \"#page3\" );\n }\n }\n\n\nHTML page example: \n\n<div data-role=\"page\" id=\"page4\" data-theme=\"d\">\n<div data-role=\"header\">\n <a href=\"#page1\" class=\"ui-btn ui-icon-home ui-btn-icon-left\">Sign Out</a>\n <h1>SoccerMeet</h1>\n</div>\n<div data-role=\"main\" class=\"ui-content\">\n <ul data-role=\"listview\" data-inset=\"true\">\n\n <li>\n <a href=\"#page5\" data-transition=\"slide\">\n <img src=\"images/icon1.jpg\">\n <h2>Search Soccer Events</h2>\n <p>Find soccer meets near you</p>\n </a>\n </li>\n <li>\n <a href=\"#page6\" data-transition=\"slide\">\n <img src=\"images/icon2.png\">\n <h2>Create an Event</h2>\n <p>Have an event you would like to invite people to?</p>\n </a>\n </li>\n <li>\n <a href=\"#page5\" data-transition=\"slide\">\n <img src=\"images/icon4.png\">\n <h2>Help Center</h2>\n <p>FAQ's and further guidance on the app</p\n ></a>\n </li>\n <li>\n <a href=\"#page1\" data-transition=\"slide\">\n <img src=\"images/icon3.png\">\n <h2>Settings</h2>\n <p>Make changes to the app</p\n ></a>\n </li>\n <li>\n <a href=\"#page1\" data-transition=\"slide\">\n <img src=\"images/icon5.png\">\n <h2>The Team</h2>\n <p>Meet the team behind the app, the co-founders, developers etc.</p\n ></a>\n </li>\n </ul>\n <div data-role=\"footer\">\n <div data-role=\"navbar\">\n <ul>\n <li><a href=\"#page1\" data-icon=\"user\">Profile</a></li>\n <li><a href=\"#page1\" data-icon=\"location\">Find Events</a></li>\n <li><a href=\"#\" data-icon=\"calendar\">Calendar</a></li>\n <li><a href=\"#\" data-icon=\"info\">Help Center</a></li>\n <li><a href=\"#page7\" data-icon=\"camera\">Camera</a></li>\n </ul>\n </div>\n </div>\n</div>" ]
[ "javascript", "php", "jquery", "html", "cordova" ]
[ "how to chain onSizeChanged(),onMeasure(),onDraw() in custom view class", "how to chain onSizeChanged(),onMeasure(),onDraw() in custom view class so I can get parent width amd parent height, so that I can scale my image to be fit exactly into the screen...kindly give any suitable example" ]
[ "android" ]
[ "How to get all the files from Applications document directory in swift?", "I'm new to swift language and i use this code for get document directory \n\nlet paths = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true);\n\n\nit's right but when we run the project then the second cript code changed every time and my issue is that i want to store all the recorded videos to document directory and then load that all the recorded videos to my application's custom gallery to see the application's whole recorded videos but when i store that videos then it stores in different directory on every new run.\n\nso how can i fatch and load that whole recorded videos from applications document directory" ]
[ "swift", "ios8" ]
[ "spring , LocalDate , java8 ,arrayindexoutofboundsException", "LocalDate instantiation in Springbean using Application context is throwing an ArrayIndexOutofBoundsException \n\npackage app;\n\n\nimport java.time.LocalDate;\n\nimport org.springframework.context.ApplicationContext;\nimport org.springframework.context.support.ClassPathXmlApplicationContext;\n\npublic class ApplicationMain {\n\n public static void main(String[] args) {\n\n ApplicationContext beanFactory = new ClassPathXmlApplicationContext(\n \"spring.xml\");\n\n LocalDate l =(LocalDate) beanFactory.getBean(\"localDate\");\n System.out.println(l);\n\n\n }\n}\n---------------------------------------------------------\n\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE beans PUBLIC \"-//SPRING//DTD BEAN 2.0//EN\"\n \"http://www.springframework.org/dtd/spring-beans-2.0.dtd\">\n<beans>\n <bean id=\"localDate\" class=\"java.time.LocalDate\" factory-method=\"now\" />\n</beans>\n\n---------------------------------------------\n\nException in thread \"main\" java.lang.ArrayIndexOutOfBoundsException: 52222\n at org.springframework.asm.ClassReader.<init>(Unknown Source)\n at org.springframework.asm.ClassReader.<init>(Unknown Source)\n at org.springframework.asm.ClassReader.<init>(Unknown Source)\n at org.springframework.core.LocalVariableTableParameterNameDiscoverer.inspectClass(LocalVariableTableParameterNameDiscoverer.java:112)\n at org.springframework.core.LocalVariableTableParameterNameDiscoverer.getParameterNames(LocalVariableTableParameterNameDiscoverer.java:71)\n at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:443)\n at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:964)\n at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:870)\n at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:479)\n at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)\n at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)\n at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)\n at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)\n at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)\n at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:562)\n at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:871)\n at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)\n at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)\n at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)\n at app.ApplicationMain.main(ApplicationMain.java:13)\n-------" ]
[ "java", "spring", "exception", "spring-ioc" ]
[ "nodeJS https - unable to set Content-Security-Policy", "I am trying to write a simple NodeJS HTTPS web server using HTTPS and Express that has a configurable Content-Security-Policy.\n\nI try to set the Content-Security-Policy header attribute in the server response object, but always just sends \"default-src 'self'\". it appears that the HTTPS module overwrites whatever I specify.\n\nI have also tried using the helmet-csp npm package with no success either.\n\nHere's my code snippet:\n\nvar app = express();\nvar sslOptions = {\n cert: fs.readFileSync(ourPath + \"/certs/server.crt\"),\n key: fs.readFileSync(ourPath + \"/certs/server.pem\")\n};\nvar httpsServer = https.createServer(sslOptions, app);\n\nvar server = httpsServer.listen(secPort /*443*/, function () {\n console.log('HTTPS Server listening at port %d', secPort);\n});\n\n// Trap the incoming request, and preset the CSP in the response header\nserver.on('request',(req,res)=>{\n res.setHeader(\"Content-Security-policy\",\"* 'inline-eval';\");\n});" ]
[ "node.js", "https", "content-security-policy", "helmet.js" ]
[ "how do we pass webelement as an arguement to check the presence of element in DOM", "I have a Signup page POM as shown below :\n\npublic class SignUpPage extends TestBase\n{\n //Page factory Object Repository\n\n @FindBy(xpath=\"//span[contains(text(),'Log In')]\")\n WebElement logIn;\n\n @FindBy(xpath=\"//a[contains(text(),'Forgot your password?')]\")\n WebElement forgotPassword;\n\n public SignUpPage() {\n PageFactory.initElements(driver, this);\n }\n\n public LoginPage clickLogin()\n {\n WebDriverWait wait=new WebDriverWait(driver, Constants.PAGE_LOAD_TIMEOUT);\n wait.until(ExpectedConditions.presenceOfElementLocated(logIn)); // Getting error here\n logIn.click();\n wait.until(ExpectedConditions.visibilityOf(forgotPassword));\n return new LoginPage();\n }\n}\n\n\nI have a method for login and before login, I want to check if that element is present in DOM.\n\nI tried typecasting login to BY but got some error related class com.sun.proxy.$Proxy24 cannot be cast to class org.openqa.selenium.By\n\nHow do I achieve this?" ]
[ "selenium", "pom.xml", "page-factory" ]
[ "How do I connect storyboard to swiftui?", "How do I connect the storyboard to swiftUI? I have tried to go to the finder/editor/assistant but it takes me to 'NSResponder.h' Is this the right place to connect code and storyboard in a Mac OS application? If so where in said file? If not what do I do?" ]
[ "swift", "storyboard", "swiftui", "nsresponder" ]
[ "php pagination display 5pages range", "I use pagination using this tutorial.\n\nEverything is ok, but I want to change display of page numbers.\n\nThe tutorial code generates pages link as below.\n\nFor page 1 : [1] 2 3 4 > >>\nFor page 6 : << < 3 4 5 [6] 7 8 9 > >> ( 3 pages range before and after).\n\n\nWhat I want to change is showing only 5pages.\n\nFor page 1: [1] 2 3 4 5 > >>\nFor page 3: 1 2 [3] 4 5 > >>\nFor page 5: 1 2 3 4 [5] > >>\nFor page 6: << < [6] 7 8 9 10 > >>\nFor page 10: << < 6 7 8 9 [10] > >>\n\n\nI think this part needs to be changed. I tried to search other articles but I couldn't find any. what is good logic to change? Thanks.\n\n// loop to show links to range of pages around current page\nfor ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) {\n // if it's a valid page number...\n if (($x > 0) && ($x <= $totalpages)) {\n // if we're on current page...\n if ($x == $currentpage) {\n // 'highlight' it but don't make a link\n echo \" [<b>$x</b>] \";\n // if not current page...\n } else {\n // make it a link\n echo \" <a href='{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a> \";\n } // end else\n } // end if \n} // end for\n\n\nAdded:\n\nLast page also in 5 pages format\n\nFor page 1: [1] 2 3 4 5 > >>\nFor page 3: 1 2 [3] 4 5 > >>\nFor page 5: 1 2 3 4 [5] > >>\nFor page 6: << < [6] 7 8 9 10 > >>\nFor page 10: << < 6 7 8 9 [10] > >>\nFor last page 12: << < 8 9 10 11[12]\n\n\nI am trying to put 5 pages numbers as group in array, to use with in_array. No success yet.\n\nAdded:\n\nSomehow, I make it working... But current page is always in center which is not I wanted.. :(\n\n// range of num links to show\n//$range = 3;\n$range = 2;\n\n....\n\n// Added from here... \nif (($currentpage - $range) <= 1){\n $start_x = 1;\n $end_x = 5; \n}\nelse if ($currentpage >= ($totalpages - $range)){\n $start_x = $totalpages - 4;\n $end_x = $totalpages;\n}\nelse { \n $start_x = $currentpage - $range;\n $end_x = $currentpage + $range;\n}\n// Until here\n\n// loop to show links to range of pages around current page\n// for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) {\nfor ($x = $start_x; $x < ($end_x + 1); $x++) {\n // if it's a valid page number...\n if (($x > 0) && ($x <= $totalpages)) {\n // if we're on current page...\n if ($x == $currentpage) {\n // 'highlight' it but don't make a link\n echo \" [<b>$x</b>] \";\n // if not current page...\n } else {\n // make it a link\n echo \" <a href='{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a> \";\n } // end else\n } // end if \n} // end for\n\n\nResult:\n\nFor page 1: [1] 2 3 4 5 > >>\nFor page 3: 1 2 [3] 4 5 > >>\nFor page 5: << < 3 4 [5] 6 7 > >>\nFor page 6: << < 4 5 [6] 7 8 > >>\nFor page 10: << < 8 9 [10] 11 12 > >>\nFor last page 12: << < 8 9 10 11[12]\n\n\nI still want like..\n\nFor page 1: [1] 2 3 4 5 > >>\nFor page 3: 1 2 [3] 4 5 > >>\nFor page 5: 1 2 3 4 [5] > >>\nFor page 6: << < [6] 7 8 9 10 > >>\nFor page 10: << < 6 7 8 9 [10] > >>\nFor last page 12: << < 8 9 10 11[12]" ]
[ "php", "pagination" ]
[ "phone bracket validation in javascript", "I would like to make an HTML text input field that formats a phone number as the user is typing it. For instance, when you type the phone number into the input field, for example 0213858954555, the input field would automatically format the phone number to (021) 385-86111111 \n\nHere's my current code: \n\n<div class=\"form_row clearfix custom_fileds owner_name\">\n <div class=\"col-sm-4\">\n <label class=r_lbl>Mobile numbers :\n <!--<span class=\"required\">*</span>-->\n </label>\n </div>\n <div class=\"col-sm-8\">\n <input name=\"mobile_no\" id=\"mobile_no\" value=\"\" type=\"text\" class=\"textfield \" placeholder=\" \"/>\n\n </div>\n </div>" ]
[ "javascript", "html" ]
[ "javascript variables in jQuery .load() parameter", "I have to load multiple HTML parts in several divs with the class 'result' and a unique id.\n\n$('.result').load('/check.php',\n {'id': this.id, 'url':'<?=$url?>'}\n );\n\n\nA PHP script (check.php) will generate different HTML according to the parameters it gets (id & url). I want to pass this.id as a parameter, but the pages never get loaded. \n\nthis.id is a string right? If I replace this.id by say 'hello' it would work." ]
[ "javascript", "jquery", "load" ]
[ "char* or LPCWSTR in windows functions", "I followed a tutorial on creating a Windows - Window with the standard windows.h header.\n\nWNDCLASSEX wc;\n...\nec.lpszClassName = applicationName;\n\n\nAt first when compiling this, applicationName was a char* and everything was fine but now I needed to recreate the project (MSVC++ by the way) and as I was trying to compile it, it needed to be a LPCWSTR. I stumbled upon this quite a lot and would like to know, why it sometimes accepts char* and sometimes not!? Am I missing somthing in my project settings?\n\nBy the way:\nthe same thing happens with\n\nD3DX11CreateShaderResourceViewFromFile(d3ddevice, filename, NULL, NULL, &m_texture, NULL);\n\n\nwhere filename once accepted char* but not anymore..." ]
[ "c++", "windows", "char", "directx" ]
[ "What is the difference when a variable holds less bits/bytes than another variable in c++", "In the C++ tutorials I use to learn C++, they mention the data types of C++. Some of these data types are double and long double with float, and long int, long long int, and short int with int. These vary in bits, as a float contains 32 bits, double contains 64 bits, and so on with a long double. The same thing happens with the int family. My question is what do bits do and what difference is there between a variable with greater amount of bits and a variable with a smaller amount of bits?" ]
[ "c++" ]
[ "\"specialize\" a base object to become a derived object?", "Is it possible to \"specialize\" a base object to become a derived object?\n\nFor example:\n\nclass base{...\n base(...) : ... {}//both have their own constructors\n virtual void foo(){}\n};\n\nclass derived : public base{...\n void foo() override; //actual function in cpp\n...};\n\nint main(){\n base x;\n //is it possible to do something to x so\n x.foo(); // will call derived::foo()\n}" ]
[ "c++", "c++11", "object", "inheritance", "syntax" ]
[ "passing stdout in subprocess to a module that wants to read from stdin (pysam)", "I am trying to write a pipeline in python and make proper use of subprocess and not invoke shell=True. One common task in bioinformatics is to align sequences with a program such as bwa and pass the sam-formatted results on to samtools to do downstream processing. The python package pysam helps me do all of the tasks samtools does but within python.\n\nI would like to pass the results from a call to the aligner bwa to pysam without having to write to a file.\n\nPysam allows for you to open Samfile object with the input file being set to \"-\" and it will read from stdin. Similarly, bwa writes its results to stdout.\n\nThe way I have written it thus far is:\n\nbwa_call = [\"bwa\", \"mem\", \"-v\", \"1\", \"-t\", str(cores), index, fwd, rev]\nbwa = subprocess.Popen(bwa_call, stdout=subprocess.PIPE)\nsamfile = pysam.Samfile(\"-\", \"r\")\n\n\nThis seems to work, in that I don't see the stdout output from bwa but the problem is that pysam does not know when the file is finished and so just keeps waiting.\n\nIs there a way in which I can pass the stdout from bwa directly to pysam without writing to a file?" ]
[ "python", "bioinformatics" ]
[ "'gem install nokogiri' fails in `bundle install` [Mac OS X Lion]", "System: Mac OS X Lion\n\nrunning bundle install tells me to do:\ngem install nokogiri -v '1.5.2'\n\nBuilding native extensions. This could take a while...\n1ERROR: Error installing nokogiri:\n ERROR: Failed to build gem native extension.\n\n /Users/ernsheong/.rvm/rubies/ruby-1.9.3-p0/bin/ruby extconf.rb\nextconf.rb:10: Use RbConfig instead of obsolete and deprecated Config.\nchecking for libxml/parser.h... yes\nchecking for libxslt/xslt.h... yes\nchecking for libexslt/exslt.h... yes\nchecking for iconv_open() in iconv.h... no\nchecking for iconv_open() in -liconv... yes\nchecking for xmlParseDoc() in -lxml2... yes\nchecking for xsltParseStylesheetDoc() in -lxslt... yes\nchecking for exsltFuncRegister() in -lexslt... yes\nchecking for xmlHasFeature()... yes\nchecking for xmlFirstElementChild()... yes\nchecking for xmlRelaxNGSetParserStructuredErrors()... yes\nchecking for xmlRelaxNGSetParserStructuredErrors()... yes\nchecking for xmlRelaxNGSetValidStructuredErrors()... yes\nchecking for xmlSchemaSetValidStructuredErrors()... yes\nchecking for xmlSchemaSetParserStructuredErrors()... yes\ncreating Makefile\n\nmake\ncompiling html_document.c\ncompiling html_element_description.c\ncompiling html_entity_lookup.c\ncompiling html_sax_parser_context.c\ncompiling html_sax_push_parser.c\ncompiling nokogiri.c\ncompiling xml_attr.c\ncompiling xml_attribute_decl.c\ncompiling xml_cdata.c\ncompiling xml_comment.c\ncompiling xml_document.c\ncompiling xml_document_fragment.c\ncompiling xml_dtd.c\ncompiling xml_element_content.c\ncompiling xml_element_decl.c\ncompiling xml_encoding_handler.c\ncompiling xml_entity_decl.c\ncompiling xml_entity_reference.c\ncompiling xml_io.c\nxml_io.c:28:10: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]\n return safe_len;\n ~~~~~~ ^~~~~~~~\n1 warning generated.\ncompiling xml_libxml2_hacks.c\ncompiling xml_namespace.c\ncompiling xml_node.c\ncompiling xml_node_set.c\ncompiling xml_processing_instruction.c\ncompiling xml_reader.c\ncompiling xml_relax_ng.c\ncompiling xml_sax_parser.c\ncompiling xml_sax_parser_context.c\ncompiling xml_sax_push_parser.c\ncompiling xml_schema.c\ncompiling xml_syntax_error.c\ncompiling xml_text.c\ncompiling xml_xpath_context.c\nxml_xpath_context.c:189:30: warning: format string is not a string literal (potentially insecure) [-Wformat-security]\n rb_raise(rb_eRuntimeError, message);\n ^~~~~~~\n1 warning generated.\ncompiling xslt_stylesheet.c\nlinking shared-object nokogiri/nokogiri.bundle\nld: warning: directory not found for option '-L/usr/local/Cellar/libxml2/2.7.8/lib'\n\nmake install\n/usr/bin/install -c -m 0755 nokogiri.bundle /Users/ernsheong/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri\nmake: /usr/bin/install: No such file or directory\nmake: *** [/Users/ernsheong/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/nokogiri.bundle] Error 1\n\n\nGem files will remain installed in /Users/ernsheong/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2 for inspection.\nResults logged to /Users/ernsheong/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/ext/nokogiri/gem_make.out\n\n\nIt is somewhat similar but still different from OS X Lion, Attempting Nokogiri install - libxml2 is missing and An error occurred while installing nokogiri (1.5.2)\n\nThanks in advance." ]
[ "ruby-on-rails", "nokogiri" ]
[ "Where is a TelnetConsole object constructed in Scrapy?", "I'm running Scrapy from scripts, and found that logging doesn't work as expected from the point it constructs a scrapy.extensions.telnet.TelnetConsole object. Thus, I tried to find where the object is constructed from the source files, but I couldn't.\n\nWhere does Scrapy construct a scrapy.extensions.telnet.TelnetConsole object when it is run from scripts?" ]
[ "scrapy" ]
[ "Type in String on Website programmatically", "I'd wanted to know how or whether I can type in something in a textField on a website from my iPhone application code. So I want to go to a website where is one textField in the middle and there I would like to type in a specific string. How can I do that in Swift (or Objective-C - I'll figure out how it works in Swift then)? I would really much appreciate any help :)" ]
[ "html", "xcode", "swift" ]
[ "COMException was unhandled in vb.net", "I want to pass textbox1.text value to crystal report.\nForm1 has a button1 and a texbox1, when I click button1, form2 will load with crystal report on it and display data that I put on textbox1.I Already created Parameters Field Mytextbox and put into crystalreport. When i run my program is says \n\n\n COMExceptions was unhandled\n\n\nin this line \n\n Report.SetParameterValue(\"MyTextBox\", Form1.TextBox1.Text)\n\n\n\n\nVb.net code\n\nImports CrystalDecisions.CrystalReports.Engine\nImports CrystalDecisions.Shared\nPublic Class Form2\n\n Private Sub Form2_Load(sender As Object, e As EventArgs) Handles Me.Load\n Dim Report As New ReportDocument\n Report.Load(\"C:\\users\\agent_edx44\\Documents\\Visual studio 2012\\projects\\sample\\sample\\sample.rpt\")\n Report.SetParameterValue(\"MyTextBox\", Form1.TextBox1.Text)\n CrystalReportViewer1.ReportSource = Report\n CrystalReportViewer1.Refresh()\n End Sub\nEnd Class" ]
[ "vb.net", "crystal-reports" ]
[ "Are there any examples of iOS apps written using PyObjC?", "The only references I can find state that it's theoretically possible to write iOS apps using python. Does anyone know of any examples of apps that were written this way?" ]
[ "python", "ios", "pyobjc" ]
[ "Google table - get selected row", "I have a table with 3 columns: Id, name, address. I want to get the Id from the selected row in the table. Cannot get it to work... Anyone?\n\n var data = new google.visualization.arrayToDataTable(dataRaw, false);\n var table = new google.visualization.Table(document.getElementById('successTable'));\n //Css\n var cssClassNames = {\n 'headerRow': 'cssHeaderRow',\n 'tableRow': 'cssTableRow',\n 'oddTableRow': 'cssOddTableRow',\n 'selectedTableRow': 'cssSelectedTableRow',\n 'hoverTableRow': 'cssHoverTableRow',\n 'headerCell': 'cssHeaderCellSmall',\n 'tableCell': 'cssTableCellSmall',\n 'rowNumberCell': 'cssRowNumberCell'\n };\n var options = {\n\n cssClassNames: cssClassNames,\n allowHtml: true,\n title: \"Success\",\n\n };\n\n\n table.draw(data, options);\n google.visualization.events.addListener(table, 'select', selectHandler);\n\n\nI have tried:\n\n function selectHandler() {\n var sel = table.getSelection();}\n\n\nAnd other stuff, but no luck..." ]
[ "javascript", "events", "google-visualization" ]
[ "How to close connection on Mailcore2?", "I see mailcore2 has something like:\n\n[_session disconnectOperation]\n\n\nbut I do not know how to implement that.\n\nHow can I disconnect from server (close connection)?" ]
[ "objective-c", "xcode", "mailcore2" ]
[ "Change UITableViewCell background color in Interface builder", "I'm trying to avoid adding any code to my iOS project that has to do with visual set up since that's what Interface Builder is supposed to streamline for you.\n\nSo I'm trying to set up the prototype cell in IB and then just call:\n\nTableCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@\"TableCell\"];\n\n\nThe problem is if I change the background color for the cell in IB it remains white when I run my application. I can preset the color of the label fine but not the background color attribute in the Table Cell.\n\nAs an additional note, I can see that the UIView that is the backgroundView inside the cell is null after breakpointing and inspecting the variable after it's been initialized.\n\nUPDATE\nI'm getting the impression that the option for background color in IB is essentially useless? I'd rather not believe that." ]
[ "ios", "uitableview" ]
[ "Print a div content with background color in IE8", "I am trying to print a div using jquery. (window.print()). The div has got background color. When I try to print, it just wont print the background color. Is there any way around. \n\nIn IE9 and above I have managed to convert it to an image uri using html2canvas, but this doesnt work on IE8. \n\nIf there is any way around please let me know. Thanks" ]
[ "jquery", "html", "css", "canvas", "internet-explorer-8" ]
[ "Is there a CSS way to decrease the distance between a text and a horizontal rule?", "I have the following text in a rmarkdown file and would like to decrease the distance between the horizontal rule and the text. Is there a way to do it in CSS? I saw one LATEX solution, but I would like to know it in CSS.\nnoaçlijchaçlkjcn\n\n***" ]
[ "r", "r-markdown", "knitr" ]
[ "Ajax response to load div problem, scripts and css not working", "I'm loading content after an AJAX call success. It works fine and the content is passed to the page without reloading, but I'm stuck with a problem. It appears that some JS scripts are not working after the new content is placed. Is there a way of reloading all the JS scripts on AJAX response?\n\n\n\n// Slider \n$('.slider').each(function() {\n $(\"[id=\" + this.id + \"]\").slider({\n range: true,\n min: parseInt($('[id=' + this.id + '] > #min ').val(), 10),\n max: parseInt($('[id=' + this.id + '] > #max ').val(), 10),\n values: [parseInt($('[id=' + this.id + '] > #min ').val(), 10), parseInt($('[id=' + this.id + '] > #max ').val(), 10)],\n slide: function(event, ui) {\n $('[id=' + this.id + '] > #amount ').val(+ui.values[0] + ' - ' + ui.values[1]);\n },\n change: function(event, ui) {\n $.ajax({\n url: '<?php echo curPageURL(); ?>',\n dataType: 'html',\n type: 'GET',\n data: {\n min: ui.values[0],\n max: ui.values[1],\n Attr_id: $(\"[id=\" + this.id + \"]\").data('id')\n },\n success: function(data, Attr_id) {\n $('#eot_filter_menu').html($('#eot_filter_menu', data).html());\n $('#content').html($('#content', data).html());\n }\n });\n }\n });\n\n\nEDIT 1:\nif i do the ajax call and aftwards I hit the refresh button the page refreshes correctly... That is why i think that there are scripts that are not loaded on div refresh" ]
[ "javascript", "php", "jquery", "opencart2.x" ]
[ "Create List View Dynamically in Android", "I am developing an Android app. In that I want to add List view at run time on Text click.\nHere is the image of one demo.\n\n\n\nBy default there are 3 options in \"List\". When user clicks on Add new List option then new List should be added into header with Work, Play and buddies option. How can I do that?" ]
[ "android", "listview", "dynamic" ]
[ "Convert from CSV to array in Python", "I have a CSV file containing the following.\n\n0.000264,0.000352,0.000087,0.000549\n0.00016,0.000223,0.000011,0.000142\n0.008853,0.006519,0.002043,0.009819\n0.002076,0.001686,0.000959,0.003107\n0.000599,0.000133,0.000113,0.000466\n0.002264,0.001927,0.00079,0.003815\n0.002761,0.00288,0.001261,0.006851\n0.000723,0.000617,0.000794,0.002189\n\n\nI want convert the values into an array in Python and keep the same order (row and column). How I can achieve this? \n\nI have tried different functions but ended with error." ]
[ "python", "csv" ]
[ "Need to select row_number which is last", "--------------------------------------------------------------\nAnimalName AnimalType RowNumber \n---------------------------------------------------------------\nChicken Bird 1 \nDuck Bird 2 \nAlpaca Mammal 1 \nCamel Mammal 2 \nCarabao Mammal 3 \nWhale Sea 1 \nShark sea 2 \nPrawns Sea 3 \nEel sea 4 \n\n\nOUTPUT\n\nAnimalName AnimalType RowNumber \n------------------------------------------------------------ \nDuck Bird 2 \nCarabao Mammal 3 \nEel sea 4 \n\n\nQuery:\n\n SELECT t.* from (\nselect \n AnimalName,\n AnimalType,\n ROW_NUMBER() OVER(PARTITION BY AnimalType ORDER BY AnimalName) AS RowNumber\nFROM Animal A\n) t\nwhere rownumber=1\n\n\nAbove query is giving me all the 1st rownumber, If i want to select the last rownumber then what changes i have to make.\nfor eg: bird max rownumber is 2, mammal max is 3 and sea max is 4" ]
[ "sql", "sql-server-2008", "row-number" ]
[ "Page prec with leaflet", "If I go on the leaflet site, and zoom the map, then I go on another site, then I return on the leaflet site with \"page prec\" on the browser, I get the map with no zoom.\n\nHow is it possible to build a leaflet map with the same state after a page prec ?" ]
[ "leaflet" ]
[ "How to handle scenarios that \"should not happen\" in Spock?", "I am wondering what is the best practice in Spock for scenarios that are exceptional or underfined situations. One that should normally not happen.\n\nEXAMPLE:\nLet's say in our API, there are two mutually exclusive fields. When both provided the result of some calculations is undefined, which in practice boils to some arbitrary handling - like giving precedence to one of them.\nOn a higher level that will lead to exception and a proper http response eventually. But in some local (unit) area a piece of code will still be executed against both.\nWhen writing unit tests, I'd like to cover (record) also the current behaviour for this (atm) impossible corner case.\n\nSo far I just resorted to a proper comment, either in the test case name or somewhere else. But the question is: what would be the best/idiomatic Spock practice for documenting those scenarios? I mean something similar using || for separating expected arguments in where clause." ]
[ "unit-testing", "groovy", "spock" ]
[ "How to display a message when user clicks the play button in audio tag?", "I want to display a little message to the user if it hits the play button, for him to know the song is loading (because there isn't any loading indicator natively in browsers).\n\nI'm not using preload=\"auto\" or \"metadata\" because the server was getting too much traffic, and not all users are going to listen to the these audios.\n\nIt takes about 5 seconds for the audio to start playing (it seems it has to download at least 1 or 2 Mb of the audio to really start playing), so I wanted this message to be shown while the audio is loading (or the metadata is loading), or at least show this for 5 seconds after the user clicks on the play button and then hide it.\n\nHow can I do that?" ]
[ "javascript", "html" ]
[ "Create cookie containing \";\" character", "I want to create a cookie that it's value contains many \";\" characters that is usually used to separate multiple cookies in java, that's why my code isn't making his job. \nif someone can help me how to create this \"special\" cookie and make my code work?\nthanks." ]
[ "java", "cookies" ]
[ "Unable to test methods in API Explorer - Security Header in not valid - 10002 error", "I logged into Paypal and created an Api user.\n\nI now have an API signature, API username and API password.\n\nWhen I go to https://devtools-paypal.com/apiexplorer/PayPalAPIs API Explorer and enter my username, password and signature into the API cridentials field, I always get a \"Security header is not valid - 10002\" error.\n\nThe request body looks correct. There are no spaces in my credentials and all the values are correct.\n\nIf I leave the default Paypal credentials in the API Credentials fields, the transactionSearch method works as expected.\n\nHow can I test this method in the API Explorer?" ]
[ "paypal", "paypal-sandbox" ]
[ "Turbo C++ Constant Limit", "In Turbo C++ (for C language) the limit of constant values is -32768 to 32767.\n\nBut if I am initializing the value more than 32767 or less than -32768 it is showing result.\n\nSo how does the compiler gives evaluates result for values more than 32767 and less than -32768. \n\nHow does the calculation takes place for these? To what does the extended value change?" ]
[ "c" ]
[ "jquery tooltip ampersand problem", "Please, help me to escape ampersand in the tooltips.\nWhen I have <a title = \"M & M\"> then it works fine, but if there is no spaces between the words and '&' (e.g. \"M&M\") then it fails and only first part (\"M\") is shown in the tooltip. The problem is actual for IE only." ]
[ "javascript", "jquery", "tooltip" ]
[ "Git push everything to new origin", "I deleted my previous git origin, and created a new one. I did git add . and git commit. But it will update changes, how do i push everything into the new origin" ]
[ "git", "branch", "commit" ]
[ "How to install git repository on Bluehost", "I've tried pretty much anything I could find on Google, if you enter: bluehost git repository all of the results on first page and some on second, I've tried. Also I've tried this very useful tutorial but not to much help, 8 ways to share your git repository So far this is what I got. When using HTTP method I can clone/fetch/pull repository to my computer but I can't push. It requires changes to be made to httpd.conf which is not possible on Bluehost. With CGI(http://en.bainternet.info/2012/how-to-git-over-http) method in conjunction with HTTP I always get 500 server error. And when using SSH since I do have access to SSH shell I get \"The remote end hung up unexpectedly\". Most of the tutorials found on Google are at least 6 months old, for example this(http://www.calzzani.com/blog/?p=92) one offers a very good solution, but \n\n\n I was messing around with my .bashrc file all morning before finding out that bluehost no longer allows remote paths to be accessed via non-interactive logins. If only I had discovered this 4 hours sooner!\n\n\nI wasted more than 4 hours trying solutions out, can this be done?" ]
[ "git", "apache", "ssh", "bluehost" ]
[ "SSIS Multiple flat files in transaction way", "First of all, i'm very new to SSIS, so i apologize if my question is stupid!\n\nAlso, i apologize for my english, it's not my first language.\n\nSo, I would like to know what is the best way to achieve my problem.\n\nWe have some flat CSV files we would like to store in tables in our SQL Server 2012 database.\nEach file correspond to a table in this DB.\nWe need to load theses files in a specific order, because of the foreign keys.\n\nWhat we want to achieve, is that if one file can't be loaded in the database, none file are loaded. So it's a simple transaction.\n\nI know there are several possibilities:\n\n** Load all datas in a temporary database and then load this database to the other. We prefer not to use this one.\n\n** Use the transact SQL statement to begin transaction and rollback if it failed. I haven't succed to achieve that. I'm not sure we can use this in my particular case.\n\nThanks in advance for your advices." ]
[ "database", "ssis", "transactions", "sql-server-2012", "flat-file" ]
[ "If output of program1 exe is 0 then run another exe", "Im using Windows 8 and would like to have a batch file that depends of the output of the exe file will call another exe file. So the output of the exe file is 1 or 0. It is openCV file and if the program detect some object then output is 1 if not then 0. I wrote the script but it doesn't call another program in the case of output of program 1 is 0. Any help?\n\nHere the batch file\n\n @echo off\n for /f \"delims=\" %%a in ('C:\\Users\\myProgram1.exe -a -b -c') do if /i \"%%~a\"==\"errorlevel\" (call:dothis) \nif %errorlevel%==0 call:dothis\ngoto:eof\n\n:dothis\nC:\\Users\\myProgram2.exe\nexit /b 0\n\n\nI was able only to run the OpenCVprgram1.exe (first program), but never execute OpenCVprgram2.exe in case of output 0. Any help?\n\nhere the output of myProgram1 when run this script\n\n@echo off\nC:\\Users\\myProgram1.exe > result.txt\nset DATA=<result.txt\necho %DATA%\ndel result.txt\n\n\nthe output in case of not detected feature is 0 . As shown in this screenshot\n\n\nIn case of detected feature is 1 as shown in this image" ]
[ "windows", "batch-file" ]
[ "Render a Wordpress page as a variable", "Is it possible to get Wordpress to render a page and return it as HTML ?\n\nI'm thinking about a function that'd look like this :\n\n$html = render_page($id);\necho $html; // prints the page\n\n\nMy goal is to have all my sections' HTML and my corresponding logic in different files and, in my home page file, merge all the different sections in the order I wish. Thus making a one-page kind of website.\n\nBecause you define a template for a page, I don't see why it's doesn't seem to be possible to do this." ]
[ "wordpress" ]
[ "Can't kill YARN apps using ResourceManager UI after HDP 3.1.0.0-78 upgrade", "I recently upgraded HDP from 2.6.5 to 3.1.0, which runs YARN 3.1.0, and I can no longer kill applications from the YARN ResourceManager UI, using either the old (:8088/cluster/apps) or new (:8088/ui2/index.html#/yarn-apps/apps) version. I can still kill them using the shell in RHEL 7 with yarn app -kill {app-id}\n\nThese applications are submitted via Livy. Here is my workflow:\n\nOpen the ResourceManagerUI, open the Application, click Settings and choose Kill Application. Notice, the 'Logged in as:' is set to UNKNOWN_USER:\n\n\n\nConfirm that I want to kill the Application:\n\n\n\nI get the following error in the UI:\n\n\n\nOpening the console in Chrome, I see a 401 (Unauthorized) error.\n\n\n\nIf I try this from the old UI I am able to expand the error message and it shows the following:\n\n{\"RemoteException\":{\"exception\":\"AuthorizationException\",\"message\":\"Unable to obtain user name, user not authenticated\",\"javaClassName\":\"org.apache.hadoop.security.authorize.AuthorizationException\"}}\n\n\nI've read lots of posts, verified and changed several settings to try to fix this with no luck. Here are some of the settings I checked or changed as a result of my research:\n\nhadoop.http.filter.initializers=org.apache.hadoop.security.HttpCrossOriginFilterInitializer,org.apache.hadoop.http.lib.StaticUserWebFilter\nhbase.security.authentication=simple\nhbase.security.authorization=false\nyarn.nodemanager.webapp.cross-origin.enabled=true\nyarn.resourcemanager.webapp.cross-origin.enabled=true\nyarn.resourcemanager.webapp.delegation-token-auth-filter.enabled=false\nyarn.resourcemanager.webapp.ui-actions.enabled=true\nyarn.timeline-service.http-authentication.simple.anonymous.allowed=true\nyarn.timeline-service.http-authentication.type=simple\nyarn.webapp.api-service.enable=true\nyarn.webapp.ui2.enable=true\nranger.add-yarn-authorization=false\n\n\nSome of these seem way off base to me, like the hbase stuff, since I don't think that has anything to do with what I'm seeing. However, some users, in other situations, had it work for them so I wanted to try it.\n\nDigging through the documentation it seems like you need to be authenticated before you can call the API. However, that same language was in the documentation for 2.6.5, which is the version of YARN I was running before where this worked.\n\nHopefully someone can point me to documentation that more clearly outlines what I can do to resolve the issue.\n\nThanks in advance." ]
[ "hadoop", "spark-streaming", "yarn", "resourcemanager" ]
[ "Change WooCommerce shipping method label only on checkout page", "I am trying to change the label of a radio button only on the checkout page, not the cart page. The label is present on both pages.\nWhen i enter the below code it changes the label on checkout page but makes the cart page blank.\nadd_filter( 'woocommerce_cart_shipping_method_full_label', 'change_shipping_label', 10, 2 );\nfunction change_shipping_label( $full_label, $method ){\n if( ! is_checkout()) return; // Only on checkout page?\n\n $full_label = str_replace( "Custom Carrier (Enter Details Next Page)", "Custom Carrier", $full_label );\n\n return $full_label;\n}\n\n\n\n\nSomeone who knows why this is?" ]
[ "php", "wordpress", "woocommerce", "checkout", "shipping-method" ]
[ "how to determine location based on ip", "how do one determine location based on ip? I'm not asking for any product or service, but rather how to go about implementing it technically. \nThe ip to country is a rather static mapping. What about more specific locations?" ]
[ "geolocation", "ip" ]
[ "How to center image in android action bar, with action items on each side", "Yes this question has been asked before. Two times actually,\n\nActionBar - custom view with centered ImageView, Action Items on sides\n\nActionBar logo centered and Action items on sides\n\nYes I have thoroughly read both and it works except, I cant figure out how to put items to the LEFT of the image. To quote from the second link:\n\n\n Of course, make sure you also do the other necessary setups for the\n Action items in your menu xml's as well. This will be for any\n right-sided action items.\n\n\nNot much help. This doesn't apply to placement:\n\nTo take control of the left action item, you could do this in your Activity:\n\n@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case R.id.yourRightActionItem:\n //do something\n return true;\n case android.R.id.home: //<-- this will be your left action item\n // do something\n return true;\n default:\n return super.onOptionsItemSelected(item);\n }\n }\n\n\nI have tried many things, but never can get buttons to the left. Can someone clear this up for me?" ]
[ "java", "android", "xml", "android-actionbar" ]
[ "Office 365 ProPlus, does it support VBA Excel Macro?", "Office 365 ProPlus, does it support VBA Excel Macro?\nI have a lot of macro applications running in version 2013 but if I have Office 365 ProPlus installed on my PC, can I use existing macros or develop macros in this O365ProPlus?\nThanks for the answers. :)" ]
[ "excel" ]
[ "Regex match only if all words in string start with specific character", "I'm using Google Big Query sql string function REGEXP_CONTAINS(value, regexp).\n\nAttempting to write a regex for the function to return false if any words in a certain string field do not begin with +.\n\nOr alternatively, true if all words in the string field begin with +.\n\nE.g.\n'+test +list +of +words' would pass.\n'+test list +of +words' would fail.\n\n(The words can be assumed to contain only alphanumeric characters other than the starting +).\n\nI've written this regex: ^(\\+\\w+\\s?)+$ which works based on testing strings above and a few variations. \nAs far as my understanding goes, this specifies that the whole string must be made up of the repeating pattern:\n\n\nSingle '+'\nFollowed by any number of alphanumeric\nFollowed by optional space (optional as the last word has no space after it)\n\n\nI'm interested to know if this can be improved to be more robust, e.g, is there anything obvious I've missed that a more experienced regexer might spot that could cause it it to fail." ]
[ "regex" ]
[ "how to pass login credential in pentaho bi url", "Pass parameter to pentaho CDE report\n\nRequest parameter using GET method is working fine but I dont want to show credentials in URL , post method is not working\n\nrequestParameterProcessingFilter : http://jira.pentaho.com/browse/BISERVER-10708\n\n<html>\n<form action=\"http://localhost:8080/pentaho/api/repos/ublic:Company:Reporting:Test:Test2.prpt/report?&output-target=pageable%2Fpdf\" method=\"post\">\n<input type=\"hidden\" name=\"userid\" id=\"userid\" value=\"admin\"/>\n<input type=\"hidden\" name=\"password\" id=\"password\" value=\"password\"/>\n<input type=\"submit\" value=\"Submit\">\n</form>\n</html>" ]
[ "pentaho", "pentaho-cde" ]
[ "Make an action when the QLineEdit text is changed (programmatically)", "I have written the following code snippet with an QLineEdit that can be edited by pushing the button \"Add Text\".\n\nimport sys\nimport os\nfrom PyQt4 import QtGui\nfrom PyQt4 import *\n\nclass SmallGUI(QtGui.QMainWindow):\n def __init__(self):\n super(SmallGUI,self).__init__()\n self.initUI()\n\n def initUI(self):\n self.setGeometry(300,300,300,300)\n self.setWindowTitle('Sample')\n\n #One input\n self.MyInput = QtGui.QLineEdit(self)\n self.MyInput.setGeometry(88,25,110,20)\n ###############\n\n QtCore.QObject.connect(self.MyInput,QtCore.SIGNAL(\"textChanged(bool)\"),self.doSomething)\n\n #Add Text\n self.MyButton = QtGui.QPushButton(self)\n self.MyButton.setGeometry(QtCore.QRect(88,65,110,20))\n self.MyButton.setText('Add Text')\n ###############\n\n QtCore.QObject.connect(self.MyButton,QtCore.SIGNAL(\"clicked(bool)\"),self.addText)\n\n self.show()\n\n def addText(self):\n self.MyInput.setText('write something')\n\n def doSomething(self):\n print \"I'm doing something\"\n\ndef main():\n app = QtGui.QApplication(sys.argv)\n sampleForm = SmallGUI()\n sys.exit(app.exec_())\n\nif __name__ == '__main__':\n main()\n\n\nWhat I would like to do is to execute an action when the text of the QLineEdit is changed programmatically, i.e. by clicking the button 'Add Text', doing the following: \n\nQtCore.QObject.connect(self.MyInput,QtCore.SIGNAL(\"textChanged(bool)\"),self.doSomething)\n\n\nThe reason why I have used the signal \"textChanged\" is related to what the class documentation says, that is \"this signal is also emitted when the text is changed programmatically, for example, by calling setText().\"\n\nHowever this does not work cause the print statement is not executed. Can anyone help me out with that?" ]
[ "python", "pyqt" ]
[ "Combining reduntant rows in INNER JOIN MySQL", "I need to know if it's possible to combine a result of INNER JOIN, without getting duplicate values. Here is my problem:\n\nI've got 2 tables:\n\nproduct\nproduct_id, product_name, image\n\nproduct_price\nproduct_id, selling_price, mrp\n\n\nWhen I combine both the table using INNER JOIN I get the results combined as expected:\n\nFor the query:\n\nSELECT `product`.`product_id`, `product`.`product_name`, `product`.`image`,\n `product_price`.`selling_price`, `product_price`.`mrp`\nFROM `product`\nINNER JOIN product_price ON `product.product_id` = `product_price.product_id`\n\n\nAs expected this works fine and I get the result ( vardump() php ):\n\narray (size=2)\n 0 => \n array (size=6)\n 'product_id' => string '8' (length=1)\n 'product_name' => string 'product1' (length=8)\n 'image' => string '587d0e605fb52ed571f80a9e9d0d4cea.png' (length=36)\n 'selling_price' => string '100' (length=3)\n 'mrp' => string '110' (length=3)\n 1 => \n array (size=6)\n 'product_id' => string '8' (length=1)\n 'product_name' => string 'product1' (length=8)\n 'image' => string '587d0e605fb52ed571f80a9e9d0d4cea.png' (length=36)\n 'selling_price' => string '200' (length=3)\n 'mrp' => string '220' (length=3)\n\n\nNow as you can see the two rows contain repeated product_id,product_name,image columns, I was thinking if there was a way to avoid this redundancy and some what get the result like :\n\narray (size=6)\n 'product_id' => string '8' (length=1)\n 'product_name' => string 'product1' (length=8)\n 'image' => string '587d0e605fb52ed571f80a9e9d0d4cea.png' (length=36)\narray (size=2)\n0 =>\n 'selling_price' => string '100' (length=3)\n 'mrp' => string '110' (length=3)\n\n1 => \n 'selling_price' => string '200' (length=3)\n 'mrp' => string '220' (length=3)\n\n\nThanks,\n-Sreejith" ]
[ "php", "mysql", "sql" ]
[ "Operating on byte[] and int[], the same memory", "I am looking to speed up my program. Currently I have a function that does this: \n\npublic void updateBitmap(byte[] buf, int thisPacketLength, int standardOffset, int thisPacketOffset) { \n int pixelCoord = thisPacketOffset / 3 - 1;\n for (int bufCoord = standardOffset; bufCoord < thisPacketLength; bufCoord += 3) {\n pixelCoord++;\n pixelData[pixelCoord] = 0xFF << 24 | (buf[bufCoord + 2] << 16) & 0xFFFFFF | (buf[bufCoord + 1] << 8) & 0xFFFF | buf[bufCoord] & 0xFF; \n }\n} \n\n\nI basically need to copy ints in byte[] form into an int[] array. I realized that if I can treat the int[] array as a byte array then I can simply modify the bytes directly, instead of doing all this shifting, which I imagine would be faster. However, I can't figure out how to do that.\n\nWhat I want is to have int[] pixelData and byte[] pixelDataBytes both point to the memory. Just be two different \"views\" of the same bits in memory if you understand what I mean. Then I can update the individual bytes as they come in without shifting them, while still maintaining the int[] representation I need for other parts of the code. It seems like this should be possible, but I haven't figured out how to do it yet." ]
[ "java", "android", "performance" ]
[ "C++ File I/O - Program suspends", "I have a homework problem here I've been working on; here is the description:\n\n\n Write a program that reads a file consisting of students’ test scores in the\n range 0–200. It should then determine the number of students having\n scores in each of the following ranges: 0–24, 25–49, 50–74, 75–99,\n 100–124, 125–149, 150–174, and 175–200. Output the score ranges\n and the number of students. (Run your program with the following input\n data: 76, 89, 150, 135, 200, 76, 12, 100, 150, 28, 178, 189, 167, 200,\n 175, 150, 87, 99, 129, 149, 176, 200, 87, 35, 157, 189.)\n\n\nThe following is the program I have made:\n\n#include <iostream>\n#include <fstream>\nusing namespace std;\n\nint main() \n{\n//declaring variables\nifstream myfile(\"data.txt\");\ndouble grades[26];\nint i, studentNumber=0;\nint score0_24=0, score25_49=0, score50_74=0,\n score75_99=0, score100_124=0, score125_149=0,\n score150_174=0, score175_200=0;\n\ncout << score150_174 << endl;\n\n//initializing grades array\nfor(i=0; i<26; i++)\n{\n grades[i] = 0;\n cout << grades[i] << \" \";\n}\n\n//getting data from text file\n for(i=0; i<26; i++)\n {\n myfile >> grades[i];\n cin.ignore(2);\n studentNumber++;\n }\n\n myfile.close();\n\n//finding number of people for each score range\nfor(i=0; i<26; i++)\n{\n if(grades[i] <= 24)\n score0_24++;\n if(grades[i] >= 25 && grades[i] <= 49)\n score25_49++;\n if(grades[i] >= 50 && grades[i] <= 74)\n score50_74++;\n if(grades[i] >= 75 && grades[i] <= 99)\n score75_99++;\n if(grades[i] >= 100 && grades[i] <= 124)\n score100_124++;\n if(grades[i] >= 125 && grades[i] <= 149)\n score125_149++;\n if(grades[i] >= 150 && grades[i] <= 174)\n score150_174++;\n if(grades[i] >= 175 && grades[i] <= 200)\n score175_200++;\n}\n\n//outputing results\ncout << \"Number of students: \" << studentNumber << endl;\ncout << \"0-24: \" << score0_24 << endl;\ncout << \"25-49: \" << score25_49 << endl;\ncout << \"50-74: \" << score50_74 << endl;\ncout << \"75-99: \" << score75_99 << endl;\ncout << \"100-124: \" << score100_124 << endl;\ncout << \"125-149: \" << score125_149 << endl;\ncout << \"150-174: \" << score150_174 << endl;\ncout << \"175-200: \" << score175_200 << endl;\n\nreturn 0;\n}\n\n\nAnd the file I have, which is in the same folder as this project, is called:\n\n\n data.txt\n\n\nAnd contains the following:\n\n\n 76, 89, 150, 135, 200, 76, 12, 100, 150, 28, 178, 189, 167, 200, 175, 150, 87, 99, 129, 149, 176, 200, 87, 35, 157, 189\n\n\nWhen I run the program, it suspends during the for loop where I read data from the file. I've tried doing some cout statements right before and after, and it seems that is the problem.\n\nHelp would be appreciated." ]
[ "c++", "input" ]
[ "Error Using Decimal And Bool", "In my syntax below I get an error of \n\n\n An exception of type 'System.FormatException' occured in mscorlib.dll but was not handled in ther user code\n Additional Information: Input string was not in a correct format\n\n\nAnd the value being passed that throws the error is 9.7000 \nAnd this is my syntax - I have a comment above the line that throws an error\n\nprivate void calculate()\n{\n var qtys = val(dropdownlist.SelectedItem.Text) + \"|\" + val(dropdownlist1.SelectedItem.Text) + \"|\" + val(dropdownlist2.SelectedItem.Text) ;\n var totalitems = dropdownitem.SelectedItem.Text + \"|\" + dropdownitem1.SelectedItem.Text + \"|\" + dropdownitem2.SelectedItem.Text + \"|\" + dropdownitem3.SelectedItem.Text;\n var amounts = dropdownamt.SelectedItem.Value + \"|\" + dropdownamt1.SelectedItem.Value + \"|\" + dropdownamt2.SelectedItem.Value + \"|\" + dropdownamt3.SelectedItem.Value; \n var totalitems = itemInfo.Split('|');\n var qtys = qty.Split('|');\n var amounts = amount.Split('|');\n\n for (int i = 0; i < totalitems.Count(); i++)\n {\n if (totalitems[i] != \"\" && qtys[i] != \"\" && qtys[i] != \"0\")\n {\n TotalPrice += Math.Round(val(amounts[i]), 2);\n TotalTax += Math.Round(val(amounts[i]) * Convert.ToDecimal(0.07), 2);\n }\n }\n} \n\n\nprivate decimal val(string p)\n{\n if (p == null)\n return 0;\n else if (p == \"\")\n return 0;\n //The value of p = 9.7000\n return Convert.ToInt16(p);\n}" ]
[ "c#", "c#-4.0" ]
[ "unknown column in where clause, but I've already verified", "I'm struggling with this simple line of SQL... \n\nRunning it keeps giving me the error: Error: Unknown column 'comics' in 'where clause'.\n\nThis would normally be an easy fix... just go check to make sure \"comics\" exists as an entry in column \"table_name\". But I've already checked that...\n\n\n\nI don't see anything wrong with my SQL:\n\n$sql = \"SELECT ip FROM votes WHERE ip = '\".$_SERVER['REMOTE_ADDR'].\"' AND table_name = $table AND imgid = $imgid\";\n\n\nEDIT:\n\nBtw, I've already tried it with quotes:\n\n $sql = \"SELECT ip FROM votes WHERE ip = '\".$_SERVER['REMOTE_ADDR'].\"' AND table_name = '$table' AND imgid = $imgid\";\n\n\nBut that throws the error:\n\nFatal error: Call to undefined method mysqli_result::num_rows() in C:\\wamp\\www\\HTwS\\scripts\\likecounter.php on line 40\n\n\nCan anyone help?\n\nThanks!" ]
[ "php", "mysql", "mysqli" ]
[ "resuming CameraActivity causes java.lang.RuntimeException: Fail to connect to camera service", "I have an activity that uses SurfaceView and MediaRecorder to record videos. Whenever I pause to go to another activity, upon returning I get the following error/exception:\n\nCODE\n\n@Override\npublic void surfaceCreated(SurfaceHolder holder) {\n Log.v(TAG, \"surfaceCreated\");\n\n camera = Camera.open();//exception line\n\n try {\n camera.setPreviewDisplay(holder);\n camera.startPreview();\n previewRunning = true;\n } catch (IOException e) {\n Log.e(TAG, e.getMessage());\n e.printStackTrace();\n }\n\n}\n\n\nEXCEPTION:\n\njava.lang.RuntimeException: Fail to connect to camera service\n at android.hardware.Camera.<init>(Camera.java:545)\n at android.hardware.Camera.open(Camera.java:403)\n at com.mycompany.app.android.CameraActivity.surfaceCreated(CameraActivity.java:362)\n at android.view.SurfaceView.updateWindow(SurfaceView.java:606)\n at android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java:246)\n at android.view.View.dispatchWindowVisibilityChanged(View.java:9365)\n at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1289)\n at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1289)\n at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1289)\n at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1289)\n at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1289)\n at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1289)\n at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1462)\n at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1185)\n at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6591)\n at android.view.Choreographer$CallbackRecord.run(Choreographer.java:777)\n at android.view.Choreographer.doCallbacks(Choreographer.java:590)\n at android.view.Choreographer.doFrame(Choreographer.java:560)\n at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:763)\n at android.os.Handler.handleCallback(Handler.java:739)\n at android.os.Handler.dispatchMessage(Handler.java:95)\n at android.os.Looper.loop(Looper.java:145)\n at android.app.ActivityThread.main(ActivityThread.java:5837)\n at java.lang.reflect.Method.invoke(Native Method)\n at java.lang.reflect.Method.invoke(Method.java:372)\n at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)\n at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)\n15231-15238/com.mycompany.app.android W/art: Suspending all threads took: 10.396ms\n\n\nHow do I prevent the throwing of this exception?" ]
[ "android", "android-camera", "surfaceview", "android-mediarecorder" ]
[ "Calling a function by an interval in a function called by interval JS", "I want to call a function that could check an amount of time constantly using an interval within function that already works (running function) by interval.\nThat what I had did:\n\n var interval;\n var time = prompt(\"Insert amount of time in seconds\");\n function log ()\n {\n console.log (\"log() called.\");\n }\n function onrunning ()\n {\n interval = setInterval(log,time*1000);\n}\ngameloop = setInterval(onrunning,5);//This interval must not cleared\n\n\nThe first amount of time works fine but after that it's keep calling the log() function faster and faster till the browser crashes.\nI tried to do this \n\nvar interval;\nvar time = prompt(\"Insert amount of time in seconds\");\nfunction log ()\n{\nconsole.log (\"log() called.\");\n}\nfunction onrunning ()\n {\n interval = setInterval(log,time*1000);\n }\n gameloop = setInterval(onrunning,5);\n clearInterval(interval); //tried this but no differece." ]
[ "javascript", "switch-statement", "settimeout", "setinterval", "clearinterval" ]
[ "When do you exactly use consensus algorithm in distributed system?", "As i understand in distributed system we are supposed to handle network partition failure which is solved by using multiple copies of the same data.\n\nIs this the only place where we use consensus algorithm?\nWhat is the difference between 2PC/3PC/Paxos (is paxos modified version of 3PC? if so then 2PC/3PC , PC also kind of consensus algorithm?)" ]
[ "database", "distributed-computing", "distributed-database" ]
[ "one table with multiple columns vs multiple tables with one column (for data in different datatypes)", "I need to design something for the following use case:\n\nUsers can submit files with lists of key value pairs (filters) that I do not know in advance. So I cannot predefine dedicated columns for the data.\n\nNow I am considering the following solutions:\n\ntable: filters\nid, name, datatype\n\ntable: filter_strings\nid, filters_id, value\n\ntable: filter_numbers\nid, filters_id, value\n\ntable: filter_datetimes\nid, filters_id, value\n\n\nVs:\n\ntable: filters\nid, name, datatype, value_string, value_datetime, value_number\n\n\nI wonder which performs better. 1 does not require a lookup over multiple tables, but I am afraid that the increased table size will increase query times (all unused datatype columns are still there and use up space)" ]
[ "mysql", "sql" ]
[ "click event on pie chart in android", "I have used to draw pie chart using canvas..\nThere are approximately 10 arcs in pie chart..i want to perform click event on each arc.\nIs there any way to do this? or any other way?\n\nThis is my pie chart view..\n\nMyView.java\n\npackage android.piechart;\nimport java.util.ArrayList;\nimport android.content.Context;\nimport android.graphics.Canvas;\nimport android.graphics.Color;\nimport android.graphics.Paint;\nimport android.graphics.RectF;\nimport android.util.AttributeSet;\nimport android.util.Log;\nimport android.view.View;\n\npublic class MyView extends View {\n\nprivate Paint p;\nprivate int startX;\nprivate int startY;\nprivate int radius;\nprivate ArrayList<Integer> colors;\nprivate ArrayList<Integer> values;\n\npublic MyView(Context context, AttributeSet attrs) {\n super(context, attrs);\n p = new Paint();\n p.setColor(Color.BLUE);\n p.setAntiAlias(true);\n\n colors = new ArrayList<Integer>();\n values = new ArrayList<Integer>();\n\n startX = 320 / 4;\n startY = 480 / 8;\n radius = 320 / 2;\n\n colors.add(Color.GREEN);\n colors.add(Color.CYAN);\n colors.add(Color.MAGENTA);\n colors.add(Color.BLUE);\n colors.add(Color.RED);\n\n values.add(0);\n values.add(1);\n values.add(3);\n values.add(0);\n values.add(2);\n\n}\n\n@Override\nprotected void onDraw(Canvas canvas) {\n super.onDraw(canvas);\n\n Log.e(\"\", \"onDraw() is called...\");\n\n float offset = 0;\n float sum = 0;\n for (int a = 0; a < values.size(); a++) {\n sum += values.get(a);\n }\n\n float angle = (float) (360 / sum);\n\n Log.e(\"angle\", \"\" + angle);\n\n RectF rectF = new RectF();\n rectF.set(getStartX(), getStartY(), getStartX() + getRadius(),\n getStartY() + getRadius());\n\n for (int i = 0; i < values.size(); i++) {\n\n p.setColor(colors.get(i));\n\n if (i == 0) {\n canvas.drawArc(rectF, 0, values.get(i) * angle, true, p);\n } else {\n canvas.drawArc(rectF, offset, values.get(i) * angle, true, p);\n }\n\n offset += (values.get(i) * angle);\n }\n\n canvas.save();\n}\n\npublic int getStartX() {\n return startX;\n}\n\npublic void setStartX(int startX) {\n this.startX = startX;\n}\n\npublic int getStartY() {\n return startY;\n}\n\npublic void setStartY(int startY) {\n this.startY = startY;\n}\n\npublic int getRadius() {\n return radius;\n}\n\npublic void setRadius(int radius) {\n this.radius = radius;\n}\n\npublic ArrayList<Integer> getColors() {\n return colors;\n}\n\npublic void setColors(ArrayList<Integer> colors) {\n this.colors = colors;\n}\n\npublic ArrayList<Integer> getValues() {\n return values;\n}\n\npublic void setValues(ArrayList<Integer> values) {\n this.values = values;\n}\n}\n\n\nThanks in advance.." ]
[ "android", "charts", "pie-chart" ]
[ "Type of auto reference", "If I have the following two loops:\n\nstd::vector<int> v;\n\nfor(auto i : v)\n //do something with i\n\nfor(auto& j : v)\n //do something with j\n\n\nWhen I hover over i, intellisense shows it as int i (as expected). However, when I hover over j I don't get int& as I expected to, but rather\n\nstd::_Simple_types<std::_Wrap_alloc<std::_Vec_base_types<int, std::allocator<int> >::_Alloc>::value_type>::value_type &j\n\n\nWhat is this complicated definition? Is it the same as int&? If not, what is it? And if it is, why can it deduce just int for i, but not int& for j?" ]
[ "c++", "visual-studio", "c++11", "visual-studio-2013" ]
[ "How to bypass UAC check in an MFC app without modifying system registry ?", "http://msdn.microsoft.com/en-us/library/bb384691.aspx is not really helping. Visual Studio enviroment settings isn't making any difference." ]
[ "mfc", "uac" ]
[ "How to add a row and timestamp one SQL Server table based on a change in a single column of another SQL Server table", "[UPDATE: 2/20/19]\nI figured out a pretty trivial solution to solve this problem.\n\nCREATE TRIGGER TriggerClaims_History on Claims\nAFTER INSERT\nAS\nBEGIN\n SET NOCOUNT ON\n INSERT INTO Claims_History\n SELECT name, status, claim_date\n FROM Claims\n EXCEPT SELECT name, status, claim_date FROM Claims_History\nEND\nGO\n\n\nI am standing up a SQL Server database for a project I am working on. Important info: I have 3 tables - enrollment, cancel, and claims. There are files located on a server that populate these tables every day. These files are NOT deltas (i.e. each new file placed on server every day contains data from all previous files) and because of this, I am able to simply drop all tables, create tables, and then populate tables from files each day. My question is regarding my claims table - since tables will be dropped and created each night, I need a way to keep track of all the different status changes. \n\nI'm struggling to figure out the best way to go about this.\n\nI was thinking of creating a claims_history table that is NOT dropped each night. Essentially I'd want my claims_history table to be populated each time an initial new record is added to the claims table. Then I'd want to scan the claims table and add a row to the claims_history table if and only if there was a change in the status column (i.e. claims.status != claims_history.status).\n\nDay 1: \n\nselect * from claims \n\nid | name | status\n 1 | jane doe | received\n\nselect * from claims_history \n\nid | name | status | timestamp\n 1 | jane doe | received | datetime\n\n\nDay 2: \n\nselect * from claims \n\nid | name | status\n 1 | jane doe | processed\n\nselect * from claims_history \n\nid | name | status | timestamp\n 1 | jane doe | received | datetime\n 1 | jane doe | processed | datetime\n\n\nIs there a SQL script that can do this? I'd also like to automatically have the timestamp field populate in claims_history table each time a new row is added (status change). I know I could write a python script to handle something like this, but i'd like to keep it in SQL if at all possible. Thank you." ]
[ "sql", "sql-server", "tsql" ]
[ "Canceling an alarm in AlarmManager", "In my code, I create an alarm as follows:\n\nAlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);\nIntent i = new Intent(\"mypackage.START_MONITORING_SERVICE\");\nPendingIntent pi = PendingIntent.getBroadcast(context, 0, i, 0);\nlong timeForNextStart = System.currentTimeMillis() + elapsedTime;\nam.set(AlarmManager.RTC_WAKEUP, timeForNextStart, pi);\n\n\nTo cancel the alarm I do this:\n\nAlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);\nIntent intent = new Intent(\"mypackage.START_MONITORING_SERVICE\");\nPendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, intent, 0);\nam.cancel(pendingIntent);\n\n\nMy question is whether this is the correct way to cancel ALL alarms of the same intent. The docs say:\n\n\n Remove any alarms with a matching Intent. Any alarm, of any type,\n whose Intent matches this one (as defined by filterEquals(Intent)),\n will be canceled.\n\n\nI'm not exactly sure what defines a \"matching intent\". If I create multiple alarms with the above code and then peform the cancel as shown, will it cancel ALL of the alarms I created?" ]
[ "android", "alarmmanager" ]
[ "Printing Function in C++ not working", "Here is a code to print elements of an array. I am getting an error.Can anyone find out what is the problem with the code? \n\n#include <iostream>\n\n using namespace std;\n\n int print_r(char arrName,int len){\n for(int i=0;i<len;i++){\n cout<<arrName[i]<<\"\\t\"; \n }\n}\n\n int main(){\n\nint a[3];\na[0]=1;\na[1]=2;\na[2]=3;\n\nprint_r(a,3);\n\nreturn 0;\n}" ]
[ "c++", "arrays", "printing" ]
[ "AngularJS Filter for comma separated values", "I have one column in my database that has comma separated values for example this is my table:\n\n\n\nNow I want to filter it in my AngularJS Application.\n\nI can filter by name and etc, whoever column has only one single string. However, I'm having difficulty to sort it together if I have to sort it by fruits.\n\nFor example: I want to sort who like orange, who likes apple and etc. and I am stuck with this. Perhaps you can help me.\n\nHere is my code in my html file:\n\n <div class=\"col s12\">\n <div class=\"col s12 input-field\">\n <select\n ng-model=\"global.fruitFilter\"\n ng-options=\"tp.fruits as tp.fruits for tp in tables= (table | filter: {region: global.name||undefined, cluster: global.amount||undefined :true) | unique:'fruit'\"\n material-select watch>\n <option value=\"\">Select Fruit</option>\n </select>\n </div>\n </div>\n\n\nI am using ng-options here so everytime I select a fruit, my table will adapt which person has that fruit for example if I pick an Apple, my table will show only data who likes apple: (Rita, Eve).\n\nI have a button on my homepage for filtering its data on the table:\n\n\n\nHow can I achieve this? I'm only using one json file\n\n{\"id\":1,\"name\":\"Rita\",fruits\":[\"Apple\"],[\"Banana\"],[\"Guava\"],\"created_at\":\"2016-08-18 12:33:14\",\"updated_at\":\"2016-09-22 13:54:01\"}\n\n\nI am very new in AngularJS 1. Kindly help me." ]
[ "angularjs", "json" ]
[ "Setting authentication headers in AngularJS", "I am just starting to learn about frameworks, I decided to start out with AngularJS. I am creating a resource to connect to a RESTful API and I need to set a custom header. I've tried looking around but I'm just not sure what I'm doing wrong. \n\nfunction KnackCtrl($scope, $resource) {\n$scope.knack = $resource('https://api.knackhq.com/v1/objects/object_2/records'), {}, {headers: {'X-Knack-REST-API-Key': 'knack'}};\n$scope.knack.get();\n}\n\n\nAny help is appreciated. Thank you!!" ]
[ "angularjs" ]
[ "Instantiating type parameter and override method", "I want to do something similar to Scala's wildcards for pattern matching,\nso I need to instantiate an object of type T that will always return true when calling the equals() - method.\n\nI know this is kind of hacky, so if I would attempt to call any other function on this object my computer might as well burst into flames, the only thing that is important is equals().\n\nWhat I have so far:\n\npublic void match(Object toMatch, Effect0 effect) {\n val bothNull = toMatch == null && value == null;\n\n val equals = toMatch != null && toMatch.equals(value);\n\n if(bothNull || equals) {\n effect.f();\n }\n}\n\n\n\n\npublic static Object any() {\n return new Object() {\n @Override\n public boolean equals(Object o) {\n return true;\n }\n };\n}\n\n\nBut I have to somehow lift any() into type T.\n\nThe usage would look like this:\n\nmyClass.match(new MyClass(any(), \"foo\", \"bar\", any()), () -> ...);\n\n\nWhat's important is that I can't, for example, compare a Pair<String, Integer> with a Pair<Integer, String>. So that's why I need generics.\n\nIs that possible?" ]
[ "java", "generics" ]
[ "JavaScript: Escape (encode?) special characters in filenames", "I have a JavaScript that runs an external program (mediainfo) on local files. However, some of my files have characters that mess up my code.\nThe code:\n objMedInfo = JSON.parse(proc.execSync('mediainfo "' + currentfilename + '" --output=JSON').toString());\n\nThe problem is that if currentfilename contains a quotation mark or some other extended characters, the command fails.\nIs there a way to escape or encode currentfilename to prevent this? It's not feasible to rename all the potential files." ]
[ "character-encoding", "javascript" ]
[ "Attempting to copy MyClass(QObject) throws a RuntimeError in Python", "I am working on PyQt5 application and trying to understand why I can't use copy.copy on a class which is inherited from QObject\nHere is the header of my Switcher class:\n\nclass Switcher(QObject):\n def __init__(self):\n QObject.__init__(self)\n self.modified = True\n self.integer_sliders = []\n self.float_sliders = []\n self.checkboxes = []\n self.drop_downs = []\n(...)\n\n\nI need to create two copies of Switcher class and in order to do so I use copy:\n\nswitch = Switcher()\nnew_switch = copy.copy(switch)\n\n\nHowever this throws a RuntimeError:\n\nRuntimeError: super-class __init__() of type Switcher was never called\n\n\nWhy is this happening and is it possible to copy a Switcher object?" ]
[ "python", "pyqt", "pyqt5" ]
[ "Show me the selected toggle button in Angular 4 and the other slice", "I have made toggle buttons like component in Angular so I can use everywhere I need, but I am trying to solve something and I need your help.\n\nI need only to show me the selected toggle button so the other toggle button don't show.\nWhen I click in the selected toggle button then show me the other toggle buttons for example like expand and collapse, if I click the selected toggle button than show me the everything what is in that array.\nThe selected toggle button comes from another component with ngModel which tells by the component which is selected\nI have tried slice but didn't work.\n\nThis is the component of toggle button.\n\n<div id=\"toggle-button\" fxLayout=\"row\" fxLayoutAlign=\"start end\">\n <label [style.width]=\"labelWidth\" [style.paddingRight]=\"label.length > 0 ? '10px' : '0'\">\n {{label}}\n </label>\n <div *ngFor=\"let option of options | slice:0:1; let first = first; let last = last\" [ngClass]=\"{'first': first, 'last': last, 'selected': option.value === value, 'divider' : !last, 'clickable': !readonly, 'not-selectable': readonly}\"\n [style.width]=\"optionWidth\" (click)=\"select(option.value)\" fxLayout=\"row\" fxLayoutAlign=\"center center\">\n <span (click)=\"options.length\">{{option.text}}</span>\n\n </div>\n</div>\n\nexport class ToggleButtonComponent implements OnInit, ControlValueAccessor {\n @Input() options: ToggleOption[] = []\n @Input() label = \"\"\n @Input() value: any\n @Input() labelWidth = \"\"\n @Input() optionWidth = \"\"\n @Input() readonly = false\n @Output() toggle = new EventEmitter<any>()\n onChangeCallback: (selected: any) => void = () => { }\n onTouchedCallback: (selected: any) => void = () => { }\n constructor() {\n }\n\n ngOnInit() {\n console.log(this.value)\n\n }\n\n writeValue(selected: any): void {\n this.value = selected\n }\n\n registerOnChange(callback: (selected: any) => void): void {\n this.onChangeCallback = callback\n }\n\n registerOnTouched(callback: (selected: any) => void): void {\n this.onTouchedCallback = callback\n }\n\n select(selected: any) {\n if (!this.readonly) {\n this.value = selected\n this.onChangeCallback(selected)\n this.onTouchedCallback(selected)\n this.toggle.emit(selected)\n }\n }\n}\n\nexport interface ToggleOption {\n text: string\n value: any\n}\n\n\nAnd this is another component where I declare the toggle buttons.\n\nreadonly categoryOptions: ToggleOption[] = [\n { text: \"BUS\", value: 0 },\n { text: \"BOS\", value: 1 },\n { text: \"BIS\", value: 2 }\n]\n<app-toggle-button label=\"Category\" labelWidth=\"75px\" [options]=\"categoryOptions\" [(ngModel)]=\"valueItem.category\"></app-toggle-button>" ]
[ "html", "angular", "typescript" ]
[ "Google Apps Script to access Google Sheet in a folder via Google Apps Script", "Suppose I have a drive with the following structure:\n\nUnder My drive:\n\n\ngoogle_sheet_E\nMain_Folder\n\n\nFolder_A\nFolder_B\n\n\ngoogle_sheet_C (in google sheet format)\nMS_excel_D.xls (in excel format, upload to drive directly)\n\n\n\n\nNote: google_sheet_E is located on the top layer of the drive, whereas, the C, and D, are located few levels below.\n\nI would like to reference some data from google_sheet_C and MS_excel_D.xls to google_sheet_E.\n\nIn Google Apps Script, my current method is to get by ID, but I find this method inconvenient, since I have to get ID every time, therefore I am planning to use the file name instead. Is there any method/function to access a sheet similar to the path system in Windows? (i.e. Traverse the folders.)\n\nAnother question: Is there any good method to let users share from their drive to the spreadsheet automatically under a specific path?" ]
[ "google-apps-script", "google-sheets" ]
[ "How do I avoid deadloop if a user enters a char into a scanf looking for an interger?", "I've been searching the web for a while now, without finding a satisfying answer. Now I'll try my luck here. So here it goes:\n\nIn my program I want a user to enter a number, via the terminal, for this I use scanf(). Rather simple, I know... and I've got that working. But I also want to make it \"idiot-proof\". Thus I'm trying to make sure that if the user enteres a character and not an interger, the program won't deadloop.\nAs it is now, if a character is entered the program will deadloop.\n\nMy code is:\n\nlong fs = 0;\nprintf(\"Enter the samplefrequency(in Hz) and press 'ENTER': \");\nwhile(fs<=0)\n{\n scanf(\" %li\", &fs);\n\n if(fs <= 0)\n {\n printf(\"\\nThe samplefrequency must be above 0 Hz. Please enter again: \");\n }\n}\n\n\nThis will keep printing the line in the if-statement.\nHow do I avoid this?" ]
[ "c" ]
[ "Update WSS 3.0 Event Handler", "I am implementing an event handler in a WSS 3.0 environment. I've created a VS project with a new class that inherits from SPEventItemReceiver. I built my project and manually deployed this assembly to the GAC via copy/paste. I use a simple console program to add the event handlers to my SharePoint list. The first iteration of my event handler code worked as expected.\n\nFor my next step, I updated the code in my event handler to change the functionality. I've tried removing the assembly from the GAC and re-adding it. That didn't help. I've unregistered and re-registered my event handlers for the list and that did no good either. Even though the code is different and I've re-deployed the assembly - I'm still getting the old (original) functionality.\n\nAn example of this change: Originally I was assigning a text field with a hard coded value. In the updated code that assignment still exists but I've changed the hard coded value I'm assigning. Now, when the event handler fires - it's still assigning the original value.\n\nCan anyone help me understand why my updated code isn't working and how I would go about deploying my updated event handler code?\n\nThanks!!!" ]
[ "c#", "sharepoint" ]
[ "Laravel passport: increase \"laravel_token\" cookie expire time", "I have Laravel Passport implemented in my project and it is everything working well except the cookie expiration time where the tokens are being stored (that is just 1 hour).\n\nMy project consists in a backend Laravel 5.8 api (with Laravel Passport) that serves a front SPA app (Vue).\n\nUsers from my app can login successfully using a page with a Vue component that makes a POST request with the user credentials and, if the login is successfully done, users are redirected to a new URL (app home) - this redirection is a GET request that creates the \"laravel_token\" cookie - created by the CreateFreshApiToken middleware.\n\nFrom now on, users can go everywhere inside the app and all data needed from the app components' is obtained through ajax calls (Laravel will note the presence of the cookie \"laravel_token\" in these ajax calls and will identify the logged in user using the JWT present in that cookie).\n\nMy problem is:\n\nThe \"laravel_token\" cookie that was created when user logged in was created with a lifetime of just 1 hour. Because this is a SPA, this cookie never gets updated (exchanged by a new one, with a new hour lifetime)... so, after 1 hour, when a new ajax request needs to be done to the backend Laravel server, it will receive an Unauthenticated response - that makes sense because \"laravel_token\" cookie is outdated.\n\nHow do you deal with this problem?\n\nI know that i can refresh this cookie by perfoming a full refresh/reload of the page before this cookie expire but this is not a good solution in terms of user experience.\n\nI can't make an ajax call to refresh this cookie because this is a SPA and i don't have the client_id and it's secret from client side... and also because not only this cookie is httponly but also it is encrypted by Laravel - so, i can't exchange it by a new one using JS.\n\nIs the only solution increase the lifetime of this cookie (from 1 hour to.... 1 year, for example)? Do you see any problem with this? And where can i set this cookie expiration time? Does i need to extend the ApiTokenCookieFactory class?\n\nI would like user to be logged in until he deliberately performs a logout request or the access_token expires (that, in my case that i am using Laravel Passport defaults, is a long-lived token of 1 year).\n\nI would appreciate if someone could help me with this problem.\n\nIf you see something that i am not doing the correct way, i also would appreciate your comments with suggestions.\n\nThank you very much!" ]
[ "laravel", "laravel-passport" ]
[ "How to build multiple cards with photo and name(CardHeaders) vertically to show multiple user details?", "I am creating gmail addon, i have show list of users after making some http call. Possible way was to make using CardHeader in google script. Can someone help me how can i create multiple cards in single page and show my details as list? Sample Code. How can i load multiple cards in place of newCard in my code?\n\nfunction getRedirect(pageId,title){\n var redirectform = CardService.newAction()\n .setFunctionName('redirectCallback')\n .setParameters({page:pageId.toString()});\n var redirectButton = CardService.newTextButton()\n .setText(title)\n .setOnClickAction(redirectform);\n return redirectButton;\n}\nfunction redirectCallback(e){\n var pageId = parseInt(e.parameters.page);\n var newCard,redirectBtn;\n if(pageId == 1){\n redirectBtn = getRedirect(2,\"Next\");\n newCard = CardService.newCardBuilder()\n .setHeader(CardService.newCardHeader()\n .setTitle(\"Page2\"))\n .addSection(CardService.newCardSection()\n .addWidget(CardService.newButtonSet()\n .addButton(redirectBtn))).build()\n }\n var navigate = CardService.newNavigation().pushCard(newCard);\n return CardService.newActionResponseBuilder()\n .setNavigation(navigate).build() \n }\n\n function buildAddOn() {\n var header = getHeaderSection();\n var body = getBody();\n var submitForm = CardService.newAction()\n .setFunctionName('openLinkCallback');\n var submitButton = CardService.newTextButton()\n .setText('Open Greatwork')\n .setOnClickAction(submitForm);\n var redirectBtn = getRedirectBtn(1,\"Next\");\n var mainCard = CardService\n .newCardBuilder()\n .addSection(CardService.newCardSection()\n .addWidget(CardService.newButtonSet().addButton(submitButton)))\n .addSection(CardService.newCardSection() \n .addWidget(CardService.newButtonSet().addButton(redirectBtn)))\n .build();\n return mainCard;\n}" ]
[ "google-apps-script", "gmail-addons" ]
[ "PHP run once and insert sql twice", "My code is meant to take in a brief text and title from users and it is adding them into the database twice and can't understand why.\n\n <?php (\"session.php\"); ?>\n <?php require_once(\"connect.php\"); ?>\n <?php include(\"header.php\"); ?> \n\n <?php \n\n\n //if the submit button is pressed then the INSERT SQL statement is submitted to database\n //if (isset($_POST['testimonial_title']) && isset($_SESSION['testimonial_text'])) {\n\n if(isset($_POST[\"submit_button\"])){\n\n\n\n $title=$_POST[\"testimonial_title\"];\n $text=$_POST[\"testimonial_text\"];\n\n\n\n //create the sql statement \n $sql=\n \"INSERT INTO testimonials \n (testimonial_title, testimonial_text, student_ID)\n VALUES(\n '$title',\n '$text',\n 1);\"; //for simplicity the student_ID is kept the same\n\n\n $result = mysqli_query($con,$sql);\n if(!mysqli_query($con, $sql))\n {\n echo \"Journal entry was not entered successfully\";\n }\n else{\n echo \"Journal entry was entered successfully\";\n }\n\n mysqli_close($con);\n }\n\n ?>\n\n\n <html>\n <body>\n\n <!-- Page Content -->\n <h1 class=\"page-header\">Learning Journals\n <small>- Admin</small>\n </h1>\n\n <h3>Update Learning Journals Plans</h3>\n\n <form name=\"membership_form\" action= \"<?php echo htmlspecialchars($_SERVER[\"PHP_SELF\"]);?>\" id=\"contactForm\" method=\"post\">\n\n <label>Learning Journals Title:</label>\n <br>\n <input type=\"text\" name=\"testimonial_title\">\n <br>\n\n <label>Learning Journal:</label>\n <br>\n <textarea rows=\"10\" cols=\"100\" name=\"testimonial_text\" maxlength=\"999\" style=\"resize:none\"></textarea>\n <br>\n <button type=\"submit\" name =\"submit_button\" class=\"btn btn-primary\">Update</button>\n </form>\n </body>\n </html>\n\n\nWhat should happen is:\n\nUser enters title \"xyz\"\n\nUser enters text \"xyz\"\n\nDatabase takes in:\n\nID | title | text | student_ID| \n\n1 | xyz | xyz | 1 | \n\n\nBut instead it the database looks like this:\n\nID | title | text | student_ID| \n\n1 | xyz | xyz | 1 | \n\n2 | xyz | xyz | 1 |" ]
[ "php", "html", "mysql", "sql", "forms" ]
[ "Extended menu on a different domain", "My client has a Drupal 6 site.\n\nThey are now adding another domain to the same site, but the different domain is going to be used by another branch of their company. Therefore, they need some additional content, specific to the other branch's geographic area, in the menu, as well as a slightly different theme on the front page.\n\nSo, to make it clearer: domain1.com and domain2.com both point to the very same installation of Drupal on one server, but not 100% of the content is shared between them.\n\nI don't usually work with Drupal, so I'm not sure how to tackle this. How would you approach the issue? Is there a way to add or remove a single menu item depending on the domain that is being used? Is there a way to use a different view in the same scenario?\n\nBoth contrib modules and programmatic solutions will be appreciated." ]
[ "php", "drupal", "drupal-6", "cross-domain" ]
[ "Using airflow to uploade data on S3", "I tried to upload a dataframe containing informations about apple stock (using their api) as csv on s3 using airflow and pythonoperator. The script is below. When launched the dags appears as success but nothing happen at s3 level.\nI created 3 tasks one for gathering data another for creating s3 bucket and the last for uploading dataframe to S3 as csv file. The script works well in pure python.\nimport urllib\nfrom datetime import datetime\nfrom datetime import timedelta\nimport pandas\nfrom urllib.request import urlopen\nfrom io import BytesIO\n\n\nimport logging\nimport boto3\nfrom botocore.exceptions import ClientError\n\nfrom airflow import DAG\nfrom airflow.operators.bash_operator import BashOperator\nfrom airflow.operators.python import PythonOperator, PythonVirtualenvOperator\nfrom airflow.utils.dates import days_ago\nfrom airflow.providers.amazon.aws.hooks.s3 import S3Hook\ns3_hook = S3Hook(aws_conn_id="my_conn_S3", region_name="eu-central-1")\n\nbuket_name = "BUCKET_NAME"\n\ndefault_args = {\n 'owner': 'admin',\n 'depends_on_past': False,\n 'start_date': datetime.now(),\n 'email': [email protected]\n 'email_on_failure': True,\n 'email_on_retry': False,\n 'retries': 2,\n 'retry_delay': timedelta(minutes=0.5),\n}\ndag = DAG(\n dag_id='apple_finance',\n default_args=default_args,\n schedule_interval=None,\n start_date=days_ago(2),\n tags=['apple-finance'],\n)\n\n\ndef get_apple_data():\n api_key = "MY_API_KEY"\n #get quotes\n\n quotes_url = f"https://financialmodelingprep.com/api/v3/profile/AAPL?apikey={api_key}"\n response = urlopen(quotes_url)\n quotes_data_ = response.read().decode("utf-8")\n quotes_data = json.loads(quotes_data_)\n pro_data= dict({key: val for key ,val in quotes_data[0].items() if key in ['companyName','price']})\n\n #gets_ratings\n rates_url = f"https://financialmodelingprep.com/api/v3/rating/AAPL?apikey={api_key}"\n response_r = urlopen(rates_url)\n rates_data_ = response_r.read().decode("utf-8")\n rates_data = json.loads(rates_data_)[0]\n\n rates_data = dict({key:val for key, val in rates_data.items() if key in ['rating','ratingScore', 'ratingRecommendation']}) \n \n pro_data.update(rates_data)\n\n df = pandas.DataFrame(pro_data , index = [0])\n df['timestamp'] = datetime.now().isoformat()\n #df.to_csv("apple_data.csv")\n return df\n\n\nt1 = PythonOperator(\n task_id="get-APPL-data",\n python_callable = get_apple_data,\n dag=dag\n)\n\ndef create_bucket():\n region = "eu-central-1"\n logger = logging.getLogger("airflow.task")\n try:\n\n\n s3_hook.create_bucket(bucket_name = bucket_name, region_name= region)\n\n #message = \n logger.info("--------BUCKET CREATED---------")\n \n except ClientError as e:\n\n logger.error(e)\n logger.info("----------CAN'T CREATE BUCKET------------")\n \n return False\n return True\n\n\nt2 = PythonOperator(\n task_id="create-s3-bucket",\n python_callable=create_bucket,\n dag=dag\n)\n\ndef sendDataToS3(**kwargs):\n\n ti = kwargs['ti']\n\n apple_df = ti.xcom_pull(task_ids="get-APPL-data")\n \n region = "eu-central-1"\n #print(apple_df)\n csv_buffer = BytesIO\n apple_df.to_csv(csv_buffer)\n\n s3_hook._upload_file_obj(file_obj = csv_buffer.getvalue(), key = f"apple_data_{datetime.now()}.csv",\n bucket_name = bucket_name)\n #s3_resource.Object(bucket, f"apple_data_{datetime.now()}.csv").put(Body=csv_buffer.getvalue())\n\n\nt3 = PythonOperator(\n task_id="UploadToS3",\n python_callable=sendDataToS3,\n dag=dag\n)\n\nt0 >> t1 >> t2 >> t3 ```" ]
[ "python", "amazon-s3", "airflow" ]
[ "How to define unknown prop warnings for a component?", "Is it good practice / possible to generate unknown prop warnings for a component? I think it would help to recognize quickly errors in the code. As far as I know props not defined in propTypes will just be ignored.\n\nFor example if I have a Box component that accepts a color prop, the following prop would not generate a warning/error:\n\n<Box colour=\"red\">1</Box>\n\n\nThis is just a simple example, but sometimes there are multiple props and such naming that mistakes can happen." ]
[ "javascript", "reactjs", "react-proptypes" ]
[ "SQL Statement Termination using RAISERROR", "(SQL 2005)\nIs it possible for a raiserror to terminate a stored proc.\n\nFor example, in a large system we've got a value that wasn't expected being entered into a specific column. In an update trigger if you write:\n\nif exists (select * from inserted where testcol = 7)\nbegin\n raiseerror('My Custom Error', 16, 1)\nend\n\nthe update information is still applied.\nhowever if you run\n\nif exists (select * from inserted where testcol = 7)\nbegin\n select 1/0\nend\n\na divide by 0 error is thrown that actually terminates the update.\nis there any way i can do this with a raiseerror so i can get custom error messages back?" ]
[ "sql", "sql-server-2005", "triggers", "raiserror" ]
[ "Spring ObjectError getDefaultMessage() encoding", "I am using @Valid annotation and the when error mesage has special characters they are always being displayed incorrectly.\n\npublic class Test {\n @NotEmpty(message = \"{test}\")\n private String test;\n //omitted getter and setter\n}\n\n\nValidationMessages.properties:\n\ntest=Número\n\n\nError Handling:\n\nprivate void handleBindException(final Exception ex, final Result res) {\n BindException bex = (BindException) ex;\n for (ObjectError error : bex.getAllErrors()) {\n res.addError(new ErrorCode(error.getCode(), error.getDefaultMessage()));\n }\n}\n\n\nSpring MessageResouce:\n\npublic ReloadableResourceBundleMessageSource messageSource() {\n ReloadableResourceBundleMessageSource ms = new ReloadableResourceBundleMessageSource();\n ms.setBasename(\"classpath:ValidationMessages\");\n ms.setUseCodeAsDefaultMessage(true);\n ms.setDefaultEncoding(\"UTF-8\");\n ms.setCacheSeconds(0);\n return ms;\n }\n\n\nFinal result:\n\nNúmero\n\n\nCan anybody help me with this issue please?" ]
[ "java", "spring", "encoding" ]
[ "update value in datagrid gives error in tables with foreign keys", "i am trying to write a code in visual studio c# where I have 3 tables \ncustomer , product, order all three are related \n\nNow i have created datagridview and fetch values from database , and when i edit datagrid , it updates database too, but when i try to update Product_id which is primary key of product and foreign key of order.\n\nIt gives error\n\nusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Data;\nusing System.Drawing;\nusing System.Linq;\nusing System.Text;\nusing System.Windows.Forms;\nusing System.Data.SqlClient;\n\nnamespace WindowsFormsApplication1\n{\n\n public partial class Form1 : Form\n {\n SqlConnection conn;\n SqlDataAdapter da;\n DataSet ds;\n public Form1()\n {\n InitializeComponent();\n conn = new SqlConnection(\"user id=sa;\" +\n \"password=sa@123;server=sudhanshu-lappy;\" +\n \"Trusted_Connection=yes;\" +\n \"database=alpha; \" +\n \"connection timeout=30\");\n try\n {\n conn.Open();\n\n }\n catch (Exception e)\n {\n Console.WriteLine(e.ToString());\n }\n }\n\n\n private void Form1_Load(object sender, EventArgs e)\n {\n\n\n\n\n\n //DataTable dt = null;\n\n //SqlCommand cmd = new SqlCommand(\"SELECT * FROM orders\", conn);\n //SqlDataReader reader = cmd.ExecuteReader();\n\n //dt = new DataTable();\n\n //dt.Load(reader);\n\n //dataGridView1.DataSource = dt;\n\n\n //DataGridViewButtonColumn clbt_delet = new DataGridViewButtonColumn();\n //clbt_delet.HeaderText = \"DELETE\";\n\n //clbt_delet.Text = \"Delete\";\n //clbt_delet.UseColumnTextForButtonValue = true;\n //dataGridView1.Columns.Add(clbt_delet);\n\n\n //da = new SqlDataAdapter(\"select * from orders\", conn);\n //SqlCommandBuilder cb = new SqlCommandBuilder(da);\n //ds = new DataSet();\n //da.Fill(ds);\n //dataGridView1.DataSource = ds.Tables[0];\n\n //now u can save changes to back end with\n\n\n }\n\n private void button1_Click(object sender, EventArgs e)\n {\n da.Update(ds);\n }\n private void button2_Click(object sender, EventArgs e)\n {\n da.Update(ds);\n }\n private void button3_Click(object sender, EventArgs e)\n {\n da.Update(ds);\n }\n\n private void ordersToolStripMenuItem_Click(object sender, EventArgs e)\n {\n da = new SqlDataAdapter(\"select * from orders\", conn);\n SqlCommandBuilder cb = new SqlCommandBuilder(da);\n ds = new DataSet();\n da.Fill(ds);\n dataGridView1.DataSource = ds.Tables[0];\n }\n\n private void productToolStripMenuItem_Click(object sender, EventArgs e)\n {\n da = new SqlDataAdapter(\"select * from product\", conn);\n SqlCommandBuilder cb1 = new SqlCommandBuilder(da);\n ds = new DataSet();\n da.Fill(ds);\n dataGridView3.DataSource = ds.Tables[0];\n }\n\n private void customerToolStripMenuItem_Click(object sender, EventArgs e)\n {\n da = new SqlDataAdapter(\"select * from customer\", conn);\n SqlCommandBuilder cb2 = new SqlCommandBuilder(da);\n ds = new DataSet();\n da.Fill(ds);\n dataGridView2.DataSource = ds.Tables[0];\n }\n\n\n\n\n }\n}\n\n\nSecondly I am only able to update order table by update operation, its not happening with other two tables \n\nSudhanshu" ]
[ "c#", "winforms", "visual-studio-2010", "datagridview" ]
[ "PHP routine sending APNS push notifications via AWS causes 500 internal server error", "I have PHP sitting on a GoDaddy server that sends push notification requests to the Apple Push Notification Service via Amazon's push notification service. \n\nIntermittently when sending push notifications to 20+ users the user initiating sending the notifications gets a GoDaddy Internal Server 500 error.\n\nI've traced specific DeviceTokens that caused the failure and used the same routine to send notifications to these specific DeviceTokens and they work - so I assume the issue is intermittent and unrelated to any particular DeviceToken.\n\nI'm suspicious of:\n(1) the exception handler which I've updated to catch AWSExceptions\n(2) the issue occurs when sending to 20+ devices, so perhaps it's a timeout issue (I do have set timeout=0 on the PHP page)\n\nHere is the code - truly hoping someone can help:\n\nstatic public function send_push_notification($message, $token, $badge = 1)\n { \n $sns = SnsClient::factory(array(\n 'credentials' => array(\n 'key' => '<redacted>',\n 'secret' => '<redacted>'\n ),\n 'region' => 'us-west-1',\n 'version' => '2010-03-31'\n ));\n $ios_arn = \"arn:aws:sns:us-west-1:<redacted>\";\n $ios_endpoints = $sns->listEndpointsByPlatformApplication(array(\n 'PlatformApplicationArn' => $ios_arn\n ));\n $arn = \"\";\n foreach ($ios_endpoints['Endpoints'] as $endpoint) {\n if ($token == $endpoint['Attributes']['Token']) {\n $arn = $endpoint['EndpointArn'];\n }\n }\n if ($arn == \"\") { \n $arn = SNSPushNotifications::register_device($token);\n } \n try {\n $contents = array();\n $contents['badge'] = $badge;\n $contents['alert'] = addslashes($message);\n $contents['sound'] = \"default\";\n $push = array(\n \"aps\" => $contents\n );\n $push_json = json_encode($push);\n $json = json_encode(array(\n 'APNS' => $push_json\n ));\n\n $sns->publish(array(\n 'MessageStructure' => 'json',\n 'Message' => $json,\n 'TargetArn' => $arn\n ));\n } \n catch (AWSException $e) { \n $mess=$e->getAwsRequestId() . \"\\n\";\n $mess.=$e->getAwsErrorType() . \"\\n\";\n $mess.=$e->getAwsErrorCode() . \"\\n\";\n\n $m=\"Push notification sent to \".get_token_user($token).\"($token) failed: \" . $endpointArn . \"<br/><strong>Error:</strong> \" . $mess . \"<br/>\";\n\n $headers = \"From: <redacted>\\r\\n\"; \n $headers .= \"Reply-To: <redacted>\\r\\n\";\n $headers .= \"Content-Type: text/html; charset=ISO-8859-1\\r\\n\";\n\n mail(\"<redacted>\",\"Push Notification Failure\",$m, $headers); \n if ($mess==\"Endpoint is disabled\") delete_token($token); \n } \n }" ]
[ "php", "amazon-web-services", "push-notification", "apple-push-notifications" ]
[ "access denied for user \"@'localhost for database 'db_name'", "I installed MySQL with package installer on Mac OS x, then I ran query browser and connected to database with username = \"\" and password = \"\". Now, I want to create a new schema,\nwhen a type create schema rest, it shows an error like access denied for user \"@'localhost' to database 'rest'\n\nhow can i fix this?" ]
[ "mysql", "mysql-error-1045" ]
[ "Conditional Formatting with partial match", "https://drive.google.com/file/d/0Bx4AlUFuxYrQaHZYUklFSENLRlk/view?usp=sharing\n\nI have a spreadsheet that uses an INDEX and AGGREGATE formula to populate results from a searched line item. I would like to add Conditional Formatting to the results to make it easier to find.\n\nFor example, if I type tax instead of taxiing, results that have a partial match will populate as module numbers, Lesson 1, Lesson 2, etc. Now I would like the items in Column B to be highlighted that partially match tax.\n\nHow do I go about doing this?" ]
[ "string", "excel", "search", "excel-formula", "conditional-formatting" ]
[ "removing duplicates based on variables", "I have three variables patients, arm and bestres\n\n01 A CR \n02 A PD \n03 B PR \n04 B CR \n05 C SD \n06 C SD \n07 C PD \n01 A CD \n03 B PD \n\n\nI want to remove duplicates in patients and arm\n\npatient arm bestres\n1 A CR \n2 A PD \n3 B PR \n4 B CR \n5 C SD \n6 C SD \n7 C PD\n\n\nHow to remove duplicates based on two variables" ]
[ "r" ]
[ "Entity Framework One to Many, Many to Many relationship", "I'm building an api using asp.net web api for an application that needs to track all the activities performed by users. So in every table I need to have createdUser and updatedUser field with their dates. But I faced some challenges on how to go about. \n\nHere are my concerns:\n\n\nHow can I have that in the User table itself? Which type of relationship do I need for that?\nI have a privilege table than can be created by required users. What type of relationship can I have between the Privilege and the User table?\n\n\nI'm new to Entity Framework so I need some guides. Please can anyone be very kind to provide some help. Thank you" ]
[ "sql", "asp.net" ]
[ "How To create Multilevel Spinner in Android", "Hi I am Developing an Android application for product distribution. I have my Products self-referencing (Parent->child) concept. ex. Samsung->Mobile->J7 (Product 3 Level), or Samsung->Laptop (Product 2 level). So I want to display Samsung in First Spinner. If Select Samsung, automatically new spinner should be created,and fill with Mobile and Laptop List. If again selects Mobile, a new spinner should appear with list J7, else if select Laptop, then no need to create new spinner." ]
[ "android" ]
[ "Adb starts with an unattached emulator", "When I start Eclipse, I always see emulator-5554 in the Devices View. If I start an application (in automatic target selection mode), it starts on this emulator, but the emulator doesn't have a window. I have to stop the system.process of the emulator every time after Eclipse startup.\n\nI was playing around with adb from the command line, so probably I caused the issue, but I can't figure out, how. \nWhen I restart adb with the commands 'adb kill-server' and 'adb start-server', emulator-5554 starts again, so adb starts it automatically.\n\nI read this document, but I couldn't find any information on emulator automatic startup. Neither a google search on \"adb autostart emulator\" helped.\n\nHow can I keep adb from running this emulator at startup?" ]
[ "android", "emulation", "adb" ]
[ "Error 413 request entity too large NGINX AWS", "Every time I upload big files to my app it always return error 413 request entity too large nginx. How can I configure my Elastic beanstalk environment so it can handle big files such as images. Thank you. I hope you can help me." ]
[ "amazon-web-services", "elasticbeanstalk" ]
[ "How to get applicationContextPath in dropwizard 1.0.0", "We are using server configuration in yml file which looks like as below\n\nserver:\ntype: simple\n\nconnector:\n type: http\n port: 8061\n\napplicationContextPath: /administration\nadminContextPath: /admin\n\n#disable the registration of default Jersey ExceptionMappers\nregisterDefaultExceptionMappers: false\n\n\nI want to get \"applicationContextPath\" when I start my dropwizard service.\n\nI am trying to get it using \n\nenvironment.getApplicationContext().getContextPath();\n\n\nbut I am getting \"/\" i.e. default value. Is there anyway to get this." ]
[ "java", "dropwizard" ]
[ "Zend_Form_Element_Checkbox issue", "I want to achieve the example html markup using Zend_Form_Element_Checkbox. Encounter problems, however, for example page_actions[]. I want to have this in a attribute and receive array in request. I know I must do it in the init of the form, but I lack knowledge of Zend Framework. I tried several options. For example, this:\n\n// In for loop in init method\n$element = new Zend_Form_Element_Checkbox('test['.$i.']');\n$element->setIsArray(true)->setBelongsTo('checkbox_name');\n$this->addElement($element);\n\n\nThis is the markup I would like to achieve:-\n\n<div>\n <div>\n Some bold message for this group\n </div>\n <div>\n <span>\n <input type=\"checkbox\" id=\"qf_18\" value=\"12\" name=\"page_actions[]\"/><label for=\"qf_18\">Test 18</label><br/>\n <input type=\"checkbox\" id=\"qf_20\" value=\"13\" name=\"page_actions[]\"/><label for=\"qf_20\">Test 20</label><br/>\n <input type=\"checkbox\" id=\"qf_22\" value=\"14\" name=\"page_actions[]\"/><label for=\"qf_22\">Test 22</label><br/>\n <input type=\"checkbox\" id=\"qf_24\" value=\"15\" name=\"page_actions[]\"/><label for=\"qf_24\">Test 24</label><br/>\n <input type=\"checkbox\" id=\"qf_26\" value=\"16\" name=\"page_actions[]\"/><label for=\"qf_26\">Test 26</label>\n </span>\n </div>\n</div>\n<div>\n <div style=\"font-weight: bold;\">\n Some bold message for this other group\n </div>\n <div>\n <span>\n <input type=\"checkbox\" id=\"qf_28\" value=\"17\" name=\"page_actions[]\"/><label for=\"qf_28\">Test 28</label><br/>\n <input type=\"checkbox\" id=\"qf_30\" value=\"18\" name=\"page_actions[]\"/><label for=\"qf_30\">Test 30</label><br/>\n <input type=\"checkbox\" id=\"qf_32\" value=\"19\" name=\"page_actions[]\"/><label for=\"qf_32\">Test 32</label><br/>\n <input type=\"checkbox\" id=\"qf_34\" value=\"20\" name=\"page_actions[]\"/><label for=\"qf_34\">Test 34</label><br/>\n <input type=\"checkbox\" id=\"qf_36\" value=\"21\" name=\"page_actions[]\"/><label for=\"qf_36\">Test 35</label>\n </span>\n </div>\n</div>" ]
[ "zend-framework", "zend-form" ]
[ "How to get the first column after Group by in SQL?", "How to get the #1 item after Group by in SQL?\nHere is my code.\n SELECT BUSEO, COUNT(BUSEO)\n FROM TBLINSA\n GROUP BY BUSEO\n ORDER BY COUNT(BUSEO) DESC\n\nThe result is 7 rows.\nI am curious about how to select and import only the first column from among them." ]
[ "sql", "oracle" ]
[ "What is post_name field in wp_posts in wordpress for?", "I'm migrating an app to wordpress.\nWe have thousands of wordpress posts that we will insert as custom_types in wordpress database.\nWhat is post_name field in wp_posts for?\nCan we have two records with the same post_name?\nIs it for friendly urls?" ]
[ "wordpress" ]
[ "substituting special characters using awk", "I have a file with the first field like this:\n\nENSGALG00000000189|ENSGALT00000000247|10|3979|4020 \n\n\nI want to get rid of the \"|\" sign and just have a space. \n\nI have been trying this code but it doesn't work:\n\nawk -F \"|\" '{gsub (\"|\", \"\")' file\n\n\nI'd be very thankful if you could help me with this.Thanks" ]
[ "awk" ]
[ "Examples to show the difference between Buffered Asynchronous Channels and Channels?", "From the official guide:\n\n\n “put” operation of asynchronous channels does not block—unless the given channel was created with a buffer limit and the limit has been reached.\n\n\nIs that mean channel-put would be blocked while other threads using channel-get, and async-channel-put still working while other threads async-channel-get?\n\nI was wondering if maybe there is any examples to show their difference?" ]
[ "scheme", "racket" ]
[ "Convert select new to DataTable?", "I am using .NET 3.5 and need to convert the below select new result into a DataTable. Is there something built in for this or anyone know of a method that can do this?\n\nvar contentList = (from item in this.GetData().Cast<IContent>()\n select new\n {\n Title = item.GetMetaData(\"Title\"),\n Street = item.GetMetaData(\"Street\"),\n City = item.GetMetaData(\"City\"),\n Country = item.GetMetaData(\"Country\")\n });" ]
[ "c#", "asp.net", ".net", "linq", "dataset" ]
[ "Return all collection items at once to function", "I'm struggling with the output off a collection. What the sub does is go into an XML file and retrieves multiple data sets (name + ranking number). Ranking numbers only go from 1 - 25. It will filter out the name and only gives the ranking number.\n\nWhat the function does is converting a string of numbers into a more readable overview, for example\n1, 2, 3, 5, 6, 20, 22, 23, 24 is converted to 1-3, 5-6, 20, 22-24. All the numbers in the first string have to be seperated by a \",\" hence the Coll.add \",\" \n\nNow I know how to get the data with for each item in Coll but I'm unable to get all the values in 1 string. Maybe collections is not the ideal functions for this?\n\nSo the question is how can I retrieve the full collaction as string as is? Because everthing is in the right order and with the add \",\" my collection is complete.\n\n Dim Coll As Collection\n Set Coll = New Collection\n\n Set NameNod = oXMLFile.SelectNodes(\"/Report/Results/Name/elt/NameId/text()\")\n\nFor i = 0 To NameNod.Length - 1\n\n Ranking = Right(NameNod(i).NodeValue, 2) 'returns only the ranking number\n\n Coll.Add Ranking\n Coll.Add \",\" \n\nNext\n\n\nFunction IntoRanges(aString As String, Optional Delimiter As String = \",\") As String\n Dim NextBit As String\n Dim i As Long\n Dim Items As Variant\n Items = Split(aString, Delimiter)\n\n IntoRanges = Items(0)\n For i = 0 To UBound(Items) - 1\n If Val(Items(i)) + 1 = Val(Items(i + 1)) Then\n NextBit = \"-\" & Val(Items(i + 1))\n Else\n If NextBit = vbNullString Then\n IntoRanges = IntoRanges & Delimiter & Val(Items(i + 1))\n\n Else\n IntoRanges = IntoRanges & NextBit & Delimiter & Val(Items(i + 1))\n NextBit = vbNullString\n End If\n End If\n Next i\n IntoRanges = IntoRanges & NextBit\nEnd Function" ]
[ "excel", "vba" ]
[ "Cannot run my App on a device disconnected from Xcode", "With the last version of Xcode (12.0), I do not succeed to run my App on my device without usb cable.\nWhen connected, the app is installed and works well, but when I remove the cable the App closes and I cannot reopen it...\nThen, I have an alert on Xcode saying "Lost connection to the debugger..."\nI tried to modify the Runner configuration settings with Releaser and Debug, but same results.\nFor info: I am using Flutter sdk.\nPlease help.." ]
[ "xcode", "flutter", "xcode12" ]