texts
list
tags
list
[ "spacing between UITableViewCells swift3", "I am creating a IOS app in swift and want to add spacing between cells like this\n\n\n\nI would like to give space of each table view cell same like my attach image.\nHow I can do that? and Right now all cells are coming without any space.\nswift3" ]
[ "ios", "uitableview", "swift3", "cellspacing" ]
[ "When creating JavaScript objects with properties, why is this code necessary?", "I am reading about JavaScript prototypes here. Under the Object.create header, some code is written out to illustrate creating objects with prototypes and certain properties:\n\nvar person = {\n kind: 'person'\n}\n\n// creates a new object which prototype is person\nvar zack = Object.create(person);\n\nconsole.log(zack.kind); // => ‘person’\n\n\nI then encountered this:\n\nvar zack = Object.create(person, {age: {value: 13} });\nconsole.log(zack.age); // => ‘13’\n\n\nInstead of passing {age: {value: 13} }, I passed {age: 13} because it seemed simpler. Unfortunately, a TypeError was thrown. In order to create properties of this object like this, why do we have to pass {age: {value: 13} } rather than just {age: 13}?" ]
[ "javascript", "object", "properties", "prototype" ]
[ "Why is Visual Studio 2015 Intellisense not showing any class, method etc information?", "Possible Duplicate:\n Visual Studio not showing IntelliSense descriptions anymore\n\n\nA most frustrating problem: Visual Studio 2015 Intellisense has suddenly stopped showing class, method etc information in the pop-up, a most useful feature just gone!\n\nI have Googled it and tried the following but nothing works:\n\nIntellisense doesn't show comments\n\nHow to make Visual Studio intellisense to show the remarks portion of XML comments?\n\nVisual Studio 2012 Intellisense Not Working – SOLVED\n\nThe only thing I can think of is that its a bug with VS2015 Update 2 because the other machine where it does work has VS2015 with no updates installed.\n\nSome examples:\n\nThis is what it should show:\n\n\n\nAnd this is how it goes wrong:\n\n\n\nThat's for a class. For a method its similar. What its supposed to show:\n\n\n\nAnd what its does show:\n\n\n\nLastly for a for a parameter, what its supposed to show:\n\n\n\nAnd what it does show:" ]
[ "c#", ".net", "visual-studio-2015", "intellisense", "xml-documentation" ]
[ "asp.net, Adding an item to a list with a textbox", "I'm creating a list with 5 items. 4 of the items are manually hard-coded, but the 5th (int Quantity) is an int value that needs to be entered via textbox. I'm struggling with how to enter the 5th item. Any help would be appreciated. \n\nClass:\n\npublic class Product_Class\n{\n public string ProdName { get; set; }\n public decimal ProdPrice { get; set; }\n public string ItemNumber { get; set; }\n public string UPC { get; set; }\n public int Quantity { get; set; }\n}\n\n\nProduct Page:\n\npublic Product_Class(string ProdName, decimal ProdPrice, string ItemNumber,\n string UPC, int Quantity)\n{\n this.ProdName = ProdName;\n this.ProdPrice = ProdPrice;\n this.ItemNumber = ItemNumber;\n this.UPC = UPC;\n this.Quantity = Quantity; \n}\n\npublic partial class Products_Accents_Mini : System.Web.UI.Page\n{\n protected void Page_Load(object sender, EventArgs e)\n {\n }\n\n protected void Button2_Click(object sender, EventArgs e)\n {\n if(Session[\"ObjList\"] == null)\n {\n List<Product_Class> objList = new List<Product_Class>();\n Session[\"ObjList\"] = objList;\n }\n\n Product_Class prod1 = new Product_Class(\"Watercolor Apples Mini Accents\",\n 5.99M, \"5635\", \"88231956358\");\n List<Product_Class> objList2 = (List<Product_Class>)Session[\"ObjList\"];\n objList2.Add(prod1);\n Session[\"ObjList\"] = objList2;\n }\n\n protected void Button4_Click(object sender, EventArgs e)\n {\n Response.Redirect(\"ShoppingCart.aspx\");\n }\n}" ]
[ "asp.net", "list", "textbox" ]
[ "Angular MVC ajax calls 404 not found", "I'm new to angular and trying to make a call to perform crud operations from angular to a newly created mvc webapi controller... cannot get around the 404 not found on the get right now. Looking for some guidance from the pros, thanks!\n\nAngular:\n\nangular.module('PersonApp').service('PersonService', ['$http', function` ($http) {\n\n var PersonService = {};\n var urlBase = '/api/PersonApi/';\n\n PersonService.getPersons = function () {\n console.log(urlBase);\n return $http.get(urlBase);\n };\n\n PersonService.upsertPerson = function (person) {\n return $http.post(urlBase, person); //must have ,person !!!!!!!!!!\n };\n\n PersonService.removePerson = function (id) {\n return $http.delete(urlBase + id);\n };\n\n return PersonService;\n\n}]);\n\n\nPersonApi.cs api:\n\npublic class PersonApi : ApiController\n{\n TutorialDataEntities ef_Db = new TutorialDataEntities();\n Repository.Repository PersonRepository = new Repository.Repository();\n\n [Route(\"api/PersonApi/{person}\")]\n [HttpPost]\n public HttpResponseMessage UpsertPerson([FromBody]DTOPerson person)\n {\n if (ModelState.IsValid) // and if you have any other checks\n {\n var result = PersonRepository.UpsertPerson(person);\n formatDate(result.birthDate);\n return Request.CreateResponse(HttpStatusCode.Created, result);\n }\n return Request.CreateResponse(HttpStatusCode.BadRequest);\n }\n\n [Route(\"api/PersonApi/{id}\")]\n [HttpDelete]\n public HttpResponseMessage RemovePerson([FromUri]int id)\n {\n PersonRepository.RemovePerson(id);\n return Request.CreateResponse(HttpStatusCode.OK);\n }\n\n [Route(\"api/PersonApi/\")]\n [HttpGet]\n public HttpResponseMessage GetPersons()\n {\n var result = PersonRepository.GetAllPersons();\n foreach (var person in result)\n {\n formatDate(person.birthDate);\n }\n\n if (result == null)\n return Request.CreateResponse(HttpStatusCode.NotFound);\n\n return Request.CreateResponse(HttpStatusCode.OK, result);\n\n }\n\n private DateTime formatDate(DateTime date)\n {\n return Convert.ToDateTime(date.ToString(\"MM/dd/yyyy\"));\n }\n}\n\n\nMy solution explorer:\n\n\n\nWebApiConfig.cs\n\npublic static class WebApiConfig\n{\n public static void Register(HttpConfiguration config)\n {\n config.MapHttpAttributeRoutes();\n\n config.Routes.MapHttpRoute(\n name: \"DefaultApi\",\n routeTemplate: \"api/{controller}/{id}\",\n defaults: new { id = RouteParameter.Optional }\n );\n }\n}\n\n\nRouteconfig.cs\n\npublic static void RegisterRoutes(RouteCollection routes)\n {\n routes.IgnoreRoute(\"{resource}.axd/{*pathInfo}\");\n\n routes.MapRoute(\n name: \"Default\",\n url: \"{controller}/{action}/{id}\",\n defaults: new { controller = \"Home\", action = \"Index\", id = UrlParameter.Optional }\n );\n }" ]
[ "angularjs", "ajax", "asp.net-mvc", "asp.net-mvc-4" ]
[ "Creating java singleton with static inner class", "I want to use the following pattern to create a singleton in java\n\npublic class Singleton {\n // Private constructor prevents instantiation from other classes\n private Singleton() { }\n\n /**\n * SingletonHolder is loaded on the first execution of Singleton.getInstance() \n * or the first access to SingletonHolder.INSTANCE, not before.\n */\n private static class SingletonHolder { \n public static final Singleton INSTANCE = new Singleton();\n }\n\n public static Singleton getInstance() {\n return SingletonHolder.INSTANCE;\n }\n}\n\n\nBut what happens when the private constructor I want to call is \n\n private Singleton(Object stuff) {... }\n\n\nHow do I pass stuff to INSTANCE = new Singleton()? As in INSTANCE = new Singleton(stuff);\n\nRewriting the above snippet:\n\npublic class Singleton {\n // Private constructor prevents instantiation from other classes\n private Singleton(Object stuff) { ... }\n\n /**\n * SingletonHolder is loaded on the first execution of Singleton.getInstance() \n * or the first access to SingletonHolder.INSTANCE, not before.\n */\n private static class SingletonHolder { \n public static final Singleton INSTANCE = new Singleton();\n }\n\n public static Singleton getInstance(Object stuff) {\n return SingletonHolder.INSTANCE;//where is my stuff passed in?\n }\n}\n\n\nEDIT:\n\nfor those of you claiming this pattern is not thread safe, read here: http://en.wikipedia.org/wiki/Singleton_pattern#The_solution_of_Bill_Pugh.\n\nThe object I am passing in is the android application context." ]
[ "java", "android", "singleton" ]
[ "notifyDatasetChanged ListView with Android 7 error loop", "I have a ListView with an EditText inside having an input type of numeric. When I use notifyDatasetChanged() in the focus event of the EditText I get an error.\n\nis notifydatasetchanged()->focus->notifyDatasetChanged()->focus......\nThat error happens with android 7 or higher.\n\ngetView()\n\nfinal ArrayAdapterListProduct.ViewHolder holder = new ArrayAdapterListProduct.ViewHolder();\n holder.caption = (EditText) view.findViewById(R.id.changegift_listview_item_number);\n if (promotionItem.getNumber_choose() != 0) {\n holder.caption.setText(promotionItem.getNumber_choose() + \"\");\n }\n holder.caption.setId(position);\n\n holder.caption.addTextChangedListener(new MyTextWatcher(holder.caption));\n int temp_cout_product = 0;\n if (promotionItem.getSoluongtonkho() > promotionItem.getPromotion_canget()) {\n temp_cout_product = promotionItem.getPromotion_canget();\n } else {\n temp_cout_product = promotionItem.getSoluongtonkho();\n }\n\n holder.caption.setOnFocusChangeListener(new View.OnFocusChangeListener() {\n @Override\n public void onFocusChange(View view, boolean b) {\n if (!b) {\n notifyDataSetChanged();\n }\n }\n });\n\n holder.caption.setFilters(new InputFilter[]{new InputFilterMinMax(0, temp_cout_product)});\n return view;\n\n\nSo I can't input numberic into editext" ]
[ "android", "listview" ]
[ "How to get the value from this structure of an Object in Laravel", "I wanted to display the value of status field from the boardings table which is in a relationship with travel table. When I do this code:\n\n$travel->boardings->status\n\n\nit returns an error that says, $status is undefined." ]
[ "php", "laravel", "laravel-5", "laravel-collection" ]
[ "How to move a value in a 2D Array without creating a shift in the array in C", "So the thing is our school assigned us to code a board game called "parcheesi" and it's all okay but I cannot figure out how to move the pieces without shifting the whole board. You see, I created the board by creating an integer matrix and each integer is equal to something in the matrix(such as pieces, path, starting points and finish points. I figured it could be easier to assign a different value to the path blocks in the corner to change the direction. I know I could not really describe my situations so I will elaborate the situation in the comments. But here is a piece of my code(edited a little bit):\ntable:\n {8911,8912, 0 ,4, 1, 4, 0, 8211,8212},\n {0,8913, 0 ,1,8223,1, 0, 8214,8213},\n {0, 0, 0 ,1,8222,1, 0, 0, 0},\n {4, 8914, 1,4,8221,4, 1, 1, 4},\n {1, 8923,8922,8921,0,6621,6622,6623,1},\n {4, 1, 1, 4,7121,4, 1, 1, 4},\n {0, 0, 0, 1,7122,1, 0, 0, 0},\n {7111,7112,0, 1,7123,1, 0, 6611,6612},\n {7114,7113,0, 4, 1, 4, 0, 6614,6613}\n\n int pawnmove(int steps, int row, int col, int max, int matrix[max][max])/*This function helps me to move the pawns by swapping the respective characters in the matrix. \n4's in the matrix trigger the corner points so the pawns will redirect at those points*/\n{\n int i=col;\n int l_move=steps;\n int j=row;\n int tmp;\n \n while(l_move>0)\n {\n if((row<4)&&((col>=0)&&(col<=3)))//since there are 4 area in the matrix, I divided the code into 4 pieces.\n {\n \n \n while((i<col+steps)&&(matrix[row][i]!=4)&&((row==3)||(row==0)))\n {\n i+=1;\n } \n tmp=matrix[row][i];\n matrix[row][i]=matrix[row][col];\n matrix[row][col]=tmp;\n \n l_move=steps-(i-col);\n \n if((l_move)>0)\n {\n while(((row-j)< l_move)&&(matrix[j][i]!=4))\n {\n j-=1;\n }\n printf("%d", j);\n tmp=matrix[j][i];\n matrix[j][i]=matrix[row][i];\n matrix[row][i]=4;\n if(col==i)\n {\n matrix[row][i]=1;\n }\n l_move=l_move-(row-j);\n \n \n } \n \n }\n\n else if((row>=4)&&((col>=0)||(col<3)))//since there are 4 area in the matrix, I divided the code into 4 pieces.\n {\n \n while((i<col+steps)&&(matrix[row][i]!=4)&&((row==3)))\n {\n i+=1;\n }\n tmp=matrix[row][i];\n matrix[row][i]=matrix[row][col];\n matrix[row][col]=tmp;\n l_move=steps-(i-col);\n \n if((steps-(i-col))>0)\n {\n while(((j-row)<(steps))&&(matrix[j][i]!=4))\n {\n j+=1;\n }\n tmp=matrix[j][i];\n matrix[j][i]=matrix[row][i];\n matrix[row][i]=4;\n steps-=(row-j);\n \n \n }\n \n \n }\n }\n\nplease consider that this function is only for this exact situation which is the one causing the problem by changing the places of 4s in a wrong way." ]
[ "arrays", "c", "multidimensional-array", "project", "swap" ]
[ "Using connector c++ to access MYSQL database (How to add a path to my standard search directory)", "I am relatively new to programming&C++ and just began learning about MYSQL. I have been searching for a couple of days but couldn't find a solution. I usually use Cygwin&VIM&g++ to write, compile and run codes that I write. \n\nMy goal is to retrieve data from MYSQL database that I've set up on my laptop and be able to run a simple algorithm on that data and possibly update the database.\n\nI went into MYSQL's website and went through tutorials and found an example here. I have Boost, Connector, MYSQL server lib downloaded. When I run it, I get an error saying 'connection.h' was not found. I'm sure this is because when I compile it, g++ does not have the location of the library added to the search path that it goes through. The example has something like:\n\n\n #include <cppconn/conneciton.h>\n\n\nwhere these angled brackets means it is going to search (after the current directory) the standard search directory. I am guessing I have to add a new path (the location of where the libraries are) so that the compiler looks at that standard directory and compiles the header.\n\nThrough googling I am thinking in g++ I can use -Ldir -I to add a new search path but I don't get how to use it. Can anyone kindly explain/show me (by example) how to get over with this problem? :(" ]
[ "c++", "mysql", "mysql-connector", "search-path" ]
[ "Searching for a substring inside an array in php", "Hi I would like to know if there is a good algorithm to the search of a substring inside an array that is inside another array,\nI have something like:\nArray(\n [0] => Array(\n [0] => img src="1" /> \n [1] => img src="2" alt="" class="logo i-dd-logo" /> \n [2] => img src="3" alt="" /> \n [3] => img src="4" width="21" height="21" alt="" class="i-twitter-xs" /> \n [4] => img src="myTarget" width="21" height="21" alt="" class="i-rss" /> \n [5] => <img class="offerimage" id="product-image" src="6" title="" alt=""/> \n [6] => <img class="offerimage" id="product-image" src="7" title="" alt=""/> \n [7] => <img class="offerimage" id="product-image" src="8" title="" alt=""/> \n [8] => <img src="9" width="16" height="16" /> \n )\n\n[1] => Array(\n [0] => src="1" \n [1] => src="a" alt="" class="logo i-dd-logo" \n [2] => src="b" alt="" \n )\n\n)\nWhat I want to do is to know the position of target, for example [0][4] but it's not always the same\nWhat I'm doing now is a while inside another while and checking whith strpos for the substring, but maybe there is a better way to do this, any suggestions?\nThanks for everything\n\nUpdated code:\n\n$i=-1;\nforeach($img as$outterKey=>$outter) {\n foreach($outter as $innerKey=>$inner){\n\n $pos = strpos($img[$outterKey][$innerKey],"myTarget");\n if (!$pos === false) {\n $i=$outterKey;$j=$innerKey;\n break 2;\n }\n }\n }" ]
[ "php", "arrays", "string", "substring" ]
[ "connect MS SQL database to railo datasources", "I'm having a heck of a time getting a MS SQL datasource connected through my railo installation. I can connect fine through Adobe ColdFusion, but railo keeps throwing an error\n\nIn Adobe ColdFusion I have my server set as mycomputername\\sqlexpress and port 1433. In Railo using the same server, database, username and password. I'm getting the following error \n\nThe TCP/IP connection to the host myservername, port 1433 has failed. Error: \"Connection refused: connect. Verify the connection properties, check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port, and that no firewall is blocking TCP connections to the port.\".. \n\nI've also tried connecting via the IP address listed in SQL Server Configuration Manager IP4 is set to active and enabled with an IP address of 127.0.0.1 but that throws the same error as above\n\nI have IPv6 turned on and that shows up as IP1 in my TCP/IP settings, but I don't know why that would be causing an issue.\n\nPort 1433 is open as I can connect through Adobe ColdFusion. I hope I'm missing something obvious, but I'm stumped." ]
[ "sql-server-2005", "coldfusion", "sql-server-express", "railo" ]
[ "How to make ffmpeg run from laravel cron", "I have a laravel command that generates summary jpeg file (contact sheet) from a video file, using exec('ffmpeg ...').\n\nWhen I call it from command-line (like this: php artisan file:generate or su - nginx -s /bin/sh -c 'php artisan file:generate') it works, but if I have it in the crontab, it doesn't work.\n\nAny ideas?" ]
[ "laravel", "ffmpeg", "cron", "centos" ]
[ "Put language index into URL Multilanguage CodeIgniter site", "My site is created in three languages https://anto-nguyen.com.\nIt works well to translate from one language to another one.\nBut.. I can't put the language indication into the URL.\nI looked through all questions and answers that I could find here and have tried to use them, but unfortunatelly it doesn't work..\nI use Controller LangSwitch\nclass LangSwitch extends CI_Controller {\n\n public function __construct() {\n parent::__construct();\n } \n function switchLang($language = "") {\n\n $this->session->set_userdata('site_lang', $language);\n \n redirect($_SERVER['HTTP_REFERER']);\n }\n\n}\n\nThe language is called by following code integrated into menu\n<div>\n <?= anchor(base_url("langSwitch/switchLang/english"), 'En'); ?>\n <?= anchor(base_url("langSwitch/switchLang/french"), 'Fr'); ?>\n <?= anchor(base_url("langSwitch/switchLang/russian"), 'Ру'); ?> \n</div>\n\nMy .htaccess lookes like this\nRewriteEngine On\n\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteCond %{REQUEST_FILENAME} !-d\nRewriteRule ^(.*)$ /codeigniter/index.php/$1 [L]\n\n\nAnd seems to be modified, but all suggestions I found doesn't work\nCould you help me what to do that my link will appeared as /mysite/fr /mysite/en /mysite/ru?\nAll translation are in the folders language/english language/french language/russian\nMayby to change something in routes?\n$route['default_controller'] = 'site';\n$route['work'] = 'work/index'; //the URL 'work' will redirect to 'work/index'\n$route['work/(:any)_(:num)'] = 'work/article/$2';\n$route['404_override'] = '';\n$route['translate_uri_dashes'] = FALSE;\n$route['(:any)'] = 'site/$1';" ]
[ "php", "internationalization", "codeigniter-3" ]
[ "Declaring a variadic function in C99 without other parameters", "I am trying to implement low-level code that passes variadic arguments to a function pointer (with the function defined in NASM). This pointer can change at any time, so I need to declare a function pointer with the following signature:\n\ntypedef int (__fastcall* callback)(...);\n\n\nHowever, unless I declare it with a non-variadic parameter (which wont work), the compiler outputs the error \"error : expected a type specifier\". Is there any way to fix this just using C? Is there a different implementation that would work short of adjusting all of the other parameters based on calling convention in assembly? Any ideas or solutions would be appreciated.\n\nEdit: I'm aware that this is a very hacky implementation, but I am working with a legacy codebase. So as much as I'd like to, I can't completely change how everything works as I need a solution which will work in the current codebase." ]
[ "c", "assembly", "x86" ]
[ "Working with Spreadsheet::ParseExcel", "I am working with an Excel worksheet to fetch two columns and replace file names based on them. \n\nThis is how I get the values of two columns that I am interested in. the 14th column could be a single value or more than one separated by a comma.\n\nmy @required = (2,14);\nmy @value;\nmy @files = grep{ -f && -T && -M > 0 } glob(\"$dir/*\");\nmy @expected_file = grep{ /Parsed/ } @files;\nprint \"@expected_file\\n\"; \nif(! $workbook) {\n\n die $parser->error(),\"\\n\";\n} \n\n\nfor my $row (1 .. $row_max) {\n\n @value = map{\n\n\n my $cell = $worksheets[0]->get_cell($row,$_);\n $cell ? $cell->value() : '';\n\n }@required;\n\n my %hash_value = @value;\n foreach my $key (keys %hash_value ){\n\n my @suffix = split /[, ]/,$hash_value{$key};\n\n push @{ $resample->{$key} },@suffix;\n\n\n print $key . \":\" .@suffix,\"\\n\";\n } \n\n }\n\n\nOutput would be : \n\nTY45745a:A,BTY45745a:C,DTY45745a:E,FTY5475a:G,HTY5475a:I,JTY5475a:K,L\n\n\nWhere TY45745a,TY5475a are the keys.What I would like to achieve is something like this : TY45745a A,B,C,D,E,F and TY5475a G,H,I,J,K,L.\n\nAnd if the file names has [A-E] at the end of the file then it should be renamed to TY45745a[1..6], and if it has [G-L] TY5475a[1..6].\n\nCould this grouping of suffix for a name could be done when fetching from the Excel sheet? \n\nHow should I do this ? Any suggestions or pointers will be helpful ." ]
[ "perl" ]
[ "Flutter: generate a List of Widgets with data from Firestore", "I want my screen to display a limited number of products in GridView.\nAll products are stored in the Firebase Firestore and their images are in the Firebase storage.\nIn order to do that I use GridView.count, which one of its parameters is List<Widget> children. I wanted to generate a List using List.generate and each time fetch a product from the Firestore and its image from the storage to create a widget that represents a product.\nThe problem is that fetching the products from Firebase is asynchronous, and the generator function of List.generate cannot be async. Moreover I'm returning Future<List<Widget>> instead of List<Widget> to the children param of GridView.count\nAny ideas of how to overcome this?\nhere is my code:\n\nGridView.count(\n primary: false,\n crossAxisCount: 2,\n padding: const EdgeInsets.all(20),\n crossAxisSpacing: 10,\n mainAxisSpacing: 10,\n //FIXME: The argument type 'Future<List<Widget>>' can't be assigned to the parameter type 'List<Widget>':\n children: _buildGridTileList(15),\n)\n\nFuture<List<Widget>> _buildGridTileList(int count) async {\n var counterCollection = await FirebaseFirestore.instance.collection("Products").doc("Counter").get();\n var counterData = counterCollection.data();\n return List.generate(\n count,\n (index) async {\n //FIXME: Doesn't work beacuse generator cannot be async!!\n var avatarUrl = await FirebaseStorage.instance.ref('${counterData[index]}').child('${counterData[index]}').getDownloadURL();\n return Container(\n child: Center(\n child: NetworkImage(avatarUrl),\n ),\n );\n }\n );\n }" ]
[ "firebase", "flutter", "dart", "gridview", "google-cloud-firestore" ]
[ "Convert Binary to Hex in Java using loop and switch", "public static void main(String[] args) {\n\n Scanner ms = new Scanner(System.in);\n\n String binary = ms.nextLine();\n binary=binary.trim();\n\n //add leading zeroes if length divided by 4 has remainder.\n while (binary.length() % 4 != 0) binary = \"0\" + binary;\n\n String number = \"\";\n for (int i = 0; i < binary.length(); i += 4) {\n String num = binary.substring(i, i + 3);\n\n switch(num)\n {\n case \"0000\" : number = \"0\"; break;\n case \"0001\" : number = \"1\"; break;\n case \"0010\" : number = \"2\"; break;\n case \"0011\" : number = \"3\"; break;\n case \"0100\" : number = \"4\"; break;\n case \"0101\" : number = \"5\"; break;\n case \"0110\" : number = \"6\"; break;\n case \"0111\" : number = \"7\"; break;\n case \"1000\" : number = \"8\"; break;\n case \"1001\" : number = \"9\"; break;\n case \"1010\" : number = \"A\"; break;\n case \"1011\" : number = \"B\"; break;\n case \"1100\" : number = \"C\"; break;\n case \"1101\" : number = \"D\"; break;\n case \"1110\" : number = \"E\"; break;\n case \"1111\" : number = \"F\"; break;\n\n }\n System.out.println(number);\n }\n}\n\n\nI need to use loop and a switch op to do the conversion. After making those changes. I get my result of binary 1111 1110 as F then E on the next line. How can I fix that? I don't want to use stringbuilder because I haven't learn that. Is there any other simple code to do that?" ]
[ "java" ]
[ "Java NetBeans pass value to JFrame produces a compilation error", "There are two jFrames.\n\n\nFirstPage\nSecondPage\n\n\nThere is a button on FirstPage. When user clicks it, I need to open SecondPage.\n\nThis is the code in FirstPage:\n\nprivate void btn_testActionPerformed(java.awt.event.ActionEvent evt) { \n\n String testName=\"Damith\";\n SecondFrame win1=new SecondFrame(testName);\n win1.setVisible(true);\n} \n\n\nThis is how I modify SecondPage:\n\npublic SecondFrame(String anyname) {\n initComponents();\n\n}\n\n\nWhen I run the project it says:\n\n\n One or more projects were complied with error\n\n\nHowever, when I click \"Run Anyway\" it works as I expected.\n\nSo, why they said \"One or more projects were complied with error\"?" ]
[ "java", "swing", "netbeans", "jframe" ]
[ "git tag -l not displaying the most recent releases", "When I go to deploy my django installation, I get the following error:\n\nlocal: git tag -l release/beta* | tail -1\nrun: git checkout release/beta-20120221-150831 \nout: error: pathspec 'release/beta-20120221-150831' did not match any file(s) known to git.\n\n\nThe tag exists on my local box, but it doesn't on my staging server. Why? It sends the most recent release \"release/beta-20120221-150831\"." ]
[ "git", "release-management" ]
[ "How to append Template Data to another Template based on Button Click in Meteor JS?", "One template have button and another template have contains one text field.When ever button clicked that text filed append to the button template at the same time not remove the previous text fields that means the button clicked in 4 times 4 text fields add to the button template.\n\nSee the following code :\n\nHTML Code :\n\n<head>\n <title>hello</title>\n</head>\n\n<body>\n <h1>Welcome to Meteor!</h1>\n\n {{> hello}}\n\n</body>\n\n<template name=\"hello\">\n\n\n Add Text Fields here :\n\n <button>add another text box</button>\n\n</template>\n\n<template name=\"home\">\n\n <input type=\"text\" id=\"name\" />\n\n</template>\n\n\nJS Code :\n\nif (Meteor.isClient) {\n\n\n Template.hello.events({\n 'click button': function () {\n\n //Here to write append logic\n }\n });\n}\n\n\nI didn't get any idea about this.So please suggest me what to do for this?" ]
[ "meteor" ]
[ "Spring Data: Method with annotation @Query doesn't work as expected", "I try to cover my Repository code with junit tests but unexpectedly I am facing the following problem:\n\n @Test\n @Transactional\n public void shoudDeactivateAll(){\n\n /*get all Entities from DB*/\n List<SomeEntity> someEntities = someEntityRepository.findAll();\n\n/*for each Entity set 1 for field active*/\n someEntities.forEach(entity -> \n {entity.setActive(1);\n\n/*save changes*/\n SomeEntityRepository.save(entity);});\n\n /*call service, which walks through the whole rows and updates \"Active\" field to 0.*/\n unActiveService.makeAllUnactive();\n\n/*get all Entities again\n List<SomeEntity> someEntities = SomeEntityRepository.findAll();\n\n/*check that all Entities now have active =0*/\n someEntities.forEach(entity -> {AssertEquals(0, entity.getActive());});\n } \n\n\nwhere: \nmakeAllUnactive() method is just a @Query: \n\n @Modifying\n @Query(value = \"update SomeEntity e set v.active=0 where v.active =1\")\n public void makeAllUnactive();\n\n\nAnd: someEntityRepository extends JpaRepository\n\nThis test method return AssertionError: Expected 0 but was 1.\n\nit means that makeAllUnactive didn't change the status for Entitites OR did chanches, but they are invisible. \n\nCould you please help me understand where is \"gap\" in my code?" ]
[ "java", "junit", "transactions", "spring-data", "dao" ]
[ "Difference between wiring events with and without \"new\"", "In C#, what is the difference (if any) between these two lines of code?\n\ntmrMain.Elapsed += new ElapsedEventHandler(tmrMain_Tick);\n\n\nand\n\ntmrMain.Elapsed += tmrMain_Tick;\n\n\nBoth appear to work exactly the same. Does C# just assume you mean the former when you type the latter?" ]
[ "c#", "events", "syntax", "delegates" ]
[ "Entity Framework 6 performance impact with IList", "Is there any performance impact of IList instead ICollection (or IEnumerable) in EF entities?" ]
[ "entity-framework" ]
[ "Will the .exe file of a C program generated on a computer run on another computer which doesn't have any C compiler", "Say for instance a C program has been written and successfully compiled using a C compiler on a computer.If only the .exe file of this program is copied to another computer which doesn't have any C compiler installed on it then will it execute on that machine?I know a source program is compiled to generate the machine code(object code).This machine code is linked by the linker to the object modules to form the load module(.exe file) which is loaded into the memory by the loader for execution.\nThat means the .exe file has the machine code present in it, but at the same time it's also true that the machine code depends on the instruction set, CPU config. of the specific computer.So will the .exe file execute on a different computer if the instruction sets are the same/if the instruction sets are different?(Assume both the computers are running on the same OS)" ]
[ "architecture", "compiler-construction", "operating-system" ]
[ "How to make parent component draggable but child component non draggable in angular", "I have implemented drag and drop feature in angular using Angular material's CDK drag drop.\nI have a parent component and a child component inside that. \nI want to make the parent component draggable but the child component should remain fixed.\n\nCurrently, when I am dragging the parent div, the child component is also moving but I want to restrict that. \nI tried using cdkDragDisabled property but it's not working properly.\nIs there some other solution?" ]
[ "angular", "angular-material", "angular-cdk" ]
[ "How to reset pose on a skinned model (Three.js)", "How do I return my model (skinned mesh and bones) to the original state, before an animation has been played? In other words to unset the animation.\n\nI've tried playing single frame \"Rest pose\" animation but it feels like a workaround." ]
[ "three.js" ]
[ "firefox shows black 1px line on top of backgroundimage", "I have the issue, that Firefox 31.0 (chrome and safari are fine) renders a 1px-wide border on top of every div which holds a background-image.\n\nI tried already a few things like:\n\nbackground-color: #F5F5F5;\nborder: 0px none #F5F5F5;\n\n\nBut it doesn't change the result. Strangely, the line disappears when I change those values in the inspector of ff. \n\nThe whole css looks like this:\n\n\n\nIf you like, you can watch it live her: http://larserbach.com (The brighter the image the more obvious it becomes).\n\nI'm glad, if you can offer me a fix to this. Thanks in advance!" ]
[ "css", "firefox", "border", "background-image" ]
[ "How do I rename the android package name?", "Pressing Shift+F6 seems only to rename the last directory.\nFor example, in the project com.example.test it will offer to rename test only. The same applies if I navigate to package name in .java or Manifest file and press Shift+F6. \n\nSo is there a way to rename the package?" ]
[ "android", "intellij-idea" ]
[ "Jasmine Testing with Angular Promise not resolving with TypeScript", "I have a fairly straightforward test that works against an Angular promise, which I'm resolving in the beforeEach function, but the then in my code is not ever firing and I can't see what I'm missing. These are written with TypeScript, but that doesn't really have any bearing on the problem.\n\nHere is my test\n\ndescribe('Refresh->', () => {\n\n var controller = new Directives.Reporting.ReportDirectiveController($scope, $q, $location);\n var called = false;\n var defer: any;\n\n beforeEach((done) => {\n controller.drillReport = (drillReport: Models.drillReport): ng.IPromise<Models.drillData> => {\n defer = $q.defer();\n called = true;\n defer.resolve({});\n return defer.promise;\n };\n spyOn(controller, 'processResults');\n controller.refresh();\n done();\n });\n\n it('Calls DrillReport', () => {\n expect(called).toBeTruthy();\n });\n\n it('Calls ProcessResults', () => {\n expect(controller.processResults).toHaveBeenCalled();\n });\n});\n\n\nThe Refresh method in the controller looks like this:\n\nrefresh() {\n this.drillReport({ drillReport: drillReport })\n .then((results: Models.drillData) => {\n parent.processResults(results, parent.availableDrills, this.columns, this.gridOptions, undefined, undefined);\n });\n}" ]
[ "javascript", "angularjs", "typescript", "jasmine", "angular-promise" ]
[ "How are less files compiled into css templates in PHP Thelia?", "When using Thelia (http://thelia.net/) which is built on the symfony 2 framework, the developers provide a less templating system for creating themes or altering variables in the default template. I can see it boils down to one file styles.less which calls all the others, and I can see the minified styles.css which the less file should compile into. But nowhere in the documentation do they specify how to compile this file.\n\nI have found this:\n\nhttp://doc.thelia.net/en/documentation/templates/assets.html\nWhich suggests to set automatic asset generation to 1 (which I have done and cleared the cache with no evident recompile.\n\nI have also found this:\n\nHow to customize Thelia template with less?\nWhich tells me to modify the files I am modifying, but now how to compile them into the minified css.\n\nSearching google reveals a few different projects for external less compilers in php, but considering the nature of the symfony 2 based command structure of the thelia project I cant help thinking Im missing something inbuilt to recompile these assets. Any help is much appreciated." ]
[ "php", "css", "symfony", "templates", "less" ]
[ "How to configure Cucumber in Rails 4", "I'm trying to use Cucumber in a Rails 4. I've added the Cucumber-Rails gem, followed the steps in the instructions but when I wrote step definitions like so:\n\nWhen(/^I submit a sign up with the following:$/) do |table|\n user = User.create({\n first_name: 'Name',\n last_name: 'Last',\n email: '[email protected]',\n domain: 'example.com',\n password: 'foobar',\n password_confirmation: 'foobar'\n })\nend\n\n\nI get the following error: uninitialized constant User (NameError)\n./features/step_definitions/users/sign_up_steps.rb:2:in/^I submit a sign up with the following:$/'\nfeatures/users/sign_up.feature:4:in When I submit a sign up with the following:'\n\nWhat am I missing?" ]
[ "ruby-on-rails", "ruby-on-rails-4", "cucumber" ]
[ "Efficiently parsing text file for datetimes", "I have text files that look like something like\n\n<Jun/11 09:14 pm>Information i need to capture1\n<Jun/11 09:14 pm> Information i need to capture2\n\n<Jun/11 09:14 pm> Information i need to capture3\n<Jun/11 09:14 pm> Information i need to capture4\n<Jun/11 09:15 pm> Information i need to capture5\n<Jun/11 09:15 pm> Information i need to capture6\n\n\nand two datetimes like\n\n15/6/2015-16:27:10 # startDateTime\n15/6/2015-17:27:19 # endDateTime\n\n\nI need to grab all the information in the logs between the two datetimes. Currently I make a datetime object from each the two times im searching between. \n\nI then read the file line by line and make a new datetime object that I compare against my start and end time to see if i should grab that line of information. However the files are huge(150MB) and the code can take hours to run(On 100+ files).\n\nThe code looks something like\n\nf = open(fileToParse, \"r\")\nfor line in f.read().splitlines():\n if line.strip() == \"\":\n continue\n lineDateTime = datetime.datetime(lineYear, lineMonth, lineDay, lineHour, lineMin, lineSec)\n if (startDateTime < lineDateTime < endDateTime):\n writeFile.write(line+\"\\n\")\n between = True\n elif(lineDateTime > endDateTime):\n writeFile.write(line+\"\\n\")\n break\n else:\n if between:\n writeFile.write(line+\"\\n\")\n\n\nI want to rewrite this using some more smarts. The files can hold months of information, however I usually only search for about 1 hour to 3 days of data." ]
[ "python", "performance", "python-2.7", "parsing", "datetime" ]
[ "Excel VBA to call a single macro by mutliple independent worksheet changes", "I have used the following Worksheet Change VBA code which is applied to a single cell reference, and is used to call a macro dependent on selection from a data validation list. The event triggered by the macro applies to the row of the active cell.\n\nPrivate Sub Worksheet_Change(ByVal Target As Range)\n\nIf Target.Address(True, True) = \"$H$2\" Then\n Select Case Target\n Case \"Yes\"\n Call StandardEntry\n Case Else\n 'Do nothing\n End Select\nEnd If\nEnd Sub\n\n\nI would now like to be able to apply this worksheet change event to be triggered by individual cells within the same column, generating the same event within the active cells row and not affecting any other rows. Identical data validation has been applied to the other cells in the column.\n\nI would appreciate assistance in writing the appropriate code or adjusting the code above to suit." ]
[ "vba", "excel", "validation", "macros" ]
[ "Reload data Collection View inside Table view Cell (Swift)", "I came across a problem with a nested Collection View inside a Table View Cell. The content is uploaded from an online database and it takes a while to fetch the data. My question is how to keep reloading data for the Collection View until the content is fetched from the online database and then display it.\n\nclass DiscoverViewCell: UITableViewCell {\n @IBOutlet weak var categoryLabel: UILabel!\n @IBOutlet weak var _collectionView: UICollectionView!\n @IBAction func seeMoreAction(_ sender: Any) {\n }\n\n}\nclass MovieCollectionViewCell: UICollectionViewCell {\n @IBOutlet weak var moviePicture: UIImageView!\n @IBOutlet weak var movieTitleLabel: UILabel!\n func updateCollectionCell(movie: MovieModel){\n moviePicture.image = movie.poster\n movieTitleLabel.text = movie.name\n }\n\n}\nfunc collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {\n guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: \"MovieCell\", for: indexPath) as? MovieCollectionViewCell else {\n return UICollectionViewCell()\n }\n\n cell.updateCollectionCell(movie: movieArray[indexPath.item])\n return cell\n}\noverride func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {\n guard let cell = tableView.dequeueReusableCell(withIdentifier: \"DiscoverCell\") as? DiscoverViewCell else {\n return UITableViewCell()\n }\n\n cell.categoryLabel.text = categories[indexPath.item]\n setUpCell(cell)\n return cell\n}\n\n\nAlso, how is it possible to display different Collection Views content inside Table View Cells depending of a label which is inside each Table View Cell but separated from Collection View." ]
[ "swift", "uitableview", "uicollectionview", "uicollectionviewcell" ]
[ "R Convert vector of epochs to POSIXct", "R noob question: I have a dataframe called train with an integer column called some_time containing times as epochs:\n\n> library(dplyr)\n> train[,\"some_time\"]\n# A tibble: 486,048 x 1\n some_time\n <int>\n1 1463497837\n2 1461357640\n3 1463499639\n4 1463182983\n5 1461855019\n6 1459927021\n7 1460230930\n8 1462282973\n9 1462888545\n10 1462888549\n# ... with 486,038 more rows\n\n\nWhen I try to convert these times to POSIXct, I get an error:\n\n> as.POSIXct(train[, \"some_time\"], origin = \"1970-1-1\", tz = \"GMT\")\nas.POSIXct(train[,\"some_time\"], origin = \"1970-01-01\", tz = \"GMT\")\nError in as.POSIXct.default(train[, \"some_time\"], origin = \"1970-01-01\", : \n do not know how to convert 'train[, \"some_time\"]' to class \"POSIXct\"\n\n\nI suspect this has something to do with dplyr and tibble, as it is returning a dataframe instead of a vector - for example, all of the following return the same column tibble as shown above, instead of the first number value:\n\ntrain[, \"some_time\"][1]\ntrain[, \"some_time\"][1][1]\nas.vector(train[,\"some_time\"])[1]\nc(train[,\"some_time\"])[1]\n\n\nHow do I get the as.POSIXct to correctly convert the times as a vector?" ]
[ "r", "dplyr" ]
[ "How to make MySQL log to 2 seperate remote servers? (Not coding)", "Documentation on this topic is scarce at best. I have two syslog servers and i need to send MySQL logs to them. Currently, i believe the logs are stored at either .mysql_history and/or mysqld.log Does mysql have the capability within itself to log remotely, or do i need to write a script to do so?\n\nIf mysql has this capability, it seems that you could only assign it one location. I need two, so i would need to know if this is able to be done or just go with the script again.\n\nI tried testing one server and tried setting environment variable MYSQL_HISTFILE location to one remote server; however, this is not working. \n\nAny help or resources?" ]
[ "mysql" ]
[ "passing all members of a json array from an API call in swift", "Hi have a project which I implemented ImageSlideshow and sdwebimage. Images are gotten from an API call but in the docs of ImageSlideshow SDwebImages are implemented as below\n\nlet sdWebImageSource = [SDWebImageSource(urlString: \"https://images.unsplash.com/photo-1432679963831-2dab49187847?w=1080\")!, SDWebImageSource(urlString: \"https://images.unsplash.com/photo-1447746249824-4be4e1b76d66?w=1080\")!, SDWebImageSource(urlString: \"https://images.unsplash.com/photo-1463595373836-6e0b0a8ee322?w=1080\")!]\n\n\nwhich works well but for my own project I have all the images in an array and I want to display this images in the ImageSlideshow. I do not know the number of images so it is difficult to hard code it so how can I pass the array of images. ProductServices.instance.selectedProduct?.productImg[0]) this gives me the image at the first index. the images could be up to the fifth index. how can I pass this?" ]
[ "ios", "swift", "alamofire", "sdwebimage" ]
[ "Decrypting AES256 with node.js via a pipe", "I'm trying to use node.js' crypt module to decrypt some files that were encrypted by another program that used the openssl library in a rather non-standard library. By non-standard I mean that the number of rounds and location of the salt differs from the defaults used by openssl. So as a result I am extracting the salt first and then creating a ReadStream on the resulting description before trying to do that actual decryption.\n\nI have two routines. The first one uses decrypt.update and decrypt.final to perform the decryption. I am able to decrypt files this way. The second uses pipe to perform the decryption. When I try to use it I get this error:\n\nThe error I get when I try to run my code is:\n\n\n digital envelope routines:EVP_DecryptFinal_ex:wrong final block length\n\n\nThe working and failing function are below. The \"binary_concat\" function referenced does the equivalent of a+b for binary strings - it took me a couple hours of debugging before I discovered that a+b doesn't work properly!\n\nfunction do_decrypt_works(infile,password,salt) {\n var outfile = fs.createWriteStream(\"/tmp/test.out\")\n var text = fs.readFileSync(infile_filename).slice(8) // hack since we aren't using infile in this case\n var rounds = 28\n data00 = binary_concat(password,salt,\"\")\n\n var hash1 = do_rounds(data00)\n var hash1a = binary_concat(hash1,password,salt)\n var hash2 = do_rounds(hash1a,password,salt)\n var hash2a = binary_concat(hash2,password,salt)\n var hash3 = do_rounds(hash2a,password,salt)\n\n var key = binary_concat(hash1,hash2,\"\")\n var iv = hash3\n\n var decrypt = crypto.createDecipheriv('aes-256-cbc', key, iv)\n\n var content = decrypt.update(text, \"binary\", \"binary\");\n content += decrypt.final(\"binary\");\n}\n\nfunction do_decrypt_fails(infile,password,salt) {\n var outfile = fs.createWriteStream(\"/tmp/test.out\")\n var rounds = 28\n data00 = binary_concat(password,salt,\"\")\n\n var hash1 = do_rounds(data00)\n var hash1a = binary_concat(hash1,password,salt)\n var hash2 = do_rounds(hash1a,password,salt)\n var hash2a = binary_concat(hash2,password,salt)\n var hash3 = do_rounds(hash2a,password,salt)\n\n var key = binary_concat(hash1,hash2,\"\")\n var iv = hash3\n\n var decrypt = crypto.createDecipheriv('aes-256-cbc', key, iv)\n infile.pipe(decrypt).pipe(outfile)\n}\n\n\nAccording to the documentation, both createDecipher and createDecipheriv return an instance of class Decipher which can be used with either of the above techniques.\n\nSources:\n\nFirst\n\nSecond\n\nThird" ]
[ "node.js", "encryption" ]
[ "styled-components: Styling components without wrapping them in containers/wrappers?", "Is it possible to style a react component without having to create a container?\n\nHere's an example of my current problem. I always need to wrap the component in a container/wrapper. Like so ...\n\nimport React, { Component } from 'react';\nimport styled from 'styled-components';\n\nconst PitchSliderContainer = styled.input`\n text-align: right;\n float: right;\n`;\n\nconst PitchSlider = () => <PitchSliderContainer\n type=\"range\"\n min=\"0.9\"\n max=\"1.1\"\n step=\"any\"\n onChange={this.props.onChange}\n/>\n\nexport default PitchSlider;\n\n\nIs there any way to style the PitchSlider without having to create a container?" ]
[ "reactjs", "styled-components" ]
[ "'onkeydown' attribute visible but null?", "I'm writing a Chrome extension and I'm trying to programmatically trigger a keypress event on the textarea element where you type in Facebook chat.\n\nIf I look at the element in the inspector, I can see that it has an onkeydown handler set:\n\nonkeydown=\"run_with(this, [\"legacy:control-textarea\"], function() {TextAreaControl.getInstance(this)});\"\n\n\n--but I can't trigger it. While trying to figure out why I can't trigger it, I found that when I select the element using one of the classes on it and type document.querySelector('._552m').onkeydown in the console, it comes up null. Likewise, using getAttribute on it for onkeydown comes up null.\n\nWhat am I missing here? How can I get at this event handler? Why can I see it set on the element in the inspector and yet not access it programmatically in the usual way? Is React pulling some weird magic here?\n\nEdit: document.querySelector('._552m').attributes shows the onkeydown attribute listed....wtf..." ]
[ "javascript", "html", "facebook", "event-handling", "reactjs" ]
[ "How to re-sign a MacOS Application (XCode 11.4.1)", "I am working on a MacOS application.\nIn the past, I was using codesign -f -s to re-sign a .app folder without paying much attention since it just works.\n\nNow using XCode 11.4.1 (Mac Catalina 10.15.4), my app starts to break with error \"Code Signature Invalid\" after re-sign.\nHere's some additional information about my attempt to figure out what's going on (for the sake of debugging, I was trying to re-sign using the same identity and entitlements used to sign the app in build step):\n\n\ncodesign -d --entitlments :- after codesign -f -s [identity] [.app] only show 1 line: Executable=<path to .app file>, the app can be launched, but later break from a line of code for capability checking, which hints the existing entitlements has been removed (the entitlement was included and the build was working fine before re-sign).\ncodesign -d --entitlments :- after codesign -f -s [identity] --entitlements [entitlement.xml file] [.app] show both executable path and entitlement.xml's content, but the build now break right at launch from \"Code Signature Invalid\".\nApparently, re-singing a sample app gives the same behavior.\n\n\nPlease leave a comment if you have any tribal knowledge or source of information that you think could be useful. Thanks for reading." ]
[ "xcode", "macos-catalina", "codesign" ]
[ "mysql - how to display count of a value in an extra column", "Imagine we have a table like this:\n\nid value\n 1 a\n 2 b\n 3 a\n 4 a\n 5 b\n\n\nQuery like this\n\nSELECT * , COUNT( * )\nFROM test\nGROUP BY value\n\n\ngives us a table like this:\n\nid value COUNT(*)\n 1 a 3\n 2 b 2\n\n\nwhich tells us that there are three 'a' and two 'b' in our table.\n\nThe question is: is it possible to make a query (without nested SELECT's), which would yield a table like\n\nid value count_in_col\n 1 a 3\n 2 b 2\n 3 a 3\n 4 a 3\n 5 b 2\n\n\nThe goal is to avoid collapsing columns and to add quantity of 'value' elements in the whole column to each row." ]
[ "mysql", "sql" ]
[ "Unity3d Game Tutorial Scavengers 2D My character only moves once", "I'm new at creating games and I'm programming in C#, and I'm in need of help because I've spent a lot of time trying to make the Unity3d tutorial game the 2D Scavengers, and my character only moves only once and for the rest is normal. Unity does not charge any error in this regard. Could someone help me?\n\nI tried to compare my code with that of the video lessons several times but I did not find any difference.\n\nprivate void Update()\n{\n //Só vamos fazer alguma coisa se for o turno do player\n if(!GameManager.instance.playerTurn)return;\n\n int horizontal = 0;\n int vertical = 0;\n\n horizontal = (int) (Input.GetAxisRaw(\"Horizontal\"));\n\n vertical = (int) (Input.GetAxisRaw(\"Vertical\"));\n\n if(horizontal != 0)\n { \n vertical = 0;\n }\n\n if(horizontal != 0 || vertical != 0)\n {\n AttemptMove<Wall> (horizontal, vertical);\n }\n}" ]
[ "c#", "unity3d" ]
[ "Refreshing a date subroutine in an HTA application", "Could anyone tell me how I could use document.write to output the date and time from a subroutine, and also have it refresh every minute from when the application is executed? Here is the code I have so far. \n\nSub Window_OnLoad\nDaterefresher \niTimerID = window.setInterval(\"DateRefresher\", 100)\nEnd Sub\n\n\n\nSub ExitProgram\n window.close()\nEnd Sub\nSub DateRefresher()\nDateInfo = DateInfo & Now & VbCrLf\nDateInfo = DateInfo & Date & VbCrLf\nDateInfo = DateInfo & Time & vbCrLf\nEnd Sub\n\n\nAfter that id like to call it in a div and have it update the time every minute.\n\nI am very sorry ,I am new to VBS, and not an expert with HTML either. Please excuse my poor attempt here. \n\nThanks." ]
[ "html", "vbscript", "subroutine", "hta" ]
[ "Is it bad practice to use C-like static variables in Objective-C?", "All I want to do is make a utility class for my (stream capture) app that grabs settings from my website. I want to call it from other files as a simple [RemoteConfig updateSettings]; \n\nMy goal is to use this remote configuration utility without making an object for every situation where I grab remote settings.\n\nThe information around static/class variables and methods in Objective C is hazy and very opinionated, so after a lot of experimenting, I got this to work. But it looks funny, which makes me think something is incorrect. \n\nRemoteConfig.h simply declares the +(void) updateSettings method.\n\nThis is my RemoteConfig.m:\n\n#import \"RemoteConfig.h\"\n\nstatic NSMutableData* _configData;\nstatic NSString* url = @\"http://local.namehidden.com:90/json.html\";\nstatic int try;\n\n@implementation RemoteConfig\n\n+(void) updateSettings\n{\n NSString *identifier = [[[UIDevice currentDevice] identifierForVendor] UUIDString];\n\n //Create URL request\n NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]\n cachePolicy: NSURLRequestReloadIgnoringCacheData\n timeoutInterval: 10];\n\n [request setHTTPMethod: @\"POST\"];\n NSString *post = [NSString stringWithFormat:@\"id=%@\", identifier];\n NSData *postData = [post dataUsingEncoding:NSUTF8StringEncoding];\n [request setHTTPBody:postData];\n\n NSURLConnection* connection = [NSURLConnection connectionWithRequest:request\n delegate:self];\n [connection start];\n}\n\n///////////////////////////// DELEGATE METHODS ///////////////////////////////////\n\n+(void)connection:(NSConnection*)conn didReceiveResponse:(NSURLResponse*)response\n{\n if (_configData == NULL) {\n _configData = [[NSMutableData alloc] init];\n }\n [_configData setLength:0];\n NSLog(@\"didReceiveResponse: responseData length:(%d)\", _configData.length);\n}\n\n/// and so on...\n\n\nIt looks funky, putting C-style variables above the @interface/@implementation. A lot of people say try to use properties, some say do the static method singleton trick, I've seen a little library that handles singletons but this was the simplest solution I found.\n\nMy questions-\n\n\nIs this proverbially bad?\nWhat limitations does this have?\nWhat are the alternatives, and what is best?" ]
[ "ios", "objective-c", "static", "singleton", "class-variables" ]
[ "Android NDK, keeping live C++ objects", "I've got a following problem. I want to write an Android application, which uses my legacy C++ classes. I have to keep a C++ object alive during the whole application lifetime.\n\nI wrote a similar application in C# and solved the problem by passing a pointer to a C++ class to C# and storing it there using IntPtr. Then, when I wanted to call a method on that object, I simply passed that pointer again to C++, converted to a class pointer and called a method on it.\n\nHow can I achieve similar result in Java and Android NDK? Does Java support storing pointers?" ]
[ "java", "android", "c++", "android-ndk" ]
[ "Deploy Struts and Spring application using java service wrapper", "I am very new to Java Service Wrapper and windows service.\n\nCan we run struts and spring application as windows service using Java Service Wrapper without any web server(Tomcat, Jboss etc.) ?." ]
[ "java", "windows" ]
[ "Incorrect zoom level for horizontal polyline in a MKMapView", "I'm using a MKMapView to display a polyline between two coordinates.\nIn order to ensure that the entire polyline is visible in the map view, I'm using its setVisibleMapRect(_:edgePadding:animated:) method.\n\nThis works fine when the polyline I'm drawing is from north to south (or vice-versa):\n\n\n\nHowever, with an east to west (or vice versa) polyline rendered, not all of it is visible, and the user must zoom out in order for it to be fully visible:\n\n\n\n\nIn this test project, the map view is added to a view controller and has its constraints set so that it fills the entirety of its superview.\n\nThe code I'm using to generate the above example is as follows:\n\noverride func viewDidLoad() {\n\n super.viewDidLoad()\n\n mapView.delegate = self\n\n var verticalLine = [CLLocationCoordinate2DMake(40.711043, -74.008243), CLLocationCoordinate2DMake(40.988465, -73.807804)]\n var horizontalLine = [CLLocationCoordinate2DMake(40.798569, -74.269200), CLLocationCoordinate2DMake(40.804152, -73.771390)]\n\n let polyline = MKPolyline(coordinates: &horizontalLine, count: 2)\n mapView.addOverlay(polyline, level: .AboveRoads)\n\n mapView.setVisibleMapRect(polyline.boundingMapRect, edgePadding: UIEdgeInsetsMake(10.0, 10.0, 10.0, 10.0), animated: false)\n\n}\n\n\nHow can I ensure that the entire line is visible when either a vertical or horizontal polyline is rendered? The above behaviour is exhibited in both iOS 8.2 and iOS 9.1." ]
[ "ios", "cocoa-touch", "mkmapview", "mapkit" ]
[ "Transparency in GD PHP library", "I'm attempting to allow transparency when compressing a file upload.\n\nI created a function in which it will change the image to a jpeg (no matter what is uploaded), however, my client wants the images to have transparency. For ease, what I will do is if the image is a PNG, I will save it out as a PNG with transparency enabled, otherwise, I will just save it as a \"flat\" jPEG.\n\nHere is the function I created.\n\nfunction resizeImage($image, $resizeHeight = null, $resizeWidth = null, $quality = 80)\n{\n $img = getimagesize($image);\n $ext = explode(\".\",$image);\n\n list($width, $height, $type, $attr) = $img;\n\n if($resizeHeight == null)\n {\n //Getting the new height by dividing the image width by the height and multiplying by the new width.\n $resizeHeight = ($height/$width)*$resizeWidth;\n }\n if($resizeWidth == null)\n {\n //Getting the new width by dividing the image height by the width and multiplying by the new height.\n $resizeWidth = ($width/$height)*$resizeHeight;\n }\n\n $name = uniqid().time().\".\".$ext[count($ext)-1];\n\n if($img['mime'] == \"image/jpeg\")\n {\n $image = imagecreatefromjpeg($image);\n }\n else if($img['mime'] == \"image/png\")\n {\n $image = imagecreatefrompng($image);\n }\n\n $destImg = imagecreatetruecolor($resizeWidth, $resizeHeight);\n\n if(imagecopyresampled($destImg, $image, 0, 0, 0, 0, $resizeWidth, $resizeHeight, $width, $height))\n {\n if(imagejpeg($destImg, DIRUPLOADFOLDER.$name, $quality))\n {\n return $name;\n }\n }\n}\n\n\nNeedless to say, this function only saves out as a JPEG. I tried replacing imagejpeg with imagepng but that didn't work (like it didn't at all create an image). What do I need to do in order to make sure that the saved out PNG will also save out with the original's transparency?" ]
[ "php", "image", "gd" ]
[ "Cutting a time elapsed variable into manageable things", "flight_time\n 11:42:00\n 19:37:06\n 18:11:17\n\n\nI am having trouble working with the time played variable in the dataset. I can't seem to figure out how to get R to treat this value as a numeric.\n\nApologies if this has been asked before.\n\nEDIT:\n\nOkay well given the stuff posted below I've realised there's a few things I didn't know/check before. \n\nFirst of all this is a factor variable. I read through the lubridate package documentation, and since I want to perform arithmetic operations (if this is the right terminology) I believe the duration function is the correct one.\n\nHowever looking at the examples - I am not entirely sure what the syntax is for applying this to a whole column in a large(ish) data from. Since I have 4.5k observations, I'm not sure exactly how to appply this. I don't need an excessive amount of granularity - ideally even hours and minutes are fine.\n\nSo I'm thinking I would want my code to look like:\n\nconversion from factor variable to character string > conversion from character string to duration/as.numeric." ]
[ "r" ]
[ "Pandas: Check if column value is smaller than any previous column value", "I want to check if any value of column 'c' is smaller than all previous column values.\nIn my current approach I am using pandas diff(), but it let's me only compare to the previous value.\n\nimport pandas as pd\n\ndf = pd.DataFrame({'c': [1, 4, 9, 7, 8, 36]})\n\ndf['diff'] = df['c'].diff() < 0\n\nprint(df)\n\n\nCurrent result:\n\n c diff\n0 1 False\n1 4 False\n2 9 False\n3 7 True\n4 8 False\n5 36 False\n\n\nWanted result:\n\n c diff\n0 1 False\n1 4 False\n2 9 False\n3 7 True\n4 8 True\n5 36 False\n\n\nSo row 4 should also result in a True, as 8 is smaller than 9.\n\nThanks" ]
[ "python", "pandas" ]
[ "How can print after point php", "How can print after point two symbols something like that (92.25)\n\nI have line like this: \n\n$amount =($order['total'] * $this->currency->getvalue($order['currency_code']));" ]
[ "php" ]
[ "Need help building libpandoc, Haskell + C and .NET bindings for Pandoc", "I'd love to use Pandoc in a utility I'm writing (C# console app) and I found this bindings project on GitHub, libpandoc and by extension, it's .NET bindings project, libpandoc-dotnet.\n\nI wish the author had included the built DLL but I suppose he wanted to leave it open to future Pandoc versions.\n\nI have no Haskell experience whatsoever, I just want the .NET bindings in the end. I'm trying to install the dependencies via cabal but I don't understand the error messages and a cursory search leads me to believe installing base is a no-no, so I'm not sure what to do.\n\n\nC:\\Development\\Contrib\\libpandoc>cabal install base-4.1.0.0\nResolving dependencies...\ncabal: Could not resolve dependencies:\nnext goal: base (user goal)\nrejecting: base-3.0.3.2, 3.0.3.1, 4.6.0.1, 4.6.0.0, 4.5.1.0/installed-7c8...,\n4.5.1.0, 4.5.0.0, 4.4.1.0, 4.4.0.0, 4.3.1.0, 4.3.0.0, 4.2.0.2, 4.2.0.1,\n4.2.0.0 (global constraint requires ==4.1.0.0)\nrejecting: base-4.1.0.0 (only already installed instances can be used)\nrejecting: base-4.0.0.0 (global constraint requires ==4.1.0.0)\n\n\nIf a kind soul could even build the damn thing (fork it? upload it somewhere?) I'd love you forever. Alternatively, show me how to build it properly and I can handle it from there I think. Though now that I think about it, not sure I have a C compiler installed.\n\nUpdate:\n\nOK. So it all comes down to the fact that libpandoc is 3 years old and its dependencies are out of date. I had no luck trying to get all the old Haskell tools to install and work, I probably had no idea what I was doing. I got as far as installing some dependencies but some dependencies weren't versioned so I had to track each version specifically and I eventually gave up.\n\nI then just updated the dependency versions for libpandoc itself and now I've got all the dependencies built and linked.\n\nThe only remaining issue is that libpandoc needs to be updated to work against the latest Pandoc release (1.10)." ]
[ "c", "haskell", "pandoc" ]
[ "between list calculations per row in R", "Let's say i have the following list of df's (in reality i have many more dfs).\n\nseq <- c(\"12345\",\"67890\")\n\nli <- list()\n\nfor (i in 1:length(seq)){\n\n li[[i]] <- list()\n\n names(li)[i] <- seq[i]\n\n li[[i]] <- data.frame(A = c(1,2,3),\n B = c(2,4,6))\n}\n\n\nWhat i would like to do is calculate the mean within the same cell position between the lists, keeping the same amount of rows and columns as the original lists. How could i do this? I believe I can use the apply() function, but i am unsure how to do this. \n\nThe expected output (not surprising):\n\n A B\n1 1 2\n2 2 4\n3 3 6\n\n\nIn reality, the values within each list are not necessarily the same." ]
[ "r", "list", "dataframe" ]
[ "Generate and download report from SQL Server using SSRS with multiple parameters", "I have designed a template in Report Builder and my report has 6 parameters:\n\nStart Date, End Date, Source, Destination, Transaction, and Consignor\n\n\nand my SQL table has the following columns:\n\n[DATE], [SOURCE], [DESTINATION], [REFERENCE#], [ITEMCODE], [DESCRIPTION],\n[UM], [PRICE], [QTY], [AMOUNT], [MFGDATE], [EXPDATE], [LOT#], [TRANS], [CONSIGNOR], [DRDATE]\n\n\nI'm having a hard time writing the expressions for the parameters and could use some help please." ]
[ "sql-server", "reporting-services" ]
[ "spellchecker for actionscript 2 projector?", "I have a AS2 based projector compiled into EXE using mprojector. I need to add spellchecking to the textboxes, is there any spellchecker available for AS2??? I have only found valid solutions for AS3. HELP!!!\n\nThanks,\n\nPeter" ]
[ "flash", "actionscript" ]
[ "Infer type from void* variable", "Suppose I have a struct like\n\ntypedef struct __item {\n void **data;\n int length;\n} item_array;\n\n\nrepresenting a kind of \"generic array\".\n\nIs there any way I could infer the type of elements pointed by data struct member, without storing this information in my struct?" ]
[ "c", "type-inference", "void-pointers" ]
[ "howto create api service", "I have an application which handles some data. Now i want to make the data available throughout a php api (something like zend_gdata for google) so my application's users can handle the data from my application in their own applications on an other host.\n\nIs this possible? Can someone hook me up whith some literature or ideas?" ]
[ "php" ]
[ "classCastException on getExtra() from a Parcelable Object in a Service", "I'm trying to implement a Service and I have a classCastException in my Service.\nSince Location isn't Parcelable I wrap it in a ParcelableArrayList.\n\npublic class GPSService extends Service {\n public void setLocation(Location location) {\n ArrayList<Location> locationArrayList = new ArrayList<Location>(1);\n locationArrayList.add(location);\n Bundle b = new Bundle();\n b.putParcelableArrayList(\"location\", locationArrayList);\n // try with an arrayList instead of just getExtra doesn't change anything :(\n ArrayList<GPSResultReceiver> resultReceiverArrayList = intent.getParcelableArrayListExtra(\"receiver\");\n // this is a resultReceiver and not a GPSResultReceiver\n // where did the upcast happen?\n GPSResultReceiver receiver = resultReceiverArrayList.get(0);\n Log.d(\"ResultClass\", receiver.getClass().toString());\n receiver.onReceiveResult(1111, b);\n }\n\n\nMy Activity looks as following:\n\npublic class MyActivity extends Activity implements GPSResultReceiver.Receiver {\n void startService() {\n resultReceiver = new GPSResultReceiver(new Handler());\n resultReceiver.setReceiver(this);\n final Intent intent = new Intent(Intent.ACTION_SEND, null, this, GPSService.class);\n // intent.putExtra(\"receiver\", resultReceiver);\n ArrayList<GPSResultReceiver> resultReceiverArrayList = new ArrayList<GPSResultReceiver>(1);\n resultReceiverArrayList.add(resultReceiver);\n intent.putParcelableArrayListExtra(\"receiver\", resultReceiverArrayList);\n serviceRunning = true;\n startService(intent);\n }\n\n\nMy GPSResultReceiver:\n\npublic class GPSResultReceiver extends ResultReceiver {\n private Receiver resultReceiver;\n public GPSResultReceiver(Handler handler) {\n super(handler);\n }\n public void setReceiver(Receiver receiver) {\n resultReceiver = receiver;\n }\n public interface Receiver {\n public void onReceiveResult(int resultCode, Bundle resultData);\n }\n @Override\n public void onReceiveResult(int resultCode, Bundle resultData) {\n if (resultReceiver != null) {\n resultReceiver.onReceiveResult(resultCode, resultData);\n }\n }\n}\n\n\nSo why does this cast occur here and how can I work around it?\n\nThanks in advance" ]
[ "android", "service", "location", "classcastexception", "parcelable" ]
[ "Vector not displaying right elements", "I have the below code where the elements which I have pushed into the vector are not same when I am printing.\n\n#include<stdio.h>\n#include<iostream>\n#include<vector>\n\nusing namespace std;\nint size = 0;\nint main()\n{\n int i,num1,num2,num;\n vector<char *>vec;\n for(i=0;i<7;i++)\n {\n char buffer[30];\n if(i%2==0)\n {\n strcpy(buffer,\"hello\");\n }\n else\n {\n strcpy(buffer,\"bye\");\n }\n printf(\"buffer has %s\\n\",buffer);\n vec.push_back(buffer);\n }\n\n for(i=0;i<vec.size();i++)\n {\n cout<<\"CHECK vec[\"<<i<<\"] has \"<<vec[i]<<endl;\n\n }\n return 0;\n}\n\n\nWhen I executed I got the following result:\n\nbuffer has hello\nbuffer has bye\nbuffer has hello\nbuffer has bye\nbuffer has hello\nbuffer has bye\nbuffer has hello\nCHECK vec[0] has hello\nCHECK vec[1] has hello\nCHECK vec[2] has hello\nCHECK vec[3] has hello\nCHECK vec[4] has hello\nCHECK vec[5] has hello\nCHECK vec[6] has hello\n\n\nI could see the following via gdb:\n\n(gdb) p vec\n$5 = std::vector of length 1, capacity 1 = {**0x7fffffffe790** \"bye\"}\n(gdb) n\n11 for(i=0;i<7;i++)\n(gdb) p vec\n$6 = std::vector of length 2, capacity 2 = {**0x7fffffffe790** \"bye\", **0x7fffffffe790** \"bye\"}\n\n\nThe address of vector elements are not different for 1st and 2nd element and so on for other elements also. can anyone please explain how to get right elements in the vector and why this happened." ]
[ "c++", "vector", "stl" ]
[ "Passing data via segue and sqlite", "I am trying to pass some data from selected row via segue to another viewcontroller but I cannot. I tried almost everything, but I always get:\n\n2016-06-16 18:41:20.069 Wine Dictionary[3282:55647] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver (<Wine_Dictionary.DetailUI: 0x7f8a1ae2fa60>) has no segue with identifier 'SegueToDetailUI''\n\n\nI already tried changing method, changing identifier etc.\n\nHere is the screenshot of the code: http://prntscr.com/bh6e6l\nHere is the screenshot of the storyboard and segue identifier: http://prntscr.com/bh6f6q" ]
[ "ios", "swift", "sqlite" ]
[ "refactor rails if else statement with to a single line with return?", "Im refactoring my older code parts, have lots of returns with multi line like:\n\nif ...\n return false\nelse\n return true\nend\n\n\nHow could one refactor to use a single line and return true or false?" ]
[ "ruby-on-rails", "ruby-on-rails-3", "if-statement", "refactoring" ]
[ "VS2015 preview: NDK_ROOT is not defined", "I am trying to install VS2015 preview to see how to develop a c++ android app.\n\nThe online secondary installer is very slow so I cancelled it and tried to install the tools separately one by one. It seemed to be OK. \n\nThen I created a c++ project for android and tried to compile it, but I got an error:\n\n1>------ Build started: Project: Android1.NativeActivity, Configuration: Debug ARM ------\n1> ANDROID_HOME=C:\\Program Files (x86)\\Android\\android-sdk\n1> ANT_HOME=C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Apps\\apache-ant-1.9.3\\\n1> JAVA_HOME=\"C:\\Program Files (x86)\\Java\\jdk1.8.0_25\"\n1> NDK_ROOT=\n1>TRACKER : error TRK0005: Failed to locate: \"clang.exe\". The system cannot find the file specified.\n\n\nI guess the problem is that NDK_ROOT is empty, but I have installed the NDK and defined NDK_ROOT manually in windows system environment variables.So I guess it needs to defined somewhere else, maybe in the registry?\n\nAnyone with a successful VS2015 c++ android environment could check where NDK_ROOT is defined in your system?\n\nThanks" ]
[ "c++", "android-ndk", "visual-studio-2015" ]
[ "Guidance on webscraping using Google Sheets", "I'm trying to get some data from a web page using import XML but it tells me \"N/A Imported content is empty\"\n\nI've tried with a different query but is not working.\n\n=IMPORTXML(\"https://www.shein.com/Floral-Lace-Halter-Teddy-Bodysuit-p-699186-cat-1862.html\",\"//div[@class='opt-size j-sa-select-size j-opt-size']\")\n\n\nI want to be able to parse the different sizes of the clothing, that would be: XS, S, M, L, etc." ]
[ "web-scraping", "xpath", "google-sheets", "google-sheets-formula" ]
[ "createRecord for one-to-one relationship fails in ember-data RC1 (ember data revision 11)", "createRecord never creates the belongsTo object. \n\nIs there any work around for creating the child model object in a case where there is such relation Post-> hasOne -> Comment and comment is embedded always inside the Post. \n\nThis works with Post -> hasMany -> Comments (as in ember-data-example. Need help, we are stuck with this problem.\n\n App.Test = DS.Model.extend({\n text: DS.attr('string'),\n contact: DS.belongsTo('App.Contact')\n });\n App.Contact = DS.Model.extend({\n id: DS.attr('number'),\n phoneNumbers: DS.hasMany('App.PhoneNumber'),\n test: DS.belongsTo('App.Test')\n });\n App.PhoneNumber = DS.Model.extend({\n number: DS.attr('string'),\n contact: DS.belongsTo('App.Contact')\n });\n\n App.RESTSerializer = DS.RESTSerializer.extend({\n init: function() {\n this._super();\n\n this.map('App.Contact', {\n phoneNumbers: {embedded: 'always'},\n test: {embedded: 'always'}\n });\n }\n});\n\n\n/* in some controller code */\nthis.transitionToRoute('contact', this.get('content'));\n\n\nThe following line of code works:\n\nthis.get('content.phoneNumbers').createRecord();\n\n\nThe following line of code fails:\n\n this.get('content.test').createRecord();\n\n\nHere is the error:\n\nUncaught TypeError: Object <App.Test:ember354:null> has no method 'createRecord'\n\n\nSo hasMany works with createRecord but 1:1 fails. Am I doing something wrong ? What must be the right way/is it not possible to do this ?" ]
[ "ruby-on-rails", "mongodb", "ember.js", "ember-data" ]
[ "Oracle SQL inner join not returning records with blank values", "I am joining two tables together, but the result set does not include blank rows. The query below does not return columns with null values. Why is that?\nSELECT\n table1.FE_KEY\n ,table2.CV_VALUE\n ,table2.CV_UOM AS EST_ISENTROPIC_POWERUoM\n ,CVDATA1.CV_VALUE\n ,CVDATA1.CV_UOM AS VAPOUR_OR_GAS_HANDLEUoM\n ,CVDATA2.CV_VALUE\n ,CVDATA2.CV_UOM AS NORMAL_FLOW_RATEUoM \nFROM\n ((table1 FULL LEFT JOIN table2 ON table1.ID = table2.FE_ID)\n INNER JOIN table2 CVDATA1 ON table1.ID = CVDATA1.FE_ID)\n INNER JOIN table2 CVDATA2 ON table1.ID = CVDATA2.FE_ID \nWHERE ((table1.FE_KEY) Like '6-K-%')\n AND ((table2.CV_CODE)='EST_ISENTROPIC_POWER')\n AND ((CVDATA1.CV_CODE)='VAPOUR_OR_GAS_HANDLE')\n AND ((CVDATA2.CV_CODE)='NORMAL_FLOW_RATE')" ]
[ "sql", "oracle" ]
[ "jquery combobox wont close when clicking on page", "I created a jquery combobox which even when I open it using the button I want it to close when clicking on the page body. I'm using jQuery v1.10.1 and jQuery UI v1.10.3. When I originally wrote it I was using v111 and I had an onclick in the body to close it but when I upgraded the auto-complete never stayed open. I tried to make a jfiddle http://jsfiddle.net/abakoltuv/Lmbdn/ but the button doesn't work at all.\n\nlocal css:\n.textbox, input.combobox {\n border: 1px solid #666666;\n color: black;\n font-family: Verdana, Arial, Helvetica, sans-serif;\n font-size: 10px;\n}\nspan.combobox {\n border-bottom: 1px solid #666666;\n border-right: 1px solid #666666;\n border-top: 1px solid #666666;\n cursor: pointer;\n display: inline-block;\n font-size: 10px;\n height: 8px;\n padding: 2px 2px 4px;\n position: relative;\n top: 1px;\n width: 10px;\n}\n<b>Brand</b><br /> \n<input type=\"text\" onChange=\"setChangedFlag()\" field=\"BRAND_ID\" value=\"\" id=\"BRAND_ID_display\" name=\"BRAND_ID_display\" size=\"22\" class=\"combobox\" style=\"width: 121px;\"><span onClick=\"click_combobox_open('BRAND_ID_display')\" class=\"combobox\">▼</span>\n<br /><input type=\"text\" value=\"\" id=\"BRAND_ID\" name=\"BRAND_ID\" style=\"background-color:#CCCCCC\" class=\"textbox\" size=\"22\">\n<script language=\"javascript\" type=\"text/javascript\">\n<!--\n\n$(document).ready(function() {\n setup_combobox();\n}); \nfunction setup_combobox()\n{\n var largest_size;\n var data = [{\"id\":\"1\",\"value\":\"Able Planet\"},{\"id\":\"86\",\"value\":\"Able Planet 123\"},{\"id\":\"2\",\"value\":\"Acecad\"},{\"id\":\"3\",\"value\":\"Action Life Media\"},{\"id\":\"4\",\"value\":\"Adobe\"},{\"id\":\"5\",\"value\":\"Bose\"},{\"id\":\"6\",\"value\":\"Canon\"},{\"id\":\"7\",\"value\":\"Delkin\"}];\n $(\"input.combobox\").autocomplete({\n html: 'html',\n minLength: 0,\n source: data ,\n select: function(event, ui) {\n if (ui.item) {\n var width1 = $('#'+this.id).width();\n $('#'+this.id).width((ui.item.value.length * 2/3) + 'em');\n var width2 = $('#'+this.id).width();\n if(width1 > width2)\n $('#'+this.id).width(width1);\n $('#'+this.id.substring(0, this.id.length - 8)).val(ui.item.id); \n };\n }\n });\n}\n\nfunction click_combobox_open(display_ID) \n{\n var width1 = $('#'+display_ID).width();\n $('#'+display_ID).width(($('#'+display_ID).val().length * 2/3) + 'em');\n var width2 = $('#'+display_ID).width();\n if(width1 > width2)\n $('#'+display_ID).width(width1);\n else \n $('#'+display_ID).width(width2); \n if(!$('#'+display_ID).autocomplete('widget').is(':visible'))\n {\n $('#'+display_ID).autocomplete('search','');\n }\n else \n {\n $('#'+display_ID).autocomplete('close');\n }\n}\n//-->\n</script>\n\n\nThanks\nAba" ]
[ "jquery-ui", "combobox" ]
[ "Python using 'with' to delete a file after use", "I am using an explicitly named file as a temporary file. In order to make sure I delete the file correctly I've had to create a wrapper class for open(). \n\nThis seems to work but \n\nA] is it safe? \n\nB] is there a better way? \n\nimport os\n\nstring1 = \"\"\"1. text line\n2. text line\n3. text line\n4. text line\n5. text line\n\"\"\"\nclass tempOpen():\n def __init__(self, _stringArg1, _stringArg2):\n self.arg1=_stringArg1\n self.arg2=_stringArg2\n\n def __enter__(self):\n self.f= open(self.arg1, self.arg2)\n return self.f\n\n def __exit__(self, exc_type=None, exc_val=None, exc_tb=None):\n self.f.close()\n os.remove(self.arg1)\n\nif __name__ == '__main__':\n\n with tempOpen('tempfile.txt', 'w+') as fileHandel:\n fileHandel.write(string1)\n fileHandel.seek(0)\n c = fileHandel.readlines()\n print c\n\n\nFYI: I cant use tempfile.NamedTemporaryFile for a lot of reasons" ]
[ "python" ]
[ "chartist js on action selectors: finding coordinates for the ct-point element", "essentially taking inspiration from this topic here (How to show label when mouse over bar) I wanted, as I mouseover onto a LINE chart [the example is with a Bar Chart] (even if I am not directly over the series), I wanted to:\n\n1) get the value of the point of the series (s) I am over \n\n2) get the css selectors of reference\n\nso that I can \n\n1) display the value\n\n2) apply temporary CSS over the element (like enlarging the \"point\" element)\n\nI tried to inspect the ct-chart object but the task proved to be daunting.\n\nin practice:\n\nvar addedEvents = false;\nchart.on('draw', function() {\n if (!addedEvents) {\n $('.ct-bar').on('mouseover', function() {\n $('#tooltip').html('<b>Selected Value: </b>' + $(this).attr('ct:value'));\n });\n\n $('.ct-bar').on('mouseout', function() {\n $('#tooltip').html('<b>Selected Value:</b>');\n });\n }\n});\n\n\nwhat is the equivalent for $(this).attr('ct:value') in the Line chart case?\n\nin pictures (forget the line, I will deal with it later):\n\nFROM:\n\n\n\nTO:" ]
[ "jquery", "css-selectors", "jquery-selectors", "chartist.js" ]
[ "run internet explorer hidden even popups", "I want to run Internet Explorer 8+ hidden. I know how to do it using vbs, my problem is that the popups does not run hidden. I dont want to stop the popups, i just want that the popups does not show visible, that runs hidden too.\n\nI want to find a way to run even popups hidden or find a registry way (window_position?) to keep even popups hidden. But i repeat, i dont want to block them since i read information from that popups.\n\nof course i need a way to revert this changes when needed in the case of registry." ]
[ "internet-explorer", "vbscript" ]
[ "Wso2 APIM multi tenancy and keycloak integration", "I am trying use keycloak as my IDP in wso2 and it works fine when using default admin user (by default blong to carbon domain) but when trying to get authentication token from a user belonging to different domain created using multitenancy domain created I am getting 403 forbidden.\nWso2 console error\nCaused by: feign.FeignException$Forbidden: [403 Forbidden] during [POST] to [http://localhost:8080/auth/realms/master/clients-registrations/openid-connect] [DCRClient#createApplication(ClientInfo)]: [{"error":"insufficient_scope","error_description":"Forbidden"}]\n at feign.FeignException.clientErrorStatus(FeignException.java:199) ~[io.github.openfeign.feign-core_11.0.0.jar:?]\n at feign.FeignException.errorStatus(FeignException.java:177) ~[io.github.openfeign.feign-core_11.0.0.jar:?]\n at feign.FeignException.errorStatus(FeignException.java:169) ~[io.github.openfeign.feign-core_11.0.0.jar:?]\n at feign.codec.ErrorDecoder$Default.decode(ErrorDecoder.java:92) ~[io.github.openfeign.feign-core_11.0.0.jar:?]\n at feign.AsyncResponseHandler.handleResponse(AsyncResponseHandler.java:96) ~[io.github.openfeign.feign-core_11.0.0.jar:?]\n at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:138) ~[io.github.openfeign.feign-core_11.0.0.jar:?]\n at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:89) ~[io.github.openfeign.feign-core_11.0.0.jar:?]\n at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:100) ~[io.github.openfeign.feign-core_11.0.0.jar:?]\n at com.sun.proxy.$Proxy496.createApplication(Unknown Source) ~[?:?]\n at org.wso2.keycloak.client.KeycloakClient.createApplication(KeycloakClient.java:134) ~[keycloak.key.manager_2.0.2.jar:?]\n at org.wso2.carbon.apimgt.impl.workflow.AbstractApplicationRegistrationWorkflowExecutor.dogenerateKeysForApplication_aroundBody8(AbstractApplicationRegistrationWorkflowExecutor.java:150) ~[org.wso2.carbon.apimgt.impl_6.7.206.jar:?]\n at org.wso2.carbon.apimgt.impl.workflow.AbstractApplicationRegistrationWorkflowExecutor.dogenerateKeysForApplication(AbstractApplicationRegistrationWorkflowExecutor.java:124) ~[org.wso2.carbon.apimgt.impl_6.7.206.jar:?]\n at org.wso2.carbon.apimgt.impl.workflow.AbstractApplicationRegistrationWorkflowExecutor.generateKeysForApplication_aroundBody6(AbstractApplicationRegistrationWorkflowExecutor.java:120) ~[org.wso2.carbon.apimgt.impl_6.7.206.jar:?]\n at org.wso2.carbon.apimgt.impl.workflow.AbstractApplicationRegistrationWorkflowExecutor.generateKeysForApplication(AbstractApplicationRegistrationWorkflowExecutor.java:117) ~[org.wso2.carbon.apimgt.impl_6.7.206.jar:?]\n at org.wso2.carbon.apimgt.impl.workflow.ApplicationRegistrationSimpleWorkflowExecutor.complete_aroundBody2(ApplicationRegistrationSimpleWorkflowExecutor.java:78) ~[org.wso2.carbon.apimgt.impl_6.7.206.jar:?]\n ... 59 more\n[2021-01-20 11:21:43,158] ERROR - GlobalThrowableMapper org.wso2.carbon.apimgt.api.APIManagementException: org.wso2.carbon.apimgt.impl.workflow.WorkflowException: Error occurred while executing SubscriberKeyMgtClient.\n\nKeycloak console message\n11:20:35,757 WARN [org.keycloak.events] (default task-16) type=CLIENT_REGISTER_ERROR, realmId=master, clientId=null, userId=null, ipAddress=127.0.0.1, error=not_allowed" ]
[ "wso2", "keycloak", "multi-tenant" ]
[ "Why cast the result of pre-incrementation to void in comma separator context?", "Looking at std::for_each_n's possible implementation:\n\ntemplate<class InputIt, class Size, class UnaryFunction>\nInputIt for_each_n(InputIt first, Size n, UnaryFunction f)\n{\n for (Size i = 0; i < n; ++first, (void) ++i) {\n f(*first);\n }\n return first;\n}\n\n\nI noticed that the part where we typically see i++ (or, the preferred ++i) consists of two operations:\n\n\n++first\n(void) ++i\n\n\nseparated by a comma. While most of it makes sense, the (void) cast seems a little surprising to me. All I can guess is that there could be an overloaded operator , that takes the deduced type of InputIt and Size which would result in some surprising side-effects. Could that be the reason? If yes, are we sure that cast to void solves that issue entirely?" ]
[ "c++", "casting", "comma-operator" ]
[ "Google maps custom colors for UI", "I would like to know if I can change the Google maps UI colour from blue to red.\n\nI don't want to change the map colour but just the start/destination (Search box on the top) colour from blue to red. I will be using the Google Maps API\n\n\n\nI have tried to find tutorial online but was unable to find any.\n\nPS: I have never used Google API before" ]
[ "android", "google-maps" ]
[ "How to save an image in a directory named on the User?", "I am using Django2.2 and I am currently learning Django. I have created a model where I have to post an image of a certain thing and that model is connected with a User. I want to save the image on a directory named on that certain user\n\nI have a custom User Model where I created a field called Profile Photo and that profile photo is saved to a directory named on that User.But then I created another application called 'Product' and there I created many fields including an image field.I am trying to save that image on that directory named on that specific User. \n\ndef user_directory_path(instance, filename):\n return 'media/%s/%s' % (instance.username, filename)\n\n class Products(models.Model): \n title = models.CharField(max_length=100)\n body = models.CharField(max_length=1000)\n image = models.ImageField(upload_to = user_directory_path)\n product_user = models.ForeignKey(User, on_delete=models.CASCADE)\n\n def __str__(self):\n return self.title\n\n\n\nWhen I try to save a Product and error occurs.\n\n'Products' object has no attribute 'username'\n\n\nIs there any successful ways to do it." ]
[ "python", "django", "django-models", "django-admin", "django-2.2" ]
[ "How do i check if login informations corresponds to a record in a file? (Socket)", "So i'm doing a project for school and i was having some trouble with this problem.\n\nAfter doing the login, the program sends through a socket username and password as one string to the server, and when the string arrives i split it in two with the function split\n\nString [] split = msgc.split(\",\");\n\n String username = split[0];\n String password = split[1];\n\n\nSo the file where login information are stored is actually like this, similar to a CSV\n\n26,johndoe,password,john,doe,123456\n...\n\n\nwhere \"johndoe\" and \"password\" are username and password of course.. then i'm stuck here. How do i see if username and password sent from the socket are equal to the login information in the file?" ]
[ "java", "file", "sockets" ]
[ "Get return value from jquery dialog box; asynchronously like alert box", "function confirmation(question) {\n var defer = $.Deferred();\n $('<div></div>').html(question).dialog({\n autoOpen: true,\n modal: true,\n title: 'Confirmation',\n buttons: {\n \"Yes\": function() {\n defer.resolve(\"true\"); //this text 'true' can be anything. But for this usage, it should be true or false.\n $(this).dialog(\"close\");\n },\n \"No\": function() {\n defer.resolve(\"false\"); //this text 'false' can be anything. But for this usage, it should be true or false.\n $(this).dialog(\"close\");\n }\n },\n close: function() {\n $(this).remove();\n }\n });\n return defer.promise();\n}\n\nfunction ValidateForm() {\n alert(\"step2\");\n var question = \"Do you want to start a war?\";\n confirmation(question).then(function(answer) {\n var ansbool = Boolean.parse(answer.toString());\n if(ansbool) {\n alert(\"this is obviously \" + ansbool); //TRUE\n return true;\n }else{\n alert(\"and then there is \" + ansbool); //FALSE\n return false;\n }\n });\n alert(\"step3\"); // it gets call before dialog is open and return results on user selection Yes/No , i want to wait and return result true or false from this function\n}\n\nfunction calltovalidateform()\n{\n alert(\"step1\");\n var returnValue = ValidateForm(); // must return true or false value\n alert(\"step4\" + returnValue); // returnValue is undefined.\n return returnValue;\n}\n\n\nabove javascript code writes results in sequence of step1,step2,step3 & step4 alert message. i want the result of ValidateForm() which opens a dialog box with use of jquery model dialog box and returns value true or false asynchronously. without having to skip its confirmation result at run time. \nmy requirement is to wait javascript until user provides a confimation yes or no in model dialog box." ]
[ "javascript", "jquery", "jquery-plugins" ]
[ "SearchOptions using Sequence number of the Word - MS Office Word Addin OfficeJS", "Right now I am locating the words in a Word document by searching the term using\n\ncontext.document.body.search(dict, { ignorePunct: true, matchCase: true, matchWholeWord: true });`\n\n\nBut I want to locate a word by its ordinal position in the Word document. I can't find the exact nth word.\n\nIs it possible to do that?" ]
[ "ms-word", "office-js", "javascript-api-for-office" ]
[ "git svn - clone repo with all externals", "I want to use git to clone a svn repository, but unfortunately, where svn checkout gets the repo with all externals, git svn clone only gets the repository without externals. How can I get the externals from the svn repository via git svn? I don't want to do any fancy stuff, just get the the complet repo with externals." ]
[ "git", "svn", "git-svn", "svn-externals" ]
[ "Snapshot with router not work", "This is different from this one enzyme-to-snapshot-render-object-as-json because\n\nHere I want to generate snapshot with JSON definition of objects\nThe other I want generate snapshot only for HTML generated by component.\n\n\n\nSnapshot tests always fail because the key property in history change every time.\n\n// ComponentContainer.jsx\nclass ComponentContainer extends Component {\n render() { ... }\n}\nexport { ComponentContainer }; \nexport default withRouter(ComponentContainer);\n\n\nAnd the tests ..\n\n// ComponentContainer.test.jsx\nimport { ComponentContainer } from './ComponentContainer';\n\nconst minProps = {\n history: {\n push: jest.fn(),\n },\n};\n\nconst wrapped = mount(\n <Router history={minProps.history}>\n <ComponentContainer.wrappedComponent {...mergedProps} {...mergedStores} />\n </Router>,\n);\n\nexpect(toJson(wrapper)).toMatchSnapshot();\n\n\nGenerate this snapshot ..\n\n// ComponentContainer.test.jsx.snap\n<MemoryRouter\n history={\n Object {\n \"push\": [Function],\n }\n }\n >\n <Router\n history={\n Object {\n \"action\": \"POP\",\n \"block\": [Function],\n \"canGo\": [Function],\n \"createHref\": [Function],\n \"entries\": Array [\n Object {\n \"hash\": \"\",\n \"key\": \"mmldr1\", // THIS IS GENERATED ON EACH TEST\n \"pathname\": \"/\",\n \"search\": \"\",\n \"state\": undefined,\n },\n ],\n\n\nAttempts\n\nI try to use memory history ...\n\n// ComponentContainer.test.jsx\nimport createHistory from 'history/createMemoryHistory';\n\nconst history = createHistory({\n initialEntries: [`/myapp/123`],\n});\n\n<Router history={history}>\n <ComponentContainer.wrappedComponent />\n</Router>\n\n\nBut I end up the same problem." ]
[ "jestjs", "snapshot", "history.js", "react-router-v4" ]
[ "Java, pixels in a given letter of a particular Font", "How can I determine how many pixels are in a specific letter of a specific Font in Java?" ]
[ "java", "fonts", "pixels" ]
[ "Is there a way to build ZFS for the linux-virt kernel on Alpine?", "I want to run ZFS inside of a virtual machine using Alpine Linux. The linux-virt kernel is much smaller and does not have the 200+MB of firmware files listed as dependencies, so that is the kernel I selected for the VM. However, I now find that there is no zfs-virt package, only zfs-vanilla which installs the vanilla kernel and all the firmware as dependencies.\n\nIs there a zfs-virt package available in perhaps a third party repository? If not, I am not against building the package myself, but I'm relatively new to Alpine so have not yet figured out how its build system works nor if it is possible to build against an already-compiled kernel (in my own past experience, the only way I've successfully built kernel modules is using the source tree of the target kernel)" ]
[ "alpine", "zfs" ]
[ "Running NodeJS worker in Docker image", "I have an application that looks like this one:\nhttps://github.com/heroku-examples/node-workers-example\n\nIn short, I have 2 processes:\n\n\nServer: it server US, handles requests and adds them to Redis\nWorker: it pulls requests from Redis and works on them\n\n\nShould I use only one Docker image for both processes or should I have 2 docker images (one for the server and the second for the worker)? What is the best practice?\n\nI personally think, it's better to have 2 images. In this case, can my project structure be like this one:\n\nProject Folder\n-node_modules\n-utils\n-server.js\n-package.json\n-Dockerfile\n-docker-compose.yml\n-/worker\n-/worker/index.js\n-/worker/Dockerfile\n\n\nIs there any advice?\n\nThanks a lot." ]
[ "node.js", "docker", "heroku", "docker-compose" ]
[ "How to remove extra legend after adding statistics to stacked barplot?", "I want to create stacked bar plot with absolute values for variables in the axis but add the percentages on each bar. This is what my data looks like:\n\nBAM Mapping Reads fraction\nbam1 Mapped 22493091 0.88940452\nbam1 Unmapped 2796966 0.11059548\nbam2 Mapped 27018375 0.88256156\nbam3 Unmapped 3595212 0.11743844\nbam3 Mapped 27238774 0.89441821\nbam4 Unmapped 3215407 0.10558179\nbam4 Mapped 19791746 0.82984107\nbam4 Unmapped 4058298 0.17015893\nbam5 Mapped 23298155 0.83144569\nbam5 Unmapped 4723104 0.16855431\nbam6 Mapped 22563538 0.83990722\nbam6 Unmapped 4300784 0.16009278\nbam7 Mapped 23940480 0.88134856\nbam7 Unmapped 3222984 0.11865144\n\n\nI am nearly there (nevermind the x-labels - I'm using long names here):\n\ngp <- ggplot(data=to_graph, aes(x=BAM, y=Reads, fill=Mapping, label=paste(round(fraction*100),\"%\", sep=\"\"), size = 3,vjust=0, position = \"stack\")) +\n geom_bar(stat=\"identity\") + \n geom_text(position=\"stack\")\n\n\n\n\nBut there a little niggling square on top of the legend that I want to get rid of. How to do that importantly why does it appear in the 1st place?\n\nCheers." ]
[ "r", "ggplot2" ]
[ "How to check if a Dynamically created label is clicked (MouseClick Event ) and Change its Colors?", "To be honest i dont realy think there should be a big mess/problem with my code , but somehow the colors are not being changed when i click on a label !\nWhat i was trying to achieve there was , if the user mouseClick male then it changes color to green and the other label aka (Female) changes back to red , and the opposit ! \n\n for (int i = 0; i < 2; i++)\n {\n Label RB = new Label();\n RB.Location = new Point(x,y);\n RB.Width = 95;\n RB.Text = LabelsText[4].Split('-')[i];\n RB.BackColor = Color.PaleVioletRed;\n RB.TextAlign = ContentAlignment.MiddleCenter;\n RB.Font = new Font(family.Families[0], 11.0f, FontStyle.Bold);\n RB.ForeColor = Color.AntiqueWhite;\n RB.Name = txtBoxNames[4].Split('-')[i];\n RB.MouseClick += (s, ev) =>\n {\n if (((Label)(s)).Name == \"isMale\")\n {\n ((Label)(s)).BackColor = Color.GreenYellow;\n ((Label)(s)).ForeColor = Color.Black;\n\n foreach (Control ct in this.Controls)\n {\n if (ct is Label)\n {\n if (((Label)(ct)).Name == \"isFemale\")\n {\n ((Label)(s)).BackColor = Color.PaleVioletRed;\n ((Label)(s)).ForeColor = Color.AntiqueWhite;\n }\n }\n }\n this.Refresh();\n this.Update();\n }\n else if(((Label)(s)).Name == \"isFemale\")\n {\n ((Label)(s)).BackColor = Color.GreenYellow;\n ((Label)(s)).ForeColor = Color.Black;\n\n foreach (Control ct in this.Controls)\n {\n if (ct is Label)\n {\n if (((Label)(ct)).Name == \"isMale\")\n {\n ((Label)(s)).BackColor = Color.PaleVioletRed;\n ((Label)(s)).ForeColor = Color.AntiqueWhite;\n }\n }\n }\n }\n };\n this.Controls.Add(RB);\n x += RB.Width + 10 ;\n }" ]
[ "c#", "winforms" ]
[ "2 ways of running application. Is this the same?", "This is a very simple question. I want to know if this:\n\nnew Form1().Show();\nApplication.Run();\n\n\nIs the same that this:\n\nApplication.Run(new Form1());\n\n\nIt seems to work the same, but maybe something change and I'm not taking notice.\nThe reason why I'm asking this is because I'm trying to implement MVP pattern in WinForms application, and if it's the same, I have some methods that I don't need anymore.\n\nSorry for bad english.\nThanks." ]
[ "c#", "winforms" ]
[ "CAKEPHP foreign key restraint - Debug shows correct values", "I am creating my first real CakePHP project. I have read the manual and gone through the blog tutorial, but am by no means an expert. I'm having a problem adding data to my database through a form generated with the form helper. The form has two text inputs and a few select boxes, all of which are populating correctly. When I fill out the form and hit submit, it tells me I have a foreign key constraint error on the first select box. However, when I debug $this->request->data, it has the correct values associated with it. Here is the debug.\n\nArray\n(\n [car] => Array\n (\n [stock] => G123456\n [vin] => 12345678\n [make_id] => 1\n [car_model_id] => 2\n [year_id] => 20\n [location_id] => 9\n [service_status_id] => 1\n [type_id] => 6\n )\n\n)\n\n\nTo make sure my schema was correct I did the insert directly from mysql console and it worked perfectly. Here is the command I ran.\n\nINSERT INTO cars (stock, vin, make_id, car_model_id, year_id, location_id, service_status_id, type_id) VALUES ('G123456', '12345678', '1', '2', '20', '9', '1', '6');\n\n\nI'm not sure why it's giving me the foreign key constraint error when I call:\n\n$car = $this->Car->save($this->request->data);\n\n\nAny ideas?\n\nEDIT The query under the error in CakePHP is: \n\nINSERT INTO `cars` (`modified`, `created`) VALUES ('2012-02-29 15:53:21', '2012-02-29 15:53:21')\n\n\nWhen I run that query from a mysql console I get the same error. Foreign key constraint fails, make_id - reference make.id\n\nHere is the add() function in my controller:\n\npublic function add()\n{ \n $this->set('years', $this->Car->Year->find('list'));\n $this->set('makes', $this->Car->Make->find('list'));\n $this->set('carModels', $this->Car->CarModel->find('list'));\n $this->set('locations', $this->Car->Location->find('list'));\n $this->set('types', $this->Car->Type->find('list'));\n $this->set('serviceStatuses', $this->Car->ServiceStatus->find('list'));\n if(!empty($this->request->data))\n {\n $car = $this->Car->save($this->request->data); \n //debug($this->request->data, true);\n }\n}\n\n\nAnd here is the view file:\n\n<?php\necho $this->Form->create('Car', array('action' => 'add'));\necho $this->Form->input('car.stock');\necho $this->Form->input('car.vin');\necho $this->Form->input('car.make_id');\necho $this->Form->input('car.car_model_id');\necho $this->Form->input('car.year_id');\necho $this->Form->input('car.location_id');\necho $this->Form->input('car.service_status_id');\necho $this->Form->input('car.type_id');\necho $this->Form->end('Add');\n?>" ]
[ "mysql", "cakephp", "foreign-keys" ]
[ "sqlldr on oracle 10g", "I have an assignment in a class which requires the transfering of data from tables in one schema to another using the sqlldr tool. I have set up my control files, and text files(.csv files if you prefer) in order to transfer the data using sqlldr. Now I am using ORACLE 10g Enterprise Edition Release 10.2.0.1.0. I am all ready to go but when I type in the sqlldr command, or event just \"sqlldr\" I get the unknown command message. Am i just completely off or does this mean this utility isnt available on this version? I have the ingredients needed to make it happen but I cant figure out why I cant get sqlldr to run. Perhaps someone can point me in the right direction. Below is the specific syntax we were given in class.\n\nsqlldr username/password control=loadsals.ctl" ]
[ "oracle", "oracle10g", "sql-loader" ]
[ "Can't select a row from a pandas dataframe, read from a csv", "I have a csv with some data that I'm reading into pandas:\n\nfilename = sys.argv[1]\n\ndata = pd.read_csv(filename, sep=';', header=None)\n\nxy = data\n\nprint str(xy)\n\n\nResult:\n\n 0 1\n0 label data\n1 x 6,8,10,14,18\n2 y 7,9,13,17.5,18\n3 z 0,0,1,1,1\n4 r 2,13,31,33,34,4324,32413,431,666\n\n\nHowever, when I try to select a frame:\n\nxy = data['2']\nxy = data['y']\nxy = data['label']\n\n\nIt just gives me the same error:\n\nTraceback (most recent call last):\n File \"Regress[AA]--[01].py\", line 10, in <module>\n xy = data['label']\n File \"/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py\", line 1997, in __getitem__\n return self._getitem_column(key)\n File \"/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py\", line 2004, in _getitem_column\n return self._get_item_cache(key)\n File \"/usr/local/lib/python2.7/dist-packages/pandas/core/generic.py\", line 1350, in _get_item_cache\n values = self._data.get(item)\n File \"/usr/local/lib/python2.7/dist-packages/pandas/core/internals.py\", line 3290, in get\n loc = self.items.get_loc(item)\n File \"/usr/local/lib/python2.7/dist-packages/pandas/indexes/base.py\", line 1947, in get_loc\n return self._engine.get_loc(self._maybe_cast_indexer(key))\n File \"pandas/index.pyx\", line 137, in pandas.index.IndexEngine.get_loc (pandas/index.c:4154)\n File \"pandas/index.pyx\", line 161, in pandas.index.IndexEngine.get_loc (pandas/index.c:4084)\nKeyError: 'label'\n\n\nHow should I be formatting my selection request?\n\nEDIT: Thanks to @Merlin's help, I got it working:\n\nfilename = sys.argv[1]\ndf = pd.read_csv(filename, sep=';')\n\nfor i in range(len(df.label)):\n a = str(df['label'][i])\n b = str(df['data'][i])\n print (\"Row: {} - Data: {}\".format(a,b))\n\n\nGives me:\n\nRow: x - Data: 6,8,10,14,18\nRow: y - Data: 7,9,13,17.5,18\nRow: z - Data: 0,0,1,1,1\nRow: r - Data: 2,13,31,33,34,4324,32413,431,666" ]
[ "python", "csv", "pandas", "dataframe", "row" ]
[ "security related sites", "What are some of the best Sites for Computer Security basics.\n\nSSL, HTTPS, PKI, Authetication/Authorization, TLS, SAML, Vulnerabilities etc etc" ]
[ "security" ]
[ "How do I declare an opaque anonymous structure defined in third-party?", "I am working on a third-party module wrapper. I hope my main header file does not have any third-party related header files. Every parameter type and return type are opaque by only declaring it. But there is a anonymous structure defined like the following:\n\ntypedef struct {\n int x;\n int y;\n int width;\n int height;\n} IppiPoint;\n\n\nI cannot modify the third-party header file. I have no idea to declare it. Here are what I tried and error messages I got\n\n1.\n\nstruct IppiPoint;\nerror C2371: 'IppiPoint' : redefinition; different basic types\n\n\n2.\n\ntypedef struct IppiPoint;\n... warning C4091: 'typedef ' : ignored on left of 'IppiPoint' when no variable is declared\n... error C2371: 'IppiPoint' : redefinition; different basic types\n\n\nHow do I declare such anonymous struct?" ]
[ "c++", "opaque-pointers" ]
[ "Is there a way to change the default StartPosition on a Windows Form?", "The default value for StartPosition on Windows Forms is WindowsDefaultLocation, which I understand is determined by the operating system. I always have to change the value to CenterScreen or CenterParent (for modal windows) - the default location is annoying and seems to change every time. Is there a reason why WindowsDefaultLocation is even there or is there a way to change a setting somewhere so that the default is centered?\n\nI don't know about everyone else, but whenever I start an application I would always prefer it to be centered, that way it's easier to work with." ]
[ "c#", "winforms" ]
[ "Angular 8/ Reactive Form - Converting result of checkbox event to a string value", "I have my Reactive form with field - Status (which can have values 'A' or 'I'):\n\nthis.form = this.formBuilder.group({\n result_info: this.formBuilder.array([\n this.getResultcontrols()]),\n status: 'A',\n change_seq: '',\n action: 'C',\n }); \n\n\nI want to map field status to an input of type \"checkbox\" - (Toggle values are 'A' or 'I').\nWhen I print this.form.value , i expect to see the value of status reflected as 'A' or 'I' , NOT true or false. Can somebody help me with reactive form equivalent of HTML...(not HTML sample based on template driven format)" ]
[ "angular" ]
[ "Missing Files in ARToolKit", "I am working with ARToolKit 5.3.3 trying to build from source. I am getting the following errors when building the simpleOSG example application:\n\nerror C1083: Cannot open include file: 'DSVL.h': No such file or \ndirectory\nerror C1083: Cannot open include file: 'GL/glext.h': No such file or \ndirectory\nerror C1083: Cannot open include file: 'GL/glut.h': No such file or \ndirectory\nerror C1083: Cannot open include file: 'jpeglib.h': No such file or \ndirectory\nerror C1083: Cannot open include file: 'osg/Config': No such file or \ndirectory\nerror C1083: Cannot open include file: 'pthread.h': No such file or \ndirectory\nerror C1083: Cannot open include file: 'qedit.h': No such file or \ndirectory\n\n\nThe clone from Github is placed on C:/. I have no idea why these files are missing, when building from source on my Mac I have no issues with this. Any help would be greatly appreciated.\n\nARToolKit 5.3.3, Windows 10, Visual Studio 2013" ]
[ "visual-studio-2013", "artoolkit" ]
[ "Multiple database connection in single connection pool using Node JS", "I am trying to create a database connection pool in Node js using generic-pool package. With single database the pool is working fine but I want to use more than one database in single pool to be use. In this context I am facing issue. Generic pool is not creating pool for both the database in single pool. Below is my code. I am using trireme-jdbc for JDBC connection ang generic-pool for connection pooling.\n\nvar Pool = require('C:JCI/trireme-jdbc/node_modules/generic-pool').Pool;\nvar jdbc = require('C:/Program Files/nodejs/node_modules/trireme-jdbc');\nvar configOpenedge = require('C:/Program Files/nodejs/node_modules/trireme-jdbc/testconf/config-openedge.js');\nvar configPostgre = require('C:/Program Files/nodejs/node_modules/trireme-jdbc/testconf/config-postgre.js');\n\n var pool = new Pool({\n name : 'Anil-JCI',\n create : function(callback) {\n var connOpenedge = new jdbc.Database({\n url : configOpenedge.url,\n properties : configOpenedge.properties,\n\n });\n\n var connPostgre = new jdbc.Database({\n url : configPostgre.url,\n properties : configPostgre.properties,\n\n /*\n * minConnections : 1, maxConnections : 2000, idleTimeout : 60\n */\n });\n\n callback(null, connOpenedge);\n\n },\n\n\n destroy : function(client) {\n client.end();\n },\n max : 10,\n // optional. if you set this, make sure to drain() (see step 3)\n min : 2,\n // specifies how long a resource can stay idle in pool before being removed\n idleTimeoutMillis : 30,\n // if true, logs via console.log - can also be a function\n log : true\n\n });\n\n console.log(\"connection created\");\n\n pool.acquire(function(err, clientOpenedge, clientPostgre) {\n if (err) {\n throw err;\n }\n\n else {\n clientOpenedge.execute(\n 'select * from \"po\" where \"po-num\" = ? and \"vend-num\" = ? ', [\n 4322452, 4301170 ], function(err, result, rows) {\n\n // pool.release(client);\n\n console.log(err);\n rows.forEach(function(row) {\n console.log(row);\n });\n console.log(\"Openedge Data Printed...\");\n });\n clientPostgre.execute(\"select * from employees \",\n [ ], function(err, result) {\n\n // pool.release(client);\n\n console.log(\"we are in postgre\");\n console.log(result);\n console.log(\"Postgre Data Printed...\");\n });\n }\n });" ]
[ "node.js", "apigee" ]
[ "Assigning ID's to table column and adding a click function", "I'm trying to find out if all my days in the calendar have an ID since I was planning to access documents on that day in my database. My problem is that there is only one ID being assigned to the table column and clicking on it after a number of tries increases the number of alert messages I am getting...just what am I missing/doing wrong?\n\nPhp calendar portion for days\n\n $list_day = 1;\nwhile($list_day <= $days_in_month){\n $calendar.= '<td class=\"calendar-day\">';\n /* add in the day number */\n $calendar.= '<div class=\"day-number\" id = \"day'.$list_day.'\" onclick = displayDocuments()>'.$list_day.'</div>';\n\n /** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !! IF MATCHES FOUND, PRINT THEM !! **/\n $calendar.= str_repeat('<p> </p>',2);\n\n $calendar.= '</td>';\n if($running_day == 6){\n $calendar.= '</tr>';\n if(($day_counter+1) != $days_in_month){\n $calendar.= '<tr class=\"calendar-row\">';\n }\n $running_day = -1;\n $days_in_this_week = 0;\n }\n $days_in_this_week++;\n $running_day++;\n $day_counter++;\n $list_day++;\n}\n\n\nJavascript for checking whether I have other ID's being assigned\n\nfunction displayDocuments(){\n $('#day1').click(function(){\n alert('day 1!');\n });\n $('#day2').click(function(){\n alert('day 2!');\n });\n}" ]
[ "javascript", "php", "jquery" ]
[ "How can I package and deploy a Cordova project to Win 10 machines?", "Cordova newbie.\nI have the app on a Win 10 dev machine and I can build and run the app for browser;\ncordova build browser\ncordova run browser\nHow can I now port the browser build to a different Win 10 for demo to client?\nI am using VS2017 and VS Tools for Cordova.\nThanks\nRegards" ]
[ "cordova", "deployment", "visual-studio-cordova", "visual-studio-2017-build-tools" ]
[ "Recursive function that identifies whether string 1 is contained within string 2? (Python 3.4)", "Is there a way to write a recursive (required) function that takes two strings as parameters and returns True if all characters in the first string can be found, in order, in the second string; and False otherwise?\n\nFor example:\n\n>>> contains(\"lit\", \"litter\")\nTrue\n>>> contains(\"thot\", \"thurtle\")\nFalse\n>>> contains(\"ratchet\", \"ramtbunchiousest\")\nTrue\n>>> contains(\"shade\", \"hadsazie\")\nFalse\n\n\nThe letters don't need to be consecutive (as in the third example), but they need to be in order (which is why the fourth example fails).\n\nI wrote this code:\n\ndef contains_recursive(s1, s2):\n\nif s1 == \"\":\n return True\nelif s1[0] == s2[0]:\n return contains_recursive(s1[1:], s2[1:])\nelif s1[0] != s2[0]:\n return contains_recursive(s1[0], s2[1:])\nelse:\n return False\n\nreturn contains_recursive(s1, s2) == True\n\n\nand it gave out this error:\n\nIndexError: string index out of range\n\n\nWhat should I do to fix the problem?" ]
[ "python", "string", "recursion" ]
[ "Getting a parsing error in with React.js", "I'm working on the React example from their website. What I have so far is: \n\n<!DOCTYPE html>\n <head>\n <meta charset=\"utf-8\">\n <title>Hello React</title>\n <script src=\"http://fb.me/react-0.12.0.js\"></script>\n <script src=\"http://fb.me/JSXTransformer-0.12.0.js\"></script>\n <script src=\"http://code.jquery.com/jquery-1.10.0.min.js\"></script>\n <script src=\"http://cdnjs.cloudflare.com/ajax/libs/showdown/0.3.1/showdown.min.js\"></script>\n</head>\n<body>\n <div id=\"content\"></div>\n <script type=\"text/jsx\">\n var data = [\n {author: \"Pete Hunt\", text: \"This is one comment\"},\n {author: \"Jordan Walke\", text: \"This is *another* comment\"}\n ];\n\n var converter = new Showdown.converter();\n\n var CommentBox = React.createClass({\n render:function(){\n return (\n <div className=\"commentBox\">\n <h1>Comments</h1>\n <CommentList data={this.props.data}/>\n <CommentForm />\n </div>\n );\n }\n });\n\n var CommentList = React.createClass({\n render:function(){\n var commentNodes = this.props.data.map(function(comment){\n return (\n <Comment author={comment.author}>\n {comment.text}\n <Comment />\n );\n });\n return (\n <div className=\"commentList\">\n {commentNodes}\n </div>\n );\n }\n });\n\n var Comment = React.createClass({\n render:function(){\n converter.makeHtml(this.props.children.toString())\n return(\n <div className=\"comment\">\n <h2 className=\"commentAuthor\">\n {this.props.author}\n </h2>\n <span dangerouslySetInnerHTML={{__html: rawMarkup}} />\n );\n }\n });\n\n React.render(\n <CommentBox data={data} />,\n document.getElementById(\"content\")\n );\n</script>\n</body>\n</html>\n\n\nI'm currently just opening the HTML file in my web browser, but my console is giving me the following error:\n\nError: Parse Error: Line 41: \n\nUnexpected token : at file:///C:/Users/jkm144/Desktop/React_Example/template.html \n\nrender:function(){ \n\nFor some reason, it doesn't like the \":\", pointing to the first time on the page it's used. I've gone through the code to look for syntax errors, but I don't see anything. Has anyone else had this problem?" ]
[ "javascript", "reactjs" ]
[ "Resize and placement of elements", "public class InputURL {\n\npublic InputURL() {\n input();\n}\n\nprivate static JFrame mainFrame = Launcher.returnFrame();\nprivate static JPanel mainPanel;\n\nprivate void input(){\n\n\n//Defining a Panel on which everything will be set\nmainPanel = new JPanel();\nmainPanel.setLayout(new GridBagLayout());\n\n//To put the GridBagLayout Constraints\nGridBagConstraints c = new GridBagConstraints();\n\n//Set Panel Size\nmainPanel.setSize(Constants.windowWidth,Constants.windowHeight);\n\n//Setting the Input Box\nJTextField inputURL = new JTextField();\nc.fill = GridBagConstraints.CENTER;\nc.ipady = 50;\nc.weightx = 0.0;\nc.gridwidth = 3;\nc.gridx = 0;\nc.gridy = 1;\nmainPanel.add(inputURL, c);\n\n//Adding the start button\nJButton submitURL = new JButton(Constants.SUBMIT_URL_BUTTON);\nsubmitURL.addActionListener(new ActionListener() {\n\n //The action performed by the start button\n public void actionPerformed(ActionEvent e)\n {\n //Execute when button is pressed\n }\n}); \n\n//The placement of the button\nc.fill = GridBagConstraints.VERTICAL;\nc.ipady = 50;\nc.weightx = 0.0;\nc.gridwidth = 3;\nc.gridx = 0;\nc.gridy = 2;\nmainPanel.add(submitURL, c);\n\n\n//Adding the components on Panel to Frame\nmainFrame.add(mainPanel);\n\n}\n}\n\n\nThe ouput and expected output can be viewed here. Need help regarding the Output. E.G.: \n\n\n\nI've tried using GridBagConstraints and for some reason I cannot play much with the UI." ]
[ "java", "swing", "user-interface", "layout-manager", "gridbaglayout" ]