Posts

Showing posts from July, 2014

java - JasperReports accessing to property javabeans -

i´m studying jasperreports , want access property subclass example report.persona.name jasperreport show me error: net.sf.jasperreports.engine.jrexception: error retrieving field value bean : name caused by: java.lang.nosuchmethodexception: unknown property 'name' on class 'class com.test.dto.report' i´m trying accessing show other errors. i have 3 dto class person public class person { private int id; private string name; private string lastname; private string age; ...getter setter ticket public class ticket { private int number; private string typeticket; private string dateticket; ...getter setter and class group both last class report public class report { private person person; private list<ticket> ticket; ...getter setter a main class call collection(report) , send parameter jrbeancollectiondatasource main public class main { public static void main(string[] args) throws filenotfoundex

mysql stored procedure select and update selected -

i trying write stored procedure mysql, , basicly, select 1 id, , update selected id's operationdate. delimiter // create procedure getid( in proc_intervaldate datetime ) begin declare ruserid bigint; select userid ruserid tasks operationdate < proc_intervaldate limit 1 ; update tasks set operationdate = now() userid = ruserid; select ruserid ; end // delimiter ; but when use this, procedure, return userid not update, if comment select ruserid then, updates, no data returns. when use this, procedure, return userid not update, if comment 'select ruserid;' then, updates, no data returns. you can change definition of stored procedure use out parameter rather in . that, can capture out value on same out parameter, in scripting language. meaning need not execute: select ruserid ; in stored procedure. change sp definition below: delimiter // create procedure getid( in proc_intervald

java - Putting Custom View Inside a Custom ScrollView -

i creating android app customized view , customized scrollview . attempting put custom view inside of scroll view. not appear work, receiving blank screen. dashboard.java package com.commentblock.fandoms; import com.commentblock.fandom.r; import com.commentblock.fandom.r.layout; import android.app.activity; import android.content.intent; import android.content.sharedpreferences; import android.os.bundle; import android.view.keyevent; import android.view.menu; import android.view.menuinflater; import android.view.menuitem; import android.view.viewgroup.layoutparams; import android.view.window; import android.widget.linearlayout; import android.widget.scrollview; import android.widget.toast; public class dashboard extends activity { protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); //set content view dashbaord this.requestwindowfeature(window.feature_no_title); this.setcontentview(new statusviewscroll(

c# - Parsing decimal in scientific notation -

i'm bit confused why numberstyles.allowexponent alone not parse decimal in scientific notation. this throws exception: decimal.parse("4.06396113432292e-08", system.globalization.numberstyles.allowexponent) this, however, not: decimal.parse("4.06396113432292e-08", system.globalization.numberstyles.allowexponent | system.globalization.numberstyles.float) i don't see numberstyle.float adds (i didn't understand msdn documentation on it). from msdn : numberstyle.float indicates allowleadingwhite, allowtrailingwhite, allowleadingsign, allowdecimalpoint , , allowexponent styles used. composite number style. if don't allow decimal point, 4.06... won't parse. note numberstyle.float includes allowexponent , don't need specify separately. should work itself: decimal.parse("4.06396113432292e-08", system.globalization.numberstyles.float)

javascript - serving static files on GAE -

this question has answer here: serve static file using app engine 4 answers serving static html in google app engine python 4 answers i'm trying serve test file javascript. test site loading, js isn't loading (if in devloper's console, see there's 404 error -- path right). first tried keeping in root. edited: loki pointed out way wrong i tried keeping in file called static (except yaml file outside) application: test version: 1 runtime: python27 api_version: 1 threadsafe: true handlers: - url: / static_files: static/test.html upload: static/test.html html: <!doctype html public "-//w3c//dtd html 4.01//en"> <html lang="en"> <head> <script type="text/javascript" src="static/script.js"

applescript - How to "touch" (update the date of) files in a selection in Finder? -

one thing lot prepare images posting social media, , want "touch" images (change modification date now) via applescript. script below works fine if want drag files applescript app, want script "touches selected in finder" without being run in "on open" loop. (this can run time keyboard maestro, best tool mac users since multifinder.) every attempt simple set selection, loop through selection, etc. causes errors reason, because finder can't info of file in selection, or something. can possibly suggestion something? the original script on open these_items repeat 1 count of these_items set this_item (item of these_items) set item_info info this_item if folder of item_info true process_folder(this_item) else process_item(this_item) end if end repeat end open -- sub-routine processes folders on process_folder(this_folder) shell script "touch \"" & posi

forms - PHP replacing a line from text file -

i have canvas submitting value hidden field in html document. <form name="hiddenstuff" method="post" onsubmit="return submittodoc()" action=""> <input type="hidden" id="new" value=""> </form> and know proper info being stored in because javascript executes fine: alert(submitinfo); document.getelementbyid('new').value=submitinfo; alert(document.getelementbyid('new').value); document.forms['hiddenstuff'].submit(); this alerts same info twice, know info stored in value. anyways, have following function... not working properly. nothing gets changed in text file. function submittodoc(){ $content=$_post['new']; $filenamechallenge="challenge.txt"; $file_handlechallenge=fopen($filenamechallenge,"rw") or die("file won't open. please contact site administrator."); $matchfound=false; whi

java - how to write hadoop map reduce programs in scala -

i writing map reduce application scala. till map function works fine. while writing reducer facing problem. override def reduce(key: text, values: java.lang.iterable[text], context: reducercontext) { } the reducercontext defined such refers context inner class, fine here. the issue iterable (java) component.i not able iterate through it. understand first have convert scala iterable , iterate on it, did still didnt get result. i have tried both scala.collection.javaconverters._ , javaconversions._ here few scanarios didnt work out val jit: java.util.iterator[text]= values.iterator() val abc = javaconversions.asscalaiterator(jit) /// val abc=jit.asscala println("size "+ abc.size)// displays proper size for(temp <- abc){ ///it dosent come inside loop } similarly have tried converting iterator list/array in vain. once convert list/arrray(tolist/tiarray) size of resulting list/array becomes 0. no matter m not able iterate thorough i ap

c# - Is there a limit to the size of a method that can be used in Windows Phone 8? -

i have working application windows phone 7 trying recreate on windows phone 8. when deploy app attached device (nokia 1020) following error message: deployment optmization failed - “method (s) exceeded maximum size limit”. i'm using vs2013 ultimate windows phone sdk 8.0 (10/30/2012) , sdk 8.0 update 3 emulators package , sdk 8.0 update windows phone 8.0.10322. and works fine when use smaller dataset intended debugging. error occurs when change using 2 small arrays (50 integers , 50 strings) release versions have 101,000 members. while these large , responsible error worked fine in wp7. however, in wp8 deployment optimization - great. so know maximum size limit method? as turns out in windows phone 8, there 256-kb limit on method's common intermediate language size described here . halfway down article describes cil method size , states "app installation succeeded under windows phone os 7.1 may fail under windows phone 8. should affect extremely small numbe

javascript - Saving html document to mysql in php -

this might useless question,i don't know exactly. have form comprising of many fields. whenever user clicks button, want html/php document saved in database along current values entered user. is possible so? if yes, please let me know procedure. for example can take html/php document sign-up forms. you can use jquery solve asking this: $(function() { var document = $("html").html(); console.log(document); }); and post document variable database.

amazon ec2 - Querying instance details long after it is terminated -

in amazon-ec2, instances page shows details of machine ip, size, key-pair, security group, how long has run etc. once instance terminated, line-item stays visible hour. within period, can know details of machine while running. once line item gets removed, there no way know that. say, instances manually instantiated, used time , terminated. after hour of event there no way find out happened. there 1 detailed-bill feature, provides instance-ids , size. interested in key-pair, ip, os, security group , name-of-machine if any. there way find out them? edit i understand can have cron job periodically list instances (and details) , store in database. thing is, host cron process, need machine 24x7. need sort of hook, callback, event. even if not readily available, can such solution made? once instance has been terminated, mentioned, of information available through api before disappears after hour or so. (ip address dns not available since every time stop or terminate

java - Extracting url by specifying a keyword -

i want extract url of facebook page giving keyword. eg if specify keyword "gulab jamun" on facebook can url of page.i tried different ways don't know possible. can me resolving issue.i tried using existing api's restfb , facebook4j think it's not possible through that. can 1 me i think you'll have no success how tried it... regex should passed where? a solution might use search api pages ( https://developers.facebook.com/docs/reference/api/search/#types ), example this: https://graph.facebook.com/search?q=gulab+jamun&type=page&access_token={your_app_access_token} then can filter results page names of interest. url, need request page details per page follows: https://graph.facebook.com/{page_id_from_result}?fields=id,name,link a one-step solution far know not possible.

Github notifications - Mail to PR creator -

if raise pull request , if need notified mail saying -- you have created pull request "bla bla" on "so , so" date. on merge - notification on comment - notification so question is... are there such settings in github sends mail pr creator? can tag myself in pr comment ? any !! are there such settings in github sends mail pr creator? there's no setting in github makes platform work in way. note: can send email support@github.com request such feature. can tag myself in pr comment ? yes, can. won't trigger email sent mailbox however, if you're after keeping track of own activity on github, there may exist alternative: github exposes atoms feeds various endpoints. user 1 of them. register own feed in rss reader , you're done. syntax: https://github.com/{:user}.atom sample: https://github.com/mojombo.atom

Getting error in php header function -

this question has answer here: how fix “headers sent” error in php 11 answers when i'm using php header function i'm getting error this, cannot modify header information - headers sent i know should use ob_start(); @ beginning of code rid error , used nevertheless i'm getting error, please tell me i'm going wrong? code i'm getting error. function insert_charset_header() { header('content-type: text/html; charset=utf-8'); exit; } thanks in advance that should first function before else, check space in code @ end of file: see question/answer: how fix "headers sent" error in php

How to search a string in all HTTP request/response that firebug captures? -

Image
say i've used firebug record many http requests , responses, how can search string in of them? in way, can find string such tag name got changed in context. when you're inside net panel check option response bodies search within bodies of http requests.

c# - Remove duplicate values in list box -

i have list box , bind table position , display column position. inserted 2 values w/ same position in table , list box displays 2 of same values inserted. so, can me display 1 of same value in list box? have code far: private void listbox1_selectedindexchanged(object sender, eventargs e) { try { string select; select = listbox1.selectedvalue.tostring(); datagridview1.datasource = this.maindatabasedataset.tblposition.select("position '%" + select + "%'"); int numrows = datagridview1.rows.count; txtcount.text = convert.tostring(numrows); txtsearchcategory.text = select.tostring(); try { maindatabasedataset.tblcategorizationdatatable getcategorycommand1 = getcategorydata(this.txtsearchcategory.text.trim()); maindatabasedataset.tblcategorizationrow getcategorycommand2 = (maindatabasedataset.tblcatego

.net - How to get executable path of 64 bit process in c#? -

i want executable path of process. use class process executable path of local 32 bit process, , use wmi path of 32 bit process of remote pc. both of path rightly. but, can't path of 64 bit process. 64 bit process can't have executable path ? addition: computer 64-bit machine. . if question getting executable's path within same application, can try path.getdirectoryname(application.executablepath); . if want path 64 bit process 32 bit application, may not possible described in article: http://qt-project.org/forums/viewthread/22075

how to remove both duplicate entries in python pandas -

i trying remove both entries if 1 duplicate...for example if array is (9,1,2,2,3,4)...i need output (9,1,3,4) most of pandas methods drop_duplicates() keep either top or bottom entry. data has double duplicates , number of elements always! so example (1,4,6,7,3,3,0,0) output should 1,4,6,7 import collections = (1,4,6,7,3,3,0,0) = [x x,y in collections.counter(a).items() if y == 1]

c# - DependencyProperty for ItemsSource -

Image
i have xaml like: <usercontrol x:class="book.customcontrols.headeredcombobox" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" datacontext="{binding relativesource={relativesource self}}" width="200" height="50"> <grid> <grid.rowdefinitions> <rowdefinition height="auto"/> <rowdefinition/> </grid.rowdefinitions> <textblock grid.row="0" margin="2,2" verticalalignment="center" text="{binding header}" fontweight="{binding headerfontweight}"/> <combobox grid.row="1" margin="2,2" verticalalignment="center" itemssource="{binding itemssource, updatesourcetrigger=propertychanged}" selected

vb.net - VB DataGridView 1 Row selection -

i have problem . when load form datagridview , want data transferred text fields when click on > @ left of datagridview. now, have select content in rows select row. how set selects row based on left row selector? instead of having me click on contents of row ? dtguser_cellcontentclick makes me select based on content click right? should if want select entire row? private sub dtguser_cellcontentclick(byval sender system.object, byval e system.windows.forms.datagridviewcelleventargs) handles dtguser.cellcontentclick if groupbox3.enabled = false else 'this code pass value specific row selected user lblid.text = dtguser.currentrow.cells(0).value serial.text = dtguser.currentrow.cells(0).value fname.text = dtguser.currentrow.cells(1).value lname.text = dtguser.currentrow.cells(2).value gender.text = dtguser.currentrow.cells(3).value address.text = dtguser.currentrow.cells(4).value contact.text

php - How to send a comment (in 1 table) to all users (referring to another table)? -

right have 2 tables. comment table , user table. short , simple, wanna sent comment users. need know sql command , how display on php. comment table pk comment sender (refers username) receiver (refers username) user table pk username etc..... i tried using this: $provider = $_request['provider']; $cert = $_request['cert']; $valid = $_request['valid']; $lprice = $_request['lprice']; $trial = $_request['trial']; $cost = $_request['cost']; echo $cert; $sql=mysql_query("select * sslcert certificatename='$cert'",$connect); if(mysql_num_rows($sql)>0) { echo"ssl exists."; echo "<br><a href=addssl.php>back</a>"; } else { $insert = mysql_query("insert sslcert (provider, certificatename, validation, listprice, trial, cost) values ('$provider', '$cert', '$va

What does implementation inheritance mean in the javadoc of java.sql.Timestamp? -

from javadoc of java.sql.timestamp class (emphasis mine) due differences between timestamp class , java.util.date class mentioned above, recommended code not view timestamp values generically instance of java.util.date. the inheritance relationship between timestamp , java.util.date denotes implementation inheritance, , not type inheritance . what mean implementation inheritance , not type inheritance ? case of has-a vs is-a? basically, documentation states fact java.sql.timestamp extends java.util.date implementation detail, , should not use timestamp instances expect date 's functionality. presumably, if java had option (like c++ does), timestamp privately inherit date .

android - Retrieving image from sqlite -

i have created databse contains surveyname , image. image inserted databse bytearray(blob) correctly when m trying retrieve images gives random value. when use if condition finding image returns random value , when use while has resulted infinite loop random values. public class capturesignature extends fragment implements onclicklistener { linearlayout mcontent; signature msignature; button mclear, mgetsign, mcancel; public static string tempdir; public int count = 1; public string current = null; private bitmap mbitmap; view mview; file mypath; context context; private string uniqueid; private edittext yourname; // private databasemethods db; // private databasehandler db; databasemethods db=new databasemethods(getactivity()); @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate);

Deferred Rendering with OpenGL, experiencing heavy pixelization near lit boundaries on surfaces -

Image
problem explaination i implementing point lights deferred renderer , having trouble determining heavy pixelization/triangulation noticeable near borders of lights coming from. the problem appears caused loss of precision somewhere, have been unable track down precise source. normals obvious possibility, have classmate using directx , handling normals in similar manner no issues. from about 2 meters away in our game's units (64 units/meter): a few centimeters away . note "pixelization" not change size in world approach it. however, appear swim if change camera's orientation: a comparison closeup forward renderer demonstrates spherical banding 1 expect rgba8 render target (only 0-255 possible values each color). note in deferred picture walls exhibit normal spherical banding: the light volume shown here green wireframe: as can seen effect isn't visible unless close surface (around 1 meter in our game's units). position reconstruct

freemarker - Java Freemaker spaces in number -

hello have such template: ...... <body onload='setinterval(function(){refresh()}, ${refreshperiod} ); setclienttime();'> <p>userid: ${userid}</p> </body> </html> when generate template , put userid 4195578878989842599 display 4 195 578 878 989 842 599 , possible fix it? use c . this built-in converts number string "computer language" opposed human audience. ${userid?c}

matlab - How to run the code for same value of two variable -

i have written following code- t=0:4 i=5 b=[1,1,1,1,1;1,1,1,2,0;1,1,3,0,0;1,2,2,0,0;1,4,0,0,0;2,3,0,0,0;5,0,0,0,0]; a=b; b(b==0)=inf; idx = (a(:,i-t)==1 ); = a(idx,:); end end now problem can run code t=0:i-1 want run code for t=0:i when tried same value of i , t shows error.it because i-t=0 means index 0 in matlab index never 0 . in case when i-t=0 take value of a unable write code condition. matlab experts need , suggestions regrading code. use if condition handle case specially... if == t idx = (a == 1); = a(idx); else idx = (a(:,i-t)==1 ); = a(idx, :); end

java - All possible ways to reach an ending position -

http://www.cstutoringcenter.com/problems/problems.php?id=103 for doesn't want click it, says there's stepping stone, "-" , soldier "#", soldiers can move right. if soldier behind soldier, must wait soldier move first. ending condition when soldiers reaches end. the number of ways 2 soldier can move across 5 stepping stones. 1) ##--- #-#-- -##-- -#-#- --##- --#-# ---## 2) ##--- #-#-- -##-- -#-#- -#--# --#-# ---## 3) ##--- #-#-- #--#- -#-#- --##- --#-# ---## 4) ##--- #-#-- #--#- -#-#- -#--# --#-# ---## 5) ##--- #-#-- #--#- #---# -#--# --#-# ---## i'm using breadth first search, 5 stones, it's running within seconds, 10 stones, it's taking hours, time increasing exponentially depth. how can deal this? my codes: states.java import java.util.arraylist; public class state { public int stones; public soldiers[] soldiers; public string currentstate =""; public boolean visited =

cql - NDepend how to export all types that I use from .NET frameworks in my assembly -

Image
i'm not .net developer, need solve 1 task: create report contain types .net frameworks using in given assembly. when open assembly in visualndepend see need in classbrowser, don't know how export of these lists file. if understand correctly need create correct cql query , export on desired format. can me query? thank. the cqlinq code query can write is: // <name>all .net fx types used</name> t in thirdparty.assemblies.withnamewildcardmatchin( "mscorlib", "system*", "microsoft.*", "presentation*").childtypes() select t basically here asking third-parties assemblies, filtered name wildcard patterns, match .net fx assemblies. , call childtypes() types of these assemblies. notice ndepend gather third-party types used application, won't unused types in result. notice changing childtypes() childmethods() or childfields() or childnamespaces() can methods, fields or namespaces of .net fx used.

CodeIgniter pagination not working for get method -

i needed pagination parameters. in method i've written following code follows. public function index($offset = 0) { $data['title_for_layout'] = 'apartment advertisement - search'; // pagination config $this->load->library('pagination'); $pagination['enable_query_strings'] = true; $pagination['page_query_string'] = true; $pagination['allow_get_array'] = true; $pagination['first_url'] = base_url('search'); $pagination['base_url'] = $config['first_url']; $pagination['total_rows'] = $this->aa_movies->no_of_search_movies(); $data['no_of_results'] = $pagination['total_rows']; $pagination['use_page_numbers'] = true; $pagination['per_page'] = 20; // initialize pagination $this->pagination->initialize($pagination); // offset $offset = 20 * $offset; // apartments $data[

php - How to run .phar from anywhere on Windows? -

i have .phar file , want run anywhere command. php file.phar --options where file.phar in c:\my-php-cli\file you need add folder containing file.phar path variable. see this link more information.

Cannot scale data with encog -

currently i'm trying scale data file (train.nn) using encog 3, data file looks (this simplified example, in real file, have 249 features each sample sp): 1,0,1,2,sp 4,5,6,1,sp and code scaling: file rawfile = new file(mydir, "train.nn"); file scaledfile = new file(mydir, "scaledtrain.nn"); encoganalyst analyst = new encoganalyst(); analystnormalizecsv norm = new analystnormalizecsv(); norm.analyze(rawfile, true, csvformat.english, analyst); norm.setproduceoutputheaders(false); norm.normalize(scaledfile); but got error: exception in thread "main" org.encog.app.analyst.analysterror: multiple fields named: 1 @ org.encog.app.analyst.util.csvheaders.validatesamename(csvheaders.java:292) @ org.encog.app.analyst.util.csvheaders.init(csvheaders.java:270) @ org.encog.app.analyst.util.csvheaders.<init>(csvheaders.java:146) @ org.encog.app.analyst.csv.normalize.analystnormalizecsv.analyze(analystnormalizecsv.java:147) i don&

python - average of all rows corresponing to all unique rows -

i have numpy array 2 columns: a = [[1,1,1,2,3,1,2,3],[0.1,0.2,0.2,0.1,0.3,0.2,0.2,0.1]] for uniques in first column, want average of values corresponding it. example b = [[1,2,3], [0.175, 0.15, 0.2]] is there pythonic way this? i think following standard numpy approach these kind of computations. call np.unique can skipped if entries of a[0] small integers, makes whole operation more robust , independent of actual data. >>> = [[1,1,1,2,3,1,2,3],[0.1,0.2,0.2,0.1,0.3,0.2,0.2,0.1]] >>> unq, unq_idx = np.unique(a[0], return_inverse=true) >>> unq_sum = np.bincount(unq_idx, weights=a[1]) >>> unq_counts = np.bincount(unq_idx) >>> unq_avg = unq_sum / unq_counts >>> unq array([1, 2, 3]) >>> unq_avg array([ 0.175, 0.15 , 0.2 ]) you of course stack both arrays, although convert unq float dtype: >>> np.vstack((unq, unq_avg)) array([[ 1. , 2. , 3. ], [ 0.175, 0.15 , 0.2 ]])

Read the Permissions used by an Application in Windows Phone 8 -

how can read programatically set of permissions being used application in windows phone 8? you can read wmappmanifest.xml file private static void read() { string ret = string.empty; try { xelement xe = xelement.load("wmappmanifest.xml"); //look capabilities section here } catch { // ignore errors in case method called // design time in vs.net } } http://weblogs.asp.net/psheriff/archive/2011/01/04/get-application-title-from-windows-phone.aspx

java - Trying to map to domain model from json with an object inside -

i have json: "{\"userid\":2,\"title\":\"jfsdk\",\"content\":\"dskljf\",\"taglist\":{\"name\":\"fysikk\",\"name\":\"matte\",\"name\":\"kjemi\"}}" that want parse domain model class public class threadcreatingmodel { int userid; string title; string content; arraylist<tag> taglist; public threadcreatingmodel(){} public threadcreatingmodel(int userid, string title, string content, arraylist<tag> taglist) { this.userid = userid; this.title = title; this.content = content; this.taglist = taglist; } @jsonproperty("userid") public int getuserid() { return this.userid; } public void setuserid(int userid) { this.userid = userid; } @jsonproperty("title") public string gettitle() { return this.title; } public void settitle(string title) { this.title = title; } @jsonproperty("content") public s

html5 - php Illegal offset type in isset or empty -

i have code working initially, not work after restarted computer. the error getting is: warning: illegal offset type in isset or empty in d:\xampp\htdocs\cookieboylive\classes\session.php on line 4 there's 3 files on site - index, login, register. index page checks if users logged in, don't think has problem. here's current code: the main register/login.php page require_once 'core/init.php'; if(input::exists()) { if(token::check(input::get('token'))) { $validate = new validate(); $validation = $validate->check($_post, array( 'username' => array('required' => true), 'password' => array('required' => true) )); if($validation->passed()) { $user = new user(); $login = $user->login(input::get('username'), input::get('password')); if($login) { redirect::to('i

spring mvc - Encrypt JAVA SpringFramework WebApplication -

i've created springframework webapplication , want distribute it. client asked me evaluate applications on own server. want protect code encrypting source. possible? if yes, what's best tool? there performance loss using it? we use proguard in ant task our release, makes classes harder reverse-engineer. seems better performance. notice variables based on injection annotations should declared private , otherwise won't injected correctly after process of proguard . 1. proguard 2. apache ant

android - how to send multiple sms to one recepient only on a button click? -

i need create application wherein on single button click want send multiple sms particular number , capture delivery reports , store in database , show in app in listview. messages sent physically not typed user instead comes database. how acheive functionality?? please help! thanks in advance! broadcastreceiver sendbroadcastreceiver = new sentreceiver(); broadcastreceiver deliverybroadcastreciever = new deliverreceiver();; @override protected void onpause() { // todo auto-generated method stub super.onpause(); try { unregisterreceiver(sendbroadcastreceiver); unregisterreceiver(deliverybroadcastreciever); } catch (exception e) { // todo auto-generated catch block e.printstacktrace(); } } @override protected void ondestroy() { // todo auto-generated method stub super.ondestroy(); try { unregisterreceiver(sendbroadcastreceiver); unregister

javascript - Can I give dynamic paths for images and css purely in client side? -

can give dynamic paths images , css through jquery/javascript/html or other technology available in client side? below dummy code: <html> my_constant_path = "/yes/i/got/this/" <head> <link rel="stylesheet" href="<my_constant_path>" + "style.css"/> </head> <body> <div> <img src= "<my_constant_path>" + "abc.png"/> </div> </body> </html> i cannot use server side script. if going apply my_constant_path images/links you use <base> element @ head section , change href attribute via javascript follows: <head> <meta charset="utf-8"> <title>title</title> <base href=""> <script> function setbaseurl(url) { document.getelementsbytagname("base")[0].href = url; } setbaseurl("http://placehold.it/"); </script> </

c++ - automatic decay of lambda to function pointer when passing to template function -

is there way make lambda decay pointer, without explicitly casting right signature? tidy code: template<typename t> t call(t(*func)()){ return func(); } int ptr(){ return 0; } int main(){ auto ret1 = call(ptr); auto ret2 = call((int(*)())([]{ return 0; })); auto ret3 = call([]{ return 0; }); //won't compile } it's evident call call works if lambda decays pointer, i'm guessing that can happen after right function overload/template chosen. unfortunately can think of solutions involve templates make lambda with signature decay, i'm square one. you can change lambda use unary + operator: +[]{ return 0; } this works because unary plus can applied pointers, , trigger implicit conversion function pointer.

javascript - Image not respecting max-height in Firefox -

portrait img contained within div not it's height set correctly... in ff(27.0.1) only. works chrome, , ie8. i have following: html, body { margin: 0; border: 0; padding:0; width: 100%; height: 100%; overflow:hidden; } .photo-container { position: absolute; right: 0; top: 0; width: 79%; height: 100%; overflow-y: auto; } img#photo { margin-top: 0.5%; max-width: 100%; max-height: 95%; } in html... <div class="photo-container"> <div id="pic"></div> </div> <script type="text/javascript"> function f_pop(theimg) { document.getelementbyid('pic').innerhtml = "<img id='photo' src='" + theimg + "' alt='photo'>"; } http://jsfiddle.net/isherwood/sfzgn notes: the photograph portrait orientation. this works chrome , ie8, not in ff 27.0.1 in img#photo, changed height 50%. chrome , ie8 sized photo down. in