Vote count: 0 I have defined a factory in AngularJS similar to the following: angular.module("myApp").factory(function (){ var userObject = { userID: '', email: '', }; userObject.isLoggedIn = function(){ if(userObject.email === '') retu false; else retu true; }; //more code goes here for the factory //... retu userObject; } The problem is, every time I call the isLoggedIn() function from my controllers, it retus a false. I tried if (this.userObject.email === ''), which retus the error TypeError: Caot read property 'token' of undefined in the console. This functionality works fine when I define userObject in a service. Is there some scope limitation that I'm missing? What am I doing wrong? as...
ادامه مطلبVote count: 0 I have an activity where an AsyncTask downloads from Google Places Photos an ArrayList of photos. In this Activity I was able to show them in a GridView. Now, when a user clicks in one image, a new Activity (or Fragment?) should be created, showing the clicked image in fullscreen with a swipe function, always in fullscreen. I think I can do that by passing the entire ArrayList and the position of the clicked image to my second Activity, but it could be quite inefficient. My second thought was to use LruCache, but I honestly don't know how to use it. Could you suggest some other, more efficient way to do what I want or explain me how to use LruCache for my specific problem? My A...
ادامه مطلبVote count: 0 Have a bit of problem showing error message in Spring. The classes are follow: request_new.jsp view file RequestValidator public class RequestValidator implements Validator { @Override public boolean supports(Class paramClass) { retu RequestBean.class.equals(paramClass); } @Override public void validate(Object obj, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "descCustomer", "Enter description please"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "descEmployee", "Enter description"); } } EmployeeController method that refreshes the page after "Salvesta" (save in english) is clicked @RequestMapping(value="/employee/",params = "Salvesta",method=Request...
ادامه مطلبVote count: 0 Im using Azure blob storage as my hadoop hdfs file directory. When I pass the input file from local machine to hdfs using command prompt, the content-type is being changed to 'application/octet-stream' thereby making it unsplittable. How to change the encoding of a hdfs file? asked 3 mins agoArun Sethupat Let's block ads! بخوانید...
ادامه مطلبVote count: 0 The XML file is as follows I want to deserialize this XML back into Polygon objects. My Polygon class is as follows [XmlType("Polygon")] public class Polygon { [XmlElement("Points")] public Point[] points { get; set; } } My deserialization code is XmlSerializer serializer = new XmlSerializer(typeof(Polygon[]),new XmlRootAttribute("Polygons")); FileStream fs = new FileStream(filename, FileMode.Open); XmlReader reader = XmlReader.Create(fs); Polygon[] p; p = (Polygon[])serializer.Deserialize(reader); fs.Close(); I've so far managed a workaround by creating a Point2D class with X and Y attributes and then creating Point objects using them. Is there any way to directly assign the a...
ادامه مطلبVote count: 0 I have a background image I have sliced in Photoshop and set in a CSS class called".bd-image". I reference this class in the body element because I want it to be the background image for the whole page. I want each image to be 100% and not repeat. The problem is the images are on top of one another and not spreading out on the page. I changed the width and height form the absolute value to 100%, but no success. I need proper coding to set the images. Does anyone know how to layer sliced images so they go down the page in the correct position and do not overlap? Or does anyone know of a sliced image background I can reference to get the correct coding? .bd-image{ background: url...
ادامه مطلبVote count: 0 I am new to C# rest API, I have a collection of data that is created when the user POST data into my REST api, What is the best way to keep this data in memory ? The data is stored in a c# collection. I do not have a database to store this day, it must stay in memory for the life of the application. I hope this is enough information for you guys to point me in the right direction. asked 1 min agoPacman Let's block ads! بخوانید...
ادامه مطلبVote count: 0 I have a number of images in several directories, and I want to be able to load all of the images in a specific directory. E.g., directory-1 | ---- panel-1.png | |- panel-2.png | |- panel-3.png | directory-2 | ---- panel-1.png |- panel-2.png I have a number of these directories, and there is no patte to how many panel images are in each directory. I want to load all the images in this directory. My first approach was to load images until I get a 404 error. However, this doesn't seem to work. const imagesLength = _(Array(15)).map((val, i) => { const img = new Image let valid = true img.onerror = () => { console.wa('error loading') valid = false retu false } img.onload = () => { ...
ادامه مطلبVote count: 0 In netsuite I am trying to automatically calculate the margin on the item sublist on a sales order and set a price level based off of the nearest margin and then show the cost and price level to the user. I have everything working except if the user enters in a margin, and then clicks off onto another row, then it adds the calculated average cost and price level to the row that you clicked on rather than the row the information was added to. How do I guarantee that it adds the value to the line I enter the margin in on? if(name =='custcol61' ) { var margincalcfield = nlapiGetCurrentLineItemValue('item', 'custcol61'); if( margincalcfield >0 && margincalcfield*1 == margincalcfiel...
ادامه مطلبVote count: 0 I have two databases that one affects the other one, so I wanted to see if there was a way to coect two both dbs so that one model can be associated to the other db where the other model can focus on a diff db. Currently my models look like this: var mongoose, Schema, Moduser, ObjectId, Project, bcrypt, SALT_WORK_FACTOR; mongoose = require('mongoose'); Schema = mongoose.Schema; ObjectId = mongoose.Schema.Types.ObjectId; Project = require('../models/project.js'); bcrypt = require('bcryptjs'); SALT_WORK_FACTOR = 10; Moduser = new Schema({ email: { type: String, required: true, lowercase: true, index: {unique: true}}, password: { type: String, unique: true} }, {collection: "moduse...
ادامه مطلبVote count: 0 I need to read image files in a file and store in a Mat array. To do this, I first read all the image files to a BufferedImage array (this works), and from there, I need to store the BufferedImages to a Mat array. I found many questions regarding this, but none of them seem to work. code error asked 52 secs agoChandika Ambawatte Let's block ads! بخوانید...
ادامه مطلبVote count: 0 I draw some rectangles and then erase and redraw them to simulate movement to the right. However canvas antialiasing makes them leave traces and I don't want to redraw the entire canvas. Here's what I'm talking about And here is the code for that: var canvas = document.getElementById("canvas"); canvas.width = 800; canvas.height = 600; var context = canvas.getContext("2d"); maxFps = 15; function loop(x) { setTimeout(function() { undoRect(x); drawRect(x + 30); loop(x + 30); }, 1000/maxFps); }; function undoRect(x) { context.clearRect(x, 0, 30, 30); }; function drawRect(x) { context.fillStyle = 'black'; context.fillRect(x, 0, 30, 30); }; loop(0); asked 1 min agoMeta Xenology Let's...
ادامه مطلبVote count: 0 var coector = new CoectorClient(); List participants = new List(); var tBot = new ChaelAccount { ChaelId = "telegram", Address = "9digit", IsBot = true, Id = "salodkid_bot", Name = "salodkid_bot" }; participants.Add(tBot); var tUser = new ChaelAccount { ChaelId = "telegram", Address = "9digit", IsBot = false, Id = "dsalodki", Name = "dsalodki" }; participants.Add(tUser); Message message = new Message { From = tBot, To = tUser, Participants = participants.ToArray(), Text = "Hey, what's up everyone?", Language = "en" }; var obj = coector.Messages.SendMessage(message); Unhandled Exception: Microsoft.Rest.HttpOperationException: The bot ... does not match From:... To:... what`s wro...
ادامه مطلبVote count: 0 I'm creating an S3 constructor/object/script. I have a list in my script that needs to be printed like: ID: 9876 Name: Virgil Gender: M LDL: 248* HDL: 45+ Triglycerides: 148 I defined a print function earlier. print.ChlorReads...
ادامه مطلبVote count: 0 I (too) often merge branches with significant conflicts, I do this from my IDE which is fairly helpful in resolving these, once I'm done I end up with the merge result already committed locally with any manual adjustments I made in the process. Usually I like this behaviour but I always do some smoke testing before pushing. When this fails I need to fix something, often something silly like add/remove a comma, something I should have done while resolving the merge conflicts. currently I just add an extra commit on top. I would like to go back to the state I was during the merge with all code as it is currently, make the change and finish the merge again. I would not like to und...
ادامه مطلبVote count: 0 Using ORM $timer = new Timer(); $em->persist($timer); print $timer->getId(); //blank - not yet set $em->flush($timer); print $timer->getId(); //prints ID of newly inserted record Actual ORM Code (Doctrine) public function persist($entity) { if ( ! is_object($entity)) { throw ORMInvalidArgumentException::invalidObject('EntityManager#persist()' , $entity); } $this->errorIfClosed(); $this->unitOfWork->persist($entity); } Question How does Doctrine insert insert_id into the Entity, when the ORM's code above has no "pass by reference" directive? I.e. normally I'd expect something like this: public function persist(&$entity) { ... } to indicate that the entity will be modified (with ...
ادامه مطلبVote count: 0 I was reading this decorators and fount the @withViewPort usage as : import React from 'react'; import withViewport from 'react-decorators/withViewport'; @withViewport class MyComponent { render() { let { width, height } = this.props.viewport; retu Viewport: {width + 'x' + height}; } } React.render(, document.body); How does this work @withViewPort decorator work? Does it have state and these state changes while resizing the window size? asked 44 secs agoAjay Gaur Let's block ads! بخوانید...
ادامه مطلبVote count: 0 I am just getting into Windows application development and I am trying to make a keno program. I need a way to save information regarding the game number, numbers drawn, ticket numbers, wiing tickets, etc. The amount of data being stored is going to be somewhat sizable since a new game is played every 3 minutes or so. What is the best/easiest way to store all of this data? All of my research has indicated the use of a database. I will have complete administrative control over all machines that my program is ruing on, meaning that other software can be installed. Do I need to embed a database within my Visual Basic project? A different user account (other than Admin) with VERY l...
ادامه مطلبVote count: 0 Google and stackexchange finds hit upon hit where the dlls aren't compatible. This time, they are. It's my DLL. I know full well it's compatible. The dll file is placed in lib/netstandard1.5 Nuspec file reads: redacted.dll 1.0.0-alpha joshudson joshudson https://sourcecontrol.inteal.lan http://ICON_URL_HERE_OR_DELETE_THIS_LINE false Redacted Redacted TEST Redacted Hand verifying references in ildasm yields: // Metadata version: v4.0.30319 .assembly exte System.Runtime { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?....: .ver 4:1:0:0 } .assembly exte System.Collections { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?....: .ver 4:0:10:0 } .assembly exte System.Text.Encod...
ادامه مطلبVote count: 0 I am new to C#2015. I just realized that the old classical way of adding event handlers by double-clicking on the item no longer works for some items like the form (or the Window). After some google searchs I still can't figure out a way to add the Load event of the form using the designer. Do I have to manually write code for that unlike in VB2005? Sorry for this extremly begier level question asked 1 min agoSadeepDarshana Let's block ads! بخوانید...
ادامه مطلب