Thursday, 15 August 2013

c# - How to handle exception if Entity DB file is not found -


I am using Antiti FY with SQL Server Compact database. The problem is, I do not understand how and how to handle the system. Data.EntityException If you do not have a database file, because when I start my application I "Kkagr stopped working" window pops up with the following details

  Problem signature: problem name: CLR20r3 problem signature 01: AVIOB1BUUW4KTDA4Y2PQRQUMWZFODHST problem signature 02: 1.0.0.0 problem signature 03: 5151de5d problem signature 04: System.Data.SqlServerCe problem signature 05: 4.0.8876.1 problem signature 06: 4fcd17f1 problem signature 07: 17b S Msya Signature 08: 4ad Problem signature 09: System.Data.EntityException   

Also, I'm not running it may not seem debug applications VS2012, because of error, so I find it dB File had to be manually renamed by renaming the name

how and Where to handle this exception?

something like:

  if (! File.Exists (NameAndLocationofDBFi Le)} {System.Windows.Forms.MessageBox.Show ("database file does not exist"); Return; // present application}    

iphone - iOS, using underscore vs using iVar directly -


It has been said a lot, but the question is when will you use each of these methods. Please use other than Setter and Gator endless loop

example

.h -
@property (nanatomic, strong) NSMutableArray * mutArray .m -
@synthesize mutArray = _mutArray;

1) Do I want to:
_mutArray = [[NSMUTABELARROL] IITIT]; or OR << CODE> Self.mutArray = [[NSMutableArray alloc] init];
Why would I do each of them, and what's the difference?

2) If I want to add an object to it ...
[_ mutArray addObject: object]; or OK [self.mutArray addobject: object];

And why ?! Thank you very much!

You can only type your code with init and Dealloc or the implementation details (such as inside the accessor, or exactly where you actually need a memory address). In addition to those places, you should always use the accelerator, which means instead of [foo] is _foo .

self.foo Actually, the actual call is about syntactic sugar, which is [self foo] It is important to understand that Self.foo is a standard ObjC messaging, and this means that the same thing as [self foo] . From the conference, you should only use dot-syntax when referring properties.

The direct use of the pre-ARC, the iver was the # 1 cause of crashing in my experience. When specifying an Ever without ARC, you are less likely to reach 100% on the scope of the program.

Since ARC, I still argue that you should always use the accessories (with the above exceptions)), but the reasons are more subtle, the main reason is that an accelerator is customized Can be either in the existing class, sub-class, or through KVO (which is outside of your code). If you reach straight ivar, you will bypass it. For example, it is to say that the property is weak (which is very common). Then if you use EVER before making it, you will get a micro bug. So you should remember, for that property, always use the accelerator. Similarly, you can call setNeedsDisplay or post a notification or like < P> If you have a simple rule that says, "I always use the accessories" then the code is easy to see and it's right. In some cases you need to circumvent the accessor, _ says "Hey, here's the note, I'm doing something weird."

If you have the rule "I use users for those properties that need it, but not for those people" who do not see the code and it's right that it's right. Did the previous developer use Ivar because it was needed or just because he felt it? Can you change it or not? It is very hard to know

Using archives, even after ARC there is also good defensive programming and I highly recommend it.

python - Using one form for two similar models -


मेरे पास निम्न मॉडल हैं:

  वर्ग BaseAddress (models.Model): name = models.CharField (MAX_LENGTH = 100) BUSINESS_NAME = models.CharField (MAX_LENGTH = 100, खाली = सच, अशक्त = सच) पता = models.CharField (MAX_LENGTH = 100, खाली = सच, अशक्त = सच) address_2 = models.CharField ( शहर = मॉडल। सीएचएफ़िल्ड (अधिकतम_लांबी = 100, रिक्त = सत्य, शून्य = सत्य) राज्य = अधिकतम = 1 = 100, रिक्त = सत्य, शून्य = सत्य) address_3 = models.CharField (max_length = 100, रिक्त = सत्य, शून्य = सत्य) models.CharField (MAX_LENGTH = 2, खाली = सच, अशक्त = सच) ZIP_CODE = models.CharField (MAX_LENGTH = 10, खाली = सच, अशक्त = सच) फोन = models.CharField (MAX_LENGTH = 30, खाली = सच, अशक्त = यह सच है) वर्ग मेटा: सार = सच वर्ग ProfileBilling (BaseAddress): प्रोफ़ाइल = models.OneToOneField (प्रोफाइल, related_name = 'billing_info') वर्ग OrderBilling (BaseAddress): आदेश = models.OneToOneField (आदेश, related_name = 'बिलिंग') name_on_card = मॉडल। चियरफिल्ड (अधिकतम_लांबी = 100) # कार्ड_टाइप = मॉडल। पॉजिटिव mallIntegerField (# विकल्प = CARD_TYPE, डिफ़ॉल्ट = 0) #card_number = models.CharField (# MAX_LENGTH = 16, डिफ़ॉल्ट = 0) expire_month = models.PositiveSmallIntegerField (विकल्प = महीने, अशक्त = सच, डिफ़ॉल्ट = 0) expire_year = models.PositiveSmallIntegerField (विकल्प = YEARS, शून्य = सत्य, डिफ़ॉल्ट = 1 9 60)   

