jstree dnd and how to limit drops - drag-and-drop

I have a jstree as follows:
Cities
London
Paul
Jack
New York
Lisa
Fred
So I want to drag and drop the Peoples from one city to another,
but not people to people.
Please can anyone show o code piece for that solution.
I am able to drop at people to cities and also people to people,
but people to people makes no sense in that case.

I found the solution by using dynatree:
onDragEnter: function(node, sourceNode) {
if (node.data.isFolder)
return ["over"];
else
return ["before", "after"];
},
That is exact what I need

Related

Google Sheets - Retrieve "A:File1" to "A:File2" where "Sheetname:File1" = "B:File2" if "C:File2" is between "E" and "F" in "File1"

Sorry for the somewhat long title, but I was told to be as specific as possible. :D
My problem will require some explantion.
So, I have 2 spreadsheets files ("Konverteringstabeller" and "Tee Posen").
In "Tee Posen" I have a sheet named "Scores MIK" (golf scorecard and my name).
In "Konverteringstabeller" I have sheets with conversion tables for multiple golf courses, but if one works, all should.
What I need is to find out what course handicap I would get if my golf handicap is "HCP 26,0" (as shown in File 2 Picture), and in this case that result should be 29 (not visible), but you should get the point.
(example: golf hcp 10 would result in course hcp 11, because 10 is between 9,9-10,7)
While I have been able to find the right result, it has only been in the "Konverteringstabeller" spreadsheet file and that is not the place I need it.
I want to have it written in E6 in the "Scores MIK" sheet in File 2.
I should mention that in "Scores MIK : File 2", cell C2 (Ikast Golf Klub) has data validation so I can easily change between the different courses in the "Konverteringstabeller" file once I add more.
What I have been messing with is something with vlookup and importrange with concatenate in it, but I can't figure out how to do it, so I ask for your help.
And I am by no means skilled in the art of Spreadsheets, so I would very much appreciate a detailed explanation.
Picture - Scores MIK (File 2)
Picture - Ikast Golf Klub (File 1)
Thanks in advance!
// Mikkel Christensen
OK so a couple notes - One is that to join a static cell where you keep the sheet name but allow it to chance you should add '$' around it, also if the rows for B8-E70 will always be the same position on the various sheets you also need to add $ around those as well.
here is an example of the whole formula
=IFERROR(ARRAYFORMULA(VLOOKUP(E5:E25;IMPORTRANGE("spreadsheet key";"'"&C2&"'!$B$8:$E$70");4;TRUE)))
And lastly - using the "&" operator to concatenate is better at least in my opinion because concatenate sometimes does not work as well with array formula - plus I find it personally quicker and easier to use that having wrap yet another function around my stuff.

About MongoDB documents

I am new to the NoSQL/MongoDB world and so I am experimenting with several things.
Let's say I would like to create a blog using MongoDB.
I could create a Blog post like this:
{
Title: "My First Post",
Body: "Bla de bla de bla bli bla de bah"
Date: "07/07/2013" // or 06/07/2013 when using javascript date notation
}
And then I would like my readers to post comments. One thing I know about my readers is they get very involved. They write thousands of comments to my blog posts.
First question:
Is it a good idea to embed the comments? Or is it better to store them in their own collection with a reference to the blog post id?
Here's another example. Let's say I'd like to create a social media like web site that has several different types of objects (i.e.: blog posts, video's, contacts) and people can subcribe to the objects so they can comment and read other people's comments.
A comment feed would look like this:
{
Type:[either blog post,video or contact]
Name:"Comments on this crazy video"
SubscribedUsers:[userid1,userid2,userid3...userid999]
Comments: {
{
Name:"Purple Dog",
Date: "07/07/2013 09:12:23",
Text: "Bla bla bla"
},
{
Name:"Shizzly Feather",
Date: "07/07/2013 09:23:08",
Text: "I agree with Purple Dog."
}
}
}
(maybe the notation is a bit off but I hope you get what I mean)
Question two:
Is the above example a good idea for a site like this? Is MongoDB a good fit or should I not use it for stuff like this? (What should I use then?) Or is there another way to achieve the same result (in the end, I would like to show the user an aggregated feed with all comments sorted by date DESC for the feeds they are subscribed to)
What I'm trying to learn (and what hopefully is useful to others) is when to choose MongoDB/NoSQL and when to stick with RDBMS's.
If you are using MongodB, you are better off embedding the comments because the comments are inextricably linked to each post - In fact, comments that are not germane/relevant to the post might be viewed as spam. The embedding shines when you ask for say, every comment that's associated with the post. The embedding sucks when you ask for say, every comment that's been made by anyone in the last 6 hours, but I can't think of a reason why you might want to ask for such a thing :)
You'll like RDBMS if you put the comments in their own table and you DO ask questions like "give me all comments that were made by everyone in the last six hours". On the other hand, RDBMS sucks when Julie C. (rightfully) expects to see all comments associated with her post and you have to run a "join" operation between the "poster" table, the "posts" table and the "comments" table to give her what she expects.
So, choose your poison :)
Here is an another approach which is a hybrid called a bucketing strategy
http://www.slideshare.net/jrosoff/mongodb-advanced-schema-design-inboxes

