Posts

Showing posts from February, 2013

jquery - Hot to submit a form that was loaded in modal? -

after loading form modal-body twitter bootstrap, how submit form using modal primary button? i don't want set #id because primary button have submit every form loaded. i go using selector $('#idofmodal .modal-body form').submit() obviously must change selector according markup (or post markup here can change according it) hope helps

php - Storing values to array and Counting total array values -

im storing age values inside array using array push, foreach($arrayagevalues $value){ $arrayage21to30 = array(); $arrayage31to40 = array(); if($value['age'] >= 21 && $value['age'] <= 30) { array_push($arrayage21to30, $value['age']); } if($value['age'] >= 31 && $value['age'] <= 40) { array_push($arrayage31to40, $value['age']); } } at end want count total values stored inside array in $arrayage21to30 ans $arrayage31to40. used count($arrayage21to30); doesnt return total number of array values inside array. is there way on how can count values of array or approach of storing values inside array wrong? $arrayage21to30 , $arrayage31to40 should out of foreach just try code: <?php $arrayage21to30 = array(); $arrayage31to40 = array(); foreach($arrayagevalues $value) { if($value['age'] >= 21 && $value['age'] <= 30) { array_push($array

javascript - Loop through imagedata in a HTM5 canvas vertically -

i trying loop canvas vertically . mean, looping through first column, the 2nd, etc. my first goal colorize first half of width . code acting weird , problem is... not know why! loopvertical = function (data, canvas){ (var x = 0; x < canvas.width*2; x+=4) { (var y = 0; y < canvas.height; y++) { data[x+y*canvas.width*4] = 255; } } return data; } the result: red stripes on image. , that's not want. after need divide image in smaller images if have vertical line of transparent pixels, not topic of question :) i don't know html5 canvas , image data, according this tutorial , guess outer loop wrong. apparently, need take care of operator precedence when calculating index of data. maybe : loopvertical = function (data, canvas){ // first half of width (var x = 0; x < canvas.width / 2; x++) { (var y = 0; y < canvas.height; y++) { data[(x+y*canvas.width)*4] = 255;

cuda - Linking an extra object file -

i using qmake manage build of cuda project. i'd use separate compilation feature of cuda 5.0, means device code must linked before being linked rest of code. i've managed intermediate linking step adding .pro file: qmake_pre_link = $$cuda_dir/bin/nvcc $$cuda_gencode -dlink $(objects) -o dlink.o this creates object file called dlink.o , should added array of objects linked g++, don't know how accomplish this. peeking makefile, notice linker passed additional variable called objcomp , not defined , can't find way access through qmake. add line .pro file: libs += dlink.o

php - Inserting data into 3 tables in 1 query -

basically have site tag-it system similar 1 on site, table structures follows topics topic_tags tags topic_id tag_id tag_id topic_data topic_id tags now trying run series of queries when topic posted, enters relevant topic data topic table(currently working), puts tags tags table(currently working), puts tag_id tags table topic_tags table in rows linked topic_ids(not working currently) right it's not entering tag_ids topic_tags tags table, it's entering last tags info row , not storing associated topic_ids here code $tags = isset($_post['tags']) ? $_post['tags'] : null; if (is_array($tags)) { foreach ($tags $t) { // checking duplicate $sql_d = "select * tags tags='$t'"; $res=mysql_query($sql_d); $res = mysql_num_rows($res); if($res<1) { // escape $t before inserting in db $sql = "insert tags (tags) values('$t')"; mysql_query($sql); } } } e

javascript - QUnit tests failing intermittently -

below javascript file shows sum of 2 numbers. var getsum = function (arg1, arg2) { var intarg1 = parseint(arg1); var intarg2 = parseint(arg2); return intarg1 + intarg2; }; var getsumtext = function (arg1, arg2) { var sum = getsum(arg1, arg2); return 'the sum of ' + arg1 + ' , ' + arg2 + ' ' + sum + '.'; }; $(document).ready(function () { $("#button1").click(function (e) { console.log('button clicked'); var sumtext = getsumtext($("#arg1").val(), $("#arg2").val()); $("#output1").text(sumtext); e.stoppropagation(); }); }); here's qunit.html file. <!doctype html> <html> <head> <meta charset="utf-8" /> <title>test suite</title> <link href="content/qunit-1.12.0.css" rel="stylesheet" /> <script src="scripts/jquery-2.0.0.min.js"></scri

android - Strange Error Using putExtra -

i trying import string intention , put string intention. seeing strange error on putextra method. when place mouse cursor on line's error mark on left side says: " multiple markers @ line: -syntax error on '(' token, delete token -syntax error on ')' token, delete token " obviously need parenthesis deleting them not solve problem. has ever encountered before? public class countdown extends activity { public final static string extra_message = "com.example.myfirstapp.message"; private handler handler = new handler(); //import intention starting point activity intent intention1=getintent(); final string message = intention1.getstringextra(startingpoint.extra_message); //create intention supposed go display message activity intent broadcastsm = new intent(this, displaymessageactivity1.class); broadcastsm.putextra(extra_message, message);

matlab - How to count the number of detected objects in the image? -

i want develop application can count number of objects in image. it's not important know shape of objects. need information of how many objects in image. and want able implement many images. possible? how that? here code: a=citra1; a_citra_keabuan = rgb2gray(a); threshold = graythresh(a_citra_keabuan); a_bww = im2bw(a_citra_keabuan,threshold); a_bw = bwareaopen(a_bww,30); se = strel('disk',2); a_bw = imclose(a_bw,se); a_bw=~a_bww; [labeled,numobjects]=bwlabel(a_bw); the numobjects shows number of detected objects in images. here sample of images images1 images2 to start off can flood images in different colors , thereafter detect how many colors left. take point, fill neighbors same color if condition satisfied. should leave picture big fields (the before objects if conditions right). these can counted then. here's hint on how that: http://blogs.mathworks.com/steve/2008/02/25/neighbor-indexing-2/

eclipse plugin - disable menu based on value of a preference variable -

i have menu item xyz. have preference page mypref has check box , couple of text fields. when check box in mypref check, want menu xyz enabled else should disabled. there way achieve this. yes, way exist. 1). create entry in ipreferencestore - class extends abstractuiplugin , following: ipreferencestore store = iextendabstractuiplugin.getdefault() .getpreferencestore(); then store value reflect checkbox state: preferencestore.setvalue("xyzmenupreference", false); // if disabled or preferencestore.setvalue("xyzmenupreference", true); // if enabled 2). create property tester extention plugin.xml: <extension point="org.eclipse.core.expressions.propertytesters"> <propertytester class="org.xyz.propertytester" id="org.xyz.propertytester" type="java.lang.object" namespace="org.xyz" properties="xyzmenu"> </propertytester> </exte

c# - Linq to XML: from query to variable -

i wrote this: xdocument doc = xdocument.load("test.xml"); string nodename = "mike"; var query = el in doc.descendants("dogs") (string)el.attribute("name") == nodename select "name: " + nodename + "\n" + "breed: " + (string)el.element("breed") + "\n" + "sex: " + (string)el.element("sex"); foreach (string data in query) messagebox.show(data); since want load data, want put them variables, able put them later textboxes, radioboxes, etc. know how display messagebox. not sure if refering this, can give try: make new public class: public class xmlresut { public string name { get; set; } public string breed { get; set; } public string sex { get; set; } // maybe enum fit property better }

javascript - 2 Select boxes filter -

i have read tutorial selectbox filter: http://www.cssnewbie.com/intelligent-select-box-filtering/#.uewddo30fgg http://www.lessanvaezi.com/filter-select-list-options/ selecting options , filter values in select box jquery some of example big, have 2 selectboxes, in first selectbox have 3 entrys, how can @ easiest method filter second selectbox, have tried this: function cascadeselect(parent, child){ var childoptions = child.find('option:not(.static)'); child.data('options',childoptions); parent.change(function(){ childoptions.remove(); child .append(child.data('options').filter('.sub_' + this.value)) .change(); }); childoptions.not('.static, .sub_' + parent.val()).remove(); } var $j = jquery.noconflict(); //$j(document).ready(function(){ cascadeform = $j('.cascadetest'); orgselect = casc

Foreach vs for loop in C#. Creation of new object is possible in for loop, but not possible in foreach loop -

i have wonder why can create new object of class ' someclass ' in for loop, can't same in foreach loop. the example bellow: someclass[] n = new someclass[10]; foreach (someclass in n) { = new someclass(); // cannot assign 'i' because 'foreach iteration variable' } (int = 0; < n.length; i++) { n[i] = new someclass(); // ok } can explain me scenario? foreach iteration loops known 'read-only contexts.' cannot assign variable in read-only context. for more info: http://msdn.microsoft.com/en-us/library/369xac69.aspx

AsyncTask error from getView using a HashMap - Android -

i have set allow me change visibility of textview on online file turned strings , of works fine apart when add in parts of code allows me change visibility of textview. not understand why isn't working. here logcat: 07-21 19:00:46.451 21334-21334/com.example.app e/androidruntime: fatal exception: main java.lang.nullpointerexception @ com.example.app.lazyadapter.getview(lazyadapter.java:68) @ android.widget.abslistview.obtainview(abslistview.java:2035) @ android.widget.listview.measureheightofchildren(listview.java:1244) @ android.widget.listview.onmeasure(listview.java:1155) @ android.view.view.measure(view.java:12723) @ android.view.viewgroup.measurechildwithmargins(viewgroup.java:4698) @ android.widget.linearlayout.measurechildbeforelayout(linearlayout.java:1369) @ android.widget.linearlayout.measurevertical(linearlayout.java:660) @ android.widget.linearlayout.onmeasure(linearlayout.java:553) @ android.view.view.measure(view.java

ios - Moving an MKMapView to a specific location relative to the superview -

i have few annotations added mkmapview, , when user clicks on 1 of annotations, displays uicalloutview right accessory button adds uiview map, displaying information specific location. uiview centred in superview of map, , in order show information in view relative annotation, shift visible map rect down (on y axis), , center on x axis annotation directly under view. i doing following centre annotation, however, don't know how move annotation down on y axis sits under added uiview. please can tell me how can so? [self.mapview setcentercoordinate:[annotation coordinate] animated:yes]; you can size of information view, know how want use map (based on difference between size , map view size). know offset, can calculate point (in view coordinate system) should moved centre annotation moved down). can use convertpoint:tocoordinatefromview: find coordinate point use setcentercoordinate:animated: .

How do I make a contact form 7 in wordpress -

i want make contact form in wordpress including input fields , checkboxes , want form data go email address. how make 1 scratch ? go wordpress dashboard , click "contact" on left hand side. click add new. in area have 2 boxes, form , mail. form displayed on website , mail generates sent (ie e-mail address form sent , default template of e-mail). directing mail e-mail address simple - change "to" box e-mail. the form box completed generating tags using plugin. example, generate file upload box click generate tag -> file upload -> , change options within (required field, etc) , paste given code form , mail boxes directs to. once process finished forms click save , copy generated shortcode page want include contact form in. hope answers question, paul

php - Sphinx 2x , Adding WHERE clause having used sql_field_string -

i building application requires search. i using sphinx 2.0x , has been giving me results. now, want filter through using where in mysql example, select * properties where type = 'house' trying add filter on sphinx search. i using https://github.com/cakenkeyboard/sphinx-cakephp , api have, (just checked) requires filter's second argument array , assert requires know if number. not touch api file nor behaviour file. checked : sphinx 2.0.2 filtering sql_attr_string attributes made sense! but add match ??? using behaviour , api file asserts if value number want check on string. please help. match(..) 'full-text' query itself. so in api, ->query call. sphinxql makes extended match mode default, use @ syntax in api, need explicitly request sph_match_extended

matlab - Fast algorithms for finding pairwise Euclidean distance -

i know matlab has built in pdist function calculate pairwise distances. however, matrix large 60000 300 , matlab runs out of memory. this question follow on matlab euclidean pairwise square distance function . is there workaround computational inefficiency. tried manually coding pairwise distance calculations , takes full day run (sometimes 6 7 hours). any appreciated! well, couldn't resist playing around. created matlab mex c file called pdistc implements pairwise euclidean distance single , double precision. on machine using matlab r2012b , r2015a it's 20–25% faster pdist (and underlying pdistmex helper function) large inputs (e.g., 60,000-by-300). as has been pointed out, problem fundamentally bounded memory , you're asking lot of it. mex c code uses minimal memory beyond needed output. in comparing memory usage of pdist , looks 2 virtually same. in other words, pdist not using lots of memory. memory problem in memory used before calling pdist (

How to Build a Search Engine? (2013 Update) -

this isn't first time question has been asked here @ stackoverflow - 5 years later - , times , technologies have changed bit. i'm wondering folks thinking these days building search engine? for example, know nutch continuing developed - still robust solution available? there alternative mature solutions available other languages - e.g. c#, php, vb.net? i know there publicly available mass index can utilized, reducing need perform one's own spidering common crawl . there of course, still few custom search engine solutions out there, well-known being google's cse ...but i'm not aware of other major/stable/reputable ones i'd trust build engine upon? what resources available learn programming search engines weren't available few years ago, or last year? udacity's got course on learning python via creating web crawler, try here: https://www.udacity.com/course/cs101

c# - OrderBy selector fails while projecting anonymous type -

when using entity framework 5, why work? var query = categories.select(c => new { products = c.products.orderby(p => p.name) }); while won't? func<product, string> selector = p => p.name; var query = categories.select(c => new { products = c.products.orderby(selector) }); the thrown exception is: unsupported overload used query operator 'orderby'. making selector expression<func<product, string>> won't work directly , not compile because c.products not iqueryable<t> . collection type implementing ienumerable<t> . enumerable.orderby not accept expression parameter, delegate. but ef still needs expression, not delegate. trick use asqueryable() on navigation collection: expression<func<product, string>> selector = p => p.name; var query = categories.select(c => new { products = c.products.asqueryable().orderby(selector) });

android - Using Jackson Json to parse Google Blogs post -

i have been struggling parse feed using jackson json parser. here feed: { "responsedata": { "query": "official google blogs", "entries": [ { "url": "http://googleblog.blogspot.com/feeds/posts/default", "title": "<b>official blog</b>", "contentsnippet": "5 days ago <b>...</b> <b>official</b> weblog, news of new products, events , glimpses of life inside <br> <b>google</b>.", "link": "http://googleblog.blogspot.com/" }, { "url": "http://googlewebmastercentral.blogspot.com/feeds/posts/default", "title": "<b>official google</b> webmaster central <b>blog</b>", "contentsnippet": "jul 12, 2013 <b>...</b> <b>official</b> weblog on <b>google</b> crawling , indexing, , on webmaster tools, <br>

java - Program crashes with empty text field -

i need trying fix code. thought simple (probably is) can't it. have simple adding calculator. works fine, if leave 1 or both number text fields empty, program crashes. i have if statement, apparently not telling right thing. public class mainactivity extends activity { double firstnum, secondnum, answernum; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); final edittext first = (edittext) findviewbyid(r.id.txtfirst); final edittext second = (edittext) findviewbyid(r.id.txtsecond); final textview answer = (textview) findviewbyid(r.id.txtanswer); button calc = (button) findviewbyid(r.id.btncalc); calc.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub // convert pulled info double using variable names firstnum = double.parsedoub

Assignment operator explanation in Java -

public class conversions { public static void main(string[] args) { int index = 3; int[] arr = new int[] { 10, 20, 30, 40}; arr[index] = index = 2; //(1) system.out.println("" + arr[3] + " " + arr[2]); } } i have , gives: 2 30 i hoping give 40 2 at (1) why value of index in assignment not changed 2 ( , kept 3). ? the right-associativity of = implied section 15.26 of java language specification (jls) means expression can represented tree , thus: = +------+-------+ | | arr[index] = +----+----+ | | index 2 but then, section 15.7 states: the java programming language guarantees operands of operators appear evaluated in specific evaluation order, namely, left right. therefore, arr[index] evaluated before index = 2 is, i.e. before

Django - Making a SQL query on a many to many relationship with PostgreSQL Inner Join -

i looking perticular raw sql query using inner join. i have models: class ezmap(models.model): layers = models.manytomanyfield(shapefile, verbose_name='layers display', null=true, blank=true) class shapefile(models.model): filename = models.charfield(max_length=255) class feature(models.model): shapefile = models.foreignkey(shapefile) i make sql query valid postgresql one: select id "table_feature" where' shapefile_ezmap_id = 1 ; but dont know how use inner join filter features shapefile belongs related particular ezmap object something this: try: id = feature.objects.get(shapefile__ezmap__id=1).id except feature.doesnotexist: id = 0 # or other action when no result found you need use filter (instead of get ) if want deal multiple feature results.

list - PHP listing function arguments with initial values -

so know can code function's arguments have default value if not supplied when function called this: edit: added example of how interface implemented interface my_interface { function my_function(); } class my_class implements my_interface { # because interface calls function no options error occur function my_function($arg_one, $arg_two = 'name') { ... } } class another_class implements my_interface { # class have no errors , complies implemented interface # can have number of arguments passed function my_function() { list($arg_one, $arg_two, $arg_three) = func_get_args(); ... } } however, making functions invoke func_get_args() method instead when using them inside classes can implement functions interface. there way use list() function can assign variables default value or need verbose , ugly way? have right is: function my_function() { list($arg_one, $arg_two) = func_get_args(); if(is_null($arg_two)) $ar

c# - Bind a ListBox inside an ItemsControl -

good day guys, want create list of clients , each client has group of items want's buy, shopping cart. method want use create listbox inside itemscontrol this: <itemscontrol name="clientlist"> <itemscontrol.itemtemplate> <datatemplate> <grid height="46"> <grid.rowdefinitions> <rowdefinition height="46"/> <rowdefinition/> </grid.rowdefinitions> <textblock name="client" text="{binding client}" height="45" width="200" horizontalalignment="left" verticalalignment="top" margin="10,5" fontsize="26"/> <listbox name="itemslist" grid.row="1" itemssource="{binding items}"/>

Can i inject javascript into iframe? -

<html> <head> <link rel="stylesheet" href="my.css" /> </head> <body> <iframe id="baidu-container" src="http://image.baidu.com/i?tn=baiduimage&ipn=r&ct=201326592&cl=2&lm=-1&st=-1&fm=result&fr=&sf=1&fmq=1374487244324_r&pv=&ic=0&nc=1&z=&se=1&showtab=0&fb=0&width=&height=&face=0&istype=2&ie=utf-8&word=giant" frameborder="0"> </iframe> <script type="text/javascript" src="my.js"></script> </body> </html> i execute script in my.js after iframe has loaded completely. shoud do? thanks. you can use onload event on iframe: http://www.w3schools.com/jsref/event_frame_onload.asp

How to Load an Image onto PictureBox in Visual Studio using C# -

i have been trying use following code load image resources picture box on visual studio 2012 using c#. picturebox1.load(properties.resources.desert); and have been getting following errors. the best overloaded method match system.windows.forms.picturebox.load(string) has invalid arguments argument 1: cannot convert system.drawing.bitmap string the load method takes string . directly passing resource bitmap .. won't work. try this: picturebox1.image = properties.resources.desert; this directly set image in picturebox bitmap in resources.

ada - Calling a function passed as an access type that takes no parameters -

consider family of functions take no arguments , return same type: function puzzle1 return answer_type; function puzzle2 return answer_type; function puzzlen return answer_type; i'd able pass functions subprogram , have subprogram call function , use result. can pass function subprogram defining access type: type answer_func_type access function return answer_type; however, there doesn't seem way call passed-in function result: procedure print_result(label : in string; func : in not null answer_func_type; expected : in answer_type) result : answer_type; begin result := func; -- expected type "answer_type", found type "answer_func_type" result := func(); -- invalid syntax calling function no parameters -- ... end print_result; is there way in ada without adding dummy parameter functions? you trying use pointer function, not function itself. dereference pointer , sh

regex - Adding Carriage Returns without deleting numbers -

fellow forum members, need little setting notepad++ regex following. have sentences preceded outline level numbers read single text string shown belov: sentence bla bla 2. sentence bla bla 3. sentence bla bla 3a. sentence bla bla 3b. sentence bla bla 3c. sentence bla bla my goal data it's shown below adding new line carriage returns in front of outline level numbers @ same time need regex not care outline level numbers (i.e. 1. 2. 3. 3a. 3b. 3c.). need regex leave these numbers alone , insert new line carriage returns in front of these numbers data looks shown below: sentence bla bla sentence bla bla sentence bla bla 3a. sentence bla bla 3b. sentence bla bla 3c. sentence bla bla i have been experimenting following wild card characters: .+? also: \r\n the problem can't work. appreciated. in advance. search: (\b\d+[a-z]?\. ) replace: \r\n\1

Carrying amount value over to PayPal from Donation form -

i creating new website non-profit organization, , have donation form in donor can enter amount give, , have value carried on paypal. here website . if click on "give online", modal appears donation form. here form's code: (it taken website's contact form in order keep forms visually similar.) <!-- form --> <form id="contactform" action="#" method="post"> <fieldset> <p><label for="amount">enter amount wish donate.</label> <input name="amount" id="amount" type="text" value="" class="form-poshytip" title="usd"></p> <p><input type="button" value="continue"></p> </fieldset> </form> <!-- ends form --> the continue button not anything, yet. direct donor paypal page amount entered in donation form present. code directs donor pay

python - Numpy indexing with a one dimensional boolean array -

the post, getting grid of matrix via logical indexing in numpy , similar, not answer question since working 1 dimensional boolean array. i attempting recreate following boolean indexing feature in octave. octave-3.2.4:6> = rand(3,3) = 0.249912 0.934266 0.371962 0.505791 0.813354 0.282006 0.439417 0.085733 0.886841 octave-3.2.4:8> a([true false true]) ans = 0.24991 0.43942 however, unable create same results in python numpy. >>> import numpy np >>> = np.random.rand(3,3) array([[ 0.94362993, 0.3553076 , 0.12761322], [ 0.19764288, 0.35325583, 0.17034005], [ 0.56812424, 0.48297648, 0.64101657]]) >>> a[[true, false, true]] array([[ 0.19764288, 0.35325583, 0.17034005], [ 0.94362993, 0.3553076 , 0.12761322], [ 0.19764288, 0.35325583, 0.17034005]]) >>> a[np.ix_([true, false, true])] array([[ 0.94362993, 0.3553076 , 0.12761322], [ 0.56812424, 0.48297648, 0.

c# - bitmap save jpeg failled but png is ok because of the comments property -

Image
question description: when save bitmap jpeg file jpeg format mode, gdi exception thrown. when save png format mode, can saved successfully. quick recreate: please save images .jpg file broswer. click here: incorrectimage , correctimage .(actually, in our application, request image on fly , save image jpeg.) using below code see exception: string newfile = @"d:\temp\newimage.jpg"; var newbitmap = image.fromfile(@"d:\temp\incorrectimage.jpg"); newbitmap.save(newfile,system.drawing.imaging.imageformat.jpeg); what found: after deep investigation, found out root of issue the comments property of orginal image. when delete the property value, error disappears. besides, after copy value of comments value of image notepad , paste back, image can saved new image upper code , size of image larger! so, guess comments property might includes sensitive or incorrect charector when saving jpeg file. guys can give our insights on comments? thanks in advance

Printing long int value in C -

i have 2 variables of long int type shown below: long int a=-2147483648, b=-2147483648; a=a+b; printf("%d",a); i getting zero. tried changing type long long int , i'm still not getting correct answer. you must use %ld print long int , , %lld print long long int . note long long int guaranteed large enough store result of calculation (or, indeed, input values you're using). you need ensure use compiler in c99-compatible mode (for example, using -std=gnu99 option gcc). because long long int type not introduced until c99; , although many compilers implement long long int in c90 mode extension, constant 2147483648 may have type of unsigned int or unsigned long in c90. if case in implementation, value of -2147483648 have unsigned type , therefore positive, , overall result not expect.

gdb - Cross-compiled gnu for m68k, on opening core dump file gives, no core file handler recognizes the format error -

cross compiled gdb, configure --target=m68k-linux --program-prefix=m68k- , gives error no core file handler recognizes format. details: core file generated on m68k devcie , log analyzed on i686-pc-linux-gnu gdb version - 7.6 any clue on subject? elf format of core file elf -a core elf header: magic: 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00 class: elf32 data: 2's complement, big endian version: 1 (current) os/abi: unix - system v abi version: 0 type: core (core file) machine: mc68000 version: 0x1 entry point address: 0x0 start of program headers: 52 (bytes file) start of section headers: 0 (bytes file) flags: 0x0 size o

JavaScript stop to extract html tags -

i have bookmarklet javascript application, used extract html tags webpage source html file. however, not know why javascript application stop extracting information, when meets following piece of html code: <span class=""> <span class="profilecardavatarthumb"> <a class="hasglobalhandling" id="nametag_956648_1" target="_blank" data-profile- card="true" data-profile-id="51ca7e40e4b013690dce7c08" href="#"> <span class="hideoff"> access profile card user: lecturer zhang </span> <img alt="" src="/images/ci/ng/avatar_150.gif"> </a>lecturer zhang </span> </span> any very appreciated!!!

html - DIV background disappearing when child image is positioned absolute -

i'm trying make joomla template , have strange problem html , css code. have footer text joomla module , img. when try bring image right side of footer seting position absolute , right 0 background of footer disappears. my html code: <footer> <p>some text</p> <p><jdoc:include type="modules" name="footer" /></p> <img src="<?php echo $templatedir;?>/images/footerbgr.png"/> </footer> my css code: footer { width: 75%; position: relative; margin: 0px 10% 0px 10%; background: #292929; border-radius: 25px; } footer p { float: left; color: #fff; margin: 3px 0px 0px 10px; } footer img { position: absolute; right: 0px; } when remove "position: absolute;" background shown image not want it. you need give height footer footer { width: 75%; position: relative; margin: 0px 10% 0px 10%; background: #292929;

javascript - How to implement keyboard function shortcut key on websites? -

i want use keyboard function key in website. how can implement keyboard function shortcut key on website. everyone....... use javascript: // event.type should keypress function getchar(event) { if (event.which == null) { // ie if (event.keycode < 32) return null; // special character return string.fromcharcode(event.keycode) } if (event.which != 0 && event.charcode != 0) { // not ie if (event.which < 32) return null; // special character return string.fromcharcode(event.which); // other } return null; // special character } for control keys use: event.shiftkey, event.ctrlkey, event.altkey or event.metakey.

hadoop - Filtering log files in Flume using interceptors -

i have http server writing log files load hdfs using flume first want filter data according data have in header or body. read can using interceptor regex, can explain need do? need write java code overrides flume code? also take data , according header send different sink (i.e source=1 goes sink1 , source=2 goes sink2) how done? thank you, shimon you don't need write java code filter events. use regex filtering interceptor filter events body text matches regular expression: agent.sources.logs_source.interceptors = regex_filter_interceptor agent.sources.logs_source.interceptors.regex_filter_interceptor.type = regex_filter agent.sources.logs_source.interceptors.regex_filter_interceptor.regex = <your regex> agent.sources.logs_source.interceptors.regex_filter_interceptor.excludeevents = true to route events based on headers use multiplexing channel selector : a1.sources = r1 a1.channels = c1 c2 c3 c4 a1.sources.r1.selector.type = multiplexing a1.sources.

html - Bad consequences of linking css external stylesheet outside of head? -

this question has answer here: does <style> have in <head> of html document? 9 answers so first off, know <link> tag link css external style sheet should in <head> section, , unorthodox place outside head. however, using head , footer includes modular web design, , there css stylesheets apply pages , not others. having placed <link> tags within <body> section of page, sweet accommodation of modern browsers have far experienced nothing wrong except in ie.... but, don't care ie @ moment. so, apologies html purists, must ask: what negative consequences there linking css external stylesheets outside of <head> ? in research, people have stuck referencing w3schools stating "link css stylesheet in head", not elaborating on why: do <link href=""> tags go in <head> tag? "validity&

ElasticSearch has_parent query -

i experimenting elasticsearch parent/child simple examples fun-with-elasticsearch-s-children-and-nested-documents/ . able query child elements running query in blog curl -xpost localhost:9200/authors/bare_author/_search -d '{ however, not tweak example has_parent query. can please point doing wrong, keep getting 0 results. this tried #returns 0 hits curl -xpost localhost:9200/authors/book/_search -d '{ "query": { "has_parent": { "type": "bare_author", "query" : { "filtered": { "query": { "match_all": {}}, "filter" : {"term": { "name": "alastair reynolds"}} } } } } }' #did not work either curl -xpost localhost:9200/authors/book/_search -d '{ "query": { "has_parent" : { "type" : "bare_author",

Add DATE and TIME to RSS FEED - Android -

i have rss feed 3 tabs, every tab fetches rss link. rss working want add date , time below every feed in part of picturelink , , make picturelink . can me please. here full code: rsstabsactivity.java public class rsstabsactivity extends tabactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_rss_tabs); tabhost tabhost = gettabhost(); intent artintent = new intent().setclass(this, rsschannelactivity.class); artintent.putextra("rss-url", "http://www1.up.edu.ph/index.php/feed/"); string arttabname = getresources().getstring(r.string.tab_art); tabspec arttabspec = tabhost.newtabspec(arttabname) .setindicator(arttabname, getresources().getdrawable(r.drawable.rss_tab_art)) .setcontent(artintent); tabhost.addtab(arttabspec); intent techintent = new intent().setclass(this, rsschannelactivity.class); techintent.putextra("rss-

pug - CompoundJS and Jade templates -

i'm using "jade" view engine compoundjs, doesn't use proper jade workflow when call render() method within controller (e.g. rendering same layout, yielding inner template body parameter of layout). i need know how either: change layout controller (its using application_layout.jade) , able render without layout render views normally, have layout specified within view template (e.g. specifying explicitly template i'm extending, jade directive "extend layout") you can override application_layout own. convention-based. for example, if want override login view different layout, add new template app/views/layouts/login_layout.ejs . the inner template specified <%- body %> . <!-- different markup before --> <%- body --> <!-- different markup after -->

javascript - Why view doesn't listen model events -

i have basic model such as: define(['backbone', 'relational'], function(backbone, relational) { var resultentitymodel = backbone.relationalmodel.extend({ defaults : { bgoccurence : "", fgoccurence : "", }, initialize : function() { var bgoccurence = this.set("bgoccurence",this.get("bgoccurence")); var fgoccurence = this.set("fgoccurence",this.get("fgoccurence")); } }); return resultentitymodel; }); and view: define(['marionette', 'js/models/result/result.entity.model', 'text!templates/result/result.entity.panel.html'], function(marionette, resultentitymodel, resultentitypanel) { var resultentityview = marionette.compositeview.extend({ tagname : "tr", template : resultentitypanel,

cdbl in crystal reports is giving wrong results in decimal points -

friends, this formula in crystal reports 9. cdbl({nrconsolidated.collamt})/100000.000 nrconsolidated table having 9 records. in 1 record's collamt value 154250. but in crystal reports output showing 1.543 instead of 1.542. want 3 decimal points.i dont know mistake coming from? in crystal reports, clicked on collamt field , checked data seeing browsedata option...its showing 154250. how can solve issue? showing correct value in 4 decimal points want 3 decimal points. thanks the below code truncate result after calculation has been performed, , output 3 decimal places. works crystal syntax , should basic - believe common amongst both. truncate(cdbl({nrconsolidated.collamt})/100000.000,3) on field set decimals 1.000 , rounding 0.001 display want.

silverlight - "Entity does not have a key defined" error in working production code -

we running odd problem: using entity framework 4 , ria services silverlight 5 appliation hosted in iis 6.1. long periods of time, running smoothly, application fails following error message in event log: webhost failed process request. sender information: system.servicemodel.activation.hostedhttprequestasyncresult/56703158 exception: system.servicemodel.serviceactivationexception: service '/services/ecofleet-domainservices-repository-ecofleetrepository.svc' cannot activated due exception during compilation. exception message is: entity 'devicedata' in domainservice 'ecofleetrepository' not have key defined. entity types exposed domainservice operations must have @ least 1 public property marked keyattribute.. ---> system.invalidoperationexception: entity 'devicedata' in domainservice 'ecofleetrepository' not have key defined. entity types exposed domainservice operations must have @ least 1 public property mar

php - how to return an array with like keyword on codeigniter's active record -

i want perform query wth active records : select * tablename status = 'a' , name 'test' and want return array because want encode json later, need use result_array(); so tried : $query = $this->db->select('*')->from('tablename')->where('status', 'a'); $query->like('name', 'test')->get()->result_array(); return $query; but got message when tried encode json : type unsupported, encoded null what should do? help. try this: $data = array(); $rs = $this->db->where('status', 'a')->like('name', 'test')->get('tablename'); if($rs->num_rows()> 0){ $data = $rs->result_array(); } return $data;

Detect webview in Android with Javascript -

there app on google play embedding website in webview. app nothing else, , includes 3rd party monetization feature. i want detect when users accessing site via app, can show message. i haven't been able find way distinguish between android mobile browser , app, user agents same. is there known method detect webview? thanks. unfortunately, answer no, there isn't way distinguish between android mobile browser , webview-based app. unless app developer elects modify user agent, of course.

How can i resolve the Exception in thread "main" java.lang.NoSuchMethodError: main -

i have code. eclipse tells me syntax correct when run program gives me error: exception in thread "main" java.lang.nosuchmethoderror: main what's wrong? import java.awt.color; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.jbutton; import javax.swing.jframe; import javax.swing.jpanel; public class main extends jframe { private static final long serialversionuid = 1l; public void main(string[] args){ jframe main = new jframe("test"); main.setsize(600, 600); main.setlocationrelativeto(null); main.setvisible(true); main.setdefaultcloseoperation(jframe.exit_on_close); //adding jpanel jpanel panel = new jpanel(); main.add(panel); //jpanel settings panel.setlayout(null); panel.setbackground(color.green); //adding jbutton jbutton button = new jbutton("button 1"); jbutton button2 = new jbutton("