जब ग्राहकों को बिलिंग पता इनपुट होता है, तो मैं इसे ऑर्डर बिलींग में सहेजना चाहता हूं, लेकिन मैं भी इसे ProfileBilling में सहेजना चाहता हूँ सबसे हालिया बिलिंग पता मैं ऐसा कैसे करूं?

जब मैं ऑर्डर बिलिंग और प्रोफाइल बिलिंग में अधिक से अधिक समान फ़ील्ड रखता हूं ...?

मैं बिलिंग पते को दो अलग-अलग तालिकाओं में सहेजने के लिए कैसे उपयोग करूं? मैं यह कैसे Django में कर सकता हूं?

यह मेरा ऑर्डर बिलिंग फॉर्म है:

  वर्ग OrderBillingForm (forms.ModelForm): क्लास मेटा: मॉडल = आदेशबिलिंग बहिष्करण = ('आदेश ',) डीईएफ़ __इनट __ (स्वयं, * एल्ग्स, ** क्वार्ज): सुपर (ऑर्डर बीलिंगफार्म, स्वयं) .__ init __ (* आर्ग्स, ** क्वार्ज) स्वयं। फ़ील्ड [' पता ']। आवश्यक = सच स्व। फ़ील्ड [' शहर '] .required = सच self.fields [' राज्य '] = USStateField () self.fields [' ZIP_CODE '] = us.USZipCodeField () self.fields [' फोन ']। आवश्यक = झूठी self.fields [' expire_month '] .required = False self.fields [' expir_year ']। आवश्यक = गलत def साफ (स्व): वापस स्वयं। स्केलिडे_डेटा    

आप सेव () विधि को ओवरराइड कर सकते हैं, लेकिन आपके मामले में स्मार्ट तरीके से इस प्रयोजन के लिए संकेत का उपयोग किया जाएगा।

OrderBilling सहेजा गया, आप अपने डेटा को प्रोफाइल बिलिंग में भी सहेज सकते हैं।

पोस्ट_एसएवी संकेत से परिचित होने के मामले में Google खोज पर कुछ उदाहरण को देखो,

जैसे:

  • आदि ...

    फिर आसानी से अपने पोस्ट_एसएव रिसीवर में | कॉलबैक Funcstion को ऑर्डर बिलिंग उदाहरण प्राप्त करें

      orderbil_instance = kwargs ['instance']   

    और अपने डेटा से अपना प्रोफाइल बिलिंग बनायें संकेत रिसीवर पर कुछ ऐसा है

      ProfileBilling.objects.create (name = orderbil_instance.name, ....)   

    / P>

      def do_something (प्रेषक, ** kwargs): # OrderBilling उदाहरण प्राप्त करने के लिए जो अभी बचाया है orderbil_instance = kwargs ['उदाहरण'] # नई प्रोफाइल में बिलिंग को भरना ProfileBilling.Billing.objects.create (name = Orderbil_instance.name, ....)    

java - Adding a BufferedImage to a JPanel on JLayerPane -


