Vote count: 0 I have a simple model, which is: var mongoose = require('mongoose'); var Schema = mongoose.Schema; var citySchema = new Schema({ name: { type: String, required: true }, state: { type: Schema.Types.ObjectId, ref: 'State' } }); module.exports = mongoose.model('City', citySchema); Only i access a route, asking to insert a city, giving as post params POST: { name: 'My City', state: 'SE' // Stands for Some State } I know the type of the state property is not correct, but in my logic i do: var newCity = new City(req.body); if (typeof req.body.state !== 'undefined' && req.body.state.length == 2) { State.findOne({uf: req.body.state.toUpperCase()}, function(err, foundState) { if (err) {...
ادامه مطلبVote count: -1 I have a table in a mySQL database titled 'xs' which holds a column titled 'result', which holds an array of xml values. I have converted this to json using: public function getResults(){ $xml_clean = stripslashes(trim($xs->result)); $xml = simplexml_load_string($xml_clean); if(isset($xml->Consumer)){ $result['consumer_name'] = json_encode($xml->Consumer->ConsumerName); $result['consumer_contact_no'] = json_encode($xml->Consumer->ConsumerTelephoneNo); } retu $result; } The $xml_clean variable was my attempt at removing special characters but it actually provides no use, the output is the same as without it. My output from the php view is: Name: {"0":"Jason Statham"} Contact Nu...
ادامه مطلبVote count: 0 This is My string i like to split it using special character "-" hi - नमस्ते Hindi - हिन्दी Telugu - तेलुगु how - कैसे are - हैं you - आप go - जाना going - जा रहा translate - अनुवाद करना good - अच्छा What i was tried : [strFileContent enumerateSubstringsInRange:NSMakeRange(0, strFileContent.length) options:NSStringEnumerationByWords usingBlock: ^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) { checking=substring; NSLog(@"this is my splitting values =%@",substring); }]; If i did above method each word getting separately so that continues words getting brakes for eg translate - अनुवाद करना this word getting brakes . 2)[arrcheck addObject:[strFil...
ادامه مطلبVote count: 0 here is my code : string constr = EstablishDBCoection(); string test = "test"; string sql = "INSERT INTO XX_XML_TEST (XML) VALUES ('" + test + "')"; OracleCoection con = new OracleCoection(constr); con.Open(); OracleCommand cmd = new OracleCommand(sql, con); cmd.CommandType = CommandType.Text; cmd.ExecuteNonQuery(); However i try its giving the table doesn't exist error but i have created the table in database. please help asked 54 secs agoRajeswari ML Let's block ads! بخوانید...
ادامه مطلبVote count: 0 I have a program which counts the amount of times each word is mentioned in tweets and then stores them in a hash map. A fellow stackexchange member helped me store the top 5 words in a map. Class where all work is being done: package readtweets; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import twitter4j.*; import twitter4j.conf.ConfigurationBuilder; public class ReadTweets { //change this to true to enable the print lines static boolean DEBUG = false; //Creates map of words HashMap wordMap = new HashMap(); /** * @param args the command line arguments */ public HashMap ...
ادامه مطلبVote count: 0 Using C# and .NET 4.5: I am looking for a simple and efficient option to use the windows user and current machine to encrypt/decrypt a string. The encrypted string can be decrypted on the very same machine with the same logged-in user only. Other users logged-in to the same machine must not be able to decrypt. The same user logged into another machine must not be able to decrypt. Back in 2002, I used to use DPAPI to do the similar thing. I expect there is a more mode option in 2016 with .NET 4.5 with single line of API call :) Thank you, asked 39 secs agoAllan Xu Let's block ads! بخوانید...
ادامه مطلبVote count: 0 I have displayed sample Xml data in below , If title lang ="it" then i want to get category attribute value ? Purgatorio Dante Alighieri 1308 30.00 asked 57 secs agoAntony Let's block ads! بخوانید...
ادامه مطلبVote count: 0 I've been ruing my iOS appium tests using the Appium.app without issue. I want to try using node + appium package instead but I'm ruing into the error displayed below. I've tried reinstalling node and the appium and wd packages but the issue still persists. I've allowed OSX to accept incoming coections from node as well. [Appium] Welcome to Appium v1.5.1 (REV c330ee9862bbc0db7d604e3b395cd1226417a9b9) [Appium] Appium REST http interface listener started on 0.0.0.0:4723 [HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"platformName":"iOS","platformVersion":"9.3","deviceName":"iPhone 6s","app":"/Users/User/Downloads/AppToTestSimulator.app (5).zip","autoAcceptAlerts":"false"...
ادامه مطلبVote count: 0 I'm new to VB.Net. I'm using MySqlCommandBuilder to automatically generate Insert and Update queries when some data is changed in a DataGridView. I already have a variable called user_id that stores a numerical value. THIS IS THE GOAL: I want to insert the value contained in the user_id variable into a column called id_usuario in my MySQL Database along with whatever data was inserted in a new row of the DataGridView. Here's my code: or if you prefer Check it here! Imports MySql.Data.MySqlClient Public Class Dashboard Public user_id As String ' This value has been set from another Form it contains the id of the current user Dim coectionstring As String = "Server=REMOVED;user id...
ادامه مطلبVote count: 0 I have trouble in drawing the line with arrow using d3.js. I did see some tutorials and wrote this code, but I just see the line with no arrow mark. Could anyone please look at it and tell me where am I missing. Thanks in advance. Drawing line with arrow at the end var w = 300; var h = 300; var svg = d3.select("body") .append("svg") .attr("width", w) .attr("height", h); //arrow svg.append("svg:defs").append("svg:marker") .attr("id", "triangle") .attr("viewBox", "0 -5 10 10") .attr("refX", 15) .attr("refY", -1.5) .attr("markerWidth", 6) .attr("markerHeight", 6) .attr("orient", "auto"); //line svg.append("line") .attr("x1", 100) .attr("y1", 100) .attr("x2", 200) .attr("y2", 100) ...
ادامه مطلبVote count: 0 I need a sql that uses self join on max id from first table. Please look at the following image of table. I am grouping the table by service_id but I need the last message of each group. So For service group 5 message count should be 3 and last_message should be thirdMsg5. I wrote a sql below everything else is fine but it is throwing an error in the case of self join. It can't recognize msgTbl1.last_message_id. I think I am calling it before preparing it. I need help to solve this problem what would be the best sql to solve this in one query? And if possible please provide me this query in laravel query builder format. SELECT count(msgTbl1.id) as message_count, max(msgTbl1.id)...
ادامه مطلبVote count: 0 I am new to EWS and I am trying to run my email parser console app real-time where it receives new emails. Someone suggested Push notifications but then I stumbled upon Streaming Notifications which I find easier. I based my codes here: Set streaming notifications for applications programmatically but I encountered a problem because I don't know where should I insert my codes for email parsing. Here are my codes: (Email Parsing is inside the OnEvent here) private static void Main(string[] args) { ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack; ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2); // coect to ex...
ادامه مطلبVote count: 0 I know a bit about regular expressions, but far from enough to figure out this one. I have tried to see if I could find something that could help me, but I got a hard time understanding how to construct the REGEX expression in c#. Here is what I need.If I have a string like the following. string s = "this is (a (string))" What I need is to focus on the parentheses. I want to be able to split this string up into the following List/Array "parts". 1) "this", "is", "a (string)" or 2) "this", "is", "(a (string))". Anyone got an idea of how to solve this problem? Can this be solved using REGEX? Hope someone can help. Greetings. asked 1 min agoANACoder Let's block ads! بخوانید...
ادامه مطلبVote count: 0 I'm pulling my hair out try to get LDAP authentication to work with Active Directory. We've just setup a SharePoint Server 2010 and we thought it would be a good idea to also authenticate users against the Active Directory given it's already there for SharePoint. Our environment is Windows Server 2008 R2 Standard. I have one user with useame of ahsieh@rdl.com.tw According to this answer http://serverfault.com/a/130556 my provider URL should be ldap://192.168.0.81:389/CN=Users,DC=rdl,DC=com,DC=tw (note that instead of using the hostname of vm-sps.rdl.com.tw, I've elected to use the IP address as I've not had the time to configure DNS entry for the said server) Just to be sure, I...
ادامه مطلبVote count: 0 I have just started looking at browserify and am wondering what is the recommended way to require the min versions of dependencies when building for production and the debug ones when building for development? For example, I have followed the tutorial here - http://www.sitepoint.com/getting-started-browserify/ and ended up with the following files: jsmain.js var names = require('./names.js'), findSuperman = require('./findsuperman.js'); if (findSuperman(names())) { document.write('We found Superman'); } else { document.write('No Superman...'); } jsnames.js module.exports = function () { retu ['Barry Allen', 'Hal Jordan', 'Kara Kent', 'Diana Prince', 'Ray Palmer', 'Oliver Queen'...
ادامه مطلبVote count: 0 When adding "md-floating-label" to angular material's md-autocomplete The dropdown suggestion items are overlapping the input area of the autocomplete. Note: all css used are default asked 1 min agoMakoto Lavan Let's block ads! بخوانید...
ادامه مطلبVote count: 0 I am currently using: Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click Process.Start("C:Program Files (x86)SteamsteamappscommonArma 3Arma3.exe") End Sub The problem with this is that it launches the game but doesnt coect to the server I want to. I also tried: steam://coect/216.52.148.114:2302 But it doesnt detect the game it is ruing on. (Arma 3) Help please! asked 1 min agoNitro Let's block ads! بخوانید...
ادامه مطلبVote count: 0 When searching for a book in a book store, say the object is a book, each book object would have a title, author, ISBN code etc. Say I enter an ISBN as a String using `scan.next()' I take this input and use it to find the object in the arraylist as follows: public Book searchISBN (String givenISBN){ Book foundBook = null; for(Book findISBN : bookStore){ if(findISBN.getISBN().equals(givenISBN)){ foundBook = findISBN;} } retu foundBook; I'm currently having problems with null pointer exception in the line which has the if statement. I do not understand why this is. When I include the following piece of code, which has the aim of setting any book that has a null classification equ...
ادامه مطلبVote count: 0 I'm working in a ntfs partition from my Windows 8.0 using xubuntu 15.04. And it is location at /media folder where is directory for mounting files systems on removable media. So because this my terminal look like this darleison@darleison-xubuntu:/media/darleison/923CC31E3CC2FC6B/Users/DarleisonRodrigues/Desktop/tudo3/skimage-tuto$ This folder is the C:/ at 923CC31E3CC2FC6B/ location While using my user folder darleison@darleison-xubuntu:~$ I want know if is it possible adjust the bash dot file the reference path to a short representation? asked 2 mins agoDarleison Rodrigues Let's block ads! بخوانید...
ادامه مطلبVote count: 0 I'm working with JavaFX and I want to implement a filter that is accesing data from a database. The code below access data from two tables in a database. The data is retrivied and put in a tableview, using javaFx. My problem is that the last column from the tableview remains empty. The code is ruing well, is working fine but that last column should not be empty. I must say that data for the last column comes from one table and the data for the others columns come from the other table. So, why my last column is empty? @FXML private void handleButtonAction(ActionEvent e) throws SQLException { tableFilter.getItems().clear(); DBMain.createCoection(); DBMain.setStatement(DBMain.getC...
ادامه مطلب