Categories
askquestion

JQuery selecting by ID

JQuery selecting by ID

Ask Question

Asked
10 years, 6 months ago

Active
10 years, 6 months ago

Viewed
233 times

.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{
margin-bottom:0;
}

1

AFAIK, the JQuery ID selector:

var ctlId = $(“https://stackoverflow.com/#” + strControlId);

gets translated into a call by document.getElementById.

Questions:

Is document.getElementById supported by ALL the browsers?
I am currently using the find object function found below for selecting an ID. Would JQuery selector essentially do the same thing?

javascript jquery

share|improve this question

edited Sep 30 ’09 at 16:11

Nick

asked Sep 25 ’09 at 15:24

NickNick

7,1891515 gold badges6969 silver badges123123 bronze badges

document.getElementById is part of the W3C standard, so any browser that doesn’t support it probably isn’t worth your time 😉

– inkedmn
Sep 25 ’09 at 15:26

The function you linked to has a load of irrelevant code to make it work on Netscape Navigator 4, which was released in 1997 and is now well and truly dead. I’m astonished MM are still using that script.

– NickFitz
Sep 25 ’09 at 15:38

“I’m astonished MM are still using that script.” I’m not. Adobe still has the “Netscape 4 Resize Fix” function built into Dreamweaver CS4.

– Scott
Sep 25 ’09 at 15:40

add a comment
 | 

3 Answers
3

Active

Oldest

Votes

3

Not by all browsers, but by all modern ones. Netscape 4 didn’t support it. Some browsers don’t support Javascript at all…
Macromedia write horrible Javascript. It looks like they’re searching across frames, which jQuery won’t do, and you probably don’t want to do. Stick with jQuery – it’s much nicer…

Edit: IE, FireFox, Safari Opera have all supported it for years… Chrome has supported it since it was created.

d.layers is for Netscape 4 – AFAIK it didn’t exist before or after.

share|improve this answer

edited Sep 25 ’09 at 15:48

answered Sep 25 ’09 at 15:29

GregGreg

277k5050 gold badges347347 silver badges323323 bronze badges

And again: +1 for whaling on MM’s atrocious scripts 🙂

– NickFitz
Sep 25 ’09 at 15:40

1

Searching across frames is a bad thing. You can have the same ID used in both frames – which one are you going to get back?

– Greg
Sep 25 ’09 at 15:44

No idea about .NET – I do PHP mostly

– Greg
Sep 25 ’09 at 16:02

add a comment
 | 

6

No,

var ctlId = $(“https://stackoverflow.com/#” + strControlId);

results in a jquery object of which, the position, $(“https://stackoverflow.com/#” + strControlId)[0] is the result of document.getElementById

I would recommend moving rapidly and forcefully away from Macromedia javascript as soon as you possibly can. Nasty stuff and you’ll learn a lot of currrently very poor practice for javascript if you keep using it (unfortunately).

EDIT:
In response to a comment below regarding the history of MM javascript. I was going to reply as a comment, but I figured I’d likely waffle so I may as well respond properly here.

The history of MM javascript probably isn’t all that interesting in this day and age, mostly because all MM javascript has is history – by which I mean it’s stuck in a timewarp of 6+ years ago and is showing no signs of catching up (or even acknowledging) the incredible changes that have happened in the javascript community.

(I mean, for crying out loud, I can know actually use the phrase ‘javascript community’ and people will nod their head sagely rather than wetting themselves with laughter).

MM javascript is the code we used to have to write when the DOM was your enemy and every mention of javascript coding was met with screams of terror. MM tried to make it easier for designers to concentrate on design and markup and not have to worry about the irritating bits like button rollovers and menu drop downs. We’ve moved on, javascript has moved on, Macromedia javascript functionality has stayed the same.

share|improve this answer

edited Sep 25 ’09 at 16:02

answered Sep 25 ’09 at 15:27

SteerpikeSteerpike

13.8k77 gold badges3636 silver badges5050 bronze badges

add a comment
 | 

0

All major browsers support getElementById (IE, Firefox, Safari, Chrome, Opera, etc.)

MM function will return a standard DOM node with no special new functions attached to it.

jQuery on the other hand will return a jQuery object which is a kind of array with many more functions attached to it (visual effects functions and more).

jQuery function also works with css selectors syntax to search for the right nodes, which I don’t think the MM function does.

Hope this helps

share|improve this answer

answered Sep 25 ’09 at 15:30

MaxiWheatMaxiWheat

5,54344 gold badges4141 silver badges7272 bronze badges

I can get the DOM node using : $(‘#’ + strControlId).get(0); Can I use this to replace the MM function?

– Nick
Sep 25 ’09 at 15:34

Yes you can do this, this will actually lead to the same result. However I don’t know how the performance compares from one to the other.

– MaxiWheat
Sep 25 ’09 at 15:38

add a comment
 | 

Your Answer

Thanks for contributing an answer to Stack Overflow!Please be sure to answer the question. Provide details and share your research!But avoid …Asking for help, clarification, or responding to other answers.Making statements based on opinion; back them up with references or personal experience.To learn more, see our tips on writing great answers.

Draft saved
Draft discarded

Sign up or log in

Sign up using Google

Sign up using Facebook

Sign up using Email and Password

Submit

Post as a guest

Name

Email
Required, but never shown

Post Your Answer

Discard

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you’re looking for? Browse other questions tagged javascript jquery or ask your own question.

The Overflow Blog

Podcast: Right Back At Ya

We’re launching an Instagram account

Featured on Meta

An Update On Creative Commons Licensing

Community and Moderator guidelines for escalating issues via new response…

Triage needs to be fixed urgently, and users need to be notified upon…

Upcoming Feature: New Question Close Experience

Visit chat

Related

2744Is there an “exists” function for jQuery?7645How do I check if an element is hidden in jQuery?4083Setting “checked” for a checkbox with jQuery829Change the selected value of a drop-down list with jQuery2659How can I know which radio button is selected via jQuery?4499How do I check whether a checkbox is checked in jQuery?2285Get selected text from a drop-down list (select box) using jQuery789Get selected element’s outer HTML2276.prop() vs .attr()

Hot Network Questions

How to to deal with criticism on my writing?

What are the differences between a $25 sleeping bag and a $440 sleeping bag if they have the same temp rating?

Methods for melting metals in space

Mathematica numerical “error” for simple multiplication

What exactly is reactive power, in concrete terms?

Is it unprofessional to add a Stallman-like “you won’t find me on Facebook” to my resume?

Does power delivery over ethernet always have to use isolated DC/DC converters?

Transliteration of the name “Seraphina”

Can the SARS-CoV-2 virus float in the air for up to 3 hours?

Checksum a Game Boy cartridge

Incorrect usage of hyphens in the form “Artist – Song Name”

Series of stories about a technologically-advanced society with nude masters but clothed slaves

Stuck in New Zealand due to coronavirus

Why does Thailand ban the sale of alcohol between 2 and 5 p.m.?

I have the following chord progression. But not scale exists. Is this okay?

Do I get a bonus d6 to Magic Missile damage if my expert sidekick helps me?

Direct product of groups has inclusions, but it’s still not the free product (coproduct)?

Does it make sense to say Big Theta of 1? Or should we just use Big O?

What exactly is an arrow in a category?

Is it possible to use a TXT record for CAA (Certification Authority Authorization)

What does quantised mean?

coronavirus – Why no ‘c’ capital? Why is there no space?

log_e approximation

Akari: Another Light

more hot questions

Question feed

Subscribe to RSS

Question feed
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

lang-js

Categories
askquestion

Streamline .NET projects with Msbuild

Streamline .NET projects with Msbuild

Ask Question

Asked
10 years, 6 months ago

Active
10 years, 6 months ago

Viewed
2k times

.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{
margin-bottom:0;
}

1

Sorry for being somewhat vague but so is the project I’m leading now. I inherited a large body of various in-house tools and am trying to put unified build system around each one.Some of the projects we have (few dozen) are .NET-based web-projects C# mostly, some of these are web-services and some webapps. The apps were build over past 6 years so .NET version varies from 2 to 3.5. The worst part – all of the apps were build using VS and none has command-line builds.

The requirement is: I should be able to check out code from SVN and fully build any or all of the projects completely from the command-line with no input prompts so it can be eventually integrated into TeamCity (continuous integration tool)

I have C/C++, Java background so I did a little research and everything seems to be pointing to MSBuild as a tool. Now for the past 2 weeks all I hear from our .NET developers: “It’s hard, it’s impossible, we don’t know how to do it” So here now come the questions:

Is it possible to retrofit any existing .Net project with command-line only build? If there are limitation what would those be?
Do I need a full-blown version of VS to perform the build and deployment or is there some smaller alternative (Again, eventually projects will be build on continuous integration box with no GUI)
Can I check out code (from SVN) into any directory? Currently I’ve been told that I need to put code into “special location” configured to be “monitored” by VS
How to manage external dependencies? Currently I’m hearing from the team that any 3rd party libraries needs to be “pre-installed” prior to the build using UI and the best solution I’ve been offered by team is to “install and create a VM”

Your suggestions will be much appreciated

.net msbuild build-process

share|improve this question

asked Sep 25 ’09 at 15:25

BostoneBostone

33.1k3838 gold badges153153 silver badges209209 bronze badges

add a comment
 | 

1 Answer
1

Active

Oldest

Votes

3

It depends on exactly what your dependencies are and things, but:

MSBuild is what Visual Studio 2005 and later uses as its “native” file format – so you can build either a VS solution or a VS project pretty easily
MSBuild is part of the .NET framework, along with the various compilers. You shouldn’t need to install VS.
Yes, you can check out code from SVN anywhere. It’s not like VSS/VSTS where the server “knows” where the code is
External dependencies should – wherever possible – be DLLs just stored in source control and referenced via relative paths. If you’ve got something you have to install in the GAC, that’s slightly harder.

Personally I’ve had success using NAnt as the build “controller” but then shelling out to MSBuild to do the actual compilation bits. It’s nicer (IMO) than MSBuild for the controller bits, but not as good at doing actual compilation as it hasn’t kept up with Visual Studio.

You can see an example of how this works in my Protocol Buffers port.

share|improve this answer

answered Sep 25 ’09 at 15:33

community wiki

Jon Skeet

I’m using Maven (exec-maven-plugin) to call MSBuild with various switches. I also can use Maven to grab DLLs and put them under the project’s folders (say proj/lib). How do I “activate” these? Is there some MSBuild commands that would help?

– Bostone
Sep 25 ’09 at 15:45

BTW if MSBuild uses VS solution files can I still check out the solution and build it with .NET framework only without actually installing VS?

– Bostone
Sep 25 ’09 at 15:49

There’s no need to “activate” the libraries so long as they’re referenced appropriately from the VS projects. And yes, you can still build without installing VS.

– Jon Skeet
Sep 25 ’09 at 15:58

Jon, can you define “appropriately referenced”? I’m pulling source into some directory and the only thing I can predefine is a relative path – will that be sufficient? And if not – can I register DLL at runtime using MSBuild?

– Bostone
Sep 25 ’09 at 16:02

2

“And yes, you can still build without installing VS” … as long as you don’t want to build a Setup project (to generate an MSI) – this needs VS 🙁

– Joe
Sep 25 ’09 at 17:19

 | 
show 2 more comments

Your Answer

Thanks for contributing an answer to Stack Overflow!Please be sure to answer the question. Provide details and share your research!But avoid …Asking for help, clarification, or responding to other answers.Making statements based on opinion; back them up with references or personal experience.To learn more, see our tips on writing great answers.

Draft saved
Draft discarded

Sign up or log in

Sign up using Google

Sign up using Facebook

Sign up using Email and Password

Submit

Post as a guest

Name

Email
Required, but never shown

Post Your Answer

Discard

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you’re looking for? Browse other questions tagged .net msbuild build-process or ask your own question.

The Overflow Blog

Podcast: Right Back At Ya

We’re launching an Instagram account

Featured on Meta

An Update On Creative Commons Licensing

Community and Moderator guidelines for escalating issues via new response…

Triage needs to be fixed urgently, and users need to be notified upon…

Upcoming Feature: New Question Close Experience

Related

173Displaying build times in Visual Studio?20Advantages of using MSBuild or NAnt versus running DevEnv.exe from command-line2061Difference between decimal, float and double in .NET?121Installing MSBuild 4.0 without Visual Studio 2010210How to Publish Web with msbuild?149How do I specify the platform for MSBuild?78TeamCity says to use “Build Parameters” instead of “/property:” in an MSBuild step. What does that mean?139How do I run msbuild from the command line using Windows SDK 7.1?1360Why not inherit from List<T>?7MSBUILD .NET v4 teamcity

Hot Network Questions

x87 trigonometric instructions

Is there a better way to formulate this constraint?

MTB freewheel not moving back wheel after change of tyre

What exactly is an arrow in a category?

Pseudo-deterministic number generator

coronavirus – Why no ‘c’ capital? Why is there no space?

How do I achieve this creamy black and white look?

Can an animal develop a facial disk through muscle and bone alone?

Can a character with the Healer feat use the second benefit of the feat to heal themselves?

Extracting speaker, microphone and hook signals from a two-line telephone

What exactly is reactive power, in concrete terms?

Part differences between main and alternate models of 8285 set

Can the SARS-CoV-2 virus float in the air for up to 3 hours?

Who owns the washing machine?

How does one adjust the equivalent of the barrel adjuster on the XTR RD-M9000 rear derailleur?

Direct product of groups has inclusions, but it’s still not the free product (coproduct)?

Are Matthew 11:6 and Luke 7:23 menace to the ungodly (impious)?

Birds on a wire (again) – how is it that birds feel no current? They are just making a parallel circuit, no?

Laplace equation with robin boundary conditions

Does power delivery over ethernet always have to use isolated DC/DC converters?

How high can an airplane be spotted with eyesight?

Is it fine to send a message to the author of a paper if I don’t understand something and want to clarify it?

What’s an efficient algorithm to calculate line breaks (word wrap) for balanced widths (minimum raggedness)?

Complete the line – passive voice

more hot questions

Question feed

Subscribe to RSS

Question feed
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

lang-xml

Categories
askquestion

Algorithms behind this animated java applet

Algorithms behind this animated java applet

Ask Question

Asked
10 years, 6 months ago

Active
10 years, 6 months ago

Viewed
246 times

.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{
margin-bottom:0;
}

0

I was recently happened to see this animation (http://universe.daylife.com/). I was wondering what are the algorithms behind this applet. How and Where to learn such things?

Thanks

algorithm animation applet

share|improve this question

asked Sep 25 ’09 at 15:25

asyncwaitasyncwait

4,21344 gold badges3333 silver badges5050 bronze badges

add a comment
 | 

1 Answer
1

Active

Oldest

Votes

1

Mmm, funny, I had lot of exceptions in the Java console, yet it kind of worked (changing colors, but not doing much other work, apparently).

Exceptions were:

java.lang.NullPointerException
at universe.draw(universe.java:262)
at processing.core.PApplet.handleDisplay(PApplet.java:1359)
at processing.core.PGraphics.requestDisplay(PGraphics.java:680)
at processing.core.PApplet.run(PApplet.java:1454)
at java.lang.Thread.run(Unknown Source)

which reveal at least how the applet was done: by using the excellent Processing environment (using a “simplified” Java and a good graphics library).

Since it didn’t really worked for me, I can hardly tell you how it was done (what it was supposed to do?), but well, you have at least a starting point! Note that Processing offers good tutorials too…

[EDIT] I re-tried with a standard search term (New-York instead of JavaFX…), and I got some result. Quite impressive.
Obviously, lot of work have been put there.
I confirm you can learn a lot on the algorithms used there (graphical, network, data parsing…) by browsing (and interacting!) on the Processing site and forum…

share|improve this answer

edited Sep 25 ’09 at 16:11

answered Sep 25 ’09 at 16:04

PhiLhoPhiLho

37.2k66 gold badges8787 silver badges125125 bronze badges

add a comment
 | 

Your Answer

Thanks for contributing an answer to Stack Overflow!Please be sure to answer the question. Provide details and share your research!But avoid …Asking for help, clarification, or responding to other answers.Making statements based on opinion; back them up with references or personal experience.To learn more, see our tips on writing great answers.

Draft saved
Draft discarded

Sign up or log in

Sign up using Google

Sign up using Facebook

Sign up using Email and Password

Submit

Post as a guest

Name

Email
Required, but never shown

Post Your Answer

Discard

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you’re looking for? Browse other questions tagged algorithm animation applet or ask your own question.

The Overflow Blog

Podcast: Right Back At Ya

We’re launching an Instagram account

Featured on Meta

An Update On Creative Commons Licensing

Community and Moderator guidelines for escalating issues via new response…

Triage needs to be fixed urgently, and users need to be notified upon…

Upcoming Feature: New Question Close Experience

Related

1430What is the best algorithm for overriding GetHashCode?540What algorithms compute directions from point A to point B on a map?319How to have multiple CSS transitions on an element?1088Ukkonen’s suffix tree algorithm in plain English1630Image Processing: Algorithm Improvement for ‘Coca-Cola Can’ Recognition877How to find time complexity of an algorithm951How do I animate constraint changes?1909What is the optimal algorithm for the game 2048?327How to implement classic sorting algorithms in modern C++?2Java Applet Thread Animation

Hot Network Questions

Akari: Another Light

Methods for melting metals in space

What is the minimum count of steps required to complete this maze correctly?

How do Minecraft know where village’s buildings are if the village is not generated yet?

Weird kind of Cauchy-Schwarz inequality

Are Matthew 11:6 and Luke 7:23 menace to the ungodly (impious)?

Can’t hear the tonic

Why did the KH-11 get the nickname “Kennen”?

How do I achieve this creamy black and white look?

Where can I find a definitive answer for what `*/` means in Bash or Zsh?

Incorrect usage of hyphens in the form “Artist – Song Name”

Error during the upgrade of LibreOffice from 6.3.5 to 6.4.2

Can a character with the Healer feat use the second benefit of the feat to heal themselves?

Why are the orthographies of Ancient/Proto Languages so Impractical?

What version of Divinity is the most recent?

Is the connection between ‘right’ in the sense of direction and concepts like ‘correct’ limited to Indo-European languages?

Why is there a Saturn V in the background of this Gemini-Titan launch?

How, or should I repay debt during Covid-19 crisis?

Is it possible to use a TXT record for CAA (Certification Authority Authorization)

Part differences between main and alternate models of 8285 set

2000’s novel where a man wakes up to find a chunk of his brain replaced by a cybernetic implant he turns out to have developed himself

Series of stories about a technologically-advanced society with nude masters but clothed slaves

Pseudo-deterministic number generator

Jewish person visiting American friend in Qatar

more hot questions

Question feed

Subscribe to RSS

Question feed
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Categories
askquestion

Writing from SQL Server table to file using BCP

Writing from SQL Server table to file using BCP

Ask Question

Asked
10 years, 6 months ago

Active
10 years, 6 months ago

Viewed
3k times

.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{
margin-bottom:0;
}

1

I just realized my caps was on from working in SQL Server, ha.

Anyways, Im trying to write from

serverName.databaseName.databaseInstanceName.TableName

to

C:FileName.xml

using bcp and I want to write only columns Col1 and Col2, could I get a little syntax help? I’m struggling over here.

Thanks,

Ted

sql-server command-line sqlbulkcopy

share|improve this question

edited Sep 25 ’09 at 16:24

marc_s

629k142142 gold badges11961196 silver badges13271327 bronze badges

asked Sep 25 ’09 at 15:26

tb.tb.

30933 silver badges1313 bronze badges

I did google it but my search terms were off… I got some better info this time. I’ll post my result for future SO reference once ive got it working.

– tb.
Sep 25 ’09 at 15:31

add a comment
 | 

2 Answers
2

Active

Oldest

Votes

1

In order to create an XML version of the format file the command is identical except we use the -x parameter.

bcp “SELECT col1, col2 FROM AdventureWorks.HumanResources.Department” format nul -c -x -f department.xml -T -S servername

share|improve this answer

answered Sep 25 ’09 at 15:31

Lukasz LysikLukasz Lysik

9,55233 gold badges4343 silver badges6868 bronze badges

add a comment
 | 

1

FYI for anyone else….

bcp “Select whatever from dbInstanceName.dbo.tableName” quesryout C:output.txt -e C:errors.txt -c -T -S localhostdbName

share|improve this answer

answered Sep 25 ’09 at 18:31

tb.tb.

30933 silver badges1313 bronze badges

add a comment
 | 

Your Answer

Thanks for contributing an answer to Stack Overflow!Please be sure to answer the question. Provide details and share your research!But avoid …Asking for help, clarification, or responding to other answers.Making statements based on opinion; back them up with references or personal experience.To learn more, see our tips on writing great answers.

Draft saved
Draft discarded

Sign up or log in

Sign up using Google

Sign up using Facebook

Sign up using Email and Password

Submit

Post as a guest

Name

Email
Required, but never shown

Post Your Answer

Discard

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you’re looking for? Browse other questions tagged sql-server command-line sqlbulkcopy or ask your own question.

The Overflow Blog

Podcast: Right Back At Ya

We’re launching an Instagram account

Featured on Meta

An Update On Creative Commons Licensing

Community and Moderator guidelines for escalating issues via new response…

Triage needs to be fixed urgently, and users need to be notified upon…

Upcoming Feature: New Question Close Experience

Related

2724Add a column with a default value to an existing table in SQL Server1758How to return only the Date from a SQL Server DateTime datatype1833How to check if a column exists in a SQL Server table?1116Check if table exists in SQL Server1885How to concatenate text from multiple rows into a single text string in SQL server?1568LEFT JOIN vs. LEFT OUTER JOIN in SQL Server3643How do I UPDATE from a SELECT in SQL Server?1176Find all tables containing column with specified name – MS SQL Server1245How to Delete using INNER JOIN with SQL Server?1970How do I import an SQL file using the command line in MySQL?

Hot Network Questions

Is it unprofessional to add a Stallman-like “you won’t find me on Facebook” to my resume?

How do Minecraft know where village’s buildings are if the village is not generated yet?

How can I avoid straw manning any belief I am against in my game?

MTB freewheel not moving back wheel after change of tyre

Can a naked Changeling use its Shapechanger feature to duplicate the appearance of clothing?

Scheduling problem data generation

What are the pros and cons on installing a typical garage floodlight kit, inside your garage?

Is the connection between ‘right’ in the sense of direction and concepts like ‘correct’ limited to Indo-European languages?

How high can an airplane be spotted with eyesight?

Tex compilation after regex replace

How to draw angled lines in LaTeX to create ruled template for calligraphy?

Why is there a Saturn V in the background of this Gemini-Titan launch?

Is the US President currently making a trade-off of human lives for the economy?

Jewish person visiting American friend in Qatar

Who owns the washing machine?

I need a title out of my name from a vehicle that my ex drive, refuses to cooperate, what can I do to resolve this?

Mathematica numerical “error” for simple multiplication

Is it wrong to use a laptop with the lid closed?

Is there any code in Firefox (as of 2020) that comes from Netscape Navigator?

Contrasting theorems in classical logic and constructivism

How can we encourage programmers to stop overly relying on testers?

How can I improve card design?

Can you use “plague” as a general term?

Ugly roots using newtxmath: alternatives

more hot questions

Question feed

Subscribe to RSS

Question feed
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

lang-sql

Categories
askquestion

Core Data: Design questions. Object wrappers or not?

Core Data: Design questions. Object wrappers or not?

Ask Question

Asked
10 years, 6 months ago

Active
9 years ago

Viewed
740 times

.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{
margin-bottom:0;
}

0

1

I’m designing my first project using Core Data (for iPhone) and Im having some issues that might be related with my design approach.

I’m doing an application that allows the user to create an Order (let’s say for a restaurant).
I’m using the graphic designer to model my persistence object (i.e. OrdeMO). I add MO to the ead of each name to indicate its a Managed Object.
I use XCode to create the Managed Object Class automatically.

I have created some “DAO” classes that allows you to search or create a new object in the Managed Context.

Now to my problem.

I want to create an OrderMO object to store the order the user is creating, BUT I don’t want it to be part of the context until the user actually places it.
I tried creating the object with [OrderMO alloc] but the object I get is “incomplete” and when I try to set any of its attribute I get an error.

I’m assuming the problem is that I need to create the order IN the context in order to use it. Is that so?

I have considered various options:

Create the object in the context and the user rollback if the user discards the order. The problem is that the user might save other context object during the process (like his prefs) so this doesn’t work. Is there a way to create the object “inside a separate transaction” of sorts?
Create a wrapper object that will hold the same data as the MO, and then only create the MO when the user place the order. The downside of this is that I have to maintain a new class.
Create an attribute in the MO, such as “placed”, and use to filter my searches in the context. The problem with this one is that I will end up with “trash” objects in the domain (i.e. unplaced orders) and I will have to do some cleanup from time to time…

Do I have any other choice?

Any suggestion is appreciated.

Thanks (for reading this long post!)
Gonso

core-data wrapper cocoa-design-patterns

share|improve this question

edited Jan 7 ’10 at 0:52

gerry3

21k88 gold badges6161 silver badges7373 bronze badges

asked Sep 25 ’09 at 16:05

gonsogonso

1,94555 gold badges2424 silver badges3535 bronze badges

add a comment
 | 

1 Answer
1

Active

Oldest

Votes

0

You should create the OrderMO object in the managed object context and then delete it if the user decides not to place the order.
If the context is saved before the object is deleted, the “trash” object will be deleted from the persistent store on the next save (if the context wasn’t saved, the “trash” object will never be saved to the persistent store).
The flag to determine if the order was placed or not does not have to live in the OrderMO object as you suggest in option 3. It could be in the view controller that is tracking the order(s) that are being edited. And, again, you won’t have “trash” objects because they will have been deleted.

share|improve this answer

answered Nov 3 ’09 at 5:18

gerry3gerry3

21k88 gold badges6161 silver badges7373 bronze badges

add a comment
 | 

Your Answer

Thanks for contributing an answer to Stack Overflow!Please be sure to answer the question. Provide details and share your research!But avoid …Asking for help, clarification, or responding to other answers.Making statements based on opinion; back them up with references or personal experience.To learn more, see our tips on writing great answers.

Draft saved
Draft discarded

Sign up or log in

Sign up using Google

Sign up using Facebook

Sign up using Email and Password

Submit

Post as a guest

Name

Email
Required, but never shown

Post Your Answer

Discard

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you’re looking for? Browse other questions tagged core-data wrapper cocoa-design-patterns or ask your own question.

The Overflow Blog

Podcast: Right Back At Ya

We’re launching an Instagram account

Featured on Meta

An Update On Creative Commons Licensing

Community and Moderator guidelines for escalating issues via new response…

Triage needs to be fixed urgently, and users need to be notified upon…

Upcoming Feature: New Question Close Experience

Related

86How to Deal with Temporary NSManagedObject instances?22Core Data merge two Managed Object Context57Core Data background fetching via new NSPrivateQueueConcurrencyType6Best practice for temporary objects in RestKit with Core Data9Core Data managed object context design recommendation0Core data data not saved8How to handle cleanup of external data when deleting *unsaved* Core Data objects?2Core Data fault after deleting managed object

Hot Network Questions

Is force frame dependent?

Installing ArcGIS Python API with ArcGIS Pro

Why should one pre-heat an oven?

Home Networking: How can I have ethernet in another part of the house?

2000’s novel where a man wakes up to find a chunk of his brain replaced by a cybernetic implant he turns out to have developed himself

Why is memetics not more widely accepted?

QGIS 3.4 Add vector styles and attribute fields in a model

How much does it cost to develop an online course?

How can I plot a parametric equation with ±?

Contrasting theorems in classical logic and constructivism

Is it possible to fabricate decent food from various types of junk and dirt?

What is the minimum count of steps required to complete this maze correctly?

I need a title out of my name from a vehicle that my ex drive, refuses to cooperate, what can I do to resolve this?

How to deal with what I think is an ebay scam?

Do I get a bonus d6 to Magic Missile damage if my expert sidekick helps me?

Ugly roots using newtxmath: alternatives

How does a disease cause its hosts to travel more?

Why did the KH-11 get the nickname “Kennen”?

Is there any code in Firefox (as of 2020) that comes from Netscape Navigator?

How can an omniscient being have limited awareness?

Mathematica numerical “error” for simple multiplication

How have they traditionally handled safety on submarines in regards to “surface cruising”?

coronavirus – Why no ‘c’ capital? Why is there no space?

How, or should I repay debt during Covid-19 crisis?

more hot questions

Question feed

Subscribe to RSS

Question feed
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Categories
askquestion

Is there a way to use WPF Grid without specifying absolute cell coordinates for every item?

Is there a way to use WPF Grid without specifying absolute cell coordinates for every item?

Ask Question

Asked
10 years, 6 months ago

Active
2 years, 9 months ago

Viewed
2k times

.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{
margin-bottom:0;
}

9

My typical form with Grid look like this in XAML:

<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width=”Auto”></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height=”Auto”></RowDefinition>
<RowDefinition Height=”Auto”></RowDefinition>
<RowDefinition Height=”Auto”></RowDefinition>
<RowDefinition Height=”Auto”></RowDefinition>
<RowDefinition Height=”Auto”></RowDefinition>
<RowDefinition Height=”Auto”></RowDefinition>
</Grid.RowDefinitions>

….

<TextBlock Grid.Row=”6″ Text=”Component”/>
<TextBox Grid.Row=”6″ Grid.Column=”1″ Text=”{Binding Component.Name}”></TextBox>
<TextBlock Grid.Row=”7″ Text=”Bussiness Process”/>
<TextBox Grid.Row=”7″ Grid.Column=”1″ Text=”{Binding BusinessProcess.Name}”></TextBox>

</Grid>

Is there a way to avoid specifying th exact Row/Column coordinates?

Basically, I would like to be able to reorder my controls in the Grid quickly by copying XAML around and now I have to change the coordinates which is awkward. I don’t want to reorder them in the Designer because it adds some unnecessary properties to the items.

wpf xaml grid

share|improve this question

asked Sep 25 ’09 at 16:05

Max GalkinMax Galkin

15.8k99 gold badges5858 silver badges108108 bronze badges

add a comment
 | 

2 Answers
2

Active

Oldest

Votes

2

No, there is no way to avoid Row/Column numbers. If you don’t want to install MS Blend, you can try wonderful and free Visual Studio addon from Karl Shifflett: XAML Power Toys. Among other useful things it allows you to play with Grid cells…

share|improve this answer

edited Jun 20 ’17 at 17:42

Abbas

2,93411 gold badge2121 silver badges4040 bronze badges

answered Sep 25 ’09 at 16:19

AnvakaAnvaka

14.3k22 gold badges4040 silver badges5151 bronze badges

This, unfortunately, doesn’t help with the “extra properties” issue, though, since it’s still using the VS Designer. Great toolset, though.

– Reed Copsey
Sep 25 ’09 at 16:28

Looks cool, it can just generate a simple form from the scratch, I’ll give it a try! Spasibo )

– Max Galkin
Sep 25 ’09 at 16:29

add a comment
 | 

3

No. Unfortunately, the Grid works by having the Grid.Row and Grid.Column attached properties defined on the children – they must be specified on each child.

BTW – Blend does a better job of letting you move these things around without the “extra” properties appearing. You may want to try giving that a shot for these types of situations.

share|improve this answer

answered Sep 25 ’09 at 16:12

Reed CopseyReed Copsey

498k6565 gold badges10421042 silver badges13111311 bronze badges

1

IS there any other layout control that can organize my controls into “columns”?

– Max Galkin
Sep 25 ’09 at 16:14

1

You can use a StackPanel with each “row” containing a horizontally oriented stackpanel – in that case, elements will align. To get a perfect “grid”, though, the elements would have to naturally be the same size.

– Reed Copsey
Sep 25 ’09 at 16:28

add a comment
 | 

Your Answer

Thanks for contributing an answer to Stack Overflow!Please be sure to answer the question. Provide details and share your research!But avoid …Asking for help, clarification, or responding to other answers.Making statements based on opinion; back them up with references or personal experience.To learn more, see our tips on writing great answers.

Draft saved
Draft discarded

Sign up or log in

Sign up using Google

Sign up using Facebook

Sign up using Email and Password

Submit

Post as a guest

Name

Email
Required, but never shown

Post Your Answer

Discard

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you’re looking for? Browse other questions tagged wpf xaml grid or ask your own question.

The Overflow Blog

Podcast: Right Back At Ya

We’re launching an Instagram account

Featured on Meta

Planned maintenance scheduled for Saturday, March 28, 2020 at 13:00 UTC (9AM…

An Update On Creative Commons Licensing

Community and Moderator guidelines for escalating issues via new response…

Triage needs to be fixed urgently, and users need to be notified upon…

Upcoming Feature: New Question Close Experience

Related

36ListBox with Grid as ItemsPanelTemplate produces weird binding errors1WPF Button text wrap as far as possible and then scroll1Silverlight Grid – Stretch to parents containersize but do not expand to acommodate children0How to prevent TextBox from stretching vertically inside Grid0My rowSpan doesn’t take 2 lines1Binding a TextBox’s Text Property to TextBlock’s Attached Property like Grid.Row0XAML – Restrict Width of one TextBlock in flexible Grid, while not restricting other Grid childern?1How do I Bind a WPF Ellipse’s Height to its own Width?1Why do ListView.HeaderTemplate and ListView.ItemTemplate (UWP XAML) display differently even though I use the exact same XAML?2How to make textboxes width dynamically like buttons in xaml

Hot Network Questions

Abelian category equivalent to a non-abelian category

Why don’t folks seem to use ECC for TLS root certificate signature?

Other meanings of “идти” besides “to go by foot”?

Is it fine to send a message to the author of a paper if I don’t understand something and want to clarify it?

Chord progression sounding good even though it has a chord out of scale

Can’t run latest Blender on Ubuntu 18.04

What are the objections to Pelosi’s COVID-19 Bill?

Freezing boiled octopus

Can the SARS-CoV-2 virus float in the air for up to 3 hours?

Players get frustrated when they couldn’t solve a hard diplomatic problem, how to get them to think out of the box

Can you use “plague” as a general term?

Why would I ever pick bows over powers?

How high can an airplane be spotted with eyesight?

Pseudo-deterministic number generator

How to do the equivalent of a “where” clause with `find` and `grep`

Convert Planck unit to SI metric

Is there a better way to formulate this constraint?

Why are the orthographies of Ancient/Proto Languages so Impractical?

What version of Divinity is the most recent?

Is the connection between ‘right’ in the sense of direction and concepts like ‘correct’ limited to Indo-European languages?

How much does it cost to develop an online course?

QGIS 3.4 Add vector styles and attribute fields in a model

How is pasteurization different from sterilization?

Is it possible to use a TXT record for CAA (Certification Authority Authorization)

more hot questions

Question feed

Subscribe to RSS

Question feed
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

lang-xml

Categories
askquestion

How to compare only date components from DateTime in EF?

How to compare only date components from DateTime in EF?

Ask Question

Asked
10 years, 6 months ago

Active
3 years, 4 months ago

Viewed
136k times

.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{
margin-bottom:0;
}

115

11

I am having two date values, one already stored in the database and the other selected by the user using DatePicker. The use case is to search for a particular date from the database.

The value previously entered in the database always has time component of 12:00:00, where as the date entered from picker has different time component.

I am interested in only the date components and would like to ignore the time component.

What are the ways to do this comparison in C#?

Also, how to do this in LINQ?

UPDATE:
On LINQ to Entities, the following works fine.

e => DateTime.Compare(e.FirstDate.Value, SecondDate) >= 0

c# linq entity-framework linq-to-entities datetime-comparison

share|improve this question

edited May 20 ’12 at 18:33

abatishchev

87.3k7070 gold badges273273 silver badges411411 bronze badges

asked Sep 25 ’09 at 16:07

pencilslatepencilslate

11.8k1717 gold badges5050 silver badges7171 bronze badges

1

You can also take a look at this SO question: stackoverflow.com/questions/683037/how-to-compare-dates-in-c/…

– Quintin Robinson
Sep 25 ’09 at 16:16

add a comment
 | 

14 Answers
14

Active

Oldest

Votes

121

NOTE: at the time of writing this answer, the EF-relation was unclear (that was edited into the question after this was written). For correct approach with EF, check Mandeeps answer.

You can use the DateTime.Date property to perform a date-only comparison.

DateTime a = GetFirstDate();
DateTime b = GetSecondDate();

if (a.Date.Equals(b.Date))
{
// the dates are equal
}

share|improve this answer

edited May 23 ’17 at 12:34

Community♦

111 silver badge

answered Sep 25 ’09 at 16:10

Fredrik MörkFredrik Mörk

140k2424 gold badges264264 silver badges326326 bronze badges

34

It’s easy to compare date but the question is related to LINQ to Entities who is unable to convert .Date property into SQL.

– Michaël Carpentier
Jan 30 ’13 at 13:06

1

@MichaëlCarpentier: good point. Apparently it still solved the OP’s problem.

– Fredrik Mörk
Jan 30 ’13 at 13:17

5

This doesn’t query the database but rather processes the data in the CLR / application layer after the fact. The real solution is to use the EntityFunctions.TruncateTime(..) function as specified in the answer below, since it sends the query to the database and allows the processing to be done at the storage layer. Without this you couldn’t use the date comparison logic in Where / Count clauses and then further query on the filtered data, since you’d have to pull partial results into the application layer first, which can be a deal-breaker in scenarios that process large bodies of data.

– Marchy
Oct 3 ’13 at 2:46

6

@Marchy Yes, EntityFunctions.TruncateTime certainly seem to be the way to go these days (it became available in .NET 4 which was released the year after this question was asked).

– Fredrik Mörk
Oct 3 ’13 at 7:30

1

use System.Data.Entity.DbFunctions.TruncateTime() method. You need to add a reference to EntityFramework

– adeel41
Jun 18 ’15 at 10:19

add a comment
 | 

131

Use the class EntityFunctions for trimming the time portion.

using System.Data.Objects;

var bla = (from log in context.Contacts
where EntityFunctions.TruncateTime(log.ModifiedDate) == EntityFunctions.TruncateTime(today.Date)
select log).FirstOrDefault();

Source: http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/84d4e18b-7545-419b-9826-53ff1a0e2a62/

UPDATE

As of EF 6.0 and later EntityFunctions is replaced by DbFunctions.

share|improve this answer

edited Sep 28 ’16 at 6:03

jmvtrinidad

2,15933 gold badges1616 silver badges3636 bronze badges

answered Mar 9 ’12 at 23:20

Mandeep JanjuaMandeep Janjua

11.3k44 gold badges2525 silver badges2222 bronze badges

36

Just a note EntityFunctions has been deprecated in favor of System.Data.Entity.DbFunctions for (at least) EF6. It may have been earlier than this.

– pquest
Sep 2 ’14 at 19:55

4

I wouldn’t be quick to jump to this solution as it is really slow, more info: stackoverflow.com/questions/22776843/…

– pajics
Jul 22 ’15 at 9:05

Doesn’t seem to work with a SQLite database. I get “SQL logic error or missing database no such function: TruncateTime”.

– shadowsora
Nov 29 ’17 at 13:37

add a comment
 | 

24

I think this could help you.

I made an extension since I have to compare dates in repositories filled with EF data and so .Date was not an option since it is not implemented in LinqToEntities translation.

Here is the code:

/// <summary>
/// Check if two dates are same
/// </summary>
/// <typeparam name=”TElement”>Type</typeparam>
/// <param name=”valueSelector”>date field</param>
/// <param name=”value”>date compared</param>
/// <returns>bool</returns>
public Expression<Func<TElement, bool>> IsSameDate<TElement>(Expression<Func<TElement, DateTime>> valueSelector, DateTime value)
{
ParameterExpression p = valueSelector.Parameters.Single();

var antes = Expression.GreaterThanOrEqual(valueSelector.Body, Expression.Constant(value.Date, typeof(DateTime)));

var despues = Expression.LessThan(valueSelector.Body, Expression.Constant(value.AddDays(1).Date, typeof(DateTime)));

Expression body = Expression.And(antes, despues);

return Expression.Lambda<Func<TElement, bool>>(body, p);
}

then you can use it in this way.

var today = DateTime.Now;
var todayPosts = from t in turnos.Where(IsSameDate<Turno>(t => t.MyDate, today))
select t);

share|improve this answer

answered Nov 18 ’09 at 23:59

community wiki

jrojo

add a comment
 | 

10

If you use the Date property for DB Entities you will get exception:

“The specified type member ‘Date’ is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported.”

You can use something like this:

DateTime date = DateTime.Now.Date;

var result = from client in context.clients
where client.BirthDate >= date
&& client.BirthDate < date.AddDays(1)
select client;

share|improve this answer

answered Jul 26 ’12 at 8:48

algreatalgreat

7,17244 gold badges3333 silver badges5252 bronze badges

add a comment
 | 

8

To do it in LINQ to Entities, you have to use supported methods:

var year = someDate.Year;
var month = …
var q = from r in Context.Records
where Microsoft.VisualBasic.DateAndTime.Year(r.SomeDate) == year
&& // month and day

Ugly, but it works, and it’s done on the DB server.

share|improve this answer

answered Sep 30 ’09 at 16:46

Craig StuntzCraig Stuntz

122k1212 gold badges241241 silver badges266266 bronze badges

add a comment
 | 

8

Here’s a different way to do it, but it’s only useful if SecondDate is a variable you’re passing in:

DateTime startDate = SecondDate.Date;
DateTime endDate = startDate.AddDays(1).AddTicks(-1);

e => e.FirstDate.Value >= startDate && e.FirstDate.Value <= endDate

I think that should work

share|improve this answer

answered Jul 1 ’11 at 17:12

John KasterJohn Kaster

2,2693030 silver badges3434 bronze badges

1

Excellent. Worked for me. It was the explicit DateTime = x.Date; I was missing. If I used var, or had the value inline in the comparison it failed with the exception reported. Thanks.

– Tim Croydon
Jun 1 ’12 at 9:45

Glad it worked, Tim. Sorry for the delay in responding – I haven’t actually logged in to SO in a while.

– John Kaster
Oct 22 ’12 at 0:05

1

If you change e.FirstDate.Value <= endDate to e.FirstDate.Value < endDate you can remove the .AddTicks(-1).

– Marco de Zeeuw
Aug 9 ’15 at 12:40

@MarcodeZeeuw you’re right, that would definitely work as well. The conditional expression shown is intended for inclusive date comparisons of exact start and end datetimes (assuming the date range values would be passed in to the condition rather than set up in a code fragment.) IOW, the conditional is considered separate from the datetime values.

– John Kaster
Aug 12 ’15 at 0:05

add a comment
 | 

6

You can also use this:

DbFunctions.DiffDays(date1, date2) == 0

share|improve this answer

answered Dec 17 ’15 at 16:46

user3829854user3829854

17522 silver badges33 bronze badges

add a comment
 | 

4

you can use DbFunctions.TruncateTime() method for this.

e => DbFunctions.TruncateTime(e.FirstDate.Value) == DbFunctions.TruncateTime(SecondDate);

share|improve this answer

answered Nov 11 ’16 at 6:26

Harsh VyasHarsh Vyas

15711 silver badge1111 bronze badges

add a comment
 | 

3

Just always compare the Date property of DateTime, instead of the full date time.

When you make your LINQ query, use date.Date in the query, ie:

var results = from c in collection
where c.Date == myDateTime.Date
select c;

share|improve this answer

answered Sep 25 ’09 at 16:10

Reed CopseyReed Copsey

498k6565 gold badges10421042 silver badges13111311 bronze badges

10

I am getting the error “The specified type member ‘Date’ is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported.”. Any thoughts?

– pencilslate
Sep 25 ’09 at 16:46

Yeah – your provider doesn’t handle the .Date property directly. You’ll have to pull it out, and compare the dates later.

– Reed Copsey
Sep 25 ’09 at 17:03

.Date can’t be used in Linq To Entities, unfortunately. Hopefully MS will add that overload support soon

– John Kaster
Jul 1 ’11 at 16:59

1

Always compare the Date property? I’ve googled into this comment because I have wondered if that is the best practice, ie. to always use the Date property, even when it’s something like candidate.Date >= base.Date. Theoritically, the candidate.Date time must be >= 12:00:00, so using the Date property is redundant, but I’ll stick with Reed’s advice.

– Stephen Hosking
Apr 11 ’12 at 6:12

add a comment
 | 

3

This is how I do this.

DateTime date_time_to_compare = DateTime.Now;
//Compare only date parts
context.YourObject.FirstOrDefault(r =>
EntityFunctions.TruncateTime(r.date) == EntityFunctions.TruncateTime(date_to_compare));

share|improve this answer

answered Feb 17 ’14 at 9:25

Alejandro del RíoAlejandro del Río

3,19422 gold badges3030 silver badges2929 bronze badges

add a comment
 | 

2

//Note for Linq Users/Coders

This should give you the exact comparison for checking if a date falls within range when working with input from a user – date picker for example:

((DateTime)ri.RequestX.DateSatisfied).Date >= startdate.Date &&
((DateTime)ri.RequestX.DateSatisfied).Date <= enddate.Date

where startdate and enddate are values from a date picker.

share|improve this answer

edited Aug 5 ’11 at 12:17

Alberto Zaccagni

26.5k99 gold badges6767 silver badges100100 bronze badges

answered Aug 4 ’11 at 16:01

Leo Di SaltyLeo Di Salty

2122 bronze badges

add a comment
 | 

1

Without time than try like this:

TimeSpan ts = new TimeSpan(23, 59, 59);
toDate = toDate.Add(ts);
List<AuditLog> resultLogs =
_dbContext.AuditLogs
.Where(al => al.Log_Date >= fromDate && al.Log_Date <= toDate)
.ToList();
return resultLogs;

share|improve this answer

edited Feb 20 ’12 at 1:38

Dmitrii Lobanov

4,50911 gold badge2828 silver badges4646 bronze badges

answered Feb 18 ’12 at 6:55

Nalan MadheswaranNalan Madheswaran

6,36611 gold badge3939 silver badges3232 bronze badges

add a comment
 | 

1

You can user below link to compare 2 dates without time :

private bool DateGreaterOrEqual(DateTime dt1, DateTime dt2)
{
return DateTime.Compare(dt1.Date, dt2.Date) >= 0;
}

private bool DateLessOrEqual(DateTime dt1, DateTime dt2)
{
return DateTime.Compare(dt1.Date, dt2.Date) <= 0;
}

the Compare function return 3 different values: -1 0 1 which means dt1>dt2, dt1=dt2, dt1

share|improve this answer

edited Apr 18 ’12 at 9:44

antyrat

25.1k99 gold badges6363 silver badges7171 bronze badges

answered Apr 18 ’12 at 9:36

majidmajid

1911 bronze badge

Why don’t you just return DateTime.Compare(dt1.Date, dt2.Date)? This makes all you need.

– Johnny Graber
Oct 27 ’12 at 6:58

add a comment
 | 

0

Try this… It works fine to compare Date properties between two DateTimes type:

PS. It is a stopgap solution and a really bad practice, should never be used when you know that the database can bring thousands of records…

query = query.ToList()
.Where(x => x.FirstDate.Date == SecondDate.Date)
.AsQueryable();

share|improve this answer

edited Sep 15 ’15 at 15:01

answered Feb 6 ’12 at 16:58

RaskunhoRaskunho

933 bronze badges

1

P.S.: I usually use this way when the DateTimes have Time value and I want to compare only the Date.

– Raskunho
Feb 19 ’12 at 0:36

2

this is a very bad solution, the query will get all the records, and only then filter out the dates. if the database has millions of records, this will grab all of them and only then will filter the dates. VERY BAD PRACTICE.

– Dementic
May 27 ’15 at 7:57

1

It is a stopgap solution and a really bad practice, should never be used when you know that the database can bring thousands of records.

– Raskunho
Aug 13 ’15 at 21:07

if you’ll add your comment into your answer, i will remove my down-vote. it should be clear to anyone visiting this page that the solution you proposed is bad without having to read the comments.

– Dementic
Aug 14 ’15 at 7:44

While a bad idea in general, this approach results in hugely improved performance for small record sets (<1000 records or so), because of the daft way EF translates date comparisons to SQL. I’ve seen queries go from over a minute to under a second just by doing the date comparison in memory instead of in whatever SQL EF generates.

– Extragorey
Aug 12 ’19 at 3:16

add a comment
 | 

Your Answer

Thanks for contributing an answer to Stack Overflow!Please be sure to answer the question. Provide details and share your research!But avoid …Asking for help, clarification, or responding to other answers.Making statements based on opinion; back them up with references or personal experience.To learn more, see our tips on writing great answers.

Draft saved
Draft discarded

Sign up or log in

Sign up using Google

Sign up using Facebook

Sign up using Email and Password

Submit

Post as a guest

Name

Email
Required, but never shown

Post Your Answer

Discard

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you’re looking for? Browse other questions tagged c# linq entity-framework linq-to-entities datetime-comparison or ask your own question.

The Overflow Blog

Podcast: Right Back At Ya

We’re launching an Instagram account

Featured on Meta

Planned maintenance scheduled for Saturday, March 28, 2020 at 13:00 UTC (9AM…

An Update On Creative Commons Licensing

Community and Moderator guidelines for escalating issues via new response…

Triage needs to be fixed urgently, and users need to be notified upon…

Upcoming Feature: New Question Close Experience

Linked

0

Compare dates linq c#

293

How to compare only Date without Time in DateTime types in Linq to SQL with Entity Framework?

1

Table Join performance issue with Entity Framework

3

Dynamically select column name using Linq to Entities (EF6)

3

C# Dynamic Linq Ternary Operator

0

Asp.net MVC 3 Linq DateTime

1

Display Results by Date ASP.NET MVC

1

Search with date only

1

Dynamic LINQ with datetime

0

EF5 + Using the ‘LIKE’ operator inside a Lambda Expression

see more linked questions…

Related

758Given a DateTime object, how do I get an ISO 8601 date in string format?1371How do I update the GUI from another thread?293How to compare only Date without Time in DateTime types in Linq to SQL with Entity Framework?39Group by Weeks in LINQ to Entities446How to remove time portion of date in C# in DateTime object only?1Dynamic LINQ OrderBy Date only on DateTime Object Entity Framework1How can i compare and seach string and datetime c#

Hot Network Questions

Why should one pre-heat an oven?

2000’s novel where a man wakes up to find a chunk of his brain replaced by a cybernetic implant he turns out to have developed himself

Can you use “plague” as a general term?

I made a guess the number game in Python

How high can an airplane be spotted with eyesight?

What are the pros and cons on installing a typical garage floodlight kit, inside your garage?

Is there a “Facebook” for researchers? (to collaborate on projects)

What are the differences between a $25 sleeping bag and a $440 sleeping bag if they have the same temp rating?

Can’t run latest Blender on Ubuntu 18.04

coronavirus – Why no ‘c’ capital? Why is there no space?

Logic behind structures like «в общей сложности»

Other meanings of “идти” besides “to go by foot”?

Abelian category equivalent to a non-abelian category

Is there a better way to formulate this constraint?

How to deal with what I think is an ebay scam?

Resume: Is it unprofessional to add a Stallman-like “you won’t find me on Facebook”?

How to to deal with criticism on my writing?

In place of cream of tartar to stabilize egg whites?

I have the following chord progression. But not scale exists. Is this okay?

Is there any code in Firefox (as of 2020) that comes from Netscape Navigator?

Home Networking: How can I have ethernet in another part of the house?

HS Lessons On Modeling Virus Spread

Justifying the “Physicist’s method” for ODEs using differential forms

Series of stories about a technologically-advanced society with nude masters but clothed slaves

more hot questions

Question feed

Subscribe to RSS

Question feed
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

lang-cs

Categories
askquestion

Unexpected value in Exception object in catch block (c# compact framework)

Unexpected value in Exception object in catch block (c# compact framework)

Ask Question

Asked
10 years, 6 months ago

Active
10 years, 6 months ago

Viewed
1k times

.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{
margin-bottom:0;
}

0

I maintain a c# compact framework application and have had 2 cases in 2 days where the a caught exception had a unexpected string in the Message. Both times due to a different exception type being thrown. In the following code the socket exception is caught, but the message shown relates to something else.

//method1
try
{
soc.Connect(new IPEndPoint(IPAddress.Parse(_serverAddress), _serverPort));

}
catch (Exception ex)
{
MessageBox.Show(ex.Message)
}

//method2
try
{
m_socServer.Connect(new IPEndPoint(IPAddress.Parse(_serverAddress), _serverPort));

}
catch (SocketException sex)
{
MessageBox.Show(sex.Message)
}

In ‘method1’ the exception is thrown upon fail to connect, the catch block entered, but the message box shown an exception I know is from outside of this try block. In ‘method2’ the exception is caught and the message is correct. These two try catch blocks are the only thing changed in the code.

I have yet to reproduce this in a small test program, but the program I maintain has this behaviour.

Where and why does ‘method1’ not get the unexpected value?

c# exception windows-mobile compact-framework

share|improve this question

edited Sep 28 ’09 at 12:33

Barry

asked Sep 25 ’09 at 16:08

BarryBarry

144 bronze badges

From the comments you wrote below I got more confused as to what you really want, I think you need to elaborate on your problem.

– pauloya
Sep 29 ’09 at 6:44

I once worked at a company where someone got fired for excessively using variable names with sexual and sometimes sexist connotation. I got reprimanded for not telling anyone about it. Just him and me worked on it, but he was the senior. I have since chosen to work someplace else. Just saying.

– Traubenfuchs
Sep 9 ’14 at 12:57

add a comment
 | 

3 Answers
3

Active

Oldest

Votes

2

You are probably mistaken – in these 2 cases, some other exception (the one you’re receiving) is being thrown instead of a SocketException.

If you’re only expecting SocketException to be thrown, you should only provide a handler for that case. Other exceptions, in this situation, are probably truly exceptional – meaning that you aren’t going to be able to correctly recover.

In that case, it’s usually better to not handle the exception, and let it bubble up. If you feel that this is incorrect, put in the SocketException handler AND a generic exception handler, and make sure to check your stack traces (and potentially InnerException properties) in the exceptions:

try
{
//throw SocketException
}
catch (SocketException sockEx)
{
MessageBox.Show(sockEx.Message)
}
catch (Exception ex)
{
MessageBox.Show(ex.Message)
}

share|improve this answer

answered Sep 25 ’09 at 16:15

Reed CopseyReed Copsey

498k6565 gold badges10421042 silver badges13111311 bronze badges

I am not mistaken – both examples I have have a ex.Message relating to something outside the try/catch block.

– Barry
Sep 28 ’09 at 11:45

add a comment
 | 

1

The statement you have above will catch ALL Exceptions, not just a specific type of exception.

If you want to handle specific exception types, you need to have code similar to this:

try
{
// Do some work.
}
catch(SocketException ex)
{
// Handle a known SocketException
}
catch(NullReferenceException ex)
{
// Handle a known NullReferenceException
}
catch(OtherSpecificException ex)
{
// You get the idea
}
catch(Exception ex)
{
// This will be everything else you haven’t explicitly caught.
// It will also give you the most generic details about the Exception.
}

share|improve this answer

answered Sep 25 ’09 at 16:14

Justin NiessnerJustin Niessner

220k3232 gold badges376376 silver badges511511 bronze badges

I appreciate that it is catching the exception, but the contents of ex.Message is wrong if caught with Excption, if I caught with SockectExcption everything is fine.

– Barry
Sep 28 ’09 at 11:47

When you catch the generic Exception, have you checked to make sure the SocketException isn’t being wrapped in the InnerException of the one you’re catching?

– Justin Niessner
Sep 28 ’09 at 12:29

add a comment
 | 

1

When you handle exceptions you can think of who needs to be notified of the error: the user? or the admin/developer?
You can define that a SocketException contains a message that the user needs to be notified of, and every other exception should be saved for developers or administrators to see. For example you can write the full exception to a file, or event you can have a special MessageBox. “Unexpected Error, please notify the administrator: ” + ex.ToString().
Make sure you write the whole ex.ToString() because it includes the stacktrace and all InnerException’s.

The best practice is to keep the catch(Exception ex) on the outer level of your application so you handle all unexpected exception in one place.

share|improve this answer

answered Sep 25 ’09 at 16:36

pauloyapauloya

2,42311 gold badge2929 silver badges4949 bronze badges

I agree, but this does not explain how the ‘Exception ex’ has unexpected data in the ‘Message’

– Barry
Sep 28 ’09 at 11:48

If all you see is the Message you don’t have enough information to understand what the problem is. If you had the exception type and the full stack trace and possible inner exceptions you could more easily understand why an exception occurred.

– pauloya
Sep 28 ’09 at 11:51

The issue is that ‘catch (Exception ex)’ catches the exception with unexpected (i.e. incorrect) information. What use is any information if it does not relate to the exception thrown?

– Barry
Sep 28 ’09 at 12:31

I’m not sure what you mean by incorrect information. An exception by definition is thrown unexpectedly, usually because of some lack of resources or some bug in the code. You want to have a Catch All somewhere that informs you about all unexpected exceptions so you change your code to deal with it.

– pauloya
Sep 29 ’09 at 6:35

add a comment
 | 

Your Answer

Thanks for contributing an answer to Stack Overflow!Please be sure to answer the question. Provide details and share your research!But avoid …Asking for help, clarification, or responding to other answers.Making statements based on opinion; back them up with references or personal experience.To learn more, see our tips on writing great answers.

Draft saved
Draft discarded

Sign up or log in

Sign up using Google

Sign up using Facebook

Sign up using Email and Password

Submit

Post as a guest

Name

Email
Required, but never shown

Post Your Answer

Discard

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you’re looking for? Browse other questions tagged c# exception windows-mobile compact-framework or ask your own question.

The Overflow Blog

Podcast: Right Back At Ya

We’re launching an Instagram account

Featured on Meta

Planned maintenance scheduled for Saturday, March 28, 2020 at 13:00 UTC (9AM…

An Update On Creative Commons Licensing

Community and Moderator guidelines for escalating issues via new response…

Related

1848What is the best way to give a C# auto-property an initial value?2088Catch multiple exceptions at once?170Exception thrown inside catch block – will it be caught again?445The case against checked exceptions551Why catch and rethrow an exception in C#?1784Get int value from enum in C#112C# catch a stack overflow exception691Can I catch multiple Java exceptions in the same catch clause?2660Catch multiple exceptions in one line (except block)

Hot Network Questions

Abelian category equivalent to a non-abelian category

How can I avoid straw manning any belief I am against in my game?

I made a guess the number game in Python

What are the differences between a $25 sleeping bag and a $440 sleeping bag if they have the same temp rating?

Do I get a bonus d6 to Magic Missile damage if my expert sidekick helps me?

Stuck in New Zealand due to coronavirus

Could a red tree exist

How much does it cost to develop an online course?

How is pasteurization different from sterilization?

Why are the orthographies of Ancient/Proto Languages so Impractical?

What are those large poles for that are always in front of US stand-alone store buildings?

Do I really need the N-MOS driver here?

Why did Gandalf bring Pippin along to blind the Nazgul?

God is real . . . unless declared integer

Mathematica numerical “error” for simple multiplication

Which solver solves PSD constrained convex non-linear problem

Short Story: A writer has his fiction analyzed by a computer

A puzzle made special for today

What version of Divinity is the most recent?

How could Bernie Sanders stall the $2tn economic rescue package?

Can I do a multi day cycle tour in Germany now (during Corona time), on my own, camping in public places?

Justifying the “Physicist’s method” for ODEs using differential forms

How can my vampires hide in public?

Why are some energies dependent on reference frame, and some are not? And why is transfer between them possible?

more hot questions

Question feed

Subscribe to RSS

Question feed
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

lang-cs

Categories
askquestion

What notes should I be taking, if any, at the beginning of a project?

What notes should I be taking, if any, at the beginning of a project?

Ask Question

Asked
10 years, 6 months ago

Active
5 years, 3 months ago

Viewed
348 times

.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{
margin-bottom:0;
}

5

4

I was recently asked by a Team Leader (not mine) if I would be willing to undertake a programming project. The members of his team are currently pre-occupied with other more important projects. I graduated college two years ago, and up until now programming has only been a hobby of mine. Recently I decided that I would like to pursue a career in software development. I accepted his offer so that I can gain some real-world experience and start building a portfolio.

In about an hour I’m scheduled to meet with the Team Leader to discuss the details of what he needs. From a short e-mail exchange with him, I know that the base project is to update an existing ASP.NET form—but I also think there’s more to it than that.

Considering that I’d like to eventually put this project in a portfolio, what kinds of notes should I take at the meeting?

project-planning

share|improve this question

edited May 27 ’10 at 1:42

Roger Pate

asked Sep 25 ’09 at 16:08

Justin RusbatchJustin Rusbatch

3,71222 gold badges2020 silver badges4242 bronze badges

2

What kind of notes did you end up taking?

– JB King
Sep 28 ’09 at 18:22

What I thought was one project is in fact several. Currently, many of our internal forms are static HTML pages that haven’t been updated in years. There are so many forms that finding specific forms is difficult and time consuming. The team leader has started an initiative to modernize the forms and automate as much of process as possible. The (one-on-one) meeting I attended served as an introduction to his initiative, rather than any one project, so I ended up writing very few notes (just defined some abbreviations).

– Justin Rusbatch
Sep 30 ’09 at 12:27

add a comment
 | 

7 Answers
7

Active

Oldest

Votes

6

I graduated college two years ago, and up until now programming has only been a hobby of mine.

In that case, my suggestion is:

revel in your ignorance.

Make the most of the fact that you know nothing and you’re being given an opportunity to learn – abuse the chance to ask as many questions as possible of the Team Leader in question regarding what type of questions you should be asking and how you should be documenting what you learn.

You only get one chance to be ignorant, once you’ve wasted it you have to spend the rest of your life as a know-it-all; take the chance to enjoy the learning process.

share|improve this answer

answered Sep 25 ’09 at 16:21

SteerpikeSteerpike

13.8k77 gold badges3636 silver badges5050 bronze badges

And there’s only one chance to make a first impression. Your advice will make him give an awful one. You can certainly be ignorant and you shouldn’t be afraid of it, but you have to do your homework. You can ask for guidance and advice, but you can’t sit there and tell the guy: “Well, I haven’t a clue about any of this software development thingy, could you ask the questions yourself and answer them for me? I’ll go grab a bite and be back in 20”

– Vinko Vrsalovic
Sep 25 ’09 at 16:52

Oh for god’s sake, you just said exactly the same thing I did, with more qualifiers. ‘You can certainly be ignorant and shouldn’t be afraid of it.’ and ‘You can ask for guidance and advice’. Do you honestly think that that’s not precisely what I was saying in my answer, just with different language? Stop being so bloody literal.

– Steerpike
Sep 25 ’09 at 17:16

I think the qualifiers are crucially important in this case: “Ask away, but do your homework”. You only said: “ask away.”

– Vinko Vrsalovic
Sep 26 ’09 at 9:54

While the other answers to my question are great suggestions if I were in a meeting with other developers and focusing on one specific project, this answer applied most to my situation. The projects that I will be involved in will introduce me to a myriad of different business process as well as the people in charge of those processes.

– Justin Rusbatch
Sep 30 ’09 at 12:36

add a comment
 | 

7

Take whatever notes you can that will best help you understand the use cases and the user requirements. Everything else is just technical details that can be figured out later.

share|improve this answer

edited Sep 25 ’09 at 16:17

answered Sep 25 ’09 at 16:11

Robert HarveyRobert Harvey

161k4141 gold badges300300 silver badges452452 bronze badges

I added a couple of Wikipedia links.

– Robert Harvey
Sep 25 ’09 at 16:18

add a comment
 | 

4

Get a list of people who are the intended users. Talking with them will allow you to flesh out the overview that the Team Leader gives you. It is likely that the intended users have a very different understanding of what the app is supposed to do than the TL does. So you’ll likely be going back and forth for a while. It’s well worth the effort though because you’ll do much less re-coding.

share|improve this answer

answered Sep 25 ’09 at 16:19

dnagirldnagirl

18.7k1212 gold badges7171 silver badges110110 bronze badges

add a comment
 | 

3

Try to understand that the Team Leader him/herself might not even have all the requirements available right at the beginning. Be prepared to be hunting down people and writing all these requirements down as they come in.

Things will change during development, new problems and new requirements will always be popping up.

share|improve this answer

answered Sep 25 ’09 at 16:15

Peter DPeter D

4,63022 gold badges2323 silver badges3030 bronze badges

add a comment
 | 

3

Three things:

What: What is the software supposed to do, the more detailed you can manage to get the other person to be, the better.
How: Are there any known constraints? For example, if it has to ask for a telephone number, does it have to validate nationally/internationally/not at all. Does it have to run on Windows 2008/2003/all
Who: Two sides:

Who will answer any questions you’ll have, will you setup weekly progress meetings?
Who will use the software, can you get their early input on your prototypes, can you ask them for opinion/requirements?

share|improve this answer

answered Sep 25 ’09 at 16:21

Vinko VrsalovicVinko Vrsalovic

230k4747 gold badges306306 silver badges355355 bronze badges

add a comment
 | 

3

One thing I’ve found very helpful is carrying a hard-copy of any existing requirements (use cases, wireframes, whatever) or any other potentially useful information in a 3 ring binder to any project meetings I attend. If the meeting strays off topic or questions about previous discussions or documents come up it is very nice to have the information at your fingertips in a format you can make notes on, pass around the table etc.

As a bonus, I find most people don’t carry any documents to meetings, so you’ll also end up looking like you are a real go-getter who is always prepared, which is never a bad thing.

Main downside to this is that you’ll waste paper if the documents are updated and changed frequently.

share|improve this answer

edited Sep 28 ’09 at 14:58

answered Sep 25 ’09 at 17:07

MillhouseMillhouse

72411 gold badge88 silver badges1717 bronze badges

add a comment
 | 

1

Find out the where as well, where are the files you need stored on the network, where is the source control repository for the project, etc.

Since this is your first taste of doing a real world project, please please please make sure you use source control even if you are the only dev on the project. Your co-workers will thank you and you will thank you the first time you need to back out a change that didn’t work.

share|improve this answer

edited Dec 1 ’14 at 1:41

answered Sep 25 ’09 at 22:01

HLGEMHLGEM

84.7k1111 gold badges9797 silver badges160160 bronze badges

add a comment
 | 

Your Answer

Thanks for contributing an answer to Stack Overflow!Please be sure to answer the question. Provide details and share your research!But avoid …Asking for help, clarification, or responding to other answers.Making statements based on opinion; back them up with references or personal experience.To learn more, see our tips on writing great answers.

Draft saved
Draft discarded

Sign up or log in

Sign up using Google

Sign up using Facebook

Sign up using Email and Password

Submit

Post as a guest

Name

Email
Required, but never shown

Post Your Answer

Discard

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you’re looking for? Browse other questions tagged project-planning or ask your own question.

The Overflow Blog

Podcast: Right Back At Ya

We’re launching an Instagram account

Featured on Meta

Planned maintenance scheduled for Saturday, March 28, 2020 at 13:00 UTC (9AM…

An Update On Creative Commons Licensing

Community and Moderator guidelines for escalating issues via new response…

Triage needs to be fixed urgently, and users need to be notified upon…

Upcoming Feature: New Question Close Experience

Related

6What is a good project to work on to learn modern patterns and practices?2Estimates – by what factor should they be reduced when adding another developer?5What UML diagram should I use for simple application features..?1What way should I take

Hot Network Questions

What version of Divinity is the most recent?

How much does it cost to develop an online course?

Is it possible to use a TXT record for CAA (Certification Authority Authorization)

Did Russia release lions onto the streets to keep people in isolation?

Can you use “plague” as a general term?

Players get frustrated when they couldn’t solve a hard diplomatic problem, how to get them to think out of the box

Is it wrong to use a laptop with the lid closed?

I made a Guess the number game in Python

What is the way to determine which tab in Firefox is using 100% of one of my CPUs?

A puzzle made special for today

How to deal with what I think is an ebay scam?

Why did Gandalf bring Pippin along to blind the Nazgul?

Free groups are CT-groups

Draw an ASCII oak tree (or a woman with curly hair?)

coronavirus – Why no ‘c’ capital? Why is there no space?

Birds on a wire (again) – how is it that birds feel no current? They are just making a parallel circuit, no?

2000’s novel where a man wakes up to find a chunk of his brain replaced by a cybernetic implant he turns out to have developed himself

I need a title out of my name from a vehicle that my ex drive, refuses to cooperate, what can I do to resolve this?

error during the upgrade of LibreOffice from 6.3.5 to 6.4.2

How can I improve card design?

Jewish person visiting American friend in Qatar

Replace each character of white space at the end of each line with ‘_’

Proof that you can win at least half the money.

How can an omniscient being have limited awareness?

more hot questions

Question feed

Subscribe to RSS

Question feed
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Categories
askquestion

Difference between components, modules, extensions and plugins in Joomla

Difference between components, modules, extensions and plugins in Joomla

Ask Question

Asked
10 years, 6 months ago

Active
2 years, 10 months ago

Viewed
16k times

.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{
margin-bottom:0;
}

29

14

What is the difference between Joomla components, modules, extensions and plugins?

plugins joomla module components

share|improve this question

edited Jun 25 ’15 at 14:12

nbro

9,5901414 gold badges6969 silver badges118118 bronze badges

asked Sep 25 ’09 at 16:09

BryanBryan

14k2222 gold badges9090 silver badges117117 bronze badges

add a comment
 | 

4 Answers
4

Active

Oldest

Votes

48

Plugins

Plugins enable you to execute code in response to certain events, either Joomla core events or custom events that are triggered from your own code. This is a powerful way of extending the basic Joomla functionality.

Components

Components are the main functional units that display in your template, like the content management system, contact forms, Web Links and the like. They are usually displayed in the center of the main content area of a template (depending on the template).

Modules

A more lightweight and flexible extension used for page rendering is a module. Modules are used for small bits of the page that are generally less complex and able to be seen across different components. Sometimes modules are linked to a component such as the core latest news module.

Extensions

Components, languages, modules, plugins and templates collectively known as Extensions.

Quickstart tutorial for free.

share|improve this answer

edited Jan 6 ’14 at 14:08

answered Sep 25 ’09 at 16:26

Andrejs CainikovsAndrejs Cainikovs

21.2k22 gold badges5959 silver badges7979 bronze badges

add a comment
 | 

20

Components

A component is a separate application. You can think of a component as something that has its own functionality, its own database and its own presentation.

So, if you install a component, you add an application to your website. Examples of components are

a forum
a newsletter
a community system
a photo gallery

You could think of all of these as being a separate application. Each of these would make perfectly sense as a stand-alone system.

A component will be shown in the main part of your website and only one component will be shown. A menu is then nothing more than a switch between different components. You can compare it a bit with your windows taskbar, where you see a tab for each open application.

Modules

Modules are extensions which present certain pieces of information on your site. It’s a way of presenting information that is already present. This can add a new function to an application, which was already part of your website.

Think about

latest article modules
login module
a menu

Typically, you’ll have a number of modules on each web page.

The difference between a component and a module is not always very clear. A module doesn’t make sense as a standalone application, it will just present information or add a function to an existing application.

Take a newsletter for instance. A newsletter is a component. You can have a website which is used as a newsletter only. That makes perfectly sense. Although a newsletter component probably will have a subscription page integrated, you might want to add a subscription module on a sidebar on every page of your website. You can put this subscribe module anywhere on your site. You’ll probably agree with me that a site with just a subscription module and no actual newsletter component would be rather ridiculous.

Plugins

They used to be called mambots in Joomla 1.0.x, but since Joomla 1.5.x they’re called plugins. A plugin is a function which is performed on a part of Joomla before this part is shown. This part can be on content, on the editor, on the complete system, etc. This might seem a bit abstract, but you’ll understand it with an example.

Let’s take one of the plugins of Ulti Joomla as an example: Ulti Reflection. This is a plugin which can make a reflection of the images you use in your content articles. To use this you just have to put something like
inside your content. Before the content is shown to the user, the Ulti Reflection plugin will scan the content to find the {reflection} tag. If it finds the tag, it will replace the tag with the image and its reflection.

Be carefull not to put to many plugins one your website, because some of them can really slow down your site.

If the difference between the three types of extensions is still not completely clear, then I advice you to go to admin pages of your joomla installation and check the components menu, the module manager and the plugin manager. Joomla comes with a number of core components, modules and plugins. By checking what they’re doing, the difference between the three types of building blocks should become clear. You can also check out the official Joomla extensions page. Browse through the extension categories and you’ll be amazed about the extension possiblities you have for your site.

share|improve this answer

edited Jun 25 ’15 at 14:31

nbro

9,5901414 gold badges6969 silver badges118118 bronze badges

answered Jul 6 ’12 at 5:07

SamarSamar

19933 silver badges99 bronze badges

This is very clear indeed! I just not quite understand this one: To use this you just have to put something like inside your content. , may be missed something after like?

– Walty Yeung
Jul 14 ’17 at 10:34

add a comment
 | 

8

Modules and components are displayed on a page.

Plugins operate behind the scenes and can do a multitude of things, like replacing content with other content, perform searches, perform login/logout functions, or anything really tricky that you can imagine.

There can only ever be one component on a page. When you choose menu items, you are actually choosing the component that you wish a page to display. The variables for the component are stored once (in the database), so you can’t have multiple instances of the component!

On the other hand, modules are added multiple times. You can have many modules on the one page. In fact, you could have 100 instances of the same module on the one page. The variables for a module are stored against each instance. (in the database).

This is why joomla templates have one place holder for a component, and many place holders for modules.

A module can be added to an individual page (menu item) , or seleceted pages, or all pages.

Remember that a menu item is indeed a component choice. Each menu item does store variables in the database, so it is possible to feed the component display details. E.g. what page id the content component is to display.

In the back end, components can have many backend settings and functions, and “do” many more things than a module.

Examples of a component are:

com_content (displays articles…)
a bulletin board
a forum
a sitemap

Examples of a module:

a countdown clock
top 10 most read content
a poll

share|improve this answer

edited Mar 29 ’15 at 0:41

nbro

9,5901414 gold badges6969 silver badges118118 bronze badges

answered Oct 7 ’09 at 0:13

BingyBingy

63344 silver badges99 bronze badges

add a comment
 | 

0

Unless you understand the difference between a module and a component, you will find it very difficult to administer your Joomla installation.

Modules
Modules are usually small pieces of functionality designed to present information in your site. They can appear a number of times, on a number of pages in various positions. On the contrary components are a full blown application, usually quite complex and are to the main body if a page. Also each module can be viewed in various pages, and the position of each module can be easily changed. You are allowed to select the menu items where a module is displayed. A good example of the usage of this functionality is targeted advertising. If your site has various sections, you can create module for each section. Each module will contain a targeted advert for the section. Now instead of showing all the modules, all the time, you customise the visibility of the module such that each advert is displayed only in the relevant menu links. Typical examples of standard Joomla modules are : Main / User / Top and other menus, Latest News, Popular Articles, Polls, Login Form, Syndication Details etc.

Components
On the other hand, a Joomla component is typically more complex, with extensive functionality and capabilities. A component can only be displayed in the main area of a page, and can only be displayed in a single page (usually). Links to components are usually done by creating menu items. Components usually have a particular page or pages for their configuration.

Extensions
Joomla extensions extend the functionality of Joomla websites. Five types of extensions may be distinguished: components, modules, plugins, templates, and languages. Each of these extensions handles a specific function.

Comdev is a Joomla development services provider, which provides varirties of extensions like: JomOffers, JomDirectory, JomHoliday 3, JomEstate, JomEvents.

Source: http://comdevjoomla.blogspot.com/

share|improve this answer

answered Apr 19 ’16 at 8:22

Web MasterWeb Master

1

add a comment
 | 

Highly active question. Earn 10 reputation in order to answer this question. The reputation requirement helps protect this question from spam and non-answer activity.

Not the answer you’re looking for? Browse other questions tagged plugins joomla module components or ask your own question.

The Overflow Blog

Podcast: Right Back At Ya

We’re launching an Instagram account

Featured on Meta

Planned maintenance scheduled for Saturday, March 28, 2020 at 13:00 UTC (9AM…

An Update On Creative Commons Licensing

Community and Moderator guidelines for escalating issues via new response…

Triage needs to be fixed urgently, and users need to be notified upon…

Upcoming Feature: New Question Close Experience

Linked

30

How to create my own form in joomla

13

Difference between Module and Component in Joomla

Related

434Difference between a class and a module409What is the difference between include and extend in Ruby?13Difference between Module and Component in Joomla0At which condition we have to make joomla component, module and plugins4call plugin in joomla component555What’s the difference between a Python module and a Python package?0Can I Use Joomla Plugins in my component831Relation between CommonJS, AMD and RequireJS?167What’s the difference between an Angular component and module

Hot Network Questions

Chord progression sounding good even though it has a chord out of scale

Why would I ever pick bows over powers?

In the case of linear regression, if the parameters are uncorrelated, does this make the model better? If yes, why?

A puzzle made special for today

Birds on a wire (again) – how is it that birds feel no current? They are just making a parallel circuit, no?

Is it wrong to use a laptop with the lid closed?

coronavirus – Why no ‘c’ capital? Why is there no space?

How can I avoid straw manning any belief I am against in my game?

How can an omniscient being have limited awareness?

“May” meaning in biblical/religious language

I recently got laid off. Is it best to wait for the corona pandemic to pass before applying for a new job?

Rules for naming fractions with non-trivial denominators

Can you use “plague” as a general term?

Why would an ILS installation need a “reflecting surface” around the glideslope antenna?

How can I improve card design?

Is there a better way to formulate this constraint?

Masculine possessive adjectives ending in nominative

Why Are Openings Named After Countries?

How to do the equivalent of a “where” clause with `find` and `grep`

Do I get a bonus d6 to Magic Missile damage if my expert sidekick helps me?

Evolution of flying skulls?

Resume: Is it unprofessional to add a Stallman-like “you won’t find me on Facebook”?

How do Minecraft know where village’s buildings are if the village is not generated yet?

Is there any code in Firefox (as of 2020) that comes from Netscape Navigator?

more hot questions

Question feed

Subscribe to RSS

Question feed
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.