texts
sequence
tags
sequence
[ "Accessing constants using Key-Value Coding in Objective-C", "I'm making a program that has a lot of constants. I decided to put them all into a separate class and I'm importing it by the classes that need it. The files look similar to this\n\n// Constants.h\nextern const int baseCostForBuilding;\nextern const int maxCostForBuilding;\n// etc\n\n// Constants.m\nconst int baseCostForBuilding = 400;\nconst int maxCostForBuilding = 1000;\n// etc\n\n\nWhat I'm trying to do is access them using key-value coding. What I've tried so far hasn't worked.\n\nid object = [self valueForKey:@\"baseCostForBuilding\"];\n\n\nBut I can do the following and it works fine.\n\nid object = baseCostForBuilding;\n\n\nThis may seem pointless but I have a lot of variables that have to end in \"CostForBuilding\" and the function I need this in only gets the first part of the string. Example, \"base\", \"max\", \"intermediate\", etc. It will then combine it with \"CostForBuilding\" or something else to get the variable name.\n\nIf this is possible, it would be way nicer to only have one or two lines of code instead of multiple if-statements to access the correct variable. Does anyone know a way to do this? Thanks in advance." ]
[ "objective-c", "variables", "constants", "key-value-coding" ]
[ "Dialog loads on page before it disappears", "I'm using JQuery UI dialog that pops up when a user clicks a button (otherwise, it should be hidden). When the page loads, the dialog is actually seen on the page for a few seconds before disappearing (because the dialog is embedded onto the page). Is there anyway to prevent this appearance when loading?" ]
[ "jquery", "html", "jquery-ui", "dialog" ]
[ "Swift 4 Why Delegate is not working", "In ViewController :\n\nprotocol SearchResultDelegate {\n func SendDataToResultController(_ result: [SkelbimasModel])\n}\n\nclass ViewController: UIViewController, UISearchBarDelegate, CLLocationManagerDelegate, MKMapViewDelegate, AddSkelbimas {\n\n @IBOutlet weak var Label: UILabel!\n @IBOutlet weak var SearchBar: UISearchBar!\n // @IBOutlet weak var boomFilter: BoomMenuButton!\n // @IBOutlet weak var Label: UILabel!\n @IBOutlet weak var CategoryView: UIView!\n @IBOutlet weak var Map: MKMapView!\n @IBOutlet weak var bmb: BoomMenuButton!\n\n var Delegate:SearchResultDelegate?\n.........\n\n //ijungimiame lentele su paieskos rezultatais\n if(result.count > 1) {\n Delegate?.SendDataToResultController(result)\n GoToSearchResultVC(result)\n\n }\n\n\nFunction GoToSearchResultVC(result) is called it opens new controller\nin that new controller code is :\n\nimport UIKit\n\nclass SearchResultTableViewController: UITableViewController, SearchResultDelegate {\n.....\n\nfunc SendDataToResultController(_ result: [SkelbimasModel]) {\n print(\"result count: \\(result.count)\")\n results = result\n}\n\n\nBut this function is never called. \nI used delegates before and was fine. Or i'm just tired and do not see where i did wrong..." ]
[ "ios", "swift", "delegates" ]
[ "Rust static library \"unlinked native library\" warnings", "I'm using Rust 0.11-pre to compile a simple staticlib\n\n#![crate_type = \"staticlib\"]\n#[no_mangle]\npub extern \"C\" fn foo() { \n}\n\n\nAnd then I compile with\n\nrustc foo.rs --crate-type=\"staticlib\" -o foo.a\n\n\nIt's working fine, but I get the following warnings and I'm wondering how to resolve them\n\nwarning: unlinked native library: System\nwarning: unlinked native library: c\nwarning: unlinked native library: m" ]
[ "static-libraries", "rust" ]
[ "How to read API Payload value using Python script", "I have an application which is supposed to add a device. When I scan a particular device it's serial number is passed through payload section of API and it reaches the python script where I'll be executing this API.\n\nThe format of payload is as follows:\n\n\"payload\" : {\n \"path\":\"serial_number(eg. Ag145ghjj)\"\n }\n\n\nWhat I want to do is read the incoming payload value (Payload in the body of the api) in my python script.\nHow can I store just the payload containing the serial number in some variable and use it later.\n\nPlease let me know the steps required for this and guide me through." ]
[ "python", "api", "payload" ]
[ "Extracting string from label, can't find Object in Squish", "Im trying to read a widget displaying a string containing coordinates. The goal is to extract the coordinates as a String but Squish can't find the object in the Objekt Map, only using Pick tool can I find the object.\nMeaning during run the script fails when I try to read the string.\n\nThe following is part of a larger script. The window is called System Display and contains a button called properies. Properties is itself a window with a unique id and contains among other things, the coordinates.\n\nJavascript:\n\nclickButton(waitForObjectItem(\":System Display.Properties_JButton\"));\nvar Coord = waitForObjectExist(\":Display Properties [ID 001]_JFormattedTextField\").value;\n\n\nRight now the get the error message\n\nObject: Display Properties [ID 001] _JFormattedTextField' not fund. Object name not found in ObjectMap" ]
[ "javascript", "automated-tests", "squish" ]
[ "WCF enqueued requests", "In our application we have a WCF \"standalone\" published on a Azure WorkerRole (Cloud Service). In this WCF, we have modified the throttling and limited the maximum number of concurrent calls. When this value is exceeded, the WCF queued requests. We don't know where are queued.\nFor the application's features the requests can't be enqueued or enqueued less time as soon as possible.\n\nWe can see these queues?\nHow can we change the parameters to not enqueued?\n\nCan you help me?\n\nThanks a lot of." ]
[ "wcf", "azure", "queue", "azure-worker-roles" ]
[ "SimpleAdapter issue when changing the background of a button, it changes for all items", "When im populating my SimpleAdapter. On the getView() method I check if a video already exists or not. If it already exists I will change the image of the button to a \"Play\" image. Otherwise, I will keep its \"download\" image. The problem is when I scroll the list, it changes all the buttons to \"Play\" images. This is my code, what im doing wrong?\n\npublic View getView(int position, View convertView, ViewGroup parent) {\n View row=super.getView(position, convertView, parent);\n\n TextView videoIdText = (TextView) row.findViewById(R.id.videoId);\n Button downloadButton = (Button) row.findViewById(R.id.videoDownload);\n\n final String videoId = videoIdText.getText().toString();\n\n if (videoExists(videoId)) {\n\n downloadButton.setBackgroundResource( R.drawable.ic_play );\n Drawable d = downloadButton.getBackground();\n d.setColorFilter(Color.parseColor(\"#00AA00\"),Mode.SRC_ATOP);\n\n downloadButton.setOnClickListener(new OnClickListener(){ \n @Override\n public void onClick(View view) {\n if (activity !=null){\n ((FeedActivity)activity).playVideo(getVideoPath(videoId));\n } \n }\n }); \n }else{\n downloadButton.setOnClickListener(new OnClickListener(){\n @Override\n public void onClick(View view) {\n DownloadTask task = new DownloadTask();\n task.setVideoId(videoId);\n task.execute();\n }\n }); \n }" ]
[ "android", "simpleadapter" ]
[ "Java and haarcascade face and mouth detection - mouth as the nose", "Today I begin to test the project which detects a smile in Java and OpenCv. To recognition face and mouth project used haarcascade_frontalface_alt and haarcascade_mcs_mouth But i don't understand why in some reasons project detect nose as a mouth. \nI have two methods:\n\nprivate ArrayList<Mat> detectMouth(String filename) {\n int i = 0;\n ArrayList<Mat> mouths = new ArrayList<Mat>();\n // reading image in grayscale from the given path\n image = Highgui.imread(filename, Highgui.CV_LOAD_IMAGE_GRAYSCALE);\n MatOfRect faceDetections = new MatOfRect();\n // detecting face(s) on given image and saving them to MatofRect object\n faceDetector.detectMultiScale(image, faceDetections);\n System.out.println(String.format(\"Detected %s faces\", faceDetections.toArray().length));\n MatOfRect mouthDetections = new MatOfRect();\n // detecting mouth(s) on given image and saving them to MatOfRect object\n mouthDetector.detectMultiScale(image, mouthDetections);\n System.out.println(String.format(\"Detected %s mouths\", mouthDetections.toArray().length));\n for (Rect face : faceDetections.toArray()) {\n Mat outFace = image.submat(face);\n // saving cropped face to picture\n Highgui.imwrite(\"face\" + i + \".png\", outFace);\n for (Rect mouth : mouthDetections.toArray()) {\n // trying to find right mouth\n // if the mouth is in the lower 2/5 of the face\n // and the lower edge of mouth is above of the face\n // and the horizontal center of the mouth is the enter of the face\n if (mouth.y > face.y + face.height * 3 / 5 && mouth.y + mouth.height < face.y + face.height\n && Math.abs((mouth.x + mouth.width / 2)) - (face.x + face.width / 2) < face.width / 10) {\n Mat outMouth = image.submat(mouth);\n // resizing mouth to the unified size of trainSize\n Imgproc.resize(outMouth, outMouth, trainSize);\n mouths.add(outMouth);\n // saving mouth to picture \n Highgui.imwrite(\"mouth\" + i + \".png\", outMouth);\n i++;\n }\n }\n }\n return mouths;\n}\n\n\nand detect smile\n\nprivate void detectSmile(ArrayList<Mat> mouths) {\n trainSVM();\n CvSVMParams params = new CvSVMParams();\n // set linear kernel (no mapping, regression is done in the original feature space)\n params.set_kernel_type(CvSVM.LINEAR);\n // train SVM with images in trainingImages, labels in trainingLabels, given params with empty samples\n clasificador = new CvSVM(trainingImages, trainingLabels, new Mat(), new Mat(), params);\n // save generated SVM to file, so we can see what it generated\n clasificador.save(\"svm.xml\");\n // loading previously saved file\n clasificador.load(\"svm.xml\");\n // returnin, if there aren't any samples\n if (mouths.isEmpty()) {\n System.out.println(\"No mouth detected\");\n return;\n }\n for (Mat mouth : mouths) {\n Mat out = new Mat();\n // converting to 32 bit floating point in gray scale\n mouth.convertTo(out, CvType.CV_32FC1);\n if (clasificador.predict(out.reshape(1, 1)) == 1.0) {\n System.out.println(\"Detected happy face\");\n } else {\n System.out.println(\"Detected not a happy face\");\n }\n }\n }\n\n\nExamples:\n\nFor that picture \n\n\n\ncorrectly detects this mounth:\n\n\n\nbut in other picture \n\n\n\nnose is detected\n\n\nWhat's the problem in your opinion ?" ]
[ "java", "opencv", "face-detection", "haar-classifier" ]
[ "How can I save nicedit textarea formatted text in mysql database using js and php and retrieve the same formatted text", "I am using niceedit textarea and I am getting the content with html tags and even while retrieving the content returns with tag.\nHow can i receive only the formatted text?\nMy html code\n\n<textarea id=\"submenu_name\" cols=\"40\" style=\"width: 100%;\"></textarea> \n\n\nMy JS\n\n<script src=\"http://js.nicedit.com/nicEdit-latest.js\" type=\"text/javascript\">\n</script>\n<script type=\"text/javascript\">\n\n bkLib.onDomLoaded(nicEditors.allTextAreas);\n\n </script>\n\n\n<script>\nfunction Save()\n{\nvar edit = new nicEditors.findEditor('submenu_name');\nvar name = edit.getContent();\n}\n</script" ]
[ "javascript", "php", "html", "ajax", "nicedit" ]
[ "How do I access different python module versions?", "so I am working on a shared computer. It is a workhorse for computations across the department. The problem we have run into is controlling versions of imported modules. Take for example Biopython. Some people have requirements of an older version of biopython - 1.58. And yet others have requirements for the latest biopython - 1.61. How would I have both versions of the module installed side by side, and how does one specifically access a particular version. I ask because sometimes these apis change and break old scripts for other people (or they expect certain functionality that is no longer there).\n\nI understand that one could locally (i.e. per user) install the module and specifically direct python to that module. Is there another way to handle this? Or would everyone have to create an export PYTHONPATH before using?" ]
[ "python", "module", "version" ]
[ "DDD naming: Domain Object", "Consider certain kinds of objects involved Domain-Driven Design (DDD): Entities, Value Objects, Domain Events, and Domain Services.\n\nWhich of these are considered to be Domain Objects? And are there other names for abstractions that encapsulate a subset of those?\n\nI can identify various abstractions that are useful to have when talking about DDD or domain models:\n\n\nEntities and Value Objects. I often find myself mentioning \"Entities or Value Objects\". Most notably, these are the ones that model the domain's state. In contrast, Domain Services are stateless, and I would argue that Domain Events merely reflect information about how the domain came to be in its current state.\nEntities, Value Objects, and Domain Events. These may all contain or represent data, whereas the Domain Services only define behavior.\nAll objects recognized by the domain model. It is useful to be able to talk about parts of the domain model in general, as opposed to concepts outside of it.\n\n\nIt's interesting how even Stack Overflow's domain-object tag has a confusing definition:\n\n\n Domain Objects are objects made for dealing with the domain logic at the Model layer. These objects generally simulate real (or virtual) items from real-life: Person, Post, Document, etc.\n\n\nThe initial definition, focused on \"dealing with the domain logic\", leans towards \"all objects recognized by the domain model\". The examples then lean towards \"Entities and Value Objects\".\n\nDDD hammers on a clearly defined, unambiguous Ubiquitous Language, and with good reason. Shouldn't it lead by example? :)" ]
[ "domain-driven-design", "naming", "domain-model", "domain-object" ]
[ "Lower the number of Append Queries in Access 2000?", "I have to make a report with 168 rows. Most of them are sequential data, but there are summation rows for which I need to build helper tables. \n\nTherefore I need to build like 45-50 queries, most of them Append Queries. \n\nIs there a way to minimize the number of queries and develop a large report with 168 rows?\n\nShould I use code?" ]
[ "vba", "ms-access" ]
[ "Create datatable reference my model with EntityFramework", "I use the EntityFramework to create datatable reference my model, but it can only create datatables one at a time. In my project, when my model is changed, how can I do to have the datatable also changed ?\n\nDo I need to modify my database? Is there a method to create or modify automatically?" ]
[ "entity-framework-5" ]
[ "Alternative to \"onChange\" event with Semantic UI dropdown?", "This is a dumb question but I've been all over the Semantic UI site, along with searching here and I haven't found a solution.\n\nThe gist is: I have been using the code below with a Semantic dropdown list. It works fine – except that I have a table component through which the user can also make a selection (which triggers a function) – and when they do, I update the Semantic dropdown to reflect the current selection . . . and then the onChange event fires – so a function is running twice when it doesn't need to.\n\nI tried using onSelect but that is apparently not a valid event for a dropdown. I could do some stupid hack to work around this but I'd rather just use a different event. Is there one?\n\n\n\n$(function () {\n $('#productStates').dropdown({\n allowAdditions: true,\n allowReselection: true,\n placeholder: \"Select State\",\n onChange: function (value, text) {\n if (projectData == undefined) return; \n loadStateByID(value)\n }\n })\n});" ]
[ "javascript", "semantic-ui" ]
[ "Jest encountered an unexpected token Express", "I have a problem using json web token with Jest\nIt gives me an error \"Jest encountered an unexpected token\"\nI think the problem with Jest Configuration but I cannot figure what it is\n\nusing\n\n\nexpress\nnodejs\nmongoose\n\n\nthat's my package.json\n\n{\n \"name\": \"task-manager\",\n \"version\": \"1.0.0\",\n \"description\": \"\",\n \"main\": \"index.js\",\n \"scripts\": {\n \"start\": \"node src/index.js\",\n \"dev\": \"env-cmd ./config/dev.env nodemon src/index.js\",\n \"test\": \"env-cmd ./config/test.env jest --watch\"\n },\n \"jest\": {\n \"testEnvironment\": \"node\"\n },\n \"keywords\": [],\n \"author\": \"\",\n \"license\": \"ISC\",\n \"dependencies\": {\n \"@sendgrid/mail\": \"^6.4.0\",\n \"bcryptjs\": \"^2.4.3\",\n \"express\": \"^4.17.1\",\n \"jsonwebtoken\": \"^8.5.1\",\n \"mongodb\": \"^3.4.0\",\n \"mongoose\": \"^5.8.1\",\n \"mongoose-hidden\": \"^1.8.1\",\n \"multer\": \"^1.4.2\",\n \"sharp\": \"^0.23.4\",\n \"validator\": \"^10.9.0\"\n },\n \"devDependencies\": {\n \"env-cmd\": \"^8.0.2\",\n \"jest\": \"^24.9.0\",\n \"nodemon\": \"^2.0.2\",\n \"supertest\": \"^3.4.1\"\n }\n}\n\n\nuser.test.js\n\nconst request = require('supertest')\nconst app = require('../src/app')\nconst User = require('../src/models/user')\nconst jwt = require('jsonwebtoken')\nconst mongoose = require('mongoose')\n\n//get userID\nconst userOneId = new mongoose.Types.ObjectId()\n//seed user\nconst userOne = {\n _id : userOneId,\n name : 'Mo Salah',\n email : '[email protected]',\n password : 'niceplayer11',\n tokens : [{\n token : jwt.sign({_id:userOneId},process.env.TOKEN_SECRET_KEY)\n }]\n}\n\n\n//beforeEach :: before execute test delete all users and store seed user\nbeforeEach(async ()=>{\n await User.deleteMany()\n await new User(userOne).save()\n})\n\n\n//test signUp user\ntest('siginUp user', async ()=>{\n await request(app).post('/users').send({\n name : 'Sama',\n email : '[email protected]',\n password : 'mypass22'\n }).expect(201)\n})\n\n//test Login\ntest('Login User Test',async ()=>{\n await request(app).post('/users/login').send({\n email : userOne.email,\n password : userOne.password\n }).expect(200)\n})\n\n//test login no user\ntest('login NoUser',async ()=>{\n await request(app).post('/users/login').send({\n email : '[email protected]',\n password : 'dsdff'\n }).expect(400)\n})\n\n// auth user get profile\ntest('auth user profile',async ()=>{\n await request(app)\n .get('users/me')\n .set('Authorization', `Bearer ${userOne.tokens[0].token}`)\n .send()\n .expect(200)\n})\n\n\nall test works fine except the test using token\nany suggestions will be appreciated" ]
[ "node.js", "express", "mongoose", "jestjs", "jwt" ]
[ "how to get j3d loader?", "I'm doing a java 3D library regarding drawing different kind of shapes and generate them into an STL file. As I'm trying to code my STLFile class I found some import which I don't really understand. Can someone tell me where can I find the Loader or the library and how to use those import.\nBelow is the code that I found which I don't understand.\nimport com.sun.j3d.loaders.Scene;\nimport com.sun.j3d.loaders.SceneBase;\nimport com.sun.j3d.loaders.IncorrectFormatException;\nimport com.sun.j3d.loaders.ParsingErrorException;\nimport com.sun.j3d.utils.geometry.GeometryInfo;\n\n. . .\n\npublic class STLFile implements Loader\n{\n. . .\n}\n\nThere are more code but I 'm just showing the part which I not sure.\nThank you." ]
[ "stl", "java-3d" ]
[ "Scrape \"aspx\" page with R", "can someone help me or give me some suggestion how scrape table from this url: https://www.promet.si/portal/sl/stevci-prometa.aspx. \n\nI tried with instructions and packages rvest, httr and html but for this particular site without any sucess. Thank you." ]
[ "r", "web-scraping", "rvest", "httr" ]
[ "Python: Cows and Bulls game", "I am writing a code fora game which randomly generates a 4-digit number. Ask the user to guess a 4-digit number. For every digit that the user guessed correctly\nin the correct place, they have a “cow”. For every digit the user guessed correctly in the wrong place is a “bull.” Every time the user makes a guess, tell them how many “cows” and “bulls” they have. Once the user guesses the correct number, the game is over. Keep track of the number of guesses the user makes throughout the game and tell the user at the end.\n\nThe code is below.\n\nimport random\n\nrand=[random.randint(0,9) for n in range(3)]\n\n\nuser_guess=[input(\"Please guess 4-digit number: \")]\n\ndef game():\n count=0\n while True:\n guess=[i for i in rand]\n listnum=[i for i in user_guess]\n\n if guess == listnum:\n print(\"You won.\")\n print(\"It took you \"+str(count)+\" guess.\")\n break\n\n if guess != listnum:\n cow=0\n bull=0\n count+=1\n for x in range(0,3):\n if guess[x]==listnum[x]:\n cow+=1\n\n if len(set(guess)&set(listnum))>num:\n bull=len(set(guess)&set(listnum)) - cow\n\n print(\"Cows: \"+str(cow)+' Bulls: '+str(bull))\n\ngame()\n\n\nBut I am getting the following error after it asks the user to guess the number and takes the input. The error is given below.\n\nPlease guess 4-digit number: 1234\n\n---------------------------------------------------------------------------\nIndexError Traceback (most recent call last)\n<ipython-input-48-64a0b0d4d766> in <module>()\n 41 print(\"Cows: \"+str(cow)+' Bulls: '+str(bull))\n 42 \n---> 43 game()\n 44 \n 45 \n\n<ipython-input-48-64a0b0d4d766> in game()\n 33 count+=1\n 34 for x in range(0,3):\n---> 35 if guess[x]==listnum[x]:\n 36 cow+=1\n 37 \n\nIndexError: list index out of range\n\n\nWhat mistake am I making here?" ]
[ "python", "index-error" ]
[ "codeigniter controller name comes twice in address when redirected", "I'm a newbie in codeigniter so this might just be a basic error but still I couldn't find any answer to this in any other disscussion.. using codeigniter 3.1.7\n\n\nIf I log in with garbage or correct values it should redirect me to profile page or the same page but instead, it gives me this...\n\n\n\nmy Control login function code is\n\nfunction admin_login_view()\n {\n $this->load->view('admin_login');\n }\n\n function admin_login()\n { \n $a = $this->input->post('id');\n $b = $this->input->post('pass');\n\n $flag = \"admin\"; \n $attempt = $this->Model->login($a,$b,$flag);\n if($attempt==\"admin\")\n {\n $_SESSION[\"user\"]=$a;\n return redirect('Control/view_administration');\n }\n elseif ($attempt==\"id\")\n {\n $msg= \"The Admin-id doesn't exists.\";\n $this->session->set_flashdata('admin_id',$msg);\n return redirect('Control/admin_login_view');\n } \n elseif($attempt==\"pass\")\n {\n $msg=\"The password is wrong.\";\n $this->session->set_flashdata('admin_pass',$msg);\n return redirect('Control/admin_login_view');\n } \n else\n {\n $msg=\"Login failed.\";\n $this->session->set_flashdata('admin_fail',$msg);\n return redirect('Control/admin_login_view');\n } \n }\n\n\nI have tried all the listed solutions\n\n\nyes my controller and model file/class names are the same and with caps on the first letter\n\nmy .htaccess file contains what the user guide site asked me to keep although I have no clue whatsoever code is written there... if there is something I need to change here please do explain what is it before you give me a bunch of code... :p\n\nmy base path is:\n\n$config['base_url'] = 'http://localhost/CodeIgniter-3.1.7/';\n\n\nindex is set as:\n\n `$config['index_page'] = 'index.php';`\n\n\nmy routes file contains: \n\n$route['default_controller'] = 'Control';\n$route['404_override'] = '';\n $route['translate_uri_dashes'] = FALSE;`\n\n\nI searched everywhere but no solution helped me in any way... I might be doing a noob mistake herebut please help" ]
[ "php", "codeigniter", "redirect" ]
[ "How to stay full screen when trigger upload file?", "I'm recently use element.requestFullScreen() to enter full screen mode from my div. However, in my full screen view there's a button could trigger upload file function.\n\nIs it possible for me to force stay in full screen mode while default select file window pop up?\n\nsimple demo in steps with jsfiddle\n1. click full screen button to full screen mode\n2. click file upload input\n\nhttps://jsfiddle.net/56yzokra/3/\n\nThanks for reminding me for a simple demo to make it clear" ]
[ "javascript", "html", "fullscreen" ]
[ "autoMirrored to ImageButton", "I have an app and I would like it to support 2 languages: English and Hebrew.\nWhen the program is localized to US I have an Imagebutton that looks as follows:\n\nNow, when I change into Hebrew, it looks as follows:\n\nAs you can see that Buttons changed places however the direction of the arrow is pinted to the wrong direction.\nI tried to use autoMirrored on it but nothing has changed:\n<ImageButton\n android:id="@+id/returnButton"\n style="?android:borderlessButtonStyle"\n android:layout_width="40dp"\n android:layout_height="wrap_content"\n android:layout_marginStart="18dp"\n android:layout_marginTop="20dp"\n android:autoMirrored="true"\n android:background="@color/fui_transparent"\n android:src="@drawable/ic_rarrow" />\n\nWhere ic_rarrow is an xml created from SVG.\nThank you" ]
[ "android", "xml", "imagebutton" ]
[ "Flask extensions IN PyCharm", "I'm actually having trouble using the flask.ext with PyCharm ide. I installed the flask-script and flask-bootstrap but the Pycharm is unable to recognize them. I'm getting the following error.\n\nTraceback (most recent call last):\nFile \"/home/brucewilson/PycharmProjects/demo_proj/demo.prj.py\", line 5, in <module>\nfrom flask.ext.bootstrap import Bootstrap\nFile \"/home/brucewilson/flasky/venv/local/lib/python2.7/site-packages/flask/exthook.py\", line 87, in load_module\nraise ImportError('No module named %s' % fullname)\nImportError: No module named flask.ext.bootstrap" ]
[ "python", "twitter-bootstrap", "flask" ]
[ "Single sign on without a secret between the Site and Provider", "I have a client who wants single sign-on to my application and I'm trying to figure out how to implement it.\n\nIt seems that on a theoretical level, either a secret has to be shared between your site and the SSO provider so that messages can have anti-tampering hashes attached, or that your site has to generate a token which both the SSO and user ok independently.\n\nI have an opportunity to tell the SSO provider how I would like to interact with them and I really don't want to deal with message hashing and storing secrets so I came up with the following which seems to me like it would work.\n\n\n\nIs this insecure? Is there another/better way of doing this?" ]
[ "architecture", "single-sign-on" ]
[ "Need a hitTestPoint solution to replace hitTestObject", "I need an as3 solution to this collision problem:\n\nI have this code:\n\nelse if (objectArray[i].toString().indexOf(\"meandude\") != -1) {\n //if the object is a meandude and hits it, game over\n if (projectileMC.hitTestObject(objectArray[i])) {\n removeEventListener(Event.ENTER_FRAME,mainEnterFrame);loseGame();\n\n\nwhich is using the bounding boxes of the projectileMC and meandude (hitTestObject). I'd like it so the center points of the projectileMC and meandude crossing registers the action instead (hitTestPoint). I tried to switch it myself, but I'm not getting it to work.\n\nThanks" ]
[ "actionscript-3", "hittest" ]
[ "remove string using Select statement in Oracle View", "I have below simple View where there are several ID_NUM field value in which there is equal sign which i want to remove. For example one of the value is '1AT=/F/ET' and i want to update as '1AT/F/ET'.\nCREATE OR REPLACE VIEW\nTR_FD\n(\nID_NUM\n)\nAS\nSELECT\n ID_NUM\nFROM IS_PL;" ]
[ "oracle", "select", "view" ]
[ "jquery UI sortable, how can i return the text of moved ?", "what i'm trying to do is to return the text that is contained by the moved li, after the list item was moved. Is there a way to do that? thanks\n\nEDIT:\n\ni tried: $(ui.item).text() but i get an ui is not defined error (i imported just jquery.js, ui.core.js and ui.sortable.js , do i have to import something else?)\n\nHTML\n\n<ul id=\"sortable\">\n <li><a href=\"\" class=\"drag\">text</a></li>\n <li><a href=\"\" class=\"drag\">another text</a></li>\n <li><a href=\"\" class=\"drag\">more text</a></li>\n</ul>\n\n\nJS\n\n$(document).ready(function(){\n $('ul#sortable').sortable({\n handle:'.drag',\n axis:'y',\n update:function(){\n alert($(ui.item).text());\n }\n });\n});" ]
[ "jquery-ui", "jquery-ui-sortable" ]
[ "Oracle 9i Session Disconnections", "[Cross-Posting from ServerFault]\n\nI am in a development environment, and our test Oracle 9i server has been misbehaving for a few days now. What happens is that we have our JDBC connections disconnecting after a few successful connections.\n\nWe got this box set up by our IT department and handed over to. It is 'our problem', so options like 'ask you DBA' isn't going to help me. :(\n\nOur server is set up with 3 plain databases (one is the main dev db, the other is the 'experimental' dev db). We use the Oracle 10 ojdbc14.jar thin JDBC driver (because of some bug in the version 9 of the driver). We're using Hibernate to talk to the DB.\n\nThe only thing that I can see that changed is that we now have more users connecting to the server. Instead of one developer, we now have 3. With the Hibernate connection pools, I'm thinking that maybe we're hitting some limit?\n\nAnyone has any idea what's going on?\n\nHere's the stack trace on the client:\n\nCaused by: org.hibernate.exception.GenericJDBCException: could not execute query\nat org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126) [hibernate3.jar:na]\nat org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114) [hibernate3.jar:na]\nat org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) [hibernate3.jar:na]\nat org.hibernate.loader.Loader.doList(Loader.java:2235) [hibernate3.jar:na]\nat org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2129) [hibernate3.jar:na]\nat org.hibernate.loader.Loader.list(Loader.java:2124) [hibernate3.jar:na]\nat org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401) [hibernate3.jar:na]\nat org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363) [hibernate3.jar:na]\nat org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196) [hibernate3.jar:na]\nat org.hibernate.impl.SessionImpl.list(SessionImpl.java:1149) [hibernate3.jar:na]\nat org.hibernate.impl.QueryImpl.list(QueryImpl.java:102) [hibernate3.jar:na]\n...\nCaused by: java.sql.SQLException: Io exception: Connection reset\nat oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) [ojdbc14.jar:Oracle JDBC Driver version - \"10.2.0.4.0\"]\nat oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146) [ojdbc14.jar:Oracle JDBC Driver version - \"10.2.0.4.0\"]\nat oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255) [ojdbc14.jar:Oracle JDBC Driver version - \"10.2.0.4.0\"]\nat oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:829) [ojdbc14.jar:Oracle JDBC Driver version - \"10.2.0.4.0\"]\nat oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1049) [ojdbc14.jar:Oracle JDBC Driver version - \"10.2.0.4.0\"]\nat oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:854) [ojdbc14.jar:Oracle JDBC Driver version - \"10.2.0.4.0\"]\nat oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1154) [ojdbc14.jar:Oracle JDBC Driver version - \"10.2.0.4.0\"]\nat oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3370) [ojdbc14.jar:Oracle JDBC Driver version - \"10.2.0.4.0\"]\nat oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3415) [ojdbc14.jar:Oracle JDBC Driver version - \"10.2.0.4.0\"]\nat org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208) [hibernate3.jar:na]\nat org.hibernate.loader.Loader.getResultSet(Loader.java:1812) [hibernate3.jar:na]\nat org.hibernate.loader.Loader.doQuery(Loader.java:697) [hibernate3.jar:na]\nat org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259) [hibernate3.jar:na]\nat org.hibernate.loader.Loader.doList(Loader.java:2232) [hibernate3.jar:na]" ]
[ "java", "hibernate", "jdbc", "oracle9i" ]
[ "How to minify and concat javascript and css files in Express 4", "Is there a middleware that takes all public stuff like scripts, css, images, and fonts. And then losslessly compress them / minify, concat, replace their mention in templates with their calls. So script 1, script 2, script 3 tags let say in jade is replaced with all.concated.min.js and all images are merged into sprite sheet, losslessly compressed and then all their mentions of them in css or img tags is replaced by extra css rules that are also concated at the end of all.concat.min.css\n\ni forgot to add that this manager should also handle http caching. As it's already replacing file values at server start. So it would make logo_s3kc.png max age infinity. But if logo changes which it keeps track using its own internal way, like using checksum. then it changes the name at next start of server so all files point to logo_new.png. but when i view file i only care about logo.png. Just like you have styles.less. Then there gets compiled styles.css etc." ]
[ "node.js", "express", "npm", "pug" ]
[ "not getting table view data after reloading tableview", "i am call api using Alamofire and SwiftyJSOn and i am creating model class for display data in tableview here is my response\n\nResponse\n\n{\n \"inspections_todays_data\" : [\n\n ],\n \"message\" : \"Successfully.\",\n \"success\" : \"1\",\n \"inspections_future_data\" : [\n\n ],\n \"inspections_overdue_data\" : [\n {\n \"notes\" : \"Test\",\n \"surveyor_id\" : \"8\",\n \"longitude\" : null,\n \"time\" : \"08:00\",\n \"address3\" : null,\n \"county\" : \"carlow\",\n \"client_id\" : \"3\",\n \"house_num\" : \"test street\",\n \"eircode\" : \"12345\",\n \"address1\" : \"test area\",\n \"date_inspected\" : \"2019-01-10\",\n \"address2\" : \"test city\",\n \"country\" : \"Ireland\",\n \"latitude\" : null,\n \"name\" : \"test street\",\n \"property_id\" : \"22\"\n }\n ]\n}\n\n\nas you see in response i have three array and i am fetching inspections_overdue_data array i fetched successfully but not able to display on tableview\n\nHere is my code\n\nCode\n\n func OverdueList(){\n let preferences = UserDefaults.standard\n let uid = \"u_id\"\n let acTkn = \"acc_tkn\"\n\n let u_ID = preferences.object(forKey: uid)\n let A_Token = preferences.object(forKey: acTkn)\n\n let params = [\"user_id\": u_ID!, \"access_token\": A_Token!]\n print(params)\n Alamofire.request(inspectionsList, method: .post, parameters: params).responseJSON(completionHandler: {(response) in\n switch response.result{\n case.success(let value):\n let json = JSON(value)\n print(json)\n let data = json[\"inspections_overdue_data\"]\n print(data)\n if data == []{\n self.viewNodata.isHidden = false\n }else{\n data.array?.forEach({ (iunOverDue) in\n let iOveList = OvedueModel(surveyor_id: iunOverDue[\"surveyor_id\"].stringValue, country: iunOverDue[\"country\"].stringValue, time: iunOverDue[\"time\"].stringValue, address2: iunOverDue[\"address2\"].stringValue, notes: iunOverDue[\"notes\"].stringValue, house_num: iunOverDue[\"house_num\"].stringValue, name: iunOverDue[\"name\"].stringValue, address1: iunOverDue[\"address1\"].stringValue, eircode: iunOverDue[\"eircode\"].stringValue, date_inspected: iunOverDue[\"date_inspected\"].stringValue, property_id: iunOverDue[\"property_id\"].stringValue, county: iunOverDue[\"county\"].stringValue, client_id: iunOverDue[\"client_id\"].stringValue)\n print(iOveList)\n self.overDueData.append(iOveList)\n })\n\n self.tblOvedue.reloadData()\n }\n\n case.failure(let error):\n print(error.localizedDescription)\n }\n\n })\n }\n\n\ni also added delegate and datasource through storyboard but still i am not able to show data here is my tableview methods\n\n func numberOfSections(in tableView: UITableView) -> Int {\n return 0\n }\n func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n return overDueData.count\n }\n func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {\n let cell = tableView.dequeueReusableCell(withIdentifier: \"Cell\") as! OverDueTableViewCell\n let name = overDueData[indexPath.row].name\n let address1 = overDueData[indexPath.row].address1\n cell.lblTitle.text = \"\\(name) \\(address1)\"\n return cell\n }" ]
[ "ios", "swift", "uitableview", "alamofire", "swifty-json" ]
[ "Very slow php update code after adding some data to the database?", "I have a soccer fantasy league php script, there is 20 teams and more than 400 players assigned to the teams, and I have 500 users.\n\nEvery week there is a points should be assigned to each player, so that in the end every user will have a total points from his formation and that will generate the ranking for the season.\n\nFirst week points were added normally, but for the second week point the addpont section became so slow, and for the 3rd week points a socket time out error appears.\n\nhere is the code I'm using in adding points to users:\n\n// Adding Point To the user player list\n$sql_user=\"select * from \".$prev.\"user LIMIT 0, 100 \"; \n\n$re_user=mysql_query($sql_user); \nwhile($d_user=mysql_fetch_array($re_user)) \n{ \n$userID=$d_user['id']; \n\n $sql_addpointgroup=\"select * from \".$prev.\"addpoint group by weekno order by weekno\"; \n $re_addpointgroup=mysql_query($sql_addpointgroup); \n while($d_addpointgroup=mysql_fetch_array($re_addpointgroup)) \n { \n $points=0; \n $sql_addpoint=\"select * from \".$prev.\"addpoint where weekno='\".$d_addpointgroup['weekno'].\"'\"; \n $re_addpoint=mysql_query($sql_addpoint); \n while($d_addpoint=mysql_fetch_array($re_addpoint)) \n { \n $points=$d_addpoint['points']; \n $sql_weekstatistic=\"select * from \".$prev.\"weekstatistic where weekno='\".$d_addpointgroup['weekno'].\"' and userID='$userID' and playerID='\".$d_addpoint['playerID'].\"'\"; \n $re_weekstatistic=mysql_query($sql_weekstatistic); \n if(mysql_num_rows($re_weekstatistic)>0) \n { \n $sql_update=\"update \".$prev.\"weekstatistic set points='$points' where weekno='\".$d_addpointgroup['weekno'].\"' and userID='$userID' and playerID='\".$d_addpoint['playerID'].\"'\"; \n\n mysql_query($sql_update); \n } \n } \n} \n} \n\n\nI've limited the number of users to 100 user every submitting and even so the code still slow.\n\nthe slowness is only with this code other website sections are working normally.\n\nIs there any way to write the code in other faster way, or if there is any thing else I can do?\n\nmany thanks in advance," ]
[ "php", "performance" ]
[ "Newtonsoft.Json.JsonReaderException: Could not convert string to DateTime:", "I am trying ton insert some date into my local database. I am getting an error:\n\n\n {Newtonsoft.Json.JsonReaderException: Could not convert string to DateTime: 20-09-1982 12:00:00. Path '[0].BIRTHDAY', line 1, position 71.\n\n\nHere is my code:\n\nvar insertdata = new ClientIndividualTable\n{\n COID = item.COID,\n CLIENTID = item.CLIENTID,\n BIRTHDAY = Convert.ToDateTime(item.BIRTHDAY)\n};\n\nawait DefaultSettings.conn.InsertOrReplaceAsync(insertdata);\n\n\nI also tried still getting the error:\n\nDateTime.Parse(item.BIRTHDAY)\n\n\nhow can I fix and avoid this in the future?" ]
[ "c#", "sqlite", "xamarin" ]
[ "Verify a X.509 certificate with Java ME and Bouncy Castle", "Can anybody point me to an example of verifying a X.509 certificate with Bouncy Castle under Java ME?\nI can see how to easily do this in Java SE code with java.security.cert.Certificate.verify(), but I could not find an equivalent method in the lightweight BC API.\n\nThanks in advance!\n\nCheers\nDino" ]
[ "java-me", "x509certificate", "bouncycastle" ]
[ "Soa design for multiple data source", "In a way to improve my service oriented architecture understanding, I am building a system to manage the follow up of clients.\n\nClients api\n\nLike you see , It could have an infinite numbers of clients web services. Theirs roles are only to retrieve client data. Because they are different, they do not share any common communication interface and do not return data in a same format.\n\nClientToFollowAdapter\n\nThis is the web service that will know how to consume different clients web service, manage the authentication with them. Another role will be to receive data from any client api\nand parse it in a common format consumable by the follow up web service itself\n\nThe question:\n\nIs it an known pattern and what do you think about it?" ]
[ "web-services", "rest", "soap", "architecture", "soa" ]
[ "Two ways of calling default constructor", "I have the following code: \n\nstruct B\n{\n //B() {}\n int x;\n int y;\n};\n\nvoid print(const B &b) \n{\n std::cout<<\"x:\"<<b.x<<std::endl;\n std::cout<<\"y:\"<<b.y<<std::endl;\n std::cout<<\"--------\"<<std::endl;\n}\n\nint main()\n{\n B b1 = B(); //init1\n B b2; //init2\n\n print(b1);\n print(b2);\n\n return 0;\n}\n\n\nWhen I start program (vs2008, debug) I have the following output:\n\nx:0\ny:0\n--------\nx:-858993460\ny:-858993460\n--------\n\n\nAs you can see b1.x and b1.y have 0 value. why? What's difference between init1 and init2?\n\nWhen I uncomment B constructor I have the following output:\n\nx:-858993460\ny:-858993460\n--------\nx:-858993460\ny:-858993460\n--------\n\n\nCan somebody explain the reason of this behaviour?\nTnx in advance." ]
[ "c++", "constructor" ]
[ "\"Hiding\" System Cursor", "BACKGROUND:\n\n\nI'm trying to create a \"mouse hiding\" application that hides the user's mouse from the screen after a set amount of time.\nI've tried many things, and using SetCursor only hides the mouse from the current application, mine must be able to sit in the tray (for example) and still function.\nI think I've found a solution with SetSystemCursor except for one problem.\n\n\nMY PROBLEM:\n\n\nI need to be able to capture any kind of mouse cursor, and replace the exact same kind of mouse cursor.\nWhen replacing the mouse, I need to provide the id of the type of mouse I'd like to replace with the mouse referenced by the handle, but none of the functions I'm using provide me with the copied mouse's id (or type). \n\n\nMY QUESTION:\n\n\nWould it be sufficient to continue doing it this way, but move the mouse to 0,0 first, hiding it, and moving it back to it's original location upon un-hiding? (Unhiding is accomplished by simply moving the mouse)\nWould a mouse at 0,0 always be an OCR_NORMAL mouse? (The standard arrow.)\nIf not, how could the mouse type/id be found to enable me to replace the proper mouse with the proper handle?\n\n\nSOURCE:\n\n[DllImport(\"user32.dll\")]\npublic static extern IntPtr LoadCursorFromFile(string lpFileName);\n[DllImport(\"user32.dll\")]\npublic static extern bool SetSystemCursor(IntPtr hcur, uint id);\n[DllImport(\"user32.dll\")]\nstatic extern bool GetCursorInfo(out CURSORINFO pci);\n\n[StructLayout(LayoutKind.Sequential)]\npublic struct POINT\n{\npublic Int32 x;\npublic Int32 y;\n}\n\n[StructLayout(LayoutKind.Sequential)]\nstruct CURSORINFO\n{\npublic Int32 cbSize; // Specifies the size, in bytes, of the structure. \n// The caller must set this to Marshal.SizeOf(typeof(CURSORINFO)).\npublic Int32 flags; // Specifies the cursor state. This parameter can be one of the following values:\n// 0 The cursor is hidden.\n// CURSOR_SHOWING The cursor is showing.\npublic IntPtr hCursor; // Handle to the cursor. \npublic POINT ptScreenPos; // A POINT structure that receives the screen coordinates of the cursor. \n}\n\nprivate POINT cursorPosition;\nprivate IntPtr cursorHandle;\nprivate bool mouseVisible = false;\nprivate const uint OCR_NORMAL = 32512;\n\n//Get the current mouse, so we can replace it once we want to show the mouse again.\nCURSORINFO pci;\npci.cbSize = Marshal.SizeOf(typeof(CURSORINFO));\nGetCursorInfo(out pci);\ncursorPosition = pci.ptScreenPos;\ncursorHandle = CopyIcon(pci.hCursor);\n\n//Overwrite the current normal cursor with a blank cursor to \"hide\" it.\nIntPtr cursor = LoadCursorFromFile(@\"./Resources/Cursors/blank.cur\");\nSetSystemCursor(cursor, OCR_NORMAL);\nmouseVisible = false;\n\n//PROCESSING...\n\n//Show the mouse with the mouse handle we copied earlier.\nbool retval = SetSystemCursor(cursorHandle, OCR_NORMAL);\nmouseVisible = true;" ]
[ "c#", "winapi", "mouse" ]
[ "Collect resources (ie. properties files) for Install4J from remote machines", "I need to collect a property file from a remote machine for my software to be installed using Install4J. Does Install4J provide functionality to collect/transfer files from remote locations to the local environment to proceed through installation?" ]
[ "install4j" ]
[ "Using the result of a Jquery function and save to PHP variable", "I have a small script that returns the width and height of my Window, what I need is to save the result to a PHP session variable.\n\nMy script\n\nvar viewportwidth;\nvar viewportheight;\n\n\nif (typeof window.innerWidth != 'undefined')\n{\n viewportwidth = window.innerWidth,\n viewportheight = window.innerHeight\n}\n\n\nlike \n\n$_SESSION['w'] = viewportwidth\n$_SESSION['h'] = viewportheight\n\n\nIs this possible?" ]
[ "php", "jquery" ]
[ "trigger click event of div manually", "i have a div which has many divs.when binding the divs i create click event for each item like below\n\n jQuery.each(opts.items, function (i, item)\n {\n var image = opts.image;\n jQuery('jQuery('<div class=\"' + opts.optionClassName + opts.controlId + '\" id=\"' + item.key + '\" ><img src=\"' + image + '\" alt=\"checkbox\" />' + item.value + '</div>')\n .click(function ()\n {')\n .click(function ()\n {\n\n //code goes here\n\n }\n\n\nwhen the div is clicked in UI this gets triggered, but when i try to do it manually it does not get triggered. any help on how to trigger would be great.\ni hardcoded the div values and tried to call but it is of no use.\n\n var id1 = 'Car';\n var id2 = 'Bus';\n $('div class=\"CList\" id=\"1\" >' + id1 + '</div>').trigger('click');\n $('div class=\"CList\" id=\"3\" >' + id2 + '</div>').trigger('click');\n\n\neven this\n\n var id1 = 'Car';\n var id2 = 'Bus';\n $('div class=\"CList\" id=\"1\" >' + id1 + '</div>')[0].click();\n $('div class=\"CList\" id=\"3\" >' + id2 + '</div>')[0].click();" ]
[ "jquery", "events" ]
[ "Load class dependencies in the same package (not showing on import statement)", "I made class implementation that packaging the needed classes and send it to execute on server.\n\nI did a method using org.reflections that allows me to load all needed classes to this job. I generate a jar file with this classes and it will be executed on server by a web service. This is already done.\n\nBut, I have a situation where occurs a problem that I cannot solve until now.\n\nEx:\n\npackage com.marciob.applications.report.generator;\n\nimport com.marciob.applications.onleague.model.Team;\n\nclass MyJob implements Job {\n\n public void execute(Team team) {\n ...\n }\n\n}\n\npackage com.marciob.applications.onleague.model;\n\nclass Team {\n\n private List<Player> players;\n\n // getters and setters\n\n}\n\n\nWhen I generate the jar file, there is a MyJob and Team class, but the class Player that is needed by Team class is not found as a dependency because is not found in import statement of Team class.\n\nAnyone knows a way to do this? Find all needed classes, including that was is not indicated in import statement because is in the same package?" ]
[ "java", "reflection", "static-analysis" ]
[ "cannot set checked of undefined (saving checkboxs w/ localStorage)", "I am saving my checkbox states with localStorage, then re-rendering them later (when button is clicked) the below seems to be working for the most part; except it's erroring in my load function with 'cannot set checked of undefined'. \n\nNote my checkboxes don't come from standard HTML mark-up they are dynamically invoked with javascript - perhaps there's a better way then using input.checked?\n\nfunction checkSaver() { \n user = JSON.parse(localStorage.getItem(user));\n\n var inputs = document.querySelectorAll('input[type=\"checkbox\"]');\n user.userAchkData = [];\n\n inputs.forEach(function(input){\n user.userAchkData.push({ id: input.id, checked: input.checked });\n });\n\n localStorage.setItem(username, JSON.stringify(user));\n console.log(JSON.stringify(user));\n\n}\n\n\n\n\nfunction load_() { \n // get saved latest checkbox states, recheck\n user = JSON.parse(localStorage.getItem(user));\n var inputs = user.userAchkData;\n\n inputs.forEach(function(input){ \n document.getElementById(input.id).checked = input.checked; // erroring here, cannot set checked of undefined\n });\n\n\n\n\nFull error: (although it is actually checking the boxes?) Derives from after the = sign above. Any pointers?\n\nUncaught TypeError: Cannot set property 'checked' of null\n at eval (eventHandlers.js:339)\n at Array.forEach ()\n at load_ (eventHandlers.js:338)" ]
[ "javascript", "ecmascript-6", "local-storage" ]
[ "C# - array index vs LINQ?", "What, if any, would be the performance difference between these?\n\n/// option 1\nstring result = data.Split('.').Last<string>();\n\n\n/// option 2\nstring[] parts = data.Split('.');\nstring result = data[data.Length-1];\n\n/// option 3\nstring result = data.Substring(data.LastIndexOf('.')+1);\n\n\nAssume that data is a string in the format of part1.part2.part3.\n\nEdit\n\nThis is really more idle curiosity than anything else. I haven't cracked open reflector to see what's happening inside of LINQ, but I don't see how it could be faster than direct array manipulation. Thanks for the tips." ]
[ "c#", "arrays", "linq", "performance" ]
[ "Get first days in a month with year input and first day input", "Here is my code so far. I think I am going about it all wrong.\nHelp would be appreciated:\n\nInput for year is 2013;\ninput for day is 2 (to signify Tuesday)\n\npublic class firstMonthDay {\n\n public static void main(String[] args) {\n\n Scanner input= new Scanner(System.in);\n\n System.out.print(\"Enter Year:\"); \n int year = input.nextInt();\n\n System.out.print(\"Enter day of the week:\"); \n int inputDay = input.nextInt();\n\n int firstday=0; \n int daysInMonth=0; \n int month =0;\n\n for (int i=1; i<=365; i++){\n\n switch(daysInMonth){\n\n case 1: daysInMonth += 31 ;\n case 2: daysInMonth += 28 ;\n case 3: daysInMonth += 31 ; \n case 4: daysInMonth += 30 ; \n case 5: daysInMonth += 31 ; \n case 6: daysInMonth += 30 ; \n case 7: daysInMonth += 31 ; \n case 8: daysInMonth += 31 ; \n case 9: daysInMonth += 30 ; \n case 10: daysInMonth += 31 ; \n case 11: daysInMonth += 30 ; \n case 12: daysInMonth += 31 ;\n break;\n default:\n\n\n switch( firstday=daysInMonth-inputDay%7){\n case 1:System.out.print(\"Monday\");break;\n case 2:System.out.print(\"Tuesday\");break;\n case 3:System.out.print(\"Wednesday\");break;\n case 4:System.out.print(\"Thursday\");break;\n case 5:System.out.print(\"Friday\");break;\n case 6:System.out.print(\"Saturday\");break;\n case 7:System.out.print(\"Sunday\");break;\n default:\n\n while (month<12){ \n month++;\n switch(month){\n case 1: System.out.println(\"January\");break;\n case 2: System.out.println(\"Febuary\");break;\n case 3: System.out.println(\"March\"); break;\n case 4: System.out.println(\"April\");break;\n case 5: System.out.println(\"May\");break;\n case 6: System.out.println(\"June\");break;\n case 7: System.out.println(\"july\");break;\n case 8: System.out.println(\"August\");break;\n case 9: System.out.println(\"September\");break;\n case 10: System.out.println(\"October\");break;\n case 11: System.out.println(\"November\");break;\n case 12: System.out.println(\"December\");break;\n default:\n\n }\n }\n }\n }\n System.out.println(\"the first day of\"+month+\"is:\"+firstday);\n }\n } \n}\n\n\nthe results should be\n\n\"the first day of january is tuesday\"\n......\n\"the first day of december is Sunday\"" ]
[ "java", "date", "java-8" ]
[ "Error: Invalid Unity Web File (Decompression Failure)", "I am getting this error while trying to load asset bundles from server:\n\n\n Exception: WWW download had an error:Invalid Unity Web File (Decompression Failure). URL: http://uehelp.com/testapps/pgift/asset-bundles/test02\n NonCachingLoadExample+<Start>c__Iterator1.MoveNext () (at Assets/AssetBundlesTest/NonCachingLoadExample.cs:11)\n\n\nWhen I load the asset bundles from my local machine, it works fine." ]
[ "unity3d", "assets" ]
[ "Algorithm for best-effort classification of vector", "Given four binary vectors which represent \"classes\":\n\n[1,0,0,0,0,0,0,0,0,0]\n[0,0,0,0,0,0,0,0,0,1]\n[0,1,1,1,1,1,1,1,1,0]\n[0,1,0,0,0,0,0,0,0,0]\n\n\nWhat methods are available for classifying a vector of floating point values into one of these \"classes\"?\n\nBasic rounding works in most cases:\n\nround([0.8,0,0,0,0.3,0,0.1,0,0,0]) = [1 0 0 0 0 0 0 0 0 0] \n\n\nBut how can I handle some interference?\n\nround([0.8,0,0,0,0.6,0,0.1,0,0,0]) != [1 0 0 0 0 1 0 0 0 0]\n\n\nThis second case should be a better match for 1000000000, but instead, I have lost the solution entirely as there is no clear match.\n\nI want to use MATLAB for this task." ]
[ "matlab", "machine-learning", "classification" ]
[ "Error during file write in simple PHP caching", "I made a simple database driven php website. Now i am trying to implement some simple caching to the site. i tried this from somewhere\n\n<?php\n $reqfilename=\"test\";\n $cachetime = 60*5; // 5 minutes\n $cachefile = \"cache/\".$reqfilename.\".html\";\n $cf2=\"cache/\".$reqfilename.\"2.html\";\n if (file_exists($cachefile) && ((time() - $cachetime) < filemtime($cachefile))) \n { \n include($cachefile);\n exit;\n }\n ob_start(); \n?>\nCONTENT OF THE PAGE GOES HERE\n<?php \n $fp = @fopen($cf2, 'w'); \n if($fp){\n fwrite($fp, ob_get_contents());\n fclose($fp); \n rename($cf2,$cachefile);\n } \n ob_end_flush(); \n?>\n\n\nBut what if the cache file is being renamed and someone requests the page. Will there be an error displayed or just the user will experience a delay?\n\nTo reduce the time of the cache file being modified only, I am using rename instead of directly writing on the original cache file\n\nCorrect code to do this (based on answer by webbiedave below)\n\n<?php\n $reqfilename=\"test\";\n $cachetime = 60*5; // 5 minutes\n $cachefile = \"cache/\".$reqfilename.\".html\";\n\n if (file_exists($cachefile) && ((time() - $cachetime) < filemtime($cachefile))) \n { \n include($cachefile);\n exit;\n }\n ob_start(); \n?>\nCONTENT OF THE PAGE GOES HERE\n<?php \n $fp = @fopen($cachefile, 'w'); \n if (flock($fp, LOCK_EX | LOCK_NB)) {\n fwrite($fp, ob_get_contents());\n flock($fp, LOCK_UN);\n fclose($fp); \n }\n\n ob_end_flush(); ?>" ]
[ "php", "caching" ]
[ "Why MongoDB is Consistent not available and Cassandra is Available not consistent?", "Mongo\n\nFrom this resource I understand why mongo is not A(Highly Available) based on below statement\n\n\n MongoDB supports a “single master” model. This means you have a master\n node and a number of slave nodes. In case the master goes down, one of\n the slaves is elected as master. This process happens automatically\n but it takes time, usually 10-40 seconds. During this time of new\n leader election, your replica set is down and cannot take writes\n\n\nIs it for the same reason Mongo is said to be Consistent(as write did not happen so returning the latest data in system ) but not Available(not available for writes) ? \n\nTill re-election happens and write operation is in pending, can slave return perform the read operation ? Also does user re-initiate the write operation again once master is selected ?\n\nBut i do not understand from another angle why Mongo is highly consistent\nAs said on Where does mongodb stand in the CAP theorem?, \n\n\n Mongo is consistent when all reads go to the primary by default.\n\n\nBut that is not true. If under Master/slave model , all reads will go to primary what is the use of slaves then ? It further says If you optionally enable reading from the secondaries then MongoDB becomes eventually consistent where it's possible to read out-of-date results. It means mongo may not be be \nconsistent with master/slaves(provided i do not configure write to all nodes before return). It does not makes sense to me to say mongo is consistent if all\nread and writes go to primary. In that case every other DB also(like cassandra) will be consistent . Is n't it ?\n\nCassandra\nFrom this resource I understand why Cassandra is A(Highly Available ) based on below statement\n\n\n Cassandra supports a “multiple master” model. The loss of a single\n node does not affect the ability of the cluster to take writes – so\n you can achieve 100% uptime for writes\n\n\nBut I do not understand why cassandra is not Consistent ? Is it because node not available for write(as coordinated node is not able to connect) is available for read which can return stale data ?" ]
[ "mongodb", "cassandra" ]
[ "SQL Server 2005 - Using Null in a comparison", "This is more of a question to satisfy my own curiosity. Given the following statement:\n\nDECLARE @result BIT\nSET @result = CASE WHEN NULL <> 4 THEN 0\n ELSE 1\n END\nPRINT @result\n\n\nWhy do i get back \"1\" instead of \"0\"\n\nChanging it to:\n\nDECLARE @result BIT\nSET @result = CASE WHEN NULL IS NULL\n OR NULL <> 4 THEN 0\n ELSE 1\n END\nPRINT @result\n\n\nCorrectly gives me back \"0\"\n\nI know NULL comparisons can be tricky, but this particular example slipped through our code review process.\n\nAny clarifications would be greatly appreciated" ]
[ "sql", "sql-server-2005", "comparison", "null" ]
[ "geodjango with mysql database", "I am developing an application with geodjango and I have been running into some difficulties. following the procedures on the official django website https://docs.djangoproject.com/en/1.11/ref/contrib/gis/tutorial/#use-ogrinfo-to-examine-spatial-data . I first used the orginfo to check spatial data I got a failed message \n\nFAILURE:\nUnable to open datasource `world/data/TM_WORLD_BORDERS-0.3.shp' with the following drivers.\n\n\nthen I followed the remaining process creating the models and the error I got when I ran migration was \n\nTraceback (most recent call last):\n File \"manage.py\", line 22, in <module>\n execute_from_command_line(sys.argv)\n File \"/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/core/management/__init__.py\", line 363, in execute_from_command_line\n utility.execute()\n File \"/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/core/management/__init__.py\", line 337, in execute\n django.setup()\n File \"/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/__init__.py\", line 27, in setup\n apps.populate(settings.INSTALLED_APPS)\n File \"/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/apps/registry.py\", line 108, in populate\n app_config.import_models()\n File \"/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/apps/config.py\", line 202, in import_models\n self.models_module = import_module(models_module_name)\n File \"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py\", line 37, in import_module\n __import__(name)\n File \"/Users/Olar/Desktop/arbithub/src/geolocation/models.py\", line 5, in <module>\n from django.contrib.gis.db import models\n File \"/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/contrib/gis/db/models/__init__.py\", line 3, in <module>\n from django.contrib.gis.db.models.aggregates import * # NOQA\n File \"/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/contrib/gis/db/models/aggregates.py\", line 1, in <module>\n from django.contrib.gis.db.models.fields import ExtentField\n File \"/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/contrib/gis/db/models/fields.py\", line 3, in <module>\n from django.contrib.gis import forms, gdal\n File \"/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/contrib/gis/forms/__init__.py\", line 3, in <module>\n from .fields import ( # NOQA\n File \"/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/contrib/gis/forms/fields.py\", line 4, in <module>\n from django.contrib.gis.geos import GEOSException, GEOSGeometry\n File \"/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/contrib/gis/geos/__init__.py\", line 18, in <module>\n HAS_GEOS = geos_version_info()['version'] >= '3.3.0'\n File \"/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/contrib/gis/geos/libgeos.py\", line 196, in geos_version_info\n raise GEOSException('Could not parse version info string \"%s\"' % ver)\ndjango.contrib.gis.geos.error.GEOSException: Could not parse version info string \"3.6.2-CAPI-1.10.2 4d2925d6\"\n\n\n. \n\nfurther codes would b supplied based on request. Kindly help with it" ]
[ "python", "django", "django-models" ]
[ "React-native fontFamily is not working as it should", "I am trying to use the custom font called times-news-roman.\nI created react-native.config.js file, here is what's inside of it\nmodule.exports = {\n project: {\n ios: {},\n android: {}, // grouped into "project"\n },\n assets: ['./assets/fonts/'], // stays the same\n};\n\nI also created my assets folder in the root of the app.\n\nI am trying to use this custom font like this:\nheaderTextLight: {\ncolor: 'black',\nfontWeight: 'bold',\nfontSize: 30,\npaddingLeft: 10,\npaddingTop: 10,\nfontFamily: 'times-new-roman',\n },\n\nBut I am getting this error:\nUnrecognized font family 'times-new-roman'\n\n\nI am using "react-native": "^0.63.3". Any suggestions please?" ]
[ "react-native" ]
[ "React conditional based on URL", "I have a navbar and a Contact button in it. I would like to change this Contact button to a Back button based on the URL.\nIf the url is localhost:5000/ then let it be Contact, if the url is localhost:5000/about then it should be Back.\nIs this possible? I'm not sure which syntax can do this.\n{localhost:5000/ && <button>Contact</button>}\n\n{localhost:5000/about && <button>Back</button>}\n\nThis is obviously incorrect, I just wonder if there is a similar approach." ]
[ "javascript", "reactjs", "react-router" ]
[ "Get the value of QML Editbox from C++", "I have created a QtQuick application with some textboxes in QML. I want to use the value of those textboxes in my c++ code. So how can I fetch those values from C++ code?" ]
[ "c++", "qt", "qml", "qtquick2", "qt-quick" ]
[ "VB.Net - Button Style Modification", "I just like to ask how this Buttonstyle is called in .net:\n\nhttp://i.stack.imgur.com/gVNuo.png\n\nAnd How do I color the borders gray?\nIt should look like in the Image." ]
[ "vb.net", "button", "styles", "themes" ]
[ "function to get only the integer", "What function I have to use to get as a Result 1 in the following expression, in SQL Server or SSRS please\n\nselect ROUND((3 - (4 * 0.32)), 1) = 1.70" ]
[ "sql-server", "reporting-services", "ssrs-2008" ]
[ "Zend / ZF2 / TableGateway update() how to process this \"hits = hits + 1\"", "I want to write a sql like this:\n\n\"Update tablename SET hits = hits + 1 WHERE id = $id\"\n\n\nIn zf2, we used TableGateway, I write the code:\n\n$this->tablenametableGateway->update(array(\n 'hits' => new Expression('hits + 1')),array(\n 'id' => $id)\n );\n\n\nBut the result is something wrong, example: \nfirst hits equal 1 , after refresh the page , hits equal 3, hits increase 2 every times, not increase 1.\n\nI don't know how to sovle this problem, need you help, thanks!" ]
[ "zend-framework2" ]
[ "how to do symmetric matrix's calculation with load balance?", "I want calculate a n x n matrix A. It is symmetric, that is A(i,j) = A(j,i)\nSuppose calculate the A(i,j) takes a long time, it will takes 1000s.\nSuppose obtain A(j,i) from A(i,j) is just data copy, it is very fast, it will takes 0.00001s.\nEach element of A(i,j) have no dependency, you can calculate anyone first if you like.\nIn order to obtain all element in matrix A fast, the symmertic attribute must be used.\nI want using n worker to calculate matrix A. Worker i calculate row i of A.\nA naive solution is\nworker 1 calculate A(1,1), A(1,2), A(1,3), ..., A(1,n)\nworker 2 calculate A(2,2), A(2,3), ..., A(2,n)\nworker 2 calculate A(3,3), ..., A(3,n)\n...\nworker n calculate A(n,n)\nthen lower triangle part can obtain by upper triangle part.\n\nThis solution leads to worker 1 needs calculate n element, but worker n only calculate 1 element. It is a load-unbalance solution.\nI am looking for a load balance solution. Could any one give some advices? Thanks for your time." ]
[ "multithreading", "algorithm" ]
[ "mockito - mock protected method in different packages", "I am writing the test case using mockito for a protected method.\n\npublic HttpResponse createPostRequest(HashMap<String, String> requestHeaders, String url, String methodName)\n {\n //some logic\n }\n\n\nmy class is in src/main/java and test case is in different package src/main/test.\nand am using the following.\n\nMockito.doReturn(mockHttpResponse).when(userServiceImpl).createPostRequest(Mockito.any(HashMap.class),\n Mockito.any(String.class),Mockito.any(String.class));\n\n\nbut it is not working. It is asking to change the method signature to public.\nPlease help on that.\n\nThanks." ]
[ "mockito", "powermockito" ]
[ "Update arraycollection from itemRenderer", "I have a have a program like following:\n\n\n [Bindable]\n private var myDP:Array = [\n {label: \"1\", selected: true},\n {label: \"2\", selected: false}\n ];\n\n </mx:Script>\n\n<mx:DataGrid dataProvider=\"{myDP}\">\n <mx:columns>\n <mx:DataGridColumn dataField=\"label\" headerText=\"Label\" />\n <mx:DataGridColumn dataField=\"selected\" itemRenderer=\"mx.controls.CheckBox\" />\n </mx:columns>\n</mx:DataGrid>\n\n\nIt works fine, but when the the checkbox is changed, the value is not updated on the arraylist. Is there a way to trigger some function when the checkbox is changed on this item renderer?" ]
[ "actionscript-3", "apache-flex" ]
[ "Add $ next to price input inputted by user", "I have a recipe website made with rails and some haml on c9.io. On the show page, I'd like to display the price that the user inputted in a simple form with a dollar sign next to it. I tried using a <p> tag, however the dollar sign appears on another line.\n\nHere is my show.html.haml file:\n\n#post_show\n%h1= @post.title\n%p.username\n Shared by\n = @post.user.name\n about\n = time_ago_in_words(@post.created_at)\n.clearfix\n .post_image_description\n = image_tag @post.image.url(:medium)\n .description= simple_format(@post.description)\n %h6 Notes:\n .notes= simple_format(@post.notes)\n %h6 Price:\n %p\n .price= (@post.price) \n\n\n .post_data\n = link_to \"Visit Link\", @post.link, class: \"button\", target: \"_blank\"\n = link_to like_post_path(@post), method: :get, class: \"data\" do\n %i.fa.fa-thumbs-o-up\n = pluralize(@post.get_upvotes.size, \"Like\")\n = link_to dislike_post_path(@post), method: :get, class: \"data\" do\n %i.fa.fa-thumbs-o-down\n = pluralize(@post.get_downvotes.size, \"Dislike\")\n %p.data\n %i.fa.fa-comments-o\n = pluralize(@post.comments.count, \"Comment\")\n - if @post.user == current_user\n = link_to \"Edit\", edit_post_path(@post), class: \"data\"\n = link_to \"Delete\", post_path(@post), method: :delete, data: { confirm: \"Are you sure?\" }, class: \"data\"\n #random_post\n %h3 Check this out\n .post \n .post_image \n = link_to (image_tag @random_post.image.url(:small)), post_path(@random_post)\n .post_content\n .title\n %h2= link_to @random_post.title, post_path(@random_post)\n\n .data.clearfix\n %p.username\n Share by\n = @random_post.user.name\n %p.buttons\n %span\n %i.fa.fa-comments-o\n = @random_post.comments.count\n %span\n %i.fa.fa-thumbs-o-up\n = @random_post.get_likes.size\n #comments\n %h2.comment_count= pluralize(@post.comments.count, \"Comment\")\n - @comments.each do |comment|\n .comment\n %p.username= comment.user.name\n %p.content= comment.content\n %h2 Share your opinion:\n = render \"comments/form\"\n\n\nAnd here is my posts' form.html.haml:\n\n %div.container\n = simple_form_for @post do |f|\n = f.input :image\n = f.input :title\n = f.input :link\n = f.input :description\n = f.input :notes\n = f.input :price\n %br\n = f.button :submit, class: \"btn btn-info\"\n\n\nHelp would be greatly appreciated.\n\nEDIT:\nSo now, I have added the following:\n\n%span .input-group-addon $ .price= (@post.price)\n\n\nHowever, the dollar sign is on the top line, and the price is on the bottom." ]
[ "ruby-on-rails", "haml" ]
[ "Which version is my SDK-X PHP Composer package?", "So I did composer update and now my dependencies updated to the latest version.\n\nI have a copy of my repo locally with the same vendor dependency - how do I find out what exact version this package is so I can update my composer.json to pull the older working version?" ]
[ "php", "composer-php" ]
[ "Set default shell binary location in Sublime Text 3", "I have installed bash 4.4.5 using brew on macOS Sierra, and use it as my primary shell. Due to SIP, I cannot simply upgrade/replace the built-in bash 3.2.57, so it's located in my /usr/local/bin/ directory.\n\nI have scripts in my .bash_profile that use bash 4.x features such as associative arrays. When I try to run any build process in Sublime Text 3, it is loading the system built-in bash instead of my custom installed bash, and spits our errors every time. Is there any setting or other way of changing which shell Sublime uses?\n\nMight be useful:\n\n$ which -a bash\n/usr/local/bin/bash\n/bin/bash\n$ bash --version\nGNU bash, version 4.4.12(1)-release (x86_64-apple-darwin16.3.0)\n$ which -a sh\n/usr/local/bin/sh\n/bin/sh\n$ sh --version\nGNU bash, version 4.4.12(1)-release (x86_64-apple-darwin16.3.0)" ]
[ "bash", "sh", "sublimetext3" ]
[ "Understanding objects in a array and how the length property works on objects", "Have a look at the below code:\n\nvar a = new Array(); // or just []\na[0] = 0\na['one'] = 1;\na['two'] = 2;\na['three'] = 3;\n\nfor (var k in a) {\n if (a.hasOwnProperty(k)) {\n alert('key is: ' + k + ', value is: ' + a[k]);\n }\n}\nalert(a.length); // 1 is printed\n\n\nNow i get the following explanation for 1 being printed;\n\n\n Oddly, the length is reported to be 1, yet four keys are printed.\n That's because we are manipulating both the array elements and the\n underlying object.\n\n\nunderlying object ? excuse me , i did't quite understand , can anybody explain please? what is this underlying object ? can anybody emphasis ? please note that my question is't directly why 1 is printed but rather i am asking a slightly wider and difficult question and that is what is the underlying object ? \n\nFound the example HERE" ]
[ "javascript" ]
[ "Set ANDROID_STL in CMakeLists", "I am compiling C++ library code in Android Studio 2.2. I follow the new guide, where I add all the files to my project and compile it using CMake (and CMakeLists.txt) like this. I want to use C++14 features, and stuff like atomic, stoi etc. but the building is failing with errors.\n\nerror: no type named 'condition_variable' in namespace 'std'\nerror: no member named 'stoi' in namespace 'std'\n\n\nThis is what my CMakeLists looks like (other lines set source files and other stuff):\n\nfind_library(GLES GLESv2)\ninclude_directories(${COMMON_PATH} /usr/local/include)\nset(ANDROID_STL \"c++_shared\")\nset(CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} -std=c++14 -latomic\")\n\nadd_library(native-lib SHARED ${COMMON_SRC})\ntarget_link_libraries(native-lib ${GLES})\n\n\nI found this article on the android page (here), but I don't know how and if I can do this when using CMakeLists and not ndk-build. I see other question that solve it using the c++_static runtime but only with ndk-build." ]
[ "android", "c++", "android-ndk", "cmake" ]
[ "svg-android on 4.1.2 or 5.0 doesn't draw", "I'm trying to display an SVG image in my Android 4.X APP (I've debugged it on my Nexus7 Android 5.0 and my Moto. Razr i Android 4.1.2). I'm using svg-android. I think I've tried everything..\n\nHere's my code:\n\n@Override\nprotected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n\n ImageView imageView = new ImageView(this);\n SVG svg = SVGParser.getSVGFromResource(getResources(), R.raw.hsv);\n imageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);\n imageView.setImageDrawable(svg.createPictureDrawable());\n setContentView(imageView);\n}\n\n\nAnd that's the result." ]
[ "android", "svg", "imageview" ]
[ "Variable not defined issue with a simple GUI program", "I'm following the examples in our text and I can't see any issue with the code that would cause this particular issue, it is saying lotnumsred isn't defined and I can't figure out why. Keeps returning NameError: name 'lotnumsred' is not defined.\n\nfrom tkinter import *\nimport random\ndef pickrando():\n addnumred = random.randint(1, 35)\n lotnumsred.set(addnumred)\nwindow = Tk()\nwindow.title(\"Powerball\")\nproducebutton = Button(window, text = \"Produce a Drawing\", command = pickrando())\nproducebutton.grid(padx=10, pady = 10, row = 0, column = 0, columnspan = 4, sticky = NSEW)\nlotnumsred = StringVar()\nlotnumswhite = StringVar()\nwhiteentry = Entry(window, state = \"readonly\", textvariable = lotnumswhite, width = 10)\nwhiteentry.grid(padx = 5, pady = 5, row = 1, column = 1, sticky = W)\nredentry = Entry(window, state = \"readonly\", textvariable = lotnumsred, width = 3)\nredentry.grid(padx = 5, pady = 5, row = 2, column = 1, sticky = W)\nwhitelabel = Label(window, text = \"White balls:\")\nwhitelabel.grid(padx = 2, pady = 5, row = 1, column = 0, sticky = E)\nredlabel = Label(window, text = \"Red ball:\")\nredlabel.grid(padx = 2, pady = 5, row = 2, column = 0, sticky = E)\n\nwindow.mainloop()\n\n\nShould be putting a random number in the entry field for the red number, I know that white isn't in the code atm I removed it because it was originally having the same problem and I thought it was something else. So I don't expect the white numbers to work." ]
[ "python" ]
[ "Python webapp2 serve static content", "Our team migrated a project from GAE to AWS. One component is a web application built on top of webapp2, a framework which is easy to integrate with GAE. We kept the webapp2 framework in AWS too, with some minor changes to make it work.\n\nThe web application works fine in the cloud, but I'm trying to find a way to run it on the local development machines too. When we were using the GAE environment it was an easy task because Google provides the App Engine Launcher, a tool which simulates the cloud environment very well.\n\nIn AWS we continued making some hacks in order to start the web application using App Engine Launcher, but now we want to discard it. So, I modified the python script and it starts successfully but I don't know how to serve the static content. The static files (CSS, JS) are added to the HTML templates like link rel=\"stylesheet\" type=\"text/css\" href=\"{{statics_bucket}}/statics/css/shared.css\"/, where {{statics_bucket}} is an environment variable which points to a specific Amazon S3 bucket per environment. Of course, this doesn't work on localhost because nobody is serving static content on http://localhost:8080/statics/css/shared.css for example. The Google App Engine launcher had this feature and it did all the hard job.\n\nCould somebody point out a way to achieve my goal?" ]
[ "python", "webapp2", "static-content" ]
[ "Mocking Files in Moq", "I have a model like this:\n\n public class Products\n{\n\n\n [Key]\n [DatabaseGenerated(DatabaseGeneratedOption.Identity)]\n public int Product_D { get; set; }\n\n [Required(ErrorMessage=\"Product is required\")]\n [Display(Name=\"Product Name\")]\n public string Product_Name { get; set; }\n\n [Required(ErrorMessage=\"Photo of the product is required\")]\n [Display(Name=\"Product Photo\")]\n public byte[] Product_Photo { get; set; }\n\n [NotMapped]\n public HttpPostedFileBase Image { get; set; }\n\n [Required(ErrorMessage=\"Enter the Quantity Available\")]\n [Display(Name = \"Product Quantity\")]\n public int Product_Quantity { get; set; }\n\n [Required(ErrorMessage=\"Enter the price of the product\")]\n [Display(Name = \"Product Price\")]\n public int Product_Price { get; set; }\n\n [Required(ErrorMessage = \"Choose your category\")]\n public string Category { get; set; }\n\n\n [NotMapped]\n public List<System.Web.Mvc.SelectListItem> CategoryList { get; set; }\n\n [Required(ErrorMessage = \"Choose your category\")]\n public string Gender { get; set; }\n\n\n\n [NotMapped]\n public List<System.Web.Mvc.SelectListItem> GenderList { get; set; }\n\n}\n\n\nI'm trying to Mock database and i'm adding products to my mock database,I was able to provide values for all other data types and I'm not sure how to play around with Files.\n\n public void MockRepo()\n {\n IList<Products> products = new List<Products>\n {\n new Products { Product_D = 1, Product_Name = \"C# Unleashed\",Product_Quantity = 20, Product_Price = 20 },\n new Products { Product_D = 2, Product_Name = \"ASP.Net Unleashed\",Product_Quantity = 20, Product_Price = 30 },\n new Products { Product_D = 3, Product_Name = \"Silverlight Unleashed\",Product_Quantity = 20, Product_Price = 100 }\n };\n //Mock Products using MOQ\n Mock<IProduct> mockproductrepo = new Mock<IProduct>();\n //return all products\n mockproductrepo.Setup(r => r.FindAll()).Returns(products);\n // returns products by name\n mockproductrepo.Setup(r => r.FindByName(It.IsAny<string>())).Returns(products.Single());\n //returns products by id\n mockproductrepo.Setup(r => r.FindById(It.IsAny<int>())).Returns(products.Single());\n }\n\n\nI don't think a providing the path of the image file would help me. Using File system would make my Test slow.Even If I do that, I should convert the image into Bytes . How can I deal with this ? Thanks in advance" ]
[ "asp.net-mvc", "file", "unit-testing" ]
[ "Building clean Nuget2 repository gives error", "I'm currently trying to build my own nuget repository (like nuget.org).\n\nIn order to do so, I had a look at Nuget.Server. But when running this solution it crashes at a few packages, that can be downloaded from nuget.org (e.g. opencart.entities 1.0.2). \n\nIt crashes in ServerPackageStore.cs, line 83:\n\nvar tasks = _repository\n .GetPackages()\n .Select(package => \n TryAddServerPackageAsync(allPackages, package, enableDelisting, token))\n .ToList();\n\n\nThe function where the exception is thrown is GetPackages(), a function in the nuget-package nuget.core. In order to rewrite the function, accepting thrown Exceptions and just continue, I downloaded the source code from Nuget2 and tried to build it by cloning the repo and run build.cmd:\n\nC:\\Users\\Jonathan\\Desktop\\NuGet2>.\\build.cmd\nMicrosoft (R) Build Engine version 14.0.25420.1\nCopyright (C) Microsoft Corporation. All rights reserved.\n\nTarget framework is v4.0. VisualStudioVersion is 14.0.\nC:\\Program Files (x86)\\MSBuild\\14.0\\bin\\Microsoft.Common.CurrentVersion.targets(2719,5): \nerror MSB3552: Resource file \"..\\..\\NuGet.Client\\src\\NuGet.Core\\NuGet.Frameworks\\Strings.resx\" cannot be found. \n[C:\\Users\\Jonathan\\Desktop\\NuGet2\\src\\Core\\Core.csproj]\n\n\nWhen trying to build it with Visual Studio 2015 and 2017 Community edition, the same error occurs.\n\nHow can I build the Nuget2 repo or is there maybe another way to tackle my problem with the Nuget.Server?" ]
[ "c#", "visual-studio-2015", "visual-studio-2017", "nuget", "nuget-package" ]
[ "Armadillo + BLAS + LAPACK: Linking error?", "When I try to compile example1.cpp that comes with Armadillo 2.4.2, I keep getting the following linking error:\n\n/tmp/ccbnLbA0.o: In function `double arma::blas::dot<double>(unsigned int, double const*, double const*)':\nmain.cpp:(.text._ZN4arma4blas3dotIdEET_jPKS2_S4_[double arma::blas::dot<double>(unsigned int, double const*, double const*)]+0x3b): undefined reference to `wrapper_ddot_'\n/tmp/ccbnLbA0.o: In function `void arma::blas::gemv<double>(char const*, int const*, int const*, double const*, double const*, int const*, double const*, int const*, double const*, double*, int const*)':\nmain.cpp:(.text._ZN4arma4blas4gemvIdEEvPKcPKiS5_PKT_S8_S5_S8_S5_S8_PS6_S5_[void arma::blas::gemv<double>(char const*, int const*, int const*, double const*, double const*, int const*, double const*, int const*, double const*, double*, int const*)]+0x68): undefined reference to `wrapper_dgemv_'\n/tmp/ccbnLbA0.o: In function `void arma::blas::gemm<double>(char const*, char const*, int const*, int const*, int const*, double const*, double const*, int const*, double const*, int const*, double const*, double*, int const*)':\nmain.cpp:(.text._ZN4arma4blas4gemmIdEEvPKcS3_PKiS5_S5_PKT_S8_S5_S8_S5_S8_PS6_S5_[void arma::blas::gemm<double>(char const*, char const*, int const*, int const*, int const*, double const*, double const*, int const*, double const*, int const*, double const*, double*, int const*)]+0x7a): undefined reference to `wrapper_dgemm_'\ncollect2: ld returned 1 exit status\n\n\nCan someone help? I manually installed\n\n\nlatest version of BLAS\nlapack-3.4.0\nboost-1.48.0\nlatest version of ATLAS\n\n\nI'm using Ubuntu 11.04 on the MacBook Pro 7,1 model" ]
[ "linker", "lapack", "blas", "armadillo" ]
[ "How to play mp4 via exoplayer?", "I have webview app I want to play mp4 files via exoplayer or any include in app media player instead playing in website, is that possible?" ]
[ "android", "webview", "exoplayer" ]
[ "c# Transfer file from remote machine to terminal server", "I am creating an app that will be used with terminal services, and I have created a explorer that will allow me to transfer files. this is first of all only on local machine. Is there a way that will allow me to connect to the remote machine access their common library. that would allow them to choose desktop and Documents folders.\nI have been trying to get the IP address of the remote machine by Code Projects Grabbing Information Of Terminal Services. I guess I'm really at a loss of words here, I'm not sure where to begin to start this process. any help or Ideas links would be very helpful.\n\nThanks so much!" ]
[ "c#", "terminal-services" ]
[ "Random Line Generation For pygame", "My goal is to make a retro lunar lander game using pygame. Right now I'm trying to create the background of mountains and platforms to land on. I would like for every time a new game is started the platforms and mountains be different. My idea is to draw a random number of horizontal lines with random lengths as the platform. I have a few problems with this:\n\n\nHow to make sure the horizontal lines don't overlap and are all accesible in regards of looking at it like you're landing.\nI think the best way to draw the mountains would be to connect the platforms with more lines that create triangles, but I have no idea where to begin to do that\n\n\nthe code I have been working for currently generates random lines, but I'm not sure how to develop the code further.\n\nfor platforms in range(1, random.randint(1, 10)):\n\n rand_x_start = random.randint(0, 400)\n rand_x_end = random.randint(0, 400)\n rand_y = random.randint(HEIGHT / 2, HEIGHT)\n\n pygame.draw.line(self.background, white, (rand_x_start, rand_y), (rand_x_end, rand_y), 2)\n\n\nI've tried looking through many questions and tutorials about random generation, but none are remotely close to what I'm looking for.\n\nA thought I had to fix the overlapping problem was if there was a way to \"read\" or \"see\" previously created lines and to limit drawing based on that some how...but I'm not sure of a way to do that." ]
[ "python", "random", "pygame", "procedural-generation" ]
[ "Python equivalent to Matlab [a,b] = sort(y)", "I am pretty new to the Python language and want to know how to the following\n\n(1) y = [some vector]\n(2) z = [some other vector]\n(3) [ynew,indx] = sort(y)\n(4) znew = z(indx)\n\n\nI can do lines 1,2 and 4 but line 3 is giving me fits. Any suggestions. What I am looking for is not a user written function but something intrinsic to the language itself.\nThanks" ]
[ "python", "matlab", "python-2.7" ]
[ "Calling child controller's method", "I have two controllers like this\n\n<div ng-controller=\"ParentController\">\n <div ng-controller=\"ChildController\">\n ... my grid table ..\n </div>\n</div>\n\n\njs code\n\nfunction ParentController($scope) {\n ...\n $scope.refreshBtnClicked = function() {\n //here I want to call refreshGrid method of ChildController\n }\n}\nfunction ChildController($scope) {\n ...\n $scope.refreshGrid = function() {\n ... its using some inner variables of Child controller...\n }\n}\n\n\nHow can I call it?" ]
[ "angularjs" ]
[ "Is it possible to profile Tensorflow with Tensorboard in Azure Databricks?", "I have a Tensorflow model in an Azure Databricks notebook and I have setup Tensorboad to visualise metrics from it. I would also like to be able to profile training but if I try to capture a profile from localhost:6009 it fails. Is it possible to do this in Azure Databricks?" ]
[ "azure", "tensorflow", "azure-databricks" ]
[ "How to hide label in edge in visjs graph?", "I would like to display label only when edge is selected, is there a library method to do this?\n\nEventually I thought about having a store for edge properties including label, is this a good idea?" ]
[ "javascript", "canvas", "vis.js" ]
[ "How to change button text in a user control using constructor c#?", "i have made this user control which contain a Button \n\nusing System.Windows.Forms;\nnamespace test2\n{\npublic partial class testme : UserControl\n{\n public testme()\n {\n InitializeComponent();\n }\n public testme(string x)\n {\n button1.Text = x;\n }\n}\n}\n\n\nthen i'm trying to change the button in user control using contructor \n\nusing System;\nusing System.Windows.Forms;\nnamespace test2\n{\npublic partial class Form1 : Form\n{\n public Form1()\n {\n InitializeComponent();\n }\n\n private void button1_Click(object sender, EventArgs e)\n {\n\n testme v = new testme(\"New Text\");\n\n}\n}\n}\n\n\nbut when i click at button1 in run time i get this error message \n Object reference not set to an instance of an object" ]
[ "c#", ".net", "winforms", "user-controls" ]
[ "How i can do a onclick for elements with editable attribute inside a iframe?", "I want to start a function by click on a element inside a iframe (ID:#iframe), which has the "contenteditable" attribute.\nFor inpage-my code works fine, but it doesn't work with the iframe.\nWhat do I have to change that this code works with a iframe too?\n$(document).on('click','[contenteditable]',function(e) { ... })\n\nThanks for helping and explaining!" ]
[ "javascript", "jquery" ]
[ "Can't change or remove grey background with material-ui", "I have a simple React app that uses material-ui. No matter what I try, I cannot remove a grey background from a section of an app.\n\nTried:\n\nbody {\n background-color: #ffffff !important; \n}\n\n* {\n background-color: #ffffff !important; \n}\n\n\nNo matter what I do, I cannot make the main container white. It always goes grey. I've searched my app and all css for this background-color and cannot find it...I cannot determine what is causing this grey background." ]
[ "css", "reactjs", "material-ui" ]
[ "Log4j2's PatternLayout skips patterns in brackets", "I can't seem to be able to print the following pattern properly [%level] %message%exception%n. Everytime I invoke it, it only prints the %message and the %exception (and the %n). What do I need to do to have the %level being print between brackets?\n\nHere's my Log4j2 configuration:\n\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Configuration>\n <Appenders>\n <Console name=\"Console\" target=\"SYSTEM_OUT\">\n <PatternLayout pattern=\"[%level] %message%exception{short}%n\"/>\n </Console>\n </Appenders>\n <Loggers>\n <Root level=\"trace\">\n <AppenderRef ref=\"Console\"/>\n </Root>\n </Loggers>\n</Configuration>\n\n\nAnd here's a unit test that shows the issue:\n\nimport org.apache.logging.log4j.LogManager;\nimport org.junit.Test;\npublic class Log4j2Test {\n @Test public void testLogging() {\n LogManager.getLogger().info(\"expecting [INFO]\", new RuntimeException());\n }\n}\n\n\nThe result of this test is the following:\n\nRunning Log4j2Test\nexpecting [INFO] java.lang.RuntimeException\n at Log4j2Test.testLogging(Log4j2Test.java:19)\nTests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.453 sec\n\n\nSo what am I doing wrong?\n\nEdit: here's the pom.xml I used. Just change the version to 2.1 or 2.2, it's the same.\n\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n <modelVersion>4.0.0</modelVersion>\n <groupId>be.fror</groupId>\n <artifactId>tmp</artifactId>\n <version>0.0.1-SNAPSHOT</version>\n <packaging>jar</packaging>\n <properties>\n <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\n <maven.compiler.source>1.8</maven.compiler.source>\n <maven.compiler.target>1.8</maven.compiler.target>\n </properties>\n <dependencies>\n <dependency>\n <groupId>org.apache.logging.log4j</groupId>\n <artifactId>log4j-api</artifactId>\n <version>2.0.1</version>\n </dependency>\n <dependency>\n <groupId>org.apache.logging.log4j</groupId>\n <artifactId>log4j-core</artifactId>\n <version>2.0.1</version>\n </dependency>\n <dependency>\n <groupId>junit</groupId>\n <artifactId>junit</artifactId>\n <version>4.12</version>\n <scope>test</scope>\n </dependency>\n </dependencies>\n</project>" ]
[ "java", "log4j2" ]
[ "Boolean operator code not working for me in python, trying to create a \"true - true\" response but it is not working", "I am trying to write an expression that prints a statement if both the variables are True\nI chose the "and" Boolean operator as it requires both statements to be true but the code fails my tests\nHere is my code:\nwrite an expression that prints "You must be rich!" if the variables young and famous are both true\nyoung = (input() == 'True')\n\nfamous = (input() == 'True')\n\nif (young == 'True') and (famous == 'True'):\n print('You must be rich!')\nelse:\n print('There is always the lottery...')" ]
[ "python", "boolean" ]
[ "Jinja won't print out object or iterate through list", "So, i'm passing my json object through render_template (flask) into my .html page and using jinja with the following code, I want to create table rows in my table:\n\n{% if showData %}\n\n <table class=\"table table-striped\">\n <thead class=\"thead-light\">\n <tr>\n <th scope=\"col\">#</th>\n <th scope=\"col\">Performer Name</th>\n <th scope=\"col\">Twitter Handle</th>\n </tr>\n </thead>\n <tbody>{{showData}}\n {% for performer in showData.performers %}\n <tr>\n <th scope=\"row\">1</th>\n <td>{{performer}}</td>\n <td>@mdo</td>\n </tr>\n {% endfor %}\n </tbody>\n </table> \n {% endif %}\n\n\nIf I print out the object 'showData' (as you can see done in the code with {{showData}}), it will print out the entire json, which looks like this:\n\n[{u'category': u'Comedy', u'rating': 5, u'name': u'first show', u'img': u'firstshow.jpg', u'performers': [u'Bob bob', u'Alex alex', u'James james'], u'url': u'first_show', u'venue': 2, u'viewTimes': [u'12:00', u'14:00', u'16:00'], u'description': u'blah blah blah'}]\n\n\nBut if I try loop through showData.performers, it doesn't show up with anything. Even if I try to print out showData.name, it's empty\n\nAny ideas why? Cheers" ]
[ "python", "flask", "jinja2" ]
[ "Outer Join returning NULL even when value present", "I'm trying to create a table where i can see an airport code and its corresponding country and region etc.\n\nI have compiled a table with all the airport codes, countries, and regions; however i seem to be getting some null values back (even though i know they are included in the joined table. \n\nfor instance the airport code 'HKG' will pull 'Hong Kong' for a row and then all of the sudden in another row (which is also 'HKG') it joins the country as NULL instead of Hong Kong....\n\nAny help would be greatly appreciated\n\nHere is my join:\n\n FROM\n [dbo].[GS_TB_2G] [Data]\n Left Outer JOIN [dbo].[Gateway_Detail] [OrigC]\n ON [Data].[OrigGateway] = [OrigC].[code]\n Left Outer JOIN [dbo].[Gateway_Detail] [DestC]\n ON [Data].[DestGateway] = [DestC].[code]\n --Left Outer JOIN [dbo].[AWB_SECT_INFO] [Carrier]\n -- ON [Data].[awb_seq] = [Carrier].[awb_seq]\n\n\nThe full Query is seen below\n\n set @report_yr = 2014 --Enter the Year you wish to run the report for\n set @report_Mth = 12 --Enter the Month you wish to run the report for\n\n SELECT\n Table1.[awb_prefix],\n Table1.[Origin],\n Table1.[Origin_2],\n Table1.[Origin_3],\n [Origin_4] = 'WW',\n Table1.[Destination],\n Table1.[Destination_2],\n Table1.[Destination_3],\n [Destination_4] = 'WW',\n Table1.[Mth],\n Table1.[yr],\n Table1.[Customer],\n sum (Table1.[Gross_Rev]) as [Gr Revenue],\n sum (Table1.[CHW]) as [Ch Weight]\n\n FROM (\n SELECT\n CASE\n WHEN [Data].[OrigGateway] IS NULL THEN [Data].[overall_orig] ELSE [Data].[OrigGateway]\n END AS [Origin],\n [OrigC].[country] AS [origin_2],\n [OrigC].[region] AS [origin_3],\n CASE\n WHEN [Data].[DestGateway] IS NULL THEN [Data].[overall_dest] ELSE [Data].[DestGateway]\n END AS [Destination],\n [DestC].[country] AS [Destination_2],\n CASE \n WHEN [DestC].[region] IS NULL THEN 'OTHER' ELSE [DestC].[region] \n END AS [destination_3],\n [Data].[Mth],\n [Data].[yr],\n [Data].[Forwarder] AS [Customer],\n CASE\n WHEN [Data].[Cal_Gross_Revenue] <0 THEN 0 ELSE [Data].[Cal_Gross_Revenue]\n END AS [Gross_Rev],\n [Data].[charge_weight] AS [CHW],\n CASE\n WHEN LEFT([Data].[AirWayBill] , 3) in ('403','369') THEN LEFT([Data].[AirWayBill],3) ELSE 'OTHER'\n END AS [awb_prefix]\n\n FROM\n [dbo].[GS_TB_2G] [Data]\n Left Outer JOIN [dbo].[Gateway_Detail] [OrigC]\n ON [Data].[OrigGateway] = [OrigC].[code]\n Left Outer JOIN [dbo].[Gateway_Detail] [DestC]\n ON [Data].[DestGateway] = [DestC].[code]\n --Left Outer JOIN [dbo].[AWB_SECT_INFO] [Carrier]\n -- ON [Data].[awb_seq] = [Carrier].[awb_seq]\n WHERE \n [IATA_code] NOT IN ('0508634','0514616')\n AND (\n ([mth] between 1 and @report_Mth AND [yr] = @report_yr)\n OR ((@report_Mth < 4) AND [Mth] between 9+@report_Mth and 12 AND [yr] = @report_yr-1)\n )\n --AND (\n -- ([Carrier].[carrier] in ('PO','3S','9S','K4','5Y','Y8') AND LEFT([Data].[AirWayBill] , 3) in ('403','369'))\n -- OR ([Carrier].[carrier] in ('PO'))\n -- )\n ) AS Table1\n\n Group By\n [awb_prefix],\n [Customer],\n [yr],\n [Mth],\n [Origin],\n [Origin_2],\n [origin_3],\n [destination],\n [destination_2],\n [destination_3]" ]
[ "null", "sql-server-2012", "outer-join" ]
[ "open_basedir restriction when parsing LESS files", "I got a warning when parsing my \"Twitter BootStrap\" files and saving them on disk in my less-cache folder.\n\n\n Warning: is_file(): open_basedir restriction in effect. File(/../../lib/bootstrap/less/reset.less.less) is not within the allowed path(s): (/var/www/vhosts/example.com/:/tmp/) in /var/www/vhosts/example.com/httpdocs/wp-content/modules/wp-less/lessc/lessc.inc.php on line 80\n\n\nI'm using (for example) @import \"../../lib/bootstrap/less/reset.less\"; in the main file that I'm parsing.\n\nThe funky thing is, that the first stylesheet gets the extension two times: reset.less.less - the other ones not. Another thing that keeps me wondering, is why the heck there's a leading / in front of the files.\n\n\n\nSome data about the environment and server:\n\n\nPHP 5.3.3\nWordpress 3.4.2\nThe WP-LESS Plugin (yes, I commit to this repo), which uses the LESSc library - which throws the error from here.\n\n\nphp.ini\n\ninclude_path = \".:..:\"\nupload_temp_dir _no value/not set_\nopen_basedir = \"/var/www/vhosts/example.com/:/tmp/\"\n\n\nThanks for any help in advance!" ]
[ "less", "file-permissions", "php", "open-basedir" ]
[ "How to dynamically define sub packages", "My goal is to come up with a spec file that defines subpackages dynamically.\n\nCurrently, I have a macro defined in the spec file so that I can call it with different parameters to generate different %package sections. Eg.\n\n%define create_pkg(n:)\\\n%package -n subpackage-%1\\\nSummary: Subpackage %1\\\n...\\\n%{nil}\n\n%create_pkg sub1\n%create_pkg sub2\n%create_pkg sub3\n\nHowever, I can only hard-code the parameters (sub1, sub2, sub3) of the create_pkg macro in the specfile. Is there a way to make the specfile read a separate file, which would contain the names of the subpackages I want? eg. subpackages.txt would have the following:\n\nsub1\nsub2\nsub3\n\nand the spec file would read subpackages.txt and call %create_pkg with the names read from the txt file." ]
[ "linux", "rpm", "rpmbuild", "rpm-spec" ]
[ "In which language are the Java compiler and JVM written?", "In which languages are the Java compiler (javac), the virtual machine (JVM) and the java starter written?" ]
[ "java", "jvm", "javac" ]
[ "How do I call an ArrayAdapter object's function from my main activity?", "I have an object called Score that I'm using in an ArrayAdapter. How do I call the functions that are defined within it? Below is my main activity including the line I'm trying to fix. \n\npublic class ScoreList extends Activity {\n\n private ListView listViewScore;\n private Context ctx;\n\n ArrayList<Integer> allScoreChange = new ArrayList<Integer>();\n ArrayList<Integer> allScore = new ArrayList<Integer>(); \n\n @Override\n public void onCreate(Bundle savedInstanceState) {\n\n super.onCreate(savedInstanceState);\n setContentView(R.layout.score_list);\n ctx = this;\n final List<Score> listScore = new ArrayList<Score>();\n listScore.add(new Score(\"Player A\", \"0\", \"0\"));\n listScore.add(new Score(\"Player B\", \"0\", \"0\"));\n listScore.add(new Score(\"Player C\", \"0\", \"0\"));\n\n for(int i = 0; i < listScore.size(); i++)\n {\n allScoreChange.set(i,0);\n allScore.set(i,listScore.getScoreTotal(i)); // this is the line I'm working on\n }\n }\n\n}\n\n\nBelow is the Score object itself with the function.\n\npublic class Score {\n\n private String name;\n private String scoreChange;\n private String scoreTotal;\n\n public Score(String name, String scoreChange, String scoreTotal) {\n super();\n this.name = name;\n this.scoreChange = scoreChange;\n this.scoreTotal = scoreTotal;\n }\n\n public String getScoreTotal() {\n return scoreTotal;\n }\n\n}" ]
[ "android", "function", "arraylist", "android-arrayadapter" ]
[ "How to apply a special operator to a list?", "The following test is rejected:\n\nCL-USER> (apply 'and '(t t t))\n; Evaluation aborted on #<CCL::CALL-SPECIAL-OPERATOR-OR-MACRO #x3020013A1F3D>\n\n\nMy first reply was trying to encapsulate the call to the and special operator into a lambda or defining my own definition, but of course it can't work. Since it would results in calling the apply function for 'and on the &rest parameter... How would you tackle the issue?" ]
[ "lisp", "common-lisp" ]
[ "Firebase Security rules for admin to write and read everything in database", "i am trying to allow my self to be able to read and write everything in the database.\n\ni am getting a read denied error when trying to run this in the firebase simulator.\n\n{\n \"rules\": {\n\n \".read\": \"root.child('Admin').child('isAdmin').child('+$AUID').val() === true\",\n\n \"Admin\": {\n \"isAdmin\": {\n \"$AUID\": {\n\n \".read\": \"$AUID === auth.uid\",\n \".write\": \"$AUID === auth.uid\",\n \".validate\": \"newData.hasChildren(['active'])\",\n\n \"active\": {\n\n \"active\": \"true\"\n },\n },\n },\n },\n}" ]
[ "firebase", "firebase-realtime-database", "firebase-security" ]
[ "Is there any way to use SSLContext with ServerSocketChannel?", "I have an application which I need to use ServerSocketChannel and SocketChannel within, but SSLContext gives me ServerSocketFactory which gives ServerSocket and accepts connections in Sockets.Any solutions? Thanks" ]
[ "java", "sockets", "ssl", "serversocket", "sslcontext" ]
[ "Changing Grails SDK in IntelliJ IDEA Doesn't Work on Plugin Modules", "IDEA 11.1.2\n\nI have a Grails app I need to upgrade. The application consists of several modules. One being the application and a few others being plugins. I right clicked on the application and went to Grails -> Change SDK Version. I chose the version I wanted, then IDEA asked me if I wanted to upgrade the application. Clicked yes and all was good.\n\nI've been trying to do the same thing on the plugin modules. IDEA never asks if I want to upgrade and it doesn't appear to change the SDK. If I upgrade the modules from the command line, when I come back to IDEA, it thinks there is a version mismatch and automatically downgrades me without even asking.\n\nIs there a workaround for this?" ]
[ "grails", "intellij-idea" ]
[ "Dynamic Add Row to MVC View then pass to controller", "Okay, so I've tried a ton of things, none of which I'm very familiar with, and I can't seem to figure out exactly how to get done what I need to do. It seems like a simple task, and I'm sure someone has done it!\n\nIn essence, I need to create a form that has the ability to create more fields that will bind to the model, or even just pass to the controller on submit.\n\nFirst, I have a model that is pretty straightforward. Something like:\n\npublic class Account\n{\n public string Organization { get; set; }\n public List<UserModel> Users { get; set; }\n}\npublic class UserModel\n{\n public string UserFirstName { get; set; }\n public string UserLastName { get; set; }\n public string UserEmailAddress { get; set; }\n public bool UserIsAdmin { get; set; }\n}\n\n\nMy view is a simple signup form that takes all the input necessary to create an account. It needs to have these fields, but also be able to have a link that says \"add User\" and ajax in another row with first name, last name, email, and isAdmin flag.\n\nThis is where I get stuck. I'm thinking I need something with a partial view and a custom binding to a controller as the data gets passed in, but I can't figure out how to pass in an object that contains all the users so I can iterate through it.\n\nIf anyone could even point me in the right direction, I would be very happy.\n\n-Lost" ]
[ "c#", "ajax", "asp.net-mvc-3", "controller", "partial-views" ]
[ "Uncaught Error: Template was precompiled with an older version of Handlebars", "I'm using Bower to manage my frontend dependencies and grunt-ember-templates to precompile handlebars templates.\n\nThese are the dependencies in bower.json:\n\n\"devDependencies\": {\n \"ember\": \"~1.3.1\",\n \"jquery\": \"~2.0.3\",\n \"normalize-css\": \"~2.1.3\",\n \"jquery.cookie\": \"~1.4.0\",\n \"font-awesome\": \"~4.0.3\"\n}\n\n\n... and in package.json:\n\n\"devDependencies\": {\n \"bower\": \"~1.2.8\",\n \"grunt\": \"~0.4.2\",\n \"grunt-contrib-copy\": \"~0.5.0\",\n \"grunt-contrib-clean\": \"~0.5.0\",\n \"grunt-contrib-concat\": \"~0.3.0\",\n \"handlebars\": \"~1.3.0\",\n \"ember-template-compiler\": \"~1.4.0-beta.1\",\n \"grunt-ember-templates\": \"~0.4.18\"\n},\n\n\nHowever, when I compile and run my Ember application I get this error:\n\nAssertion failed: Ember Handlebars requires Handlebars version 1.0 or 1.1, COMPILER_REVISION expected: 4, got: 5 - Please note: Builds of master may have other COMPILER_REVISION values.\n\nUncaught Error: Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version (>= 2.0.0) or downgrade your runtime to an older version (<= 1.0.rc.2).\n\nAnd these are the versions:\n\n> Ember.VERSION\n> \"1.3.2\"\n> Handlebars.VERSION\n> \"v2.0.0-alpha.1\"\n\n\nAs you see handlebars is not mentioned explicitly as a dependency, but is rather resolved through Ember. But somehow it resolves to a newer (incompatible) version.\n\nHow do I fix the version of handlebars?" ]
[ "templates", "ember.js", "handlebars.js", "bower", "grunt-ember-templates" ]
[ "How to update JSON data", "I want to get a result of updating two json data, the second json updated existing data from first json and also it has new data as well, these are my structure:\n\nvar origin = {\n \"allTest\": [\n {\n \"testName\": \"A\",\n \"platform\": [{\"name\": \"chrome\", \"area\": [\"1\"]}]\n },\n {\n \"testName\": \"B\",\n \"platform\": [{\"name\": \"Edge\", \"area\": [\"2\"]}]\n }\n ]\n};\n\nvar updated = {\n \"allTest\": [\n {\n \"testName\": \"A\",\n \"platform\": [{\"name\": \"chrome\", \"area\": [\"1\"]}]\n },\n {\n \"testName\": \"B\",\n \"platform\": [{\"name\": \"Safari\", \"area\": [\"3\"]}]\n },\n {\n \"testName\": \"C\",\n \"platform\": [{\"name\": \"IE\", \"area\": [\"4\"]}]\n }\n ]\n}\n\nvar result = origin.allTest.concat(updated.allTest);\nconsole.log(result);\n\n\nresult: \n\n [ { testName: 'A', platform: [ [Object] ] },\n { testName: 'B', platform: [ [Object] ] },\n { testName: 'A', platform: [ [Object] ] },\n { testName: 'B', platform: [ [Object] ] },\n { testName: 'C', platform: [ [Object] ] } ]\n\n\nbut this is not the current update, i would like to update origin data like this:\n\nexpected result:\n\n{\n \"allTest\": [\n {\n \"testName\": \"A\",\n \"platform\": [{\"name\": \"chrome\", \"area\": [\"1\"]}]\n },\n {\n \"testName\": \"B\",\n \"platform\": [{\"name\": \"Edge\", \"area\": [\"2\"]},{\"name\": \"Safari\", \"area\": [\"3\"]}]\n },\n {\n \"testName\": \"C\",\n \"platform\": [{\"name\": \"IE\", \"area\": [\"4\"]}]\n }\n ]\n}\n\n\ncan you please help me to solve it. i am new in codding, thanks" ]
[ "javascript", "arrays", "json", "loops", "object" ]
[ "Create a short lived JMSProducer", "I am using ActiveMQ5.10 and spring,\n\n<bean id=\"connectionFactory\" class=\"org.apache.activemq.ActiveMQConnectionFactory\">\n <property name=\"brokerURL\" value=\"failover:(tcp://localhost:61616?wireFormat.maxInactivityDuration=120000)\" />\n</bean>\n\n<bean id=\"jmsConnectionFactory\"\n class=\"org.apache.activemq.pool.PooledConnectionFactory\"\n destroy-method=\"stop\">\n <property name=\"connectionFactory\" ref=\"connectionFactory\" />\n</bean>\n\n<bean id=\"jmsTemplate\" class=\"org.springframework.jms.core.JmsTemplate\">\n <property name=\"connectionFactory\">\n <ref local=\"jmsConnectionFactory\" />\n </property>\n <property name=\"pubSubDomain\" value=\"false\" /> \n <property name=\"deliveryMode\" value=\"2\" /> <!-- 2 implies persistent -->\n <property name=\"sessionTransacted\" value=\"false\" />\n <property name=\"timeToLive\" value=\"3600000\" />\n <property name=\"explicitQosEnabled\" value=\"true\" />\n</bean>\n\n\nI need to create a producer which will send one message and then stop itself and then create new connection and send message again.\n\nIs there a way to achieve this ?" ]
[ "spring", "activemq", "spring-jms" ]
[ "Issues with getting VoiceChannel.members and Guild.members to return a full list", "Any time I try to use VoiceChannel.members or Guild.members it does not give me a full list of applicable members. I'm grabbing both the VoiceChannel and the Guild from the context in a text command like this:\[email protected](name='followme')\nasync def follow_me(ctx):\n if ctx.author.voice != None:\n guild = ctx.guild\n tracking = ctx.author\n channel = tracking.voice.channel\n\nLater on I've tried to use the channel like this:\nfor member in channel.members:\n if member.voice.mute != True:\n await member.edit(mute=True)\n\nHowever, it's only finding my user despite having another user in the channel.\nI found that the only way I could get an accurate representation of members in the channel is using:\nchannel.voice_states.keys()\n\nUsing voice_states, I can get an accurate list of members, but only by their IDs when I still need to manipulate the member itself.\nSo I tried this:\nfor key in channel.voice_states.keys():\n member = guild.get_member(key)\n if member.voice.mute != True:\n await member.edit(mute=True)\n\nHowever, the guild isn't pulling the right set of users and despite verifying all the IDs were correct, guild.members is also not working appropriately.\nAny input on how to get this working properly would be greatly appreciated." ]
[ "python", "discord", "discord.py", "discord.py-rewrite" ]
[ "Dynamic Linq passes incorrect DateTime format to DB", "I am using Entity Framework with Dynamic Linq library.\nHave code like this\nvar myDate = new DateTime(2021, 01, 01);\nvar res = dbContext.MyEntities.Where("CreateDate < @0", myDate);\n\nIt worked well if I run same query on local collection, but on database it returns error:\n"Conversion failed when converting date and/or time from character string."\nI checked with DB Profiler and the reason is format that is passed to database. It converts date to '2021-01-01T00:00:00.0000000' instead of expected '2021-01-01 00:00:00.000' and in result have query like\nSELECT * FROM [MyEntity] AS [a]\nWHERE [a].[CreateDate] < '2021-01-01T00:00:00.0000000'\n\nthat generates an error because SQL cannot parse this string. Tried to specify parameter as string but Dynamic Linq still converts it to this format and gives the same error in result. Are there any way to fix this behavior?" ]
[ "c#", "sql", "entity-framework", "datetime", "dynamic-linq" ]
[ "TypeError: Cannot read property 'map' of undefined\" React", "I am new in React , I was following the course of React. And the code as follow appeared issue like "TypeError: Cannot read property 'map' of undefined"; Can anyone tell what's going on ? Thank you so much!\nimport React, { Component } from 'react'\n\nconst ListGroup = props => {\n const {items,textProperty,valueProperty} = props;\n return ( \n <ul className="list-group">\n {items.map(item =>(\n <li key={item[valueProperty]} className="list-group-item">\n {item[textProperty]}\n </li>\n ))}\n \n </ul>\n );\n}\n \nexport default ListGroup;" ]
[ "reactjs" ]
[ "Valid Warehousing Strategy? Type6?", "As a database user, I'm having problems interpreting the data in one of our tables at work. When I questioned the data team, the solution architects told me it was done this way on purpose because it is a \"Type 6\" table.\n\nFrom my limited googling, I think a Type 6 should look like this:\n\n+--------------+------------------+------------------+------------+------------+---------------------+\n| Customer_Key | Customer_Attrib1 | Customer_Attrib2 | Start_Date | End_Date | Record Updated Date |\n+--------------+------------------+------------------+------------+------------+---------------------+\n| 123 | 1 | A | 1/1/2001 | 6/8/2004 | 6/9/2004 |\n+--------------+------------------+------------------+------------+------------+---------------------+\n| 123 | 1 | A | 6/9/2004 | 4/11/2016 | 4/12/2016 |\n+--------------+------------------+------------------+------------+------------+---------------------+\n| 123 | 1 | A | 4/12/2016 | 4/3/2017 | 4/4/2017 |\n+--------------+------------------+------------------+------------+------------+---------------------+\n| 123 | 2 | B | 4/4/2017 | 5/18/2017 | 5/19/2017 |\n+--------------+------------------+------------------+------------+------------+---------------------+\n| 123 | 2 | B | 5/19/2017 | 12/31/9999 | 5/19/2017 |\n+--------------+------------------+------------------+------------+------------+---------------------+\n\n\nThe activity in question is the Customer_Attrib1, how it changed from 1 to 2 on 5/18/2017.\n\nI like this style because I can figure out what customer_attrib1 is at any point of time by using the start and end dates:\n\nselect customer_attrib1 \nfrom table \nwhere customer_key=123 \nand '2017-03-01' between start_date and end_date;\n\n\nHowever...\n\nThe table itself actually gets updated in arrears, to look like this:\n\n+--------------+------------------+------------------+------------+------------+---------------------+\n| Customer_Key | Customer_Attrib1 | Customer_Attrib2 | Start_Date | End_Date | Record Updated Date |\n+--------------+------------------+------------------+------------+------------+---------------------+\n| 123 | 2 | A | 1/1/2001 | 6/8/2004 | 5/19/2017 |\n+--------------+------------------+------------------+------------+------------+---------------------+\n| 123 | 2 | A | 6/9/2004 | 4/11/2016 | 5/19/2017 |\n+--------------+------------------+------------------+------------+------------+---------------------+\n| 123 | 2 | A | 4/12/2016 | 4/3/2017 | 5/19/2017 |\n+--------------+------------------+------------------+------------+------------+---------------------+\n| 123 | 2 | B | 4/4/2017 | 5/18/2017 | 5/19/2017 |\n+--------------+------------------+------------------+------------+------------+---------------------+\n| 123 | 2 | B | 5/19/2017 | 12/31/9999 | 5/19/2017 |\n+--------------+------------------+------------------+------------+------------+---------------------+\n\n\nCan you see how much trouble I have, if I want to go find what the customer_attrib1 was during March of 2016? \n\nNOTE: There is a previous_customer_attrib1 column, but it also gets mass updated to the value of 1. I wanted to keep the table small enough to get the point across, which is why I didn't add it above.\n\nThe big question: Is this a valid warehousing strategy? Is this really what Type 6 is? Or is my solution architect wrong. \n\nFollow up question: Would the answer be different if customer_attrib1 was a foreign key to another table?" ]
[ "database", "database-design", "database-schema", "etl", "data-warehouse" ]
[ "convert string [\"string\"] to string array", "I have a kind of strange problem, I am receiving from server side an compressed text that is a string array, for exemple [\"str1\",\"str2\"] or just [\"str\"]\n\nCan I convert it to an normal string array? like:\n\n String[] array;\n array[1] = \"str\";\n\n\nI know that is not a big deal to convert an simple string but not this one...Any ideas?" ]
[ "java", "android", "arrays" ]