Posts

Showing posts from February, 2014

python - imshow() function not working -

i'm working on program in python packages numpy,scipy , matplotlib.pyplot. code: import matplotlib.pyplot plt scipy import misc im=misc.imread("photosafteraverage/exampleafteraverage1.jpg") plt.imshow(im, cmap=plt.cm.gray) for reason image isn't showing (checked if got image, in part it's fine- can print array.). you need call plt.show() display image. or use ipython --pylab interactive shell matplotlib aware.

c++ - use of boost::ref for passing reference to functions that take values -

i confused use of boost::ref. dont understand why 1 want following - void f(int x) { cout << x<<endl; x++; } int main(int argc, char *argv[]) { int aaa=2; f(boost::ref(aaa)); cout << aaa<<endl; exit(0); } what use of passing ref function. can pass value instead. not ref passed. in above value of aaa in main remains 2 only. where boost ref useful? is possible use boost::ref in scenario. want pass iterator refernce std::sort function. sort works on iterator copies - boost::ref make work references also? (without changes std::sort) i dont understand why 1 want following they wouldn't. that's not boost::ref (or these days std::ref ) for. if function takes argument value, there's no way force take reference instead. where boost ref useful? it can used make function template act if takes argument reference, instantiating template reference (wrapper) type, rather value type: template <typen...

javascript - Using window.open, document.open, and document.write to display XML (XML rendering gone) -

this related question, not duplicate. deals proposed solution have reached impasse. i have following code reads xml, makes changes, opens window, , writes xml document. problem content not rendered xml. way set content type, etc, have browser handle content xml? <script> var wxml; var xdoc; var xdevices, xinputs; var xdevice, xinput; function fsetxmlainput(idevice, inode, nodenewval) { xinput = xinputs[inode]; xvalue = xinput.getelementsbytagname("value")[0]; // change node value: // console.log("nodeval: " + xvalue.firstchild.nodevalue); xvalue.firstchild.nodevalue = nodenewval; // console.log("newval: " + xvalue.firstchild.nodevalue); } function fsetxmldevice(idevice) { xdevice = xdevices[idevice]; xinputs = xdevice.getelementsbytagname("input"); fsetxmlainput(idevice, 0, "22"); fsetxmlainput(idevice, 1, "33"); } function ...

c# - Binding to a drawingVisual element -

how can set binding dependency property belongs drawingvisual element in code ? for dependency property belongs frameworkelement have called elem.setbinding(...) not have function in drawingvisual class. the frameworkelement class , frameworkcontentelement class both expose setbinding method. drawingvisual not inherit either of these not have method. from msdn : drawingvisual lightweight drawing class used render shapes, images, or text. class considered lightweight because not provide layout, input, focus, or event handling, improves performance. reason, drawings ideal backgrounds , clip art. so intentionally (no event handling), keep fast.

opengl es - Multiple Shaders-Single Program or If-else conditions via a uniform variable? -

i want ask simple question opengl es 2.x (or think valid of recent opengl releases). which 1 of following faster? : attaching/detaching multiple shaders depending on draw, having uniform variable checking rendering mode; result of going have bunch of if-else conditions(or i.e. switch-case block). know no gpu cores; may assume render same group of primitives subsequently; i.e. not switch 1 mode frequently. if may explain pros/cons of each solution; appreciated. third solution welcome. that depends on volume of data compute, whenever fragment processing bound , many more things. as rule of thumb, changing states should avoided when possible trigger pipeline flush. make thinks worse, changing uniform may trigger pipeline flush. if not using shaders throughput try conditional. edit: if reorder data there small amount of state changes should ok change shader , allow output more fragments. again, depends on bottleneck. tip: measure.

json - Android - ImageView from URL won't fill_parent in ListView -

i have json, parsing json. results text , image in listview. works fine except 1 thing. trying imageview fill_parent width , wrap_content height. doesn't work.. this layout: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <textview android:id="@+id/id" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:text="large text" android:textappearance="?android:attr/textappearancelarge" /> <textview android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_below="@+id/id" andr...

php - Opencart enabling SEO url leads to 404 error -

i'm using opencart version 1.5.5.1 our website. when enable seo in admin section urls lead 404. site url https://www.domain.com/dev/ . .htaccess file content follows: # 1.to use url alias need running apache mod_rewrite enabled. # 2. in opencart directory rename htaccess.txt .htaccess. # support issues please visit: http://www.opencart.com options +followsymlinks # prevent directoy listing options -indexes # prevent direct access files <filesmatch "\.(tpl|ini|log)"> order deny,allow deny </filesmatch> # seo url settings rewriteengine on # if opencart installation not run on main web folder make sure folder run in ie. / becomes /shop/ rewritebase /dev/ rewriterule ^sitemap.xml$ index.php?route=feed/google_sitemap [l] rewriterule ^googlebase.xml$ index.php?route=feed/google_base [l] rewriterule ^download/(.*) /index.php?route=error/not_found [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_uri...

javascript - How can I prevent the page scrolling when I have scrolled to the bottom of a div inside it? -

this question has answer here: prevent scrolling of parent element? 27 answers i've got several divs on page this: <div style="height:200px; overflow:auto;"> <div style="height:300px;"> <!--lots of text here--> </div> </div> when user hovers on them , scrolls scroll wheel scroll fine. trouble that, when user reaches bottom, page starts scrolling instead. is there way stop happening (using javascript if necessary), focus stays on div when has scrolled bottom , page scrolls when user not hovered on div? check demo : http://jsfiddle.net/zugkw/1/ code: // bind mousewheel event $('.mydiv').bind('mousewheel', function(e) { // if scroll direction down , there nothing more scroll if(e.originalevent.wheeldelta < 0 && ($(this).scrolltop() + $(this).h...

php - How to open a smoothbox iFrame popup, on button cick,for a dynamic url -

we can open smoothbox popup link static url this <a id ="join-request" href="<?php echo $this->baseurl() ?>/register/selected_groups/test?>tb_iframe=true" class="smoothbox"> click me </a> but how can in button click ? chek this demo if buttons different url php use this: html <button class="smoothbox" url="one<?php echo $this->baseurl() ?>/register/selected_groups/test?>tb_iframe=true">click me - one</button> <button class="smoothbox" url='two<?php echo $this->baseurl() ?>/register/selected_groups/test?>tb_iframe=true'>click me - two</button> script window.addevent("domready", function (e) { document.getelements(".smoothbox").addevent("click", function (e) { $('test_result').innerhtml = e.target.innerhtml + '</br >url is: ' + e.target.getproperty('url...

java - Android Adding DATE (now) to SQLite database -

currently sqlite database working great, have read on various methods such this one achieve this, though having issues setting date constructor , how define data use in putting database (and getting back!) so far have used static final string define data variables, notsure correct way use date. i'm not concerned time, date entry created. below java class: import java.sql.date; import java.text.simpledateformat; import android.content.contentvalues; import android.content.context; import android.database.cursor; import android.database.sqlexception; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteopenhelper; public class stats { public static final string key_rowid = "_id"; public static final string key_weight = "weight"; public static final string key_waist = "waist"; public static final string key_chest = "chest"; public static final string key_legs = "legs"; ...

Azure and classic asp - showing detailed error messages -

i moved site classic asp azure (website), , having trouble getting detailed error messages - receiving "an error occurred on server when processing url. please contact system administrator. if system administrator please click here find out more error." i've added httperrors errormode="detailed" web.xml not seem help. i've set http://azure.dollarkurs.no can see yourselves. need help! :) classic asp website on azure "the page cannot displayed because internal server error has occurred." this should sort out.

triggers - Initiate a jQuery plugin on multiple elements. Click triggered multiple times -

i have written simple jquery plugin slice ul or ol elements on client side witnessing strange behaviour while initiating on multiple elements. plugin hides items in list , show specified number of items. appends more/less link list user can toggle items. following code plugin. /** * jquery list slice v1.0 * * slices list ('ul', 'ol') , shows more/less link either show more * or less 'li's respectively. * * @usage: * list following: * * <ul id="sample-list"> * <li>item 1</li> * <li>item 2</li> * <li>item 3</li> * </ul> * * initiate slicelist follows: * * $('ul.sample-list').listslice({ * default_items: 2, // set other options here * }); */ (function($) { $.fn.listslice = function(options) { // merge or override user defined options options = $.extend({}, $.fn.listslice.options, options...

jquery - Opening a URL in iframe with Fancybox -

Image
i using fancybox first time , trying use click on link, webpage pops in fancybox @ position scrolled down in new webpage. for example: i've been testing out below code, iframe ends jumping bottom of page first, top right: <html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript" src="fancybox/jquery.fancybox.js"></script> <script type="text/javascript" src="fancybox/jquery.fancybox.pack.js"></script> <link type="text/css" rel="stylesheet" href="/fancybox/jquery.fancybox.css" > <script type="text/javascript"> $(document).ready(function() { $(".iframe").fancybox({ "padding" : 3, "type":"iframe", "width" : 640, "heig...

How to add "info" and "help" tab to my Android application? -

Image
i need add "info" , "help" buttons when clicking on "settings" application,how? read similar questions couldn't understand, not expert in programing best. heres screen shot trying : this looks standard options menu android. here doc how set up. note if want them there time, use linear layout, 2 image buttons

Javascript regex to match fully qualified domain name, without protocol, optional subdomain -

i haven't been able find 1 , i'm trying isn't quite working out me. i want match domains that: don't contain protocol (http, https, ftp) optionally include subdomain don't start hyphen can contain hyphen example domains match: domain.com example.domain.com example.domain-hyphen.com www.domain.com example.museum example domains not match: http://example.com subdomain.-example.com example.com/parameter example.com?anything www.subdomain.domain.com what i've got: /^(?!:\/\/)(^[a-za-z0-9])?.[a-za-z0-9-]+\.[a-za-z]{2,6}?$/i it's not matching protocols, allowing hyphen inside domain, not allowing trailing characters after tld, , allowing subdomain (but 1 character). i still need allow subdomains of length, not allow www.subdomain.domain.com , not allow leading hyphen. try /^(?!:\/\/)([a-za-z0-9]+\.)?[a-za-z0-9][a-za-z0-9-]+\.[a-za-z]{2,6}?$/i

android - How to make seekbar like this -

Image
i want apply effect seekbar shown below: download it... what have tried below. the complete code below try , let me know if effect below. mainactivity.java public class mainactivity extends activity { private static int myprogress=0; private seekbar seekbar; private int progressstatus=0; private handler myhandler=new handler(); @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.h_processbar); } public void beginyourtask(view view) { myprogress=0; seekbar= (seekbar)findviewbyid(r.id.seekbar); seekbar.setmax(100); new thread(new runnable() { @override public void run() { // todo auto-generated method stub while(progressstatus<100) { progressstatus=performtask(); myhandler.post(new runnable() { public void run() { seekbar.setprogress(pr...

Installing Android SDK Manager in Eclipse -

Image
i'm trying install sdk in eclipse gives me following screen does know why , how solve issue? in advance. close eclipse , explorer (probably directory explorer) , click yes.

python - Django - get the last object of a model with many objects -

i have 2 models. father , son model. , relationship in son model is: father = models.foreignkey(father, related_name="father") now in real database, have 5 fathers, each father has 5 sons. want find sons age 20. father = father.objects.all() #how find sons age 20? your title doesn't quite match question , question missing information. but, want? fathers = fathers.objects.all() sons = son.objects.filter(father__in=fathers, age=20) but, assuming sons have fathers, write as sons = son.objects.filter(age=20) if looking sons age 20 1 father: father = fathers.objects.get(id=101) sons = son.objects.filter(father=father, age=20) this assumes have different model father , son (which not design decision understand question).

How to get Enum object by value in C#? -

i encountered case when needed enum object value (to saved via ef codefirst), , here enum : public enum shipmentstatus { new = 0, shipped = 1, canceled = 2 } so needed shipmentstatus.shipped object value 1 . so how accomplish that? why not use build in feature? shipmentstatus shipped = (shipmentstatus)system.enum.getvalues(typeof(shipmentstatus)).getvalue(1);

sql - How to limit the maximum display length of a column in PostgreSQL -

i using postgresql, , have column in table contains long text. want select column in query, limit display length. something like: select longcolumn (only 10 chars) mytable; how this? what can use postgresql's substring() method. either 1 of 2 commands below work: select substring(longcolumn 10) mytable; select substring(longcolumn 1 10) mytable;

spring data jpa - JPA: do i have to fetch all OneToMany relation list in order to add new relation -

lets have entity , has list of b mark onetomany. have fetch of b items in order add new b item list has? example: @entity public class { @id long id; @onetomany list<b> bs; } do have fetch of a.bs in order add new item bs ? thanks alon edit few more questions: @german: interesting! few questions what if join between , b table c? same behavior? why list make troubles? what can use instead of list? set? if persist overwrite links b? what if link manytomany (using table) you have add b a's bs list. happens though provider specific. providers eclipselink can avoid fetching list operations on lazy loaded lists when change tracking enabled

c++ - Memory Deallocating freezes my program -

this not problem, question want answered. i'm making 2d application has particles. in click handler i've written code: particle *tempp = new particle(); tempp->setposition(mx, my); particles.push_back(tempp); // typeof particles = std::list<particle*> delete tempp; // <- line problem when click, 1 particle created @ mouse position. after 1 second should disappears, works fine. after it's disappeared can click again create new particle. however, when click while there still 1 particle on screen, program freezes , stops working. my destructor of particle class , it's parent's destructor both empty. without calling delete program runs fine, multiple particles @ once, or multiple per frame. wondering causing freezing issue. based on posted code, particles container contain dangling pointers. attempt dereference these undefined behaviour. assuming later being used, otherwise storage of them seems pointless. calling push_back() ...

xslt - XSL - Display XML tags based on parameter from PHP -

ive got problem displaying desired xml tags based on parameter. i'm new this. xml example: <car name="toyota"> <model nr="123" yeardate="2010"> <owner ssn="123456789" name="tom"/> <owned years="0" months="6"/> </model> </car> <car name="volvo"> <model nr="222" yeardate="2009"> <owner ssn="345364774" name="john"/> <owned years="0" months="8"/> </model> </car> <car name="fiat"> <model nr="333" yeardate="2010"> <owned years="0" months="0"/> </model> </car> the problem want able choose car displayed based on html form made in php document. so, made form in php, sent value of post xsl document , want display car based on parameter value. also,...

r - How to suppress stargazer() information in output file -

i'm using stargazer package output r dataframe latex code: library(stargazer) stargazer(mtcars) and output % table created stargazer v.3.0.1 marek hlavac, harvard university. e-mail: hlavac @ fas.harvard.edu % date , time: thu, may 09, 2013 - 16:14:28 \begin{table}[htb] \centering \caption{} \label{} \footnotesize \begin{tabular}{@{\extracolsep{5pt}}l c c c c c } \\[-1.8ex]\hline \hline \\[-1.8ex] statistic & \multicolumn{1}{c}{n} & \multicolumn{1}{c}{mean} & \multicolumn{1}{c}{st. dev.} & \multicolumn{1}{c}{min} & \multicolumn{1}{c}{max} \\ \hline \\[-1.8ex] mpg & 32 & 20.091 & 6.027 & 10.400 & 33.900 \\ cyl & 32 & 6.188 & 1.786 & 4 & 8 \\ disp & 32 & 230.722 & 123.939 & 71.100 & 472.000 \\ hp & 32 & 146.688 & 68.563 & 52 & 335 \\ drat & 32 & 3.597 & 0.535 & 2.760 & 4.930 \\ wt & 32 & 3.217 & 0.978 & 1.513 & 5.42...

sql server 2008 - Simple T-SQL function to convert date to displayable format -

i have strange bug cannot resolve (with 1 line function). this code works: declare @testdate datetime = '2013-05-01 23:15:11' select isnull(convert(varchar(max), @testdate, 120), 'null') 'test1' displays: 2013-05-01 23:15:11 create function [dbo].[dateornulltochar] (@inputdate date) returns varchar(40) begin return isnull(convert(varchar(40),@inputdate, 120),'null'); end select dbo.dateornulltochar('2013-05-01 23:15:11') 'result' returns: 2013-05-01 (no time) i have tried varchar(max) . the purpose of function this: set @errormessage = ' @arrivaldate=' + dbo.dateornulltochar(@arrivaldate) + ' @departuredate=' + dbo.dateornulltochar(@departuredate); if 1 value null, whole value becomes null. want see string 'null' when date has null value. @inputdate should datetime or datetime2 if want time shown the clues in code... @testdate datetime @inputdate d...

3d - How to build PCL project -

i´ve been trying run 1 of point cloud library examples shown ( http://pointclouds.org/documentation/tutorials/using_pcl_pcl_config.php#using-pcl-pcl-config ) in pcl website whole morning , still can´t make run! this did: i´ve installed point cloud library pcl 1.6.0 all-in-one installer msvs 2010 (64 bit) in computer, then, installed couple of libraries found needed (boost , eigen). after, have added dependencies , libraries needed in ms visual studio 2010 (plc, boost , eigen) , i´m still getting these annoying errors: (i´ve tried using cmake gui windows reports lot of errors when generating project) 1>pcl.obj : error lnk2019: unresolved external symbol "void __cdecl pcl::console::print(enum pcl::console::verbosity_level,char const *,...)" (?print@console@pcl@@yaxw4verbosity_level@12@pbdzz) referenced in function _main 1>pcl.obj : error lnk2001: unresolved external symbol "public: virtual int __thiscall pcl::pcdreader::readheader(class std::basic_...

css - JavaScript function won't load html pages -

i have been struggling 2 days. javascript should load home.html page upon load , other pages when links clicked. home page won't load. doesn't make sense me why nothing loading. can see mistake is? javascript: $(document).ready(function(){ setorientationlistener(); changepage('home.html?v=1'); $('nav a').on('click', function(){ $('nav a').removeclass('selected'); $(this).addclass('selected'); }) }); function changepage(filename){ $('.content_container').animate({opacity:0}, 500, function(){ $('.content_loading_container').load('assets/content/'+filename, function(){ $('.content_container').delay(250).animate({opacity:1}, 500); }); }); } css: /* global styles */ body { margin: 0px; padding: 0px; font-family: helvetica; font-size: 16px; background- color: #ddd;} /* global layout */ header { display: blo...

android - Device press/touch with monkeyrunner on DroidBox don't work -

i'm using monkeyrunner script works on droidbox23, script cames default in droidbox program, in folder scripts/, modificated way: import re import sys import os import time com.android.monkeyrunner import monkeyrunner, monkeydevice device = monkeyrunner.waitforconnection() device.installpackage(sys.argv[1]) package = sys.argv[2] activity = sys.argv[3] # sets name of component start runcomponent = package + '/' + activity print "running: " + runcomponent # runs component device.startactivity(component=runcomponent) time.sleep(5) # takes screenshot print "taking snapshot" result = device.takesnapshot() # writes screenshot file result.writetofile('shot1.png','png') print 'pulsamos' device.press("dpad_up", 'down_and_up') print 'pulsado' device.touch(60,350, 'down_and_up') when executes device.pr...

powershell - Is there a method to determine if a System.IO.StreamWriter object is open? -

im trying determine if streamwriter object open or closed in script. if it's not closed, can write new line file. if closed, need perform other actions.... how can verify if stream still open? example test script. $stream = [system.io.streamwriter] "c:\testing.txt" $stream.writeline("test") $stream.close() if($stream)){ #stream still open, write new line $stream.writeline("stream still open. write.") $stream.close() }else( #stream not open... end script, send reponse. } you can check if basestream exists streamwriter -object. this: if($stream.basestream)){ #stream open } example: $sw = new-object system.io.streamwriter "c:\test.txt" ps > $sw | fl * autoflush : false basestream : system.io.filestream encoding : system.text.utf8encoding formatprovider : nb-no newline : ps > if($sw.basestream) { "yes" } yes ps > $sw.close() ps > if($sw.basestream...

c# - Using observablecollection with buttons -

i have observablecollection create buttons problem each of these buttons call same event handler. trying make each button has own unique id can distinguished 1 another. code used create button elements is public class button { public bool isempty { get; set; } public int id {get; set;} public button(int button_number) { isempty = true; id = button_number; } } i added observablecollection in following code buttoncollection = new observablecollection<cchipvm>(); ( int = 0 ; < inumchips ; ++i ) { buttoncollection.add( new button(i) ); } the xml button following <datatemplate x:key="buttontemplate"> <button x:name="button" uid="{binding path=id}" click="button_click" borderbrush="black" borderthickness="1" margin="7" width="25" height="25" clickmode="press" opacity=...

ios - Category for simplified NSLogging of BOOLs -

i trying create code, this. nslogbool(self.propertyname) and output in debugger console be "propertyname set yes." any hints @ how could achieve that, , code not depend on particular class, i.e. have function usable class? if need decoupled particular class, using preprocessor , c best bet. should work fine. #define nsboollog(x) cfilogboolean(#x, x) extern void cfilogboolean(char *propertyname, bool val); void cfilogboolean(char *propname, bool val) { printf("%s set %s", propname, (val ? "yes" : "no")); } as long extern declaration put header (possibly utility header, or common set of typedefs, etc.) that's visible compilation units, can used freely without having rely on class.

linux - Set Up I2C Address Without Device Attached -

i've been trying learn i2c today, it's taken me time set i've got raspberry pi configured i2c-tools installed , can see /dev/i2c-0 . however when run i2cdetect -y 0 empty address table. makes sense don't have device connected i2c bus. able write i2c pins , observe output using oscilloscope or connect led can see state changes. is possible, , if how go it? in advance. provided have set correctly, should see on scope while i2cdetect scans i2c bus available devices. i2c built such nack after writing i2c-address if try talk address doesn't exist on bus. how i2cdetect knows device of specific address doesn't exist on bus. can't see actual data transactions without having device on bus. see i2c user manual. i suggest attach simple i2c device such rtc (like ds3231m or ds3232m) or temperature sensor on i2c bus , try interfacing them see actual i2c transaction. another method (which use) have microcontroller known-good i2c-slave implementati...

json - Using 'Ajax updated' dataset with crossfilter -

i have large dataset (about 500 000 records...) co2 emission on london want display maps , charts using crossfilter. reasons of performance, want queries beforehand boroughs, i've done ajax function dynamically when click on borough (just imagine map of london borough boundaries can click on them). ajax code works fine : function load_data(str){ var londondata = null; $.ajax({ url: "php/london-data.php", data: "name='"+str+"'", type: 'get', async: false, success: function(data) { londondata = data; } }); alert(json.stringify(londondata)); return londondata;} it returns json file. when click on borough, alert function shows me data updated. use crossfilter, wanted have global variable updates when click on borough, load_data function, doesn't work -> variable keeps same value initialized. i don't know if i'm clear enough think there solution upd...

.net - 2 methods in Web Service, one works, one returns with 400 Bad Request -

i have 2 methods in svc web service, 1 takes no arguments , returns active directory users. 1 works. have method receives user id , returns of groups member of. 1 fails "400 (bad request)" on our beta site, works identical code , calling methods on local development box. have used fiddler ensure json being sent web service correct in both instances. both environments sharepoint. i have checked authentication providers sites both in beta , dev environment , identical. what causing this? when utilizing ajax, not internal server error 500 message. if you're sure of inputs (no ampersand in parameters, etc) , other methods not yielding errors, code crashing in method returning 400 (bad request). it turns out there security issue on beta server not return user principal unless specifying super user able see domain accounts, domain , password. there no check null on user principal object before attempting use properties, , throwing internal server error. ...

android - How to create layout with 6 buttons like windows tiles -

Image
i'm trying create layout 6 buttons automatically adapt screen size tiles of windows phone. in code create dynamically 6 button, 2 line button should fit size of screen filling latter. how can proceed? <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <linearlayout android:layout_width="match_parent" android:layout_height="0dip" android:orientation="horizontal" android:weightsum="2" > <button android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="1" android:background="@drawable/conv_up" /> <button android:layout_width="0dip" ...

javascript - Main div not scaling properly with dynamic content -

i have html table thats inside div inside div. <div id='mainholder'> <div id='primarycontent'> <table>moar content</table> </div> <div id='secondarycontent'></div> </div> the problem have right 'mainholder' not scale when dynamically add content in table. 'primarycontent' div scale properly. here link complete solution. here thanks reply :) demo : http://jsfiddle.net/g2msh/6/ .container:after { clear:both; content: "."; display:block; height: 0; visibility: hidden; }

java - Reclaim first reference of Immutable String -

i see many q&a immutable string saying jvm create new reference when following: string text = "apple"; text = "orange"; // new reference created my question is, happen previous reference "apple"? since java garbage collection automatic, means there no intentional way re-claim memory? edit: reason asking question know how should handle string variables in future. does string literals cleared gc? if not, wouldn't pool going huge until point goes out of memory? considering if program receives different string values textbox on ui, each different values user enters going add on pool. there no way intentionally reclaim memory system.gc() (which suggestion jvm). even when garbage collection runs, "apple" won't reclaimed. according jls 3.10.5 , string literals interned in string pool and never garbage collected . quoting: a string literal reference instance of class string (§4.3.1, §4.3.3). moreover, string...

c# - How to make a BaseUserControl meant for inheritance -

i need create baseusercontrol has custom code behind , inherits usercontrol, used parrentclass for, used, usercontrols. have read numerous articles can not work. baseusercontrol not supossed have design elements purely custom stuff references used in other usercontrols inherit it, design element apriciated. require more baseusecontrols exstensions out of question. baseusercontrol in 1 project, , rest inherits in another. 1) tried create class inherits. public class entryusercontrolbase:usercontrol { public entryusercontrolbase() { } } 2) inheriting usercontrol <usercontrol x:class="spis_base.entryusercontrolbase" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" ...

Security concerns for Ajax using chrome inspect -

i making 1 website in form submitted using jquery ajax. have taken care of of security majors https, session cookie, encryption etc. hence have minimised possibility of outside person sniffing or modify data transfer. but there can valid registered user wants play havoc using chrome inspect element. can example create loop in calls jquery ajax post call. can possible? how can avoid this? unable find better alternative & resort once again basic form post instead of ajax. thanks. anything present client side can messed with. user able modify front end code, , want it. why need server side validation. if worried repeating post call, sounds worried dos attack guess? your server configuration should set detect frequent requests same user , deny service it.

apache - Redirect/htaccess without folder name -

i have simple issue in redirecting web site folder link. have main domain , lets abc.com , have subdomain xyz.com. have xyz.com in document root folder of abc.com , folder name othersite. works perfect, when type manually in browser www.xyz.com/hero , takes m tot hat directory url changes in browser , shows me www.xyz.com/othersite/hero. not sure why doing so, works when type www.xyz.com/hero/ , i.e. / @ end. here have in main htaccess in abc.com htaccess rewriteengine on options +followsymlinks rewritebase / rewritecond %{http_host} ^xyz\.com$ [or] rewritecond %{http_host} ^www\.xyz\.com$ rewritecond %{request_uri} !^/othersite/ rewriterule ^(.*)$ othersite/$1 this because mod_dir turned on , automatically redirect requests directories missing trailing slash include trailing slash. there's information disclosure security risk when don't this: turning off trailing slash redirect may result in information disclosure. consider situation mod_autoindex ac...

facebook sdk php post to users wall -

okay, have app user can input text text area, , when click submit, translated , displayed different text area. second text area have button allow them pot own wall though normal status update. i beginner facebook sdk , php, , had on google , on here, seemed not fit required. if can or point me in right direction appreciated. i believe have correct permissions publish_stream many in advance

sql - Copy a column from one table into another table -

i have tried alter table create column followed insert into . kind of works, except each subsequent column starts after previous column has ended. guess how insert works, there workaround or query can build? i have been trying updates not working out. reference, these alter/insert queries used. sql = "alter table [results] add column [" & fld.name & "_result] text(25)" db.execute sql sql = "insert [results] ([" & fld.name & "_result]) select [result] [" & fld.name & "_result] [newtable]" db.execute sql your insert statement assumes results table has 1 column need insert data into. unlikely true, if table had other columns before executed add column. you need keep track of columns in results table, , provide data (or default value) each column. it rather unusual expand table's structure inside application. trying accomplish? sure can't accomplish better defining fixed tables ,...

jquery - Using ajax with jQM and seeing duplicate POSTs -

i'm noticing ajax being called several times resulting in duplicate entries in mysql. what's deal? can see in code? $("#form-addcomment").live('submit', function(e) { e.preventdefault(); var values = $(this).serializearray(); values = $.param(values); $.ajax({ type: "post", url: "/components/m/actions/index.php", data: "command=comments_add&" + values, datatype: "html", success: function(data){ alert(data); return false; } }); return false; }); you having problems multiple event binding, should fix problem: $(document).off('submit', "#form-addcomment").on('submit', "#form-addcomment" ,function(e) { e.preventdefault(); var values = $(this).serializearray(); values = $.param(values); $.ajax({ type: "post", url: "/com...

php - web application custom url dev? -

i'm in stage of planning web application , i'm wanting allow user create custom url profile page, i've seen on soundcloud user clicks title , textbox appears user can change url his/her liking (am assuming jquery validation goes on @ point). haven't been able find online regarding (unless called something). can point me in right direction or tell me url management dealt via database or .htaccess? completely stumped looks wicked ahead if can help. it's not way it, use framework, if put framework name here generate discussion, so, that's my logic: webserver > check file existence rewritecond on apache, try_files on nginx '-- file exists > ignore '-- file doesn't exist pass request router file '-- check > check if it's system request, '/register' '-- match > process request '-- doesn't match > validate possible username '-- valid username ...

security - New WebStart Behavior with Java 7 Update 21 -

Image
i’ve been working on off , on couple of weeks , non-stop since yesterday couple of developers. opening discussion in hopes has ideas. we have eclipse rcp application launched via webstart. we’ve been running on java 7 update 17 , prompt saw when launching our application "do want run application". with upgrade java 7 update 21, seeing install java extension, want install thie following software? 14 times different jar files. based on website http://java.com/en/download/help/appsecuritydialogs.xml#trusted java application prompts include these images present lower risk. the java logo or publishers logo represents application identified valid certificate trusted certificate authority (ca). blue information shield indicates application can identified valid certificate , more information available. i tried clicking “more information” has no effect. know why i’m seeing these additional dialogs , how stop behavior? any appreciated. due securit...

php - fatal error: Uncaught exception 'DOMPDF_Exception' with message 'Box property calculation requires containing block width' -

when try process url http://www.bbc.co.uk/ dompdf throws error fatal error: uncaught exception 'dompdf_exception' message 'box property calculation requires containing block width' in www\dompdf\include\block_frame_reflower.cls.php on line 171 it seems settings or bug? dompdf_exception extension of exception class. i'm not sure parameters spit out, can dump array out see being returned: try{ }catch(dompdf_exception $e){ echo '<pre>',print_r($e),'</pre>'; } also found on google code might narrow down, actual issue is: http://code.google.com/p/dompdf/issues/detail?id=244

javascript - Solving API Performance Issues with Cross Domain Ajax -

i'm in process of building out infrastructure support gaming platform intend scale out hundreds of thousands of users. since in entertainment / gaming industry, expecting heavy load each user session, therefore, performance of upmost importance. we trying parallelize of architecture possible, meaning api, databases, , applications run off of different servers can horizontally scaled. 1 of applications web app, , we're having trouble due specific scenario involving same origin policy on legacy browsers. this application running in web browser need speedy access models available through centralized api. while great our dedicated mobile clients, browsers unfortunately need cors support interface directly our api. problematic because of http verbs not supported on browsers (put / delete). our known workarounds are, rewrite api create more abstraction (we believe not best practice , increase development time , potentially performance) , work post using jsonp or create proxy ...