Therefore, I have a zeledadpan (technically a class sub-clinging JellyheadPen in fact). There is a JPNL on that I want to add a buffard image to zipal.

  The public class Bigmat JLearpine implies the MouseListener JP Penal Map Panel; Buffeedmeremet; Public Bitmap (Buffer Image M) {theMap = m; MapPanel = new JPanel (); Addition (Map Panel, 0); MapPanel.setBounds (0, 0, 640, 640); // other unimportant stuff} @ Override Public Waste Paint Coment (Graphics G) {SuperPaintConant (G); Graphics 2D GPMap = (Graphics 2D) MapPanel.Graph Graphics (); Gmap.drawImage (map, empty, 0, 0); // some other things that are working fine now) The problem is that the buffed image is not showing JPNL is definitely present because I can choose my background and If I want, I can see it. I know that JLED is not a layout manager in the pen and they have to set the limit for the zippin but this should definitely not be an issue for JPNL? And in the buffeted image there is a lack of ways to control its size, I do not know how to remove it, if it is.  

Any help appreciated.

The problem here is that you paintComponent () method of your layered panel No, not JPanel . JPNL will paint later as one of the children of your layered panel, and erase the paints you make from it.

In general, a paintComponent () method should be painted in graphics , which was not given in graphics of any other component.

Is there a defined method for storing Adobe XMP in HTML? -


Adobe Standard methods for storing XMP metadata inside many file formats including PMD, TIFF, JPEG, GIF, SWF Have defined. , MP3, MP4, etc. However, I do not find any documentation defining standardized method for storing XMR in HTML.

Note I look into XMP but I have found it In Adobe's specification, perhaps it helps:

All cited (page 41ff):

2.5.1 HTML

embed code in XMP must be in line with one of the W3C recommendations to embed html in XML For reference information, see the Meeting Report for the May 1990 W3C meeting:

L a SCRIPT or XML can be embedded in element, placed in any legal base; The suggested location is the end of the HEAD element SCRIPT or XML element of the element is XMP packet. The browser should recognize the SCRIPT or XML element so that the text representing the value of the RDF properties can not be displayed as a page content. Unlike the use of the xml element, unless the incompatibilities with the old software are known; If so, then the SCRIPT element is likely to be recognized.

2.5.1.1 Embedding XML in HTML

as shown in the examples below There are three approaches for embedding HTML in the XML two using the SCRIPT element, and the third XML element Uses

2.5.1.1.1 SCRIPT element and LANGUAGE attribute

  & lt; Html & gt; & Lt; Top & gt; & Lt; SCRIPT LANGUAGE = "XML" & gt; & Lt ;? Xpacket start = '' id = 'W5M0MpCehiHzreSzNTczkc9d'? & Gt; & Lt ;! - Serial RDF goes here. This is removed for brevity - & gt; & Lt ;? Xpacket end = 'w'? & Gt; & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; / Body & gt; & Lt; / Html & gt;   

Note : Adobe has problems with using the SCRIPT element and LANGUAGE attribute in Microsoft Word 2000 Microsoft has been running under Windows XP: body contents can not be displayed

2.5.1.1.2 SCRIPT element and TYPE attribute

  & lt; Html & gt; & Lt; Top & gt; & Lt; SCRIPT TYPE = "text / xml" & gt; & Lt ;? Xpacket start = '' id = 'W5M0MpCehiHzreSzNTczkc9d'? & Gt; & Lt ;! - Serial RDF goes here. This is removed for brevity - & gt; & Lt ;? Xpacket end = 'w'? & Gt; & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; / Body & gt; & Lt; / Html & gt;   

2.5.1.1.3 XML element usage

  & lt; Html & gt; & Lt; Top & gt; & Lt; Xml & gt; & Lt ;? Xpacket start = '' id = 'W5M0MpCehiHzreSzNTczkc9d'? & Gt; & Lt ;! - Serial RDF goes here. This is removed for brevity - & gt; & Lt ;? Xpacket end = 'w'? & Gt; & Lt; / XML & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; / Body & gt; & Lt; / Html & gt;    

linux - verifing some arguments in bash -


I'm verifying one in BASH

  if [! ((-e $ f) || ($ # -lt2) || (-D $ F));; Again exit 0f   

I am trying to see if the file exists or if it is a directory or if enough arguments pass through the terminal I can do this Or should it be done in any other way?

Reject anything that is not a simple file, in that case, instead of the -e If you use -f, then testing for a directory is unnecessary.

  If [[! -f "$ f" || $ # -lt2]]; Then exit 0f   

By the way, if this is an error, you should get away from something other than 0-0, in most cases, success indicates; Exit 1 will be better.

html - css: target a class which is inside a same class -


I am currently working on a WordPress project. There is a 3 level menu in it

.submenu must be hidden on the same page. Now I have to hide the .submenu , which is inside SabMedu.

How can I target it?

I have the goal #mainmenu> . Submenu & gt; .submenu

Just like #mainmenu .submenu .submenu .