Posts

java.lang.ClassCastException: android.widget.AbsListView$LayoutParams cannot be cast to android.widget.LinearLayout$LayoutParams -

i trying put message n date below in same bubble messeage textview. used layoutparams make bubble left or right. but i'm getting error. fatal exception: main process: com.rana.sahaj.myyu, pid: 18103 java.lang.classcastexception: android.widget.abslistview$layoutparams cannot cast android.widget.linearlayout$layoutparams @ com.rana.sahaj.myyu.singlemessageroomactivity$messagesadapter.getview(singlemessageroomactivity.java:326) @ android.widget.abslistview.obtainview(abslistview.java:2257) @ android.widget.listview.makeandaddview(listview.java:1790) @ android.widget.listview.filldown(listview.java:691) ...

Python in ArcGIS - Lookup values in a dictionary and print corresponding value into a new field -

i new python , have been trying days work write function decodes field in attribute table , adds corresponding value (from dictionary below) blank field. (similar vlookup in excel). example when 'e1' shows in attribute table 'e' in dictionary, find corresponding value in dictionary , print list , '1' , print same list (blank field has been added attribute table). add list blank field in attribute table. your data structure not friend @ point. you have information stacked in nested dictionary structure, better off decoding first: #!python3 import collections import itertools luc_dict = { 'estu':'estuaries', 'ice':'ice', 'lake':'lake', 'quar':'quarries/mines', 'rive':'river', 'town':'town/urban', 'class':{'1':'arable (1)', '2':'arable (2)', '3':'arable (3)', ...

d3.js - d3 units formatting SI with rounding (nvd3 charts) -

i using si units formatting axis using code below. way if value goes 1000 represented 1k, 2.4k etc. d3.format('s') problem cases displaying 13.47899999999k. how can use si units along rounding off 2 decimal places? you can try d3.format(".2s")

c - Why this weird behaviour of memory allocation -

this interesting code allocates 3 gb memory in linux systems if physical ram less 3 gb. how? (i have 2.7 gb ram in system , code allocated 3.054 mb memory!) #include <stdio.h> #include <string.h> #include <stdlib.h> int main(int argc, char *argv[]) { void *ptr; int n = 0; while (1) { // allocate in 1 mb chunks ptr = malloc(0x100000); // stop when can't allocate more if (ptr == null) break; n++; } // how did get? printf("malloced %d mb\n", n); pause(); } by default in linux, don't ram until try modify it. might try modifying program follows , see if dies sooner: #include <stdio.h> #include <string.h> #include <stdlib.h> int main(int argc, char *argv[]) { char *ptr; int n = 0; while (1) { // allocate in 4kb chunks ptr = malloc(0x1000...

scroll - Trouble with jquery scrollTop function -

i'm trying follow dry principle changing bunch of repeated functions, i'm stuck here. want change scroll function repeated 4 times different classes , ids more generic way (i'm using jquery ): $('.empresa').click(function(event){ $('html, body').animate({ scrolltop: $("#empresa").offset().top }, 500); return false; }); $('.nosotros').click(function(event){ $('html, body').animate({ scrolltop: $("#nosotros").offset().top }, 500); return false; }); the classes elements of navigation within ul looks this. <ul class="nav"> <li><a href="index#nosotros" class="nosotros">link anchor</a></li> <li><a href="index#empresa" class="empresa">link anchor</a></li> </ul> and scroll tags div elements tags. <div class="some-random-class" id="emp...

php - What does this get_text function do? -

panique did great job answering question on thread: php directory list remote server but created function don't understand @ , hoping sort of explanation. example, what's random 8192 number? function get_text($filename) { $fp_load = fopen("$filename", "rb"); if ( $fp_load ) { while ( !feof($fp_load) ) { $content .= fgets($fp_load, 8192); } fclose($fp_load); return $content; } } it loads file path in $filename , returns it's content. 8192 not random. means read file in chunks of 8kb . the while loop runs long file wasn't entirely read. each iteration adds latest 8kb of file $content returned @ end of function.

possible mistake/bug in Stanford CoreNLP and/or NLP parse visualization -

Image
don't think wrong tag 'me meal on flight ua 386 san francisco denver' in sentence 'show me meal on flight ua 386 san francisco denver' s? image created using nlp parse visualization available @ http://nlpviz.bpodgursky.com/ the stanford parser worse @ imperatives on other sentences. simple parse error, inherent in fact these imperfect models. the dependency parser seems mess on sentence; suspect it's hard sentence.