Posts

python - is not JSON serializable -

i have following listview import json class countrylistview(listview): model = country def render_to_response(self, context, **response_kwargs): return json.dumps(self.get_queryset().values_list('code', flat=true)) but following error: [u'ae', u'ag', u'ai', u'al', u'am', u'ao', u'ar', u'at', u'au', u'aw', u'az', u'ba', u'bb', u'bd', u'be', u'bg', u'bh', u'bl', u'bm', u'bn', '...(remaining elements truncated)...'] not json serializable any ideas ? i'll add more detailed answer. it's worth noting queryset.values_list() method doesn't return list, object of type django.db.models.query.valueslistqueryset , in order maintain django's goal of lazy evaluation, i.e. db query required generate 'list' isn't performed until object evaluated. somew...

Display, sort and filter numbers with multiple decimal in excel 2007 -

Image
i'm using excel 2007. i've list of tasks (200-500) need group in different category/section etc (multiple filters). whole data in excel table can apply excel's build-in table filters display exact data need. however difficult apply multiple filter display expected data, specially need frequently. make things simple i'm planning number each record like a.b.c.d.e.f a, b, c, d, e, f simple numbers. list looks like: 1 1.1 1.2 1.2.1 1.2.1.1 1.2.2 1.3 & on. problem is, excel take number single decimal add second decimal, excel treat text, obvious in general behavior. however, special case, need excel treat both number or text. number preferable want sort them, might difficult text. to make things little more complex, while filtering in table, require if can add formula filter results 1.* should display numbers starts 1. is possible excel's default behavior, without vba? if no, possible vba? if yes, clue appreciated. don't need whole program ...

Delphi - How to make a diagram? -

i've been problem time.. want make diagram, made on runtime data user enters in other forms etc etc. my first , actual option, making cycles , create shapes / labels, , applying shape.top variable , increasing every cycle 120. works great, if turn more complex thing, give me lot of work create shapes , controlling if in top of each other, , more, connect them line. so, there isn't component can me this? way, there component connect simple line 2 objects visually? nice ! thanks. delphiarea has component called simple graph type of thing. i have never used myself, found today , impressed demo application.

java - How to access a parameter in jrxml file and Print it? -

my query is, have set parameter in java file given below map<string, object> parameters = new hashmap<string, object>(); parameters.put("reporttitle", "mrsg quarterly report"); how access in jrxml file , print text? you need declare parameter in jrxml <parameter name="reporttitle" class="java.lang.string"></parameter> then call in text field <textfield isblankwhennull="true"> <textfieldexpression class="java.lang.string"><![cdata[$p{"reporttitle"}]]> </textfieldexpression> </textfield>

javascript - event handler that knows the event name -

i have socket.io server generates many events, , want catch of them , print similar message. right now, this: for (var event in {eventa: 1, eventb: 1, eventc: 1}) { this.translationsocket.on(event, function(result) { console.log("server sent event of type "+event); }); } when server sends eventa, eventb , eventc, see this: server sent event of type eventc server sent event of type eventc server sent event of type eventc i.e. program catches events, displays type of eventc... i tried following variations: remove "var" before "event" inside "for": "for (event ..." adding statement 'var msg = "server sent event of type "+event;' either before 'on' statement or before 'console.log' statement, , 'console.log(msg)'. none of these variations worked... what should do? this has nothing socket.io or node.js, known javascript "quirk". value of event...

xcode - Need a solution to implement xmpp add friends in group chat and sending message to them in once in ios -

i'm having difficulties add friends, sending invitations , in group chat sending 1 message using xmpp. know need use xep-0045. not succeeded. can tell me how it. send friend request 1 one chat. send invitation join chat room. send message chat room's friends. if has sample code great.. thanks in advance for #3 : send message chat room's friends. -(void) sendgroupmessage:(nsstring *) groupjid message:(nsstring *)msg{ xmppjid *roomjid = [xmppjid jidwithstring:[nsstring stringwithformat:@"%@@conference.%@",groupjid,server_url]]; xmpproom *muc = [[xmpproom alloc] initwithroomstorage:xmpproomstorage jid:roomjid dispatchqueue:dispatch_get_main_queue()]; [muc activate:xmppstream]; [muc adddelegate:self delegatequeue:dispatch_get_main_queue()]; [muc sendmessagewithbody:msg]; }

ruby - Rails Json String Length -

i trying pass json api, has possibility long due including territory codes. when restricting territories 20 or 30, works fine, when extending 250, api call not take place. checking length of json string, around 5000 characters. the problem occurs in production, , not in development. app deployed on aws elastic beanstalk. when checking logs no information @ all, if stopped @ point , ignored it. if passing json via request, please note uri in http request has limit. may want pass data post.