Friday, 15 May 2015

java - What is meant by container? Web Container, JSP Container or Spring Container? -



java - What is meant by container? Web Container, JSP Container or Spring Container? -

please elaborate little illustration mean container in java. web container or jsp containe or servlet container or spring container? if possible can have link can visualize these concepts.

a web container, jsp container or servlet container refer same thing: a server takes java web application , executes it.

an illustration apache tomcat or eclipse jetty. create app, start server , pass application it. server "contain" application , executes (therefore it's called container). server handle things you, such listening on ports , incoming requests or routing.

a spring container executes application written spring framework.

java containers

php - Stuck with unknown column in field MySQL -



php - Stuck with unknown column in field MySQL -

i maintain getting error

unknown column 'hello' in 'field list'

when execute code

$sql = "insert installs (date,addedby,customer,reg,vehmake,vehmodel,colour,mileage,location,tracker,serial,sim,extr as,satnav,input1,input2,output,comments) values (" . $date . ", " . $addedby . ", " . $customer . ", " . $reg . ", " . $vehmake . ", " . $vehmodel . ", " . $colour . ", " . $mileage . ", " . $location . ", " . $tracker . ", " . $serial . ", " . $sim . ", " . $extras . ", " . $satnav . ", " . $input1 . ", " . $input2 . ", " . $output . ", " . $comments . ")"; $result = $connect->query($sql) or die($connect->error);

replace this

(' . "hello" . ', ' . 2 . ', ' . 3 . ', ' . 4 . ', ' . 4 . ', ' . 5 . ', ' . 6 . ', ' . 7 . ', ' . 8 . ', ' . 9 . ', ' . 10 . ', ' . 11 . ', ' . 12 . ', ' . 13 . ', ' . 14 . ', ' . 15 . ', ' . 16 . ', ' . 17 . ')';

by

("hello", 2 ,3, 4,4,5,6,7,8,9,10,11,12, 13,14,15,16,17)';

edit:

replace this

(" . $date . ", " . $addedby . ",..........

by

('$date', '$addedby',...........

or this

('" . $date . "', '" . $addedby . "',..........

php mysql mysqli

javascript - Secure Websockets not working on iphone browsers -



javascript - Secure Websockets not working on iphone browsers -

i have made setup of websockets on nginx server.

i using javascript websockets in project on ssl.

they working fine on desktop browsers, android browsers , blackberry browsers. not working on iphone browsers.

i have checked compatibility of iphone browsers. have tested in safari , chrome on iphone.

please help me solution.

javascript php ios iphone websocket

wso2esb - Backing up proxy services and configurations in WSO2 ESB? -



wso2esb - Backing up proxy services and configurations in WSO2 ESB? -

i have wso2 esb 4.6 running proxy services, proxies have endpoints, sequences , other artifacts saved inline, in registry , standalone endpoints/sequences. want backup them. there way suggested situation?

if in registry utilize checkin client tool backup. , take backup of repository/server/deployment/synapse-config folder too

wso2 wso2esb synapse

Is there a Java.Swing equivalent to AS3's ADDED_TO_STAGE event? -



Is there a Java.Swing equivalent to AS3's ADDED_TO_STAGE event? -

in as3, there event listens when object added stage. useful cases where, example, variables not set until added on-screen. waiting until object has been added, can assure of variables set.

is there equivalent in swing? example, have function relies on objects getwidth function. obviously, if seek phone call before object added on screen, function have problems because width zero. function called component added , has width. in as3, like:

mycomponent.addeventlistener(event.added_to_stage, myfunction).

how in java?

depending on setup, componentlistener might enough. there a section in java tutorials componentlisteners.

another way of initializing stuff displayed overriding paintcomponent method , performing setup on first invocation.

java swing

c# - How do I deserialize a List as another List instead of a readonly T[]? -



c# - How do I deserialize a List<T> as another List<T> instead of a readonly T[]? -

we have code makes re-create of list<t> of objects. problem code returning readonly array of t[] instead of list<t>.

why that, , how can prepare deserialization code?

public interface itestobject { } [knowntype(typeof(itestobject))] [datacontract(name = "testobject")] public class testobject : itestobject { [datamember] public int id { get; set; } [datamember] public string value { get; set; } } public class testapp { public void run() { ilist<itestobject> = new list<itestobject>(); a.add(new testobject() { id = 1, value = "a" }); a.add(new testobject() { id = 2, value = "b" }); ilist<itestobject> b = copy(a); // list<t> while b readonly t[] debug.writeline(a.gettype().fullname); debug.writeline(b.gettype().fullname); } public ilist<itestobject> copy(ilist<itestobject> list) { datacontractserializer serializer = new datacontractserializer(typeof(ilist<itestobject>), new type[] { typeof(testobject) }); using (stream stream = new memorystream()) { serializer.writeobject(stream, list); stream.seek(0, seekorigin.begin); ilist<itestobject> clone = (ilist<itestobject>)serializer.readobject(stream); stream.close(); homecoming clone; } } }

i'm guessing it's fact list<t> isn't listed knowntype

try using datacontractserializer(typeof(list<itestobject>) knows concrete type

c# datacontractserializer

php - htaccess redirect and not change the url -



php - htaccess redirect and not change the url -

how alter page url without redirecting?

file structure:

/www /www/app /www/app/index.html /www/app/.htaccess

.htaccess

options +followsymlinks -multiviews rewriteengine on rewritebase / rewriterule ^(demo1|demo2)\/?$ app [l]

for example

domain.dev/app (index.html page) domain.dev/app/demo1 (here want open /index.html page without changing url it) domain.dev/app/demo2 (same demo1 route)

php apache .htaccess redirect yeoman

asp.net mvc - MVC5 ActionResult model being passed as empty -



asp.net mvc - MVC5 ActionResult model being passed as empty -

i have read plenty of posts issue can't seem find solution fits implementation. i'm giving mvc effort (i'm webforms guy). model beingness passed actionresult empty when should populated. i'm starring @ sample works , can find no differences. seems impossible debug too. pointers greatfully appreciated.

view:

@model webapplication1.models.siteviewmodel @{ viewbag.title = "delete site"; layout = "~/views/shared/_layout.cshtml"; } <p>are sure want delete site?</p> @using (html.beginform()) { @html.antiforgerytoken() @html.validationsummary(false) <ul class="list-group"> <li class="list-group-item"> <div class="row"> <div class="col-md-2"><b>@html.labelfor(model => model.name)</b></div> <div class="col-md-6">@model.name</div> </div> </li> <li class="list-group-item"> <div class="row"> <div class="col-md-2"><b>@html.labelfor(model => model.phase)</b></div> <div class="col-md-6">@model.phase</div> </div> </li> <li class="list-group-item"> <div class="row"> <div class="col-md-2"><b>@html.labelfor(model => model.type)</b></div> <div class="col-md-6">@model.type</div> </div> </li> </ul> <button type="submit" class="btn btn-danger">delete</button> @html.actionlink("back list", "index", null, new { @class = "btn btn-default" }) } @section scripts { @scripts.render("~/bundles/jqueryval") }

model:

public class siteviewmodel { public siteviewmodel() { services = new list<servicemodel>(); } public siteviewmodel(sitemodel site) { this.siteid = site.siteid; this.name = site.name; this.type = site.type; this.phase = site.phase; this.services = site.services; } public int siteid { get; set; } [required(errormessage = "name required")] public string name { get; set; } public schooltype type { get; set; } public schoolphase phase { get; set; } public datetime? deleted { get; set; } public virtual icollection<servicemodel> services { get; set; } }

controller action:

[httppost] public actionresult delete(siteviewmodel model) { var site = siterepository.getbyid(model.siteid); if (site == null) { throw new argumentexception(string.format("site id [{0}] not exist", model.siteid)); } seek { siterepository.softdeleteandsubmit(site); base.setsuccessmessage("the site has been (soft) deleted."); homecoming redirecttoaction("index"); } grab (exception ex) { base.seterrormessage("whoops! couldn't delete site. error [{0}]", ex.message); } homecoming view(model); }

thanks, chris.

if want fully-populated model you'll need utilize form elements or form helper functions post data.

@using(html.beginform()) { <input type="text" value="@model.name" /> // or html.textboxfor(m => m.name) ... }

the illustration linked relies on url routing rule match model's parameter. need rename siteid id or add/modify routing rule.

if need id pass parameter create intent more obvious , less prone breaking.

@using(html.beginform()) { @html.hiddenfor(m => m.id) <button type="submit">delete</button> } [httppost] public actionresult delete(int id) { var site = siterepository.getbyid(id); ... }

asp.net-mvc asp.net-mvc-5.1

r - Creating a conditional variable whose value=dataframe colnames -



r - Creating a conditional variable whose value=dataframe colnames -

i have dataset(df),

id b c d e f 1 0 0 1 1 1 1 2 0 0 0 0 0 0 3 0 1 0 0 0 0

i trying write function give me names of columns have value 1 making dataset , have no thought start.

id b c d e f newcol 1 0 0 1 1 1 1 c,d,e,f 2 0 0 0 0 0 0 na 3 0 1 0 0 0 0 b

i appreciate help! thanks!!

here's approach

newdf <- transform(df, newcol=sapply(apply(df[, -1], 1, function(x) colnames(df[,-1])[x==1]), paste0, collapse=",")) levels(newdf$newcol)[levels(newdf$newcol)==""] <- "na" newdf # id b c d e f newcol # 1 1 0 0 1 1 1 1 c,d,e,f # 2 2 0 0 0 0 0 0 na # 3 3 0 1 0 0 0 0 b

r conditional

objective c - Turkish currency symbol not drawn in iOS 6 -



objective c - Turkish currency symbol not drawn in iOS 6 -

i trying display turkish currency symbol (turkish lira sign) in ios app. using unicode "\u20ba". working fine in ios 7 ios 6 symbol not displayed , seeing square box beingness drawn. issue here?

i drawing symbol on cell below code:

nsstring *aformattedprice = [mydict stringforkey:@"formattedprice"]; acell.detailtextlabel.text = aformattedprice;

when set nslog on aformattedprice, prints correctly on console cell detailed text label not able render properly.

ios objective-c cocoa-touch unicode

encryption - Encrypted Vs Unencrypted EBS Volumes AWS -



encryption - Encrypted Vs Unencrypted EBS Volumes AWS -

we testing standard ebs volume, ebs volume encryption on ebs optimized m3.xlarge ec2 instance.

while analyzing test results, came know that

ebs volume encryption taking lesser time during read, write, read/write operations compared ebs without encryption. think there effect of latency on encrypted ebs volume because of encryption overhead on every i/o request.

what appropriate reason why ebs encrypted volumes faster normal ebs volumes??

expected results should ebs should yield improve results encrypted eebs.

results :

encrpted ebs results:

sysbench 0.4.12: multi-threaded scheme evaluation benchmark running test next options: number of threads: 8 initializing random number generator timer. file open flags: 16384 8 files, 512mb each 4gb total file size block size 16kb calling fsync() @ end of test, enabled. using synchronous i/o mode doing sequential write (creation) test threads started! done. operations performed: 0 read, 262144 write, 8 other = 262152 total read 0b written 4gb total transferred 4gb (11.018mb/sec) 705.12 requests/sec executed test execution summary: total time: 371.7713s total number of events: 262144 total time taken event execution: 2973.6874 per-request statistics: min: 1.06ms avg: 11.34ms max: 3461.45ms approx. 95 percentile: 1.72ms

ebs results:

sysbench 0.4.12: multi-threaded scheme evaluation benchmark running test next options: number of threads: 8 initializing random number generator timer. file open flags: 16384 8 files, 512mb each 4gb total file size block size 16kb calling fsync() @ end of test, enabled. using synchronous i/o mode doing sequential write (creation) test threads started! done. operations performed: 0 read, 262144 write, 8 other = 262152 total read 0b written 4gb total transferred 4gb (6.3501mb/sec) 406.41 requests/sec executed test execution summary: total time: 645.0251s total number of events: 262144 total time taken event execution: 5159.7466 per-request statistics: min: 0.88ms avg: 19.68ms max: 5700.71ms approx. 95 percentile: 6.31ms

please help me resolve issue.

that's unexpected conceptually , confirmed amazon ebs encryption:

[...] , you can expect same provisioned iops performance on encrypted volumes unencrypted volumes minimal effect on latency. can access encrypted amazon ebs volumes same way access existing volumes; encryption , decryption handled transparently , require no additional action you, ec2 instance, or application. [...] [emphasis mine]

amazon ebs volume performance provides more details on ebs performance in general - angle, pure speculation, maybe utilize of encryption implies default pre-warming amazon ebs volumes:

when create new ebs volume (general purpose (ssd), provisioned iops (ssd), or magnetic) or restore volume snapshot, back-end storage blocks allocated immediately. however, first time access block of storage, must either wiped clean (for new volumes) or instantiated snapshot (for restored volumes) before can access block. preliminary action takes time , can cause 5 50 percent loss of iops volume first time each block accessed. [...]

either way, suggest rerun benchmark after pre-warming both new ebs volumes, in case haven't done already.

encryption amazon-web-services amazon-ec2

r - Using read.table to read a CSV file gives a table with quotes -



r - Using read.table to read a CSV file gives a table with quotes -

i trying read csv file in r using read.table command , table in r has double quotes around every entry. problem cannot utilize these entries quotes mathematical operations.

here read command:

exprs_data <- as.matrix(read.table("test1.csv", sep= ",",header=true,row.names=1,as.is=true))##

here imported table in r:

abc def xyz m0122 " 854" "1487" "1855" m0152 " 97" " 159" " 468" m0257 " 157" " 733" " 6"

why there quotes around numbers?? never experienced problem in r before. can help me importing csv file in r?

the quotes indicate values in matrix strings rather numbers. without knowing csv file looks like, suspect value in file not valid number, , conversion matrix (your as.matrix) statement, converted strings comply required construction of matrix (needs same info type). i'm not exclusively sure why doing matrix conversion can explicitly specify in read.table type info using colclasses parameter. seek (assuming columns treated numbers, otherwise utilize vector of different values each column in colclasses):

exprs_data <- read.table("test1.csv", sep= ",", header=true, row.names=1, colclasses = "numeric")

you can convert matrix if want work straight info frame read.table returns. mentioned in comment, can details on construction (including column info types) of variable running str(exprs_data).

r csv read.table

cmd - batch file to backup file -



cmd - batch file to backup file -

i have below script take backup of file when user logs in. saved in batch file. creates log when file copied. want edit script saves date , time when file has been copied... please need ur help thanks

@echo off rem re-create documents xcopy "c:\users\user1\desktop\the folder\the file.xlsm" "c:\users\user1\desktop\the folder\backup\" /c /r /d /y > "c:\users\user1\desktop\the folder\backup\xcopy.log"

this works independent of regional date/time format:

for /f "tokens=1" %%i in ('wmic os localdatetime ^|find "20"') set dt=%%i rem dt format yyyymmddhhmmss echo datetimestring: %dt% rem here can format date/time need it: set dat=%dt:~4,2%-%dt:~2,2%-%dt:~0,4% echo formatted datetimestring: %dat% set tim=%dt:~8,4% echo time unformatted without date: %tim% set tims=%dt:~8,2%:%dt:~10,2%:%dt:~12,2% echo time formatted: %tims%

note: if want write date/time filename, best selection yyyymmddhhmm format, because files sort chronilogical.

xcopy "source" "destination" > "path\xcopy-%dt%.log"

to write date/time file, utilize

echo %dat%-%tims% >> "path\xcopy.log"

batch-file cmd

smart mobile studio - Unable to access RTTI for SmartMobileStudio -



smart mobile studio - Unable to access RTTI for SmartMobileStudio -

trying utilize smart's rtti as defined in post, not able allow rtti emitted html.

when define:

type tbase = class published field : integer = 1; end; var base of operations := new tbase; printpropertiesfortype(base);

then, there no rtti available class.

in index.html, have:

var $rtti = [];

meaning there no rtti emitted.

this occurs whatever project options have set. (in short, rtti compilation alternative not create difference)

i’m using sms 2.0.1.741.

i’m stuck implementing native sms client mormot..

there seem bug issue in latest hotfix. have reported issue developer team , should fixed shortly. noticed exact same thing myself testing rtti methods on different versions of sms.

an immediate solution roll-back version 2.0.0.723.

you can download version here: http://smartmobilestudio.com/download/v2_0_0_723/

smart-mobile-studio

javascript - ZeroClipboard: Hiding element when there is no Flash in browser -



javascript - ZeroClipboard: Hiding element when there is no Flash in browser -

using zeroclipboard, page loads, want hide "copy clipboard" button if there no adobe flash present.

i understand there noflash , wrongflash events, wonder if these can used effect rendering of page button can't seen.

if create button like:

var $button = $('.btn'), client = new zeroclipboard($button);

you like

client.on("error", function(e) { client.destroy(); $button.hide(); }

javascript flash zeroclipboard

android - java.lang.RuntimeException: Unable to start activity ComponentInfo ... java.lang.IllegalStateException: RequestQueue not initialized -



android - java.lang.RuntimeException: Unable to start activity ComponentInfo ... java.lang.IllegalStateException: RequestQueue not initialized -

i using library in bundle shows images flickr declared in manifest file still gives error

06-12 22:00:03.862: e/androidruntime(15128): fatal exception: main 06-12 22:00:03.862: e/androidruntime(15128): java.lang.runtimeexception: unable start activity componentinfo{com.examples.youtubeapidemo/com.mani.staggeredview.demo.mainactivity}: java.lang.illegalstateexception: requestqueue not initialized 06-12 22:00:03.862: e/androidruntime(15128): @ android.app.activitythread.performlaunchactivity(activitythread.java:2180) 06-12 22:00:03.862: e/androidruntime(15128): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2230) 06-12 22:00:03.862: e/androidruntime(15128): @ android.app.activitythread.access$600(activitythread.java:141) 06-12 22:00:03.862: e/androidruntime(15128): @ android.app.activitythread$h.handlemessage(activitythread.java:1234) 06-12 22:00:03.862: e/androidruntime(15128): @ android.os.handler.dispatchmessage(handler.java:99) 06-12 22:00:03.862: e/androidruntime(15128): @ android.os.looper.loop(looper.java:137) 06-12 22:00:03.862: e/androidruntime(15128): @ android.app.activitythread.main(activitythread.java:5041) 06-12 22:00:03.862: e/androidruntime(15128): @ java.lang.reflect.method.invokenative(native method) 06-12 22:00:03.862: e/androidruntime(15128): @ java.lang.reflect.method.invoke(method.java:511) 06-12 22:00:03.862: e/androidruntime(15128): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:793) 06-12 22:00:03.862: e/androidruntime(15128): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:560) 06-12 22:00:03.862: e/androidruntime(15128): @ dalvik.system.nativestart.main(native method) 06-12 22:00:03.862: e/androidruntime(15128): caused by: java.lang.illegalstateexception: requestqueue not initialized 06-12 22:00:03.862: e/androidruntime(15128): @ com.mani.staggeredview.demo.app.staggereddemoapplication.getrequestqueue(staggereddemoapplication.java:35) 06-12 22:00:03.862: e/androidruntime(15128): @ com.mani.staggeredview.demo.mainactivity.oncreate(mainactivity.java:72) 06-12 22:00:03.862: e/androidruntime(15128): @ android.app.activity.performcreate(activity.java:5104) 06-12 22:00:03.862: e/androidruntime(15128): @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1080) 06-12 22:00:03.862: e/androidruntime(15128): @ android.app.activitythread.performlaunchactivity(activitythread.java:2144) 06-12 22:00:03.862: e/androidruntime(15128): ... 11 more 06-12 22:00:07.452: i/process(15128): sending signal. pid: 15128 sig: 9

declared in manifest file

<activity android:name="com.mani.staggeredview.demo.mainactivity" android:label="activity library"> </activity>

in class calling

import com.mani.staggeredview.demo.*; . . . . btn_naat.setonclicklistener(new onclicklistener() { @override public void onclick(view arg0) { intent myintent = new intent(getbasecontext(),com.mani.staggeredview.demo.mainactivity.class); startactivity(myintent); } });

i presume using volley library networking. seems haven't initialized requestqueue object:

if (mrequestqueue == null) { mrequestqueue = volley.newrequestqueue(getapplicationcontext()); }

add above code wherever have declared requestqueue object. seek this. should work.

java android

html - Banner getting ignored -



html - Banner getting ignored -

i want set navigation under banner, when seek goes behind banner (it pretends isn't there. solved removing position: absolute; when banner wont on top left anymore.

<img class="banner" src="images/banner.png"> <nav class="navigation"> <ul> <li><a href="#">home</a></li> <li><a href="#">prijzen</a></li> <li><a href="#">examen</a></li> <li><a href="#">leerlingen</a></li> </ul> </nav>

css:

.banner { width: 100%; top: 0; left: 0; position: absolute; } .navigation { }

i suggest utilize container banner , menu this:

html

<div class="navcont"> <div class="banner">banner</div> <nav class="navigation"> <ul> <li><a href="#">home</a></li> <li><a href="#">prijzen</a></li> <li><a href="#">examen</a></li> <li><a href="#">leerlingen</a></li> </ul> </nav> </div>

css

.banner { width: 100%; height: 50px; position: relative; background: yellow; float: left; } .navigation{ float:left; }

also suggest utilize position:relative , float instead of position:absolute.

take example:

fiddle

html css

"The C Programming Language" or other books -



"The C Programming Language" or other books -

i have been going through k&r , have been struggling many of programs. effect me me reason, makes me sense idiot not understanding "quintessential c book."

i have asked help on irc, has proved filled elitist jerks talk downwards on want learn.

is possible me larn , become much of expert @ c using book? have been looking @ "c: how program" , seems alternative.

edit

thanks link list of books. inquire because "good" (or claims be) @ c praises k&r , worry other books won't teach well.

i'm sure 1 problem c first "real" programming language, though have touched on others, have chosen c 1 want know.

check out this, definitive c book guide , list.

i recommend c primer plus, of course of study mileage may vary. you're not 1 didn't k&r.

c

django - How to use updateview with a ForeignKey/OneToOneField -



django - How to use updateview with a ForeignKey/OneToOneField -

class modtool(models.model): ... issue = models.onetoonefield(issue) priority = models.charfield(max_length=1, choices=priority, blank=true) status = models.charfield(max_length=1, choices=status, default='o', blank=true)

url

url(r'^moderate/(?p<pk>\d+)', modedit.as_view(),name='moderation')

view

class modedit(updateview): model = modtool template_name = 'myapp/moderate.html' fields = ['priority','status']

at point not able figure out how set view edit particular modtool instance has onetoonefield issue given in pk.

you can utilize slug_field , slug_url_kwarg attributes this:

url(r'^moderate/(?p<issue_id>\d+)', modedit.as_view(),name='moderation') class modedit(updateview): slug_field = 'issue_id' slug_url_kwarg = 'issue_id' model = modtool template_name = 'myapp/moderate.html' fields = ['priority','status']

this lookup on issue_id=<issue_id> issue_id issue's primary key captured in url.

i've renamed keyword argument pk issue_id prevent name clash lookup primary key. otherwise additional filter take place filtered on modtool's primary key value issue's primary key.

django django-class-based-views

javascript - Why cant my function get data from JSON File? -



javascript - Why cant my function get data from JSON File? -

i trying practice usage of json file , fining out how works. have json file attached document , 1 function same name object in json file. how ever must set info on div not. code:

json file:

myfunction([ { "display": "html tutorial", "url": "http://www.w3schools.com/html/default.asp" }, { "display": "css tutorial", "url": "http://www.w3schools.com/css/default.asp" }, { "display": "javascript tutorial", "url": "http://www.w3schools.com/js/default.asp" }, { "display": "jquery tutorial", "url": "http://www.w3schools.com/jquery/default.asp" }, { "display": "json tutorial", "url": "http://www.w3schools.com/json/default.asp" }, { "display": "ajax tutorial", "url": "http://www.w3schools.com/ajax/default.asp" }, { "display": "sql tutorial", "url": "http://www.w3schools.com/sql/default.asp" }, { "display": "php tutorial", "url": "http://www.w3schools.com/php/default.asp" }, { "display": "xml tutorial", "url": "http://www.w3schools.com/xml/default.asp" } ])

js function:

function myfunction(arr) { var out = ""; var i; (i = 0; < arr.length; i++) { out += '<a href="' + arr[i].url + '">' + arr[i].display + '</a><br>'; } document.getelementbyid("w3schools").innerhtml = out;

and here demo: http://jsfiddle.net/ylv9a/

any thought create working? in advance.

well json file isn't json file. it's javascript file function beingness called happens contain array of data. best guess you're loading in "json file" first, other file second. you're calling function before exists, causing error , js execution stop. alter order of loading scripts , should work fine.

javascript json

php - Show only rows that contain data in one specific column -



php - Show only rows that contain data in one specific column -

this question has reply here:

mysql select column not empty 8 answers

i have table contains thousands of rows. i'm trying show rows have info in specific column. column name "vhf" table name "p_loc". bulk of rows contain no info in column "vhf" but, when seek code below wants echo rows.

i need rows contain info in column "vhf"

$sql = mysql_query("select vhf p_loc vhf not null");

sounds there 2 cases want filter out:

the vhf column null the vhf column empty, or empty string

this means need 2 clauses in select:

$sql = mysql_query("select vhf p_loc vhf not null , vhf != ''");

php

C++: when object constructed in argument is destructed? -



C++: when object constructed in argument is destructed? -

when object constructed in argument destructed, before of after function call?

e.g. next code safe?

void f(const char*) { ... } std::string g() { ... } ... f(g().c_str());

it works me don't know undefined behaviour or should work.

g() temporary. lifetime of tempraries extends entire time of evaluation of entire full-expression (in case, f(g().c_str())) hence usage safe, unless f() stores pointer somewhere.

§12.2/4 there 2 contexts in temporaries destroyed @ different point end of fullexpression. first context when look appears initializer declarator defining object. in context, temporary holds result of look shall persist until object’s initialization complete. [...]

§12.2/5 sec context when reference bound temporary. [...]

neither of these 2 cases apply in example.

c++

c# - Object reference not set Error in Json Serialize in Lists -



c# - Object reference not set Error in Json Serialize in Lists -

i have 3 c# classes in have 2 lists, when trying create json string, got object reference not set instance of object error.

i have tried 1 list. works, 2 classes or more classes have list in program, not worked. pls help me resolve.

model json -

{ "accesskey": "7eb228097576abf56968e9845ab51b90", "channelid": "103", "hotels": [ { "hotelid": "2", "rooms": [ { "roomid": "1" } ] } ] }

c# classes -

public class rootobject { public string accesskey { get; set; } public string channelid { get; set; } public list<hotel> hotels { get; set; } } public class hotel { public string hotelid { get; set; } public list<room> rooms { get; set; } } public class room { public string roomid { get; set; } }

c#

public string cc() {

string s = ""; rootobject ro = new rootobject(); ro.accesskey = "7eb228097576abf56968e9845ab51b90"; ro.channelid = "103"; ro.hotels = new list<hotel>(); hotel h = new hotel(); room r = new room(); string config = "server=localhost;username=someuser;password=somepwd;database=db"; mysqlconnection connection = new mysqlconnection(config); string query = "select * test1"; mysqlcommand command = new mysqlcommand(query, connection); connection.open(); mysqldatareader reader = command.executereader(); while (reader.read()) { r.roomid = reader[2].tostring(); } connection.close(); query = "select * test1"; command = new mysqlcommand(query, connection); connection.open(); reader = command.executereader(); while (reader.read()) { h.hotelid = reader[1].tostring(); } connection.close(); h.rooms.add(r); // object reference not set instance of object error ro.hotels.add(h); javascriptserializer js = new javascriptserializer(); s = js.serialize(ro); homecoming s; }

you need initialise rooms property. add together constructor hotel calss so

public class hotel { public hotel(string hotelid){ this.hotelid = hotelid; this.rooms = new list<room>(); } public string hotelid { get; private set; } public list<room> rooms { get; private set; } }

then you'd instantiate room new hotel(hotelid)

it's thought maintain should not changed encapsulated. keys should not changed outside of object. e.g. create sense alter hotelid , maintain list of rooms?

it's recommended not expose setter collections @ all. it's plenty expose getter , it's improve expose required operations e.g. in case expose addroom operation rather exposing list of rooms

in code looping on records in info set (and you're doing twice) , overriding value hotelid. ie using lastly record in info set both hotelid , room

c# nullreferenceexception

javascript - jQuery dialog text selected like js prompt? -



javascript - jQuery dialog text selected like js prompt? -

hey quick question!

i want have text selected in dialog window user can press ctrl + c re-create text. can done , if can, how?

an illustration of javascript alert prompt. there user can u press ctrl + c re-create text. anyway implement in jquery dialog div?

thanks peeps!

i utilize jquery ui dialog widget this, http://api.jqueryui.com/dialog/. highlight text need utilize plugin mentioned here, highlight word jquery.

if ok using textarea within dialog, seek this.

<div><button id="opener">open dialog</button> <div id="dialog" title="dialog title"><textarea id="test">i'm textarea within dialog</textarea></div> </div> <script type="text/javascript"> <!-- $(document).ready(function() { $( "#dialog" ).dialog({ autoopen: false }); $( "#opener" ).click(function() { $( "#dialog" ).dialog("open"); $( "#dialog textarea" ).select(); }); }); //--> </script>

javascript jquery asp.net-mvc

python - iPython Notebook Print Above Last Line -



python - iPython Notebook Print Above Last Line -

i have notebook going print off hundreds of lines. there anyway have next line print above lastly one?

as in:

output_n ... output 2 output 1

instead of:

output1 output2 ... output_n

kind of! from ipython.display import clear_output, calling clear_output() clear everything. reprint starting output_n. it's... not ideal.

here's link.

python ipython ipython-notebook

ruby on rails 3 - Sub domain validation and creation from backend -



ruby on rails 3 - Sub domain validation and creation from backend -

hi have application in user registers , provide company name , utilize name , create sub domain saved in company table. want create unique don't want restrict user type same company name in database. want if company name nowadays example: name entered xyz sub domain xyz.myapp.com, , when other user type same name sub domain should xyz1.myapp.com , same other same names in sequence.

here have tried fails on sec turn:

def get_available_subdomain generated_subdomain = name.downcase.gsub(/\s+|\&|\@|\#|\(|\)|\/|\.|\/|\?|\!|\"|\$|\%|\'|\*|\+|\,|\:|\;|\<|\>|\[|\]|\^|\`|\{|\}|\||\-|\~/, "") unless name.blank? companies = company.where(:subdomain=> generated_subdomain) if companies.count == 0 new_subdomain = generated_subdomain else new_subdomain = generated_subdomain + (companies.count).to_s end new_subdomain end

how create unique method expected results. help appreciated.

if using mysql back-end can seek searching companies generated sud-domain 'xyz', 'xyz1', 'xyz2' etc.

def get_available_subdomain generated_subdomain = name.downcase.gsub(/\s+|\&|\@|\#|\(|\)|\/|\.|\/|\?|\!|\"|\$|\%|\'|\*|\+|\,|\:|\;|\<|\>|\[|\]|\^|\`|\{|\}|\||\-|\~/, "") unless name.blank? companies = company.where('subdomain regexp ?', "#{generated_subdomain}[/d]*") if companies.count == 0 new_subdomain = generated_subdomain else new_subdomain = generated_subdomain + (companies.count).to_s end new_subdomain end

if database progress search companies this

companies = company.where('subdomain ~* ?', "#{generated_subdomain}[/d]*")

if database not mysql suggested search company name instead of sub-domain. because creating subdomain according company name.

companies = company.where(:name => generated_subdomain)

ruby-on-rails-3 subdomain

Android - How can I determine an appropriate height for my ListView items? -



Android - How can I determine an appropriate height for my ListView items? -

i building android app listview. coming ios used setting fixed pixel heights list view items, since screen sizes of used devices same. android, wondering way dynamically set heights of listview items it looks nice on screen sizes?

in android there 2 famous properties. are:

match_parent formerly fill_parent using property layout width or height expand view parents width or height minus margins wrap_content using property layout width or height allow view take much space required or available(if exceeds screen dimension exception within scrollable views)

so tag set both width , height match_parent. , in custom row might populating set root layout width match_parent , height wrap_content.

note: in android while give fixed height @ times not practice.

android android-layout android-listview

perl - Importing multi-lingual categories with Magmi -



perl - Importing multi-lingual categories with Magmi -

i trying create multilingual categories magmi. have 1 website, 1 store , 3 store views every language. i've noticed isn't possible create different root category when store view selected.

is possible create same behavior products? => having same category different title depending on store view selected? or have create different category tree each language/store view.

1)

+root +product categories lang1_cat1 / lang2_cat1 / lang3_cat1 (per storeview language) lang1_cat2 / lang2_cat2 / lang3_cat2 lang1_cat3 / lang2_cat3 / lang3_cat3

2)

+root +english +product categories lang1_cat1 lang1_cat2 lang1_cat3 +french +categories darticles lang2_cat1 lang2_cat2 lang2_cat3 +spanish +categorias de productos: lang3_cat1 lang3_cat2 lang3_cat3

and how translate import csv? have following:

"product categories::1::0::1~storage::1::0::1~storage accessories::1::0::1~tool cases::1::0::0"

so utilize custom separators (since off our categories has unusual characters in them, making sure don't conflicts) , category parameters , first update english language version , update other languages.

i hoping utilize profile, specified different storeview (with store column) , outputting the categories above corresponding translated category names.

so question here is, go on above (same category tree level, different storeviews/translations)? or need create different tree level each language , import following?

"english::1::0::1~product categories::1::0::1~perel::1::0::1~storage accessories::1::0::1~tool cases::1::0::0" "spanish::1::0::1~categorías de productos::1::0::1~herramientas perel::1::0::1~accesorios de almacenamiento::1::0::1~cajas de herramientas::1::0::0" "french::1::0::1~catégories d'articles::1::0::1~outillage perel::1::0::1~accessoires de rangement::1::0::1~valises d' outillage::1::0::0"

where english, spanish & french different trees.

thank you!

the magmi wiki describes root categories should placed between square brackets[] identified root names. example( wiki )

store,sku,...,categories root,00001,....,[storerootname1]/level1s1;;[storerootname2]/level1s2

hope helps

perl magento magmi

objective c - On iOS8, displaying my app in landscape mode will hide the status bar but on iOS 7 the status bar is displayed on both orientations -



objective c - On iOS8, displaying my app in landscape mode will hide the status bar but on iOS 7 the status bar is displayed on both orientations -

i want status bar displayed in both orientations in ios 8; it's beingness displayed in ios 7.

navigationcontroller.isnavigationbarhidden returns no.

why ios 8 doing this?

try this

add below code in didrotatefrominterfaceorientation

[[uiapplication sharedapplication] setstatusbarhidden:no withanimation:uistatusbaranimationnone];

edit no need write code in view controller set view controller-based status bar appearance no in plist , add together below code in root view controller's viewdidload

[[uiapplication sharedapplication] setstatusbarhidden:yes withanimation:uistatusbaranimationnone]; [[uiapplication sharedapplication] setstatusbarhidden:no withanimation:uistatusbaranimationnone];

demo project https://www.dropbox.com/s/uumneidk4wom5md/demostatusbar.zip?dl=0

ios objective-c orientation ios8

asp.net - Differences between .Net Full framework and the .Net Core Framework 4.5 used by K runtime? -



asp.net - Differences between .Net Full framework and the .Net Core Framework 4.5 used by K runtime? -

i've seen videos introducing asp.net vnext , been keeping recent proclamation blog posts, detailed info on what's been stripped total framework appears slim. here's think know far:

it's much smaller (11mb vs >200mb): http://davidzych.com/2014/05/24/getting-started-with-asp-net-vnext/ strong naming gone: http://jeremydmiller.com/2014/06/09/final-thoughts-on-nuget/ it's dumped system.web it includes merged mvc , webapi (however don't believe part of framework rather dependencies can specified) dependencies managed through project.json, extent base

are looking @ framework includes nil more what's in mscorlib in total framework, else delivered via bundle management? , if case, why 1 need target framework specifically, described here? http://blogs.msdn.com/b/webdev/archive/2014/06/17/dependency-injection-in-asp-net-vnext.aspx

the reason target net45 in link supplied because autofac built , has dependency on .net 4.5. without net45 code wouldn't compile.

my assumption 1 time vnext gets closer , closer release autofac (and structuremap, , castle windsor, , ...) release version targets cloud optimized framework remove dependency.

asp.net .net asp.net-core

web services - How to send large custom object to .net webservice in android -



web services - How to send large custom object to .net webservice in android -

i able send custom object .net webservice , webmethod working absolutely fine. tested code on multiple phone , result success when trying on samsung mobile started give me exception.

i found problem memoryoutofexception occuring because have recorded big size of video , trying convert byte[] expected record less quality video working in micromax , motorola not in samsung (rest brands don't know yet).

takevideointent.putextra(mediastore.extra_video_quality, myvideoquality);

so here of solution think should have: 1. either record less size video camera intent in mobile(not working in samsung). 2. or code video upload method in such way upload video in chunks. have send more info video have created custom object handle , have implemented kvmserializable , used marshal also. don't know how send big custom object in chunks.

i have seen this don't find can send add-on info along it. send video file alone.

if not clear plenty please allow me know more info should provide.

here code using upload video :

private string savemedia(string email, byte[] media, string mediatype, string mediaext) { soapserializationenvelope envelope; soapobject request = new soapobject( helpmeconstant.wsdl_target_namespace, "savemedia"); // log.i(tag, "email : " + email + ", media : " + media + "mediatype : " + mediatype + ",mediaext : " + mediaext); mediaavidance mediainfo = new mediaavidance(); mediainfo.emailid = email; mediainfo.media = media; mediainfo.mediaext = mediaext; mediainfo.mediatype = mediatype; propertyinfo pi = new propertyinfo(); pi.setname("avidanceinfo"); pi.setvalue(mediainfo); pi.settype(mediainfo.getclass()); request.addproperty(pi); envelope = new soapserializationenvelope(soapenvelope.ver11); // log.i("savemedia", "serialising.."); new marshalbase64().register(envelope); envelope.dotnet = true; envelope.headerout = helpermethod.addauthentication(); envelope.implicittypes = true; envelope.setoutputsoapobject(request); httptransportse httptransport = new httptransportse( helpmeconstant.soap_address); object response = null; seek { // log.i("savemedia", "calling service.."); httptransport.call(helpmeconstant.soap_action + "savemedia", envelope); // log.i("savemedia", "getting response.."); response = envelope.getresponse(); } grab (exception exception) { // log.e("savemedia", "i got error :", exception); response = exception.tostring(); } homecoming response.tostring(); }

thanks in advance response.

android web-services video out-of-memory httptransportse

PostgreSQL superuser does not access other databases -



PostgreSQL superuser does not access other databases -

so have 2 superusers, postgres , eric, each own databases. want is, while beingness connected 1 of them, access database (tables more precise) of other. tables of both databases in public schema.

i using query, found on question on forum, without result:

select table_name information_schema.tables table_schema='public'

i have changed owners of databases, offered privileges both roles, nothing. tables of database under user, not both.

any thought missing? thanks.

p.s: using postgresql 9.3, , coding in python 2.7

superusers can access in whole cluster.

this sentence makes no sense:

both databases in public schema.

cluster -> database -> schema -> table. start manual here.

while connected particular database can access tables of particular database. have connect different database work tables there. or can utilize dblink or fdw.

database postgresql python-2.7 root

java - Howto sanitize inputs -



java - Howto sanitize inputs -

i willing utilize "owasp esapi java" sanitize users inputs when submits forms in tomcat webapp.

i used utilize org.apache.commons.lang.stringescapeutils this:

public static string myescapehtml(string s) { string s_escapedstring = null; s_escapedstring = stringescapeutils.escapehtml(s); homecoming s_escapedstring; }

i don't know anymore if plenty protect webapp "reasonably"...

i know lines of code should write utilize owasp esapi sanitize tomcat webapp user inputs.

can give illustration in 1 or several esapi "filters" (escaping?, encoding? ...) applied string sanitize it?

the backend rdbms postgresql.

the tomcat server can either be running on linux server or on windows server.

thank , best regards.

for input validation, you'll utilize this api. if want define own validation rules in validation.properties, technique demonstrated when this question asked.

for output escaping, that's quite easier. preferably when inserting info object sent presentation layer, you'll want utilize string output = esapi.encoder().escapeforhtml(string s); methods. total list of methods defined here.

java input sanitize owasp esapi

cordova - Integrating between phonegap and c on ubuntu platform? -



cordova - Integrating between phonegap and c on ubuntu platform? -

is possible phone call phonegap js c or java , opposite (not android) on ubuntu platform? understand there possibility write plugins on android. possible on ubuntu? in advance.

so solution utilize websockets natural client solution in js , used libwesokets http://libwebsockets.org/trac/libwebsockets server side

ubuntu cordova phonegap-plugins

Android Support Library: Retained Fragment lifecycle -



Android Support Library: Retained Fragment lifecycle -

i'm experiencing perchance unusual behavior retained fragment. situation: i've retained fragment when configuration alter occurs in hosting activity not recreated (i.e., oncreate method not invoked) expect. unusual thing following: if hosting activity recreated due memory pressure level (you can forcefulness opening many other apps depending on ram available on device) receives bundle != null in oncreate , oncreate method of retained fragment called too. seems unusual me given retained fragment. can find docs related behavior?

if reproduce behavior can seek back upwards library sample "retain instance" declared in "fragmentretaininstancesupport.java"

thanks help.

if hosting activity recreated due memory pressure level (you can forcefulness opening many other apps depending on ram available on device) receives bundle != null in oncreate , oncreate method of retained fragment called too

well if there memory problem resulted in activity beingness killed wouldn't have high hopes fragment. if app killed, nil survives. cannot escape lifecycle. may able cut down chances of fragment or activity beingness recreated, cannot prevent it.

you have programme app in mind. may killed @ moment, app needs survive without exceptions , cannot depend on not beingness recreated or killed.

android android-fragments android-support-library

webdeploy - Visual studio 2013 web publish to web deploy 3.0 -



webdeploy - Visual studio 2013 web publish to web deploy 3.0 -

is possible publish web application server web deploy 3.0 visual studio 2013 ? know visual studio 2013 ships web deploy 3.5, unable find info if going able publish web deploy 3.0

visual-studio-2013 webdeploy

javascript - Callback inside nested function -



javascript - Callback inside nested function -

i'm trying understand this code

i have simplified code below , trying understand how utilize function callback.

function test(text, callback) { function test2() { callback(text); } }

and phone call with

test('sometext', function(response) { console.log(response); });

however test2 never gets called.

how can phone call test2 callback?

you need phone call text2. @ moment define it. there various ways this. simplest phone call function is:

function test(text, callback) { (function test2() { callback(text); })(); }

note (); @ end of definition , parentheses around it. phone call test2 when test run.

another way same thing phone call after defining it:

function test(text, callback) { function test2() { callback(text); } test2(); }

alternatively, can utilize test mill test2 , homecoming , phone call @ later date:

function test(text, callback) { homecoming function test2() { callback(text); } } var f = test('logged', console.log); f();

in illustration link not clear me how callback called because doesn't gettokenandxhr ever called. perhaps there magic going on in chrome browser calls via reflection of somekind.

javascript callback

Google Spreadsheets: Script to check for completion of ImportHTML -



Google Spreadsheets: Script to check for completion of ImportHTML -

i trying scrape info of website 1 time day automatically. in google spreadsheets, utilize =importhtml() function import info tables, , extract relevant info =query(). these functions take between 10 , 30 seconds finish calculation, every time open spreadsheet.

i utilize scheduled google apps script, re-create info different sheet (where stored, can run statistics) every day.

my problem having problem create script wait calculations finished, before info copied. result script copies error message "n/a".

i tried adding utilities.sleep(60000);, didn't work.

is possible create loop, checks calculation finish? tried without success:

function checkforerror() { var spreadsheet = spreadsheetapp.getactive(); var source = spreadsheet.getrange ("today!a1"); if (source = "n/a") { utilities.sleep(6000); checkforerror(); } else { movevaluesonly(); } }

locks this. lock services in docs. utilize public lock.

google-apps-script google-spreadsheet scrape

How to load font in java? -



How to load font in java? -

i want include font called fixedsys in game , code utilize :

try{ font myfont = null; file fontfile = new file("fixedsys.ttf"); if(fontfile.exists()){ myfont = font.createfont(font.truetype_font, fontfile).derivefont(font.plain, 22f); graphicsenvironment ge = graphicsenvironment.getlocalgraphicsenvironment(); ge.registerfont(myfont); system.out.println("not null"); }else{ system.out.println("file not exist"); } } grab (fontformatexception e) { // todo auto-generated grab block e.printstacktrace(); } grab (ioexception e) { // todo auto-generated grab block e.printstacktrace(); }

for reason, java thinks file not exist , prints out file not exist line. have searched through google , stackoverflow none of work when utilize :

mycomponent.setfont(myfont);

i error saying:

cannot find variable myfont

i have checked on , on , on nil seems wrong.

edit : removed if(file.exists()) line , different error. :

cannot read fixedsys.ttf !

edit 2 : ug_'s comment proved right. java looking in wrong folder file. thanks.

the myfont variable local variable within grab block , hence doesn't exist anywhere else.

you have create class variable utilize outside grab block.

like so:

class someclass { // declare here private font myfont; public someclass() { try{ // initialize here file fontfile = new file("fixedsys.ttf"); if(fontfile.exists()){ myfont = font.createfont(font.truetype_font, fontfile).derivefont(font.plain, 22f); graphicsenvironment ge = graphicsenvironment.getlocalgraphicsenvironment(); ge.registerfont(myfont); system.out.println("not null"); }else{ system.out.println("file not exist"); } } grab (fontformatexception e) { // todo auto-generated grab block e.printstacktrace(); } grab (ioexception e) { // todo auto-generated grab block e.printstacktrace(); } } // somewhere else: mycomponent.setfont(myfont); }

java

How to extract different file versions between two tags in Git? -



How to extract different file versions between two tags in Git? -

methods mentioned here get list of new commits between 2 tags in git? gives me list of diff files.

however, have constraint can't checkout every time tag because need serve more 1000 request/sec asking diff files between different tags. there method available accomplish this?

for example, have 3 tags:

1.0 1.1 1.2

now assume file one.txt changes in tags , head on latest tag (1.2). when

git diff 1.0 1.1 --stat

it returns me file name one.txt know one.txt changed, , can grab file. however, one.txt on tag 1.1, need checkout first @ 1.1, otherwise latest one.txt, here need avoid checkout , one.txt on 1.1.

please suggest solution?

solution 1: git checkout

using git checkout revision specifier branch, tag, or commit sha, along filepath, checkout revision of file working copy:

git checkout <tag> -- <filepath>

note modifies version of 1 particular file. rest of working re-create not affected.

documentation

from official linux kernel documentation git log (summarized):

git checkout [-p|--patch] [<tree-ish>] [--] <pathspec>…

when <paths> or --patch given, git checkout not switch branches. updates named paths in working tree index file or named <tree-ish> (most commit)...the <tree-ish> argument can used specify specific tree-ish (i.e. commit, tag or tree) update index given paths before updating working tree.

solution 2: git show

you can retrieve version of file using git show , outputting results file:

git show <tag>:<filepath> > <outputpath> see also

official linux kernel documentation for:

git log git show what commit-ish , tree-ish in git?

git

jquery - JavaScript Zooming Chart function -



jquery - JavaScript Zooming Chart function -

i write java-script code trace line chart after finishing need modify code allow zooming mouse selection , panning canvas

function zoom(){ startindex = document.getelementbyid("startpoint").selectedindex; endindex= document.getelementbyid("endpoint").selectedindex; var newlabels=oldlabels.slice(startindex, endindex); var newdata=olddatas.slice(startindex,endindex); data.labels= newlabels; data.datasets.data=newdata; mychart = new chart(context).line(data); }

the link chart

learn context.translate , context.scale methods.

knowing these allow pan & zoom.

the basics of zoom are:

translate point want zoom scale canvas desired zoom level erase canvas redraw chart @ -chartwidth/2 , -chartheight/2.

pan easier:

translate x-distance want pan erase canvas redraw chart @ 0,0

javascript jquery html5-canvas zoom linechart

php - text area output format -



php - text area output format -

this question has reply here:

how save user-entered line breaks textarea database? 4 answers

when im using text area output format different input format eg:

input :

hi,

hello world.

it outputs :

hi,hello world

what changes want create code format input.

<html> <head> </head> <body> <form method="get" action="textarea.php"> <pre> <textarea name="name"> </textarea> </pre> <input type="submit" name="submit"> </form> <?php if(isset($_get['submit'])) { $name=$_get['name']; echo $name; } ?> </body> </html>

it looks need nl2br in php.

if(isset($_get['submit'])) { $name=$_get['name']; echo nl2br($name); }

also, quentin mentioned, should not echoing user input onto form because ripe xss disaster, hope exercise you.

php html

html - Photo album with a horizontal scrollbar -



html - Photo album with a horizontal scrollbar -

could please explain me why 2nd, 3rd , 4th images in jsfiddle smaller , smaller in size?

http://jsfiddle.net/fdhl6/

here html jsfiddle.

<div id="album"> <table border="1"> <tr> <td><img src="http://i.imgur.com/dj7aqdo.jpg"/></td> <td><img src="http://i.imgur.com/dj7aqdo.jpg"/></td> <td><img src="http://i.imgur.com/dj7aqdo.jpg"/></td> <td><img src="http://i.imgur.com/dj7aqdo.jpg"/></td> <td><img src="http://i.imgur.com/dj7aqdo.jpg"/></td> </tr> <tr> <td>caption 1</td> <td>caption 2</td> <td>caption 3</td> <td>caption 4</td> <td>caption 5</td> </tr> </table> </div>

here css.

#album { overflow: auto; } #album td { width: 40%; } #album img { width: 100%; }

i trying create photo album horizontal scrollbar in #album div. want each image 40% of width of page. now, width, 2 , half image fit in page. want scrollbar appear remaining pictures in #album div. #album div should not exceed width of page.

don't utilize tables this. nowadays own problems.

http://jsfiddle.net/michaelburtonray/fdhl6/2/

html

<div id="album"> <ul class="stage"> <li class="image-wrapper"> <img src="http://i.imgur.com/dj7aqdo.jpg"/> <span>caption 1</span> <li class="image-wrapper"> <img src="http://i.imgur.com/dj7aqdo.jpg"/> <span>caption 2</span> <li class="image-wrapper"> <img src="http://i.imgur.com/dj7aqdo.jpg"/> <span>caption 3</span> <li class="image-wrapper"> <img src="http://i.imgur.com/dj7aqdo.jpg"/> <span>caption 4</span> <li class="image-wrapper"> <img src="http://i.imgur.com/dj7aqdo.jpg"/> <span>caption 5</span> </ul> </div>

css

#album { overflow: auto; } ul.stage { padding-left: 0; white-space: nowrap; width: 200%; } li.image-wrapper { display: inline-block; width: 20%; } img { display: block; width: 100%; } span { display: block; }

html css

move an object into left and right in screen with moving mouse pointer in java programming -



move an object into left and right in screen with moving mouse pointer in java programming -

i writing game in java language,in game have gun want move right , left,do without clicking mouse,as mouse pointer moves right gun moves right , left side.how can using mouse listener ? thanks.

what should here create mousemotionlistener , implement method mousemoved(mouseevent e). on whatever gui component draws gun (i'm assuming extends java.awt.component), phone call addmousemotionlistener() listener made. can phone call e.getx() , e.gety() in mousemoved() coordinates of mouse , pass them somehow gun object.

java

Django rest framework - PrimaryKeyRelatedField -



Django rest framework - PrimaryKeyRelatedField -

i next django rest framework tutorial, , @ point here: http://www.django-rest-framework.org/tutorial/4-authentication-and-permissions#adding-endpoints-for-our-user-models

my code userserializer looks like:

class userserializer(serializers.modelserializer): snippets = serializers.primarykeyrelatedfield(many=true, read_only=true) class meta: model = user fields = ('id', 'username', 'snippets')

i trying understand primarykeyrelatedfield exactly. doing changing code follows , refreshing url http://127.0.0.1:8000/users/ see different outputs

variation 1

snippets = serializers.relatedfield(many=true, read_only=true) { "count": 1, "next": null, "previous": null, "results": [ { "id": 1, "username": "som", "snippets": [ "snippet title = hello", "snippet title = new2" ] } ] }

this printing out __unicode__() value of snippets. expected this

variation 2 - using primarykeyrelatedfield

snippets = serializers.primarykeyrelatedfield(many=true, read_only=true) { "count": 1, "next": null, "previous": null, "results": [ { "id": 1, "username": "som", "snippets": [ 1, 2 ] } ] }

this prints out primary key id of 2 snippets - i don't understand this

variation 3 - commenting out produces

#snippets = serializers.primarykeyrelatedfield(many=true, read_only=true) { "count": 1, "next": null, "previous": null, "results": [ { "id": 1, "username": "som", "snippets": [ 1, 2 ] } ] }

from serializer docs

the default modelserializer uses primary keys relationships

if don't specify primarykeyrelatedfield used under hood, variation 2 expected output.

hopefully helps.

django django-rest-framework

php - Allowed memory size of 268435456 bytes exhausted with array -



php - Allowed memory size of 268435456 bytes exhausted with array -

i trying create function generate possible combinations. part works output

aaa aab aac aad ...

but trying add together extension each of combinations want add together "hi" @ end like

aaahi aabhi aachi aadhi

iv tried next im getting error. there improve way doing?

fatal error: allowed memory size of 268435456 bytes exhausted (tried allocate 100663409 bytes)

here script

function sampling($chars, $size, $combinations = array()) { # if it's first iteration, first set # of combinations same set of characters if (empty($combinations)) { $combinations = $chars; } # we're done if we're @ size 1 if ($size == 1) { homecoming $combinations; } # initialise array set new values in $new_combinations = array(); # loop through existing combinations , character set create strings foreach ($combinations $combination) { foreach ($chars $char) { $new_combinations[] = $combination. $char; $new_combinations[] = implode($new_combinations, "hi"); } } # phone call same function 1 time again next iteration homecoming sampling($chars, $size - 1, $new_combinations); } // illustration $chars = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'); $output = sampling($chars, 3); foreach($output $do) { echo $do."<br>"; }

this not clear going do, first of all, using implode() incorrectly. first argument must $glue , sec array.

string implode ( string $glue , array $pieces )

secondly, $new_combinations array growing progressively on each step.

but if understood going do, code work you:

<?php function sampling($chars, $size, $combinations = array()) { // if it's first iteration, first set // of combinations same set of characters if (empty($combinations)) { $combinations = $chars; } // we're done if we're @ size 1 if ($size == 1) { homecoming $combinations; } // initialise array set new values in $new_combinations = array(); // loop through existing combinations , character set create strings foreach ($combinations $combination) { foreach ($chars $char) { $tmp = $combination. $char; if ($size == 2) { $tmp .= '.com'; } $new_combinations[] = $tmp; // don't going line, // looks logical bug in code //$new_combinations[] = implode(".com", $new_combinations); } } // phone call same function 1 time again next iteration homecoming sampling($chars, $size - 1, $new_combinations); } // illustration $chars = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'); $output = sampling($chars, 3); foreach($output $do) { echo $do."<br>".php_eol; }

php arrays combinations memory-limit

ssl - Https with self-signed certificate in Android over Restlet -



ssl - Https with self-signed certificate in Android over Restlet -

i'm trying implement simple androd client restlet thesis.evrything works on http have work on https self-signed certificate , have problems. unable find helpful articles or similar how implement on android restlet. know how code android developers need restlet classes.

i managed implement code execute method ( though slow, takes 20-30 seconds info server) have problems set method. used next code implement https client

private static clientresource makeinstance(string url, context con) { reference reference = new reference(url); log.d("url", url); string keystorefileabsolutepath = preferencemanager .getdefaultsharedpreferences(con).getstring( constants.pref_key_keystore_file_path, ""); system.setproperty("javax.net.ssl.truststore",keystorefileabsolutepath); system.setproperty("javax.net.ssl.truststorepassword", "ks090278d"); system.setproperty("ssl.trustmanagerfactory.algorithm", javax.net.ssl.keymanagerfactory.getdefaultalgorithm()); org.restlet.context context = new org.restlet.context(); context.getattributes().put("hostnameverifier", new hostnameverifier() { @override public boolean verify(string arg0, sslsession arg1) { homecoming true; } }); clientresource resource = new clientresource(context, reference); engine.getinstance().getregisteredclients().clear(); engine.getinstance().getregisteredclients() .add(new httpclienthelper(null)); resource.release(); homecoming resource; }

and i'm using this

clientresource request = new clientresource(url); request.setretryattempts(0); series<header> responseheaders = (series<header>) request.getresponse() .getattributes().get("org.restlet.http.headers"); if (responseheaders == null) { responseheaders = new series(header.class); request.getrequestattributes().put("org.restlet.http.headers", responseheaders); } responseheaders.add(new header("accept", "application/json;")); responseheaders.add(new header("content-type", "application/json;")); responseheaders.add(new header("authorization", "basic zxn0dwrlbnq6yw5kcm9pza==;")); seek { request.put(new jsonrepresentation(jsonstring)); response response = request.getresponse(); if (response != null) { log.d("response", "http response: " + response.tostring()); responsehandler .handleresponse(response); } } grab (exception e) { }

when execute request i'm getting "internal server error - 500". i'm using same code method insted of

request.put(new jsonrepresentation(jsonstring));

i'm doing

request.get();

and works (though slow mentioned above).

i checked if due error server think not because managed appropriate response when i'm using code similar code android developers , when i'm trying execute set same url restclient in chrome.

can give me suggestions how work? i'm not sure if aproach begin with, may i'm gooing in wrong direction start. thnaks in advance.

android ssl restlet self-signed

php - Changing And Or Removing App Folder in CI -



php - Changing And Or Removing App Folder in CI -

in codeigniter have name path application folder. $application_folder = 'application' when leave blank not work. because have copied contents of application folder , set in same directory index.php

how create work having contents of application folder on same directory index.php

try:

$application_folder = "./";

"./" = current directory

php codeigniter

css3 - SVG icons blur/unblur in chrome during any CSS animations -



css3 - SVG icons blur/unblur in chrome during any CSS animations -

see image below. image on left during "resting state", image on right during css3 animation on different element on page (the animation on svg icon though).

the animation simple:

element { -webkit-transform : scale( .8 ); -webkit-transition : .2s; } element:hover { -webkit-transform : scale( 1 ); }

any ideas how prepare this? ideally how create icons "always sharp", "always blurry" work well.

this should job:

element { -webkit-transform : scale(.8) translatez(0); -webkit-transition : .2s; } element:hover { -webkit-transform : scale(1) translatez(0); }

css css3 css-animations

android - How to handle BackPressed key of for Fragment by custom? -



android - How to handle BackPressed key of for Fragment by custom? -

in android app, have used fragment ,but handling key have got problem , construction is,

its user business relationship structure, in that,

1)main wall=> in sub fragment->another fragment -> fragment

2)when click 1 button (friends wall button )which on screen , then, open wall same main wall .

3)from main wall go next screen.

i have maintain stack of fragment taking back, when key pressed. works main wall , friends wall user wall handling goes hard ,

please give me clue or suggestion handling such condition. ,now handle b

this right way using button in actionbar in screenshot below:

@override public boolean onoptionsitemselected(menuitem item) { switch (item.getitemid()) { // respond action bar's up/home button case android.r.id.home: navutils.navigateupfromsametask(this); homecoming true; } homecoming super.onoptionsitemselected(item); }

android android-fragments

regex - before event shutil copy2 -



regex - before event shutil copy2 -

i want utilize own copy2 function when calling shutil.copytree. using regex on dst create new dst(copy , rename). see function header copy2 shutil.copy2(src, dst, *, follow_symlinks=true). if create following:

def my_copy2(???): homecoming copy2(src, newdst...)

what should function header like, , phone call copy2 with? uncertain happens empty * , symlink argument, i.e. care?

this works, not same function signature copy2:

#!/usr/bin/python import shutil def copy_and_rename(src,dst) : homecoming shutil.copy2(src, dst.replace("pdf","zzz")) src_dir="srcjunk" dest_dir="destjunk" shutil.copytree(src_dir, dest_dir, copy_function=copy_and_rename)

you can import module within function or can on script. documentation doesn't explain *. omit it.

from shutil import copy2 def my_copy2(src, newdst, ...) homecoming copy2(src, newdst, ...)

or import within (also import shutil , import shutil.copy2):

def my_copy2(src, newdst, ...) shutil import copy2 homecoming copy2(src, newdst, ...)

you must give plenty parameters function copy2 able run. abut using regex means before using string prepare it, adding suffix, or adding path want store it. can done within function or outside.

regex python-3.x directory

javascript - How to code php file in ajax request to the server using JSON? -



javascript - How to code php file in ajax request to the server using JSON? -

i have next ajax request code

$.getjson('getinfo.php' , 'user=bob', callback );

in getinfo.php how grab user=bob ? thanks.

in getinfo.php how grab user=bob?

$.getjson() send get request data, 'user=bob', included in query-string:

getinfo.php?user=bob

these can accessed by name $_get:

class="lang-php prettyprint-override"><?php $user = $_get['user']; echo json_encode($user); // "bob" ?>

for getjson() request succeed, response need valid json, json_encode() can used generate.

javascript php jquery ajax json

c# - How Ajax post large data to asp.net web form webMethod -



c# - How Ajax post large data to asp.net web form webMethod -

i trying send image using ajax post asp.net web form

function submitfunction() { alert(imgdata_based64string); imgdata_based64string = "test"; $.ajax({ type: "post", contenttype: "application/json; charset=utf-8", url: "webform1.aspx/saveimage", data: "{ 'based64binarystring' :'" + imgdata_based64string + "'}", datatype: "json", success: function (data) { }, error: function (result) { alert("error"); } }); } [system.web.services.webmethod] public static void saveimage(string based64binarystring) { string value = based64binarystring; }

everything ok."test" message arrived server side saveimage function. when tried send actual based64string (after removing "test" dummy message)

data:image/png;base64,ivborw0kggoaaaansuheugaaaoaaaahgcayaaaa10 ....

it never reach server side saveimage function. show below error @ browser developer mode.

failed load resource: server responded status of 500 (internal server error)

finally can solve it, after getting help link.

<configuration> <system.web.extensions> <scripting> <webservices> <jsonserialization maxjsonlength="50000000"/> </webservices> </scripting> </system.web.extensions> </configuration>

c# jquery asp.net ajax http-post

jquery - I tried including iDangerous Swiper in a project that uses Backbone.js with Marionette.js but it doesn't work -



jquery - I tried including iDangerous Swiper in a project that uses Backbone.js with Marionette.js but it doesn't work -

jquery(function(){ //thumbs $('.thumbs-cotnainer').each(function(){ $(this).swiper({ slidesperview:'auto', offsetpxbefore:25, offsetpxafter:10, calculateheight: true, slidesperview:'auto', centeredslides: true, initialslide:7, loop:true, tdflow: { rotate : 40, stretch : -40, depth: 10 } }) }) })

above swiper code utilize idangerous swipe library, doesn't work. confuse add together code in case of marionette js construction ie model, view & controller.

have added swiper dependency in main.js? if needs jquery remember shim too.

jquery html backbone.js marionette

ruby on rails - Capistrano Deploy not fetching latest commit from GitHub -



ruby on rails - Capistrano Deploy not fetching latest commit from GitHub -

when run 'cap production deploy' not getting latest master on server. here lines deploy log:

debug[208486a4] command: ( git_askpass=/bin/echo git_ssh=/tmp/----/git-ssh.sh /usr/bin/env git ls-remote git@github.com:------.git ) debug[208486a4] 3983b992ede90e5957dc9ddb953c4df488354d7d head debug[208486a4] 3983b992ede90e5957dc9ddb953c4df488354d7d refs/heads/master debug[208486a4] finished in 0.832 seconds exit status 0 (successful).

then later on in log:

info[38bea0b3] running /usr/bin/env echo "branch master (at 18306db) deployed release 20140626124746 dean; " >> /home/deploy/royalty/revisions.log on 96.126.121.168 debug[38bea0b3] command: echo "branch master (at 18306db) deployed release 20140626124746 dean; " >> /home/deploy/royalty/revisions.log info[38bea0b3] finished in 0.116 seconds exit status 0 (successful).

i have switched using repo @ assembla github. commit: 18306db lastly commit pushed assembla. new commits after show when view repo on github.

i changed origin url set-url , pushed github.

what missing here?? thanks

finally found question related here: capistrano error tar: not tar archive

and followed advice in sec reply worked me.

logged server , deleted app_name/repo folder (rm -rf /app_name/repo )

ruby-on-rails git github capistrano3

loops - Ruby deep hash looping? -



loops - Ruby deep hash looping? -

i have big nested hash in form below. need loop through , pull out name , url of each repository, can't seem that. suggestions?

code snippet:

repo_json = get_touched_repos() repo_hash = json.parse(repo_json) puts repo_hash.class puts repo_hash['repositories'][0]['name']

the hash:

{ "repositories": [ { "type": "repo", "username": "...", "name": "....", "owner": "...", "homepage": "", "description": "description", "language": "java", "watchers": 2, "followers": 2, "forks": 1, "size": "open_issues": 0, "score": 1.0, "has_downloads": true, "has_issues": true, "has_wiki": true, "fork": false, "private": false, "url": "http://my.domain.com/repo/name", "created": "2012-07-02t17:47:54z", "created_at": "2012-07-02t17:47:54z", "pushed_at": "2014-03-20t20:09:38z", "pushed": "2014-03-20t20:09:38z" }, {....} ] }

you can utilize array#each method this

repo_hash['repositories'].each |repo| puts repo['name'] puts repo['url'] end

ruby loops hash

google analytics - How to get number of visitors who do not bounce back -



google analytics - How to get number of visitors who do not bounce back -

we're using analytics api number of visitors , filter visitors backing right back. there filter that?

i have looked while docs , don't think there filter bounces (i.e. filter uses same definition bounce reports). should possible find close approximation.

one approach filter users whom page depth equals one. not 100% correct, depending on if want count users 1 page interaction events bounces or not. might want combine page depth "session duration equals 0" (as ga cannot compute session duration visitors 1 interaction). give users bounce (your title , questions seem inquire exact opposite things), if want visits without bounces page depth > 1 , session duration > 0.

google-analytics

A weird : java.lang.ArrayIndexOutOfBoundsException: 0 -



A weird : java.lang.ArrayIndexOutOfBoundsException: 0 -

i've got problem dynamic table. here code :

public static object[][] extractsctabledata(hashtable<integer,colis> lcolis) { object[][] tabledata = {{}}; int i=0; set<integer>keyset = lcolis.keyset(); (integer currkey:keyset) { tabledata[i][0]=lcolis.get(currkey).expediteur; tabledata[i][1]=lcolis.get(currkey).nocolis; tabledata[i][2]=currkey; i++; } homecoming tabledata; }

i've got exception , don't know why ... error :

java.lang.arrayindexoutofboundsexception: 0

apperently don't know how declared tab ! weird thing it's have same kind of method ( in other class ) without error. other method :

public static object[][] extractsctabledata(course[] lcourse) throws exceptioncolisinconnu { int nbcourse = lcourse.length; object[][] tabledata = { {} }; (int = 0; < nbcourse; i++) { short nocolis = lcourse[i].nocolis; string etat; org.omg.corba.orb orb; string[] str = {}; orb = org.omg.corba.orb.init(str, null); g_colis g_colis = (g_colis) orb .string_to_object(lcourse[i].iorg_colis); switch (g_colis.demandeetat(nocolis).value()) { case etatcolis._entransport: etat = "en cours"; break; case etatcolis._adestination: etat = "livré"; break; case etatcolis._audepart: case etatcolis._enattentedetransport: etat = "enregistrée"; break; default: etat = "non défini"; break; } tabledata[i][0] = short.tostring(nocolis); tabledata[i][1] = etat; } homecoming tabledata; }

if sombebody see ... guys

there no tabledata[0][1] , tabledata[0][2] because object[][] tabledata = {{}}; defines array dimensions [1][0]

java

Android calculate the area of polygon using canvas drawing(not maps) -



Android calculate the area of polygon using canvas drawing(not maps) -

i utilize codes draw polygon on canvas. want calculate area of polygon. of course of study give measurements of each line. see lot of illustration on maps ı don't convert/adapt on canvas. can showing way or method ?

thanks in advance.

import java.util.arraylist; import java.util.list; import android.app.activity; import android.content.context; import android.graphics.canvas; import android.graphics.color; import android.graphics.paint; import android.graphics.paint.style; import android.graphics.point; import android.os.bundle; import android.view.motionevent; import android.view.surfaceholder; import android.view.surfaceview; public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(new drawingview(mainactivity.this)); } class drawingview extends surfaceview { private surfaceholder surfaceholder; private final paint paint = new paint(paint.anti_alias_flag); private list<point> pointslist = new arraylist<point>(); public drawingview(context context) { super(context); surfaceholder = getholder(); paint.setcolor(color.black); paint.setstyle(style.fill); } @override public boolean ontouchevent(motionevent event) { if (event.getaction() == motionevent.action_down) { if (surfaceholder.getsurface().isvalid()) { // add together current touch position list of points pointslist.add(new point((int) event.getx(), (int) event.gety())); // canvas surface canvas canvas = surfaceholder.lockcanvas(); // clear screen canvas.drawcolor(color.white); // iterate on list (int = 0; < pointslist.size(); i++) { point current = pointslist.get(i); point first = pointslist.get(0); // draw points canvas.drawcircle(current.x, current.y, 5, paint); // draw line next point (if exists) if (i + 1 < pointslist.size()) { point next = pointslist.get(i + 1); canvas.drawline(current.x, current.y, next.x, next.y, paint); canvas.drawline(next.x, next.y, first.x, first.y, paint); c } } // release canvas surfaceholder.unlockcanvasandpost(canvas); } } homecoming false; } } }

here's method calculating area of polygon.

for (int = 0; < points.size(); i++) { float addx = points.get(i).x; float addy = points.get(i == points.size() - 1 ? 0 : + 1).y; float subx = points.get(i == points.size() - 1 ? 0 : + 1).x; float suby = points.get(i).y; total += (addx * addy * 0.5); total -= (subx * suby * 0.5); } homecoming math.abs(total);

android canvas polygon area

GNU Octave: How to make sure vectors in random matrix are unique? -



GNU Octave: How to make sure vectors in random matrix are unique? -

creating mxn matrix of random integer values in gnu octave easy:

k = randi(k, m, n)

where k maximum value.

however, have requirement each column vector in matrix should unique. there clever way ensure in octave? could, of course, loop on columns , calculate pair-wise difference between possible pairing of column vectors. seems bit cumbersome.

does have improve idea?

one options utilize unique eliminate duplicate columns, , compare dimensions of result dimensions of original matrix. note need transpose matrix able utilize rows parameter unique.

# non unique columns octave> k=[1 2 1; 2 2 2] k = 1 2 1 2 2 2 octave> isequal(size(unique(k','rows')), size(k')) ans = 0 # unique columns octave> k=[1 2 3; 2 2 2] k = 1 2 3 2 2 2 octave> isequal(size(unique(k','rows')), size(k')) ans = 1

random matrix unique octave gnu

sql server - How can I drop second Primary Key in MVC model? -



sql server - How can I drop second Primary Key in MVC model? -

i have model has 2 primary key. wanna drop 1 of them got error.

my model;

public class equipment { [key] [column(order = 0)] public int equipmentid { get; set; } [key] [column(order = 1)] public string name { get; set; } }

and wanna drop name columns' key.

public class equipment { [key] public int equipmentid { get; set; } public string name { get; set; } }

when seek that, got error like;

'fk_dbo.employee_equipment_dbo.equipments_equipments_equipmentid_equipments_name' not constraint. not drop constraint. see previous errors.

use should remove db wrong data. info should delete repeat equipmentid row.

sql-server asp.net-mvc asp.net-mvc-4

Serialize a column in mysql php -



Serialize a column in mysql php -

i want serialize column in database named hpriority. using next mysql in php code, apparently statement wrong gives me syntax error:

$hpriorityqueryupdate = mysql_query (" set @counter = 0; update hcontactinfo (@counter := @counter +1) hpr set hpriority = hpr (htype ='$htype') ");

thanks ur help :)

php mysql

android - TextView's ellipsize not working on maxLines = 1 -



android - TextView's ellipsize not working on maxLines = 1 -

i cannot figure out why, able ellipsize working on maxlines=2 , more. displaying few words of description , long string no spaces.

this how textview looks like:

<textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:textcolor="#757575" android:text="@string/gcm_not_registered" android:maxlines="1" android:ellipsize="end" android:id="@+id/login_gcmregistrationtextview"/>

i programatically set text it, depending on maxlines limitation, 2 different results:

the thing changed maxlines, why isn't line filled in first image well?

there 2 ways prepare it:

try alter android:ellipsize="end" attribute android:ellipsize="marquee". try remove android:maxlines="1" android:ellipsize="end" attributes , add together android:singleline="true" attribute.

android textview

asp.net - Cant add bindings to IIS programatically - redirection.config permissions (with a video!) -



asp.net - Cant add bindings to IIS programatically - redirection.config permissions (with a video!) -

here video summary of problem http://screencast.com/t/v6th4burlhv

i trying add together bindings programtically iis code:

public void addbindings(string sitename, string hostname) { servermanager servermgr = new servermanager(); site mysite = servermgr.sites[sitename]; mysite.bindings.add("*:80:" + hostname, "http"); mysite.serverautostart = true; servermgr.commitchanges(); }

and error:

filename: redirection.config error: cannot read configuration file due insufficient permissions description: unhandled exception occurred during execution of current web request. please review stack trace more info error , originated in code. exception details: system.unauthorizedaccessexception: filename: redirection.config error: cannot read configuration file due insufficient permissions asp.net not authorized access requested resource. consider granting access rights resource asp.net request identity. asp.net has base of operations process identity (typically {machine}\aspnet on iis 5 or network service on iis 6 , iis 7, , configured application pool identity on iis 7.5) used if application not impersonating. if application impersonating via <identity impersonate="true"/>, identity anonymous user (typically iusr_machinename) or authenticated request user.

i have addressed permissions on redirection.config (both iusr , iis_iusrs have permissions)

as errors on web.config suggested here http://www.codeproject.com/questions/348972/error-cannot-read-configuration-file-due-to-insuff

but still doesn't work. suggestions much appreciated.

answer

websites don't run under iis group. whoever owns app pool user , user needs permission. or set user in iis_iusrs group.

asp.net iis binding

Tail recursiveness in Scala methods with multiple parameter lists -



Tail recursiveness in Scala methods with multiple parameter lists -

i have next function:

@tailrec def sameprefix[a](length: int)(a: vector[a], b: vector[a]): boolean = { if(length<1) true else{ if(a(length-1)==b(length-1)) sameprefix(length-1)(a, b) else false } }

which checks if 2 vectors have equal first elements, given length check.

i wondering if part calls

sameprefix(length-1)(a, b)

would first create function object sameprefix(length-1) , apply (a,b) it, or if phone call method tail-recursively.

let's see...

$ scala welcome scala version 2.11.1 type in expressions have them evaluated. type :help more information. scala> import scala.annotation._ import scala.annotation._ scala> @tailrec def curried(a: int)(b: int): int = curried(a-1)(b-1) curried: (a: int)(b: int)int scala> :javap curried ... irrelevant output removed ... public int curried(int, int); flags: acc_public code: stack=3, locals=3, args_size=3 0: iload_1 1: iconst_1 2: isub 3: iload_2 4: iconst_1 5: isub 6: istore_2 7: istore_1 8: goto 0 ... irrelevant output removed ...

as can see, there no recursive invocation in bytecode. instead, there goto 0 instruction indicates loop. means tail phone call optimization has taken place.

you'll notice multiple parameter lists have been squashed single parameter list in compiled bytecode, there no intermediate functions involved.

edit: actually, didn't have inspect bytecode 100% sure method has been compiled tco, because @tailrec annotation exists purpose. in other words, if set @tailrec on method , compiles without errors, can 100% sure has been compiled tco.

scala

Display different footer for jasper report summary section -



Display different footer for jasper report summary section -

i using jasper reports 5.5.2. have created study header, detail, footer , summary sections. want display page header , footer (which different <pagefooter>) in summary section.

i know using issummarywithpageheaderandfooter="true" display <pageheader> , <pagefooter> summary section; using it. want different footer summary section. should it? (i have tried <lastpagefooter> tag irrelevant problem.)

edit: summary section goes upto 2-3 pages since displaying html file content there, want pagination intact in summary section.

if know how many pages proceed summary section can utilize next code in look proerty of footer subreport:

if($v{page_number}.intvalue()>3,"summarysectionfooter.jasper","regularfooter.jasper")

3 number of pages proceed summary section. if variable number can utilize other code place right page number here.

jasper-reports