Search Results

Search found 690 results on 28 pages for 'pat ma'.

Page 5/28 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Using a regex to match IP addresses in Python

    - by MHibbin
    I'm trying to make a test for checking whether a sys.argv input matches the regex for an IP address... As a simple test, I have the following... import re pat = re.compile("\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}") test = pat.match(hostIP) if test: print "Acceptable ip address" else: print "Unacceptable ip address" However when I pass random values into it, it returns "Acceptable ip address" in most cases, except when I have an "address" that is basically equivalent to \d+ Any thoughts welcome. Cheers Matt

    Read the article

  • How to solve High Load average issue in Linux systems?

    - by RoCkStUnNeRs
    The following is the different load with cpu time in different time limit . The below output has parsed from the top command. TIME LOAD US SY NICE ID WA HI SI ST 12:02:27 208.28 4.2%us 1.0%sy 0.2%ni 93.9%id 0.7%wa 0.0%hi 0.0%si 0.0%st 12:23:22 195.48 4.2%us 1.0%sy 0.2%ni 93.9%id 0.7%wa 0.0%hi 0.0%si 0.0%st 12:34:55 199.15 4.2%us 1.0%sy 0.2%ni 93.9%id 0.7%wa 0.0%hi 0.0%si 0.0%st 13:41:50 203.66 4.2%us 1.0%sy 0.2%ni 93.8%id 0.8%wa 0.0%hi 0.0%si 0.0%st 13:42:58 278.63 4.2%us 1.0%sy 0.2%ni 93.8%id 0.8%wa 0.0%hi 0.0%si 0.0%st Following is the additional Information of the system? cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 23 model name : Intel(R) Xeon(R) CPU E5410 @ 2.33GHz stepping : 10 cpu MHz : 1992.000 cache size : 6144 KB physical id : 0 siblings : 4 core id : 0 cpu cores : 4 apicid : 0 initial apicid : 0 fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm constant_tsc arch_perfmon pebs bts pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr dca sse4_1 lahf_lm bogomips : 4658.69 clflush size : 64 power management: processor : 1 vendor_id : GenuineIntel cpu family : 6 model : 23 model name : Intel(R) Xeon(R) CPU E5410 @ 2.33GHz stepping : 10 cpu MHz : 1992.000 cache size : 6144 KB physical id : 0 siblings : 4 core id : 1 cpu cores : 4 apicid : 1 initial apicid : 1 fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm constant_tsc arch_perfmon pebs bts pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr dca sse4_1 lahf_lm bogomips : 4655.00 clflush size : 64 power management: processor : 2 vendor_id : GenuineIntel cpu family : 6 model : 23 model name : Intel(R) Xeon(R) CPU E5410 @ 2.33GHz stepping : 10 cpu MHz : 1992.000 cache size : 6144 KB physical id : 0 siblings : 4 core id : 2 cpu cores : 4 apicid : 2 initial apicid : 2 fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm constant_tsc arch_perfmon pebs bts pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr dca sse4_1 lahf_lm bogomips : 4655.00 clflush size : 64 power management: processor : 3 vendor_id : GenuineIntel cpu family : 6 model : 23 model name : Intel(R) Xeon(R) CPU E5410 @ 2.33GHz stepping : 10 cpu MHz : 1992.000 cache size : 6144 KB physical id : 0 siblings : 4 core id : 3 cpu cores : 4 apicid : 3 initial apicid : 3 fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm constant_tsc arch_perfmon pebs bts pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr dca sse4_1 lahf_lm bogomips : 4654.99 clflush size : 64 power management: Memory: total used free shared buffers cached Mem: 2 1 1 0 0 0 Swap: 5 0 5 let me know why the system is getting abnormally this much high load?

    Read the article

  • Egy DBA napja - Utópia, vagy sem?

    - by lsarecz
    Ma délelott a HOUG BI/DW és DB szakmai napján tartottam egy eloadást arról, hogyan kellene egy DBA-nak dolgoznia manapság. A lényeg az volt, hogy az üzlet legjobb kiszolgálása érdekében célszeru a felhasználók és az alkalmazás oldaláról megközelíteni a kérdést. Azaz monitorozzuk a felhasználók elégedettségét, majd ha valami nem stimmel fúrjunk le alsóbb rétegekbe (MW, DB, OS, HW, Storage, Network), és ott folytassuk a diagnosztikát. Meglepetésemre az eloadást követoen a DB szakosztály vezetoje úgy kommentálta az eloadást, hogy ez még utópisztikus. Ma délután egy a hallgatók között ülo üzemeltetési igazgató e-mail-ben jelezte, hogy ezzel o sem ért egyet, mert ok már most is így üzemeltetnek, még ha nem is minden elemében a Grid Control-t használják. És mi sem bizonyítja jobban, hogy ez az üzemeltetési model nem utópia, mint hogy az Oracle Enterprise Manager 11g tökéletes támogatást ad minderre. Akit ezek után érdekel az eloadásom, az innen letöltheti: 1. fele, 2. fele.

    Read the article

  • Technology Fórum eloadások

    - by Lajos Sárecz
    Ma délelott lezajlott az Oracle Technology Fórum rendezvény. A Database szekcióban Tóth Csaba tartotta a nyitó eloadást, melyben az IT költségek csökkentési lehetoségeirol beszélt Oracle Database 11g felhasználásával. Ot követoen én beszéltem az Oracle Enterprise Manager által kínált extrém menedzsment képességekrol, amely ma már nem csak adatbázis menedzsmentet jelent, hanem a teljes alkalmazás infrastruktúra üzemeltetésre koncentrál, kiemelt figyelmet fordítva az üzlet valós kiszolgálására. Szünet elott még Mosolygó Feri tartott egy eloadást az adatbázis-kezelo és a felho kapcsolatáról, majd szünet után Fekete Zoltán folytatta a Database Machine bemutatásával. Zoli után ismét Mosolygó Feri tartott eloadást ezúttal az adatbázis biztonságról, majd én zártam a napot a kockázatmentes változáskezelés témával.

    Read the article

  • Glume amuzante cu copii

    - by interesante
    Tatal chel; o fetita o intreaba pe mama sa: - Mama, de ce tata e asa de chel? - Deoarece are multa minte si i-a cazut parul. - Dar tu de ce ai asa de mult par in cap? - Mananca si taci!Era odata un tanar care cand era mic vroia sa se faca un "mare" scriitor. Cand i s-a cerut sa defineasca "mare" a spus: "Vreau sa scriu chestii pe care sa le citeasca toata lumea, chestii la care lumea sa reactioneze emotional, lucruri care sa-i faca sa strige, sa planga, sa urle, sa se zbata de durere, disperare si manie!" Acum lucreaza pentru Microsoft si scrie mesaje de eroare...Mai multa distractie pe un website cu jocuri flash care sa te captiveze.Un barbat zbura cu un balon cu aer cald si la un moment dat si-a dat seama ca s-a ratacit. A coborat pana aproape de pamant si a zarit o femeie pe o pajiste. Apropiindu-se de ea, el i-a strigat: -Fii amabila, poti sa ma ajuti? Am promis unui prieten ca ma intalnesc cu el, dar nu mai stiu unde ma aflu. Femeia i-a raspuns: -Te afli intr-un balon cu aer cald, la vreo 10 metri inaltime. Te gasesti intre 40 si 41 grade latitudine nord, si intre 59 si 60 de grade logitudine vest. -Ei, probabil esti inginera de profesie! spuse omul din balon. -Asa este, raspunse femeia, dar de unde stii? -Pai tot ce mi-ai spus este corect din punct de vedere tehnic, dar tot n-am idee ce-as putea face cu informatiile de la tine si sunt tot in ceata. Sa fiu sincer, nu m-ai ajutat deloc. Ba chiar pot spune ca m-ai tinut pe loc degeaba. Atunci femeia i-a raspuns: -Dar tu trebuie sa fii director! -Asa este, raspunse barbatul, dar de unde stii? -Pai nu stii unde te afli si nici incotro te indrepti. Te-ai ridicat la inaltime profitand de o flama care a incins situatia. Ai facut o promisiune pe care nu stii cum ai sa ti-o tii si te astepti ca oamenii de sub tine sa-ti rezolve problema. Adevarul este ca te afli exact in locul unde te aflai cand am inceput discutia, acum 1 minut, dar brusc constati acum ca asta este din vina mea.

    Read the article

  • ArchBeat Link-o-Rama for 2012-09-07

    - by Bob Rhubart
    Oracle Technology Network Architect Day - Boston, MA - 9/12/2012 Sure, you could ask a voodoo priestess for help in improving your solution architecture skills. But there's the whole snake thing, and the zombie thing, and other complications. So why not keep it simple and register for Oracle Technology Network Architect Day in Boston, MA. There's no magic, just a full day of technical sessions covering Cloud, SOA, Engineered Systems, and more. Registration is free. Wednesday September 12, 2012 8:00 a.m. – 5:00 p.m. Boston Marriott Burlington, One Burlington Mall Road, Burlington, MA 01803 Attend OTN Architect Day in Los Angeles – by Architects, for Architects – October 25 The OTN Architect Day roadshow stops in Boston next week, then it's on to Los Angeles for another all architecture, all day event on Thursday October 25, 2012 at the Sofitel Los Angeles, 555 Beverly Boulevard, Los Angeles, CA 90048. Like all Architect Day events, this one is absolutley free, so register now. Webcast: Oracle WebCenter in Action: Hitachi Data Systems Catch this live webcast on Thursday, September 13, 2012 (10am PT / 1pm ET) to learn from speakers from Hitachi Data Systems, LingoTek, and Oracle about how Hitachi used Oracle WebCenter to improve the web experience for its international customers. Article Index: Architect Community Column in Oracle Magazine Did you know that Oracle Magazine features a regular column devoted specifically to the architect community? Every column includes insight and expertise from architects who regularly deal with the issues architects face. Click here to see a complete list of articles. ADF EMG Sunday at OOW 2012 (30. Sep 2012) - A day full of content | Frank Nimphius Frank Nimphius's shares details on Chris Muir's ADF EMG series of sessions during User Group Sunday at OOW, Sept 30, in Moscone West room 305. The Role of Oracle VM Server for SPARC in a Virtualization Strategy New OTN article from Matthias Pfützner. Countdown to Oracle OpenWorld 2012 | Oracle WebCenter Blog A helpful list of OOW sessions focused on Oracle WebCenter. Oracle Exalogic X2-2 walkthrough | Jan van Zoggel "For those of us not lucky enough to have one at home," Jan van Zoggel recommends this "very cool" video featuring "a detailed walkthrough explaining each component of a Oracle Exalogic X2-2 machine," presented by Oracle Exalogic VP Development Brad Cameron. September OTN Member Offers | OTN Blog Save big on books from top tech publishers with these discounts for OTN members. Thought for the Day "Only Robinson Crusoe had everything done by Friday." — Unknown Source: Quote Garden

    Read the article

  • Simulating smooth movement along a line after calculating a collision containing a restitution of zero in 2D

    - by Casey
    [for tl;dr see after listing] //...Code to determine shapes types involved in collision here... //...Rectangle-Line collision detected. if(_rbTest->GetCollisionShape()->Intersects(*_ground->GetCollisionShape())) { //Convert incoming shape to a line. a2de::Line l(*dynamic_cast<a2de::Line*>(_ground->GetCollisionShape())); //Get line's normal. a2de::Vector2D normal_vector(l.GetSlope().GetY(), -l.GetSlope().GetX()); a2de::Vector2D::Normalize(normal_vector); //Accumulate forces involved. a2de::Vector2D intermediate_forces; a2de::Vector2D normal_force = normal_vector * _rbTest->GetMass() * _world->GetGravityHandler()->GetGravityValue(); intermediate_forces += normal_force; //Calculate final velocity: See [1] double Ma = _rbTest->GetMass(); a2de::Vector2D Ua = _rbTest->GetVelocity(); double Mb = _ground->GetMass(); a2de::Vector2D Ub = _ground->GetVelocity(); double mCr = Mb * _ground->GetRestitution(); a2de::Vector2D collision_velocity( ((Ma * Ua) + (Mb * Ub) + ((mCr * Ub) - (mCr * Ua))) / (Ma + Mb)); //Calculate reflection vector: See [2] a2de::Vector2D reflect_velocity( -collision_velocity + 2 * (a2de::Vector2D::DotProduct(collision_velocity, normal_vector)) * normal_vector ); //Affect velocity to account for restitution of colliding bodies. reflect_velocity *= (_ground->GetRestitution() * _rbTest->GetRestitution()); _rbTest->SetVelocity(reflect_velocity); //THE ULTIMATE ISSUE STEMS FROM THE FOLLOWING LINE: //Move object away from collision one pixel to prevent constant collision. _rbTest->SetPosition(_rbTest->GetPosition() + normal_vector); _rbTest->ApplyImpulse(intermediate_forces); } Sources: (1) Wikipedia: Coefficient of Restitution: Speeds after impact (2) Wikipedia: Specular Reflection: Direction of reflection First, I have a system in place to account for friction (that is, a coefficient of friction) but is not used right now (in addition, it is zero, which should not affect the math anyway). I'll deal with that after I get this working. Anyway, when the restitution of either object involved in the collision is zero the object stops as required, but if movement along the same direction (again, irrespective of the friction value that isn't used) as the line is attempted the object moves as if slogging through knee deep snow. If I remove the line of code in question and the object is not push away one pixel the object barely moves at all. All because the object collides, is stopped, is pushed up, collides, is stopped...etc. OR collides, is stopped, collides, is stopped, etc... TL;DR How do I only account for a collision ONCE for restitution purposes (BONUS: but CONTINUALLY for frictional purposes, to be implemented later)

    Read the article

  • Weblogic Bea 10.0 M1 and WorkManager

    - by ma-ver-ick
    Hi there! I have to execute long running threads in a WebLogic Bea 10.0 M1 server environment. I tried to use WorkManagers for this. Using an own WorkManager allows me to specify my own thread timeout (MaxThreadStuckTime) instead of adjusting the timeout for the whole business application. My setup is as follows: weblogic-ejb-jar.xml: <?xml version="1.0" encoding="UTF-8"?> <weblogic-ejb-jar xmlns="http://www.bea.com/ns/weblogic/90" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-ejb-jar.xsd"> <weblogic-enterprise-bean> <ejb-name>TestBean</ejb-name> <resource-description> <res-ref-name>myWorkManager</res-ref-name> <jndi-name>wm/myWorkManager</jndi-name> </resource-description> </weblogic-enterprise-bean> </weblogic-ejb-jar> weblogic-application.xml: <?xml version="1.0" encoding="UTF-8"?> <weblogic xmlns="http://www.bea.com/ns/weblogic/90" xmlns:j2ee="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic.xsd"> <work-manager> <name>myWorkManager</name> <ignore-stuck-threads>1</ignore-stuck-threads> </work-manager> </weblogic> and the Bean: import javax.annotation.Resource; import javax.ejb.Stateful; import weblogic.work.WorkManager; @Stateful(mappedName = "TestBean") public class TestBean implements TestBeanRemote { @Resource(name = "myWorkManager") private WorkManager myWorkManager; public void test() { myWorkManager.schedule(new Runnable() { public void run() { while (true) { System.out.println("test: +++++++++++++++++++++++++"); try { Thread.sleep(45000); } catch (InterruptedException e) { e.printStackTrace(); } } } }); } } When I try to deploy this things, the server gives me the following exceptions: [EJB:011026]The EJB container failed while creating the java:/comp/env namespace for this EJB deployment. weblogic.deployment.EnvironmentException: [EJB:010176]The resource-env-ref 'myWorkManager' declared in the ejb-jar.xml descriptor has no JNDI name mapped to it. The resource-ref must be mapped to a JNDI name using the resource-description element of the weblogic-ejb-jar.xml descriptor. I try to figure out how to access / use WorkMangers for days now, and still get this or that as an exception. Very frustrating! Thanks in advance!

    Read the article

  • Need Java Swing HTML canvas with support for integrated swing controls

    - by Iggy Ma
    I would like to create an application in swing in the style of web 2.0 but have the power and functionality of a thick client. I know substance and some other look and feels help with this some, but I was wondering if there is a way I can actually use some kind of html panel / canvas to create the content in html, embedding swing controls in the rendering so as to still use listeners and get the functionality. Anybody know of a way to do this?

    Read the article

  • Code golf: find all anagrams

    - by Charles Ma
    An word is an anagram if the letters in that word can be re-arranged to form a different word. Task: Find all sets of anagrams given a word list Input: a list of words from stdin with each word separated by a new line e.g. A A's AOL AOL's Aachen Aachen's Aaliyah Aaliyah's Aaron Aaron's Abbas Abbasid Abbasid's Output: All sets of anagrams, with each set separated by a separate line Example run: ./anagram < words marcos caroms macros lump's plum's dewar's wader's postman tampons dent tend macho mocha stoker's stroke's hops posh shop chasity scythia ... I have a 149 char perl solution which I'll post as soon as a few more people post :) Have fun!

    Read the article

  • oracle's pro*C compiler and gnu C (__builtin_va_list, __attribute__, etc)

    - by Charles Ma
    I'm compiling a database library with pro*C which converts the .ppc library file to a .c file that gcc can use. However, I'm getting a lot of errors in pro*C like the following PCC-S-02201, Encountered the symbol "__ attribute__ " when expecting one of the following ... , Encountered the symbol "__builtin_va_list" when expecting one of the following The missing symbols are from a chain of standard includes like stdio.h and stdlib.h. How do I get around this issue? The library I'm compiling came from an old solaris system that we're now upgrading (to a new solaris 10 system) and the header files don't seem to use these symbols. e.g. the newer .h files has typedef __builtin_va_list va_list while the old .h files has typedef void* va_list There are a lot of things like this so I'm reluctant to go and fix all of them manually with a typedef

    Read the article

  • svn diff: file marked as binary type

    - by Charles Ma
    I'm doing an svn diff on one of my files and svn is detecting it as a binary type. The file is readable plain text and I would like to be able to get a diff of this file. How do I tell SVN that this is not a binary file? Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream

    Read the article

  • How can I force mod_perl to only allow one process per connection?

    - by Charles Ma
    I have a perl cgi script that's fairly resource intensive (takes about 2 seconds to finish). This is fine as long as only at most 4 or 5 of them are running at the same time and that's usually the case. The problem is that when a user clicks a link that calls this script, a new process is spawned to handle that connection request, so if a user clicks many times (if they're impatient), the server gets overloaded with new processes running and most of them are redundant. How can I ensure that only one instance of this process is running per host? This is an old system that I'm maintaining which uses an old framework for the frontend, and I would like to avoid using javascript to disable the button client side if possible. Converting this to fast-cgi perl is out of the question as well, again because this is an old system and adding fast-cgi to apache might break a lot of other things that this thing runs.

    Read the article

  • Custom Event - invokation list implementation considerations

    - by M.A. Hanin
    I'm looking for some pointers on implementing Custom Events in VB.NET (Visual Studio 2008, .NET 3.5). I know that "regular" (non-custom) Events are actually Delegates, so I was thinking of using Delegates when implementing a Custom Event. On the other hand, Andrew Troelsen's "Pro VB 2008 and the .NET 3.5 Platform" book uses Collection types in all his Custom Events examples, and Microsoft's sample codes match that line of thought. So my question is: what considerations should I have when choosing one design over the other? What are the pros and cons for each design? Which of these resembles the inner-implementation of "regular" events? Below is a sample code demonstrating the two designs. Public Class SomeClass Private _SomeEventListeners As EventHandler Public Custom Event SomeEvent As EventHandler AddHandler(ByVal value As EventHandler) _SomeEventListeners = [Delegate].Combine(_SomeEventListeners, value) End AddHandler RemoveHandler(ByVal value As EventHandler) _SomeEventListeners = [Delegate].Remove(_SomeEventListeners, value) End RemoveHandler RaiseEvent(ByVal sender As Object, ByVal e As System.EventArgs) _SomeEventListeners.Invoke(sender, e) End RaiseEvent End Event Private _OtherEventListeners As New List(Of EventHandler) Public Custom Event OtherEvent As EventHandler AddHandler(ByVal value As EventHandler) _OtherEventListeners.Add(value) End AddHandler RemoveHandler(ByVal value As EventHandler) _OtherEventListeners.Remove(value) End RemoveHandler RaiseEvent(ByVal sender As Object, ByVal e As System.EventArgs) For Each handler In _OtherEventListeners handler(sender, e) Next End RaiseEvent End Event End Class

    Read the article

  • R: NA/NaN/Inf in foreign function call (arg 1)

    - by Ma Changchen
    When i use a package named HydroMe to fit a model, some data groups will return the following errors: Error in qr.default(.swts * attr(rhs, "gradient")) : NA/NaN/Inf in foreign function call (arg 1) Actually,there is no missing value in the data groups. the codes are as followed: library(HydroMe) fortst<-read.csv(file="F:/fortst.csv") van.lis <-nlsList(y~SSvan(x,Thr, Ths, alp, scal)|Sample,data=fortst) datas are as following: Sample x y 1116 0.000001 0.4003 1116 10 0.3402 1116 20 0.3439 1116 30 0.3432 1116 40 0.3426 1116 60 0.3379 1116 90 0.3325 1116 180 0.3212 1116 405 0.3033 1116 810 0.2843 1116 1630 0.2659 1117 0.000001 0.3785 1117 10 0.3173 1117 20 0.3199 1117 30 0.3193 1117 40 0.3179 1117 60 0.313 1117 90 0.308 1117 180 0.2973 1117 405 0.2789 1117 810 0.2608 1117 1630 0.2405 the example data can be downloaded from here.

    Read the article

  • django-admin formfield_for_* change default value per/depending on instance

    - by Nick Ma.
    Hi, I'm trying to change the default value of a foreignkey-formfield to set a Value of an other model depending on the logged in user. But I'm racking my brain on it... This: Changing ForeignKey’s defaults in admin site would an option to change the empty_label, but I need the default_value. #Now I tried the following without errors but it didn't had the desired effect: class EmployeeAdmin(admin.ModelAdmin): ... def formfield_for_foreignkey(self, db_field, request=None, **kwargs): formfields= super(EmployeeAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs) if request.user.is_superuser: return formfields if db_field.name == "company": #This is the RELEVANT LINE kwargs["initial"] = request.user.default_company return db_field.formfield(**kwargs) admin.site.register(Employee, EmployeeAdmin) ################################################################## # REMAINING Setups if someone would like to know it but i think # irrelevant concerning the problem ################################################################## from django.contrib.auth.models import User, UserManager class CompanyUser(User): ... objects = UserManager() company = models.ManyToManyField(Company) default_company= models.ForeignKey(Company, related_name='default_company') #I registered the CompanyUser instead of the standard User, # thats all up and working ... class Employee(models.Model): company = models.ForeignKey(Company) ... Hint: kwargs["default"] ... doesn't exist. Thanks in advance, Nick

    Read the article

  • Integrating a Custom Compiler with the Visual Studio IDE

    - by M.A. Hanin
    Background: I want to create a custom VB compiler, extending the "original" compiler, to handle my custom compile-time attributes. Question: after I've created my custom compiler and I've got an executable file capable of compiling VB code via the standard command-line interface, how do I integrate this compiler with the Visual Studio IDE? (such that pressing "compile" or "build" will make use of my compiler instead of the default compiler). EDIT: (Correct me if i'm wrong) From the reactions here, I see this question is a bit shocking, so I shall further explain my needs and background: .NET provides us with a great mechanism called Attributes. As far as I understand, making attributes apply their intended behavior upon the attributed element (assembly, module, class, method, etc.) - attributes must be reflected upon. So the real trick here is reflecting and applying behavior at the right spot. Lets take Serialization for example: We decorate a class with the Serializable attribute. We then pass an instance of the class to the formatter's Serialize method. The formatter reflects upon the instance, checking if it has the Serializable attribute, and acting accordingly. Now, if we examine the Synchronization, Flags, Obsolete and CLSCompliant attributes, then the real question is: who reflects upon them? At least in some cases, it has to be the compiler (and/or IDE). Therefore, it seems that if I wish to create custom attributes that change an element's behavior regardless of any specific consumer, i must extend the compiler to reflect upon them at compilation. Of course, these are not my personal insights: the book "Applied .NET Attributes" provides a complete example of creating a custom attribute and a custom C# compiler to reflect upon that attribute at compilation (the example is used to implement "java-style checked exceptions").

    Read the article

  • Splitting assemblies - finding the balance (avoiding overkill)

    - by M.A. Hanin
    I'm writing a wide component infrastructure, to be used in my projects. Since not all projects will require every component created, I've been thinking of splitting the component into discrete assemblies, so that every application developed will only be deployed with the required assemblies. I assume that creating an assembly has some storage overhead (the assembly's code, wrapping whatever is inside). Therefore, there must be some limit to the advantage gained by splitting an assembly - a certain point where splitting the assembly is worse than keeping it united (storage-wise and performance-wise). Now, here is the question: how do I know when splitting an assembly is an overkill? P.S I guess there are other overheads to assembly splitting, aside from the storage overhead. If anyone can point out these overheads, it would be much appreciated.

    Read the article

  • .net mvc pass dictionary data from view to controller

    - by Wei Ma
    A while ago, I was trying to pass a dictionary data from my view to my controller. And I was able to do so after googling on the net(remember it was one of scott hanselman's posts). The solution I had was something like <%for(int index=0; index<Model.Count(); index++){ var property= Model.ElementAt(index);%> <input type="hidden" name="<%="properties["+index+"].Key"%>"/> <input type="hidden" name="<%="properties["+index+"].Value"%>"/> <%}%> public ActionResult Process(IDictionary<string,string> properties) { doSomething(); return View(); } The code worked for awhile and then I did some refactoring and got rid of this chunk of code. Today, I ran into a situation in which I would like to pass a dictionary again. But no matter how hard I try, the properties parameter received by the action was always null. I tried the above code and <%for(int index=0; index<Model.Count(); index++){ var property= Model.ElementAt(index);%> <input type="hidden" name="<%="properties.Keys["+index+"]"%>"/> <input type="hidden" name="<%="properties.Values["+index+"]"%>"/> <%}%> Neither code worked. I googled again but couldn't find the post that helped me before. Can someone point out what I did wrong? thanks a million.

    Read the article

  • Delegates and ParamArray - Workaround Suggestions?

    - by M.A. Hanin
    Some predefined methods contain a ParamArray in their signature. Delegates, however, cannot contain a ParamArray in their signature. Main question: Assume you wish to create a delegation mechanism for a specific method which requires a ParamArray. How would you work around this constraint? "Bonus" question: Assume you wish to create a generalized delegation mechanism for all methods which require ParamArray, how would you do that?

    Read the article

  • Android: handle unexpected internet disconnect while downloading data

    - by M.A. Cape
    Hi, I have here a function that downloads data from a remote server to file. I am still not confident with my code. My question is, what if while reading the stream and saving the data to a file and suddenly I was disconnected in the internet, will these catch exceptions below can really catch that kind of incident? If not, can you suggest how to handle this kind of incident? Note: I call this function in a thread so that the UI won't be blocked. public static boolean getFromRemote(String link, String fileName, Context context){ boolean dataReceived = false; ConnectivityManager connec = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE); if (connec.getNetworkInfo(0).isConnected() || connec.getNetworkInfo(1).isConnected()){ try { HttpClient httpClient = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(link); HttpParams params = httpClient.getParams(); HttpConnectionParams.setConnectionTimeout(params, 30000); HttpConnectionParams.setSoTimeout(params, 30000); HttpResponse response; response = httpClient.execute(httpGet); int statusCode = response.getStatusLine().getStatusCode(); if (statusCode == 200){ HttpEntity entity = response.getEntity(); InputStream in = null; OutputStream output = null; try{ in = entity.getContent(); String secondLevelCacheDir = context.getCacheDir() + fileName; File imageFile = new File(secondLevelCacheDir); output= new FileOutputStream(imageFile); IOUtilities.copy(in, output); output.flush(); } catch (IOException e) { Log.e("SAVING", "Could not load xml", e); } finally { IOUtilities.closeStream(in); IOUtilities.closeStream(output); dataReceived = true; } } }catch (SocketTimeoutException e){ //Handle not connecting to client !!!! Log.d("SocketTimeoutException Thrown", e.toString()); dataReceived = false; } catch (ClientProtocolException e) { //Handle not connecting to client !!!! Log.d("ClientProtocolException Thrown", e.toString()); dataReceived = false; }catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); dataReceived = false; Log.d("MalformedURLException Thrown", e.toString()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); dataReceived = false; Log.d("IOException Thrown", e.toString()); } } return dataReceived; }

    Read the article

  • About Data Objects and DAO Design when using Hibernate

    - by X. Ma
    I'm hesitating between two designs of a database project using Hibernate. Design #1. (1) Create a general data provider interface, including a set of DAO interfaces and general data container classes. It hides the underneath implementation. A data provider implementation could access data in database, or an XML file, or a service, or something else. The user of a data provider does not to know about it. (2) Create a database library with Hibernate. This library implements the data provider interface in (1). The bad thing about Design #1 is that in order to hide the implementation details, I need to create two sets of data container classes. One in the general data provider interface - let's call them DPI-Objects, the other set is used in the database library, exclusively for entity/attribute mapping in Hibernate - let's call them H-Objects. In the DAO implementation, I need to read data from database to create H-Objects (via Hibernate) and then convert H-Objects into DPI-Objects. Design #2. Do not create a general data provider interface. Expose H-Objects directly to components that use the database lib. So the user of the database library needs to be aware of Hibernate. I like design #1 more, but I don't want to create two sets of data container classes. Is that the right way to hide H-Objects and other Hibernate implementation details from the user who uses the database-based data provider? Are there any drawbacks of Design #2? I will not implement other data provider in the new future, so should I just forget about the data provider interface and use Design #2? What do you think about this? Thanks for your time!

    Read the article

  • Why does Git.pm on cygwin complain about 'Out of memory during "large" request?

    - by Charles Ma
    Hi, I'm getting this error while doing a git svn rebase in cygwin Out of memory during "large" request for 268439552 bytes, total sbrk() is 140652544 bytes at /usr/lib/perl5/site_perl/Git.pm line 898, <GEN1> line 3. 268439552 is 256MB. Cygwin's maxium memory size is set to 1024MB so I'm guessing that it has a different maximum memory size for perl? How can I increase the maximum memory size that perl programs can use? update: This is where the error occurs (in Git.pm): while (1) { my $bytesLeft = $size - $bytesRead; last unless $bytesLeft; my $bytesToRead = $bytesLeft < 1024 ? $bytesLeft : 1024; my $read = read($in, $blob, $bytesToRead, $bytesRead); //line 898 unless (defined($read)) { $self->_close_cat_blob(); throw Error::Simple("in pipe went bad"); } $bytesRead += $read; } I've added a print before line 898 to print out $bytesToRead and $bytesRead and the result was 1024 for $bytesToRead, and 134220800 for $bytesRead, so it's reading 1024 bytes at a time and it has already read 128MB. Perl's 'read' function must be out of memory and is trying to request for double it's memory size...is there a way to specify how much memory to request? or is that implementation dependent? UPDATE2: While testing memory allocation in cygwin: This C program's output was 1536MB int main() { unsigned int bit=0x40000000, sum=0; char *x; while (bit > 4096) { x = malloc(bit); if (x) sum += bit; bit >>= 1; } printf("%08x bytes (%.1fMb)\n", sum, sum/1024.0/1024.0); return 0; } While this perl program crashed if the file size is greater than 384MB (but succeeded if the file size was less). open(F, "<400") or die("can't read\n"); $size = -s "400"; $read = read(F, $s, $size); The error is similar Out of memory during "large" request for 536875008 bytes, total sbrk() is 217088 bytes at mem.pl line 6.

    Read the article

  • Preserve data in .net mvc

    - by Wei Ma
    I am implementing a search module with result page support paging. The example provided by NerdDinner passes pagenumber as a parameter for the Index action, and the action uses the pagenumber to perform a query each time the user hit a different page number. My problem is that my search take many more criteria such as price, material, model number etc. than just simple pagenumber. Therefore, I would like to preserve the criteria after users' first submission, so that I only have to pass the pagenumber back and forth. Using ViewData is not possible because ViewData get cleared once it is sent to the View. Is there any good way to preserve the criteria data as I wish?

    Read the article

  • Limit size of cache directory.

    - by M.A. Cape
    I have some questions about the cache directory in android. Does anyone knows the limit for each app's cache directory? Also what will happen if there is not enough disk space to cache data? All I know is when the device runs low on storage, the files here (cache directory)will be the ones that get deleted first and each app has its own cache directory. Now, are the files of other app's cache directory will be cleared to accommodate my app's request to add files in the cache dir when there is not enough storage?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >