texts
sequence | tags
sequence |
---|---|
[
"I used a drop down box to load different text box based on option from drop down box but unable to get default view",
"I used a drop down box named dd1 to display the list of cards like select card,visa,master cards.when i use select card as default view in dd1, i should not get any text boxes displayed and when visa or master cards are selected it should display text boxes and labels asking name and card number etc. i am able to get the labels and textboxes when selected visa or master but could not get the default view on selection of select card(which is first option in dd1)\nthis is the code \n\n\n<asp:DropDownList ID=\"dd1\" runat=\"server\" AutoPostBack=\"true\" OnSelectedIndexChanged=\"dd1_SelectedIndexChanged1\">\n <asp:ListItem Text=\"---Select amount\" Selected=\"True\" Value=\"0\"></asp:ListItem>\n <asp:ListItem Text=\"Master card\" Value=\"1\"></asp:ListItem>\n <asp:ListItem Text=\"Maestro\" Value=\"2\"></asp:ListItem>\n <asp:ListItem Text=\"Visa\" Value=\"3\"></asp:ListItem>\n <asp:ListItem Text=\"Visa Debit\" Value=\"4\"></asp:ListItem>\n <asp:ListItem Text=\"Post office Credit card\" Value=\"5\"></asp:ListItem>\n</asp:DropDownList> \n<asp:MultiView ID=\"multiview\" ActiveViewIndex=\"-1\" runat=\"server\">\n <asp:View ID=\"viewtext\" runat=\"server\">\n <p>\n <asp:Label ID=\"cardname\" runat=\"server\" Text=\"Name on card\"></asp:Label>\n <asp:TextBox ID=\"text1\" runat=\"server\" Text=\"\"></asp:TextBox>\n </p>\n <p>\n <asp:Label ID=\"cardnumber\" runat=\"server\" Text=\"Card number\"></asp:Label>\n <asp:TextBox ID=\"text2\" runat=\"server\"></asp:TextBox>\n </p>\n\n\nCode behind is as follows: \n\npublic partial class WebForm3 : System.Web.UI.Page\n{\n protected void Page_Load(object sender, EventArgs e)\n {\n if (IsPostBack)\n return;\n }\n protected void dd1_SelectedIndexChanged1(object sender, EventArgs e)\n {\n if (dd1.SelectedValue==\"1\")\n {\n multiview.ActiveViewIndex = 0;\n }\n\n }\n}\n\n\nPlease help me with this..Thank you in advance.."
] | [
"c#",
"asp.net",
"css"
] |
[
"Errors while installing a Fortran 77 program",
"adwaita@adwaita-HP-2000-Notebook-PC:~/Downloads/netcdf-fortran-4.4.1/v2.9$ make install\nf77 -c gwrdge.f \ngwrdge.inc: In function `luserd':\ngwrdge.inc:32: \n STRUCTURE /gwridge/\n 1 2\nUnrecognized statement name at (1) and invalid form for assignment or statement-function definition at (2)\ngwrdge.inc:50: \n END STRUCTURE\n ^\nInvalid form for END statement at (^)\ngwrdge.f:106: \n RECORD /gwridge/ rdg\n 1 2\nUnrecognized statement name at (1) and invalid form for assignment or statement-function definition at (2)\ngwrdge.inc:50: \n END STRUCTURE\n 1\ngwrdge.f:107: (continued):\n REAL rt\n 2\nStatement at (2) invalid in context established by statement at (1)\ngwrdge.f:100: \n LOGICAL FUNCTION LUSERD(rdg)\n 1\ngwrdge.f:111: (continued):\n IF(rdg.lon .LT. lon1 .OR.\n 2\nInvalid declaration of or reference to symbol `rdg' at (2) [initially seen at (1)]\ngwrdge.f:111: \n IF(rdg.lon .LT. lon1 .OR.\n ^\nPeriod at (^) not followed by valid keyword forming a valid binary operator; `.lon.' is not a valid binary operator\ngwrdge.f:111: \n IF(rdg.lon .LT. lon1 .OR.\n ^\nInvalid declaration of or reference to symbol `lt' at (^) [initially seen at (^)]"
] | [
"fortran",
"gfortran",
"g77"
] |
[
"After Android Studio 4.2.0 update gradle error solved",
"enter image description here\nAfter i did my 4.2.0 android studio update i got gradle module error.I just solved it so i publish it to whom got the same error.Just change the following path In the picture,on the build.gradle part .On default it writes ext.kotlin_version = "1.5.0-release 764".After you change it to ext.kotlin_version = "1.5.0" ,android studio redownload the module and you good to go.Hope it helps."
] | [
"android-studio",
"kotlin"
] |
[
"reading more than one word from user",
"main class :\n\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n\n Scanner input = new Scanner(System.in);\n\n Student std = new Student();\n\n System.out.println(\"plz , inter id :\");\n std.setId(input.nextInt());\n\n System.out.println(\"plz , inter name :\");\n std.setName(input.next());\n\n System.out.println(\"plz , inter Age :\");\n std.setAge(input.nextInt());\n\n System.out.println(\"plz , inter department :\");\n std.setDepartment(input.next());\n\n System.out.println(\"plz , inter GPA :\");\n std.setGpa(input.nextFloat());\n\n std.printStudentInfo();\n\n }\n}\n\n\nStudent class :\n\npublic class Student {\n\n private int id;\n private String name;\n private int age;\n private String department;\n private float gpa;\n\n public void setId(int Pid) {\n this.id = Pid;\n }\n\n public int getId() {\n return this.id;\n }\n\n public void setName(String Pname) {\n this.name = Pname;\n }\n\n public String getName() {\n return this.name;\n }\n\n public void setAge(int Page) {\n this.age = Page;\n }\n\n public int getAge() {\n return this.age;\n }\n\n public void setDepartment(String Pdepartment) {\n this.department = Pdepartment;\n }\n\n public String getDepartment() {\n return this.department;\n }\n\n public void setGpa(float Pgpa) {\n this.gpa = Pgpa;\n }\n\n public float getGpa() {\n return this.gpa;\n }\n\n public void printStudentInfo() {\n System.out.println(\"-------------- \" + \"[\" + this.id + \"]\" + \" \"\n + this.name.toUpperCase() + \" -----------------\");\n System.out.println(\"age : \" + this.age);\n System.out.println(\"Department : \" + this.department);\n System.out.println(\"Gpa : \" + this.gpa);\n }\n}\n\n\nthis is a simple application that reads some data from the user and print it out , I want to read more than one word from the user in my tow string fields \"name , department\" , but , when I inter department name of two or more words like \"computer science \" , I get an error , I also tried to use nextline() instead of next() , similar results , I end up making another error !"
] | [
"java"
] |
[
"Strange async/await behaviour in a class",
"Node 7.9.0\n\nThis is the scenario:\n\nclass TestClass {\n constructor() {\n const x = await this.asyncFunc()\n console.log(x)\n }\n async asyncFunc() {\n return new Promise((accept) => {\n setTimeout(() => accept(\"done\"), 1000)\n })\n }\n}\nnew TestClass()\n\n\nThe error is Unexpected token this on line 3\n\nOK, so I wrap it up like this... const x = await (this.asyncFunc())\n\nNow I get await is not defined\n\nIt makes me think that node 7.9.0 has no idea about await/sync despite http://node.green/ telling me it is supported and it's example is running just fine.\n\n(function(){\n(async function (){\n await Promise.resolve();\n var a1 = await new Promise(function(resolve) { setTimeout(resolve,800,\"foo\"); });\n var a2 = await new Promise(function(resolve) { setTimeout(resolve,800,\"bar\"); });\n if (a1 + a2 === \"foobar\") {\n console.log(\"passed\")\n }\n}());\n})()"
] | [
"javascript",
"node.js",
"asynchronous",
"async-await"
] |
[
"Is there a runtime proxy creation library that supports to retain annotations of the proxied class?",
"When creating a proxy with for example cglib or javassist proxies, this proxy is implemented by creating a subclass of the proxy target. However, this means that the annotations on this proxy are lost. This is problematic when a class is processed by two libraries where:\n\n\nThe first libraries requires the creation of a proxy of a given class to function.\nThe second library process objects by reading annotations from them.\n\n\nFor the second library, the annotations have disappeared when simultaneously using the first library. The question is: Does there exist a runtime code generation library with a high-level API that allows for an easy retention of the annotations of the proxied class?"
] | [
"java",
"code-generation",
"bytecode",
"proxy-classes",
"byte-buddy"
] |
[
"jquery mobile 1.3 remote autocomplete can't select an element within the dynamically created list",
"I set up an alert when I click on the class \"upperUlProductSearch\" but when I click on the li within the ajax created list I don't get a response. I have also an a tag and another static ul li with the same class that when clicked does give me the alert. I was hoping someone could help me figure out why I can't target the ajax li or the proper way to. Thanks in advanced!!!\n\njquery:\n\n$( document ).on( \"pageinit\", \"#template\", function() {\n$( \"#upperApplianceSearch\" ).on( \"listviewbeforefilter\", function ( e, data ) {\n var $ul = $( this ),\n $input = $( data.input ),\n value = $input.val(),\n html = \"\";\n $ul.html( \"\" );\n if ( value && value.length > 1 ) {\n $ul.html( \"<li><div class='ui-loader'><span class='ui-icon ui-icon-loading'></span></div></li>\" );\n $ul.listview( \"refresh\" );\n $.ajax({\n url: \"productautocomplete.php\",\n type: \"POST\",\n dataType: \"json\",\n data: {\n q: $input.val()\n }\n })\n .then( function (data) {\n $.each( data, function ( i, val ) {\n /*html += \"<li><a href='#' data-role='none' value=\" + val.productId + \">\" + val.productName + \"</a></li>\";*/\n html += '<li class=\"upperUlProductSearch\" id=' + val.productId + '>' + val.productName + '</li>';\n });\n $ul.html( html );\n $ul.listview( \"refresh\" );\n $ul.trigger( \"updatelayout\");\n });\n }\n});\n})\n\n$(\".upperUlProductSearch\").click(function() {\nalert (\"helleo\");\n});\n\n\nhtml:\n\n<ul id=\"upperApplianceSearch\" class=\"ui-listview ui-listview-inset ui-\ncorner-all ui-shadow\" data-filter-theme=\"d\" data-filter-placeholder=\"Find an \nappliance...\" data-filter=\"true\" data-icon=\"false\" data-inset=\"true\" data- \nrole=\"listview\">\n\n<li id=\"41\" class=\"upperUlProductSearch ui-li ui-li-static ui-btn-up-f ui- \nfirst-child ui-last-child\">Hawley</li>\n</ul>\n\n<a class=\"upperUlProductSearch ui-link\">Hello</a>\n\n<ul class=\"ui-listview\" data-role=\"listview\">\n <li class=\"upperUlProductSearch ui-li ui-li-static ui-btn-up-f ui-first- child ui-last-child\">Li Test</li>\n</ul>"
] | [
"jquery",
"jquery-mobile"
] |
[
"Changing Filenames on a NAS with Python",
"I have a python script that works perfectly to find and replace specified characters or phrases with other information (in most cases I am just removing characters) when the location of the folder to scan is on the local laptop.\n\nWhen trying to change its path to a folder on my NAS, there is no update to the filename while pycharm returns a successful code.\n\nIf possible, I'd like to avoid copy GBs worth of data to my laptop to modify and then push it back to the NAS.\n\nBelow is the script contents:\n\nimport os\n\npaths = (os.path.join(root, filename)\n for root, _, filenames in os.walk('afp://NAS-SYN._afpovertcp._tcp.local/Home/Documents/Finances')\n for filename in filenames)\n\n# The keys of the dictionary are the values to replace, each corresponding\n# item is the string to replace it with\nreplacements = {'&': '',\n 'Hello.Everyone.':'Hello Everyone - '}\n\n\nfor path in paths:\n # Copy the path name to apply changes (if any) to\n newname = path\n # Loop over the dictionary elements, applying the replacements\n for k, v in replacements.items():\n newname = newname.replace(k, v)\n if newname != path:\n os.rename(path, newname)"
] | [
"python",
"filenames"
] |
[
"Android ActionBar disappeared in some of the layouts",
"Here is my manifest file : \n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n <manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n package=\"com.bankaspace.servicefinder\">\n\n <uses-permission android:name=\"android.permission.INTERNET\" />\n\n <application\n android:allowBackup=\"true\"\n android:icon=\"@mipmap/ic_launcher3\"\n android:label=\"@string/app_name\"\n android:roundIcon=\"@mipmap/ic_launcher3_round\"\n android:supportsRtl=\"true\"\n android:theme=\"@style/AppTheme\">\n <activity android:name=\".MainActivity\">\n <intent-filter>\n <action android:name=\"android.intent.action.MAIN\" />\n\n <category android:name=\"android.intent.category.LAUNCHER\" />\n </intent-filter>\n </activity>\n <activity android:name=\".doctorSearch\" />\n <activity android:name=\".garageSearch\" />\n <activity android:name=\".plumberSearch\" />\n <activity android:name=\".electricianSearch\" />\n <activity android:name=\".tutorSearch\" />\n <activity android:name=\".DetailProfile\" />\n <activity android:name=\".ContactForm\"></activity>\n </application>\n\n </manifest>\n\n\nhere is my layout file\n\n <ScrollView xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\">\n <LinearLayout\n xmlns:tools=\"http://schemas.android.com/tools\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:orientation=\"vertical\"\n android:padding=\"10dp\"\n android:background=\"#fcfcfc\"\n android:gravity=\"center\"\n android:id=\"@+id/ll\">\n\n <LinearLayout\n android:clipToPadding=\"false\"\n android:gravity=\"center\"\n android:orientation=\"horizontal\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\">\n <android.support.v7.widget.CardView\n android:foreground=\"?android:attr/selectableItemBackground\"\n android:clickable=\"true\"\n android:id=\"@+id/doctorId\"\n android:layout_width=\"160dp\"\n android:layout_height=\"190dp\"\n android:layout_margin=\"10dp\">\n\n\nI tried to apply a toolbar in place of action bar. In the process I may have changed a bit of lines but I reverted the changes done then, now the action bar is invisible. I have no idea what might cause this, everything is reverted to the original code of lines. Some activities do have the action bar from the project."
] | [
"android",
"xml",
"layout",
"android-actionbar",
"android-manifest"
] |
[
"Why no warning when int in bool context?",
"I always use all compilation warnings to prevent possible errors. And tries to use strict code. But tooday I got a case which is not covered by -Wall. So wy next code is correct?\n#include <stdio.h>\n\nbool func()\n{\n int a = 10;\n return a;\n}\n\nint main()\n{\n int b = func();\n\n printf("%d\\n", b); // shows 1\n \n return 0;\n}\n\nHere obvious error. Bool function returns int variable. And I expected that compiler can find it for me.\nCompilation and start output:\n$ g++ --version\ng++ (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2)\nCopyright (C) 2019 Free Software Foundation, Inc.\nThis is free software; see the source for copying conditions. There is NO\nwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n$ g++ -O0 -Wall -Wextra -pedantic main.cpp\n$ ./a.out\n1"
] | [
"compiler-errors",
"g++"
] |
[
"How to query two tables to get user that hasn't voted?",
"I'm stuck doing this sql query....I have two tables one with all my users and another one with votes per user.\nI want to check the users that hasn't voted.\nI'm trying some like this but is not working.\n\nusuarios table \n----------------------\n| id | username |\n----------------------\n\nvotes \n--------------------------------------------\n| id | user | mes | ano |\n\n\n\nSELECT DISTINCT a.username \nFROM usuarios a\n , votes b \nWHERE a.username != b.user \nAND b.ano = 2019 \nAND b.mes = 11\n\n\non my usuarios table i hvae 20 entries.\n\n1 | user1\n2 | user2\n........\n\non my votes table \n1 | user1 | 11 | 2019\n\n\nand with the query I want to get only the users from(usuarios table) that are not on my votes table;"
] | [
"mysql",
"sql",
"database"
] |
[
"Fortran zlib Example Compilation on Ubuntu",
"I like using the gzstream library in C++ and would like similar functionality in Fortran77 code. However, my MWE doesn't find the references, and it is unclear to me if I have the correct Fortran wrapper installed.\n\nThere is documentation available at DESY for using zlib from Fortran but with no indication which zlib version it is referring to or how to obtain the Fortran wrapper.\n\nI'd like to use standard packages as much as possible to make it easy to stay up to date.\n\nOutput of dpkg -l 'zlib*':\n\n||/ Name Version Architecture Description\n+++-===========================-==================-==================-===========\nun zlib1 <none> <none> (no description available)\nun zlib1-dev <none> <none> (no description available)\nii zlib1g:i386 1:1.2.8.dfsg-2ubun i386 compression library - runtime\nii zlib1g-dev:i386 1:1.2.8.dfsg-2ubun i386 compression library - development\n\n\nzlib1-dev has no installation candidate.\n\ndpkg -L zlib1g-dev:i386 shows the location of the static library as\n/usr/lib/i386-linux-gnu/libz.a\n\nAccordingly, to exclude library path issues, I am trying to compile with\ngfortran -fdefault-real-8 -fdefault-double-8 -O -Wall -Wtabs zlibtest.f /usr/lib/i386-linux-gnu/libz.a\n\nI am obtaining\n\n/tmp/ccWl8klj.o: In function `MAIN__':\nzlibtest.f:(.text+0x26): undefined reference to `gzopen_'\nzlibtest.f:(.text+0xfd): undefined reference to `gzwrite_'\nzlibtest.f:(.text+0x128): undefined reference to `gzclose_'\ncollect2: error: ld returned 1 exit status\n\n\nMy MWE code:\n\n program zlibtest\n implicit none\n\n integer ii\n integer fhandle, istat\n character*256 outline\n parameter (fhandle=0)\n\n call gzopen(fhandle, 'w', 'zlibtest.dat', istat)\n do ii=1,10\n write(outline, '(3i10)') ii, ii**2, ii**3\n call gzwrite(fhandle, outline)\n end do\n call gzclose(fhandle, istat)\n\n end program"
] | [
"linux",
"ubuntu",
"compilation",
"fortran"
] |
[
"Insert data in laravel IDENTITY_INSERT is set to OFF",
"So i got the problem when i insert the data on database sqlserver. the id sqlserver refuse to insert because the database want to insert id it self.\n\ni have to try to set IDENTITY_INSERT ON like this :\n\nDB::statement('SET IDENTITY_INSERT articles ON;');\n\nand set IDENTITY_INSERT to OFF like this :\n\nDB::statement('SET IDENTITY_INSERT articles OFF;');\n\nbut it isn't work for my code.\n\n public function store(Request $request){\n //to sparate to methode\n $article = $request->isMethod('put') ? Article::findOrFail($request->article_id) : new Article;\n\n $article->id = $request->input('article_id');\n $article->title = $request->input('title');\n $article->body = $request->input('body');\n\n DB::statement('SET IDENTITY_INSERT articles ON;');\n if($article->save()){\n return new ArticleResources($article);\n }\n DB::statement('SET IDENTITY_INSERT articles OFF;');\n\n }\n\n\nthis error look like this: \n\n\n SQLSTATE[23000]: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Cannot insert explicit value for identity column in table 'articles' when IDENTITY_INSERT is set to OFF."
] | [
"laravel",
"sqlsrv"
] |
[
"D2L Valence: Retrieve Final Grades",
"Is there a way to get both the Final Calculated Grade and the Final Adjusted Grade? I would like to be able to compare them."
] | [
"desire2learn",
"valence"
] |
[
"what is difference between (define (add x y) (+ x y)) and (define add (lambda (x y) (+ x y)))?",
"I am now writing a scheme's interpreter by using c++. I got a question about define and lambda.\n\n(define (add x y) (+ x y))\n\n\nis expanded as\n\n(define add (lambda (x y) (+ x y)))\n\n\nby lispy.py\n\nwhat's the difference between this two expression?\n\nwhy need expand the expression? Just because it is easy to evaluate the expression?"
] | [
"scheme",
"lisp",
"sicp"
] |
[
"Process returned -1073741819 (0xC0000005) Error when compiling C++ Clock",
"I am trying to make a digital clock.\n\nI understand that the error message is due to a memory problem. My Build log don't show no error.\n\nI have successfully included the libbgi.a as a linked library and the -lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32 as linker options. \n\nWhat may me do to fix it?\n\n#include <graphics.h>\n#include <time.h>\n\nint main()\n{\n int gd = DETECT, gm;\n char driver[] = \"C:\\\\TC\\\\BGI\";\n initgraph(&gd, &gm, driver);\n\n time_t rawTime;\n //Created a pointer variable of tm struct. Variable name is currentTime.\n struct tm * currentTime;\n char a[100];\n\n while(1)\n //Always true\n {\n //%I=%DD, %M=%D, %S=%C;\n\n rawTime = time(NULL);\n currentTime = localtime(&rawTime);\n strftime(a, 100, \"%I:%M:%S\", currentTime);\n //function copies the third value, see: 'S', into the first argument (\"a\").\n //a holds the value %I:%M:%S\".\n //%I will be replaced by Hour in 12h format (01-12).\n //%M will be replaced by Minute (00-59).\n //%S will be replaced by Second (00-61).\n //'100' is the maximum number of characters to be copied to 'a'.\n setcolor(11);\n settextstyle(3, HORIZ_DIR, 10);\n outtextxy(200, 100, a);\n //see: color, location.\n\n strftime(a, 100, \"%p\", currentTime);\n settextstyle(3, HORIZ_DIR, 2);\n outtextxy(600, 8, a);\n\n delay(1000);\n\n }\n\n strftime(a, 100, \"%a, %d %b, %Y\", currentTime);\n settextstyle(3, HORIZ_DIR, 5);\n outtextxy(130, 310, a);\n\n //%p format is for AM or PM designation.\n //%a format specifier is for abbreviated weekday name. Ex: Mon, Tue, Wed etc...\n //%d format specifier is for the day of the month (1-31).\n //%b format specifier is for abbreviated month name. Ex: Jan, Feb, mar etc...\n //%Y formate specifier is for the year Ex: 2015.\n\n getch();\n closegraph();\n}\n\n\nExpected a beautiful digital clock face for me to edit. Now, I see:\n\nProcess returned -1073741819 (0xC0000005) execution time : 1.849 s\nPress any key to continue."
] | [
"c++",
"compilation",
"codeblocks",
"bgi",
"winbgi"
] |
[
"Spark dataframe with strange values after reading CSV",
"Coming from here, I'm trying to read the correct values from this dataset in Pyspark. I made a good progress using df = spark.read.csv("hashtag_donaldtrump.csv", header=True, multiLine=True), but now I have some weird values in some cells, as you can see in this picture (last lins):\n\nDo you know how could I get rid of them? Or else, how can I read the CSV with format using another program? It's very hard for me to use a text editor like Vim or Nano and try to guess where are the errors. Thank you!"
] | [
"python",
"csv",
"apache-spark",
"pyspark"
] |
[
"How to access div in sharepoint aspx in its webpart codebehind",
"i have an aspx sharepoint page with webpart. how to set display=none to a div in the page(aspx) inside the webpart codebehind(ascx.cs).\n\ncode:\n\n<asp:Content ContentPlaceHolderId=\"PlaceHolderMain\" runat=\"server\">\n<script type=\"text/javascript\">\nfunction ShowGearPage() {\n var gearPage = document.getElementById(\"GearPage\");\n gearPage .style.display = \"block\";\n\n var loginPage = document.getElementById(\"MasterTable\");\n loginPage.style.display = \"none\";\n return true;\n}\n </script>\n\n\n <div align=\"center\" id=\"GearPage\" style=\"display:none;\">\n<div id=\"s4-simple-card\" class=\"s4-simple-gearpage\">\n <div id=\"s4-simple-card-content\">\n <h1>\n <img id=\"gearsImage\" alt=\"This animation indicates the operation is in progress.\"\n src=\"gears_anv4.gif\" style=\"width: 24px; height: 24px; font-size: 0px;\"\n align=\"middle\" />\n Processing...\n </h1>\n <div>\n\n </div>\n\n </div>\n</div>\n\n\n\n \n ShowGearPage();\n \n \n \n \n \n\nI want to hide the GearPage div and show the Master div in the DisplayReportWebPart webpart codebehind."
] | [
"asp.net",
"sharepoint-2010",
"web-parts"
] |
[
"Control horizontal scroll with javascript",
"I'm working on a project and I'm stranded and i decided to ask you for help\n\nI have 2 Divs\n\n1- Div that stores content with full width\n\n2- Div that simulates a scrollbar, which will make scrolling of the first Div\n\nbelow my project image\nhttps://prnt.sc/n1vyg5\n\n100% functional example\nhttps://www.udacity.com/course/blockchain-developer-nanodegree--nd1309\nin the session \"Learn with the best\"\n\nThe structure is similar to this\n\n.page {\n overflow: hidden;\n}\n.container {\n width: 60%;\n margin: auto;\n}\n\nh3 {\n background: #dbd0bc;\n color: #000;\n padding: 1rem;\n}\n\n.hs {\n list-style: none;\n overflow-x: auto;\n overflow-y: hidden;\n white-space: nowrap;\n width: 100%;\n padding: 0 20% 2rem 20%;\n}\n\n.hs .item {\n display: inline-block;\n width: 17rem;\n background: #dbd0bc;\n text-align: center;\n margin-right: 0.75rem;\n height: 10rem;\n white-space: normal;\n}\n\n.scrollbar {\n width: 100%;\n background: #bcc9d4;\n height: 0.2rem;\n position: relative;\n margin: 3rem 0 3rem 0;\n border-radius: 2rem;\n height: 0.2rem;\n}\n.handle {\n position: absolute;\n width: 30%;\n height: 0.7rem;\n background: purple;\n cursor: pointer;\n cursor: -webkit-grab;\n top: 50%;\n transform: translateY(-50%);\n border-radius: 2rem;\n top: 1px !important;\n}\n\n\n<div class=\"page\">\n <div class=\"container\">\n <h3>Container</h3>\n </div>\n\n <ul class=\"hs\">\n <li class=\"item\">test</li>\n <li class=\"item\">test</li>\n <li class=\"item\">test</li>\n <li class=\"item\">test</li>\n <li class=\"item\">test</li>\n <li class=\"item\">test</li>\n <li class=\"item\">test</li>\n <li class=\"item\">test</li>\n </ul>\n\n <div class=\"container\">\n <div class=\"row\">\n <div class=\"scrollbar\">\n <div class=\"handle\"></div>\n </div>\n </div>\n </div>\n</div>\n\n\n$('.handle').draggable({\n axis: 'x',\n containment: 'parent',\n drag: function (event, ui) {\n console.log(ui.position.left)\n }\n});\n\n\nI do not know how to synchronize the drag of the '.handle' with the scrolling of the first div"
] | [
"javascript",
"html",
"css",
"scroll",
"scrollbar"
] |
[
"Copy Table from a Server and Insert into another Server: What is wrong with this T-SQL query?",
"I am using SQL Server 2014. I have created the following T-SQL query which I uploaded to my local SQL server to run as a job process on a daily basis at a specific time. However, I noticed that it failed to run. If I run it manually in SSMS, it runs correctly.\nWhat is preventing the query to run as an automated process? Is it a syntax issue?\n\nUSE MyDatabase\nGO\n\nDELETE FROM ExchangeRate -- STEP 1\n\n;WITH MAINQUERY_CTE AS ( --STEP 2\n SELECT *\n FROM (\n SELECT *\n FROM [178.25.0.20].HMS_ARL.dbo.ExchangeRate\n ) q\n\n)\nINSERT INTO ExchangeRate --STEP 3\nSELECT *\nFROM MAINQUERY_CTE\n\n\nBasically, the function of the query is to copy a table named ExchangeRate from the live server and paste its content in a table of the same name (which already exists on my local server).\n\nError Log shows the following message:\n\n\n Description: Executing the query \"USE MyDatabase DELETE FROM\n ExchangeRate...\" failed with the following error: \"Access to the\n remote server is denied because no login-mapping exists.\". Possible\n failure reasons: Problems with the query, \"ResultSet\" property not set\n correctly, parameters not set correctly, or connection not established\n correctly. End Error DTExec: The package execution returned\n DTSER_FAILURE (1). Started: 10:59:30 AM Finished: 10:59:30 AM \n Elapsed: 0.422 seconds. The package execution failed. NOTE: The\n step was retried the requested number of times (3) without succeeding.\n The step failed."
] | [
"sql",
"sql-server",
"copy",
"sql-server-2014",
"linked-server"
] |
[
"Back to revision in Subversion",
"suppose you update your code to revision 10 which is broken. You want to go back to revision 9, work on the code and wait until someone will fix the build:\n\nsvn merge -rHEAD:9 .\n\n\nBut it won't work, why?"
] | [
"svn",
"version-control"
] |
[
"Spymemcached client and time out error",
"I am facing a weird problem with spymemcached client. Say I am in a box whose public ip is x and memcache is running in this box, when I run spymemcached client on the same box and connect to memcache using it's ip as x, I get a timeout error. When I replace x as 127.0.0.1 things work fine. At the same time, if I run the code from a different box and connect to the memcache box as x, things work fine. What is happening here?"
] | [
"networking",
"spymemcached"
] |
[
"MVC 5 Dynamic Rows with BeginCollectionItem",
"What is the best way to add/delete rows to a table when a button is clicked? I need rows created from ChildClass properties (child class is a list within the main class/model).\n\nCurrently have a View (model is MyMain) which references a Partial View using RenderPartial.\n\nThe partial view displays the properties of the model, a class called MyChild which is an object list within MyMain.\n\nI want to have add and delete buttons to dynamically add the rows which are held within the partial view.\n\nSo adding MyChild repeatedly for more rows on the list.\nIs this possible? Or should I not be using partial views for this?\n\nUpdated Code\n\nBelow are the current classes and views I'm working with, I've been trying to implement the BeginCollectionItem helper but I'm getting null ref where I'm trying to load the partial view despite the if statement saying to create a new instance of the child class if doesn't exist - why is this being ignored?\n\nMain View\n\n @using (Html.BeginForm())\n{\n <table>\n <tr>\n <th>MyMain First</th>\n <th>MyChild First</th>\n </tr>\n <tr>\n <td>\n @Html.EditorFor(m => m.First)\n </td>\n <td>\n @if (Model.child != null)\n {\n for (int i = 0; i < Model.child.Count; i++)\n {\n Html.RenderPartial(\"MyChildView\");\n }\n } \n else\n {\n Html.RenderPartial(\"MyChildView\", new MvcTest.Models.MyChild());\n } \n </td>\n </tr>\n @Html.ActionLink(\"Add another\", \"Add\", null, new { id = \"addItem\" })\n </table>\n}\n\n\nPartial View\n\n@model MvcTest.Models.MyChild\n\n@using (Html.BeginCollectionItem(\"myChildren\"))\n{\n Html.EditorFor(m => m.Second);\n}\n\n\nModels\n\npublic class MyMain\n{\n [Key]\n public int Id { get; set; }\n public string First { get; set; }\n public List<MyChild> child { get; set; }\n}\n\npublic class MyChild\n{\n [Key]\n public int Id { get; set; }\n public string Second { get; set; }\n}\n\n\nController\n\npublic class MyMainsController : Controller\n{\n // GET: MyMains\n public ActionResult MyMainView()\n {\n return View();\n }\n\n [HttpPost]\n public ActionResult MyMainView(IEnumerable<MyChild> myChildren)\n {\n return View(\"MyMainView\", myChildren);\n }\n\n public ViewResult Add()\n {\n return View(\"MyChildView\", new MyChild());\n }\n}"
] | [
"c#",
"asp.net-mvc",
"asp.net-mvc-4",
"razor",
"asp.net-mvc-5"
] |
[
"Linux Bash Script Regex malfunction",
"I would like to make a bash script, which should decide about the given strings, if they fulfill the term or not.\n\nThe terms are:\n\n\nThe string's first 3 character must be \"le-\"\nBetween hyphens there can any number of consonant in any arrangement, just one \"e\" and it cannot contain any vowel.\nBetween hyphens there must be something\nThe string must not end with hyphen\n\n\nI made this script:\n\n#!/bin/bash\n# Testing regex\n\nwhile read -r line; do\n if [[ $line =~ ^le((-[^aeiou\\W]*e+[^aeiou\\W]*)+)$ ]]\n then\n printf \"\\\"\"$line\"\\\"\\t\\t\\t-> True\\n\";\n else\n printf \"\\\"\"$line\"\\\"\\t\\t\\t-> False\\n\";\n fi\ndone < <(cat \"$@\")\n\n\nIt does everything fine, except one thing:\nIt says true no matter how many hyphens are next to each other.\nFor example:\nIt says true for this string \"le--le\"\n\nI tried this regex expression on websites (like this) and they worked without this malfunction.\nAll I can think of there must be something difference between the web page and the linux bash. (All I can see on the web page is it runs PHP)\n\nDo you have got any idea, how could I make it work ?\n\nThank you for your answers!"
] | [
"regex",
"linux",
"bash"
] |
[
"How can I target an objects properties using a variable and string?",
"I'm trying to build a simple yes/no diagnostic tool as part of learning Javascript. I'm coming absolutely unstuck on how to dynamically target an object's properties based on an external variable such as 'stage'.\nFor example,\nVisually Stage 1 has a title and two buttons. When I select one of the buttons (say yes), the information is replaced with the stage 2 yes information.\nSo far I've created my objects (what I'm using to hold the info for each page).\nfunction stage (name, title, button1, button2) {\n this.name = name;\n this.title = title;\n this.button1 = button1;\n this.button2 = button2;\n}\n\nvar Stage1A = new stage ('Stage1A', 'success', 1, 2);\nvar Stage1B = new stage ('Stage1B', 'failure', 1, 2);\n\nNow I'm trying to access the information inside each object based on the current stage number.\nvar stageNumber = 1;\n\nfunction myFunction(){\n\n\n document.getElementById("title").innerHTML = ("Stage"+stageNumber+"A").title;\n}\n\nThis returns a result of undefined. Can anyone point me in the right direction?"
] | [
"javascript"
] |
[
"Valgrind examine memory, patching lackey",
"I would like to patch valgrind's lackey example tool. I would like to \nexamine the memory of the instrumented binary for the appearence\nof a certain string sequence around the pointer of a store instruction.\nAlternatively scan all memory regions on each store for the appearence\nof such a sequence. Does anyone know a reference to a adequate\nexample? Basically I'd like to \n\nfor (i = -8; i <= 8; i++) {\n if (strncmp(ptr+i, \"needle\", 6) == 0) \n printf(\"Here ip: %x\\n\", ip);\n}\n\n\nBut how can I verify that ptr in the range of [-8,8] is valid? Is there\na function that tracks the heap regions? Or do I have to track /proc/pid/maps each time?\n\n// Konrad"
] | [
"valgrind",
"instrumentation"
] |
[
"Can't create .xlsx file",
"I'm trying to create '.xlxs' file via xlsxwriter but it doesn't create.\nAfter entering the command, nothing happens.\n\nimport xlsxwriter\nworkbook = xlsxwriter.Workbook('file.xlsx')"
] | [
"python",
"python-3.x",
"xlsxwriter"
] |
[
"Access forbidden for identity on javascript Twilio chat SDK",
"I'm using twilio chat javascript SDK and I'm having problems when I try to create a new channel and invite a user.\nBoth users (sender and receiver) receive this error:\nError: Access forbidden for identity\n\nBut if I go to the dashboard, the channel is created with the 2 members.\nWhat am I doing wrong?\n\nPS: I'm creating user tokens as listed on Twilio API, I don't believe token could be a problem because the message is already sent.\nIt seems the problem happen when I join the channel.\n\nMy code to create the channel:\n\nthis.client.createChannel({\n uniqueName: roomName,\n friendlyName: 'My Channel',\n type: 'private'\n}).then(channel => {\n this.channel = channel\n this.channel.join()\n});\n\n\nMy invite code is just:\n\nthis.channel.invite(user)\n\n\nand to generate user tokens:\n\nnew Fingerprint2().get(fingerprint => {\n this.fingerprint = fingerprint\n\n let AUTH_TOKEN = $('meta[name=csrf-token]').attr('content')\n\n fetch('/chat/tokens', {\n method: 'POST',\n body: JSON.stringify({\n fingerprint: fingerprint,\n authenticity_token: AUTH_TOKEN,\n email: email\n }),\n headers: {\n 'X-Requested-With': 'XMLHttpRequest',\n 'X-CSRF-Token': $('meta[name=\"csrf-token\"]').attr('content'),\n 'Content-Type': 'application/json',\n 'Accept': 'application/json'\n }\n }).then(result => result.json()).then(data => {\n callback({ token: data.token, username: data.username })\n })\n})\n\n\nand on my API\n\nuser = User.find_by_email(params[:email])\n\naccount_sid = ENV['TWILIO_ACCOUNT_SID']\napi_key = 'SKe9fcdbefe0bdc1f01af4aa50d3548b70'\napi_secret = 'oslALMC18tCZrUhBRDPin5KbqPSR9Rr4'\n\nservice_sid = ENV['TWILIO_SERVICE_ID']\ndevice_id = params[:fingerprint]\nidentity = user.username\nendpoint_id = \"FakeEndPoint:#{identity}:#{device_id}\"\n\ngrant = Twilio::JWT::AccessToken::IpMessagingGrant.new\ngrant.service_sid = service_sid\ngrant.endpoint_id = endpoint_id\n\ntoken = Twilio::JWT::AccessToken.new(\n account_sid,\n api_key,\n api_secret,\n [grant],\n identity: identity\n)\n\nrender status: 200, json: { token: token.to_jwt, username: user.username }\n\n\na token sample:\n\neyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImN0eSI6InR3aWxpby1mcGE7dj0xIn0.eyJqdGkiOiJTS2U5ZmNkYmVmZTBiZGMxZjAxYWY0YWE1MGQzNTQ4YjcwLTE1MDExNjA0MjAiLCJncmFudHMiOnsiaWRlbnRpdHkiOiJqb25hdGFzIiwiaXBfbWVzc2FnaW5nIjp7InNlcnZpY2Vfc2lkIjoiSVMwYThiM2NkYTllMTU0YTUyOTg3MjJkOTRjOTI5ZjBhOSIsImVuZHBvaW50X2lkIjoiSGlwRmxvd1NsYWNrRG9ja1JDOmpvbmF0YXM6ZmU2NGZjYTA5NDc4YjYzNjNlYTFiMzA3OGQzOTQwM2MifX0sImlzcyI6IlNLZTlmY2RiZWZlMGJkYzFmMDFhZjRhYTUwZDM1NDhiNzAiLCJuYmYiOjE1MDExNjA0MjAsImV4cCI6MTUwMTE2NDAyMCwic3ViIjoiQUMxN2VmODM5N2JhODJkZWQ2ZDlmZmE0ODFkMWI2YTczMSJ9.UF8XtcEBN8LSCKVvBRscu9CmYdgMVobTd84RowF5KaU"
] | [
"twilio"
] |
[
"Command not found when remote run cmd with RPYC",
"I started rpyc_classic service on slave A\nHere is the PATH in A:\n\n/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/bin:/sbin:/usr/bin:/usr/local/bin:/bin/bash:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-2.b14.el7.x86_64/bin:/home/hscaleflux/.local/bin:/home/hscaleflux/bin\n\n\nBut I get wrong PATH by rpyc:\n\nconn = rpyc.classic.connect(host)\nos_mod = conn.modules.os\nos_mod.environ.get(\"PATH\")\n\n>>>'/usr/local/bin:/usr/bin'\n\n\nWith this wrong path. I will get \n\n\"Command not found\"\n\n\nwhen run command not in \"/usr/local/bin:/usr/bin\"\".\n\nAny solutions?"
] | [
"python",
"rpyc"
] |
[
"JQuery MVC and Internet Explorer",
"Hey guys, i have a crazy problem. I have been running my webapp on firefox and it works fine. However, my client will be using internet explorer. I dont think it will work me just saying in order to use this, you have to use firefox so i am trying to correct this damn bug.\nI have 3 dropdownlists, a parent, a parent/child and a child. And populating these lists is a controller action being called by jquery (i am using 1.4.2) and a function called $.fn.loadselect\n\n$(function () {\n $.fn.loadSelect = function (data) {\n return this.each(function () {\n this.options.length = 0;\n var select = this;\n $.each(data, function (index, itemData) {\n var option = new Option(itemData.Text, itemData.Value);\n $(select).append(option);\n });\n });\n };\n});\n\n\nMy controller action is returning a json object, which when a breakpoint is returning the correct action.\nNow what is happening is the parent dropdownlist is fine. Because the loadselect function is being called to populate it. However, the second dropdownlist parent/child which is controlled by the parent and controls the child, all of the data in the dropdownlist appear as empty strings. Same as the child dropdownlist, all of the data appear as empty strings. This is very frustrating, and when i copy the source from inet explorers view source and open that in inet explorer, everything is fine."
] | [
"jquery",
"asp.net-mvc",
"internet-explorer"
] |
[
"ignore spaces and dashes in javascript search code",
"I've got a search box where as I type, table data gets filtered through and only matching results get shown. It works great; however, I want to make it better.\n\nI want the code to ignore spaces and dashes. I'd prefer make it easy to add additional characters I want it to ignore as well in the future..\n\nFor instance...\n\nProduct Table\nFH-54\nTDN 256\nTDN25678\nFH54\n\nIn the search box, if I type FH54, I'd like both the FH-54 and the FH54 to show up. If I type in FH-54 I'd also like the FH54 and the FH-54 to show up and so on to include FH 54 as well.\n\nIf I type in TDN2 or TDN 2 in the search box, I'd like TDN 256 and TDN25678 to show up.\n\n\n\n<b>Product Search</b><br /><form class=\"formatted\">\n<input id=\"Search\" data-class=\"search_product\" type=\"text\" /></form>\n\n\n\n\n<script type=\"text/javascript\">\n\n $('#Search').on('keyup', function(e) {\n $(\"#noData\").remove();\n var value = $(this).val();\n value = value.replace(/\\\\/g, '');\n var patt = new RegExp(value, \"i\");\n var sw = 0;\n var counter = 0;\n $('#Data tbody').find('tr').each(function() {\n counter++;\n if (!($(this).find('td').text().search(patt) >= 0)) {\n $(this).not('#header').hide();\n sw++;\n } else if (($(this).find('td').text().search(patt) >= 0)) {\n $(this).show();\n }\n });\n if (sw == counter) {\n $(\"#Data tbody\").append(`<tr id=\"noData\">\n <td colspan=\"3\">No data</td>\n </tr>`);\n } else {\n $(\"#noData\").remove();\n }\n});\n </script>"
] | [
"javascript"
] |
[
"Time complexity of 2 nested loops",
"I want to detect the time complexity for this block of code that consists of 2 nested loops:\nfunction(x) {\n for (var i = 4; i <= x; i++) {\n for (var k = 0; k <= ((x * x) / 2); k++) {\n // data processing\n }\n }\n}\n\nI guess the time complexity here is O(n^3), could you please correct me if I am wrong with a brief explanation?"
] | [
"time-complexity"
] |
[
"Disabling a control with Pixate Freestyle",
"I have a UIButton with the following css\n\nbutton {\n size: 50 100;\n color: #FF0000;\n}\n\n\nBut I want to disable the button based on a style like maybe:\n\nbutton {\n size: 50 100;\n color: #FF0000;\n enabled: true;\n}\n\n\nDoes anyone know how to accomplish or add an extension method to enable this?"
] | [
"ios",
"xamarin",
"pixate"
] |
[
"How can I enable Source Maps for Sass in rails 4?",
"According to this issue https://github.com/rails/sass-rails/pull/192 sass-rails hasn't support for Sass 3.3 yet.\n\nBut it seems that sass-rails-source-maps has been depending on Sass 3.3 since the very beginning. So is there a way to use this gem with sass-rails?\n\nAccording to the readme with sass-rails-source-maps, Chrome dropped support of the Source Maps files from Sass older than version 3.3.\n\nDoes that mean there is no way of using Sass Source Maps with Chrome devtools now?"
] | [
"ruby-on-rails-4",
"sass",
"google-chrome-devtools"
] |
[
"Leaflet map not showing properly in bootstrap 3.0 modal",
"i have a big problem. i want to open a leaflet map in a modal.\nbut the map is not showing properly. the tiles are not loading.\n\nhere is the script:\n\nhttp://bootply.com/98730\n\n<a href=\"#myModal\" role=\"button\" class=\"btn btn-primary\" data-toggle=\"modal\">Open Map</a>\n\n<div id=\"myModal\" class=\"modal\">\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-hidden=\"true\">×</button>\n <h4 class=\"modal-title\">Map</h4>\n </div>\n <div class=\"modal-body\">\n <div class=\"modal-body\" id=\"map-canvas\"></div>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn\" data-dismiss=\"modal\" aria-hidden=\"true\">OK</button>\n </div>\n </div>\n</div>\n\n\n\n\n$.getScript('http://cdn.leafletjs.com/leaflet-0.7/leaflet.js',function(){\n\n /* map settings */\n var map = new L.Map('map-canvas');\n var cloudmade = new L.TileLayer('http://{s}.tile.cloudmade.com/f1376bb0c116495e8cb9121360802fb0/997/256/{z}/{x} /{y}.png', {\n attribution: 'Map data © <a href=\"http://openstreetmap.org\">OpenStreetMap</a> contributors, Imagery © <a href=\"http://cloudmade.com\">CloudMade</a>',\n maxZoom: 18\n });\n map.addLayer(cloudmade).setView(new L.LatLng(41.52, -71.09), 13);\n\n\n });\n\n\nany help much apreciated"
] | [
"twitter-bootstrap",
"modal-dialog",
"leaflet"
] |
[
"Transforming streams in the Browser",
"I have some remote data I want to transform before saving it to disk.\nIn bash I would simply do curl $url | gzip -d | base64 -d > $file.\nWhat ist the proper equivalent in the browser?\nThe file is potentially large, therefore using streams sounds like a good idea.\nI already found fetch to create a stream from the body and StreamSaver to write the Stream to a local file.\nThere is also a nicely working example on how to save a remote file directly.\nThis basically simply says:\nfetch(url).then(res => { res.body.pipeTo(fileStream) })\n\nHow do I add the gzip/base64 transformations to the example above?"
] | [
"javascript",
"stream",
"gzip"
] |
[
"New e-commerce website. Use a framework or start fresh?",
"I am looking to build an e-commerce website and have it ready within a month or so. The website is nothing complicated, it is a bunch of products that will be sorted by category and provide online check out. I actually have already started and almost finished it, but I'm using drupal 7 and Ubercart. It is my first time building a drupal site and was following a tutorial, then I noticed how outdated the stuff I'm using are. Would you recommend starting fresh with a drupal 8 core and using the commerce module? \nI've seen many benefits to this, but I'm not entirely sure it's worth it, since commerce module on drupal 8 is still in beta and payment gateways such as stripe which I'm looking to use, and I believe many more useful ones aren't developed for drupal 8 yet. Any advice would be appreciated. Thank you!"
] | [
"drupal-7",
"e-commerce",
"drupal-modules",
"drupal-8",
"drupal-commerce"
] |
[
"Most efficient way to export WHERE clause to excel for multiple values",
"so lets say I have this query for example\n\nSELECT *\nFROM dbo.test\nWHERE (person_ID IN ('person1', 'person2', 'person3', 'person4', \n 'person5', 'person6', 'person7', 'person8', 'person9', \n 'person10', 'person11', 'person12', 'person13', \n 'person14', 'person15', 'person16', 'person17', \n 'person18', 'person19', 'person20'))\n\n\nIt gives me all the results for these values in the test table right. I need to save the results for each person into its own excel file or into it's own tab within excel. Instead of writing a query with them all together.\n\nBasically how would I write this query properly so it would give me separate outputs for each person that I could quickly copy and paste into its own excel sheet? \n\nThe difficult part for me is I have lets say close to 200+ values in an excel sheet right now that I will be searching against (for example with the above query person1 to 200) It's all in a column so I just formatted all the values with '@', so it would come out as example 'person1', that I just copy and pasted into a whereIN( Clause. If I want to do it separately whats the best way to do it so it will give me a lot of different results back all split up I could copy and paste best with the select all as each person_id could come back with a lot of results.\n\nAlso is copy and pasting the easiest way in the end ? For them to go into their own excel file or is there an easier way?"
] | [
"sql",
"sql-server",
"excel"
] |
[
"Calculating Throughput in FCFS algorithm",
"Hey guys I'm trying to calculate the following metrics for an FCFS-algorithm in C++: wait time, turnaround time, response time, including avg's and throughput. I've succeeded at determining all metrics using my program except throughput. I'm not quite sure how to detect what programs have finished their bursts at a given value. Any help is greatly appreciated.\n\nThanks so much!!\n\nHere is what I've got thus far:\n\nvoid FCFS(int process_num, int burst[], int arrival[], int throughput)\n{\n int wait[10], turnaround[10], g[10];\n int wt = 0;\n int tat = 0;\n //setup \n g[0]=0;\n\n cout << \"Output for FCFS scheduling algorithm\" << endl;\n //calculations \n for (int i = 0; i < 10; i++)\n g[i+1] = g[i] + burst[i];\n for (int i = 0; i < process_num; i++)\n {\n wait[i] = g[i] - arrival[i];\n turnaround[i] = g[i+1] - arrival[i];\n wt += wait[i];\n tat += turnaround[i];\n }\n //output \n cout << \"\\nProcess\\t\\tBurst Time\\tArrival Time\\tWait Time\\tTurnaround Time\"; \\\n for( int i = 0; i < process_num; i++)\n {\n cout << \"\\nP[\" << i + 1 << \"]\" << \"\\t\\t\" << burst[i] << \"\\t\\t\" << arrival[i] << \"\\t\\t\" << wait[i] << \"\\t\\t\" << turnaround[i];\n }\n\n cout << \"\\n\\nAverage Wait Time: \" << wt/process_num;\n cout << \"\\nAverage Response Time: \" << wt/process_num;\n cout << \"\\nAverage Turnaround Time: \" << tat/process_num << endl;\n }"
] | [
"c++",
"algorithm",
"scheduling",
"scheduler",
"throughput"
] |
[
"Get available SSL/TLS protocols in Python 2.7",
"Avoiding trial-and-error, I would like to list which TLS/SSL protocols are available for use on the system (in a cross-platform way).\n\nPython ssl module offers constants such as:\n\nssl.PROTOCOL_SSLv2\n\n\nBut these do not say anything about what the system actually supports when connecting to a server.\n\nAdditionally, is there a way to get from an SSLContext the supported protocols that will be used? \nFor example SSLv2 and SSLv3 are disabled when using ssl.create_default_contex(), would it be possible to somehow parse the SSLContext.options to list which protocols are supported?\n\nEDIT:\nFor example on the latest Debian TLSv1 is disabled and connecting to TLSv1-only hosts will fail, yet ssl.PROTOCOL_TLSv1 is still available and also creating ssl.SSLContext(ssl.PROTOCOL_TLSv1) works."
] | [
"python",
"python-2.7",
"openssl"
] |
[
"How to set broadcast listener interface in fragment?",
"I have service, which gets data from API and sends this data to BroadcastReceiver class. Also, I create interface OnReceiveListener, which used in Activity. Look at the code here:\n\nActivity:\n\npublic class StartActivity extends AppCompatActivity\n implements MyBroadcastReceiver.OnReceiveListener {\n\n@Override\nprotected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_start);\n\n MyBroadcastReceiver receiver = new MyBroadcastReceiver();\n receiver.setOnReceiveListener(this);\n LocalBroadcastManager.getInstance(this).registerReceiver(receiver,\n new IntentFilter(MyBroadcastReceiver.START));\n ...\n}\n\n@Override\npublic void onReceive(Intent intent) {\n // Do smth here\n}\n}\n\n\nMyBroadcastReceiver:\n\npublic class MyBroadcastReceiver extends BroadcastReceiver {\npublic static final String START = \"com.example.myapp.START\";\npublic static final String GET_LINKS = \"com.example.myapp.GET_LINKS\";\n\nprivate OnReceiveListener onReceiveListener = null;\n\npublic interface OnReceiveListener {\n void onReceive(Intent intent);\n}\n\npublic void setOnReceiveListener(Context context) {\n this.onReceiveListener = (OnReceiveListener) context;\n}\n\n@Override\npublic void onReceive(Context context, Intent intent) {\n if(onReceiveListener != null) {\n onReceiveListener.onReceive(intent);\n }\n}\n}\n\n\nService isn't important on this question.\n\n---- Question ----\n\nSo, what's problem: I want to use this receiver in fragment, but when it sets context - I get exception \"enable to cast\". What I should to do on this case?\n\nHere is my code in fragment:\n\npublic class MainFragment extends Fragment\n implements MyBroadcastReceiver.OnReceiveListener {\n\n@Override\npublic void onViewCreated(View view, Bundle savedInstanceState) {\n super.onViewCreated(view, savedInstanceState);\n\n MyBroadcastReceiver myBroadcastReceiver = new MyBroadcastReceiver();\n myBroadcastReceiver.setOnReceiveListener(getContext());\n LocalBroadcastManager.getInstance(getContext()).registerReceiver(myBroadcastReceiver,\n new IntentFilter(MyBroadcastReceiver.GET_LINKS));\n}\n\n@Override\npublic void onReceive(Intent intent) {\n // Do smth here\n}\n}"
] | [
"java",
"android",
"android-fragments",
"broadcastreceiver",
"intentservice"
] |
[
"number field plus minus buttons stop working seconds after page load",
"I am using the following code to implement plus / minus quantity buttons for a Woocommerce cart solution: \n\nconsole.log('rental')\n// make quantity buttons work\n$('.qib-container').on('click', '.plus, .minus', function () {\n console.log('clicked')\n // Get current quantity values\n var qty = $(this).closest('.qib-container').find('.qty')\n var val = parseFloat(qty.val())\n var max = parseFloat(qty.attr('max'))\n var min = parseFloat(qty.attr('min'))\n var step = parseFloat(qty.attr('step'))\n\n // Change the value if plus or minus\n if ($(this).is('.plus')) {\n console.log('plus')\n if (max && (max <= val)) {\n qty.val(max)\n } else {\n qty.val(val + step)\n }\n } else {\n if (min && (min >= val)) {\n console.log('else')\n qty.val(min)\n } else if (val > 1) {\n qty.val(val - step)\n console.log('else > 1')\n }\n }\n\n\nAnd the HTML is as follows: \n\n<div class=\"qib-container\">\n <button type=\"button\" class=\"minus qib-button\">-</button>\n <div class=\"quantity\">\n <label class=\"screen-reader-text\" for=\"quantity_5dd507573790b\">Contenur prügikonteiner 140L kogus</label> <input type=\"number\" id=\"quantity_5dd507573790b\" class=\"input-text qty text\" step=\"1\" min=\"0\" max=\"\" name=\"raq[9bb59b8531b987176485dff07c07c672][qty]\" value=\"1\" title=\"Kogus\" size=\"4\" inputmode=\"numeric\">\n </div>\n <button type=\"button\" class=\"plus qib-button\">+</button>\n </div>\n\n\nEverything works fine on the product listing page but when adding products to cart and going to the cart page the buttons stop working after 1-2 seconds like pointer-events arent working and the script is not running anymore. \n\nTest issue yourself: \n\nStep 1\nListing page: https://moya.no11.ee/lahenduste-rent/ (Add product to cart, quantity buttons work with same script like normal)\n\nStep 2\nCart page (after adding product): https://moya.no11.ee/lahenduste-rent-paringukorv/ (try to change quantity fast after loading: initially works but it resets back to original state and does not work after that)\n\nAny ideas what might be causing this?"
] | [
"javascript",
"php",
"jquery",
"woocommerce"
] |
[
"Message passing between content scripts and background page",
"I have injected content scripts to all frames. I sent a request from background and would like to receive response from all the content scripts (frames that have been injected). \n\nCurrently I can only receive one response, how do I receive responses from all content scripts?\n\ncontent script:\n\nchrome.runtime.onMessage.addListener( \n function(request, sender, sendResponse) { \n if (request.bgReq == \"windowInfo\")\n alert(\"bgreq received : \"+ window.location.host);\n\n});\n\n\nbackground script:\n\nchrome.runtime.onMessage.addListener(function(sentWords) {\n if (sentWords.words == \"injection\") {\n //send request to content scritps\n chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {\n chrome.tabs.sendMessage(tabs[0].id, {bgReq:\"windowInfo\"});\n });\n }\n});"
] | [
"javascript",
"google-chrome",
"google-chrome-extension",
"message"
] |
[
"Create IPA iOS file for multiple testing devices with Free Apple ID",
"I have a free personal Apple ID account, I made an IPA file successfully but only works for my own iPhone device, when other testers want to install the IPA on their own iPhone through iTools, they get an \"Authentication failed\" error at 99% of the installation, I guess it's because that the IPA contains only my device UDID. I searched on the internet that I should add the testers's devices UDID in the Apple Provisioning Portal but, I can't find this page on my account, and I get redirected the welcome page if I try to access directly to that page."
] | [
"ios",
"xcode",
"ipa",
"apple-id"
] |
[
"It is possible to get the kony crypto algorithm in java",
"My use-case is to re-create the client side(browser) manipulation such as encryption in Java program.\n\nI could see a website uses the kony framework generate a encrypted value.\nDetails of Kony Framework in Javascript : http://docs.kony.com/konylibrary/visualizer/viz_api_dev_guide/content/kony.crypto_functions.htm\n\nI would like to understand do we have any equivalent java code to implement the kony crypto algorithm in java?"
] | [
"javascript",
"java",
"algorithm",
"password-encryption",
"temenos-quantum"
] |
[
"How to readd a dash after exploding input in PHP",
"I have input coming into my website from a database. The format is XXX-XXX or XXXX-XXXX. It is not number formated. I can't simply do a number_format. I have worked on it and I just need to readd a dash.\n\n$input = \"1000-1199\";\n$explodedInput = explode(\"-\",$input);\nforeach ($explodedInput as $item) {\n echo number_format(\"$item\");\n}\n\n\nOutput = 1,0001,199\nI want = 1,000-1,199"
] | [
"php"
] |
[
"Mistake with JSON, Fabric and IText",
"I need to load a personalized object itext, loaded from json, but fabric return a error: \n\nfabric.min.js:1 Uncaught TypeError: Cannot read property 'async' of undefined(anonymous function) @ fabric.min.js:1enlivenObjects @ fabric.min.js:1_enlivenObjects @ fabric.min.js:4loadFromJSON @ fabric.min.js:4success @ code.js:5067c @ jquery.min.js:2fireWith @ jquery.min.js:2k @ jquery.min.js:4r @ jquery.min.js:4\n\n\nI need load this JSON\n\n{\n \"type\": \"itext\",\n \"originX\": \"left\",\n \"originY\": \"top\",\n \"lockMovementX\": false,\n \"lockMovementY\": false,\n \"lockScalingX\": false,\n \"lockScalingY\": false,\n \"lockRotation\": false,\n \"lockUniScaling\": false,\n \"lockScalingFlip\": false,\n \"borderColor\": \"rgba(102,153,255,0.75)\",\n \"cornerColor\": \"rgba(102,153,255,0.5)\",\n \"transparentCorners\": true,\n \"padding\": 0,\n \"hasBorders\": true,\n \"hasControls\": true,\n \"cornerSize\": 12,\n \"id\": 5,\n \"nombre\": \"Objeto_5\",\n \"lnk\": \"http://www.google.com\",\n \"left\": 200,\n \"top\": 190,\n \"width\": 334.34,\n \"height\": 52.43,\n \"fill\": \"rgb(0,0,0)\",\n \"stroke\": null,\n \"strokeWidth\": 1,\n \"strokeDashArray\": null,\n \"strokeLineCap\": \"butt\",\n \"strokeLineJoin\": \"miter\",\n \"strokeMiterLimit\": 10,\n \"scaleX\": 1,\n \"scaleY\": 1,\n \"angle\": 0,\n \"flipX\": false,\n \"flipY\": false,\n \"opacity\": 1,\n \"shadow\": null,\n \"visible\": true,\n \"clipTo\": null,\n \"backgroundColor\": \"\",\n \"fillRule\": \"nonzero\",\n \"globalCompositeOperation\": \"source-over\",\n \"transformMatrix\": null,\n \"text\": \"Click to change Text\",\n \"fontSize\": 40,\n \"fontWeight\": \"normal\",\n \"fontFamily\": \"Times New Roman\",\n \"fontStyle\": \"\",\n \"lineHeight\": 1.16,\n \"textDecoration\": \"\",\n \"textAlign\": \"left\",\n \"textBackgroundColor\": \"\",\n \"styles\": {}\n }\n\n\nI think that my problem are in the property lnk, that contains a type of link.\n\nThe reason of this personalized object, is that, when i do double click in the object, should open the web in the browser.\n\nThis problem only i have it in itext object type"
] | [
"javascript",
"json",
"fabricjs"
] |
[
"Getting last 30 days of records",
"I have a table called 'Articles' in that table I have 2 columns that will be essential in creating the query I want to create. The first column is the dateStamp column which is a datetime type column. The second column is the Counter column which is an int(255) column. The Counter column technically holds the views for that particular field. \n\nI am trying to create a query that will generate the last 30 days of records. It will then order the records based on most viewed. This query will only pick up 10 records. The current query I have is this:\n\nSELECT *\nFROM Articles\nWHERE DATEDIFF(day, dateStamp, getdate()) BETWEEN 0 and 30\nLIMIT 10\n) TOP10\nORDER BY Counter DESC\n\n\nThis query is not displaying any records, but I don't understand what I am doing wrong. Any suggestions?"
] | [
"mysql",
"sql",
"datediff"
] |
[
"How is Floyd-Warshall a Dynamic Algorithm?",
"Since the Floyd-Warshall algorithm is dynamic, that means that it must provide an optimum solution at all times, right? So what's confusing me is what the nature of these optimum solutions is during each segment of the algorithm - in particular, I'm trying to understand the following three questions:\n\n\niteration 0: what optimum (i.e. exact) solution is provided\n before any iteration occurs?\niteration 1: what optimum (i.e. exact) solution is provided\n at the end of this iteration?\niteration i (for arbitrary i > 0): \n what optimum (i.e. exact) solution is provided\n at the end of this iteration?\n\n\nCan anyone shed some light on these concerns?"
] | [
"algorithm",
"language-agnostic",
"graph-theory",
"floyd-warshall"
] |
[
"Insert new row every 2nd element of python list",
"I have the following List\n\nmylist = ['a','b','c' ....]\n\nlist.append('a')\nlist.append('b'+'\\r\\n')\nlist.append('c')\n\n\nCSV Generate\n\nwith open(csvFile, \"w\",) as output:\n writer = csv.writer(output, delimiter='\\r\\n')\n writer.writerow(list)\n\n\nHow do I ensure that a new row is inserted after every 2nd element ? By default '\\r\\n' is used as the lineterminator so I've tried to add '\\r\\n' add the end of every 2nd string when I build my list but no such luck, the csv is always generated all on one row."
] | [
"python",
"csv"
] |
[
"Contradictory MySqlReader errors",
"MySqlCommand command = connection.CreateCommand();\ncommand.CommandText = string.Format(\"SELECT * FROM characters WHERE account_id = '{0}'\", this.ID);\nMySqlDataReader reader = command.ExecuteReader();\n\nwhile (reader.Read()) { ... }\n\n\nI get an error at the last line saying \"Invalid attempt to Read when reader is closed.\"\nNow, if I add another line before it, as in:\n\nMySqlCommand command = connection.CreateCommand();\ncommand.CommandText = string.Format(\"SELECT * FROM characters WHERE account_id = '{0}'\", this.ID);\nMySqlDataReader reader = command.ExecuteReader();\nreader = command.ExecuteReader(); // Here.\n\nwhile (reader.Read()) { ... }\n\n\nI get an error at that new line saying \"There is already an open DataReader associated with this Connection which must be closed first.\"\n\nAlright, I don't want to get picky here, but is my reader open or closed?"
] | [
"c#",
".net",
"mysql"
] |
[
"how to operate $concat use spring mongodb",
"i am using spring-data-mongodb(version is 1.8.1.release) to operate my mongodb,\nbut i encounter a problem.\ni want to use aggregate to projection a new field,which use #concat to join two field. like this:\n\n{\n\"$project\":{\n \"idai\" : {\n \"$concat\": [\n {\"$substr\":[\"$channel_id\",0,-1]},\n \"-\",\n {\"$substr\":[\"$no_ai\",0,-1]}\n ]\n },\n ...\n}\n\n\nand the below code is my java code\n\nAggregationResults<QualifyHourData> results = mongoOps.aggregate(newAggregation(HisAiInfo.class, \n match(where(\"date\").gte(startTime.toDate()).lt(endTime.toDate())),\n project(\"date\",\"zset\").andExpression(\"$channelId + [0] + $noAi\",CHAR_CHANNELID_NOAI).as(\"idai\"),\n ...\n ), QualifyHourData.class);\n\n\nwhen it run,the log is:\n\n{ \n \"aggregate\" : \"last\" , \n \"pipeline\" : [ \n { \"$match\" : { \"date\" : { \"$gte\" : { \"$date\" : \"2015-11-30T16:00:00.000Z\"} , \"$lt\" : { \"$date\" : \"2015-12-31T16:00:00.000Z\"}}}},\n { \"$project\" : { \"date\" : 1 , \"zset\" : 1 , \"idai\" : { \"$add\" : [ \"$channel_id\" , \"_\" , \"$no_ai\"]}}} , ...\n ]\n}\n\n\nlook,this is not my expired.\nplease help!!!"
] | [
"java",
"spring",
"mongodb",
"spring-data-mongodb"
] |
[
"create a simple(or dynamic) chart with using AIOTrade library in java?",
"I have a sceleton code for creating chart. I draw the frame. You only fulfill this source code for creating a chart. It confuses me to create a chart in AIOTrade library. Can you help? Thanks\n\nhttps://gist.github.com/anonymous/ef021bf009b6cc20ab31\n\nI couldn't find enough knowledge about AIOTrade and I don't understand how should I use it. Please help. Thaks again."
] | [
"java",
"swing",
"graphics",
"charts",
"grid"
] |
[
"How to have subfooter in jQuery Mobile",
"I used the data-role=\"footer\" but I want 2 links below that blue bar to also be part of the footer. \n\n<div data-role=\"footer\" class=\"footer\" id=\"ftrMain\" name=\"ftrMain\" data-position=\"fixed\">\n &copy; 2011 Probity Investigations\n</div>\n<div data-role=\"footer\" id=\"subfooter\" name=\"subfooter\" >\n <div style=\"float: left;\">\n <a href=\"../../agents/index.php\" rel=\"external\">Full Site</a>\n </div>\n <div style=\"float: right;\">\n <a href=\"logout.php\" rel=\"external\">Logout</a>\n </div>\n</div>\n\n\nThen I want to fix it to bottom. I tried creating the second footer with data-theme=\"c\" but it doesnt quite match. \n\nBasically like this:\n\nhttp://i.stack.imgur.com/sfl6g.png"
] | [
"jquery-mobile"
] |
[
"How to add actions to Overflow menu on Galaxy S3?",
"I'm facing a problem when actions intended to be shown in overflow menu in action bar are not there on Galaxy S3. As a consequence the UX is somewhat confusing - my action bar on Galaxy S3 is there to only display app logo and name but offering no extra functionality. \n\nI'd like to have an identical UX on all devices running on Android 4.x with actions in the overflow menu. Is this possible without using third-party components such as ActionBarSherlock?\n\nThanls"
] | [
"android",
"android-actionbar",
"galaxy"
] |
[
"gcloud command to retrieve metadata of a specific key",
"Is there any way to retrieve custom instance metadata value for a specific key ?\nI tried gcloud compute instances describe instance-1 command, this return whole meta data text. But i just want to retrieve the value of a specific key only."
] | [
"shell",
"google-cloud-platform",
"google-compute-engine",
"google-cloud-sdk"
] |
[
"Making recyclerview fill entire page",
"I have a page that has a custom recyclerview. I want items I add to the recyclerview to pop up in a list. App was working just fine before I updated my AppCompact library. But essentially, I had anchored my FAB to a Coordinator layout, but I got an IllegalStateException and to resolve that, I had to anchor it to one of the Coordinator layout's children. I picked the recyclerview. But the problem now is that the recycler view does not fill the entire page. It only shows one item (I can scroll through them) but they only take up the space of one - like viewing one at a time. How do I make the layout work like it did before the update?\n\nThis is my xml:\n\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n android:layout_width=\"match_parent\"\n android:orientation=\"vertical\"\n android:gravity=\"center\"\n android:layout_height=\"match_parent\">\n\n <!--<include layout=\"@layout/base_toolbar\"/>-->\n <android.support.design.widget.CoordinatorLayout\n android:id=\"@+id/myCoordinatorLayout\"\n android:layout_width=\"match_parent\"\n android:gravity=\"center\"\n android:layout_height=\"match_parent\"\n >\n\n <LinearLayout\n android:id=\"@+id/reminderEmptyView\"\n android:orientation=\"vertical\"\n android:gravity=\"center\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\">\n\n <ImageView\n android:src=\"@drawable/empty_view_bg\"\n android:layout_width=\"100dp\"\n android:layout_height=\"100dp\"/>\n\n <TextView\n android:text=\"Nothing added yet\"\n android:textColor=\"@color/secondary_text\"\n android:textSize=\"16sp\"\n android:paddingTop=\"4dp\"\n android:paddingBottom=\"8dp\"\n android:gravity=\"center\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\"/>\n\n </LinearLayout>\n\n\n <!--<include layout=\"@layout/base_toolbar\"/>-->\n\n\n <!--</android.support.design.widget.AppBarLayout>-->\n\n\n <apps.todo.Utility.RecyclerViewEmptySupport\n app:layout_behavior=\"@string/appbar_scrolling_view_behavior\"\n android:id=\"@+id/toDoRecyclerView\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"/>\n\n\n <android.support.design.widget.FloatingActionBut"
] | [
"android",
"android-recyclerview"
] |
[
"Drupal State API - set key expired time",
"I am new to Drupal 8. I have found Drupal state API for cache mechanism. Can I set key expire time also with below statement?\n\n\\Drupal::state()->set('key','value'); \n\nSource : https://www.drupal.org/docs/8/api/state-api/overview\n\nHere I am able to set key but I want to clear it after 60 minutes. \nIs there any other cache mechanism I can use?\n\nAny suggestion would be helpful. \n\nThanks in advance."
] | [
"caching",
"drupal-8"
] |
[
"Windows.UI.Xaml.Controls.TreeView w/ Selection=\"Multiple\", where is the checkbox selected/unselected event?",
"I am using Windows.UI.Xaml.Controls.TreeView along w/ Windows.UI.Xaml.Controls.TreeViewItem with Selection="Multiple".\n <TreeView Name="DessertTree" SelectionMode="Multiple" ItemsSource="{x:Bind DataSource}" ItemInvoked="{x:Bind OnSelectionChanged, Mode=OneTime}">\n <TreeView.ItemTemplate>\n <DataTemplate x:DataType="local:Item">\n <TreeViewItem ItemsSource="{x:Bind Children}" Content="{x:Bind Name}"/>\n </DataTemplate>\n </TreeView.ItemTemplate>\n </TreeView>\n\nI cannot seem to find a way to have an event fired for a state change of the checkbox associated with the TreeViewItem. Does anyone have any information on this? I see that the TreeView in WPF has a trigger for change of the checkbox state, so I would think the same functionality is available.\nThe only trigger I found that is somewhat similar is ItemInvoked, but that does not register selection events on the checkbox, only if the label is clicked."
] | [
"c#",
"xaml",
"uwp"
] |
[
"AdMob Banner wont show up, no error message with test ad and failed to load : 3 with real ad",
"I have a Xamarin Forms application on which I would like to advertise via Admob. If I set my real ad-id, I get Ad failed to load : 3. When I use the id of a test-ad, there is no error message in the console, but there is also no ad.\nIve tried connecting with firebase, which worked well, but didn't fix the problem. Ive also changed the language of the app and specified in the google play console settings that my App uses ads (even through it isnt live yet).\nI used a custom renderer:\nClass in forms:\nnamespace test7\n{\n \n public class AdMobView : View\n {\n \n }\n \n}\n\nandroid implementation:\n[assembly: ExportRenderer(typeof(AdMobView), typeof(AdMobViewRenderer))]\nnamespace test7.Droid\n{\n public class AdMobViewRenderer : ViewRenderer<AdMobView, AdView>\n {\n public AdMobViewRenderer(Context context) : base(context) { }\n string id = "ca-app-pub-xxxxxxxxxxxxx/yyyyyyyyyy"; //here was my real id and test id\n private AdView CreateAdView()\n {\n var adView = new AdView(Context)\n {\n AdSize = AdSize.SmartBanner,\n AdUnitId = id,\n LayoutParameters = new LinearLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent)\n };\n\n adView.LoadAd(new AdRequest.Builder().Build());\n\n return adView;\n }\n\n protected override void OnElementChanged(ElementChangedEventArgs<AdMobView> e)\n {\n base.OnElementChanged(e);\n\n if (e.NewElement != null && Control == null)\n {\n SetNativeControl(CreateAdView());\n }\n }\n }\n}\n\nxaml:\n <local:AdMobView x:Name="werbung" />\n\nAny ideas how to fix this? Im lost :("
] | [
"xamarin",
"xamarin.forms",
"admob"
] |
[
"How to Import Python Code from Other Files",
"I have a simple situation on a linux system:\n\nls test_repo\n\nexample __init__.py text\n\n\nIn text directory, I just have 2 files:\n\n__init__.py ex.py\n\n\nIn example directory, I have just 2 files again:\n\n__init__.py test.py\n\n\nIn ex.py I have the code:\n\ndef test():\n print(10)\n\n\nNow, in text directory I want to import it:\n\nfrom text.ex import test\n\nprint(test())\n\n\nBut when I run the file in the example directory as well as out of it: python test.py\n\nI get the error:\n\nTraceback (most recent call last):\n File \"test.py\", line 1, in <module>\n from text.ex import test\nModuleNotFoundError: No module named 'text'\n\n\nHow can I import the function?\n\nShould I put something in __init__.py?"
] | [
"python",
"python-3.x",
"module",
"python-3.6"
] |
[
"How to ensure the loading order of javascript before end of body tag in IE8",
"To optimize my website for google page speed I inserted my js-files before the end of the body-tag, so they don't delay the rendering of the website. This works fine in all modern browsers - also in IE until version 9.\n\nThe html where I embed the scripts looks like this:\n\n<script type=\"text/javascript\" src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js\"></script>\n<script type=\"text/javascript\" src=\"scripts/init.min.js\"></script>\n</body>\n</html>\n\n\nI have tested the site via saucelabs to check, whether it works in good old Internet-Explorer 8. \n\nSurprisingly in IE 8 I received an error message. I realized, that this error was caused, because my self hosted javascript was executed before the Google-hosted jquery was loaded – despite the fact, that I linked jquery first as shown above. When I host jquery myself and copy my script directly at the end of the jquery-file to reduce http-requests, the error-message is gone and everything works just fine.\n\nNow to my question: Am I missing something regarding the loading order of the scripts or is there any other reason, that IE8 won't load jquery from google?\nActually I would like to rely on the CDN-version of jquery since there is no possibility to activate compression on my server and jquery is quite a big chunk of data. Btw the problem only appears in IE8 under Windows XP – in IE8 under Windows 7 the above shown solution also seems to works fine."
] | [
"javascript",
"jquery",
"html",
"internet-explorer-8",
"pagespeed"
] |
[
"Is it possible to tell if a database is normalised just by looking at the ERM",
"Is it possible to tell if a database is normalised just by looking at the ERM? What assumptions do you have just by looking at the ERM"
] | [
"relational-database",
"data-modeling",
"database-normalization"
] |
[
"don't want whitespace to occur when text is too long and i got to enter",
"Is there any way when your text is too long - and you break it up with new lines - to not have whitespace happen? What I need is three values to be joint without whitespace in between.\n\n<div style='font-size:100%; color:blue'>\n {{ $record->m_pk_address_line1 }}\n {{ $record->m_pk_address_line2 }}\n {{ $record->m_pk_address_line3 }}\n</div>\n\n\nWithout entering new line, it'll be too long even if they can be joined together.\n\n<div style='font-size:100%; color:blue'>{{ $record->m_pk_address_line1 }}{{ $record->m_pk_address_line2 }}{{ $record->m_pk_address_line3 }}</div>\n\n\nIs there no standard way of going about this without resorting to tricks? What do people do when their code is too long and they need to break it up into new lines but they don't want the whitespace that comes with it?"
] | [
"html",
"laravel",
"text",
"whitespace",
"blade"
] |
[
"Remove customer form attribute",
"I have added the custom attributes using\n\n$setup->addAttribute('customer','default_business',array(\n 'type' => 'int',\n 'label' => 'Default Business Address',\n 'input' => 'text',\n 'backend' => 'orancustomer/customer_attribute_backend_business',\n 'required' => false,\n 'sort_order' => 200,\n 'visible' => 0,\n 'global' =>1,\n 'user_defined' => 1,));\n\n\n$attr = $eavConfig->getAttribute('customer', 'default_business');\n$attr->setData( 'used_in_forms', array('customer_account_create', 'customer_account_edit', 'checkout_register')///*'adminhtml_customer',*/\n)->save(); \n\n\nIt worked as expected. but when I tried to remove it, \n\n$installer->removeAttribute('customer', 'default_business');\n\n\nIt was removed sucessfullu from eav_attribute table. but in the admin section I am getting the following error\n Fatal error: Call to a member function getBackend() on a non-object in D:\\xampp\\htdocs\\magoran\\app\\code\\core\\Mage\\Eav\\Model\\Entity\\Collection\\Abstract.php on line 515\n\nAnd when I tried to debug I found that it is still searching for default_business attribute . It is still searching the attribute in manage customer page. Here is the query i found during debugging\n\n SELECT `eav_attribute`.* FROM `eav_attribute` WHERE (`eav_attribute`.`attribute_code`='oran_company') AND (entity_type_id = :entity_type_id)\n BIND: array (\n ':entity_type_id' => '1', \n )"
] | [
"php",
"attributes",
"magento-1.7"
] |
[
"angular2: service with a template?",
"I am trying to create a service for showing alerts (in case sending a form goes wrong). This will be used on various forms of my project so I thought I could use an independant service for this. The problem is: for this alert I need HTML code at a certain place of my form, so what I need to know is : what's best practice for that? \n\nCan I define a template for my service? And how do I use this template in my form wihch uses the service?"
] | [
"angularjs",
"angular"
] |
[
"Trouble reading bytes from webpage response (amf)",
"I'm trying to write a program that can read different types of encoding from webpage responses. Right now I'm trying to figure out how to successfully read AMF data's response. Sending it is no problem, and with my HttpWrapper, it gets the response string just fine, but many of the characters get lost in translation. For that purpose, I'm trying to receive the response as bytes, to then convert into readable text. \n\nThe big thing I'm getting is that characters get lost in translation, literally. I use a program called Charles 3.8.3 to help me get an idea of what I should be seeing in the response, both hex-wise and AMF-wise. It's generally fine when it comes to normal characters, but whenever it sees non-unicode character, I always get \"ef bf bd.\" My code for reading the HTTP response is as follows:\n\nBufferedReader d = new BufferedReader(new InputStreamReader(new DataInputStream(conn.getInputStream())));\nwhile (d.read() != -1) {\nString bytes = new String(d.readLine().getBytes(), \"UTF-8\");\n result += bytes;\n}\n\n\nI then try to convert it to hex, as follows:\n\nfor (int x = 0; x < result.length(); x++) {\n byte b = (byte) result.charAt(x);\n System.out.print(String.format(\"%02x\", b & 0xFF));\n}\n\n\nMy output is: 0000000001000b2f312f6f6e526573756c7400046e756c6c00000**bf**\nWhereas Charles 3.8.3 is: 0000000001000b2f312f6f6e526573756c7400046e756c6c00000**0b**\n\nI'm at my wits end on how to resolve this, so any help would be greatly appreciated!\nThank you for your time"
] | [
"java",
"http",
"amf",
"datainputstream",
"inputstreamreader"
] |
[
"Assign action to NSMenuItem containing a submenu",
"In Xcode i've created a simple menu item with a submenu (Submenu Menu Item from library). Its submenu has some specific actions but i also want the item itself to contain a click handler. Right now if i connect it to an action in a controller - it doesn't work. Is it even possible to do it?\n\nSome piece of additional info: this menu item is a part of application's custom dock menu.\n\nGoogle doesn't seem to be much of a help (or at least i can't find a \"winner\" keyword) so any thoughts are appreciated."
] | [
"objective-c",
"cocoa",
"nsmenu"
] |
[
"Export to Excel - intermediate file formats?",
"I am trying to export very large amount of data (300.000 rows * 100 columns) to Excel (from Delphi application) and OLE approach (combined solution from DevExpress DX, CX suites and out own code) gives error messages Not enough storage is available to complete this operation, Error creating variant array. There is no good and ready third party components for native export and there for I have idea to use intermediate file: I can export data in some intermediate file and then open this file in Excelt. But what format is the most suitable for such action?:ddd\n\n\nCSV is the most simple one, but can Excel recover the column format from the CSV data - it is very important for us, that currency data are exported as numbers and calculations can be done on them, that date data are exported as dates. CSV has no this type information.\nXML seems to be promising, because typing and formatting can be added to the data but what is the format of XML that Excel requires, is this format described anywhere?\nDB file seems to be promising to, but it is quite old and I am not sure whether there is no limits on the amount of data.\n\n\nI am looking solution for Delphi 6."
] | [
"xml",
"excel",
"csv",
"delphi",
"delphi-6"
] |
[
"yii ajaxSubmitButton blocks html5 validation",
"I have a form where I used ajaxSubmitButton to submit that form. But Yii generates return false at the end of jQuery that handles ajax, so automatic HTML5 validation is not working anymore. (for example input type=number accepts letters too) Any Idea how to solve it?\n\nTry to enter any letters to the field and submit form in the following demos and you will see what I mean:\n\nDEMO without ajaxSubmitButton\n\nDEMO with simple ajaxSubmitButton"
] | [
"jquery",
"html",
"forms",
"yii"
] |
[
"How to start my websocket connection with my haproxy load balancer?",
"I have configured a Haproxy Load Balancer in my VMware Ubuntu OS, and I have a simple websocket server (nodeJS ws) in my windows 10 machine. The question I wan to ask is how can i setup the connection between my Haproxy and my websocket server??\n\nBelow is my Haproxy configuration\n\nglobal\n daemon\n maxconn 4096\n\ndefaults\n mode http\n stats enable\n stats uri /haproxy?status\n balance roundrobin\n option redispatch\n option forwardfor\n\n timeout connect 5s\n timeout queue 5s\n timeout client 50s\n timeout server 50s\n\nfrontend http-in\n bind *:8000\n default_backend servers\n\n # Any URL beginning with socket.io will be flagged as 'is_websocket'\n acl is_websocket path_beg /socket.io\n acl is_websocket hdr(Upgrade) -i WebSocket\n acl is_websocket hdr_beg(Host) -i ws\n\n # The connection to use if 'is_websocket' is flagged\n use_backend websockets if is_websocket\n\nbackend servers\n server server1 192.168.0.201:80\n server server2 192.168.0.201:80\n\nbackend websockets\n balance leastconn\n option http-server-close\n option forceclose\n server ws-server1 192.168.0.252:4080 weight 1 maxconn 1024 check\n server ws-server2 192.168.0.14:8080 weight 1 maxconn 1024 check\n\n\nHere is my Websocket server script\n\nvar server = require('http').createServer()\n , url = require('url')\n , WebSocketServer = require('ws').Server\n , wss = new WebSocketServer({ server: server })\n , express = require('express')\n , app = express()\n , port = 4080;\n\napp.use(function (req, res) {\n res.send({ msg: \"hello\" });\n});\n\nwss.on('connection', function connection(ws) {\n var location = url.parse(ws.upgradeReq.url, true);\n // you might use location.query.access_token to authenticate or share sessions \n // or ws.upgradeReq.headers.cookie (see http://stackoverflow.com/a/16395220/151312) \n\n ws.on('message', function incoming(message) {\n console.log('received: %s', message);\n });\n\n ws.send('something from sevrer');\n});\n\nserver.on('request', app);\nserver.listen({port: port, host: '192.168.0.252' }, function () { console.log('Listening on ' + server.address().port) });"
] | [
"websocket",
"haproxy"
] |
[
"Issue while querying a alias column in oracle",
"I am trying to solve this using ORACLE query. Following is the sample data\n\n| Col1 | Col2 |\n------------------------------------\n| 21-dec-15 | nochange |\n| 20-dec-15 | change |\n| 20-dec-15 | nochange | \n| 18-dec-15 | change |\n| 18-dec-15 | nochange |\n\n\nHere col2 is a alias column, not a column from table.\n\nHere the requirement is for a particular date I need to check whether any change is happening, If change is there then update nochange to change for that date. \n\nAs col2 is a alias column so I am not sure how to check it. I am also ok if we are storing the result in a separate alias column. \n\nExpected Result:\n\n| Col1 | Col2 |\n------------------------------------\n| 21-dec-15 | nochange |\n| 20-dec-15 | change |\n| 20-dec-15 | change | \n| 18-dec-15 | change |\n| 18-dec-15 | change |"
] | [
"sql",
"oracle"
] |
[
"Python CSV file input, validation not working",
"I tried to print out the variable gayle and it assigns values correctly.\nI can't find why is my program stopping if i input non-existent ID.\n os.system("clear")\n print('\\tSEARCH AND VIEW FILE\\n')\n gayle=0\n\n file_input = input('Search ID Number: ')\n proj = io.open('all_projects.csv', 'r') \n while True:\n data = proj.readline()\n if file_input in data:\n txt = data\n gayle += 1\n break\n proj.close()\n \n if gayle > 0:\n list2 = txt.split(",")\n i = Preview(list2)\n i.view()\n print(gayle)\n try_again('Search file again?','Invalid input.',2)\n elif (gayle == 0):\n print("Not exist")"
] | [
"python",
"python-3.x",
"csv",
"validation"
] |
[
"Does idiomatic rust code always avoid 'unsafe'?",
"I'm doing leetcode questions to get better at solving problems and expressing those solutions in rust, and I've come across a case where it feels like the most natural way of expressing my answer includes unsafe code. Here's what I wrote:\nconst _0: u8 = '0' as u8;\nconst _1: u8 = '1' as u8;\n\npub fn add_binary(a: String, b: String) -> String {\n let a = a.as_bytes();\n let b = b.as_bytes();\n let len = a.len().max(b.len());\n let mut result = vec![_0; len];\n let mut carry = 0;\n for i in 1..=len {\n if i <= a.len() && a[a.len() - i] == _1 {\n carry += 1\n }\n if i <= b.len() && b[b.len() - i] == _1 {\n carry += 1\n }\n if carry & 1 == 1 {\n result[len - i] = _1;\n }\n carry >>= 1;\n }\n if carry == 1 {\n result.insert(0, _1);\n }\n unsafe { String::from_utf8_unchecked(result) }\n}\n\nThe only usage of unsafe is to do an unchecked conversion of a Vec<u8> to a String, and there is no possibility of causing undefined behaviour in this case because the Vec always just contains some sequence of two different valid ascii characters. I know I could easily do a checked cast and unwrap it, but that feels a bit silly because of how certain I am that the check can never fail. In idiomatic rust, is this bad practice? Should unsafe be unconditionally avoided unless the needed performance can't be achieved without it, or are there exceptions (possibly like this) where it's okay? At risk of making the question too opinionated, what are the rules that determine when it is and isn't okay to use unsafe?"
] | [
"rust"
] |
[
"Errors and Restful WCF",
"Hi I'm creating a Restful WCF web services that serves up JSON and XML. I believe with wcf 4 you can specify an error object which will return a detailed error to the client in JSON. Is there any way of completely overriding this and return text and therefore have complete control over the format of the error?"
] | [
"wcf"
] |
[
"Latest version of PSWebServiceLibrary",
"I'm currently playing with the prestashop webservice but there is a version issue between the PSWebServiceLibrary.php used in documention (1.6) and the last version of prestashop.\n\nDoes someone know which changes I have to do in the lib or where can I find the updated library ?\n\nThanks."
] | [
"php",
"prestashop",
"prestashop-1.7"
] |
[
"Writing Clean Code With Nested Promises",
"I'm writing an app that talks to Apple to verifyReceipts. They have both a sandbox and production url that you can post to.\n\nWhen communicating with Apple, if you receive a 21007 status, it means you were posting to the production url, when you should be posting to the sandbox one.\n\nSo I wrote some code to facilitate the retry logic. Here's a simplified version of my code:\n\nvar request = require('request')\n , Q = require('q')\n ;\n\nvar postToService = function(data, url) {\n var deferred = Q.defer();\n var options = {\n data: data,\n url: url\n };\n\n request.post(options, function(err, response, body) {\n if (err) { \n deferred.reject(err);\n } else if (hasErrors(response)) {\n deferred.reject(response);\n } else {\n deferred.resolve(body);\n }\n });\n\n return deferred.promise;\n};\n\nexports.verify = function(data) {\n var deferred = Q.defer();\n\n postToService(data, \"https://production-url.com\")\n .then(function(body) {\n deferred.resolve(body);\n })\n .fail(function(err) {\n if (err.code === 21007) {\n postToService(data, \"https://sandbox-url.com\")\n .then(function(body){\n deferred.resolve(body);\n })\n .fail(function(err) {\n deferred.reject(err);\n });\n } else {\n deferred.reject(err);\n }\n\n });\n\n return deferred.promise;\n};\n\n\nThe retry portion in the verify function is pretty ugly and difficult to read with the nested promises. Is there a better way of doing this?"
] | [
"javascript",
"node.js",
"promise"
] |
[
"Trying to find the index of the last uppercase char using regex",
"I need a little bit of help trying to find the last index of the last uppercase char in the string. I have been using regex to do so. However it keeps returning -1 instead of the index of B which is 7.\nThe code is highlighted below\npublic class Main {\n public static void main(String[] args) {\n String s2 = "A3S4AA3B3";\n int lastElementIndex = s2.lastIndexOf("[A-Z]");\n System.out.println(lastElementIndex);\n }\n}\n\nDoes anyone have any recommendation on how to fix the issue?\nKind regards."
] | [
"java",
"regex",
"char",
"indexof",
"lastindexof"
] |
[
"Allowing NSArbitrary loads in IOS 9",
"We are an online payments app which allows users to pay to different merchants through credit, debit cards or net banking. Since apple has introduced App Transport Security in IOS 9.0, we are facing issues while loading different bank urls in UIWebView. \n\nATS requires all bank sites to be TLS 1.2 compliant but most of the banks are still using SSL or TLS 1.0. Based on various stack overflow answers to bypass this either we have to explicitly allow that particular domain to be SSL or TLS 1.0 compliant or we can make use of NSAllowsArbitraryLoads to allows all the bank urls. Since we can't keep track of all the bank urls we want to use NSAllowsArbitraryLoads approach.\n\nDoes apple rejects the app which use NSAllowsArbitraryLoads? \n\nDoes enabling NSAllowsArbitraryLoads in IOS 9 disables TLS or SSL checking altogether or does it only removes TLS 1.2 enforcement."
] | [
"security",
"uiwebview",
"ios9",
"nsapptransportsecurity"
] |
[
"How to use PHP sessions in Angular4 in order to check whether user logged in or not?",
"I very new to Angular, and i'm working on Angular4 + PHP application, the user credentials are sent to the server from Angular app and it is validated in the PHP server (where db is MySQL). I have created the session variables in PHP, but i don't know how to use them in the Angular app in order to allow or disallow the user from accessing the dashboard, settings, etc. I'm using Service and Guard in this application,\n\nAngular code:\n\nhome.component.ts\n\nauthUser(event){\n let formData = new FormData();\n formData.append('uname',event.target[0].value);\n formData.append('pwd',event.target[1].value);\n this.http.post('http://localhost/auth.php', formData)\n .subscribe((data) => {\n let dat = data.json();\n if (dat){\n this.user.setUserBase(); \n this.route.navigate(['report']);\n }\n }, (error) => {\n console.log(\"Error!\", error);\n });\n}\n\n\nuser.service.ts\n\n@Injectable()\nexport class UserbaseService {\n private isLoggedIn;\n\n constructor() {\n this.isLoggedIn = false;\n }\n setUserBase(){\n this.isLoggedIn = true;\n }\n getUserBase(){\n return (this.isLoggedIn);\n }\n}\n\n\napp.module.ts\n\nconst appRoutes: Routes = [\n {\n path: '',\n component: HomeComponent\n },\n {\n path: 'upload',\n canActivate: [AuthGuard],\n component: UploadComponent\n },\n]\n\n\nauth.guard.ts\n\ncanActivate(\n next: ActivatedRouteSnapshot,\n state: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean {\n return this.user.getUserBase();\n}\n\n\nPHP Code:\n\n<?php\n session_start();\n header('Access-Control-Allow-Origin: *');\n require('connect.php');\n $username = $_POST['uname'];\n $password = $_POST['pwd'];\n $query = \"SELECT * FROM auth WHERE uname='$username' and passwd='$password'\";\n $result = mysqli_query($connection, $query) or die(mysqli_error($connection));\n $count = mysqli_num_rows($result);\n\n if (!isset($myObj))\n $myObj = new stdClass();\n\n if ($count == 1){\n $_SESSION['username'] = $username;\n }\n if (isset($_SESSION['username'])){\n $myObj->user = $username;\n $myObj->status = \"authentic\";\n }\n $response = json_encode($myObj);\n echo ($response);\n?>\n\n\nThese are the navigation I have in my App; Home (default page), Dashboard, Settings, Logout.\nI want the user to be redirected to Dashboard from Home if the session is active and if session is not destroyed then user should be redirected to Home from Dashboard, or Settings and also i want to destroy the session by clicking Logout. Help will be appreciated."
] | [
"php",
"angular",
"session",
"cookies",
"angular4-router"
] |
[
"How do I create a fixed size text box within a div? Image attached",
"The input text (\"ooooooo's\") you can see is continuing across the complete page and under the images. I would like it to stop inside the the area shaded red. How would I resolve this?"
] | [
"css",
"textbox"
] |
[
"Jinja2 use variable from parent template",
"Image a base template like this:\n\n{% set styles = [] %}\n<!DOCTYPE html>\n<html>\n <head>\n {% for style in styles %}\n <link href=\"{{style}}\" ref=\"stylesheet\" type=\"text/css; charset=utf8\">\n {% endfor %}\n </head>\n <body>\n {% block body %}\n {% endblock %}\n </body>\n</html>\n\n\nI want to append to the styles variable from a child-template, but it will yield \"styles is undefined\".\n\n{% extends \"base.html\" %}\n{% do styles.append(\"index.css\") %}\n\n\nOne solution to this would be to define the styles as an empty list when rendering the template from the Python code. But I do not want to add styles=[] to every template I render.\n\nUnfortunately, importing doesn't work either. It won't tell you anymore that \"styles is undefined\", but it simply won't render in the head section of the parent template.\n\n{% extends \"base.html\" %}\n{% from \"base.html\" import styles %}\n{% do styles.append(\"index.css\") %}\n\n\nHow can this be solved?\n\nPS: You need to add jinja2.ext.do to the extensions if you want to test it."
] | [
"python-2.7",
"jinja2"
] |
[
"How to fake ajax file upload?",
"I've an upload form I would like to populate with a file, in particular an image.\n\nMy understanding is that I need to create a File object to put in the FileList of the relative form. Currently the image I have is in the data URI format \"data:image/png;base64,...\" but I can change that.\n\nIf that is true how do I create the correct File object from an image and add it to the FileList? If it is not do you suggest a better solution?"
] | [
"javascript",
"ajax",
"file-upload",
"automation"
] |
[
"Publish an Azure DevOps extension from command line fails with 401",
"I develop an Azure DevOps extension. Now I want to automate the publishing process. Here the journey begins ... Following the theory here the reality looks different to me.\n\nFor me every trial of publish via command line ends in\n\ntfx extension publish --auth-type pat -t \n7dblablablablablablablablazq --share-with examplecompany0123\n\nTFS Cross Platform Command Line Interface v0.6.3\nCopyright Microsoft Corporation\nChecking if this extension is already published\nIt isn't, create a new extension.\nerror: Received response 401 (Not Authorized). Check that your personal \naccess token is correct and hasn't expired.\n\n\nMy first guess on that error message 401 was that I probably have a wrong PAT. A look in my PAT management showed me that everything seems good.\n\n\n\nSo, now I am confronted like a cow at a five-barred gate. I just don't get the root of the failure. Anyone here who already has left this noob beginner problems behind and reached the next level and can help me?"
] | [
"azure",
"azure-devops-extensions"
] |
[
"MERGE JOIN on two indexes still causing a SORT?",
"This is a performance question simplified to join of two indexes. Take the following setup:\n\nCREATE TABLE ZZ_BASE AS SELECT dbms_random.random AS ID, DBMS_RANDOM.STRING('U',10) AS STR FROM DUAL CONNECT BY LEVEL <=1000000;\nCREATE INDEX ZZ_B_I ON ZZ_BASE(ID ASC); \nCREATE TABLE ZZ_CHILD AS SELECT dbms_random.random AS ID, DBMS_RANDOM.STRING('U',10) AS STR FROM DUAL CONNECT BY LEVEL <=1000000;\nCREATE INDEX ZZ_C_I ON ZZ_CHILD(ID ASC);\n\n-- As @Flado pointed out, the following is required so index scanning can be done\nALTER TABLE ZZ_BASE MODIFY (ID CONSTRAINT NN_B NOT NULL); \nALTER TABLE ZZ_CHILD MODIFY (ID CONSTRAINT NN_C NOT NULL); -- given the join below not mandatory.\n\n\nNow I want to LEFT OUTER JOIN these two tables and only output the already indexed ID field.\n\nSELECT ZZ_BASE.ID \nFROM ZZ_BASE \nLEFT OUTER JOIN ZZ_CHILD ON (ZZ_BASE.ID = ZZ_CHILD.ID);\n----------------------------------------------------------------------------------------\n| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |\n----------------------------------------------------------------------------------------\n| 0 | SELECT STATEMENT | | 1000K| 9765K| | 4894 (2)| 00:00:30 |\n|* 1 | HASH JOIN OUTER | | 1000K| 9765K| 16M| 4894 (2)| 00:00:30 |\n| 2 | INDEX FAST FULL SCAN| ZZ_B_I | 1000K| 4882K| | 948 (3)| 00:00:06 |\n| 3 | INDEX FAST FULL SCAN| ZZ_C_I | 1000K| 4882K| | 948 (3)| 00:00:06 |\n----------------------------------------------------------------------------------------\n\n\nAs you can see no table access is necessary, only index access. But according to common sense, HASH-joining is not the most optimal way to join these two indexes. If these two tables where much larger, a very large hash table would have to be made. \n\nA much more efficient way would be to SORT-MERGE the two indexes.\n\nSELECT /*+ USE_MERGE(ZZ_BASE ZZ_CHILD) */ ZZ_BASE.ID \nFROM ZZ_BASE \nLEFT OUTER JOIN ZZ_CHILD ON (ZZ_BASE.ID = ZZ_CHILD.ID);\n-----------------------------------------------------------------------------------------\n| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |\n-----------------------------------------------------------------------------------------\n| 0 | SELECT STATEMENT | | 1000K| 9765K| | 6931 (3)| 00:00:42 |\n| 1 | MERGE JOIN OUTER | | 1000K| 9765K| | 6931 (3)| 00:00:42 |\n| 2 | INDEX FULL SCAN | ZZ_B_I | 1000K| 4882K| | 2258 (2)| 00:00:14 |\n|* 3 | SORT JOIN | | 1000K| 4882K| 22M| 4673 (4)| 00:00:29 |\n| 4 | INDEX FAST FULL SCAN| ZZ_C_I | 1000K| 4882K| | 948 (3)| 00:00:06 |\n-----------------------------------------------------------------------------------------\n\n\nBut it appears that the second index gets sorted, even if it already is (\"If an index exists, then the database can avoid sorting the first data set. However, the database always sorts the second data set, regardless of indexes\"1)\n\nBasically, what I want is a query that uses a SORT-MERGE join and instantly starts outputting the records, i.e.:\n\n\nno HASH join because it first has to make a hash table (IO overhead if stored on disk) and thus doesn't output instantly. \nno NESTED LOOP join which, although it would output\ninstantly, has log(N) complexity on index pokes and large IO overhead on non-sequential index reads in case the index is large."
] | [
"oracle",
"algorithm",
"join",
"query-performance"
] |
[
"class sf::RenderWindow' has no member named 'clear'",
"I've spent at least 5 hours trying to get the sfml library to work with my QT-creator ide. I have followed this tutorial https://github.com/LaurentGomila/SFML/wiki/Tutorial%3A-Compile-and-Link-SFML-with-Qt-Creator but still no luck. \n\nI continuously get the error that members of classes don't exist after building simple code. I can make instances of the classes, but I get multiple errors when trying to use \nmembers of the objects created. I have tried looking up library related issues, sfml issues, but I don't think I'm looking for the correct problem. \n\nThis works and displays a window that will never close until forcing the program to quit:\n\n#include <SFML/Graphics.hpp>\n\nint main()\n{\n sf::RenderWindow window(sf::VideoMode(200, 200), \"SFML works!\");\n //sf::CircleShape shape(100.f );\n //shape.setFillColor(sf::Color::Green);\n\n while (true)//window.isOpen())\n {\n sf::Event event;\n /*while (window.pollEvent(event))\n {\n if (event.type == sf::Event::Closed)\n window.close();\n }*/\n\n //window.clear();\n //window.draw(shape);\n //window.display();\n }\n\n return 0;\n}\n\n\nAs soon as I remove one comment an error pops up. I can't figure out for the life of me what's happening.\n\nThanks in advance. \n\nExtra Info \n\n\n\nOs:\n\nUbuntu 12.10 Live (installed to hard drive)\n\n\n\n\n\nProject File\n\n\nI'm sure this is incorrect\n\n\n\nTEMPLATE = app\n\n#CONFIG += console\n\nCONFIG -= qt\n\nSOURCES += main.cpp\n\nLIBS += -L\"/home/user/Projects/SFML/lib\"\n\nCONFIG(release, debug|release): LIBS += -lsfml-audio -lsfml-graphics -lsfml-network -lsfml-window -lsfml-system\n\nCONFIG(debug, debug|release): LIBS += -lsfml-audio -lsfml-graphics -lsfml-network -lsfml-window -lsfml-system\n\nINCLUDEPATH += \"/home/user/Projects/SFML/include\"\n\nDEPENDPATH += \"/home/user/Projects/SFML/include\"\n\n\n\n\n\nErrors:\n \n\n I'll post the compile output \n\n\n\nmain.cpp: In function 'int main()':\n\nmain.cpp:6:5: error: 'CircleShape' is not a member of 'sf'\n\nmain.cpp:6:21: error: expected ';' before 'shape'\n\nmain.cpp:7:5: error: 'shape' was not declared in this scope\n\nmain.cpp:12:23: error: 'class sf::RenderWindow' has no member named 'pollEvent'\n\nmain.cpp:14:23: error: 'class sf::Event' has no member named 'type'\n\nmain.cpp:15:24: error: 'class sf::RenderWindow' has no member named 'close'\n\nmain.cpp:18:16: error: 'class sf::RenderWindow' has no member named 'clear'\n\nmain.cpp:19:16: error: 'class sf::RenderWindow' has no member named 'draw'\n\nmain.cpp:20:16: error: 'class sf::RenderWindow' has no member named 'display'\n\n16:25:10: The process \"/usr/bin/make\" exited with code 2.\n\nError while building project sfmlTest (target: Desktop)\n\nWhen executing build step 'Make'\n\n\n Executed Path \n\nmake: Leaving directory `/home/username/Documents/Projects/c++/Sfml/sfmlTest-build-desktop-Qt_4_8_1_in_PATH__System__Release'\n\n\n\n\n\n Compiler Used: \n\n I believe the Gnu Compiler, G ++"
] | [
"c++",
"libraries",
"sfml"
] |
[
"Create Array in JavaScript From Comma Delimited String",
"Thanks in advance for any help. I've searched many articles and can't seem to figure this out.\n\nI have a control that has a Value property that can be set like this from JS:\n myControl.value([\"8C65416E-DD68-4AF1-952B-2370D1D1F38B\", \"00EA79CB-6D5B-4A49-8CE4-32F19D88F6D8\"]); \n\nThis works perfectly fine.\n\nI have a string coming from a database that looks like this:\n\nmyString = \"8C65416E-DD68-4AF1-952B-2370D1D1F38B\", \"00EA79CB-6D5B-4A49-8CE4-32F19D88F6D8\"\n\n\nI am trying to set the controls value using the string, like this:\n\n myControl.value(myString);`\n OR like myControl.value([myString]);\n\n\nI have tried to create an array, variations of split, etc. but can't seem to fine the magic touch. The string is already formatted for me with double quotes, commas, etc. Seems very simple, just can't seem to get it."
] | [
"javascript"
] |
[
"Python Chat Server - Telnet error",
"I have the following code which is supposed to implement a basic chat server on my localhost. The code has no errors (i dont get any erros thrown at me when i run the code). However when i run the program using telnet , i always get the error : \n\nTrying 127.0.0.1...\ntelnet: Unable to connect to remote host: Connection refused\n\n\nI have made sure that the port i am trying to connect to is open. I am trying this out on Ubuntu 12.04. I have installed telnet. The code is as follows:\n\nfrom asyncore import dispatcher\nfrom asynchat import async_chat\nimport socket, asyncore\n\nPORT = 5939\nNAME = 'Chatbox'\n\nclass ChatSession(async_chat):\n def __init__(self,server,sock):\n async_chat.__init__(self, sock)\n self.server = server\n self.set_terminator(\"\\r\\n\")\n self.data = []\n\n def collect_incoming_data(self, data):\n self.data.append(data)\n\n def found_terminator(self):\n line =''.join(self.data)\n self.data = []\n self.server.broadcast(line)\n\n def handle_close(self):\n async_chat.handle_close(self)\n self.server.disconnect(self)\n\nclass ChatServer(dispatcher):\n def __init__(self, port, name):\n dispatcher.__init__(self)\n self.create_socket(socket.AF_INET, socket.SOCK_STREAM)\n self.set_reuse_addr()\n self.bind(('',port))\n self.listen(5)\n self.name = name\n self.sessions = []\n\n def disconnect(self, sessions):\n self.sessions.remove(session)\n\n def broadcast(self, line):\n for session in self.sessions:\n session.push('>>' + line + '\\r\\n')\n\n def handle_accept(self):\n conn, addr = self.accept()\n self.sessions.append(ChatSession(self, conn))\n\nif __name__ == '__main__':\n s = ChatServer(PORT, NAME)\n try: asyncore.loop()\n except KeyboardInterrupt: print\n\n\nI run the programs using the commands :\n\nuser@ubuntu:~$ python chatbox.py\nuser@ubuntu:~$ telnet 127.0.0.1 5939\n\n\nI am pretty sure its a minor issue in executing the program but I havent used linux before so I am unsure if my process is correct. Any help will b appreciated.\n\nUPDATE: Ok so there where a few formatting errors in my code which i solved. Now when I run the code, the terminal goes unresponsive."
] | [
"python",
"linux"
] |
[
"how to avoid NaN in the text box before adding the other text box values in javascript",
"am using the following code to add text box values if any of the textbox is not given value it is showing NaN in total textbox how to avoid it \n\n <script>\n function totalValue()\n {\n var a = document.getElementById(\"a\").value;\n var b = document.getElementById(\"b\").value;\n var c = document.getElementById(\"c\").value; \n var d = parseFloat(a)+ parseFloat(b)+ parseFloat(c);\n document.getElementById(\"total\").value = d;\n }\n\n </script>"
] | [
"javascript",
"html"
] |
[
"Unity: Speech Recognition is not supported on this machine",
"I have a problem with an Unity project. More specific with a HoloLens Application.\nI have added the Keyword recognition from the MixedReality-Toolkit for unity. Until now everything worked fine. Today I had to reset my Laptop and install everything new. After the reset everything worked fine, but after activating my Windows 10 - Educational license in order to enable Hyper-V I get now the following Error message:\n\nUnityException: Speech recognition is not supported on this machine.\nUnityEngine.Windows.Speech.PhraseRecognizer.CreateFromKeywords (System.String[] keywords, UnityEngine.Windows.Speech.ConfidenceLevel minimumConfidence) (at C:/buildslave/unity/build/artifacts/generated/Metro/runtime/SpeechBindings.gen.cs:47)\nUnityEngine.Windows.Speech.KeywordRecognizer..ctor (System.String[] keywords, UnityEngine.Windows.Speech.ConfidenceLevel minimumConfidence) (at C:/buildslave/unity/build/Runtime/Export/Windows/Speech.cs:221)\nMixedRealityToolkit.InputModule.InputSources.SpeechInputSource.Start () (at Assets/HoloToolkit/InputModule/Scripts/InputSources/SpeechInputSource.cs:72)\n\n\nOn other devices (I have tested it with Windows 10 Home and a bootable USB-Stick on the Laptop with Windows 10 Educational) the Voice recognition still works.\nDoes someone know how to solve this error?\n\nEdit: Still have this problem. Does somebody found a new solution for this problem?"
] | [
"c#",
"unity3d",
"voice-recognition",
"hololens"
] |
[
"Tikzpictures not rendering in gitbook, even though they appear in pdf_book",
"I'm using bookdown to type up my notes from some of my math courses. I want to insert tikzpictures into my book, and even though they render perfectly when using render_book(\"index.Rmd\", \"pdf_book\"), they do not appear at all, on any browser (I've tried Chrome, Firefox, and even Internet Explorer) when I use render_book(\"index.Rmd\", \"gitbook\"). Likewise when using preview_chapter instead of render_book.\n\nHere is the code that can be used to render my Tikz image:\n\n\\def\\firstcircle{(0:-0.5cm) circle (1.5cm)}\n\\def\\secondcircle{(0:0.4cm) circle (0.5cm)}\n\n\\colorlet{circle edge}{blue!50}\n\\colorlet{circle area}{blue!20}\n\n\\tikzset{filled/.style={fill=circle area, draw=circle edge, thick},\n outline/.style={draw=circle edge, thick}}\n\n\\begin{figure}\n\\centering\n\\begin{tikzpicture}\n \\begin{scope}\n \\clip \\firstcircle;\n \\secondcircle;\n \\end{scope}\n \\draw[outline] \\firstcircle node {$B$};\n \\draw[outline] \\secondcircle node {$A$};\n\\end{tikzpicture}\n\\caption{$A$ as a subset of $B$}\n\\end{figure}\n\n\nWhen I use pdf_book it's beautiful. If I use gitbook it just does not appear. I've tried to do something similar as what's described in this question here i.e. using the same chunk but replacing that code with my code (though I did center mine) like so:\n\n```{r, echo=FALSE, engine='tikz', out.width='90%', fig.ext='pdf', fig.align='center', fig.cap='Some caption.'}\n\\def\\firstcircle{(0:-0.5cm) circle (1.5cm)}\n\\def\\secondcircle{(0:0.4cm) circle (0.5cm)}\n\n\\colorlet{circle edge}{blue!50}\n\\colorlet{circle area}{blue!20}\n\n\\tikzset{filled/.style={fill=circle area, draw=circle edge, thick},\n outline/.style={draw=circle edge, thick}}\n\n\\begin{tikzpicture}\n \\begin{scope}\n \\clip \\firstcircle;\n \\secondcircle;\n \\end{scope}\n \\draw[outline] \\firstcircle node {$B$};\n \\draw[outline] \\secondcircle node {$A$};\n\\end{tikzpicture}\n```\n\n\nwhen I do this, again it renders beautifully in pdfbook and actually I get further in gitbook (the figure caption appears and a \"broken image link\" symbol appears, I've tried across browsers, as mentioned) but still no image.\n\nAny ideas on how I can get this to work?"
] | [
"r",
"latex",
"knitr",
"bookdown",
"tikz"
] |
[
"Multi valued attribute in Hibernate",
"I have the following entities:\n\n____________________ ____________________\n| Activity | | Benefit |\n------------------ | |------------------|\n| activityId:long |-------------| benefitId: long |\n| activity:varchar | | activityId: long |\n| .... | | benefit: varchar |\n-------------------- -------------------|\n\n\nCan I map this into Hibernate so I end up with this:\n\n@Entity\nclass Activity {\n @Id\n private Long id;\n private String activity;\n\n\n private List<String> benefits;\n}"
] | [
"java",
"hibernate"
] |
[
"Dynamically adding new row in Swing GridLayout - How to enable Scrolling",
"I've added rows dynamically to a grid view. When the number of rows are more than what can be displayed on the screen, the remainder content is hidden. How to enable scrolling to view the remainder of the undisplayed rows ?\n\n JPanel billItemsPanel = new JPanel();\n GridLayout billItemsLayout = new GridLayout(0,6);\n billItemsLayout.setVgap(20);\n billItemsPanel.setLayout(billItemsLayout);\n billItemsPanel.add(new Label(\"Mobile Number\"));\n billItemsPanel.add(new TextField(20));\n billItemsPanel.add(new Label(\"\"));\n billItemsPanel.add(new Label(\"\"));\n billItemsPanel.add(new Label(\"\"));\n billItemsPanel.add(new Label(\"\")); \n\nfor(int i=0; i<10; i++){\n billItemsPanel.add(new TextField(\"Hi SKU\"));\n billItemsPanel.add(new Label(\"Hi Title\"));\n billItemsPanel.add(new Label(\"Hi Type\"));\n billItemsPanel.add(new TextField(\"Hi Qty\"));\n billItemsPanel.add(new Label(\"Hi Price\"));\n billItemsPanel.add(new Label(\"Hi Amount\"));\n\n billItemsPanel.add(new TextField(\"Bye SKU\"));\n billItemsPanel.add(new Label(\"Bye Title\"));\n billItemsPanel.add(new Label(\"Bye Type\"));\n billItemsPanel.add(new TextField(\"Bye Qty\"));\n billItemsPanel.add(new Label(\"Bye Price\"));\n billItemsPanel.add(new Label(\"Bye Amount\"));\n}"
] | [
"java",
"swing",
"user-interface"
] |
[
"WordPress add doble slash in URL",
"I'm Dev. WordPress site but this added // into URL.\n\n\n\nI don't know how to fix it."
] | [
"wordpress",
"url",
"icons"
] |
[
"Loading web page icons asynchronously - a cross-browser solution?",
"In today's fractured web-icon landscape where (surprisingly) .svg icons have not yet achieved broad support, one might be tempted to add a huge list of elements in the head pointing to any number of\n\n\nfavicons\nicons\napple-touch-icons\nsafari-pinned-tabs\nmstiles\n\n\netc.\n\nA comprehensive list of favicons, icons, touch-icons, tiles etc. on any page would be enormous.\n\nThis affects page initialisation and loading time, in some cases quite dramatically.\n\nThe goldilocks solution would be to be able to add as many icon <link> references as needed, without affecting page load performance.\n\nSo... is it a legitimate approach to load these elements asynchronously?\n\neg.\n\nconst favIcon = {'rel' : 'icon', 'href' : 'favicon.ico'};\nconst appleTouchIcon = {'rel' : 'apple-touch-icon', 'href' : 'apple-touch-icon.png'};\n\nconst myIcons = [favIcon, appleTouchIcon];\n\nfor (let i = 0; i < myIcons.length; i++) {\n\n let myIcon = document.createElement('link');\n myIcon.rel = myIcons[i].rel;\n myIcon.href = myIcons[i].href;\n document.head.appendChild(myIcon);\n}\n\n\nOr will loading these <link> elements asynchronously on DOMContentLoaded mean that various user-agents miss the icons they are looking for?"
] | [
"javascript",
"performance",
"icons",
"favicon",
"apple-touch-icon"
] |
[
"Power Apps - Checked toggles reset after Submitform",
"I am new to Powerapps. I have a number of toggles in an EditForm named EditForm1. When the toggles are checked they cause text input boxes to appear, these can then be used to enter new information. \n\nI then have a SubmitForm button (SubmitForm(EditForm1)), which saves the new information to an Excel table via Dropbox. Everything works fine except when I press the SubmitForm button the toggles return to their default mode, which is off. How can I keep the toggles on after submitting? Thank you"
] | [
"ms-office",
"submit",
"toggle",
"powerapps"
] |
[
"rotate a matrix such that each element is shifted by one place in a clockwise manner in python",
"I want to rotate a matrix such that each element is shifted by one place in a clockwise manner.\nFirst it should ask the size of matrix and then matrix elements\nInput 3*3 matrix:\n\n1 2 3\n4 5 6\n7 8 9\n\n\nOutput:\n\n4 1 2\n7 5 3\n8 9 6\n\n\nInput 4*4 matrix:\n\n1 2 3 4\n5 6 7 8\n9 10 11 12\n13 14 15 16\n\n\nOutput:\n\n5 1 2 3\n9 10 6 4\n13 11 7 8\n14 15 16 12"
] | [
"python"
] |
[
"Nested throttle for API in rails",
"I know there is a lot of gems around throttling API requests in rails, but the problem is their structure is pretty flat - I mean you cannot apply another rule based on other rule happening. Here is the example:\n\nthrottle max: 100, per: 1.day\n\ncool, but what if I want to reduce the number of those requests after reaching 100 per day to for example 10 per hour?\n\nso something like:\n\nthrottle max: 100, per: 1.day do\n throttle max: 10, per: 1.hour\nend\n\n\nhow to achieve that with the use of existing gems avoiding custom solutions as much as possible?"
] | [
"ruby-on-rails",
"ruby",
"api",
"grape",
"throttling"
] |
[
"Swift animation not sticking",
"I have a button when clicked I move an imageView with animation to another location on the screen with the following code:\n\n@IBOutlet var CurrentPlayerTotal: UILabel!\n@IBOutlet var Player1: UIImageView!\n\nUIImageView.animateWithDuration(1.0, animations: {\n self.Player1.frame = CGRect(x: 16, y: 178, width: 250, height: 350)\n})\n\n\nThe image moves fine.\n\nI have another button that updates a label on the screen.\n\n@IBAction func Sub1(sender: AnyObject) {\n currentTotal -= 1\n CurrentPlayerTotal.text = \"\\(currentTotal )\"\n}\n\n\nWhen I click this button the image returns to the original location. Why is this happening?\n\nHere is a more complete code snippet\n\nvar currentTotal : Int = 0\nvar currentPlayer : Int = 1\nvar numberOfPlayers : Int = 6\n\n@IBOutlet var CurrentPlayerTotal: UILabel!\n@IBOutlet var CurrentPlayerNme: UILabel!\n@IBOutlet var Player1: UIImageView!\n\noverride func viewDidAppear(animated: Bool) {\n UIImageView.animateWithDuration(1, delay: 1.0, options: .CurveEaseOut, animations: {\n var player = self.Player1.frame\n player = CGRect(x: 16, y: 178, width: 250, height: 350)\n\n self.Player1.frame = player\n\n }, completion: { finished in\n println(\"done\")\n })\n}\n\noverride func viewDidLoad() {\n super.viewDidLoad()\n // Do any additional setup after loading the view, typically from a nib.\n}\n\n// SUBTRACT\n@IBAction func Sub1(sender: AnyObject) {\n currentTotal -= 1\n CurrentPlayerTotal.text = \"\\(currentTotal )\"\n}\n\n\nThe app begins the image moves to the correct spot. When I click on the button bound to the Sub1 func the image pops back to the original spot."
] | [
"ios",
"ipad",
"swift"
] |
[
"Swift Xcode Error: Cannot Convert Value of Type",
"Sorry, I'm a noob at Swift and still learning. \n\nI'm getting the following error message from Xcode for the following swift code: \"Cannot convert value of type 'Town?.Type' (aka 'Optional.Type') to expected argument type 'Town?'\"\n\nclass Vampire: Monster {\n\n var vampirePopulation: [Vampire] = []\n\n override func terrorizeTown() {\n if town?.population > 1 {\n town?.changePopulation(-1)\n } else {\n town?.population = 0\n }\n vampirePopulation.append(Vampire(town: Town?, monsterName: String))\n print(\"\\(vampirePopulation.count) vampires\")\n super.terrorizeTown()\n }\n\n}\n\n\nHere is the Monster Class:\n\nimport Foundation\n\nclass Monster {\n static let isTerrifying = true\n class var spookyNoise: String {\n return \"Grrr\"\n }\n var town: Town?\n var name = String ()\n var victimPool: Int {\n get {\n return town?.population ?? 0\n }\n set(newVictimPool) {\n town?.population = newVictimPool\n }\n }\n init(town: Town?, monsterName: String) {\n self.town = town\n name = monsterName\n }\n func terrorizeTown() {\n if town != nil {\n print(\"\\(name) is terrorizing a town!\")\n }else {\n print(\"\\(name) hasn't found a town to terrorize yet..\")\n }\n }\n}\n\n\nHere is the Town struct:\n\nimport Foundation\n\nstruct Town {\nvar mayor: Mayor?\nlet region: String\nvar population: Int {\n didSet(oldPopulation) {\nif population < oldPopulation\n{\n print(\"The population has changed to \\(population) from \\\n(oldPopulation).\")\n mayor?.mayorResponse()\n}\n}\n}\n\n\n\nvar numberOfStoplights: Int\ninit(region: String, population: Int, stoplights: Int) {\nself.region = region\nself.population = population\nnumberOfStoplights = stoplights\n}\ninit(population: Int, stoplights: Int) {\n self.init(region: \"N/A\", population: population, stoplights: \nstoplights)\n}\n\nenum Size {\n case Small\n case Medium\n case Large\n}\nvar townSize: Size {\n get {\n switch self.population {\n case 0...10000:\n return Size.Small\n\n case 10001...100000:\n return Size.Medium\n\n default:\n return Size.Large\n }\n}\n}\nfunc printTownDescription () {\n print(\"Population: \\(population); number of stoplights: \\\n(numberOfStoplights); region: \\(region)\")\n}\n\nmutating func changePopulation(_ amount: Int) {\npopulation += amount\n}\n}\n\n\nWhy am I receiving this error message?"
] | [
"xcode"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.