texts
sequence | tags
sequence |
---|---|
[
"what are all the components used to connect arduino and android",
"i want to send data from android smartphone to Arduino AND Arduino to android but without using Bluetooth and Wifi. \n What are all the ways? \n How to do it?"
] | [
"android",
"arduino"
] |
[
"Parse SDK Android Proguard issue",
"I have parse 1.5.1 in my app and everything works fine, but when I go to export to APK I get:\n\n[2014-09-05 19:53:08 - myapp] Proguard returned with error code 1. See console\n[2014-09-05 19:53:08 - myapp] Note: there were 662 duplicate class definitions.\n[2014-09-05 19:53:08 - myapp] Warning: com.parse.FacebookAuthenticationProvider$1: can't find superclass or interface com.facebook.android.Facebook$ServiceListener\n[2014-09-05 19:53:08 - myapp] Warning: com.parse.FacebookAuthenticationProvider$2: can't find superclass or interface com.facebook.Session$StatusCallback\n[2014-09-05 19:53:08 - myapp] Warning: com.parse.FacebookAuthenticationProvider$2$1: can't find superclass or interface com.facebook.Request$Callback\n[2014-09-05 19:53:08 - myapp] Warning: com.parse.FacebookAuthenticationProvider: can't find referenced class com.facebook.android.Facebook\n......\n[2014-09-05 19:53:08 - myapp] at proguard.Initializer.execute(Initializer.java:321)\n[2014-09-05 19:53:08 - myapp] at proguard.ProGuard.initialize(ProGuard.java:211)\n[2014-09-05 19:53:08 - myapp] at proguard.ProGuard.execute(ProGuard.java:86)\n[2014-09-05 19:53:08 - myapp] at proguard.ProGuard.main(ProGuard.java:492)\n\n\nIn my proguard.cfg I have the following:\n\n-keepattributes *Annotation*\n-keep class com.parse.* { *; } \n-libraryjars libs/Parse-1.5.1.jar \n\n\nThis is driving me crazy!!!"
] | [
"android",
"parse-platform",
"proguard"
] |
[
"How to convert datesrting to short date object in javascript?",
"I am new to UI (User Interface) coding and I have date from json as "2021-02-28 00:00:00". But while writing to the xlsx I don't want the date in string form. And this is what I have tried.\nvariable = new Date("2021-02-28 00:00:00")\n\nWhich give the date object as below\nSun Feb 28 2021 00:00:00 GMT+0530 (India Standard Time)\n\nBut I want the date to be in below format [should be still a date object not a string]\n28 Feb 2021 00:00:00"
] | [
"javascript",
"vue.js"
] |
[
"Redux - handling really large state object",
"I have a simple react + flask application.\nI want to load some data (~10mb) when the user clicks a button, and then use this data.\nBecause two different components have to interact with this data, i thought ill save the data as a global state using redux.\nWhat i basically have is two components:\n\nhave a button that calls an action to load the large data from the flask server (and save that data into the global redux state)\nuses the data (from the global state)\n\nOnce i did that, i was getting "SerializableStateInvariantMiddleware took 509ms, which is more than the warning threshold of 32ms.", Which made me think this isnt the right way to do so.\nWhat is the right way to handle something like that?\nShould i keep a different smaller state (so i know the "load data" button was clicked), and read that state from the second component and only then load the data into a private state?\n(check if the global state was changed and if it did, call an action and save the data in the private state?)"
] | [
"reactjs",
"redux"
] |
[
"How to change size setting of video capturing by AVFoundation",
"I am created a app that record video and upload it on server,but video recorded at very high resolution , i want to decrease its resolution, i learn about AVCaptureSessionPreset640x480 on internet but i dont know how to use it."
] | [
"iphone",
"ios",
"avfoundation"
] |
[
"how to get context of a tapped list item to show details in another page in Nativescript",
"i am trying to create a listview to show data from hardcoded array list and its working good , but i need to make user able to click on any item to show the details of this item in another page , how can i do that ? i tried to create another array for details and make bindingContext and its working good but no data show when converting to details page as you can see here\n\nthats my code :\n\nmain-view-model.js:\n\nvar Observable = require(\"data/observable\").Observable;\n\nfunction RegisterViewModel() {\n var viewModel = new Observable();\n viewModel.shows = [\n {name:\"Reg1\"},\n {name:\"Reg2\"},\n {name:\"Reg3\"},\n {name:\"Reg4\"},\n {name:\"Reg5\"},\n\n\n ];\n\n return viewModel;\n\n}\n\nexports.RegisterViewModel = RegisterViewModel;\n\n\nmain-page.js:\n\nvar RegisterViewModel = require(\"./main-view-model\").RegisterViewModel;\nvar frameModule = require('ui/frame'); \n\n\nvar viewModel = new RegisterViewModel();\nfunction RegisterViewModel(args) {\nvar page = args.object;\npage.bindingContext = RegisterViewModel();\n}\n\nexports.getInfo = function (args) {\n var navigationEntry = { \n moduleName: \"RegisterDetails\",\n context: {info:args.view.bindingContext}\n }\n frameModule.topmost().navigate(navigationEntry);\n }\n\nexports.loaded = function(args){\n args.object.bindingContext = viewModel;\n}\n\n\nexports.RegisterViewModel = RegisterViewModel;\n\n\nmain-page.xml:\n\n<Page xmlns=\"http://schemas.nativescript.org/tns.xsd\" navigatingTo=\"onNavigatingTo\" class=\"page\" loaded=\"loaded\">\n\n <Page.actionBar>\n <ActionBar title=\"My App\" icon=\"\" class=\"action-bar\">\n </ActionBar>\n </Page.actionBar>\n\n <StackLayout class=\"p-20\">\n\n <SearchBar id=\"searchBar\" hint=\"Search\" text=\"\" clear=\"onClear\" submit=\"onSubmit\" />\n<TabView>\n <TabView.items>\n <TabViewItem title=\"register\">\n <TabViewItem.view>\n <ListView items=\"{{shows}}\" tap=\"getInfo\" >\n\n <ListView.itemTemplate>\n <Label text=\"{{name}}\" />\n\n </ListView.itemTemplate>\n\n </ListView>\n </TabViewItem.view>\n </TabViewItem>\n <TabViewItem title=\"Tab 2\">\n <TabViewItem.view>\n <Label text=\"Label in Tab2\" />\n </TabViewItem.view>\n </TabViewItem>\n </TabView.items>\n </TabView>\n\n </StackLayout>\n</Page>\n\n\nthese for details: \n\nRegisterDetails-model.js\n\n viewModel.shows = [\n {name:\"Reg01\"},\n {name:\"Reg02\"},\n {name:\"Reg03\"},\n {name:\"Reg04\"},\n {name:\"Reg05\"},\n\n ];\n return gotData;\n\n}\n\nexports.pageLoaded = pageLoaded;\n\n\nRegisterDetails.js:\n\nvar gotData;\nfunction pageLoaded(args) {\n var page = args.object;\n gotData = page.navigationContext.info;\n page.bindingContext={passedData:gotData}\n }\n\n exports.pageLoaded = pageLoaded;\n\n\nRegisterDetails.xml:\n\n <Page xmlns=\"http://schemas.nativescript.org/tns.xsd\" navigatingTo=\"onNavigatingTo\" class=\"page\" loaded=\"pageLoaded\">\n\n <Page.actionBar>\n <ActionBar title=\"Register\" icon=\"\" class=\"action-bar\">\n </ActionBar>\n </Page.actionBar>\n\n <StackLayout >\n <Label text=\"{{name}}\" />\n </StackLayout>\n </Page>\n\n\nbut when i clicked on any item i go to register details but no data shows in page , and i received this message error in console :\n\nJS: Binding: Property: 'name' is invalid or does not exist. SourceProperty: 'name'\n\n\nany help?"
] | [
"javascript",
"android",
"listview",
"data-binding",
"nativescript"
] |
[
"Java If and Or Statement",
"The following statement is working without any issues, but please can someone explain why, I was under the impression there should be an additional set of brackets before the &&? However, even with the () missing it still works.\n\nif(returnt.getInt(\"date\", iLoop) == Util.getBusinessDate()\n && returnt.getInt(\"ins_type\", iLoop) == Ref.getValue(SHM_USR_TABLES_ENUM.INSTRUMENTS_TABLE, \"DEPO\")\n || returnt.getInt(\"ins_type\", iLoop) == Ref.getValue(SHM_USR_TABLES_ENUM.INSTRUMENTS_TABLE, \" DEPO2\"))\n{...}"
] | [
"java",
"if-statement"
] |
[
"mean of n rows by grouping another column in r",
"I have a dataframe and I need to calculate Mean of x for every n rows\nby grouping Name, lets say n= 3\nSample dataset df: \n\n Name X \n A 3.1 \n A 2.5 \n A 3.6 \n A 3.4 \n B 4.6 \n B 1.8 \n B 3.4 \n\n\nFor every name, mean of first 3 rows, then next 3 rows,\n if in the end < 3 rows for a name, mean for those 1 or 2 rows. \n\nSo far I've been able to group for the 3 rows or names separately.\nAny help on how to imply those two together would be appreciated. \n\n## by grouping 3 rows##\nfinal1<-aggregate(df$X,list(rep(1(nrow(df)%/%n+1),each=n,len=nrow(df))),mean)[-1] \n\n##by grouping name##\nfinal2<- df %>% group_by(Name) %>% summarise(value=mean(df$X)) \n\n\nDesired Output is: \n\n Name X \n A 3.066 \n A 3.400 \n B 3.266 \n\n\nThanks for the help!"
] | [
"r",
"group-by",
"aggregate",
"mean"
] |
[
"Is the @input() tag available for classes in angular?",
"I'm watching some videos about Angular 2 on the Microsoft Virtual Academy and there is a lot of slides who show a class tagged with the @input() attribute. The first time I saw this I thank it was a mistake, but now I saw at least 3 or 4 differents slides on differents videos with a class tagged with @input().\n\nI searched on the official documentation, and I didn't found any class with an @input() tag.\n\nIs this some mistakes or it's possible to mark a class as inputeable in angular 2 ?\n\nSome slides containing this :"
] | [
"angular"
] |
[
"Duplicate function name affecting Jasmine tests in Meteor",
"I have recently started working with Meteor, and trying to start off as I mean to go on by testing well. To this end, I am using the Velocity test runner and using Jasmine for the actual tests. \n\nTake the very simple case where I have a file in the server directory called hello.js, which contains our old favourite\n\nvar helloWorld = function () {\n return \"Hello World\";\n};\n\n\nThen in my test directory, well 'tests/jasmine/server/unit' I have a test file sampleTest.js containing the basic test suite\n\ndescribe(\"Hello World\", function() {\n it(\"should return hello world\", function() {\n expect(helloWorld()).toBe(\"Hello World\");\n });\n});\n\n\nVelocity reports all tests passing, everyone is happy. If I change the original helloWorld function to return something different, the test fails as expected.\n\nIf, however, a second function, of the same name with a different output existed somewhere in the project, e.g.\n\nvar helloWorld = function () {\n return \"Goodbye World\";\n};\n\n\nThen this would break the test, but the other version of it passes the test.\n\nExtrapolating from this simplified example, how then do I ensure each function is uniquely named to avoid this problem? \n\nIs my question more a result of my incomplete grasp of Meteor fundamentals (or JS/testing fundamentals in general)?"
] | [
"javascript",
"unit-testing",
"meteor",
"jasmine",
"meteor-velocity"
] |
[
"Custom attribute options value in magento",
"I want to add a custom column in “Attribute option” in “Manage Attribute Options” menu in admin. Like “value” column beside the position column in admin.\n\nWhat I have done ... \n\n\ncreated a new filed in ”eav_attribute_option” table named “value” beside “sort_order” filed in database. \nchanged ”magento\\app\\design\\adminhtml\\default\\default\\template\\catalog\\product\\attribute\\options.phtml” this file to show the “Value” column beside the “Position” column. \nchanged ”getOptionValues()” method in this file ”magento\\app\\code\\core\\Mage\\Eav\\Block\\Adminhtml\\Attribute\\Edit\\Options\\Abstract.php” to get data for my custom “value” column from database and show in admin side. It shows the default value of db in admin form. \n\n\n* But when I want to save from admin panel the data doesn't save in db. Can anybody help which file I have to change to save the data of “Value” field into db? Can anybody please give any solution, which file or where have to change ?"
] | [
"magento",
"magento-1.7"
] |
[
"Cmd window to close after opening process with .bat",
"I'm new with batch file and the code I'm using I had to find but it always opens cmd but doesn't close it after the program is open. I'm aware that it doesn't close because it's a window process and cmd doesn't close until after the window is closed. I would like to to close after it opens the window. Here is the code:\n\n\"C:\\Program Files\\Java\\jre7\\bin\\javaw.exe\" -Xmx1G -Xms1G -jar \"Minecraft_Server.exe\"\n\n\nI've used many different ways close it like putting Exit at the end or putting cmd /c in front but that didn't work."
] | [
"batch-file",
"cmd",
"window",
"application-start"
] |
[
"Pyamg don't work (No module named 'pyamg.amg_core.evolution_strength')",
"I want to use PyAMG (https://pyamg.readthedocs.io/en/latest/#).\nI install it using (pip install pyamg) \nI use spyder in windows. It gives error when I want to import it\nI run it's example:\nimport pyamg\nimport numpy as np\nA = pyamg.gallery.poisson((500,500), format='csr') # 2D Poisson problem on 500x500 grid\nml = pyamg.ruge_stuben_solver(A) # construct the multigrid hierarchy\nprint(ml) # print hierarchy information\nb = np.random.rand(A.shape[0]) # pick a random right hand side\nx = ml.solve(b, tol=1e-10) # solve Ax=b to a tolerance of 1e-10\nprint("residual: ", np.linalg.norm(b-A*x)) # compute norm of residual vector\n\nThe error is : \nimport pyamg.amg_core\nFile "C:\\Users\\Admin\\AppData\\Local\\Programs\\Spyder\\pkgs\\pyamg\\amg_core_init_.py", line 5, in \nfrom .evolution_strength import *\nModuleNotFoundError: No module named 'pyamg.amg_core.evolution_strength'\nHow can I resolve this issue?\nThanks in advance"
] | [
"python",
"import",
"spyder",
"pyamg"
] |
[
"sort: cannot create temporary file in '/Data': Permission denied",
"I've recently started working through a Tuxedo suite pipeline using a makefile written by somebody else. We've been trying to work through this particular stanza \n\nreformat_read_group_tracking:\n @echo \"Here we go!\"\n @for file in $(FILELIST_CUFFLINKS_REFORMAT); do \\\n awk '{if (NR!=1) {print}}' $(DIRPATH)/RNA_SEQ/Analysis_062216/$${file}/genes.read_group_tracking > $(DIRPATH)/RNA_SEQ/Analysis_062216/$${file}/temp.txt;\\\n chmod 775 $(DIRPATH)/RNA_SEQ/Analysis_062216/$${file}/temp.txt;\\\n sort -nk 3,3 $(DIRPATH)/RNA_SEQ/Analysis_062216/$${file}/temp.txt | sort -nk 2,2 | sort -nk 1,1 > $(DIRPATH)/RNA_SEQ/Analysis_062216/$${file}/temp2.txt;\\\n chmod 775 $(DIRPATH)/RNA_SEQ/Analysis_062216/$${file}/temp2.txt;\\\n perl formatCuffDiffOutput.pl $(DIRPATH)/RNA_SEQ/Analysis_062216/$${file}/temp2.txt > $(DIRPATH)/RNA_SEQ/Analysis_062216/$${file}/reformatted_genes.read_group_tracking;\\\n chmod 775 $(DIRPATH)/RNA_SEQ/Analysis_062216/$${file}/reformatted_genes.read_group_tracking;\\\n awk '{print $$1}' $(DIRPATH)/RNA_SEQ/Analysis_062216/$${file}/reformatted_genes.read_group_tracking > $(DIRPATH)/RNA_SEQ/Analysis_062216/$${file}/reformatted_genes_temp.read_group_tracking;\\\n awk -v OFS='\\t' '{print $$2,$$3,$$4,$$5,$$6,$$7,$$8,$$9}' $(DIRPATH)/RNA_SEQ/Analysis_062216/$${file}/reformatted_genes.read_group_tracking > $(DIRPATH)/RNA_SEQ/Analysis_062216/$${file}/reformatted_genes_temp2.read_group_tracking;\\\n awk -v OFS='\\t' -F '\\t' '{print $$2,$$3,$$4,$$5,$$6,$$7,$$8,$$9,$$10,$$11,$$12,$$13,$$14}' $(DIRPATH)/RNA_SEQ/Analysis_062216/$${file}/gene_exp.diff > $(DIRPATH)/RNA_SEQ/Analysis_062216/$${file}/gene_exp_temp.diff;\\\n chmod 775 $(DIRPATH)/RNA_SEQ/Analysis_062216/$${file}/reformatted_genes_temp.read_group_tracking;\\\n chmod 775 $(DIRPATH)/RNA_SEQ/Analysis_062216/$${file}/reformatted_genes_temp2.read_group_tracking;\\\n chmod 775 $(DIRPATH)/RNA_SEQ/Analysis_062216/$${file}/gene_exp_temp.diff;\\\n paste $(DIRPATH)/RNA_SEQ/Analysis_062216/$${file}/reformatted_genes_temp.read_group_tracking $(DIRPATH)/RNA_SEQ/Analysis_062216/$${file}/gene_exp_temp.diff $(DIRPATH)/RNA_SEQ/Analysis_062216/$${file}/reformatted_genes_temp2.read_group_tracking > $(DIRPATH)/RNA_SEQ/Analysis_062216/$${file}/final_reformat_genes.read_group_tracking;\\\n rm $(DIRPATH)/RNA_SEQ/Analysis_062216/$${file}/reformatted_genes.read_group_tracking;\\\n rm $(DIRPATH)/RNA_SEQ/Analysis_062216/$${file}/reformatted_genes_temp.read_group_tracking;\\\n rm $(DIRPATH)/RNA_SEQ/Analysis_062216/$${file}/reformatted_genes_temp2.read_group_tracking;\\\n rm $(DIRPATH)/RNA_SEQ/Analysis_062216/$${file}/gene_exp_temp.diff;\\\n rm $(DIRPATH)/RNA_SEQ/Analysis_062216/$${file}/temp2.txt;\\\n rm $(DIRPATH)/RNA_SEQ/Analysis_062216/$${file}/temp.txt;\\\n done ;\n\n\nbut we keep encountering an error, and the guy who wrote the code is unavailable to help right now. The issue we are having is that whenever we run the stanza it gives us the following error:\n\nsort: cannot create temporary file in '/Data': Permission denied\n\n\nNone of us know exactly what is happening, but we wanted to know if this issue is a result of anything in the stanza, or if it could be a problem with the system it is running on (this makefile was written on a different machine, so the staza itself has worked before, but it is give us this error message.) \n\nI hope this is enough to tell what the general issue is, but let me know if more information is required.\n\nThank you"
] | [
"makefile",
"permissions",
"temp"
] |
[
"When does substitution of inline function body exceuted",
"I'm trying to experiments with inline function. I think that the substitution of function's body executed at preprocessing time. But it is not true. If we declare inline function as the follwoing\n\n//--main.cpp--//\n....\ninline void bar();\n....\n\n\nand running g++ -E main.cpp then we can to see inline function without changes. So when does substitution body function executed?"
] | [
"c++",
"inline"
] |
[
"gridview can't add after clearing",
"I am using entity framework and taking my datas from database and fill my gridview with them.Datas selected by user from a treview.Simply, user selects a data from treeview and I put it to gridview. Lastly I have a button for clearing the gridview. Here is my aspx:\n\n<div id=\"divPrint\" style=\"background-color: white\" runat=\"server\">\n <asp:UpdatePanel ID=\"UpdatePanel1\" runat=\"server\">\n <ContentTemplate>\n <p style=\"text-align:center\">HDCVI KAMERA FİYAT TEKLİFİDİR</p>\n <asp:GridView ID=\"GridViewHdcvi\" runat=\"server\" DataSourceID=\"EntityDataSourceHdcvi\" AutoGenerateColumns=\"False\">\n <Columns>\n <asp:TemplateField HeaderText=\"ÜRÜN VE DETAYLARI\">\n <ItemStyle Width=\"400px\" />\n <ItemTemplate>\n <div style=\"color: red\" class=\"text-center\"><%#Eval(\"UrunAdi\") %></div>\n <%#Eval(\"UrunDetay\") %>\n </ItemTemplate>\n </asp:TemplateField>\n <asp:ImageField HeaderText=\"ÜRÜN GÖRSELİ\" DataImageUrlField=\"UrunResim\"></asp:ImageField>\n <asp:TemplateField HeaderText=\"BİRİM FİYAT\">\n <ItemTemplate>\n <%#Eval(\"UrunFiyati\") %>\n </ItemTemplate>\n </asp:TemplateField>\n <asp:TemplateField HeaderText=\"ADET\">\n <ItemTemplate>\n <asp:TextBox ID=\"txtAdet\" runat=\"server\" Width=\"40px\"></asp:TextBox>\n </ItemTemplate>\n </asp:TemplateField>\n </Columns>\n </asp:GridView>\n </ContentTemplate>\n </asp:UpdatePanel>\n </div>\n<asp:Button ID=\"btnListiSifirla\" runat=\"server\" Text=\"Listeyi Sıfırla\" CssClass=\"btn btn-danger\" OnClick=\"btnListiSifirla_Click\" />\n\n\nAnd my codebehind:\n\n static List<string> urunList = new List<string>();\n\n protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)\n {\n string id = TreeView1.SelectedValue;\n urunList.Add(id); \n listeyiDoldur();\n }\n\n protected void listeyiDoldur() \n {\n if (urunList.Count == 0)\n {\n failDiv.Visible = true;\n }\n else\n {\n string query = \"SELECT UrunTable.UrunAdi, UrunTable.UrunFiyati, UrunTable.UrunResim, UrunTable.UrunKategori, UrunTable.UrunDetay FROM UrunTable WHERE \";\n foreach (var val in urunList)\n {\n if (val.Equals(urunList[urunList.Count - 1]))\n {\n query += \"UrunTable.UrunId = \" + val;\n }\n else\n {\n query += \"UrunTable.UrunId = \" + val + \" || \";\n }\n }\n EntityDataSourceHdcvi.CommandText = query;\n divPrint.Visible = true;\n btnListiSifirla.Visible = true;\n }\n }\n\n protected void btnListiSifirla_Click(object sender, EventArgs e)\n {\n urunList.Clear();\n btnListiSifirla.Visible = false;\n Page_Load(null,EventArgs.Empty);\n }\n\n\nI can successfully display selected datas in gridview and clear them when button is pressed. Here is the problem: After clearing the gridview I can't add the last added item again.For example if I add item1,item2 and item3 in this order,after clearing the gridview I can't add item3. I can add item1 or item2, then item3. I can't add item firstly which I added last before clearing. I tried clearing gridview in button's onClick and tried other lots of things but nothing gave any result. Thanks for your time."
] | [
"c#",
"asp.net",
"gridview",
"add"
] |
[
"SQL: Query for date greater than X months and Y days ago",
"Is it possible to construct a SQL query for MySQL that can SELECT based on a date being greater than 1 month and 4 days ago?\n\nI know that the following is possible:\n\nSELECT * FROM TBL WHERE DATE_COL > date_sub(now(), INTERVAL 1 MONTH);\n\n\nHowever, what if I wanted to add another 4 days (or any number of days for that matter) to the interval in the date_sub?"
] | [
"mysql",
"sql",
"date"
] |
[
"Websockets with HTTPS : handshake time out",
"I'm using websockets on my php-apache website, running on ubuntu. That worked well, until I added a SSL certificate. The certificate was generated using certbot from Let's Encrypt.\nNow when I use\nvar websocket = WebSocket("wss://my_domain:4950/");\n\nChrome responds with this error : "WebSocket connection to 'wss://my_domain:4950/' failed: WebSocket opening handshake timed out"\nI found some answers that I had to add another certificate for websockets, but I'm lost..."
] | [
"javascript",
"php",
"ssl",
"https",
"websocket"
] |
[
"Scrape from site, which has CloudFlare (BeautifulSoup, Request)",
"I am unable to scrape data from website, that uses CloudFlare.\nI always get urllib.error.HTTPError: HTTP Error 503: Service Temporarily Unavailable\nCan you show me the way to pass the CloudFlare protection?\n\nfrom bs4 import BeautifulSoup\nfrom urllib.request import Request, urlopen\n#Website url was changed to ####, because it is secret\nurl = '#######'\nhdr = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11',\n 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',\n 'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',\n 'Accept-Encoding': 'none',\n 'Accept-Language': 'en-US,en;q=0.8',\n 'Connection': 'keep-alive'}\n\nreq = Request(url,headers=hdr)\npage = urlopen(req)\nsoup = BeautifulSoup(page, \"lxml\")\n\nprint(soup)\n\n\nCan you explain me every step, please"
] | [
"python",
"beautifulsoup"
] |
[
"Why does Z3 keeps a variable at the same value even if it is specified not to do that",
"I am encountering a problem in Z3 for which I can't seem to find where it originates from and how to fix it. My goal that for a given certain iteration (for-loop) that is composed of an if-then-else statement at each step; is it possible to achieve a given value k after the loop has finished. This is done without knowing the structure of if. In other words, i need to check every possible mapping of the function (true or false) for each step. More precisely in smt2 format: \n\n(declare-fun a(Int) Int)\n(declare-fun b(Int) Int)\n(assert (= 1 (a 0)))\n(assert (= 1 (b 0)))\n(assert (xor (and ( = (a 1) (+ (a 0) (* 2 (b 0)))) (= (b 1) (+ 1 (b 0)))) (and (= (b 1) (+ (a 0) (b 0))) (= (a 1) (+ (b 0) 1)))))\n(assert (xor (and ( = (a 2) (+ (a 1) (* 2 (b 1)))) (= (b 2) (+ 2 (b 1)))) (and (= (b 2) (+ (a 1) (b 1))) (= (a 2) (+ (b 1) 2)))))\n(assert (xor (and ( = (a 3) (+ (a 2) (* 2 (b 2)))) (= (b 3) (+ 3 (b 2)))) (and (= (b 3) (+ (a 2) (b 2))) (= (a 3) (+ (b 2) 3)))))\n(assert (xor (and ( = (a 4) (+ (a 3) (* 2 (b 3)))) (= (b 4) (+ 4 (b 3)))) (and (= (b 4) (+ (a 3) (b 3))) (= (a 4) (+ (b 3) 4)))))\n(assert (xor (and ( = (a 5) (+ (a 4) (* 2 (b 4)))) (= (b 5) (+ 5 (b 4)))) (and (= (b 5) (+ (a 4) (b 4))) (= (a 5) (+ (b 4) 5)))))\n(assert (xor (and ( = (a 6) (+ (a 5) (* 2 (b 5)))) (= (b 6) (+ 6 (b 5)))) (and (= (b 6) (+ (a 5) (b 5))) (= (a 6) (+ (b 5) 6)))))\n(assert (xor (and ( = (a 7) (+ (a 6) (* 2 (b 6)))) (= (b 7) (+ 7 (b 6)))) (and (= (b 7) (+ (a 6) (b 6))) (= (a 7) (+ (b 6) 7)))))\n(assert (xor (and ( = (a 8) (+ (a 7) (* 2 (b 7)))) (= (b 8) (+ 8 (b 7)))) (and (= (b 8) (+ (a 7) (b 7))) (= (a 8) (+ (b 7) 8)))))\n(assert (xor (and ( = (a 9) (+ (a 8) (* 2 (b 8)))) (= (b 9) (+ 9 (b 8)))) (and (= (b 9) (+ (a 8) (b 8))) (= (a 9) (+ (b 8) 9)))))\n(assert (xor (and ( = (a 10) (+ (a 9) (* 2 (b 9)))) (= (b 10) (+ 10 (b 9)))) (and (= (b 10) (+ (a 9) (b 9))) (= (a 10) (+ (b 9) 10)))))\n(assert (= (b 10) 461))\n(check-sat)\n(get-model)\n\n\nThe xor operator is used to check if the statement for then holds or the statement in else holds, but not both. So the the variable a or b is bounded to follow only one valid path. Somehow the values sometimes don't seem to obey this rule or they do not change, and I am unable to tell why is this happening. As for example take this output for a, for the step 2 and 3 the value doesn't change, which should not be possible:\n\n (define-fun a ((x!0 Int)) Int\n (ite (= x!0 0) 1\n (ite (= x!0 1) 3\n (ite (= x!0 2) 7 <--- should not be possible but keeps happening\n (ite (= x!0 3) 7 <---\n (ite (= x!0 4) 29\n [...]\n\n\nI don't know if i either am encountering a bug or my logic involved in the solution for this problem is flawed. I tried to use Bounded Model Checking. I would appreciate any help!"
] | [
"z3",
"solver",
"smt"
] |
[
"editing file lines in place python 2.6",
"I have multiple files that I'm iterating through and for each file I check if a pattern exists there or not and the pattern can either exist once or multiple times or it doesn't exist at all. I want to edit the line that has the pattern once the pattern is found and rewrite the line with the pattern only. If the pattern is not there then I close the file without any modifications. \nMy code:\n\nfor root, dirs, files in os.walk('C:/Users/Documents/'):\n for fname in files:\n for line in fileinput.input(os.path.join(root, fname), inplace = 1): \n if re.search(r\"([\\w-d])\", line):\n x=re.sub(r\"([\\w-d])\", r\"(\\1).\", line)\n print line.replace(line,x)\n\n\nThe problem is it changes the pattern fine when it finds it but for the files that doesn't have the pattern it deletes their contents completely. And if the pattern exists in multiple lines, it keeps one line only and deletes the rest. What am I missing?\n\nEDIT\n\nI'm flexible also to use \"open\" or any other method that can solve my problem. My main concern is I don't want to rewrite the lines in files that don't have the pattern. For tracking purposes I want to only modify the files that has the pattern. so far my research online [1] [2][3] shows that I can either write to a temp file and use it later as original file or read all the lines and then write all of them again regardless if the file has the pattern or not. is there a better way of solving this problem?"
] | [
"python",
"regex"
] |
[
"how to fetch value from tag",
"I have a list like\n\n<select name=\"operation\" id=\"operation\">\n <option value=\"1\">XXXX</option>\n <option value=\"2\">YYY</option>\n <option value=\"3\">ZZZ</option>\n</select>\n\n\nI have to get value \"XXXX\" if user select an option 1, for 2nd I have to get show \"YYYY\" and so on. And format should be like in the above means i don't have to change value=\"1\",\"2\",\"3\". I need it in javascript.\nThanks"
] | [
"javascript"
] |
[
"How to show/hide HTML Buttons via MVC Action Method",
"In my web page, I need to populate button according to parameter value called ButtonType.\nlet's say that If ButtonType == \"Edit\" then I need to hide every buttons but butUpdate.\n\nI want to know how to show/hide html buttons via MVC Action method.\n\n[AcceptVerbs(HttpVerbs.Post)]\n public ActionResult SupplierDetail(int SupplierID, string ButtonType)\n { \n var Supplier = supplierListRepository.Supplier_SelectByID(SupplierID);\n return View(Supplier);\n }\n\n\nI am using Asp.net Mvc Razor form.\n\n@using (Html.BeginForm(\"SupplierDetail_SubmitClick\", \"Supplier\", FormMethod.Post, new { id = \"frmSupplierDetail\" }))\n{ \[email protected](true)\n<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"width:450px; height:auto\">\n.....\n<tr>\n <td>@Html.LabelFor(model => model.Phone)</td>\n <td>@Html.EditorFor(model => model.Phone)\n @Html.ValidationMessageFor(model => model.Phone)</td>\n</tr>\n<tr>\n <td>&nbsp;</td>\n <td>&nbsp;</td>\n</tr>\n<tr>\n <td>&nbsp;</td>\n <td>\n <input type=\"submit\" id=\"butSave\" name=\"butSave\" value=\"Save\" style=\"width:100px; height:auto\" />\n <input type=\"submit\" id=\"butUpdate\" name=\"butUpdate\" value=\"Update\" style=\"width:100px; height:auto\" />\n <input type=\"submit\" id=\"butDelete\" name=\"butDelete\" value=\"Delete\" style=\"width:100px; height:auto\" />\n <input type=\"submit\" id=\"butReset\" name=\"butReset\" value=\"Reset\" style=\"width:100px; height:auto\" />\n </td>\n</tr>\n</table>\n</div>\n\n<div id=\"content\">\[email protected](\"Back to List\", \"Index\")\n</div>\n\n}\n\n\nEvery Suggestions will be appreciated."
] | [
"c#",
"javascript",
"jquery",
"asp.net-mvc"
] |
[
"Card payment error 508 -Realex payments error number: 61,754",
"i am using realex payment with iframe\ni can load the payment page correctly, but as soon as i hit 'Pay Now'\nit return Error: 508\nMessage: An error has occurred processing your request. Please contact the merchant whose goods or services you are purchasing quoting the following error number: 61,754\n(most of time it return correct response string either successful and declined) but sometimes it return above error code)\nany idea what is mean and how to solve this issue?\n\r\n\r\n <script type='text/javascript'> \n \n function iRedirect(redirectUrl, arg, value) {\n \n console.log(redirectUrl);\n try {\n var form = $('<form action=\"' + redirectUrl + '\" method=\"post\">' +\n '<input type=\"hidden\" name=\"' + arg + '\" value=\"' + value + '\"></input>' + '</form>');\n $('body').append(form);\n console.log(form);\n $(form).submit();\n }\n catch (e) {\n alert(e.message);\n }\n }\n\n function displayMessage(evt)\n {\n \n var message;\n \n try {\n var iOrigin = '<%=ConfigurationManager.AppSettings[\"RealexResponseDomain\"] %>';\n if (evt.origin == iOrigin) {\n\n message = evt.data.toString();\n console.log(message);\n if (message.indexOf(\"Error\") == 0) {\n var ErrorJsonStr = message.toString().split(\":\");\n var ErrorJsonStr1 = ErrorJsonStr[1].split(\"<BR>\");\n var reDirectPath = \"{\\\"\" + ErrorJsonStr[0] + \"\\\"\" + \":\" + \"\\\"\" + ErrorJsonStr1[0] + \"\\\"\" + \",\" + \"\\\"\" + ErrorJsonStr1[1] + \"\\\"\" + \":\" + \"\\\"\" + ErrorJsonStr[2] + \"\\\"\" + \"}\";\n \n iRedirect(\"Response.aspx\", \"JsonStr\", encodeURIComponent(reDirectPath));\n }\n else {\n if (isJson(message) == true) {\n\n var message1 = JSON.parse(message);\n //alert(message1);\n console.log(message1);\n if (message1.hasOwnProperty('pas_uuid')) {\n iRedirect(\"Response.aspx\", \"JsonStr\", encodeURIComponent(message.toString()));\n }\n else {\n //check if this transaction is already exist\n //do redirect\n //alert(\"not pas_uuid\" + message1);\n console.log(\"not pas_uuid\" + message1);\n }\n }\n }\n //get message and check result\n }\n else {\n console.log(\"not data\");\n }\n }\n \n catch (err) {\n console.log(err.message);\n \n }\n }\n\n function isJson(str) {\n try {\n JSON.parse(str);\n }\n catch (e)\n {\n console.log(e.message);\n return false;\n }\n return true;\n }\n \n if (window.addEventListener) {\n // For standards-compliant web browsers\n window.addEventListener(\"message\", displayMessage, false);\n }\n else {\n window.attachEvent(\"onmessage\", displayMessage);\n }\n\n \n </script>"
] | [
"realex-payments-api",
"global-payments-api"
] |
[
"EditText text selection popup has wrong theme on Android 6.0 only",
"While I was using the Material components for Android (https://material.io/develop/android/docs/getting-started/) I was forced to inherit my application theme from \"MaterialComponent\" instead of the classic \"Theme.AppCompat\" in order to make the material components work. While I was testing the application with the integrated material components, on Android 6.x.x Marshmallow I observed that there is is a strange theme for the popup items when I select a text in any of my EditTexts. \n\nHere is an example with the actual Material theme\n\n\n\nand here is the expected theme \n\n\n\nHas anyone encountered the same issue before?"
] | [
"android",
"android-edittext",
"material-design",
"android-6.0-marshmallow"
] |
[
"How to implement onBackPressed() in Fragments?",
"Is there a way in which we can implement onBackPressed() in Android Fragment similar to the way in which we implement in Android Activity?\n\nAs the Fragment lifecycle do not have onBackPressed(). Is there any other alternative method to over ride onBackPressed() in Android 3.0 fragments?"
] | [
"android",
"android-fragments",
"onbackpressed"
] |
[
"Bitcoinjs browser compile creating empty file",
"I'm attempting to do a build of Bitcoinjs for browser testing folloing the instructions on the BitcoinJS page (included below). \n\n$ npm install -g bitcoinjs-lib\n\n$ npm -g install bitcoinjs-lib browserify uglify-js\n$ browserify -r bitcoinjs-lib -s Bitcoin | uglifyjs > bitcoinjs.min.js\n\n\nWhen I run this is does generate a file called bitcoinjs.min.js but it is empty. Can anyone explain what I'm doing wrong?"
] | [
"javascript",
"node.js",
"browserify",
"bitcoin"
] |
[
"Matching two Social Media Profiles",
"How can you check if two profiles from two different Social Media sites are the same? \nWhat algorithms exist to accomplish this and thereby assigning a weight measure for the match?\n\nLet's say that I have a profile from LinkedIn and another profile from Facebook. I know the properties of these two profiles. What algorithm can I implement to find the matching distance between these two profile.\n\nThanks\nAbhishek S"
] | [
"algorithm",
"math",
"graph",
"graph-theory",
"social-media"
] |
[
"Git push not working, no error",
"I am trying to push my commits to Bitbucket using the command \n\ngit push origin master\n\n\nNothing happens. I am represented with a command prompt, and no error message. When I browse the source online, my code has not been uploaded.\n\ngit remote show\n\n\nreturns \"origin\"\n\ngit push --verbose\n\n\nDoes not show any additional information.\n\nI have pushed many times using this method, but it suddenly just stopped working.\n\nI am using 2.6.1.windows.1 on Windows 10 \n\nUPDATE:\nIt appears to a problem with Git itself. I can't push, pull, or clone any repository on both GitHub or Bitbucket. It seems that any git command that connects to a remote isn't working. \n\nI tried uninstalling and reinstalling git. I tried installing both, 2.6.1 and 2.7.0 (2.7 didn't even install properly on Windows 10 Build 14251). I can interact with the repo without an issue on other computers."
] | [
"git",
"bitbucket"
] |
[
"Anatomy of a C# .NET MVC Controller Class",
"I just installed the free version of the .NET Visual Web Developer 2010 IDE along with version 3 of the ASP.NET MVC framework. I'm new enough to C#, .NET, ASP.NET's MVC Framework that I'm a little confused by the base controller class that was generated for me, and what's a C# language feature vs. possible syntactic sugar being provided by the framework\n\nNamespace MvcApplication1\n Public Class Default1Controller\n Inherits System.Web.Mvc.Controller\n\n '\n ' GET: /Default1\n\n Function Index() As ActionResult\n Return View()\n End Function\n\n End Class\nEnd Namespace\n\n\nSpecifically, \n\n\nIn the tutorials I've found online, a : is used to indicate inheritance, but here it's actually the word Inherits. Does Inherits confer any addition context/features, or is it just another way of saying :? \nThe generated Index method has no return type, or access modifiers. I was under the impression that these were a required part of the method signature in C#. Is this an incorrect assumption? If so, what is the default return type?\nAlso related to the Index method is the trailing as ActionResult, which sort of looks like a return type for the method signature, but is obviously something else. What does this do?\nAre the above differences in the language something that C# is providing me, or is this syntax simplification something that the ASP.NET MVC framework is giving me via meta-programming?\n\n\nFull answers are great, but a pointer towards a tutorial or reference that doesn't assume knowledge of the ASP.NET ecosystem and would get ac experienced programming"
] | [
"c#",
"asp.net-mvc",
"visual-studio-2010"
] |
[
"Automatically scale x-axis by date range within a factor using xyplot()",
"I've been trying to write out an R script that will plot the date-temp series for a set of locations that are identified by a Deployment_ID. \n\nIdeally, each page of the output pdf would have the name of the Deployment_ID (check), a graph with proper axes (check) and correct scaling of the x-axis to best show the date-temp series for that specific Deployment_ID (not check). \n\nAt the moment, the script makes a pdf that shows each ID over the full range of the dates in the date column (i.e. 1988-2010), instead of just the relevant dates (i.e. just 2005), which squishes the scatterplot down into uselessness.\n\nI'm pretty sure it's something to do with how you define xlim, but I can't figure out how to have R access the date min and the date max for each factor as it draws the plots.\n\nScript I have so far:\n\n#Get CSV to read data from, change the file path and name\ndata <- read.csv(file.path(\"C:\\Users\\Person\\Desktop\\\", \"SampleData.csv\"))\n\n#Make Date real date - must be in yyyy/mm/dd format from the csv to do so\ndata$Date <- as.Date(data$Date)\n\n#Call lattice to library, note to install.packages(lattice) if you don't have it\nlibrary(lattice)\n\n#Make the plots with lattice, this takes a while.\ndataplot <- xyplot(data$Temp~data$Date|factor(data$Deployment_ID),\n data=data, \n stack = TRUE, \n auto.key = list(space = \"right\"), \n layout = c(1,1),\n ylim = c(-10,40)\n )\n\n#make the pdf\npdf(\"Dataplots_SampleData.pdf\", onefile = TRUE)\n\n#print to the pdf? Not really sure how this works. Takes a while.\nprint(dataplot)\ndev.off()"
] | [
"r",
"date",
"pdf-generation",
"axis",
"lattice"
] |
[
"python file.write() does not create new line",
"I am new to Python and am following a tutorial on how to write/read text files here. But I ran into an issue where when writing a file, it does not create another line, but just writes directly after the first one. I attached my code below, any help is appreciated greatly!\n\n import os\nimport sys\ndef generate_cdat():\n file = open(\"documents/pytho/login/cdat.txt\", \"w\")\n file.write(\"username[usr]\")\n file.write(\"userpass[1234]\")\n file.close()\ndef getCredentials(checkUsrName, checkUsrPass):\n file = open(\"documents/pytho/login/cdat.txt\", \"r\")\n recievedUsrName = file.readline(1)\n recievedUsrPass = file.readline(2)\n if checkUsrName in recievedUsrPass:\n print(\"recieved username\")\nprint(\"started program\")\nprint(\"checking for constant data file\")\npath = \"cdat.txt\"\nif os.path.exists(path):\n print(\"Constant data found, setting up\")\nelse:\n print(\"Constant data not found, creating constant data.\")\n generate_cdat()\nprint(\"starting login\")\nlogingIn = True\nwhile logingIn == True:\n getUsrName = input(\"Enter username: \")\n getUsrPass = getpass.getpass(\"Enter password: \")\n checkCredentials(getUsrName, getUsrPass)\n\n\nThanks again,\nMax!"
] | [
"python",
"python-3.6"
] |
[
"Entity Framework with mysql, entity without PK",
"I am using EF with MySQL for external database (database from other project that just connected to mine). So I can't change database structure.\n\nThe Database have some tables without PK, but if I am right EF entity should have primary key.\n\nI think that I will not have any problems with just reading the table, I just add Key attribute for any filled in entity. But what if I need to add row to that table with same value on OK? I will get error that PK with same value already exists... \n\nI need any help or suggestions how to work with that tabale. Thanks in advance"
] | [
"c#",
"mysql",
"entity-framework"
] |
[
"Cell Referencing issue: Method 'Range' of Object ' _Worksheet fail on many intersected ranges",
"I am receiving a \n\n\n Method 'Range' of object '_Worksheet failure \n\n\nfor the following code:\n\nOption Explicit\n\nPrivate Sub Worksheet_Change(ByVal Target As Excel.Range)\n\n Dim rngF As Range\n Dim rngC As Range\n Dim aCell As Range\n Dim bCell As Range\n Dim wkSheet1 As Worksheet\n\n 'recursive error prevention\n On Error GoTo Whoa\n Application.EnableEvents = False\n\n '~~> Set your range\n Set wkSheet1 = ThisWorkbook.Worksheets(\"backend\")\n Set rngF = wkSheet1.Range(Cells(\"C5:C500,H5:H500,M5:M500,R5:R500,W5:W500,AB5:AB500,AG5:AG500,AL5:AL500,AQ5:AQ500,AV5:AV500,BA5:BA500,BF5:BF500,BK5:BK500,BP5:BP500,BU5:BU500,BZ5:BZ500,CE5:CE500,CO5:CO500,CT5:500,CY5:CY500,DD5:DD500,DI5:DI500,DN5:DN500,DS5:DS500,DX5:DX500,EC5:EC500\").Address)\n Set rngC = wkSheet1.Range(Cells(\"D5:D500,I5:I500,N5:N500,S5:S500,X5:X500,AC5:AC500,AH5:AH500,AM5:AM500,AR5:AR500,AW5:AW500,BB5:BB500,BG5:BG500,BL5:BL500,BQ5:BQ500,BV5:BV500,CA5:CA500,CF5:CF500,CP5:CP500,CU5:500,CZ5:CZ500,DE5:DE500,DJ5:DJ500,DO5:DO500,DT5:DT500,DY5:DY500,ED5:ED500\").Address)\n\n'fORECAST\nIf Not Application.Intersect(Target, rngF) Is Nothing Then\n\n For Each aCell In rngF\n If aCell.Value <> \"\" Then\n If aCell.Value <> \"N/A,TBC,TBA,TBD\" Then\n If aCell.Value < Date Then\n aCell.ClearContents\n MsgBox \"PAST date not allowed in cell \" & aCell.Address\n\n Else\n\n End If\n End If\n End If\n Next\n End If\n\n 'complete\n If Not Application.Intersect(Target, rngC) Is Nothing Then\n\n For Each bCell In rngC\n If bCell.Value <> \"\" Then\n\n If bCell.Value > Date Then\n bCell.ClearContents\n MsgBox \"Future date not allowed in cell \" & bCell.Address\n\n Else\n\n End If\n\n End If\n Next\n End If\n\nLetscontinue:\n Application.EnableEvents = True\n Exit Sub\nWhoa:\n MsgBox Err.Description\n Resume Letscontinue\nEnd Sub\n\n\nThis code has been adapted from an answer that a user: Siddharth Rout originally answered, found here: ORIGINAL CODE.\n\nNow, I have changed the number of If functions to 2 subsets.\n\nThe first checks that dates are not in the past and ignores \"N/A, TBC,etc\", while the second does exactly the same but for dates in the future. Now, this code works absolutely beautifully when you apply each IF subset to a single range for each: like A5:500 and B5:500. (On a new sheet for example) BUT, I need to apply these rules to work over the ranges specified above. This code is in the 'backend' worksheet of my project, where the ranges to be checked are. I don't know if it makes a difference, but the data that arrives in the backend sheet is generated by a different macro that is coded in the frontend part of the workbook. This macro generates 3 data changes and I receive the error message 3 times, which is good because it tells me that the first macro is inserting as it should and the backend macro recognizes the changes, just obviously is getting stuck on the reference somewhere. Any advice would be greatly appreciated!"
] | [
"vba",
"excel"
] |
[
"Simple Chrome Extension but Issues?",
"Ave!\n\nDear People..\n\nI wanted to make an extension of my \"Google Custom Search Code\"\n\nto show search results from my website in Extension Popup (popup.html)\n\nI am having issues while making an extension from it.\n\n\nWhen I load iframe from local computer The popup is showing Text but the Search Dialog box is not showing.\nWhen I load iframe from GoogleDrive iframe is showing but it takes nearly 3 4 seconds to load.\n------------------ (No. 3 I solved successfully)\nThe Links are not opening in new tab I treid too much please help me to open link in new tab??\n(in Google Search API there was an option Search Features> Advance > Target Link ... I put the value _Blank)\n\n\nThanks alot!\n\nThe codes are as below.\n\nmanifest.json\n\n{\n \"name\": \"Instant Search!\",\n \"description\": \"Search My Blog Instantly!\",\n\n \"version\": \"0.1\",\n \"manifest_version\": 2,\n \"browser_action\": {\n \"default_popup\": \"popup.html\",\n \"default_title\": \"Search My Blog\"\n }\n\n}\n\n\nPopup.html\n\n<html>\n<head>\n\n</head>\n <body>\n <iframe width=\"400\" height=\"400\" \n seamless=\"seamless\"src=\"/QS.html\"></iframe>\n </body>\n</html>\n\n\niframe page\n\n <!DOCTYPE html>\n <html>\n <head>\n<style>\n.cse input.gsc-input, input.gsc-input {\nbackground-image:url('/blank.gif')!important;\n}\n</style> \n </head>\n<body>\n<script>\n (function() {\n var cx = '009043611225946488903:ntz9nyqubzw';\n var gcse = document.createElement('script');\n gcse.type = 'text/javascript';\n gcse.async = true;\n gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +\n '//www.google.com/cse/cse.js?cx=' + cx;\n var s = document.getElementsByTagName('script')[0];\n s.parentNode.insertBefore(gcse, s);\n })();\n</script>\n<gcse:search></gcse:search>\n</body>\n </html>"
] | [
"javascript",
"json",
"html",
"iframe",
"google-chrome-extension"
] |
[
"Spring Tomcat : Non-whitespace characters are not allowed in schema elements . Saw '301 Moved Permanently'",
"I am trying to bring up a tomcat server, and am facing problems with loading definitions of spring beans. The applicationContext.xml reads as follows :\n\n<beans xmlns=\"http://www.springframework.org/schema/beans\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:context=\"http://www.springframework.org/schema/context\"\n xmlns:tx=\"http://www.springframework.org/schema/tx\"\n xmlns:aop=\"http://www.springframework.org/schema/aop\" xmlns:task=\"http://www.springframework.org/schema/task\" xmlns:hz=\"http://www.hazelcast.com/schema/spring\"\n xmlns:mongo=\"http://www.springframework.org/schema/data/mongo\"\n xmlns:solr=\"http://www.springframework.org/schema/data/solr\" xmlns:elasticsearch=\"http://www.springframework.org/schema/data/elasticsearch\"\n xsi:schemaLocation=\"http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd\n http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd\n http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd\n http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd\n http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd\n http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo-1.5.xsd\n http://www.hazelcast.com/schema/spring META-INF/hazelcast-spring-2.0.xsd\n\n http://www.springframework.org/schema/data/solr http://www.springframework.org/schema/data/solr/spring-solr.xsd\n\n\n http://www.springframework.org/schema/data/elasticsearch http://www.springframework.org/schema/data/elasticsearch/spring-elasticsearch.xsd\">\n ..\n ..\n ..\n ..\n\n\nThe IDE (Idea) says it is unable to resolve the file hazelcast-spring-2.0.xsd\n\nThe error log says: \n\n13:19:59,909 INFO [localhost-startStop-1][XmlBeanDefinitionReader] - Loading XML bean definitions from class path resource [applicationContext.xml]\n13:20:02,964 ERROR [localhost-startStop-1][ContextLoader] - Context initialization failed\norg.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 2 in XML document from class path resource [applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; systemId: http://hazelcast.com/schema/spring/hazelcast-spring-2.0.xsd; lineNumber: 2; columnNumber: 35; s4s-elt-character: \n**Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw '301 Moved Permanently'.**\n\n\nWhat am I doing wrong here ? I did not touch this file."
] | [
"java",
"spring",
"tomcat",
"hazelcast"
] |
[
"iOS Addressbook: Cannot setup an ABNewPersonViewController in storyboard",
"I have a subclass of ABNewPersonViewController defined in storyboard, and embedded there in a navigation controller, as required by the docs. The navigation controller is itself controlled by a tab bar controller. In the identity inspector, the class has been set to the subclass.\n\nIn the subclassed ABNewPersonViewController I do the test initialization in viewDidLoad: \n\n- (void)viewDidLoad\n{\n [super viewDidLoad];\n self.newPersonViewDelegate = self;\n\n ABRecordRef newPerson= ABPersonCreate();\n CFErrorRef error = NULL;\n ABRecordSetValue(newPerson, kABPersonFirstNameProperty, CFSTR(\"First\"), &error);\n ABRecordSetValue(newPerson, kABPersonLastNameProperty, CFSTR(\"Last\"), &error);\n assert(!error);\n [self setDisplayedPerson:newPerson];\n} \n\n\nIn my subclass I have also implemented the delegate method newPersonViewController:didCompleteWithNewPerson:, but this does not matter.\nWhen I select the tab in the tab bar controller, a black screen is displayed.\nAny idea what I am doing wrong?\nPS: I know how to set it up programmatically, but I would like to do it in storyboard.\n\nEDIT \n\nWhen I do it programmatically, the subclass is initialized by alloc & init. This works correctly. When the subclass is instantiated from storyboard, it receives initWithCoder:. To test it, I implemented initWithCoder: in the following way: \n\n- (id)initWithCoder:(NSCoder*)coder{ \n self = [super init]; \n return self; \n}\n\n\nIn this case, the entry mask of ABNewPersonViewController is indeed displayed, but the navigation bar is not shown empty. I know this initialization hack is wrong, but does anybody know how to do it right? \n\nEDIT \n\nThe navigation bar was not shown, because I set it to hidden. Normally, it is shown, but the buttons \"done\" and \"cancel\" are missing. This is of course no surprise, because the superclass is not initialized by initWithCoder: but by init.\nStill the question is why the entry mask is not shown, but a black screen only."
] | [
"ios",
"storyboard",
"abaddressbook"
] |
[
"Migrating from Ant to gradle build android studio",
"I have an existing ANT build project build using Intelli J . I want to migrate it to Gradle build .What to do?\nI have Android studio also."
] | [
"android",
"android-studio",
"gradle"
] |
[
"Is \"utf-8-sig\" suitable for decoding both UTF-8 and UTF-8 BOM?",
"I am using the Python CSV library to read two CSV files.\nOne is encoded with UTF-8-BOM, another is encoded with UTF-8. In my practice, I found that both files could be read by using "utf-8-sig" as encoding type:\nfrom csv import reader \nwith open(file_path, encoding='utf-8-sig') as csv_file:\n c_reader = reader(csv_file, delimiter=',')\n headers = next(c_reader) \n for row in c_reader:\n print(row)\n\nI want to confirm, is "utf-8-sig" suitable for decoding both UTF-8 and UTF-8 BOM?\nI am using Python version 3.6 and 3.7. Thanks for your answers!"
] | [
"python",
"csv",
"utf-8",
"character-encoding"
] |
[
"EmptyResultSetException not thrown when expected",
"A query is run to retrieve records from a table one-by-one, which are email recipients. After sending an email to a recipient, the status of the sending is updated for the recipient. The table where this status is stored has a relationship with the table used to store the actual messages to be sent. Because I'm using Room, the query for retrieving the message to send gets automatically run again. This will continue in a loop until all the recipients have been sent an email. This works with the Rx stream below. The problem I have is that after the last email is sent, the query is not throwing an EmptyResultSetException, which is what I expect it to do when no more records are found. Without that exception, I have no way of knowing when all the emails have been sent.\n\nval msgToSendPublisher = BehaviorSubject.createDefault(0)\n\nmsgToSendPublisher.flatMap { startPos -> App.context.repository.getMessageToSend() }\n .flatMap { messageToSend ->\n App.context.repository.sendMessage(messageToSend)\n .doOnError {\n messageToSend.failureSending = true\n }\n }\n .zipWith( // 1 second delay between emissions.\n Observable.interval(1, TimeUnit.SECONDS),\n BiFunction { item: MessageToSend, _: Long -> item })\n .flatMap { messageToSend ->\n App.context.repository.storeMessageSent(messageToSend)\n .doOnError {\n messageToSend.failureSending = true\n }\n }\n .subscribeOn(Schedulers.io())\n .observeOn(AndroidSchedulers.mainThread())\n .subscribe(\n { messageToSend ->\n\n },\n { ex ->\n if (ex is EmptyResultSetException) {\n\n } else {\n\n }\n },\n {\n // Done\n }\n )\n\n\nDAO\n\n@Query(\n \"SELECT blah blah blah\"\n)\nfun getMessageToSend(): Observable<MessageToSend>\n\n\nMessageToSend.kt\n\nclass MessageToSend(\n var content: String? = null,\n var chatId: String? = null,\n var firstName: String? = null,\n var lastName: String? = null,\n var totalMessagesToSend: Int? = null\n): MessageRecipientBase()\n\n\nWhat could be preventing EmptyResultSetException from not being thrown? Or is it being thrown but caught somewhere I am not aware of. I have a suspicion that Room only throws this exception when you explicitly run a query. But if a query is run because Room forces a query to run after data in a related table is updated, it is possible that Room may decide not to throw any exception.\n\nNOTE: I've put a breakpoint on each of the doOnError handlers as well as the error handler in the subscriber but none of them get hit."
] | [
"android-room"
] |
[
"UWP Deployment Error :: DEP0001 : Unexpected Error: -2146958844",
"I am facing \"DEP0001 : Unexpected Error: -2146958844\" error while deploying a game in WP.\n\nCode does not contain anything. Its simple a Hello World program made in Unity & exported as \"Windows Store\" Project. Then I open that windows build in VS and deploy. \n\nUnity Version : 5.3.5f1\n\nVisual Studio : Microsoft Visual Studio Professional 2015 Version 14.0.25425.01 Update 3\n\nDevelopment PC OS : Win 8.1"
] | [
"c#",
"unity3d",
"visual-studio-2015",
"windows-phone",
"windows-store-apps"
] |
[
"AddThis with Vue shares wrong links",
"So I have a page that uses AddThis for link sharing and Vue for rendering. Now, the page displays a list of links with multiple pages. On the first page all sharing works as expected, but on the second page, it uses the links from the first page.\n\nAn example to reproduce this:\n\n\r\n\r\nnew Vue({\r\n el: '#app',\r\n data: {\r\n pages: [\r\n [{\r\n url: 'http://google.com',\r\n title: 'Google'\r\n }],\r\n [{\r\n url: 'http://yahoo.com',\r\n title: 'Yahoo'\r\n }]\r\n ],\r\n currentPage: 0\r\n },\r\n computed: {\r\n items() {\r\n return this.pages[this.currentPage]\r\n }\r\n },\r\n methods: {\r\n switchPage() {\r\n if (this.currentPage === 0) {\r\n this.currentPage = 1;\r\n } else {\r\n this.currentPage = 0;\r\n }\r\n }\r\n }\r\n})\r\n<script src=\"https://unpkg.com/vue\"></script>\r\n\r\n<div id=\"app\">\r\n <div class=\"sharer\" v-for=\"item in items\">\r\n <div class=\"addthis_inline_share_toolbox\" :data-url=\"item.url\" :data-title=\"item.title\">{{ item.title }}</div>\r\n </div>\r\n <button @click=\"switchPage\">Switch pages</button>\r\n</div>\r\n\r\n<script src=\"https://s7.addthis.com/js/300/addthis_widget.js#pubid=ra-57f620a4f185d54b\"></script>\r\n\r\n\r\n\n\nWhen on the first page, AddThis correctly shares the Google homepage. But when on the second page, it doesn't pick up the data-* tags for sharing Yahoo.\n\nNote: You can't really run the StackOverflow snippet here because AddThis wants to access cookies which the sandboxed iframe forbids. A running version can also be found at https://jsfiddle.net/d1az3qb3/3/. Please remember to disable ad-blockers to let AddThis load.\n\nWhat I already tried\n\n\nRunning addthis.layers.refresh() after switching pags\nRunning addthis.toolbox('.addthis_inline_share_toolbox')\n\n\n(Both directly and in this.$nextTick(() => …))\n\nQuestion\n\nIs AddThis just broken, is it incompatible with Vue or is there a way to make it work?"
] | [
"javascript",
"vue.js",
"addthis"
] |
[
"Api multiple request httpful.phar Fatal error",
"I want to get 2 different sets of data using 2 different apis and display it on the same page. The first dataset displays fine however when doing the second request i get the error:\nWarning: Constant already defined in C:\\xampp\\htdocs\\exempel\\biblo\\httpful.phar on line 7\nFatal error: Cannot declare class Httpful\\Bootstrap, because the name is already in use in phar://C:/xampp/htdocs/exempel/biblo/httpful.phar/Httpful/Bootstrap.php on line 11\nWhat am i doing wrong?\nIs it possible to send 2 requests like this or do i have to solve it some other way?\nI am using the standard httpful.phar,\nThe code used here is just example code for my real project however the problem is the same, that i cannot do 2 requests.\nIf any more information is needed i am happy to provide it!\nThanks and have a good day!\nCode bellow:\n<?php\n include('../biblo/httpful.phar');\n\n $url = "http://api.scb.se/OV0104/v1/doris/sv/ssd/START/MI/MI0307/MI0307T1";\n\n $postKod = '{ "query":[\n {\n "code":"ContentsCode",\n "selection":{\n "filter":"item",\n "values":[\n "000000XV",\n "000000VA"\n ]\n }\n },\n {\n "code":"Tid",\n "selection":{\n "filter":"item",\n "values":[\n "2015"\n ]\n }\n }\n ],\n "response":{\n "format": "px"\n }\n }'; \n\n\n $response = \\Httpful\\Request::post( $url )\n ->body( $postKod )\n ->send();\n\n echo $response;\n\n?>\n\n<?php\n include('../biblo/httpful.phar');\n\n $url = "http://api.scb.se/OV0104/v1/doris/sv/ssd/START/MI/MI0307/MI0307T1";\n \n $postKod ='{ "query":[\n {\n "code":"ContentsCode",\n "selection":{\n "filter":"item",\n "values":[\n "000000XV",\n "000000VA"\n ]\n }\n },\n {\n "code":"Tid",\n "selection":{\n "filter":"item",\n "values":[\n "2015"\n ]\n }\n }\n ],\n "response":{\n "format": "px"\n }\n}'; \n\n $response2 = \\Httpful\\Request::post( $url )\n ->body( $postKod )\n ->send();\n\n\n echo $response2;\n\n?>\n\nMap structure\nerror message"
] | [
"php",
"api",
"httpful"
] |
[
"bigQuery Google Drive Sheets multiple worksheets in one sheet",
"I have created 3 Google Cloud bigQuery tables mapping to 3 worksheets in a single Google Sheets sheet. I have named the 3 tables according to the 3 worksheet names, and I can run SQL queries against the tables.\n\nMy problem is that the results from the query always show the records in the first worksheet within the spreadsheet, not the second or third worksheet.\n\nIs it possible to associate BigQuery tables to different worksheets of the same Google Sheets document? If not, is the only solution to have 3 separate sheet documents each with the first worksheet being the one with the records that BigQuery will query?"
] | [
"google-sheets",
"google-drive-api",
"google-bigquery"
] |
[
"change background of one element and all its children when it is hovered jquery",
"I have a table which all <tr> that contains a lot of <div> and each one can contains many others (they are generated automatically)\n\nthen, I want to change backgounrd-color of each <tr> and all of children (<div> and children of <div> (others div)) when the mousemove the <tr> \n\nthen I used this : \n\n$('.ui-datagrid-column').live('mousemove',function(){\n $(this).css('background-color', 'red');\n $(this).children().css('background-color', 'red');\n //ui-layout-unit-content ui-widget-content\n\n });\n //.ui-layout-container\n $('.ui-datagrid-column').live('mouseleave',function(){\n $(this).css('background-color', 'white');\n $(this).children().css('background-color', 'white');\n });\n\n\nbut it doesn't change the background of the div inside the <tr>\n\nhow can I achive that"
] | [
"jquery",
"css",
"dynamic",
"hover",
"children"
] |
[
"Possibility of assumption in C#",
"Can I make assumptions on the casted int value of system enums in C#?\n\nFor example:\n\n//DayOfWeek\n(int)DayOfWeek.Monday == 1,\n(int)DayOfWeek.Tuesday == 2,\n(int)DayOfWeek.Wednesday == 3,\n(int)DayOfWeek.Thursday == 4,\n(int)DayOfWeek.Friday == 5,\n(int)DayOfWeek.Saturday == 6,\n(int)DayOfWeek.Sunday == 0\n\n\nThe logic of my code depends on it. However, I don't feel like writing my own mapping, because it... is just a wrong solution.\n\nEDIT\nAlso here comes the culture thing as well. The ISO standard - Monday the 1st day. In USA - Sunday the 1st day."
] | [
"c#",
"enums"
] |
[
"getting numbers from stdin to an array in C",
"I'm trying to get numbers from stdin to an array. the first number in stdin is the number of elements in the array (the number can be any int).\nI did this to get the first number:\n\nwhile(c=getchar()!=' '){\nn*=10;\nn+=atoi(c);\n}\n\n\nAnd then created an array of size n.\nNow I need to go through all the rest\n\n while(c=getchar()!=EOF)\n\n\nand add numbers to the array. The numbers are separated by \\t and sometimes \\n as well.\nHow would I do that? I've been thinking for an hour and still haven't got a working code.\nAny help?\nThanks!"
] | [
"arrays",
"getchar",
"atoi"
] |
[
"Monitoring apache's load with php",
"UPDATE: thanks to all the answer given, but they are all about the system load, and not the apache.\n\nMy goal is to understand, inside my php scripts (the templating ones), when apache have an high load and is prefearrable to fork some traffic on lighttpd, that is here just to the long-polling and to light the apache's load.\n\nHi guys, after this question i've started to use lighttpd for a long-polling service on my server, in order to not to nuke apache and the database forn this kind of requests.\n\nThen, i started to use lighttpd also to static content (images, css, js, and so on).\n\nSo, actually, i have example.com served by apache, and polling.example.com served by lighttpd, both using memcache to reduce the database hits.\n\nIn apache, i've set the proxy module to proxy out all the requests to example.com/polling/* at polling.example.com/*\n\nNow, im wondering if there is a way to retrieve the apache server load in php, in order to redirect even other ajax requests on lighttpd if apache have an high load.\n\nI mean, something like:\n\n<?php\n$apache_server_load = /*hot to retrieve this value?*/;\nif($apache_server_load >= $my_defined_max_load){\n $ajax_domain = '/polling';\n}else{\n $ajax_domain = '';\n}\n?>\n<script>\n [...]\n $.ajax({\n url: '<?php echo $ajax_domain; ?>/mypage.php',\n [...]\n });\n [...]\n</script>\n\n\nedit im running on Debian\n\np.s: i'll also like to hear if this solution can be a nice approach, but would be another question.. feel free to comment if you like."
] | [
"php",
"apache",
"apache2"
] |
[
"Postback not working on mouse click in Safari",
"So I have a dropdown context box, which I use to select which item I am going to be working with.\n\nNow everything seems to be working on all browsers except Safari. I have a type function that works fine in safari if you focus on the box and type the name in and hit enter. However my issue is with the mouse click. If I select an item from the dropdown and click it, the postback doesn't work until I hit enter on the keyboard.\n\nHere is my .ascx.cs file\n\n...\nif (cboContext.Visible)\n {\n string postBackFunction = \"function contextPostback() {\\n\"\n + \"var newValue = document.getElementById(\\\"\" + cboContext.ClientID + \"\\\").value;\\n\"\n + \"if (newValue != \" + cboContext.SelectedValue + \") \" + Page.ClientScript.GetPostBackEventReference(cboContext, \"\") + \";\\n}\";\n\n Page.ClientScript.RegisterClientScriptBlock(typeof(string), \"contextPostback\", postBackFunction, true);\n\n if (Request.UserAgent.ToLower().IndexOf(\"chrome\") > -1)\n {\n cboContext.Attributes.Add(\"onkeypress\", \"if (typeAhead(event,'\" + cboContext.ClientID + \"') == 1) contextPostback();\");\n cboContext.Attributes.Add(\"onclick\", \"contextPostback();\");\n }\n else if (Request.UserAgent.ToLower().IndexOf(\"safari\") > -1)\n {\n cboContext.Attributes.Add(\"onclick\", \"contextPostback();\");\n cboContext.Attributes.Add(\"onkeypress\", \"if (typeAhead(event,'\" + cboContext.ClientID + \"') == 1) contextPostback();\");\n cboContext.Attributes.Add(\"onkeydown\", \"if (typeAhead(event,'\" + cboContext.ClientID + \"') == 1) contextPostback();\");\n cboContext.Attributes.Add(\"onkeyup\", \"if (typeAhead(event,'\" + cboContext.ClientID + \"') == 1) contextPostback();\");\n }\n else\n {\n\n cboContext.Attributes.Add(\"onkeydown\", \"if (typeAhead(event,'\" + cboContext.ClientID + \"') == 1) contextPostback();\");\n cboContext.Attributes.Add(\"onclick\", \"contextPostback();\");\n }\n }\n\n\nHere is the typeAhead() function\n\nfunction typeAhead(e, nextFocus) {\n\n//don't trap Ctrl+keys\nif ((window.event && !window.event.ctrlKey) || (e && !e.ctrlKey)) {\n\n // timer for current event\n var now = new Date();\n\n ....\n if (inputBuffer.accumString == \"\" || now - inputBuffer.last < inputBuffer.delay) {\n //check for browsers\n var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;\n var is_safari = navigator.userAgent.toLowerCase().indexOf('safari') > -1;\n // make shortcut event object reference\n var evt = e || window.event;\n // get reference to the select element\n var selectElem = evt.target || evt.srcElement;\n // get typed character ASCII value\n var charCode = evt.keyCode || evt.which;\n // get the actual character, converted to uppercase\n var newChar = \"\";\n // get reference to the actual form selection list\n // added cross browser fix to enable the context switcher to work properly\n if (is_chrome) {\n var selection = document.getElementById(\"ctl00_ContextSwitch1_cboContext\").selectedIndex;\n }\n else {\n var selection = document.getElementById(nextFocus);\n }\n....\n\n\nNow I have a section in the typeAhead for the chrome browser, but everything I try for safari doesn't seem to allow me to use the mouse click to select an item.\n\nAny help would be appreciated."
] | [
"c#",
"javascript",
"asp.net",
"safari"
] |
[
"\"Click to use Flash\" button doesn't always show on Safari",
"I'm working on a site that uses a video recorded via the user's webcam. The recorder library is not my code, but at a high level, it tries to use HTML5 (Media Recorder API) where possible and falls back onto Flash where not. On Safari, this means Flash. Basically, I supply the library with a div where I want the recorder to appear and it inserts it there.\n\nHowever, some of my users were reporting confusion on Safari (the video recorder was not showing up) and I was able to reproduce this confusing situation. With Safari 12.0 on Mac OS 10.13.6 with Adobe Flash installed and enabled in Safari:\n\n\n\nwhen I navigate to the page with the video recorder, I expect to see a \"Click to use Flash\" button on the video recorder area. But, when I first load the page, the area is complete blank. Strangely, it appears that the button is indeed there, but just not showing:\n\n\nWhen I click on the area where the button should be, it responds (and prompts me to enable flash)\nWhen I open the Web Inspector tool, the button appears (you can also see the code for the Flash object here that gets inserted dynamically)\n\n\n\n\n\nWhen I simply resize the window, the button appears\n\n\n\n\nI don't use Safari as my regular browser, so it's not like I have a highly customized configuration. Unless I'm missing something, this feels like a bug in Safari (I filed a bug report, but they specifically say they do not respond). \n\nI've tried some javascript tricks to \"re-draw\" the element (e.g. hide then show) to try and get the button to show up right away, but without any luck. Obviously I can't tell users \"resize the window\" or \"click in the middle where there is supposed to be a button\".\n\nAny ideas what could be causing this and how to fix it?"
] | [
"javascript",
"flash",
"safari"
] |
[
"The set seed value won't provide the right output of numbers",
"When I enter 42 for the seed value, it provides a certain sequence of numbers and reproduces the same ones every time the program is used. But the sequence of numbers in my program doesn't match up with the sequence of numbers in another program. I need to figure out how to make both of them provide the same output of random numbers when both seed values are set to 42. Is this the correct format for getting a seed value from the user? What could be causing the numbers to not match up? Thanks for the help.\n\npublic class SampleTest {\n\n public static void main(String[] args) {\n\n System.out.println(\"Please enter a seed value: \");\n\n Scanner in = new Scanner(System.in);\n seed = in.nextInt();\n Random ranGen = new Random(seed);"
] | [
"java",
"random"
] |
[
"Method definition in ruby (like sinatra)",
"I do not know where Sinatra methods (like get or params) are defined. According to base.rb, they are static parts of Sinatra's Base class. How can I call them anywhere by just writing get? Shouldn't I write something like Sinatra::Base.get instead? And how can I define things like that by myself?"
] | [
"ruby",
"sinatra"
] |
[
"fit() got an unexpected keyword argument 'generator'",
"epochs = 150\ncallbacks_list=[ModelCheckpoint(save_best_only=False,filepath=checkpoint_path),TensorBoard(log_dir='logs')]\nhistory = model.fit(generator=gen_tr,steps_per_epoch=200,\n epochs=epochs,\n validation_data=gen_val,\n validation_steps=1,\n callbacks = callbacks_list )\n\nError message- TypeError : fit() got an unexpected keyword argument 'generator'\nIn documentation it is written that Model.fit supports generator now, but still it shows error."
] | [
"tensorflow",
"tf.keras"
] |
[
"Do not know how to get this pdfbox annotation example to run",
"Hi I found this example of pdfbox using annotation:\n\nhttps://svn.apache.org/repos/asf/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/AddAnnotations.java\n\nWhen I try to run it in netbeans, nothing happens except to print in output:\n\nUsage: add_annotation_exp1.Add_annotation_exp1$AddAnnotations\n\nNot sure what I am doing wrong"
] | [
"java",
"netbeans",
"pdfbox"
] |
[
"sharethis is stopping page to load in IE 8",
"I have a sharethis link on my site having the below mentioned code ...\n\n <script type=\"text/javascript\">\n addthis_url = location.href;\n addthis_title = document.title;\n </script>\n <script type=\"text/javascript\" src=\"http://s7.addthis.com/js/addthis_widget.php?v=12\"></script>\n\n\nBut this is not working as the page stops loading after the addthis_widget.php like . I even changed the code to newer version i.e.\n\n<!-- AddThis Button BEGIN --> <a class=\"addthis_button\"></a> <script type=\"text/javascript\" src=\"http://s7.addthis.com/js/250/addthis_widget.js?pub=ogmios\"></script> <!-- AddThis Button END -->\n\n\nBut this code is too stopping the page load in IE8.\n\nAny help will be appreciated.\n\nThanks\nJawed"
] | [
"sharethis"
] |
[
"How to create a function to be re-used for later within another function",
"I got this code:\n\n$(document).ready(function(){\n $(\".nextForm\").on('click',(function(){\n //check criteria\n if(selectedSlots.length < 1 ||$(\"#positionAppliedFor\").get(0).value.length < 1 ||$(\"#maxAmountOfHours\").get(0).value.length < 1){\n //error messages and array \n var errorForSlots= \"<h5>Select at least one availability slot</h5>\";\n var errorForPosition = \"<h5>Enter the position you wish to apply for<h5>\";\n var errorForHours = \"<h5>Enter the amount of hours you would like to work<h5>\";\n var errors = [];\n\n //add errors to array\n if(selectedSlots.length < 1){errors.push(errorForSlots)};\n if($(\"#positionAppliedFor\").get(0).value.length < 1){errors.push(errorForPosition)};\n if($(\"#maxAmountOfHours\").get(0).value.length < 1){errors.push(errorForHours)};\n\n //create message\n var div = \"<div id=\\\"sectionError\\\">\";\n if($(\"#sectionError\").length > 0){$(\"#sectionError\").html('')};\n $(div).appendTo($(this).get(0).parentNode); \n for(var i = 0; i < errors.length; i++){\n $(errors[i]).appendTo($(\"#sectionError\"));\n console.log(errors[i]);}\n $(\"</div>\").appendTo($(this).get(0).parentNode); \n } else {\n $(\"#applicationDetails\").slideUp();\n $(\"#personalDetails\").slideDown();\n if($(\"#sectionError\").length > 0){$(\"#sectionError\").remove()};\n }\n console.log(\"function finished\");\n }));\n\n\nIt all works perfectly, however, I am trying to figure out how to create a function for \n\n//create message\n var div = \"<div id=\\\"sectionError\\\">\";\n if($(\"#sectionError\").length > 0){$(\"#sectionError\").html('')};\n $(div).appendTo($(this).get(0).parentNode); \n for(var i = 0; i < errors.length; i++){\n $(errors[i]).appendTo($(\"#sectionError\"));\n console.log(errors[i]);}\n $(\"</div>\").appendTo($(this).get(0).parentNode); \n\n\nI am planning to re-use this for few other sections on my form and rather than copy/paste I would like to get some help on making my code tidier.\n\nI did try:\n\nfunction myFunction(){\n//message code here\n}\n$(document).ready(function(){\n $(\".nextForm\").on('click',(function(){\n//check criteria\n...\n//add errors\n...\n//call func\nmyFunction();\n(I also tried this.myFunction();)\n...\n}));\n});\n\n\nHowever, that ended up in TypeError and I don't know where to begin...\nI am also concerned about the \"this\" in my message code so I am also not sure how to address that in my new function... \n\nAdmitedly I am a newbie at this and I do not exactly understand all the ins and outs, hopefully you will be able to help.\n\nMaybe there is a better way of doing this?\nLet me know your thought either way!\nThanks."
] | [
"javascript",
"jquery"
] |
[
"Opening and reading multiple netcdf files with RnetCDF",
"Using R, I am trying to open all the netcdf files I have in a single folder (e.g 20 files) read a single variable, and create a single data.frame combining the values from all files. I have been using RnetCDF to read netcdf files. For a single file, I read the variable with the following commands:\n\nlibrary('RNetCDF')\nnc = open.nc('file.nc')\nlw = var.get.nc(nc,'LWdown',start=c(414,315,1),count=c(1,1,240))\n\n\nwhere 414 & 315 are the longitude and latitude of the value I would like to extract and 240 is the number of timesteps.\n\nI have found this thread which explains how to open multiple files. Following it, I have managed to open the files using:\n\n filenames= list.files('/MY_FOLDER/',pattern='*.nc',full.names=TRUE)\n ldf = lapply(filenames,open.nc)\n\n\nbut now I'm stuck. I tried \n\n var1= lapply(ldf, var.get.nc(ldf,'LWdown',start=c(414,315,1),count=c(1,1,240)))\n\n\nbut it doesn't work. \nThe added complication is that every nc file has a different number of timestep. So I have 2 questions: \n\n1: How can I open all files, read the variable in each file and combine all values in a single data frame? \n2: How can I set the last dimension in count to vary for all files?"
] | [
"r",
"netcdf"
] |
[
"setTimeout and .click for images HTML",
"I have an animated gif that doesn't have a loop. I want to display images on top of the gif after about 6 seconds. I would like some images to have an onlick event that scrolls to a section of the page(embedded code), some that displays box/container, and others that open a link. I have figured out how to place the images on top of the gif but I can't seem to get the setTimeout or onclick functions to work. I am using weebly so I am placing the script in the html. \n\n<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n <script type=\"text/javascript\" defer>\n setTimeout(function(){\n document.querySelector(\".contact-icon\").style.display = 'inline-block';},6000)\n</script>\n<script type=\"text/javascript\" defer>\n$(\".contact-icon\").click(function() {\n $('html,body').animate({\n scrollBottom: $(\".contact\").offset().bottom},\n 'slow');});\n </script>\n</head>\n<div id=\"tablet-container\">\n <img src=\"/files/theme/tablet.gif\" height=\"645\" width=\"960\" style=\"padding:65px;\"/>\n <div id=\"contact-icon-container\">\n <a href=\"#\" class=\"sprite contact-icon\"></a> \n </div>\n <div id=\"gallery-icon-container\">\n <a href=\"#\" class=\"sprite gallery-icon\"></a>\n </div>\n <div id=\"gmail-icon-container\">\n <a href=\"#\" class=\"sprite Communcation-gmail-icon\"></a>\n </div>\n <div id=\"piechart-icon-container\">\n <a href=\"#\" class=\"sprite piechart-icon\"></a>\n </div>\n <div id=\"linkedin-icon-container\">\n <a href=\"#\" class=\"sprite LinkedIn_logo_initials\"></a>\n </div>\n </div>\n\n\n \n\n<css>\n.sprite {\nbackground: url(sprites.png) no-repeat;\ndisplay:inline-block;\n}\n.Communication-gmail-icon{\nbackground-position: 0 0;\nwidth: 66px;\nheight: 66px;\n}\n.Communication-gmail-icon:hover, .Communication-gmail-icon:active{\nbackground-position: -96px 0;\nwidth: 66px;\nheight: 66px;\n}\n.contact-icon{\nbackground-position: 0 -77px ;\nwidth: 66px;\nheight: 66px;\n}\n.contact-icon:hover, .contact-icon:active{\nbackground-position: -95px -75px ;\nwidth: 66px;\nheight: 66px;\n}\n.gallery-icon{\nbackground-position: 0 -322px ;\nwidth: 66px;\nheight: 66px;\n}\n.gallery-icon:hover, .gallery-icon:active{\nbackground-position: -97px -321px ;\nwidth: 66px;\nheight: 66px;\n}\n.LinkedIn_logo_initials{\nbackground-position: -200px -83px ;\nwidth: 66px;\nheight: 66px;\n}\n.LinkedIn_logo_initials:hover, .LinkedIn_logo_initials:active{\nbackground-position: -295px -83px ;\nwidth: 66px;\nheight: 66px;\n}\n.piechart-icon{\nbackground-position: -198px -324px ;\nwidth: 66px;\nheight: 66px;\n}\n.piechart-icon:hover, piechart-icon:active{\nbackground-position: -292px -324px ;\nwidth: 66px;\nheight: 66px;\n}\n/*Positioning for icons on top of Gif*/\n#contact-icon-container{\nposition:relative;\ntop:-280px;\nright:120px;\n}\n/*etc.......*/\n\n\nHere is the a link to the JsFiddle\n\nhttps://jsfiddle.net/wp6uLksw/"
] | [
"javascript",
"jquery",
"html",
"css"
] |
[
"How can I return a string properly in C",
"I'm having a simple question to make, because I can't really find the way to return a string from a function and put it in another string. My code in C is this:\n\n#include <string.h>\n#include <stdlib.h>\n#include <stdio.h>\n\nchar *func();\n\nint main()\n{\n char *temp = malloc(sizeof(char) * 25);\n\n temp = func();\n printf(\"String received: %s\\n\", temp);\n\n return 0;\n}\n\nchar *func()\n{\n char str[25];\n\n strcpy(str, \"HEY THERE!\");\n printf(\"String sent: %s\\n\", str);\n\n return str;\n}\n\n\nI get this result:\nString sent: HEY THERE!\nString received:\n\nAny idea how to do it properly? Thanks"
] | [
"c",
"string",
"function",
"char",
"return"
] |
[
"Are series lines possible in python-pptx?",
"In powerpoint the lines connecting the two columns in the image below are called series lines. Is it possible to create these via python-pptx?"
] | [
"python",
"powerpoint",
"python-pptx"
] |
[
"Run flash game in headless chrome using puppeteer",
"How can I run a flash game in headless chrome using puppeteer? I'm trying to screenshot this flash game but the game doesn't run and is replaced by \"Couldn't load plugin\" text.\n\nHere's the relevant code I used to generate the screenshot and its output, running in ubuntu on windows subsystem linux:\n\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox']});\n const page = await browser.newPage();\n await page.setViewport({width: 1243, height: 882});\n await page.goto('http://www.bigfuntown.com/Game-59.html');\n await page.screenshot({path: 'game.png'});\n\n await browser.close();\n})();"
] | [
"node.js",
"google-chrome",
"flash",
"puppeteer",
"google-chrome-headless"
] |
[
"Passing managed callback to DllImport (ed) function",
"I had a piece of code that throwed exception with respect garbage collected delegate being called by unmanaged function. This is the code:\n\n// Setup Callback functions\nerrorCode = gsapi_set_stdio(ghostScriptPtr, new StdioMessageEventHandler(RaiseStdInCallbackMessageEvent), new StdioMessageEventHandler(RaiseStdOutCallbackMessageEvent), new StdioMessageEventHandler(RaiseStdErrCallbackMessageEvent));\n\nif (errorCode >= 0)\n{\n try\n {\n //GC.SuppressFinalize(this);\n // Init the GhostScript interpreter\n errorCode = gsapi_init_with_args(ghostScriptPtr, commandParameters.Length, commandParameters);\n\n // Stop the Ghostscript interpreter\n gsapi_exit(ghostScriptPtr);\n }\n finally\n {\n // Release the Ghostscript instance handle\n gsapi_delete_instance(ghostScriptPtr);\n }\n}\n\n\n_Raise... variables passed to function are being disposed before being called by the function.\n\nI don't know what occurred to me, but I changed the callbacks into variables:\n\nvar _RaiseStdInCallbackMessageEventHandler = new StdioMessageEventHandler(RaiseStdInCallbackMessageEvent);\nvar _RaiseStdOutCallbackMessageEventHandler = new StdioMessageEventHandler(RaiseStdOutCallbackMessageEvent);\nvar _RaiseStdErrCallbackMessageEventHandler = new StdioMessageEventHandler(RaiseStdErrCallbackMessageEvent);\n// Setup Callback functions\nerrorCode = gsapi_set_stdio(ghostScriptPtr, _RaiseStdInCallbackMessageEventHandler, _RaiseStdOutCallbackMessageEventHandler, _RaiseStdErrCallbackMessageEventHandler);\n\n\nand finally block to:\n\n finally\n {\n // Release the Ghostscript instance handle\n gsapi_delete_instance(ghostScriptPtr);\n _RaiseStdInCallbackMessageEventHandler = _RaiseStdOutCallbackMessageEventHandler = _RaiseStdErrCallbackMessageEventHandler = null;\n }\n\n\nand it fixed the issue. Why? I don't know. Perhaps it's just a coincidence. I have a gut feeling that using variables in finally block resulted in not disposing variable's object to early (because it's used in finally block). Is that true? Anyway, is it a correct approach to provide dllimported function with managed callbacks?\n\nThanks,Pawel"
] | [
"c#",
".net",
"garbage-collection",
"pinvoke"
] |
[
"Woocommerce Rest API Parameter filter",
"I am developing Ionic3 mobile app for e-commence web site using Woocommerce REST API.\n\nThis website contains different color shoes and bags I need to filter them respect to color using REST API.\n\nI tried this way. But it returns all products .\n\nhttp://www.example.com/wc-api/v1/products?color=black\"\n\n\nHow can I do this?"
] | [
"wordpress",
"rest",
"ionic-framework",
"woocommerce",
"ionic2"
] |
[
"AWS WAF best practices",
"Can anyone here help me with some best practice of WAF condition/Rules to used for AWS CDN. some Generic rule which any one can use to protect CDN"
] | [
"amazon-cloudfront",
"cdn",
"web-application-firewall"
] |
[
"Using dplyr rowwise to create multiple linear models",
"considering this post:\nhttps://www.tidyverse.org/blog/2020/06/dplyr-1-0-0/\nI was trying to create multiple models for a data set, using multiple formulas. this example says:\nlibrary(dplyr, warn.conflicts = FALSE)\n\nmodels <- tibble::tribble(\n ~model_name, ~ formula,\n "length-width", Sepal.Length ~ Petal.Width + Petal.Length,\n "interaction", Sepal.Length ~ Petal.Width * Petal.Length\n)\n\niris %>% \n nest_by(Species) %>% \n left_join(models, by = character()) %>% \n rowwise(Species, model_name) %>% \n mutate(model = list(lm(formula, data = data))) %>% \n summarise(broom::glance(model))\n\nYou can see rowwise function is used to get the answer but when i dont use this function, i still get the correct answer\niris %>%\n nest_by(Species) %>% \n left_join(models, by = character()) %>% \n mutate(model = list(lm(formula, data = data))) %>% \n summarise(broom::tidy(model))\n\ni only lost the "model_name" column, but considering that rowwise documentation says, this function is to compute, i dont get why is still computed this way, why this happens?\nthanks in advance."
] | [
"r",
"dplyr",
"tibble",
"rowwise"
] |
[
"ASP.NET - Get gridview edit row to span across columns",
"I've got a grid control with 6 columns. I use the EditItemTemplate fields to display edit data and I'd like to customize this if possible. Right now, the EditItemTemplate will show any control that I put in there but it only displays it in the column in which the template is in. How can I get it to span across all 6 columns? For instance, the 6 columns are:\n\nFirst Name | Last Name | Address | City | State | Zip\n\n\nand when the user clicks the Edit button (in each row), I'd like to show those 6 for edit, but add 1 more control on a row below that, which spans all 6 columns:\n\nFirst Name | Last Name | Address | City | State | Zip\n------------------------------------------------------\nUserComments\n------------------------------------------------------\n\n\nAny ideas how I can accomplish this or even if it can be done?"
] | [
"asp.net",
"aspxgridview"
] |
[
"loop add a comma after nth comma using awk",
"I feel like this should be a fairly straight forward question, but I cant seem to get it to work.\n\nI have a csv file and I need to add comma after the nth comma in each row.\nI believe I have to use gsub to get it to loop.\nsomething like\n\n{gsub(/$nth/,/\",\")}\n\n\nbut I don't understand awk well enough to get it to work.\n\nThe end goal of my script is to check to see if a word exist and if it does NOT add a comma after the nth comma.\n\nI'm using grep for that part like this:\n\nTEST1=$(cat $file | grep 'Sentence Skills')\n if [ $? -eq 1 ]\n then\n awk command to add comma after nth comma\n fi\n\n\nIf it doesnt exist I need to add a comma after the nth comma to make sure everything lines up correctly\n\nUPDATE\nto clarify with sample input and output (my apologies, I originally was not going to include the grep if then fi part)\n\nHere is a sample of the csv:\n\nlast,first,A00XXXXXX,1888-01-01,2015-05-13,Reading Comprehension 97,Sentence Skills 104,College Level Math 76,Elementary Algebra 115,\nlast,first,A00XXXXXX,1888-01-01,2015-05-13,Elementary Algebra 34,\nlast,first,A00XXXXXX,1888-01-01,2015-05-13,College Level Math 64,Elementary Algebra 114,\nlast,first,A00XXXXXX,1888-01-01,2015-05-13,Reading Comprehension 87,College Level Math 64,Elementary Algebra 114,\n\n\nAnd this is what I need it to look like:\n\nlast,first,A00XXXXXX,1888-01-01,2015-05-13,Reading Comprehension 97,Sentence Skills 104,College Level Math 76,Elementary Algebra 115,\nlast,first,A00XXXXXX,1888-01-01,2015-05-13,,,,Elementary Algebra 34,\nlast,first,A00XXXXXX,1888-01-01,2015-05-13,,,College Level Math 64,Elementary Algebra 114,\nlast,first,A00XXXXXX,1888-01-01,2015-05-13,Reading Comprehension 87,,College Level Math 64,Elementary Algebra 114,\n\n\nI need to add one comma after the 5th comma if Reading comprehension doesn't exist, then add one comma after the 6th comma if Sentence Skills doesn't exist, then one comma after the 7th comma if College Level Math doesn't exist, then one comma if Elementary algebra doesn't exist.\n\nIf any of those do exist, it does not add a comma and skips on to the next one."
] | [
"bash",
"awk"
] |
[
"Adding new elements won't make the modal body bigger in Twitter-Bootstraps",
"I have this code:\n\n<div class=\"modal fade\" id=\"myModal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\"\n aria-hidden=\"true\">\n <div class=\"modal-dialog\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\">\n <span aria-hidden=\"true\">×</span></button>\n <h4 class=\"modal-title\" id=\"myModalLabel\">My title</h4>\n </div>\n <div class=\"modal-body\">\n <div id=\"problem_desc\">\n\n </div>\n <div id=\"problem_sol\">\n\n </div>\n </div>\n <div class=\"modal-footer\">\n <div id=\"modalbutton\">\n\n </div>\n </div>\n </div>\n </div>\n</div>\n\n\nThen I use some ajax to fill the divs, something like this:\n\n$('#problem_desc').html('<div class=\"form-group error\">'+data.problem.problem_description+'</div>');\n\n\n...\n\n$('#problem_sol').html(<div class=\"form-group error\"> <label for=\"probselect\" \n\nclass=\"col-sm-3 control-label\">Something</label><div class=\"col-sm-9\"> \n\n<select class=\"form-control\" id=\"probselect\"></select></div>);\n\n\nI use these functions 2 or 3 times to make a form in the modal\n\nThere are several cases of what I want to include in the modal depending on the AJAX response, so I can't just put the form in the modal and fill it with AJAX. I need to create the form dynamically.\n\nI expect the modal's body to expand or contract depending on the amount of divs and columns that I add. This works when I don't add them dynamically.\n\nThe problem is that, when added with jQuery, it won't expand or contract and the form will end up in the overlapping the footer.\n\nAny suggestions?"
] | [
"jquery",
"css",
"twitter-bootstrap"
] |
[
"VBA Batch Action on Folder - CSV lists to fill an XLS template",
"I'm new to VB/VBA. Trying to get this to work.\n\nI have found this:\nLooping a code through a folder of workbooks with VBA?\n\nBut it doesn't quite address what I'm trying to do. I have ~60 .CSV files that are all clean and conformed, and I want to take these and put them onto an Excel template using a VBA. I was able to get one working using the \"Record Macro\" Function:\n\nRange(\"A2:A33\").Select\nSelection.Copy\nWorkbooks.Open Filename:=\"C:\\Users\\rs\\Desktop\\F15-Template.xlsx\"\nRange(\"A6\").Select\nSelection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _\n xlNone, SkipBlanks:=False, Transpose:=False\nWindows(\"List01.csv\").Activate\nRange(\"B2\").Select\nApplication.CutCopyMode = False\nSelection.Copy\nWindows(\"F15-Template.xlsx\").Activate\nRange(\"H2:J2\").Select\nActiveSheet.Paste\nWindows(\"List01.csv\").Activate\nRange(\"D2\").Select\nApplication.CutCopyMode = False\nSelection.Copy\nWindows(\"F15-Template.xlsx\").Activate\nRange(\"H3:J3\").Select\nActiveSheet.Paste\n\n\nBut as you can tell this is for one list onto the template.\n\nThe things I'd like to do in addition to copy/pasting from list to XLS template are:\n\n\nMake the above code work with a directory\nSave As ListName01.xls after the copy/paste merge\nIf possible, apply a batch \"Protect Sheet\" to these files. \n\n\nThe lists live in C:\\Users\\rs\\Desktop\\lists and the template is on the bare Desktop -- Whatever you can do to help would be well appreciated. \n\nIf VB/VBA is the wrong tool for the job, please point me in the right direction. Thanks in advance!"
] | [
"vba",
"excel",
"batch-processing"
] |
[
"How to return array while using GROUP BY",
"Right now, I have this query:\n\nSELECT COUNT(*) AS Count, SUM(Ask) AS Ask, SUM(Cost) AS Cost, Provider, Factura FROM store_items \n WHERE (\n Provider NOT IN(SELECT Provider FROM store_provider_invoices)\n AND Factura NOT IN(SELECT Factura FROM store_provider_invoices)\n ) \n OR Factura NOT IN(SELECT Factura FROM store_provider_invoices) \n GROUP BY Provider, Factura\n\n\nThis is working great, and returns the following array:\n\nArray ( \n [0] => Array ( \n [Count] => 1 \n [ID] => 13 \n [Ask] => 20.00 \n [Cost] => 10.00 \n [Provider] => 5 \n [Factura] => 8 \n ) \n [1] => Array ( \n [Count] => 1 \n [ID] => 18 \n [Ask] => 125.01 \n [Cost] => 110.01 \n [Provider] => 5 \n [Factura] => 34 \n ) \n [3] => Array ( \n [Count] => 3 \n [ID] => 14 \n [Ask] => 210.00 \n [Cost] => 150.00 \n [Provider] => 6 \n [Factura] => 5 \n )\n) \n\n\nWhat I would like to do is to also return all the ID's that match the query from the store_items table, like:\n\nArray ( \n [0] => Array ( \n [ID] => Array (\n [0] => 101\n )\n [Count] => 1 \n [Ask] => 20.00 \n [Cost] => 10.00 \n [Provider] => 5 \n [Factura] => 8 \n ) \n [1] => Array ( \n [ID] => Array (\n [0] => 102\n )\n [Count] => 1 \n [Ask] => 125.01 \n [Cost] => 110.01 \n [Provider] => 5 \n [Factura] => 34 \n ) \n [3] => Array ( \n [ID] => Array (\n [0] => 103\n [1] => 104\n [2] => 105\n )\n [Count] => 3 \n [Ask] => 210.00 \n [Cost] => 150.00 \n [Provider] => 6 \n [Factura] => 5 \n )\n) \n\n\nSo, for instance, in the last array element above, instead of just returning a Count of 3, also return the ID's of each row that it counted."
] | [
"mysql"
] |
[
"Scala Spark - Define a multi-line function with intermediate results",
"I am having trouble defining the function below.\nFirstly, moviePairs is a Spark RDD that contains data like this:\n[("Spiderman", "DR. Sleep"), ("Spiderman", "Jungle Book"), ("Mulan", "Jungle Book")]\nSecondly, the movieRatings RDD contains a movie title followed by a list of user ratings:\nFORMAT: (movie_name), [list of user-rating, index pairs] ie. (rating1, index0), (rating2, index1)\n[ ("Spiderman", [[4, 0], [3, 1], [3, 2]] ), ("Jungle Book", [[4, 0], [3, 1], [3, 2]] ) ]\nWhen I run the code below, the last line, the intersection operation, gives me an error:\n val result = moviePairs.map{val filteredMovieList1 = (movie1 : String, movie2 : String) => \n {movieRatings.filter(mRating => mRating._1 == movie1)\n .map(mRating => mRating._2).first();}\n\n val filteredMovieList2 = (movie1 : String, movie2 : String) => \n {movieRatings.filter(mRating => mRating._1 == movie2)\n .map(mRating => mRating._2).first();}\n\n (movie1 : String, movie2 : String) => filteredMovieList1.intersection(filteredMovieList2)\n }\n\nError message:\nTask4.scala:29: error: type mismatch;\n found : (String, String) => (String, String) => Array[(Int, Int)]\n required: ((String, String)) => ?\n (movie1 : String, movie2 : String) => filteredMovieList1\n\n\nMy first question is, how do I fix the code so that I am not defining filteredMovieList1, filteredMovieList2 as functions ? I just need the results they return.\nMy second question is, am I defining multi-line functions correctly ? I am used to coding one-liner lambda functions in Spark, so doing this is very new to me.\nThe only reason I am coding this multi-line function and storing results in many intermediate variables is because previously I tried this one-liner:\nmoviePairs => movieRatings.filter(mRating => mRating._1 == moviePairs._1).map(mRating => mRating._2).intersection(moviePairs => movieRatings.filter(mRating => mRating._1 == moviePairs._2).map(mRating => mRating._2));\nBut I got a runtime error that suggested something like: you cannot perform transformations or actions within another transformations (ie. I am doing transformations inside a intersection operation)."
] | [
"scala",
"apache-spark"
] |
[
"How to check if a div has an svg in it using JavaScript?",
"I have a div like the following with a question mark in it...\n\n<div id=\"mydiv\">?</div>\n\n\nIn my code, when someone tries to submit a form, I do a check to see if that field has a question mark in it, like this:\n\nconst fieldText = $('#mydiv').text();\nreturn fieldText.indexOf('?') !== -1;\n\n\nThat works fine, but now, instead of a question mark in that div, I have an SVG of a question mark (rather than just a text question mark), like this.\n\n<div id=\"mydiv\">\n <svg version='1.1' id='Layer_1' class='q-mark-svg' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 50 50' style='enable-background:new 0 0 50 50;' xml:space='preserve'>\n <style type='text/css'>\n .q-mark{fill:#777777;}\n </style>\n <g>\n <g>\n <path class='q-mark' d='M18.3,17.2c0,0.4-0.1,0.7-0.2,1c-0.1,0.3-0.3,0.6-0.5,0.8c-0.2,0.2-0.5,0.4-0.8,0.5c-0.3,0.1-0.6,0.2-1,0.2 c-0.7,0-1.3-0.2-1.8-0.7c-0.5-0.5-0.7-1.1-0.7-1.8c0-1.6,0.3-3.2,0.9-4.6c0.6-1.4,1.5-2.7,2.6-3.8s2.3-1.9,3.8-2.5 c1.4-0.6,3-0.9,4.6-0.9s3.1,0.3,4.6,1c1.4,0.6,2.7,1.5,3.8,2.6s1.9,2.3,2.6,3.8c0.6,1.4,0.9,2.9,0.9,4.5c0,3.2-1.2,6-3.5,8.4 l-3.8,3.5c-1.3,1.3-2,2.7-2,4.3c0,0.7-0.2,1.3-0.7,1.8c-0.5,0.5-1.1,0.7-1.8,0.7s-1.3-0.2-1.8-0.7c-0.5-0.5-0.7-1.1-0.7-1.8 c0-2.9,1.2-5.6,3.5-7.9l3.8-3.6c1.3-1.4,2-2.9,2-4.8c0-0.9-0.2-1.8-0.5-2.6c-0.4-0.8-0.8-1.5-1.5-2.1c-0.6-0.6-1.3-1.1-2.1-1.5 c-0.8-0.4-1.7-0.5-2.6-0.5c-0.9,0-1.8,0.2-2.6,0.5c-0.8,0.4-1.5,0.8-2.1,1.4c-0.6,0.6-1.1,1.3-1.4,2.1 C18.5,15.3,18.3,16.2,18.3,17.2z M28.5,40.9c0,1-0.3,1.8-1,2.5c-0.7,0.7-1.5,1-2.5,1c-1,0-1.8-0.3-2.5-1c-0.7-0.7-1-1.5-1-2.5 c0-1,0.3-1.8,1-2.5c0.7-0.7,1.5-1,2.5-1c1,0,1.8,0.3,2.5,1C28.2,39.1,28.5,40,28.5,40.9z'/>\n </g>\n </g>\n </svg>\n</div>\n\n\nI still want to run a check on that div, but now I have to check to see if it has an SVG in it, rather than just \"?\". How can I use JS to check if a div has an svg element in it?\n\nFYI, I tried the following since I thought it would still look for the text, but to no avail...\n\nconst fieldText = $('#mydiv').text();\nreturn fieldText.indexOf('svg') !== -1;"
] | [
"javascript",
"jquery",
"html",
"css",
"svg"
] |
[
"Open IOS application from asp .net MVC web application on button click",
"I have asp .net MVC web application that is developed to be used on Ipad and I want to open an IOS application that is already installed on the same Ipad on a button click. Now, the button click will take me to the app store and from there I can click OPEN, but I want to direct the user to the app directly not app store. Is it possible?"
] | [
"c#",
"ios",
"asp.net-mvc"
] |
[
"Set Javascript variable as PHP variable",
"Hai I want to set javascript variable (getdate1) as PHP variable to compare the dates with database value to display event details. I attached the attachement of how alert box will work.\n\n var getdate1 = document.getElementById(\"eventDayName\").innerHTML = selectedDate.toLocaleString(\"en-US\", {\n month: \"long\",\n day: \"numeric\",\n year: \"numeric\"\n }); \n\n alert(getdate1);"
] | [
"javascript",
"php"
] |
[
"ReactJS: setState using if else",
"I am new to ReactJS. On my index page, the initial state of loginState & modalStatus is false. I am trying to change modalStatus to true inside componentDidMount().\n\nclass Home extends Component {\n constructor(props) {\n super(props);\n this.state = {\n isLoggedIn: true,\n modalStatus: false,\n };\n }\n\n componentDidMount() {\n if(this.state.isLoggedIn) {\n console.log(this.state.modalStatus);\n this.setState({ modalStatus: true});\n console.log(this.state.modalStatus);\n } else {\n console.log(this.state.modalStatus);\n }\n render() {\n return (\n <>\n <h1>Hello</h1>\n </>\n );\n }\n}\n\n\nBut my console is printing false for both modalStatus even after setState. Is there anything I am doing wrong? Please guide me. I would appreciate any helps."
] | [
"reactjs"
] |
[
"UTF-8 Not working in the JQuery plugin Jeditable",
"I have added a meta tag like this,\n\n <meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\" />\n\n\nto my page. I have made sure that the MySQL table column in question is \"utf8_unicode_ci\" and I added a charset= to my jquery call as in\n\n <script type=\"text/javascript\" src=\"js/jeditable.js\" charset=\"utf-8\"></script>\n\n\nBut a slash (/) for example still comes out as '%2F'.\nAnyone see why MySQL isn't storing it as a '/' slash and why my web page isn't displaying it as a '/'?"
] | [
"php",
"jquery",
"mysql",
"jeditable"
] |
[
"Setting up resources in separate dll WPF",
"I am wanting to have a set of styles contained within a standalone dll that can be referenced from a number of different WOF classes to define common styles. \n\nI have created the standalone dll and tried referencing it but am having problems. \n\nHere is the code for the standalone dll:\n\n<ResourceDictionary xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" \n xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\">\n\n <Style x:Key=\"myStyle\" TargetType=\"Button\">\n <Setter Property=\"Background\" Value=\"Orange\" />\n <Setter Property=\"FontStyle\" Value=\"Italic\" />\n <Setter Property=\"Padding\" Value=\"8,4\" />\n <Setter Property=\"Margin\" Value=\"4\" />\n </Style>\n\n <!-- store here your styles -->\n</ResourceDictionary> \n\n\nHere is where Im trying to reference it:\n\n<src:GX3ClientPlugin.Resources>\n <ResourceDictionary Source=\"pack://application:,,,/GX3StyleResources.dll;component/GX3StyleResources.xaml\" />\n</src:GX3ClientPlugin.Resources>\n\n\nWhen running I get the following exception:\n\n\n Could not load file or assembly 'GX3StyleResources.dll, Culture=neutral' or one of its dependencies. The system cannot find\n the file specified.\n\n\nAny Ideas?"
] | [
"c#",
"wpf",
".net-assembly",
"resourcedictionary"
] |
[
"Parsing SQL statements ( get Column name used , where conditions etc ) in .NET",
"n my application , i have a textbox where user can paste Procedure , i need to parse this SQL and get the table names , joins , Columns ,Columns schema etc.\n\nis there a easy in c# rather than using string manupulation to do this activity?"
] | [
"sql",
"parsing"
] |
[
"Animate words width with jQuery in infinite loop",
"I'm having an jQuery issue, which is making my life hard. \n\nSo what I have done until now if this JSBin\n\nOn what you can see, is that I am pretty close. What I need to achieve is to show words within a sentence, once one word is shown show the next one. Until a sentence has no words with a width of 0. Once that has happened the sentence hides, and the next sentence starts. Once all words in the last sentence are visible, everything starts over (infinite loop). But there has also to be the functionality of delays between words, and between sentences. I'm somehow not making progress right now with the code, so I thought I ask if someone had a similar issue, or if there is an plugin out there that could save my life.\n\nHow it should work is the following;\n\n\nThe words have to animate (as they are now)\nOnce one word appears, the next one is called\nOnce all words in one sentence have appeared, the sentence hides. Then the next word starts appearing which is in sentence two.\nSome words have to have a delay meaning they should start appearing after the delay given\nAlso I should be able to set intervals between sentences.\nOnce the second sentence is done, it should hide. And everything should start again.\n\n\nThanks a lot for any kind of assistance."
] | [
"javascript",
"jquery",
"css",
"jquery-animate",
"transition"
] |
[
"replacement has X rows, data has Y in R",
"I'm trying to find the appointment cost for each one of the appointments that our leasing office had in the past year. The leads data frame is 'desired_372' and all the monthly expenses for each one of the marketing sources comes from expenses_372. My code is really simple by I keep getting the following error:\n\n**Error in `$<-.data.frame`(`*tmp*`, \"Expense_per_Appt\", value = c(0, 0, : \n replacement has 9 rows, data has 8** \n\n\nMy Code:\n\ndesired_372$Expense_per_Appt = rep(0,nrow(desired_372)) #create an empty vector\n\nfor (i in 1:nrow(desired_372)){ \n if (desired_372$Source[i] %in% names(expenses_372)){ #check if the marketing source the lead came from is a paid one\n if(desired_372$Reg.Month[i] %in% expenses_372$Month){ #if the date the lead came in was during accounting period\n if (desired_372$Appointment[i] == \"Yes\"){ #check if the lead had an appointment\n\n#finding the indices of the source's monthly fee\n row_index = which(expenses_372$Month == desired_372$Reg.Month[i])\n col_index = which(names(expenses_372) == desired_372$Source[i]) \n\n # the appointment cost is calculated by dividing the total monthly cost of the source by number of appointments in this month from this source\n desired_372$Expense_per_Appt[i] = expenses_372[row_index,col_index] / length(desired_372$`Prospect Code`[desired_372$Source == desired_372$Source[i] & \n desired_372$Reg.Month == desired_372$Reg.Month[i] &\n desired_372$Appointment == \"Yes\"])\n } else {expenses_372$Expense_per_Appt[i] = NA}\n } else {expenses_372$Expense_per_Appt[i] = NA}\n } else {expenses_372$Expense_per_Appt[i] = NA}\n}\n\n\nAny Idea why I'm getting this error?"
] | [
"r"
] |
[
"What is dollar sign within directory location?",
"I got a Stata do file which always uses \"dollar\" sign $ whenever \"using\" something.\n\nBut when I actually run it on my computer, it looks like my computer thinks the directory is ignored.\n\n\n\nHere, the directory \"logs\" was just ignored and obviously my computer thinks I am looking for the file in the main directory \"C\"\n\nWhat is that dollar sign? Why does my computer think so?"
] | [
"stata"
] |
[
"Not sure about using test command with al in assembly",
"I am new to assembly and have begun to learn it through an assignment. However, I am not so sure about using the \"test\" command:\n\nThe first command is \"anding\" together the constant 1 and eax. If eax is something like 10101010 and 1 is: 00000001, then \"anding\" them together would produce: 0. But what does testing the lowest four bits of the register have to do with anything - and why is it important? What is this entire expression doing?\n\n8049ac0: 83 e0 01 and $0x1,%eax // \"and\" these bits together\n8049ac3: 84 c0 test %al,%al // check the last \n8049ac5: 74 05 je 8049acc <level_4+0x60> // if it is equal, then skip down."
] | [
"assembly"
] |
[
"webview in scrollview windows phone 8.1",
"I have a webview in a scrollview in a Windows phone 8.1 application, I set the height of the webview to fit its content and disabled the scrollview in the webview, but when I scroll the webview the scrollview is not scrolling.\n\nthe same code work for Windows store 8.1."
] | [
"webview",
"windows-phone-8.1",
"scrollview"
] |
[
"Two lists of dictionaries with some different keys, how to find intersection?",
"My data looks like this:\n\nbuffer = [{\"siteid\": 1 , \"distance\": 2, \"codes\": \"1|b|c\", \"urv\": \"545\"}, {\"siteid\": 2 , \"distance\": 2, \"codes\": \"1|b|c\", \"urv\": \"55\"}, {\"siteid\": 2 , \"distance\": 2, \"codes\": \"1|b|c\", \"urv\": \"55\"}, {\"siteid\": 3 , \"distance\": 2, \"codes\": \"1|b|c\", \"urv\": \"546\"}]\nlayer = [{\"siteid\": 2 }, {\"siteid\": 4 }, {\"siteid\": 3 }]\n\n\nI would like to be able to return all of the members of the buffer list where the siteid is the same. \n\nThe result would be:\n\n[{\"siteid\": 2 , \"distance\": 2, \"codes\": \"1|b|c\", \"urv\": \"55\"}, {\"siteid\": 2 , \"distance\": 2, \"codes\": \"1|b|c\", \"urv\": \"55\"}, {\"siteid\": 3 , \"distance\": 2, \"codes\": \"1|b|c\", \"urv\": \"546\"}]\n\n\nTIA,\nChris"
] | [
"python",
"list"
] |
[
"Stream controller not registering sink event flutter",
"I am using the bloc pattern to handle state in my app. However, sinking data into my stream is not working. I have a formfield and a button that returns null if the text field is empty.\nHere is my bloc\n\nclass SavingsCategoryBloc {\n final amount = PublishSubject<int>();\n\n Stream<int> get amountStream => amount.stream;\n Function(int) get amountSink => amount.sink.add;\n}\n\n\nThis is my screen\n\nclass _StartSavingPageState extends State<StartSavingPage> {\n final SavingsCategoryBloc bloc = SavingsCategoryBloc();\n ...\n\n\n @override\n Widget build(BuildContext context) {\n ...\n Container(\n padding: EdgeInsets.symmetric(\n horizontal: 15.0, vertical: 15.0),\n child: TextField(\n onChanged: (String value) => bloc.amountSink,\n keyboardType: TextInputType.number,\n controller: amountController,\n decoration: InputDecoration(\n labelText: 'AMOUNT TO SAVE ',\n labelStyle: TextStyle(\n fontFamily: 'Montserrat',\n fontSize: 2.1 * SizeConfig.textMultiplier,\n color: Colors.grey),\n focusedBorder: UnderlineInputBorder(\n borderSide:\n BorderSide(color: Colors.purple))),\n ),\n ),\n\n ....\n\n Container(\n padding: EdgeInsets.symmetric(\n horizontal: 15.0, vertical: 15.0),\n decoration: BoxDecoration(\n borderRadius:\n BorderRadius.all(Radius.circular(25.0))),\n width: double.infinity,\n child: StreamBuilder(\n stream: bloc.amountStream,\n builder: (context, snapshot) {\n return RaisedButton(\n elevation: 5.0,\n onPressed: snapshot.hasData\n ? () => print('hi')\n : null,\n padding: EdgeInsets.all(15.0),\n color: Colors.purple,\n child: Text(\n 'SAVE',\n style: TextStyle(\n color: Colors.white,\n letterSpacing: 1.5,\n fontSize: 18.0,\n fontWeight: FontWeight.bold,\n fontFamily: 'OpenSans',\n ),\n ),\n );\n }),\n )\n\n\nThe button remains disabled even when the formfield is not empty."
] | [
"flutter"
] |
[
"Spring Cloud Kinesis binder when kpl/kcl are enabled creates SpringIntegrationMetadataStore and SpringIntegrationLockRegistry. Is it necessary?",
"I'm trying Spring Cloud Kinesis binder with intention to use it in production. I want to rely on KCL/KPL channel adapters so I switched on kplKclEnabled property. My app still creates SpringIntegrationLockRegistry and SpringIntegrationMetadataStore tables. Is it necessary as we use KCL which already have created a metadata table with my consumer group name? If its not necessary, how can I switch it off ?"
] | [
"java",
"spring",
"spring-cloud-stream",
"amazon-kinesis"
] |
[
"How do I disable the text from the navigation bar back button for every view controller?",
"How do I disable the text from the navigation bar back button for every view controller?\n\nI would like the back button to contain just the default \"<\" icon.\n\nIt takes up too much space.\n\nHere is way of doing it, but it seems awkward to have to change every view controller.\n\nHow to change the UINavigationController back button name?\n\nThank you."
] | [
"ios"
] |
[
"Python 3.2 extremely slow when compare to Python 3.1.x",
"I read through Python 3.2 changes and understand that it has made many improvement over 3.1. However, my exact same code with zero modification running on 3.2 is more than 10 times slower than when I run my code on 3.1.3\n\nIt took Python 3.2 six minutes to transfer binary content of a file to a physical device then receive and prints out the received data on screen, when the exact same scenario on same PC only takes 30 second to execute with Python 3.1.3.\n\nI developed my code from scratch with Python 3.1.2 and 20% of my code uses ctypes to perform transaction through windows driver with USB/PCI device, so I don't think this performance hit has anything to do with backward compatibility. In my application, I create four instances of threading.Thread subclasses, each dealing with one PCI or USB device on the system. Things I suspect are that ctypes performance of 3.2 got worse than ever or there are more to threading.Thread that I have to play with to get exactly the multi-threading performance I want. Would be much appreciated if anyone can shade some lights for me\n\n=========================================\n\nmore diagopnistic\n\nI reduced amount of data to be sent&received\n\npython 3.1.3 spends 3 seconds to comelete as shown in this system resource monitor screenshot http://img62.imageshack.us/img62/5313/python313.png\n\npython 3.2 spends about 1 minutes to complete as shown in this system resource monitor screenshot http://img197.imageshack.us/img197/8366/python32.png\n\nMy PC is a single core Intel P4 with 2 GB of RAM, so I think we can rule out GIL factor for multiple core processors.\n\nI used yappi to profile multiple runs to average out performance results on both 3.1.3 and 3.2. I see that threading and ctypes are badly performed on Python 3.2.\n\nThis is accessing thread safe queue provided with standard windows binary of python package\n\non 3.1.3\nname #n tsub ttot tavg\nC:\\Python31\\lib\\queue.py.qsize:86 46070 1.352867 4.234082 0.000092\nC:\\Python31\\lib\\queue.py._get:225 8305 0.012457 0.017030 0.000002\nC:\\Python31\\lib\\queue.py.get:167 8305 0.635926 1.681601 0.000202\nC:\\Python31\\lib\\queue.py._put:221 8305 0.016156 0.020717 0.000002\nC:\\Python31\\lib\\queue.py.put:124 8305 0.095320 1.138560 0.000137\n\non 3.2\nname #n tsub ttot tavg\nC:\\Python32\\lib\\queue.py.qsize:86 252168 4.987339 15.229308 0.000060\nC:\\Python32\\lib\\queue.py._get:225 8305 0.030431 0.035152 0.000004\nC:\\Python32\\lib\\queue.py.get:167 8305 0.303126 7.898754 0.000951\nC:\\Python32\\lib\\queue.py._put:221 8305 0.015728 0.020928 0.000003\nC:\\Python32\\lib\\queue.py.put:124 8305 0.143086 0.431970 0.000052\n\n\nthread-wise performance is just insanely bad on Python 3.2\n\nanother example. this function simply calls API in windows USB driver through ctypes module and request 16 bits of data from USB device\n\non 3.1.3\nname #n tsub ttot tavg\n..ckUSBInterface.py.read_register:14 1 0.000421 0.000431 0.000431\non 3.2\nname #n tsub ttot tavg\n..ckUSBInterface.py.read_register:14 1 0.015637 0.015651 0.015651\n\n\nas you can see, the time it takes is more than 30 times worse on Python 3.2\n\nPython 3.2 seems like a disaster for my application"
] | [
"python",
"multithreading",
"ctypes",
"python-3.2",
"python-3.1"
] |
[
"How long should my cookie token be?",
"This is what i've come up with to store a cookie to validate a user on my site.\n\nHow long should the token be that I generate? Is 33 enough or should it be 64? and is my generation secure enough?\n\n<?PHP \n$token = bin2hex(openssl_random_pseudo_bytes(33));\necho $token.'<br>';\n$hash = hash('sha256', $token);\necho $hash;\n\n//Test user db and local cookie\n $stored_hash = '5be39777ad41916c5fa1e78681bfc8793a5cfe7c27842846ad23396e44b390a7';\n $cookie = '1a9243f95354252d937d2b99e64a7eeb462e00c72b26d488426f08ef11667522c6';\n\n$cookie_hash = hash('sha256', $cookie);\n\nif(hash_equals($stored_hash, $cookie_hash))\n echo 'true';\nelse\n echo 'false';\n?>"
] | [
"php",
"cookies",
"random",
"hash",
"sha256"
] |
[
"How would a nosql schema be designed to relate users to \"friends\" who are actually other users?",
"User {\n _id: \"my_user\",\n name: \"john smith\",\n email: \"[email protected],\n friends: [\n *More Users*\n ]\n}\n\n\nDo I rewrite the User data of friends? Everytime I \"add a friend\" do I put in the data again or do I \"relate\" to another User _id field?"
] | [
"mongodb",
"scaling",
"relation",
"nosql"
] |
[
"How to change content inside table when condition search is false using javascript",
"I have a code for table and search text : \n\n<div class=\"table-responsive\">\n Search Data : <input type=\"text\" class=\"txtSearch\" id=\"search_field\">\n <div class=\"tableFixHead\">\n <table id=\"fid_table\" class=\"ui celled table\" style=\"width:100%\">\n <thead>\n <tr class=\"t_head\">\n <th>No</th>\n <th>Name</th>\n <th>Gender</th>\n </thead>\n <tbody>\n <tr>\n <td>1</td>\n <td>John</td>\n <td>Male</td>\n </tr>\n <tr>\n <td>2</td>\n <td>Lily</td>\n <td>Female</td>\n </tr>\n <tr>\n <td>3</td>\n <td>Joe</td>\n <td>Male</td>\n </tr>\n </tbody>\n </table>\n </div>\n</div>\n\n\nAnd I have simple search code using javascript like this : \n\n $('#search_field').on('keyup', function() {\n var value = $(this).val();\n var patt = new RegExp(value, \"i\");\n\n $('#fid_table').find('tr').each(function() {\n var $table = $(this);\n var result = $table.find('td').text().search(patt);\n\n if (!(result >= 0)) {\n $table.not('.t_head').hide();\n }\n if ((result >= 0)) {\n $(this).show();\n }\n });\n });\n\n\nAnd I want make $table.not('.t_head').hide() change to text inside tag <td> and make a text like this Sorry, bla bla bla.\n\n\n\nBefore I input text on search field\n\n\n\nAfter I input and the result is false"
] | [
"javascript"
] |
[
"WinRT gridview Add tile",
"I have a GridView and it's bind to List of items. I want it to have a static item so that users can click on it to add more items. if I click on other items I produce a item detail page. \n\nHow can I have that static tile which have entirely diferent behavior from every other grid item in the GridView? Like the last tile in image below."
] | [
"c#",
"windows",
"gridview",
"windows-runtime"
] |
[
"Swift 3.0 Map Returns to Previous MapView",
"I have a mapView with annotations with detail disclosure that when clicked on, moves to a new viewController. Then when the user selects to go back to the mapView from the detail disclosure, I want the mapView to have the same view that the user had before clicking on the detail disclosure. Below is the code I have set up so far, however, when the user clicks back from the detail disclosure, the map zooms out. I am not sure how to recreate the previous view. \n\nDetail Disclosure VC:\n\n// here by segueing, I want to communicate to the MapView VC that the map should remain the same \noverride func prepare(for segue: UIStoryboardSegue, sender: Any?) {\n if (segue.identifier == \"backButtonTapped\" )\n {\n let destinationVC = segue.destination as! TabBarVC\n mapStatus = \"wentBack\"\n print(\"The value of mapStatus after seguing is \\(mapStatus)\")\n destinationVC.selectedIndex = 1\n\n }\n\n}\n\n\nMapView VC:\n\n override func viewDidAppear(_ animated: Bool) {\n // here if the mapStatus is not the correct value (the user never used the detail disclosure), the map will just snap onto the current location\n\n if mapStatus == \"wentBack\" {\n print(\"Do not update location\")\n\n // assuming appropriate code is placed here but I am not sure what it is\n\n\n } else {\n print(\"Updated Current Location\")\n let center = CLLocationCoordinate2D(latitude: self.lastLocation.coordinate.latitude, longitude: self.lastLocation.coordinate.longitude)\n let region = MKCoordinateRegion(center: center, span: MKCoordinateSpan(latitudeDelta: 0.01, longitudeDelta: 0.01))\n\n map.setRegion(region, animated: true)\n\n locationManager.delegate = self\n locationManager.desiredAccuracy = kCLLocationAccuracyBest\n if #available(iOS 8.0, *) {\n locationManager.requestAlwaysAuthorization()\n } else {\n // Fallback on earlier versions\n }\n let noLocation = CLLocationCoordinate2D()\n let viewRegion = MKCoordinateRegionMakeWithDistance(noLocation, 200, 200)\n map.setRegion(viewRegion, animated: false)\n\n }\n }"
] | [
"ios",
"swift",
"dictionary",
"mkmapview"
] |
[
"Android currentThread.getStackTrace() Indexes",
"I'm using the following to get the name of the method that called the currently executing method:\n\nString methodName = Thread.currentThread().getStackTrace()[3].getMethodName();\n\n\nWill the index (3) be the same across all Android devices? I saw in a few places that different JVMs have it arranged differently."
] | [
"java",
"android",
"reflection",
"methods",
"stack-trace"
] |
[
"Scala: how to specify varargs as type?",
"Instead of\n\ndef foo(configuration: (String, String)*)\n\n\nI'd like to be able to write:\n\ntype Configuration = (String, String)*\ndef foo(configuration: Configuration)\n\n\nThe main use case is to provide an easy method signature when overriding in subclasses \n\nUPDATE:\nI can come close by\n\ntype Param = (String, String)\ndef foo(configuration: Param*)\n\n\nBut is there a way of doing it better?"
] | [
"scala",
"types"
] |
[
"printing business cards - a kind of knapsack task",
"I am new to Prolog and I have some probably simple issue with a piece of code. This is a real world problem that arose last Friday and believe me this is not a CS Homework.\n\nWe want to print business cards and these can only be printed in blocks of 900 cards (100 sheets with 9 cards per sheet). The cards for anybody should not be distributed over several blocks. People ordered different amount of cards, E.G:\n\n% \"braucht\" is german and means \"needs\"\nbraucht(anton,400).\nbraucht(berta,200).\nbraucht(claudia,400).\nbraucht(dorothee,100).\nbraucht(edgar,200).\nbraucht(frank,400).\nbraucht(georg,100).\n\n\nI put together the following definition to find an appropriate block of 900 business cards:\n\nblock(0,[]).\nblock(N,[H|T]) :-\n braucht(H,Nh),\n% \\+(member(H,T)),\n D is N - Nh,\n D >= 0,\n block(D,T).\n\n\nThis produces a nice list of blocks of people whose cards fit together on a 900 cards block. But it stops working if I activate the commented line \"\\+member....\" and just gives me a \"false\". But I need to assure that nobody is getting more than once on that block. What am I doing wrong here?"
] | [
"prolog"
] |
[
"Download script resulting in 404 page",
"I have put together a basic PHP script, that, when executed, should trigger a download of file stored on server. I took note from http://php.net/manual/en/function.readfile.php for using readfile function, and used identical code.\n\nThis used to work earlier, but now, suddenly, I've started getting 404 pages instead. Below is the snippet that I have :\n\nheader('Content-Description: File Transfer');\nheader('Content-Type: application/octet-stream');\nheader('Content-Disposition: attachment; filename='.basename($file));\nheader('Expires: 0');\nheader('Cache-Control: must-revalidate');\nheader('Pragma: public');\nheader('Content-Length: ' . filesize($serverPath));\nreadfile($serverPath);\nexit(0);\n\n\nWhen I insert debugging scripts in between, I'm able to see them, along with the weird data that readfile function receives from file, as files are PDF. But, on their own, this just gives me a 404 page with no error/warning anywhere.\n\nCan someone please point me to any issue that I'm having in code, or any thing that I can look into ? Any pointers would be very helpful, as I've spent almost all the day through forums and debugging, and still nowhere near to any kind of solution.\n\nEdit :\n\nBelow are the response headers received from server :\n\nDate: Tue, 21 Feb 2017 23:01:50 GMT\nServer: Apache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/1.0.1e-fips mod_bwlimited/1.4\nX-Powered-By: PHP/5.4.45\nExpires: Wed, 11 Jan 1984 05:00:00 GMT\nCache-Control: no-cache, must-revalidate, max-age=0\nPragma: no-cache\nContent-Disposition: attachment; filename=\"QM-1.pdf\"\nKeep-Alive: timeout=2, max=150\nConnection: Keep-Alive\nTransfer-Encoding: chunked\nContent-Type: application/octet-stream\n\n\nEdit 2 :\n\nSo, I tried the localhost approach, and the code indeed works perfectly fine in my local environment. PHP versions are same at both locations. Apart from that, any pointers where I should look at server level to find the cause behind this behavior ?"
] | [
"php",
"download",
"readfile"
] |
[
"Escape SQL with bash",
"I'm working on importing data into MySQL from two business systems. I've written some bash scripts to compare the differences between the systems in order to only import the relevant parts. Now I need to construct SQL queries so I can load the data. My main problem is to escape single quotes, I've added the code part below that should escape it, but somehow that is only done sometimes, inconsistent. I don't get it...\n\nTEXT=${PART[1]/\\'/\\\\\\'}\n\n\nSo... Are there any better ways / programs I can pipe data through that escapes the data? The absolutely best solution would be to use MySQL's load data infile mixed with on duplicate update, but if I understand correct, that has not yet been implemented."
] | [
"mysql",
"sql",
"bash",
"escaping"
] |
[
"Calling nested http in route Resolver return Observable instead of data",
"I am trying to call nested HTTP call in resolve.ts. and implemented in the following way.\n\napp.route.js:\n { \n path: 'result/:start_date/:end_date', \n component: ResultComponent,\n resolve:{hnData:ResultResolver}\n }\n\n\nfollowing is my resolver code\n\nresult.resolver.ts\n\n resolve(route: ActivatedRouteSnapshot) {\n return this.service.firstHttp()\n .pipe(\n map((data)=>{\n\n param['data_from_firstHttp']= data.result;\n param['checkinDate']=route.paramMap.get('start_date');\n param['checkoutDate']=route.paramMap.get('end_date');\n\n return this.service.searchListing(param);\n\n\n })\n )\n\n\nand the component code\n\nresult.component.ts\n\n { hnData : Observable}\n\n\nHere in the component, I am expecting the result from serchListing service method instead I am getting observable."
] | [
"angular",
"typescript",
"observable",
"angular-routing"
] |
[
"Wordpress shortcode preview in tinyMCE",
"I've written a shortcode and its functioning like it should. Now the hard part:\n\nI would like to show the user a preview already in the tinyMCE editor. Loading CSS in the editor is not a problem for me, but i would love to know if it is possible to already process the shortcode within TinyMCE.\n\nThanks!"
] | [
"tinymce",
"wordpress",
"wordpress-theming"
] |
Subsets and Splits