Magic numbers. Joomla K2. Wrong some categories links

I have one category (Games) with subcategories (Gamesnames).
http://www.gamerno1.net/index.php?option=com_k2&view=itemlist&layout=category&task=category&id=1&Itemid=113
The settings of all categories is the same. But, links certain subcategories return to the parent category (Games).
As soon as I change the alias name - everything works as it should.
Below is a list of subcategories and their aliases.
Ancients of Ooga 91810
Anomaly Warzone Earth 91200
Cloning Clyde 91800
Dead Island 91310
Demolition, Inc. 98600
Dungeon Defenders 65800
Dungeons of Dredmor 98800
E.Y.E: Divine Cybermancy 91700
Hard Reset 98400
Jamestown 94200
Post Apocalyptic Mayhem 91900
Ravaged 96300
Revenge of the Titans 93200
Rise of Immortals 90530
Sanctum 91600
SkyDrift 91100
SpaceChem 92800
Spiral Knights 99900
The Elder Scrolls V: Skyrim 72850
Toy Soldiers 98300
Worms Ultimate Mayhem 70600
Xotic 92600
What is my problem?
Thank you!
Update.
If you create a category with an alias: 91810, 91200, 91800, etc. .. category will refer to the parent category.
Whyyyyy?
Magic numbers ...
I solved the problem.
I removed
urlencode($item->alias)
everywhere
and all earned the right.
Thanks for watching!!!

stored long description in Sqlite database manager in iphone

I want to store long description in sqlite database manager in iphone like this data.
"The Golden Temple: The Golden Temple, popular as Sri Harmandir Sahib or Sri Darbar Sahib, is the sacred seat of Sikhism. Bathed in a quintessential golden hue that dazzles in the serene waters of the Amrit Sarovar that lace around it, the swarn mandir (Golden temple) is one that internalizes in the mindscape of its visitors, no matter what religion or creed, as one of the most magnificent House of Worship. On a jewel-studded platform is the Adi Grantha or the sacred scripture of Sikhs wherein are enshrined holy inscriptions by the ten Sikh gurus and various Hindu and Moslem saints. While visiting the Golden Temple you need to cover your head. Street sellers sell bandanas outside the temple at cheap prices."
I am trying to take as description (VARCHAR(5000)) but when i execute query it is showing half text with dotted (....) like that http://i.stack.imgur.com/gyMqi.png
Thanks
The ... surely indicate that the full text is present in the database. It also indicates that "Sqlite database browser" truncates past a certain length:
m_textWidthMarkSize = s.value("prefs/sqleditor/textWidthMarkSpinBox", 60).toInt();
Is there a way to change the settings?
Edit
You can verify that the text is fully saved with the following query (replace theTable with the correct table name):
select length(description) from theTable;

Parsing an Address with T-SQL

I am trying to figure out how to parse an address using T-SQL and I suck at T-SQL. My challenge is this,
I have a table called Locations defined as follows:
- City [varchar(100)]
- State [char(2)]
- PostalCode [char(5)]
My UI has a text box in which a user can enter an address in. This address could be in the form of essentially anything (yuck, I know). Unfortunately, I cannot change this UI either. Anyways, the value of the text box is passed into the stored procedure that is responsible for parsing the address. I need to take what the person enters and get the PostalCode from the Locations table associated with their input. For the life of me, I cannot figure out how to do this. There are so many cases. For instance, the user could enter one of the following:
Chicago, IL
Chicago, IL 60601
Chicago, IL, 60601
Chicago, IL 60601 USA
Chicago, IL, 60601 USA
Chicago IL 60601 USA
New York NY 10001 USA
New York, NY 10001, USA
You get the idea. There are a lot of cases. I can't find any parsers online either. I must not be looking correctly. Can someone please point me to a parser online or explain how to do this? I'm willing to pay for a solution to this problem, but I can't find anything, I'm shocked.
Perhaps a CLR function might be a better choice than tsql. Check out http://msdn.microsoft.com/en-us/magazine/cc163473.aspx for an example of using regular expressions to parse some pretty complex string inputs into table value results. Now you get to be as creative as you please with your regex matching but the following regex should get you started:
(.*?)([A-Z]{2}),? (\d+)( USA)?$
If you're reluctant to use CLR functions, perhaps you have regex functionality in the calling system, like ASP.Net or PHP.