Menu
  • HOME
  • TAGS

Sorting a ListView by date? [closed]

android,json,listview,sorting,populate

In the spirit of having less computation processes into the Android client, I suggest you create a new method called findServicesByDate from the server, which should give you the right order based on dates. However, if this is not possible, the only thing you have to do is order the...

How to model and save in mongoose multi-to-multi relationship?

node.js,mongodb,rest,mongoose,populate

First of all, your realization is really complex and it can be simplified as this: var userId = req.body.user_id; // this is an ObjectId var group = { createdBy: userId, joinedUsers: userId }; Group.create(group, function (err, group) { if (err || !group) { return res.send(err); } User.findById(userId, function (err, user)...

Concatenating matrices within for-loop in MatLab

matlab,loops,matrix,populate

vertcat is a good choice, but it will result in a growing matrix. This is not good practice on larger programs because it can really slow down. In your problem, though, you aren't looping through too many times, so vertcat is fine. To use vertcat, you would NOT pre-allocate the...

VB.net Creating a class and populating it

vb.net,list,class,arraylist,populate

if you just wanna create an instance of a class and set it's values like your title says: (Dim) x = New Employee With x .displayName = "" .ntID = "" .lastName = "" .givenName = "" .department = "" .eMail = "" End With assuming empInfo is a list(of)...

How to populate my sport activity with data?

java,android,arraylist,populate

The easiest way to do this would be to pass the data to the activity in the intent you're using to start the activity: Intent intent = new Intent(getBaseContext(), YourActivity.class); intent.putExtra("youe_data_key", yourData); startActivity(intent); ...

Populate in rails 4 and heroku (SOLUTIONS)

ruby-on-rails,heroku,deployment,populate

heroku run rake db:seed -a your_app_name_on_heroku from command line in the project's directory

Show HTML element if the Array provided has a nested Array using Angular.js

arrays,angularjs,filter,nested,populate

You can use ng-show to conditionally show/hide the second drop-down The code can be seen/tested here Controller: app.controller('MainCtrl', function($scope) { $scope.items = [ {name:'item1'}, {name:'item2', subItems: [ {name:'sub item 1'}, {name:'sub item 2'}]}]; }); Markup: <p> <select ng-model="selectedItem" ng-options="i.name for i in items"></select> </p> <p ng-show="selectedItem.subItems"> <select ng-model="selectedSubItem" ng-options="i.name for...

styling vertical text that is populated dynamically

css,dynamic,populate,rotatetransform,vertical-text

add to '#titleposition' top: 200px; (or other distance from the '#menuarrow' to prevent conflict on the positions). give it also left :50%; for placing it in the middle of '#undermenu'. give '.vertical-text' position: absolute; too and replace the float: left; with width: 100%;. for your request to make the text...

Populate textarea with javascript variables from onclick

populate

I think it's the single quote in the anchor tag, give this a try, it seems to be fine with both .val and .text <script> function quote(username, date, quote) { var newText = "[quote date='" + date + "' name='" + username + "']" + quote + "[/quote]"; var old...

Populate an array of objects using hashmap

java,arrays,for-loop,hashmap,populate

You have to iterate the hash map and get the value of map and convert the arraylist (value of your hash map) to the array using toArray() of arraylist. But in your design the routes array has limited size, which will have memory wastage. public class FetchMapData { static final...

How to get content of objectId in an Array - Mongoose / NodeJs

javascript,node.js,mongodb,mongoose,populate

You need to provide the full, dot-notation path of the field to populate in your populate call: userModel.find({ _id : req.session.passport.user._id }) .select('tags') .populate('tags.objectId', 'name alias') .lean() .exec(function (err, result) { console.log(JSON.stringify(result)); } ); ...

how to populate a table's fields with multiple values depending on the row

mysql,sql-update,populate

You have to use CASE inside the UPDATE statement: UPDATE sinvent SET accno = CASE WHEN jno < '09999' THEN '4010' WHEN jno = '00011' THEN '4011' WHEN jno = '00012' THEN '4012' WHEN jno = '00014' THEN '4014' WHEN (jno > '80000' and jno < '99998') THEN '4018' WHEN...

Is it safe to drop and then create the foreign key constraints inside a transaction?

sql,postgresql,transactions,foreign-keys,populate

TRUNCATE is not allowed on any table referenced by a foreign key, unless you use TRUNCATE CASCADE, which will also truncate the referencing tables. The DEFERRABLE status of the constraint does not affect this. I don't think there is any way around this; you will need to drop the constraint....

Populate array of class type in PHP

php,arrays,class,populate

Just simply add new Fuelprices($year, $coal) objects into the array. foreach($arrayFromDatabase as $theData){ $data[] = new Fuelprices($theData['year'], $theData['coal']); } ...

populate all div ids in a page with javascipt

html,populate

Try: document.write(divs[i].id); ...

Populate Select from PHP Function in Wordpress

jquery,select,populate

You need $.ajax() for this like, $(function(){ $('#select_id').on('change',function(){ if(this.value){ var val=this.value; $.ajax({ url:'your php url here', type:'post', data:{select_id:val}, success:function(response){ $('#select_role').prop('disabled',false) .html(response); } }); } else { $('#select_role').prop('disabled',true); } }); }); Your PHP Page Code, <?php $get_role = GetRoleList ( $_POST['select_id'] ) ; echo $get_role ; ?> And if you want...

Swift: cannot invoke 'addObject' with an argument list of type '(AnyObject?!)' [closed]

ios,arrays,json,swift,populate

You need to unwrap the optional twice. var textArray: NSMutableArray! = NSMutableArray() var a:AnyObject?! = "hello" You could do this with force unwraps: textArray.addObject(a!!) But that is unsafe and will crash if either optional is nil. The way to do it safely is to use optional binding: if let temp1...

Populate Winforms treeview with Sharepoint site

winforms,sharepoint,treeview,populate

Solved! public void FillTreeSPWeb(SPWeb MySPWeb, TreeNode Node, int num) { if (num <= 0) { Node.Text = MySPWeb.Title; GetSPDocumentLibrary(MySPWeb, Node); } num--; foreach (SPWeb item in MySPWeb.Webs) { TreeNode Child = new TreeNode(); FillTreeSPWeb(item, Child,num); Node.Nodes.Add(Child); } } public void GetSPDocumentLibrary(SPWeb MySPWeb,TreeNode Node) { foreach (SPList item1 in MySPWeb.Lists) {...

Angularjs populate select options with json

javascript,json,angularjs,select,populate

angular.module('ui.bootstrap.demo', ['ui.bootstrap']) - be sure you have ui.bootstrap. Read how to install it http://angular-ui.github.io/bootstrap/ Here is your updated jsfiddle http://jsfiddle.net/e31k5e6L/1/ ...

mongodb populate method not working

node.js,mongodb,model,populate,auto-populate

When you create an instance of the Post model, you need to assign the _id from the user as an ObjectId, not a string: var ObjectId = require('mongoose').Types.ObjectId; Post.create({ text: 'farheen123', created_by: new ObjectId('5587bb520462367a17f242d2') }, function(err, post) { if(err) console.log("Farheen has got error"+err); else console.log(post); }); ...

Change Spinner entries after EditText changes

android,android-edittext,spinner,populate

private String editString1,editString2,editString3,editString4; public void onCreate(){ //Initialise views edit1.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable s) { editString1 = s.toString(); setupSpinner(editString1,editString2,editString3,editString4) }) //DO the same for other edit texts and save them to appropriate Strings } public void setupSpinner(String first,String second,String third,String four){ //Check the strings and set up...

what it means by “populate” in mongoose

node.js,mongoose,populate

If you have a document pointing to another document (i.e. contains an ID reference), populate will fetch the referenced document. For instance, if you have: { "__id" : "a", "className" : "astroPhysics", "teacher" : "b" } and { "__id" : "b", "teacherName" : "John Smith" } getting a and populating...

Asking user for array size and populating array | Java

java,arrays,input,size,populate

This may help you public static Student[] createArray() { System.out.println("Enter size of array:"); Scanner userInputEntry = new Scanner(System.in); int inputLength =userInputEntry.nextInt(); Student students[] = new Student[inputLength]; return students; } public static void populateArray(Student [] array) { for(int i=0;i<array.length().i++) { array[i]=new Student(); System.out.println("Enter Name"); Scanner userInputEntry = new Scanner(System.in); array[i].setName(userInputEntry .next());...

Defining values based on other values comes up with no Data

python,table,dependencies,populate

The issue that Bob and Aamir are pointing out is that GRIDCODE has no value, and thus can't equal anything, rendering the rest of your change() function moot. If you want to use a certain value of GRIDCODE, your code might look like this. class GRIDCODE: def __init__(self, BSMPW): self.BSMPW...

Android: problems with CursorAdapter

android,sqlite,listview,android-cursoradapter,populate

Remove the three Override methods getCount(), getItem() and getItemId() from your ListaAdaptador class. You don't need them since you're using a CursorAdapter.

Codeigniter form populate with db results not working

database,forms,codeigniter,populate,setvalue

Thank you very much for your help. I'm sure you must have realised that I'm new to Codeigniter, but with your help I was able to sort out the problem that I had. I changed the query to return only the one result that it found like you suggested return...

Change data according to selected item in combobox

vb.net,combobox,populate

Yes ... but you need to put all of the code above into the SelectedValueChanged event for the ComboBox1 object.

Populate wxChoice at Start of Program Run | Python

python,wxwidgets,populate,wx,wxformbuilder

Check for your indentation. Some times if you copy paste, this can mess things up. Just rewrite it or replace it with another statement. See here: IndentationError: unindent does not match any outer indentation level Problem is if you make your indentation with tabs and then copy-paste some code from...

How to populate a treeview from a XML file with multiple child nodes?

xml,vb.net,xml-parsing,treeview,populate

I improved the output. See code below Imports System.Xml Imports System.Xml.Linq Imports System.IO Imports System.Text.Encoding Public Class Form1 Const FILENAME As String = "c:\temp\test.xml" Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Try ' SECTION 1. Create a DOM Document and load the XML data into...

how to populate a table's fields with multiple criteria, some of which overlap

mysql,populate

this worked UPDATE sinvent accno = case when (jno > '60000' AND jno < '80000') then '4015' when jno = '04011' then '4011' when jno = '4116' then '4116' when jno = '4506' then '4006' when jno = '4006' then '4006' when jno = '4012' then '4012' when jno =...

Populate Userform combobox from a given range on a mac (excel 2011)

excel,combobox,populate,userform

I just found the answer with: Private Sub UserForm_Initialize() CurrencyList.List = Worksheets("mySheet").Range("A23:A30").Value End Sub My mistake was changing UserForm to the name of my specific userform (Details)...

ListView error from SQLite database

android,sqlite,android-listview,populate

The exception thrown is Caused by: android.database.sqlite.SQLiteException: no such table: medidas (code 1): , while compiling: SELECT * FROM medidas WHERE id_usuario = ? So your 'medidas' table does not exist. So please verify that onCreate is called and the call of db.execSQL(CREATE_MEDIDAS); Furthermore: db.execSQL("DROP TABLE IF EXISTS " +...

Populate an array using dynamic variables names in Powershell

powershell,matrix,populate,dynamic-variables

Just because of your other question I have built this to output the random numbers in the matrix block. It uses $width and $height to define the size of $theMatrix which is built as an array of string arrays. $width = 4 $height = 5 $theMatrix = @() For($heightIndex =...

Node.js creating model objects from json

javascript,json,node.js,model,populate

I don't know if this is what you are asking but you can parse JSON: getSomethingFromAPI().then(function(dataResponse){ var objectArray = JSON.parse(dataResponse) }) If it isn't please post some code snippets and clarify your questions. Per comment: I don't think you can freely add an instance method without writing some code. It...