django get display annotate
Models (short):
class Canvas(models.Model):
C_TYPE_CHOICES = (
('L', 'Lack'),
('M', 'Matt'),
('me', 'Met'),
('S', 'Satin'),
('pe', 'Pearl'),
('p', 'Photo'),
)
#in reports c_type_chioces must me the same as here!!
c_type = models.CharField(max_length=30, verbose_name=u'Òèï', choices
= C_TYPE_CHOICES, default = 'L')
c_width = models.DecimalField(max_digits=12, decimal_places=2,
verbose_name=u'Øèðèíà', validators=[MinValueValidator(0)])
class Order(models.Model):
part = models.ForeignKey('warehouse.Part',
verbose_name=u'Êîìïëåêòóþùàÿ', related_name='order_part_a',
blank=True, null=True)
canvas = models.ForeignKey('warehouse.Canvas', verbose_name=u'Òèï
ïîëîòíà', related_name='order_canv_a', blank=True, null=True)
I make an annotate:
sum_parts_c = Order.objects.filter(o_type = '1',
entry_date__range=(start_date, end_date)).values('canvas').annotate(o_sum
= Sum('full_price'), c_sum=Sum('cost'), o_count = Count('id'), a_sum =
Sum('amount'), c_name = Min('canvas__c_type'), c_width=
Min('canvas__c_width') , p_c_name = Min('canvas__prod__name'))
How do I become in 'c_name' the name of type and not code? something like
get_ _display().
Bolevice
Thursday, 3 October 2013
Wednesday, 2 October 2013
Receiving JSON from asmx web service in Android
Receiving JSON from asmx web service in Android
Anyone know of a sample or example of Android calling an .asmx web service
and getting JSON back? Up until now I've been using ksoap2/XML just fine,
but the web service now supposedly has a JSON option but I can't seem to
make it give me JSON. Via several attempts (I'm focusing on
HttpURLConnection mainly), I've been able to get data back but it's not in
JSON (still looks like XML).
I also need to send 2 parameters along with the web service call. Do I add
them as a query string to the URL or do they have to be parameterized as
value pairs? How would I find that out?
Anyone know of a sample or example of Android calling an .asmx web service
and getting JSON back? Up until now I've been using ksoap2/XML just fine,
but the web service now supposedly has a JSON option but I can't seem to
make it give me JSON. Via several attempts (I'm focusing on
HttpURLConnection mainly), I've been able to get data back but it's not in
JSON (still looks like XML).
I also need to send 2 parameters along with the web service call. Do I add
them as a query string to the URL or do they have to be parameterized as
value pairs? How would I find that out?
HTaccess how to redirect multiple URLs?
HTaccess how to redirect multiple URLs?
I want to redirect multiple URLs to the same page.
I could do it this way:
Redirect /index.html http://example.com/newdirectory/
Redirect /index1.html http://example.com/newdirectory/
Redirect /index2.html http://example.com/newdirectory/
Redirect /index3.html http://example.com/newdirectory/
Redirect /index4.html http://example.com/newdirectory/
Redirect /index5.html http://example.com/newdirectory/
Is there not a better method for doing this? (more clean)
I want to redirect multiple URLs to the same page.
I could do it this way:
Redirect /index.html http://example.com/newdirectory/
Redirect /index1.html http://example.com/newdirectory/
Redirect /index2.html http://example.com/newdirectory/
Redirect /index3.html http://example.com/newdirectory/
Redirect /index4.html http://example.com/newdirectory/
Redirect /index5.html http://example.com/newdirectory/
Is there not a better method for doing this? (more clean)
mysql query for select from two mysql tables
mysql query for select from two mysql tables
i'm using codeigniter.
i have two mysql tables.
what i'm doing is taking all the details in the first table and feed it to
html page and let all users to view it. but now i want to take some
details from second table related to a colum in first table.
i mean i have a column in first table call "Pending_on" in that column i
have inserted some branch names. and in the second table i have inserted
the contact details of those departments.
so if we think in the first table fifth row pending_on column has the
value "HR" then i want to display the telephone number of the HR
department.
so how can i write a query for this?
i'm using codeigniter.
i have two mysql tables.
what i'm doing is taking all the details in the first table and feed it to
html page and let all users to view it. but now i want to take some
details from second table related to a colum in first table.
i mean i have a column in first table call "Pending_on" in that column i
have inserted some branch names. and in the second table i have inserted
the contact details of those departments.
so if we think in the first table fifth row pending_on column has the
value "HR" then i want to display the telephone number of the HR
department.
so how can i write a query for this?
Tuesday, 1 October 2013
Android Failed to initialize display event receiver
Android Failed to initialize display event receiver
My application crashed when I open it again after closing it for quite
some time. The crash report shows this error:
java.lang.RuntimeException: Failed to initialize display event receiver.
status=-2147483648
at android.view.DisplayEventReceiver.nativeInit(Native Method)
at android.view.DisplayEventReceiver.<init>(DisplayEventReceiver.java:61)
at
android.view.Choreographer$FrameDisplayEventReceiver.<init>(Choreographer.java:676)
at android.view.Choreographer.<init>(Choreographer.java:165)
at android.view.Choreographer.<init>(Choreographer.java:68)
at android.view.Choreographer$1.initialValue(Choreographer.java:94)
at android.view.Choreographer$1.initialValue(Choreographer.java:87)
at java.lang.ThreadLocal$Values.getAfterMiss(ThreadLocal.java:430)
at java.lang.ThreadLocal.get(ThreadLocal.java:65)
at android.view.Choreographer.getInstance(Choreographer.java:184)
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:440)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:322)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:234)
at
android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:153)
at android.view.Window$LocalWindowManager.addView(Window.java:559)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2702)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2140)
at android.app.ActivityThread.access$700(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4921)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.s
I am cracking my head looking for the solution or at least someone with
similar problem but surprisingly there is none. Thanks.
My application crashed when I open it again after closing it for quite
some time. The crash report shows this error:
java.lang.RuntimeException: Failed to initialize display event receiver.
status=-2147483648
at android.view.DisplayEventReceiver.nativeInit(Native Method)
at android.view.DisplayEventReceiver.<init>(DisplayEventReceiver.java:61)
at
android.view.Choreographer$FrameDisplayEventReceiver.<init>(Choreographer.java:676)
at android.view.Choreographer.<init>(Choreographer.java:165)
at android.view.Choreographer.<init>(Choreographer.java:68)
at android.view.Choreographer$1.initialValue(Choreographer.java:94)
at android.view.Choreographer$1.initialValue(Choreographer.java:87)
at java.lang.ThreadLocal$Values.getAfterMiss(ThreadLocal.java:430)
at java.lang.ThreadLocal.get(ThreadLocal.java:65)
at android.view.Choreographer.getInstance(Choreographer.java:184)
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:440)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:322)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:234)
at
android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:153)
at android.view.Window$LocalWindowManager.addView(Window.java:559)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2702)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2140)
at android.app.ActivityThread.access$700(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4921)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.s
I am cracking my head looking for the solution or at least someone with
similar problem but surprisingly there is none. Thanks.
Method out of space?
Method out of space?
Today I got the following error message for the first time ever...
java.lang.Error: Unresolved compilation problem:
The code of method init() is exceeding the 65535 bytes limit
at generator.Main.init(Main.java:36)
at sun.applet.AppletPanel.run(AppletPanel.java:425)
at java.lang.Thread.run(Thread.java:680)
The error is being caused because I am creating an array list with around
10,000 ints in my init() method. The solution to this problem is not very
complicated, I made 3 methods that each had 3,300 ints in them and called
them all from my init().
But I have a couple questions purely out of curiosity.
Why do methods have a limit on space?
Why is it limited to 65535 bytes? (2^something-1?)
Is there any way to give a method more space or will they all be limited
the same amount?
How much information exactly is 65535 bytes?
Today I got the following error message for the first time ever...
java.lang.Error: Unresolved compilation problem:
The code of method init() is exceeding the 65535 bytes limit
at generator.Main.init(Main.java:36)
at sun.applet.AppletPanel.run(AppletPanel.java:425)
at java.lang.Thread.run(Thread.java:680)
The error is being caused because I am creating an array list with around
10,000 ints in my init() method. The solution to this problem is not very
complicated, I made 3 methods that each had 3,300 ints in them and called
them all from my init().
But I have a couple questions purely out of curiosity.
Why do methods have a limit on space?
Why is it limited to 65535 bytes? (2^something-1?)
Is there any way to give a method more space or will they all be limited
the same amount?
How much information exactly is 65535 bytes?
Uninstall Linux OS's with GRUB
Uninstall Linux OS's with GRUB
pIs there a way to uninstall my 3 Linux OS's: Ubuntu, Linux Mint and Pear
OS (Pear OS's Partition somehow got formatted, just the partition, not the
OS) With GRUB so I can install everything freshly? I made a big mess and I
think that I need to reinstall it freshly, I got a Linux Mint live USB in
case of emergency./p pThe real problem is that I also got Windows 8 and I
don't wanna lose any files there./p pSummary: How do I completely delete
My Linux Operative Systems along with GRUB to reinstall it freshly?/p
pIs there a way to uninstall my 3 Linux OS's: Ubuntu, Linux Mint and Pear
OS (Pear OS's Partition somehow got formatted, just the partition, not the
OS) With GRUB so I can install everything freshly? I made a big mess and I
think that I need to reinstall it freshly, I got a Linux Mint live USB in
case of emergency./p pThe real problem is that I also got Windows 8 and I
don't wanna lose any files there./p pSummary: How do I completely delete
My Linux Operative Systems along with GRUB to reinstall it freshly?/p
Subscribe to:
Comments (Atom)