Tuesday, 15 March 2011

excel - return binary code instead of string in response php -



excel - return binary code instead of string in response php -

i want read excel file php , send content client. want changing content type , other html headers forcefulness browser download file instead of showing content. ok , user can download file when tries open contents not displayed in right format , shape. thing comes mind should not send response in unicode string , have in binary format excel can know it. current code :

$filename = $_get['file']; $ext = $_get['type']; $filename .= '.' . $ext; $path = "../generatedreports/" . $filename; header('content-type: application/vnd.ms-excel;'); header('content-disposition: attachment; filename=' . $filename); header("pragma: public"); header("expires: 0"); header("cache-control: must-revalidate, post-check=0, pre-check=0"); header("cache-control: public", false); header("content-description: file transfer"); header("accept-ranges: bytes"); header("content-transfer-encoding: binary"); header("content-length: " . filesize($path)); $size = filesize($path); $f = fopen($path, 'r'); $content = fread($f, $size); echo $content;

any solution?

please seek below code,

echo unicode2utf8(hexdec("00ce")); // result: Î // or function recognize u+ in front end of string, , skip show character function unicodecodepointtochar($str) { if (substr($str,0,2) != "u+") homecoming $str; $str = substr($str,2); // skip u+ homecoming unicode_to_utf8(array(hexdec($str))); } echo unicodecodepointtochar("u+00ce"); // result: Î

php excel binary

How to find resolution of video/image file in Android -



How to find resolution of video/image file in Android -

i want know resolution(height, width) of media file (video/image) in android.

i have file path , can stored in internal or external storage.

i came across apis mediastore, media etc. don't know how utilize them.

can tell me best efficient way retrieve meta info to the lowest degree overhead?

found way:

for video

mediametadataretriever mdr = new mediametadataretriever(); mdr.setdatasource("file_path"); int height = integer.parseint(mdr.extractmetadata(mediametadataretriver.metadata_key_video_height)); int width = integer.parseint(mdr.extractmetadata(mediametadataretriver.metadata_key_video_width));

for image

bitmap bitmap = bitmapfactory.decodefile("file_path"); bitmap.getheight(); bitmap.getwidth();

android

How to set Winforms Devexpress GridView Width 100 Percentage -



How to set Winforms Devexpress GridView Width 100 Percentage -

i have designed windows application. in forms contains gridview both more columns , less columns. want best fit columns , width of gridview 100 percentage.

try following:

mygridview.bestfitcolumns();

gridview devexpress

asp.net - Why Jquery datepicker popup doesn't appear next to the textbox to which it's associated in IE? -



asp.net - Why Jquery datepicker popup doesn't appear next to the textbox to which it's associated in IE? -

i have several textboxes utilize calendar purpose.

function setupdatepicker() { var $alldatepickers = $('.datepicker'); $.each($alldatepickers, function () { $(this).datepicker(); }); });

ff , chrome work fine, i.e. calendar appear under textbox clicked.

but ie, no matter textbox located, calendar appear next first textbox.

any thought why?

jquery asp.net

regex - Sequence in regular expression -



regex - Sequence in regular expression -

how can write regular look meets next requirements: 1) must 1 sequence 7 digits 2) edd or final word somewhere

this should trick :

#[0-9]{7}(edd|final)?# //edd or final optional

or

#[0-9]{7}(edd|final)+# //if edd or final must there

regex

Wordpress if post or blog category statement -



Wordpress if post or blog category statement -

got little problem here on wordpress.

i trying utilize php check whether page on category page or post page if isn't on either else nothing.

the code have is:

<?php if( (!is_category($category)) || (!is_single($post)) ) { ?> something... <?php } ?>

when seek without or category bit works fine. when bring together them code stops working.

i think you're trying test if it's not category and not post. alter status accordingly:

if( (!is_category($category)) && (!is_single($post)) ) {

wordpress post category

c# - Modify file embedded in Class Library then Save file -



c# - Modify file embedded in Class Library then Save file -

i've been researching couple weeks , having hard time figuring out solution, hoping gain insight posting general question here.

i have class library (in case .xll) have embedded resource (a .xlsm). may or may not know, .xlls associated excel when opens .xll loaded instance of excel. in scenario when .xll loaded excel .xll loads re-create of embedded .xlsm. far good. allows me send out that, intents , purposes, appears unusual excel file end users @ workplace.

the problem comes in when user wants able save changes have made excel sheet. if save desktop (using excels built in save function) saved .xlsm. when .xlsm opened 1 time again .xll no longer loaded , .net features included in .xlsm not function.

a couple questions arise @ point. firstly, why not register .xll system? because if registered .xll every time opens excel .xll open, means embedded .xlsm open (remember, that's .xll on start up.) users tend find annoying... :-).

nextly, why not send both files? answer: much disruption end user (just bear me on this). love or hate it, want 1 file open , modify. them .xll version of .xlsm, , prefer retained perception makes explaining myself much easier.

lastly, why not distribute .xll grouping whole , release .xlsms against that? answer: these .xlls sent whole bunch of random places can't command user have on machine, prefer maintain things self contained.

there 2 basic solutions come mind.

option one figure out how recompile .xll on fly .xlsm (probably via instance of .xll), , save .xll place of users choosing. require me create own save method since excel won't help , include me needing intercept effort user makes @ saving can redirect them own save method. problem can't figure out how create .xll recompile itself, since i'll sending .xll out machines don't have sdk on them. , on top of that, forcing user utilize own save method unwelcome disruption (at to the lowest degree in opinion...)

option two create assembly works executable. contain .xlsm .xll , executable load excel , apply .xll it. long executable doesn't need admin privileges, think i'll fine sending them out in place of regular old file (most people around here never see extension anyway, right icon, people can't tell difference). problem can't figure out how link .xlsm assembly without using resource file , turning .xlsm bytecode. puts @ square one.

in essence, alternative 1 requires me figure out how compile on foreign machine , alternative 2 requires me figure how contain whole .xlsm can modify , place was...or @ to the lowest degree putting somewhere executable can find 1 time again easily.

anyway, if made far have eternal gratitude. i'm stuck trying figure out next , hoping can point me in right direction.

thanks in advance.

c# .net excel-dna

android - Library project dependency built as APK -



android - Library project dependency built as APK -

i'm using external library in project.

i downloaded code github , added project eclipse workspace. after went mainapp, added project folder library.

everytime compile mainapp, dependency build apk. when i'm using external library in project, it's same behavior. why happens?

[2013-02-09 20:57:50 - mainapp] installing mainapp.apk... [2013-02-09 20:58:25 - mainapp] success! [2013-02-09 20:58:25 - mainapp] project dependency found, installing: androidbillinglibrary [2013-02-09 20:58:25 - androidbillinglibrary] uploading androidbillinglibrary.apk onto device 'emulator-5556' [2013-02-09 20:58:26 - androidbillinglibrary] installing androidbillinglibrary.apk... [2013-02-09 20:58:29 - androidbillinglibrary] success! [2013-02-09 20:58:29 - mainapp] starting activity de.mainappapp.activities.splashactivity on device emulator-5556 [2013-02-09 20:58:31 - mainapp] activitymanager: starting: intent { act=android.intent.action.main cat=[android.intent.category.launcher] cmp=de.mainappapp/.activities.splashactivity }

i had similar problem, far had next solution:

mark external library library project (as have shown in pic) clean projects , wait till main application project builds using external library unmark "is library" check on external library now can install application

at installation apk of external library , can find easily, since not library project anymore. if still marked, couldn't find apk file library. anyway how trick it. i'm sure there improve solution that, didn't figure out yet !

android eclipse build compilation

Android tabs+swipe fragments redrawing -



Android tabs+swipe fragments redrawing -

i'm using android feature tabs+swipe application. generated of code. have mainactivity, sectionspageradapter , fragment classes. in application have 2 tabs, created 2 different fragment classes each tab. on first tab need fragment spinner in , table values underneath spinner. need on spinner item selection want redraw same type of fragment different values in table.

also cannot utilize layout xml files fragment cause table not have same number of columns or rows. need programmatically design it's view. cannot utilize nested fragments either cause need application destined lower version of android... , nested fragments newest 4.2 ver.

i have written code based on similar questions found here, still have problem. here fragment class emphasis on spinner selection listener.

public class currencylistfragment extends fragment { ... @override public view oncreateview(layoutinflater inflater, final viewgroup container, bundle savedinstancestate) { spinner.setonitemselectedlistener(new onitemselectedlistener() { ... @override public void onitemselected(adapterview<?> arg0, view arg1, int arg2, long arg3) { ... selection = spinner.getselecteditemposition(); fragmenttransaction trans = getfragmentmanager().begintransaction(); fragment fragment = new currencylistfragment(selection); fragment.setarguments(result); trans.replace(container.getid(), fragment); trans.settransition(fragmenttransaction.transit_fragment_open); trans.addtobackstack(null); trans.commit(); } } }

i skipped parts of code.

i don't why not working ... don't error instead of redrawing same fragment on first tab different table values blank fragment.... nil on it.

is there possible solution this?

android fragment gestures redraw

c# - make access modifier one for all members in class -



c# - make access modifier one for all members in class -

have defined such class:

class info { internal string f_source; internal string f_output; internal string password; }

as see, i'm defining access modifier each fellow member in it, explicitly.

does exist way define default access modifier members in class @ once?

maybe, there attribute makes such dream come true... don't know...

i've tried utilize access modifier before class declaration:

internal class info { string f_source; string f_output; string password; }

but, no success!

are suggestions: "how prepare such problem?"

by design asking not possible in c#.

the specifications of c# specifies access modifier utilize if none given. default restricted access modifier that's legal. type straight in namespace (ie not nested type) internal whereas fellow member private unless otherwise specified.

this is, i'm sure, design decision partly based on experience how access modfiers in c++ works. series of bugs can come have specific sections of file declaring private, publicetc. it's lot more expressive have state (or know if not specified it's restricted possible). keeping restricted default fits keeping much possible internal (*) implementation details , exposing need expose

(*) not modifier

c# access-modifiers

javascript - how to select my first child in jQuery -



javascript - how to select my first child in jQuery -

this question has reply here:

jquery first kid of “this” 9 answers

i'm having bit of problem selecting first kid in jquery. i'm trying avoid having lots of if statements. basically, click on button. class selector setup handle click in js. 1 time go js, want kid of item clicked, i'm not having joy.

here's have in js:

$('.itemclicked').click(function(){ var id = $(this).attr('id').first(); // can't find method first() here. if find id, // right id of clicked. var test = id.first(); // tried above seperate id first() method request // no joy either. test.toggleclass("icon-tick"); // ultimate aim, toggle icon-tick class on item // clicked. });

thanks in advance if can help me out here. i'm doing stupid i'm struggling realise is.

your current version doesn't work because .attr('id') returns id string, not jquery object. also, .first() returns first item jquery collection, not children.

so, want:

var test = $(this).children().first();

or:

var test = $('>:first-child', this);

or:

var test = $(this).children(':first');

or (on newer browsers):

var test = $(this.firstelementchild);

in jsperf test chrome 25 .firstelementchild method incredibly fast, it's not available on msie < 9. .children().first()was fastest portable option, , the>:first-child' method very, slow.

javascript jquery css-selectors

ios - Content-Type JSON SIGABRT Error -



ios - Content-Type JSON SIGABRT Error -

i trying parse json, , getting sigabrt error: reason: '[<nsurlrequest 0x7e7e970> setvalue:forundefinedkey:]: class not key value coding-compliant key content-type.

my code is:

self.responsedata = [nsmutabledata data]; nsurlrequest *request = [nsurlrequest requestwithurl: [nsurl urlwithstring:@"http://dmsfw01.dev.com:8082/g.fqi/gvolfqi.svc/search(v)?start=1&count=10"]]; nsstring *contenttype = @"application/json"; [request setvalue:contenttype forkey:@"content-type"]; [[nsurlconnection alloc] initwithrequest:request delegate:self];

what should instead set content-type?

you getting error because using key value coding method tries set property on request name content-type. can not modify nsurlrequest because immutable. utilize nsmutableurlrequest instead , phone call - (void)setvalue:(nsstring *)value forhttpheaderfield:(nsstring *)field.

nsmutableurlrequest *request = [nsmutableurlrequest requestwithurl: [nsurl urlwithstring:@"http://sw730voldmsfw01.vol1dev.com:8082/gvol.fqi/gvolfqi.svc/search(visa)?start=1&count=10"]]; nsstring *contenttype = @"application/json"; [request setvalue:contenttype forhttpheaderfield:@"content-type"];

ios objective-c json nsurlrequest

windows - Different results when R script is automated -



windows - Different results when R script is automated -

the next command executes ghostscript on pdf file. (the pdf_file variable contains path pdf)

bbox <- system(paste( "c:/gs/gs8.64/bin/gswin32c.exe -sdevice=bbox -dnopause -dbatch -f", pdf_file, "2>&1" ), intern=true)

after execution bbox includes next character string.

gpl ghostscript 8.64 (2009-02-03) copyright (c) 2009 artifex software, inc. rights reserved. software comes no warranty: see file public details. processing pages 1 through 1. page 1 %%boundingbox: 36 2544 248 2825 %%hiresboundingbox: 36.395015 2544.659922 247.070032 2824.685914 error: /undefinedfilename in (2>&1) operand stack: execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push dictionary stack: --dict:1147/1684(ro)(g)-- --dict:1/20(g)-- --dict:69/200(l)-- current allocation mode local lastly os error: no such file or directory gpl ghostscript 8.64: unrecoverable error, exit code 1

this string manipulated in order boundingbox dimensions (36 2544 248 2825) isolated , used cropping pdf file. far works ok.

however, when schedule script in task manager (using rscript.exe or rcmd.exe batch), or when script within r chunk , press knit html, bbox gets next character string lacks boundingbox information, , makes unusable:

gpl ghostscript 8.64 (2009-02-03) copyright (c) 2009 artifex software, inc. rights reserved. software comes no warranty: see file public details. processing pages 1 through 1. page 1 error: /undefinedfilename in (2>&1) operand stack: execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push dictionary stack: --dict:1147/1684(ro)(g)-- --dict:1/20(g)-- --dict:69/200(l)-- current allocation mode local lastly os error: no such file or directory

how can on problem , have script run automated?

(the script comes accepted reply that question)

the 2>&1 add together @ end of command sent ghostscript interpreter, not shell. ghostscript interprets file, hence error. used procmon @ process creation:

to create shell interpret it, must prefix command cmd /c, this

> bbox <- system(paste("cmd /c c:/progra~1/gs/gs9.07/bin/gswin64c.exe -sdevice=bbox -dnopause -dbatch -q -f",pdf_file,"2>&1"), intern=true) > print (bbox) [1] "%%boundingbox: 28 37 584 691" "%%hiresboundingbox: 28.997999 37.511999 583.991982 690.839979"

windows r redirect automation ghostscript

jsf - How to get the result List from managed bean to xhtml webpage? -



jsf - How to get the result List from managed bean to xhtml webpage? -

i trying build online exam system. right now, trying search particular question , displaying results on searchresult.xhtml.

i have session bean questionbankfacadebean - selects entity bean questionbank based on id , returns result list, managed bean questonbankbean passes on list xhtml page. trying utilize display result html table, failing so. getting error saying "/searchresult.xhtml @28,99 value="#{question.idquestionbank}": class 'entity.questionbank' not have property 'idquestionbank'." please allow me know missing.

thanks

code: session bean

public list<questionbank> searchquestion (integer questionid){ list <questionbank> results = new arraylist <questionbank>(); seek { results = em.createnamedquery("questionbank.findbyidquestionbank").setparameter("idquestionbank", questionid).getresultlist(); }....

managed bean:

public string searchquestion(){ if (questionid != null ) { questionlist = questionbankfacade.searchquestion(questionid); } if(questionlist != null) questionfound = questionlist.size(); else questionfound = 0; system.out.println("questionfound " + questionfound); homecoming "searchresult.xhtml"; }

searchresult.xhtml:

<h:datatable id ="questiontable" rendered ="#{quizbean.questionfound > 0}" value ="#{quizbean.questionlist}" var="question" binding ="#{quizbean.questiontable}" border ="3" cellspacing ="5" cellpadding ="5" > <h:column> <f:facet name="header"> <h:outputtext value="question "/> </f:facet> <h:commandlink value="#{question.idquestionbank}" action="#{quizbean.retrieve}"/> </h:column>

jsf java-ee xhtml managed-bean

Can someone explain to me what this Array Java program wants me to do? -



Can someone explain to me what this Array Java program wants me to do? -

i stuck on 1 problem on arrays. haven't started programme yet because don't understand wants me do! here problem:

write method called wordlengths accepts string representing file name argument. method should open given file, count number of letters in each token in file, , output result diagram of how many words contain each number of letters. example, next text:

before sorting:

12 23 480 -18 75

hello how feeling today

after sorting:

-18 13 23 75 480

are feeling hello how today you

your method should produce next output console:

1: 0 2: 6 [there should 6 * printed here] 3: 10 [there should 10 * printed here] 4: 0 5: 5 [there should 5 * printed here] 6: 1 [there should 1 * printed here] 7: 2 [there should 2 * printed here] 8: 2 [there should 2 * printed here]

so stackoverflow rather limited, wasn't able show total style of output, in summary, "before sorting:" part followed 2 sentences 1 group, "after sorting:" , 2 sentences below group. "before" , "after" sorting separated 1 space.

i don't how output achieved, that's problem. have feeling 1-8 represents line numbers, 0, 6, 10, etc. represent? because when counted word lengths, exceeded 6 or 10... it'd great help if explain me programme wants me do.

thanks in advance!

1 - 8 length of word (or number, or token); -18 has length 3, , "sorting:" 8.

0, 6, 10... number of occurrences words have length 1, 2, 3...

btw, not question fitting here hope help.

java arrays

Priciples of Unix Domain Socket. How does it works? -



Priciples of Unix Domain Socket. How does it works? -

i doing study unix domain socket. how work. googled many times many keywords results api, scheme calls, how utilize it, examples ... . have read pipe , fifo because unix domain socket said same pipe , fifo still want know more concept/priciples of unix domain socket. how work? (maybe @ kernel level because wiki this:"this allows 2 processes open same socket in order communicate. however, communication occurs exclusively within operating scheme kernel."

i still wonder why unix domain socket documentaries less pipe or fifo? maybe because born many years ago?

could show me ideas or books/links read?

thanks in advance!

unix sockets used other socket types. means, socket scheme calls used them. difference between fifos , unix sockets, fifo utilize file sys calls, while unix sockets utilize socket calls.

unix sockets addressed files. allowes utilize file permissions access control.

unix sockets created socket sys phone call (while fifo created mkfifo). if need client socket, phone call connect, passing server socket address. if need server socket, can bind assign it's address. while, fifo open phone call used. io operation performed read/write.

unix socket can distinguish it's clients, while fifo not. info peer provided take call, returns address of peer.

unix sockets bidirectional. means every side can perform both read , write operations. while, fifos unidirectional: has author peer , reader peer.

unix sockets create less overhead , communication faster, localhost ip sockets. packet don't need go through network stack localhost sockets. , exists locally, there no routing.

if need more details about, how unix sockets works @ kernel level, please, @ net/unix/af_unix.c file in linux kernel source.

sockets unix unix-domain-sockets

c - Search string in an array and return index -



c - Search string in an array and return index -

i have problem in code. after come in string want search, programme crash.

i have checked code, still not figure out went wrong.

would need advice.

#include <stdio.h> #include <string.h> int findtarget(char *string, char *nameptr[], int num); int main() { int index, index2; int size; char *nameptr[100]; char *string[100]; printf("enter number of names: "); scanf("%d",&size); for(index=0; index<size; index++) { printf("enter name: "); scanf("%s", &nameptr[index]); } printf("\nenter string search:"); scanf("%s", &string); index2 = findtarget(string[100], nameptr, size); if ( index2 == -1 ) { printf("\nno - no such name\n"); } else { printf("\nyes - matched index location @ %d\n", index2); } homecoming 0;

}

int findtarget(char *string, char *nameptr[], int num) { int i=0; ( = 0 ; < num ; i++ ) { if (strcmp(nameptr[i],string)==0) { homecoming i; break; } } homecoming -1;

}

the problem in code can described "memory management":

you not allocate memory individual strings you passing addresses of wrong things scanf your utilize of scanf allows buffer overruns you declared string array of 100 strings, not single string you passing string[100] search function

to prepare this, need allocate individual string dynamically using malloc. can utilize temporary buffer , re-create strdup, or pre-allocate 100 characters, , limit scanf it.

here portion of programme needs changing:

char *nameptr[100]; char string[100]; // asterisk gone printf("enter number of names: "); scanf("%d",&size); for(index=0; index<size; index++) { char buf[100]; printf("enter name: "); scanf("%99s", buf); // note limit of 99 buf[99] = '\0'; // create sure it's terminated nameptr[index] = strdup(buf); } printf("\nenter string search:"); scanf("%99s", string); // no ampersand index2 = findtarget(string, nameptr, size); // string, not string[100] (index=0; index<size; index++) { free(names[i]); }

the rest "points style":

you not need break after return in search function you not need initialize i before loop and in loop printing \n @ origin of line discouraged.

c

timer - PostgreSQL and Glassfish EJB__TIMER__TBL table -



timer - PostgreSQL and Glassfish EJB__TIMER__TBL table -

i'm trying utilize timer service provided glassfish. thus, have create table named ejb__timer__tbl , configure jdbc resource in glassfish.

i want store table on postgresql on schema named glassfish. ddl 1 (i replace blob type bytea) :

create schema glassfish; create table glassfish.ejb__timer__tbl ( creationtimeraw bigint not null, blob bytea, timerid varchar(255) not null, containerid bigint not null, ownerid varchar(255) null, state integer not null, pkhashcode integer not null, intervalduration bigint not null, initialexpirationraw bigint not null, lastexpirationraw bigint not null, schedule varchar(255) null, applicationid bigint not null, constraint pk_ejb__timer__tbl primary key (timerid) ); drop role if exists glassfish; create role glassfish noinherit login password '...'; revoke privileges on tables in schema glassfish glassfish; revoke privileges on functions in schema glassfish glassfish; grant usage on schema glassfish glassfish; grant select, insert, update, delete on tables in schema glassfish glassfish; grant execute on functions in schema glassfish glassfish; grant usage on sequences in schema glassfish glassfish; alter user glassfish set search_path 'glassfish';

i configured jdbc pool , resource glassfish :

asadmin create-jdbc-connection-pool --datasourceclassname org.postgresql.ds.pgconnectionpooldatasource --restype javax.sql.connectionpooldatasource --property user=glassfish:password=...:portnumber=5432:databasename=...:servername=localhost jdbc/simpool/glassfish asadmin create-jdbc-resource --connectionpoolid jdbc/simpool/glassfish jdbc/sim/glassfish

and come in jdbc/sim/glassfish in jdbc resource utilize timer service in glassish gui.

each time deploy app, receive exception :

[#|2013-02-18t11:42:42.562+0100|warning|glassfish3.1.2|org.eclipse.persistence.session.file :/e:/softs/serveurs/glassfish3_1122/glassfish/domains/domain1/applications/ejb-timer-service-app/web-inf/classes/___ejb__timer__app|_threadid=58;_threadname=thread-2;|local exception stack: exception [eclipselink-4002] (eclipse persistence services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.databaseexception internal exception: org.postgresql.util.psqlexception: erreur: la relation « ejb__timer__tbl » n'existe pas position : 193 error code: 0 call: select "timerid", "applicationid", "blob", "containerid", "creationtimeraw", "initialexpirationraw", "intervalduration", "lastexpirationraw", "ownerid", "pkhashcode", "schedule", "state" "ejb__timer__tbl" (("ownerid" = ?) , ("state" = ?)) bind => [2 parameters bound] query: readallquery(name="findtimersbyownerandstate" referenceclass=timerstate sql="select "timerid", "applicationid", "blob", "containerid", "creationtimeraw", "initialexpirationraw", "intervalduration", "lastexpirationraw", "ownerid", "pkhashcode", "schedule", "state" "ejb__timer__tbl" (("ownerid" = ?) , ("state" = ?))") @ org.eclipse.persistence.exceptions.databaseexception.sqlexception(databaseexception.java:333) @ org.eclipse.persistence.internal.databaseaccess.databaseaccessor.basicexecutecall(databaseaccessor.java:644) @ org.eclipse.persistence.internal.databaseaccess.databaseaccessor.executecall(databaseaccessor.java:535) @ org.eclipse.persistence.internal.sessions.abstractsession.basicexecutecall(abstractsession.java:1717)

so table ejb__timer__tbl doesn't seem accessible glassfish.

when create project, configure persistence.xml file same credentials pooled connexion above , create simple query select count(*) ejb__timer__tbl, receive 0 connexion established , default schema accessed glassfish espected.

in ${glassfish_root}\glassfish\lib\install\databases there ddls neither postgresql...so doing wrong ?

nb: when test configure service timer mysql jdbc resource, it's work...

thanks help

ok found solution of problem.

i didn't know sql can case sensitive. glassfish calls select ... "ejb__timer__tbl" double quotes have create table named "ejb__timer__tbl" not "ejb__timer__tbl" or else.

the workaround recreate table double quotes :

create table glassfish."ejb__timer__tbl" ( "creationtimeraw" bigint not null, "blob" bytea, "timerid" varchar(255) not null, "containerid" bigint not null, "ownerid" varchar(255) null, "state" integer not null, "pkhashcode" integer not null, "intervalduration" bigint not null, "initialexpirationraw" bigint not null, "lastexpirationraw" bigint not null, "schedule" varchar(255) null, "applicationid" bigint not null, constraint "pk_ejb__timer__tbl" primary key ("timerid") );

postgresql timer glassfish

safari - Broken live mp3 stream from Icecast using mediaelement.js -



safari - Broken live mp3 stream from Icecast using mediaelement.js -

i'm using mediaelement.js live stream our radio station in mp3 format icecast. fine, except odd reports stream won't play in browsers. i've verified won't play in safari 5.1.7/windows (but uses anyway?). far more troubling reports users on windows 7/firefox or chrome, although can't duplicate problem myself.

the icecast stream using port 8000 , wonder if there firewall issues in places blocking port. wouldn't business relationship safari/windows issue.

anyone know deal here be?

thanks, jack

safari streaming mp3 mediaelement.js icecast

php - mysql Update in foreach loop -



php - mysql Update in foreach loop -

i trying figure out how update mysql table array.

the table has 3 fields: id, rate, pol_id. "insert into" works perfect:

foreach ($rates $rn=>$rv) { $sql3=mysql_query("insert `rates` (`rate`, `pol_id`) values ( '$rv', '$polid',)") or die ("unable issue query sql2: ".mysql_error()); }

$rates array dynamic input fields.

so example:

id | rate | pol_id ========================= 1 | 5.6 | 272 2 | 6.3 | 272 3 | 7.9 | 272

now edit values in input fields need update table:

i have tried this:

foreach ($rates $rn=>$rv) { $sql3=mysql_query("update `rates` set `rate`='$rv' `pol_id`='$polid'")or die ("unable issue query sql3: ".mysql_error()); }

but isn't working, updates rows lastly value.

can ypu please help me this?

your $polid variable not beingness changed within foreach loop. causes statement true elements in rates table have same pol_id (specified in $polid). sets value 'all' entries (with pol_id = $polid) lastly value entered (in $rv).

you seek adding sec status statement if know old value of rate this:

$sql3=mysql_query("update `rates` set `rate`='$rv' `pol_id`='$polid' , `rate`={old_value}")or die ("unable issue query sql3: ".mysql_error()); }

a nicer method utilize id column of rates (as guaranteed unique) first performing query retrieve id of entry want , subsequently utilize id in update query.

$query1 = mysql_query("select id rates {your desired condition}; /* assign result of $query1 $id */ $sql3=mysql_query("update `rates` set `rate`='$rv' `pol_id`='$polid' , `id` = $id)or die ("unable issue query sql3: ".mysql_error()); }

you can allow pol_id = '$polid' out of query because of id beingness unique.

php mysql

C/C++ The purpose of static const local variable -



C/C++ The purpose of static const local variable -

in c , c++, advantage of making local const variable static? assuming initialization not utilize other variables, there difference between preserving value between calls, , setting same constant value each call?

could valid c compiler ignore static?

in c++, avoids construction/destruction between calls, there other benefit?

it doesn't take stack-space may benefit if have like:

static const double table[fairly_large_number] = { .... };

obviously, cost of construction can substantial plenty if function called lot, there's value in constructing object once.

c++ c static

How can I check string length before insert in MySQL? -



How can I check string length before insert in MySQL? -

i created table next statements in mysql.

create table users ( username varchar(15) not null primary key, password varchar(15) not null, active bool default true )

so want create 2 trigger on table:

check username , password more 4 or 8 characters. (check minimum length of string in inserting new rows) make regular look check password. illustration want contains both upper case , lower case characters , numbers.

please guide me. lot.

you can utilize stored procedure or trigger test info first mysql not back upwards check constraints unlike other rdbms

the stored procedure approach more obvious because tests before insert/update. triggers can quite opaque code maintenance later

however, i'm more concerned having plain text passwords in database. salt , hash you'd utilize etc?

mysql string triggers minimum

jquery - slider for my drag and drop lists -



jquery - slider for my drag and drop lists -

i have following: http://jsfiddle.net/fckvk/

when pull image 1 of lists in other 1 exstands height of div, don't want that!

when pictures more 4 on 1 list want aciev this:

http://jqueryui.com/slider/#side-scroll

$(function(){ $( "#sortable1, #sortable2" ).sortable({ connectwith: ".connectedsortable" }).disableselection(); });

how can done? thanks

add white-space: nowrap containers:

#sortable1, #sortable2 { list-style-type: none; margin: 0; padding: 0 0 2.5em; margin-right: 10px; white-space: nowrap; }

jsfiddle

jquery

Django editable=False and still show in fieldsets? -



Django editable=False and still show in fieldsets? -

i have image field in models.py...

qr_image = models.imagefield( upload_to="public/uploads/", height_field="qr_image_height", width_field="qr_image_width", null=true, blank=true, editable=false )

when it's editable=false nasty error when trying show it. don't want field editable, want image show in admin 'edit' page i.e. fieldsets

i'm new django, can tell me if possible , point me in right direction here?

thank you.

an easy way accomplish create field read-only in modeladmin: https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.modeladmin.readonly_fields

django django-admin

javascript - option select onchange -



javascript - option select onchange -

this might primitive question, new js/jquery.

i have several different select boxes on page. each of them has image next to, changed, when different alternative selected. however, works fine 1 select box getelementbyid, doesn't work getelementbyclassname many of them, nor want utilize method, since read it's not supported ie8.0. there way create work multiple select boxes within 1 page, without using separate ids each 1 of them?

your help appreciated. here's code.

<img id="color" src="content/1.png"> <select class="mod_select" name="colors" id="changingcolor" tabindex="1" onchange="changeimg()"> <option value="content/1.png">1 thing</option> <option value="content/2.png">2 thing</option> <option value="content/3.png">3 thing</option> </select> <script type="text/javascript"> function changeimg(){ document.getelementbyid('color').src=document.getelementbyid('changingcolor').value } </script>

edit: i'd utilize classes both select , img. within 1 div have particular select alternative alter img next it. possible?

edit 2: works great:

$('.mod_select').on('change', function () { var $this = $(this); var img = $this.prev(); // assuming select next img img.attr('src', $this.val()); });

however, img not next select, think should utilize prevsibling, i'm not sure how. reading jquery api didn't help me much. appreciate help! here's html:

<img src="content/1.png"> <!-- image needs updated new select alternative --> <p>text</p> <div class="moreinfo info_icon left"></div> <!-- div triggers qtip --> <div class="moreinfo_text"> <!-- hidden div shown qtip -- text: $(this).next('.moreinfo_text') --> <img src="content/qtip_img.jpg"> <p>qtip text</p> </div> <select class="mod_select" name="colors" tabindex="1"> <option value="content/1.png">1 thing</option> <option value="content/2.png">2 thing</option> <option value="content/3.png">3 thing</option> </select>

see if works please:

jquery(document).ready(function($){ $('.mod_select').change(function() { $('.mod_select option:selected').each(function() { $('#color').attr('src', $(this).val()); }); }); });

you should add together

<!-- grab google cdn's jquery. fall local if necessary --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script> <script type="text/javascript">/* <![cdata[ */ !window.jquery && document.write('<script type="text/javascript" src="/js/jquery.js"><\/script>') /* ]]> */</script>

to add together jquery.

javascript jquery

Passing a reference to a C++ constructor -



Passing a reference to a C++ constructor -

i have this code:

#include <iostream> using namespace std; struct x { int = 1; }; struct y { x &_x; y(x &x) : _x(x) {} }; // intentionally typoed version of y, without reference in constructor struct z { x &_x; z(x x) : _x(x) {} }; int main() { x x; y y(x); z z(x); cout << "x: " << &x << endl; cout << "y.x: " << &y._x << endl; cout << "z.x: " << &z._x << endl; }

i maintain finding myself forgetting & in constructor of classes of format.

this outputs following:

x: 0xbfa195f8 y.x: 0xbfa195f8 z.x: 0xbfa195fc

why behaviour different in case of y , z?

and why not error initialize x &_x fellow member instance of type x in constructor of y?

a re-create of object created when constructor called, hence different output z.x. lifespan of object limited - exists in constructor. undefined behavior , reference come invalid.

to prevent such behavior in applications practice mark re-create constructor , assignment operator private.

c++ reference

java - Paint Like JComponent Drawing Pad -



java - Paint Like JComponent Drawing Pad -

i have class pad_draw extending jcomponent. constructor

public pad_draw() { this.setdoublebuffered(true); this.setlayout(null); };

the paintcomponent methpod :

public void paintcomponent( graphics g ) { graphics2d = (graphics2d)g; graphics2d.setrenderinghint(renderinghints.key_antialiasing, renderinghints.value_antialias_on); graphics2d.setpaint(color.white); graphics2d.fillrect(0, 0, getsize().width, getsize().height); }

in jframe adding scrollpane:

jscrollpane padscroller = new jscrollpane(); padscroller.setwheelscrollingenabled(true); padscroller.setverticalscrollbarpolicy(scrollpaneconstants.vertical_scrollbar_always); padscroller.sethorizontalscrollbarpolicy(scrollpaneconstants.horizontal_scrollbar_always); padscroller.setpreferredsize(new dimension(200, 100)); padscroller.setminimumsize(new dimension(200, 100)); padscroller.setmaximumsize(new dimension(200, 100)); padscroller.setviewportview(drawpad); content.add(padscroller, borderlayout.center);

but add together content in frame , set size of frame. drawing pad taking whole size whatever needs.

i want specified size (200,100) maintained , want windows paint application has. should able increment size extending corner. extend corner scrollbar gets activated. can give me thought how accomplish it?

the default layout manager jframe, borderlayout not respect preferred sizes of components.

you layout manager does, such boxlayout, , override getpreferredsize in padscroller component:

jscrollpane padscroller = new jscrollpane() { @override public dimension getpreferredsize() { homecoming new dimension(200, 100); } };

regarding increasing size, have @ using mouseadapter , updating property in mousedragged method.

java layout paint jcomponent

android - recording user selections and altering textview strings via java code -



android - recording user selections and altering textview strings via java code -

im new android programming (and java matter). although have grasp on programming concepts.

what im trying exercise help build understanding create simple text adventure. want begin offering user ability select player race or class (which determine how story plays out). plan on doing radio buttons (or perhaps normal button).

my question this. when user selects class (ie: "mage") want selection stored. there want able define conditional statement alter story user given. problem not yet have grasp on process recording users selection, , altering text in textview (or other view)

once know how record variable user chose , test in "if" statement, alter output of view within conditional, on way.

thanks in advance =)

first want create radio grouping in layout xml file , give each radio button id value reference java code this:

<radiogroup android:id="@+id/radgroup"> <radiobutton android:id="@+id/rad1" android:text="radio1"/> <radiobutton android:id="@+id/rad2" android:text="radio2"/> <radiobutton android:id="@+id/rad3" android:text="radio3"/> </radiogroup>

then there utilize if statement or switch statement , altering textview utilize mytextview.settext("mystring") , utilize within each if accomplish different text values.

java android xml eclipse input

google maps api 3 - Draw polygon of 100 pixels on mouseclick -



google maps api 3 - Draw polygon of 100 pixels on mouseclick -

i need draw square polygon of 100x100 screenpixels whereever click on google map (amsterdam, lat 52, lng 4), on every zoomlevel, e.latlng @ center of polygon. tried figure out using fromlatlngtopoint, frompointtolatlng, scale , worldcoordinates, can't polygon drawn. if likes puzzle appreciate solution much. (i want utilize simple start edit polygon more complex shape, not using drawingmanager)

i tried:

google.maps.event.addlistener(map, 'click', function(e) { var scale = math.pow(2, map.getzoom()); var nw = new google.maps.latlng(map.getbounds().getnortheast().lat(),map.getbounds().getsouthwest().lng()); var worldcoordinatenw = map.getprojection().fromlatlngtopoint(nw); var worldcoordinate = map.getprojection().fromlatlngtopoint(e.latlng); var dex = math.floor((worldcoordinate.x - worldcoordinatenw.x) * scale); var dey = math.floor((worldcoordinate.y - worldcoordinatenw.y) * scale); // far good, dex , dey give centerpixel var denw = map.getprojection().frompointtolatlng(new google.maps.point(dex-50,dey-50)); var deno = map.getprojection().frompointtolatlng(new google.maps.point(dex+50,dey-50)); var dezo = map.getprojection().frompointtolatlng(new google.maps.point(dex+50,dey+50)); var dezw = map.getprojection().frompointtolatlng(new google.maps.point(dex-50,dey+50)); var depatharray = [denw, deno, dezo, dezw]; deobjectnew = new google.maps.polygon({ paths: depatharray, strokecolor: '#000000', strokeweight: 1, fillcolor: "#ff0000", fillopacity: 0.3, }); deobjectnew.setmap(map);

});

got it:

var denw = dekaart.getprojection().frompointtolatlng(new google.maps.point((dex-50)/scale+worldcoordinatenw.x,(dey-50)/scale+worldcoordinatenw.y)); var deno = dekaart.getprojection().frompointtolatlng(new google.maps.point((dex+50)/scale+worldcoordinatenw.x,(dey-50)/scale+worldcoordinatenw.y)); var dezo = dekaart.getprojection().frompointtolatlng(new google.maps.point((dex+50)/scale+worldcoordinatenw.x,(dey+50)/scale+worldcoordinatenw.y)); var dezw = dekaart.getprojection().frompointtolatlng(new google.maps.point((dex-50)/scale+worldcoordinatenw.x,(dey+50)/scale+worldcoordinatenw.y));

google-maps-api-3

Benchmarking with Python -



Benchmarking with Python -

i looking utilize python scheme benchmark other process's time, info i/o, correctness, etc. interested in accuracy of time. example

start = time() subprocess.call('md5sum', somelist) end = time() print("%d s", end-start)

would sub process add together considerable overhead function beingness called.

edit

well after few quick tests appears best alternative utilize subprocess have noted included stdout/stderr communicate phone call adds 0.002338 s time execution.

use timeit

import timeit timeit.timeit('yourfunction')

update

if in linux, can utilize time command, this:

import subprocess result = subprocess.popen(['time', 'md5sum', somelist], shell = false, stdout = subprocess.pipe, stderr = subprocess.pipe).communicate() print result

python

c# - dependency inject in to an automapper resolver -



c# - dependency inject in to an automapper resolver -

i working automapper in c# mvc4 application. utilize map dto objects view models.

i have created custom resolver resolve particular property of dto model property.

i working spring.net dependency injection , wondering possible inject straight in custom resolver?

you can part of automapper configuration this:

mapper.initialize(cfg => { cfg.constructservicesusing(objectfactory.getinstance); });

this illustration structuremap, parameter func<type, object> sure there in spring.net can similar job.

c# asp.net-mvc-4 dependency-injection automapper spring.net

nhibernate - Why does cascade SaveUpdate triggers a Delete statement? -



nhibernate - Why does cascade SaveUpdate triggers a Delete statement? -

this related question asked previously.

in request mapping have set saveupdate due , in discount mapping have cascade set none.

there 2 scenarios:

the first new request , new discount. created both added discount request , saved request; works expected.

next scenario new request , existing discount. not working right , i'm unsure why. below sql statements ran in test (omit values):

nhibernate: insert requests nhibernate: select @@identity nhibernate: insert discountrequests (discountid, requestid) values (3, 5); nhibernate: update discounts nhibernate: delete discountrequests discountid = 3;

the final line issue: going , deleting insert line 3. command applying request object session.save(request);, nil else.

would there reason why phone call delete made?

edit:

update code

public void add(request request) { using (isession session = nhibernatehelper.opensession()) { using (itransaction transaction = session.begintransaction()) { session.save(request); transaction.commit(); } } }

discount mapping

<join table="discountrequests" optional="true"> <key column="discountid" /> <many-to-one name="request" column="requestid" cascade="none" /> </join>

request mapping

<join table="discountrequests" optional="true"> <key column="requestid" /> <many-to-one name="discount" column="discountid" cascade="save-update" /> </join>

ttp://stackoverflow.com/questions/14837373/zero-to-one-relationship-nhibernate-mapping

i disagree accepted reply earlier question; see this article explanation of bring together mapping.

i model simple many-to-many relationship (or 2 one-to-manys if discountrequest has additional data). can map collections fields , enforce rule discount has 0 or 1 request (and vice versa) through public property. if it's many-to-many cascade setting should none.

for example:

public class request { private icollection<discount> _discounts; public request() { _discounts = new hashset<discount>(); } public discount { { homecoming _discounts.singleordefault(); } set { _discounts.clear(); if (value != null) { _discounts.add(value); } } }

nhibernate nhibernate-mapping nhibernate-cascade

jQuery Mobile swipe not working -



jQuery Mobile swipe not working -

i working on create own image gallery project. need swipe event. found below code on jsfiddle. inserted necessary files. shows list , all.. still swipe not working.? writing jquery code in right place? or wrong? here`s code:

<html> <head> <meta charset="utf-8" /> <title>home</title> <!-- meta viewport tag adjust mobile screen resolutions--> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> <link rel="stylesheet" type="text/css" href="css/style.css" /> <link rel="stylesheet" type="text/css" href="css/jstyle.css" /> <link rel="stylesheet" type="text/css" href="css/jquery.mobile.theme-1.2.0.css" /> <link rel="stylesheet" type="text/css" href="http://code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.css" /> <script type="text/javascript" src="javascript/jquery1.js"></script> <script type="text/javascript" src="javascript/jquery2.js"></script> <script type="text/javascript" src="css/jq1.6.2.js"></script> <script type="text/javascript"> $("#listitem").swiperight(function() { $.mobile.changepage("#page1"); }); </script> </head> <body> <div data-role="page" id="home"> <div data-role="content"> <ul data-role="listview" data-inset="true"> <li id="listitem"> swipe right view page 1</a></li> </ul> </div> </div> <div data-role="page" id="page1"> <div data-role="content"> <ul data-role="listview" data-inset="true" data-theme="c"> <li id="listitem">navigation</li> </ul> <p> page 1 </p> </div> </div> </body>

try pageinit handler jquery mobile:

$(document).on('pageinit', function(event){ $("#listitem").swiperight(function() { $.mobile.changepage("#page1"); }); });

docs paginit @ jquery mobile.

from docs:

take @ configuring defaults

because jquery-mobile event triggered immediately, you'll need bind event handler before jquery mobile loaded. link javascript files in next order:

<script src="jquery.js"></script> <script src="custom-scripting.js"></script> <script src="jquery-mobile.js"></script>`

jquery jquery-mobile

Linux based PHP install connecting to MsSQL Server -



Linux based PHP install connecting to MsSQL Server -

what best way connect via php on linux box remote microsoft sql server.

the php ever run on linux box.

i've been trawling simplest reply while now.

you must install mssql driver php on linux. best tutorial you.

php sql-server linux

web applications - Google Earth or Google Maps? -



web applications - Google Earth or Google Maps? -

i have 3 weeks develop prototype. bascially fleet management system, browser based. tracking tractors in open country, using low info rate satellite modems study vehicle location on regular basis.

i struggling grip on whether want utilize google earth or google maps:

ease of implementation (php/html 5, pulling info mysql database) tracking each vehicle, drawing line, toggle display of time and/or distance travelled @ each location visual appeal user (given open country, no real landmarks) available overlays (rainfall, temperature data, elevation, etc) anythign else?

i toally @ loss on mapping part (the reast can do). 1 of google earth / maps "best " for me? (not wanting start religious war)

is possible utilize both , toggle between them?

any other advice? googling crazy , might not post question before doing more research, dealine ricdicuous. @ 16 hr days , need of help , advice can get. will have live decision create , don't want create hasty 1 based on scant knowledge.

thanks in advance...

[update] oic. google earth pc applicaion , gogole maps browser based. well, guess that answers that, then.

[update] sigh! it's of head of company uses i-pad end users have windows desktops. wants browser based "just in case" wants @ (which might twice in first week , never again). why seem way?

to identify right solution, first need identify target audience app.

will users of web-based app using desktops, ipads, or mobile devices have google earth available? will intented users using big screens located @ info center (google earth or google maps work) or remote users in field (google maps might best improve fit)? not mobile devices back upwards google earth application , mobile devices have limited feature set. google maps api, on other hand, run on web browsers multiple of devices.

see details:

google earth mobile http://www.google.com/earth/explore/products/mobile.html

google maps mobile http://www.google.com/mobile/maps/

also note if utilize google earth api can mashup earth , maps in single web application 1 time again requires platforms back upwards google earth client.

here's sample demo seek out:

http://earth-api-samples.googlecode.com/svn/trunk/demos/drive-simulator/index.html

google-maps web-applications google-earth

android - Using a rotation matrix to convert euler units to 360 degrees -



android - Using a rotation matrix to convert euler units to 360 degrees -

in android, using accelerometer , magnetic field sensor calculate spatial positioning, shown in code below. getrotationmatrix method generates values in real-world units azimuth, pitch , roll. azimuth , roll give values in range of 0 180 or 0 -180. pitch gives values 0 90 or 0 -90. that's problem app because in app need determine unique locations regardless how device oriented. roll, can have 2 locations same value.

i need apply matrix transformation remaps sensor values values range 0 360 degrees (actually, 360 wouldn't valid since it's same 0 , close 360 result in number 359.99999...)

i not mathematician , don't know how utilize matrixes, allow lone utilize them in android aware required 0 360 grade conversion. nice if matrix took care of azimuth , roll produce values 0 360 if isn't possible, that's fine since unique positions can still derived sensor values. suggestions how how create matrix transformation?

@override public void onsensorchanged(sensorevent event) { seek { if (event.sensor.gettype() == sensor.type_accelerometer) accelerometervalues = event.values; else if (event.sensor.gettype() == sensor.type_magnetic_field) magneticfieldvalues = event.values; if ((accelerometervalues != null) && (magneticfieldvalues != null)) { float[] r = new float[9]; float i[] = new float[9]; boolean success = sensormanager.getrotationmatrix(r, i, accelerometervalues, magneticfieldvalues); if (success) { float[] values = new float[3]; sensormanager.getorientation(r, values); // convert radians degrees if preferred. values[0] = (float) math.todegrees(values[0]); // azimuth values[1] = (float) math.todegrees(values[1]); // pitch values[2] = (float) math.todegrees(values[2]); // roll } } } grab (exception ex) { } }

edit: raw event values pitch not give unique values rotate device 360 degrees, highly uncertainty matrix transformation going produce results after. maybe using wrong sensors.

android sensor

php - Submitting the form to itself - Server self or Script name? -



php - Submitting the form to itself - Server self or Script name? -

i want submit form itself. give filename straight i.e hard code it.

but maintain changing filename often. decided utilize function php.

on searching, found out 2 functions:

$_server[script_name] , $_server[php_self] . both homecoming same values.

my question, difference between 2 & of them improve use?

thanks in advance!!

p.s: searched such question pretty well. no results turned me. sorry if has been asked !

don't utilize either. if anything, should utilize $_server['request_uri'] since include query string parameters, unnecessary. form empty action submit per rfc 3986 standards.

php forms

c# - Interfaces cannot declare types -



c# - Interfaces cannot declare types -

i have abstract class in api used methods in assembly. class has nested enum defined within it, bit this:

abstract public class thing { public enum status { accepted, denied, pending }; abstract public status status { get; private set; } etc... }

i decided improve design if thing interface. can't this:

public interface thing { enum status { accepted, denied, pending }; status status { get; } etc... }

this produces error message "interfaces cannot declare types." however, if move definition of enum outside of interface, firstly i'd breaking encapsulation (the status type belongs thing , meaningless on own) , more importantly have go , modify code in many other assemblies utilize this. can think of solutions?

as error indicates, have pull definition of status outside of interface. understand breaks encapsulation, there's no way around this. suggest alter name of status indicates strong relation thing -- thingstatus should trick.

enum thingstatus { accepted, denied, pending }; public interface thing { thingstatus status { get; } etc... }

c#

mysql - #1005 - Can't create table, I looked at every single little thing in it...nothing -



mysql - #1005 - Can't create table, I looked at every single little thing in it...nothing -

this code:

create table phone ( id int not null auto_increment primary key, name varchar(15) not null, stock varchar(15) not null, fk_manufacturerid int not null, index (fk_manufacturerid), foreign key(fk_manufacturerid) references manufacturer (manufacturerid) on delete no action on update no action, fk_osid int not null, index (fk_osid), foreign key(fk_osid) references os (osid) on delete no action on update no action, photographic camera varchar(15) not null, handset varchar(15) not null, screen varchar(15) not null, connectivity varchar(15) not null, batterylife varchar(15) not null, memory varchar(15) not null, messaging varchar(15) not null, soundformat varchar(15) not null, cost int(5) not null, flag varchar(3) not null )engine=innodb

i'm newbie php (i hate it...a lot) , don't problem here...help me please :)

this question implies it's foreign key problem - have checked referenced tables , fields exist, , there's indexes need them? have @ question, might shed lite on similar-sounding problem.

mysql mysql-error-1005

java - javax.mail.MessagingException: Can't send command to SMTP host -



java - javax.mail.MessagingException: Can't send command to SMTP host -

in java mail service send getting next exception

javax.mail.messagingexception: can't send command smtp host; nested exception is: javax.net.ssl.sslhandshakeexception: sun.security.validator.validatorexception: pkix path building failed: sun.security.provider.certpath.suncertpathbuilderexception: unable find valid certification path requested target @ com.sun.mail.smtp.smtptransport.sendcommand(smtptransport.java:1365) @ com.sun.mail.smtp.smtptransport.sendcommand(smtptransport.java:1353) @ com.sun.mail.smtp.smtptransport.ehlo(smtptransport.java:794) @ com.sun.mail.smtp.smtptransport.protocolconnect(smtptransport.java:336) @ javax.mail.service.connect(service.java:258) @ javax.mail.service.connect(service.java:137) @ javax.mail.service.connect(service.java:86) @ javax.mail.transport.send0(transport.java:150) @ javax.mail.transport.send(transport.java:80) @ com.csdcsystems.amanda.common.utility.emailhelper.sendmail(emailhelper.java:244) @ com.csdcsystems.amanda.jems.web.viewmodel.folderemailprintoutputviewmodel.sendemail(folderemailprintoutputviewmodel.java:117) @ com.csdcsystems.amanda.jems.web.viewmodel.folderemailprintoutputviewmodel.sendemail(folderemailprintoutputviewmodel.java:91) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ org.zkoss.bind.impl.paramcall.call(paramcall.java:109) @ org.zkoss.bind.impl.binderimpl.doexecute(binderimpl.java:1508) @ org.zkoss.bind.impl.binderimpl.docommand(binderimpl.java:1261) @ org.zkoss.bind.impl.binderimpl.access$1500(binderimpl.java:95) @ org.zkoss.bind.impl.binderimpl$commandeventlistener.onevent0(binderimpl.java:1145) @ org.zkoss.bind.impl.binderimpl$commandeventlistener.onevent(binderimpl.java:1103) @ org.zkoss.zk.ui.abstractcomponent.onevent(abstractcomponent.java:2734) @ org.zkoss.zk.ui.abstractcomponent.service(abstractcomponent.java:2705) @ org.zkoss.zk.ui.abstractcomponent.service(abstractcomponent.java:2646) @ org.zkoss.zk.ui.impl.eventprocessor.process(eventprocessor.java:136) @ org.zkoss.zk.ui.impl.uiengineimpl.processevent(uiengineimpl.java:1709) @ org.zkoss.zk.ui.impl.uiengineimpl.process(uiengineimpl.java:1494) @ org.zkoss.zk.ui.impl.uiengineimpl.execupdate(uiengineimpl.java:1204) @ org.zkoss.zk.au.http.dhtmlupdateservlet.process(dhtmlupdateservlet.java:558) @ org.zkoss.zk.au.http.dhtmlupdateservlet.doget(dhtmlupdateservlet.java:456) @ org.zkoss.zk.au.http.dhtmlupdateservlet.dopost(dhtmlupdateservlet.java:464) @ javax.servlet.http.httpservlet.service(httpservlet.java:637) @ javax.servlet.http.httpservlet.service(httpservlet.java:717) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:290) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:233) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:191) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:127) @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:102) @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:109) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:293) @ org.apache.coyote.http11.http11processor.process(http11processor.java:859) @ org.apache.coyote.http11.http11protocol$http11connectionhandler.process(http11protocol.java:602) @ org.apache.tomcat.util.net.jioendpoint$worker.run(jioendpoint.java:489) @ java.lang.thread.run(unknown source)

take here:

javax.net.ssl.sslhandshakeexception: sun.security.validator.validatorexception: pkix path building failed: sun.security.provider.certpath.suncertpathbuilderexception: unable find valid certification path requested target

see these relevant threads:

solutions suncertpathbuilderexception

how solve sun.security.provider.certpath.suncertpathbuilderexception?

allowing java utilize untrusted certificate ssl/https connection

unable find valid certification path requested target - error after cert imported

java javamail

java - Getting a random number without the Random library -



java - Getting a random number without the Random library -

i random numbers between range give, problem don't want utilize random library of java or have initializate.

does know alternative way random numbers without using java library?

thanks

edit: think solution?

int random = + (int)(system.currenttimemillis()%((j - i) + 1));

where , j range

you have implement own pseudo-random number generation algorithm, literally reinventing wheel , not secure!

another solution utilize service generates true random numbers like random.org

java dll random

javascript - Confirmation/Success message does not display -



javascript - Confirmation/Success message does not display -

i have simple wishlist script written in javascript adds item wishlist. script adds item user's list can't seem display success message.

i'm using code below seek , display success message.

function additem(todoitem) { if ((todoitem != null) && (todoitem != "undefined" )) { numtodoitems++; setcookie('pt_todoitem'+numtodoitems, todoitem, exp); setcookie('pt_numtodolist',numtodoitems, exp); $(window).humanmsg('added '+todoitem+' wishlist'); } }

can please have @ code , provide me advice?

more info:

my html:

<div class="add-to-wishlist"> <a href="javascript:additem('<?php print htmlentities($title, ent_quotes); ?>')"> <img class="add-to-wishlist" src="/images/add-to-wishlist-button.gif" border="0" /></a> </div>

here humanmsg. plugin jquery

(function($, window){ $.fn.humanmsg = function( message, options ) { homecoming this.each(function(){ var container = == window || == document ? document.body : this; !$.data(container, 'humanmsg') && $.data(container, 'humanmsg', new $.humanmsg (container, message, options) ); }); }; $.humanmsg = function( container, message, options ) { if (typeof message == 'object') { options = message; message = null; } var s = $.extend({}, $.humanmsg.defaults, options); var $m, sizecontainer = container == document.body ? window : container; $m = $('<div class="humanized-message '+s.addclass+'"/>') .html(message || s.message) .click(remove) .appendto(container); $m.css({ display: 'none', visibility: 'visible', top: ($(sizecontainer).height()-$m.innerheight())/2, left: ($(sizecontainer).width()-$m.innerwidth())/2 }) .fadein(s.speed); s.autohide && settimeout(remove, s.autohide); function remove() { $m.fadeout(s.speed, function(){ $m.remove(); $.removedata(container, 'humanmsg'); }); } }; $.humanmsg.defaults = { message: 'no message set', autohide: 3000, addclass: '', speed: 300 }; })(jquery, this);

looking error console have this:

uncaught typeerror: property '$' of object [object window] not function (anonymous function) closing script tag manually

javascript

c++ - Friend declaration for single member instead of whole class? -



c++ - Friend declaration for single member instead of whole class? -

normally in c++ when class declares friendship class b, class b has total access class private members. need allow class b access 1 private fellow member of class , nil else. there way it, maybe new in c++11?

not i'm aware of. if it's of import allow access single member, wrap info in class (c) has exclusively private members, create class friend of b , provide public accessor c object in a.

something this:

template<class t> class mateswithb { friend class b; public: mateswithb( t & val ) : data(val) {} private: t& data; operator t&() { homecoming data; } operator const t&() const { homecoming data; } }; class { // ... mateswithb<int> getprivatethingy() { homecoming mateswithb(thingy); } private: int thingy; // shared class b };

something that. haven't run through compiler check.

but wonder... when find needing this, isn't in design fundamentally flawed?

c++ oop class c++11 friend

ember.js - How to refresh templates in Ember when data is added/removed? -



ember.js - How to refresh templates in Ember when data is added/removed? -

i have simple part of ember application that's supposed draw list of books. issue if user visits list before books loaded server, list empty. after info finishes loading, list still empty.

what methods ember have to refresh view after info loaded? , appropriate place set code? here's code looks like:

route:

app.myroute = ember.route.extend({ model: function() { homecoming app.store.find(app.book); // books server } });

template:

{{#each book in model}} <li {{ bindattr data-book-id="book.id" }}> <span>{{ book.name }}</span> </li> {{/each}}

for record, this:

{{#if model.get('isloaded')}} {{#each book in model}} <li {{ bindattr data-book-id="book.id" }}> <span>{{ book.name }}</span> </li> {{/each}} {{else}} <span>loading books...</span> {{/#if}}

as stated in comment above, {{each}} helper has {{else}} you'd add together spinner list, same way you'd individual item. populating list view, shouldn't have manually phone call method framework responsible populating records in modelarray gave you. if can't populate info when receive json backend api, problem must in store/adapter/serializer or json format. 1 should check sever sending response , how store set (adapter/serializer/etc) in order translate json response ember-data expects valid info app models.

ember.js ember-data

Where does tomcat6 hide its cache? -



Where does tomcat6 hide its cache? -

i have servlet abc.jar re-create $tomcat/webapps, , works fine. next, shutdown tomcat, delete folder abc , war file. when restart tomcat, comes error messages "cannot find folder .../abc", filenotfoundexception , on.

my question: how know should looking "abc"? deleted named directory "temp" , "work" folders, still remembers it. how clean artifacts? tomcat 6, java-1-6-37. tia.

if you've shut downwards tomcat, removed $catalina_home/temp/, $catalina_home/webapps/abc/ , $catalina_home/work/ folders, , removed $catalina_home/webapps/abc.war file; offending remaining reference may $catalina_home/conf/catalina/localhost/abc.xml (copied tomcat web application when deployed it).

this not "cache" such, may cause tomcat folders no longer exist.

there more detailed info @ http://tomcat.apache.org/tomcat-6.0-doc/config/host.html#automatic%20application%20deployment. example:

any web application archive file within hosts's appbase directory not have corresponding context xml descriptor (with ".xml" extension rather ".war" extension) in $catalina_base/conf/[engine_name]/[host_name] scanned see if contains context xml descriptor (located @ /meta-inf/context.xml) , if 1 found descriptor copied $catalina_base/conf/[engine_name]/[host_name] directory , renamed.

tomcat6

How to include view inside view in extjs -



How to include view inside view in extjs -

i working in extjs. have created view as-

ext.define('balaee.view.qb.qbpaper.qbpaper', { extend:'ext.form.panel', requires:[ 'balaee.view.qb.qbpaper.qbpaperview' ], id:'qbpaperid', alias:'widget.qbpaper', title:'qbpaper', //height:180, items:[ { //html:'hiii', xtype:'qbpaperview', }, ],//end of items square buttons:[ { xtype:'button', fieldlabel:'vote', name:'vote', text:'vote', action:'voteaction', } ] });// end of login class

in view including view namely "qbpaperview" giving xtype. view have created as-

ext.define('balaee.view.qb.qbpaper.qbpaperview', { extend:'ext.view.view', id:'qbpaperviewid', alias:'widget.qbpaperview', store:'qb.qbpaperstore', config: { tpl:'<tpl for=".">'+ '<div id="main">'+ '</br>'+ '<b>hii :-</b> '+ //'<b>percentage :-</b> {percentage}</br>'+ '</div>'+ '</tpl>', itemselector:'div.main', } });

but not including other view. have included both views in qbpapercontroller as-

ext.define('balaee.controller.qb.qbpapercontroller',{ extend: 'ext.app.controller', stores: ['qb.qbpaperstore'], models: ['qb.qbpapermodel'], views:['qb.qbpaper.qbpaper','qb.qbpaper.qbpaperview'], refs:[ ], init: function() { this.control({ });//end of command }//end of init() function });//end of controller

so more changes need include other view. please help me..

extjs view

Showing a comma seperated list of Database ID's in that order PHP/MySQL -



Showing a comma seperated list of Database ID's in that order PHP/MySQL -

i have database 2 tables looks this:

categories

name | items --------------------------------- @ home | 3,4,8,9 @ office | 10,3,2,1

items

name | id -------------------------------- prepare auto | 3 mow lawn | 4 garbage | 8 laundry | 9 desk clean | 10

in categories table comma separated numbers represent list of items id.

how sql select selects of items in specific category (e.g. "at home") , orders them in same order items column.

the database has been simplified create question easier understand.

also if can think of improve way organize database type of application know.

customized order critical project

if possible, create 3rd table normalize db, or @ edit below :-)

categories name | id --------------------------------- @ home | 1 @ office | 2 items name | id -------------------------------- prepare auto | 3 mow lawn | 4 garbage | 8 laundry | 9 desk clean | 10 links cat_id | item_id -------------------------------- 1 | 3 1 | 4 1 | 8 1 | 9 2 | 10 2 etc.

then go:

select items.name items left bring together links on items.id = links.item_id items.cat_id = 1 order items.id

i realized operated on assumption every items can in multiple categories. if want 1 item --> 1 category, there's no need 3rd table, add together field items, , 1 custom-ordering:

items

name | id | cat_id | order ----------------------------------------- prepare auto | 3 | 1 | 1 mow lawn | 4 | 2 | 1 kill cat | 9 | 1 | 2 select name items cat_id = 1 order order

php mysql

c# - Can I test real In-App Purchases before submitting to the Store? -



c# - Can I test real In-App Purchases before submitting to the Store? -

building in-app purchases in windows store app requires using in-app purchase simulator. almost identical real in-app purchase namespace. while building app, utilize simulator. have reserved name in store. have created in-app purchase in store app. there way test real iap before submitting app certification?

no, in-app purchases not "real" in windows store until app submitted certification. means final step before submission swap out simulator code real code. and, yes, means cannot test real code - store tester first test you.

one more thing

having said that, created helper class wraps both real , simulator api. though help 90% of utilize cases out there, perfect 90%. have validated code iap product team , submitted real apps utilize it.

you can find helper here: http://codepaste.net/rqwtcy

here's syntax if want remove advertisements, example...

i add together view model this:

public async task start() { // in app purchase setup m_hideadsfeature = await new inapppurchasehelper(hideadsfaeturename, system.diagnostics.debugger.isattached).setup(); this.hideads = m_hideadsfeature.ispurchased; } bool m_hideads = false; public bool hideads { { homecoming m_hideads; } set { setproperty(ref m_hideads, value); } } const string hideadsfaeturename = "hideads"; inapppurchasehelper m_hideadsfeature; // http://codepaste.net/ho9s5a delegatecommand m_purchasehideadscommand = null; public delegatecommand purchasehideadscommand { { if (m_purchasehideadscommand != null) homecoming m_purchasehideadscommand; m_purchasehideadscommand = new delegatecommand( purchasehideadscommandexecute, purchasehideadscommandcanexecute); this.propertychanged += (s, e) => m_purchasehideadscommand.raisecanexecutechanged(); homecoming m_purchasehideadscommand; } } async void purchasehideadscommandexecute() { pausecommandexecute(); await m_hideadsfeature.purchase(); hideads = m_hideadsfeature.ispurchased; } bool purchasehideadscommandcanexecute() { if (m_hideadsfeature == null) homecoming false; homecoming !m_hideadsfeature.ispurchased; }

i add together xaml this:

<ui:adcontrol x:name="myadcontrol" width="250" height="250" horizontalalignment="left" verticalalignment="top" adunitid="10043107" applicationid="d25517cb-12d4-4699-8bdc-52040c712cab" visibility="{binding hideads, converter={staticresource collapsedwhentrueconverter}}" />

best of luck!

c# in-app-purchase windows-store-apps winrt-xaml

iphone - StartUpdatingLocation Vs significant-change location service -



iphone - StartUpdatingLocation Vs significant-change location service -

i having issue regarding significant-change location service.

apple documentation says "whether utilize standard location service or significant-change location service location events, way receive events same."

but in case of "significant-change location service" not able callbacks in case of "standard location service" please allow me know if has inputs?

startupdatinglocation updates location when called first time , when distance filter value exceeds.

but startmonitoringsignificantlocationchanges when important alter in position occurs.

please check cllocationmanager details.

startupdatinglocation

starts generation of updates study user’s current location.

- (void)startupdatinglocation discussion

this method returns immediately. calling method causes location manager obtain initial location prepare (which may take several seconds) , notify delegate calling locationmanager:didupdatelocations: method. (in ios 5 , earlier, location manager calls locationmanager:didupdatetolocation:fromlocation: method instead.) after that, receiver generates update events when value in distancefilter property exceeded. updates may delivered in other situations though. example, receiver may send notification if hardware gathers more accurate location reading.

calling method several times in succession not automatically result in new events beingness generated. calling stopupdatinglocation in between, however, cause new initial event sent next time phone call method.

if start service , application suspended, scheme stops delivery of events until application starts running 1 time again (either in foreground or background). if application terminated, delivery of new location events stops altogether. therefore, if application needs receive location events while in background, must include uibackgroundmodes key (with location value) in info.plist file.

in add-on delegate object implementing locationmanager:didupdatelocations: method, should implement locationmanager:didfailwitherror: method respond potential errors.

startmonitoringsignificantlocationchanges

starts generation of updates based on important location changes.

- (void)startmonitoringsignificantlocationchanges discussion

this method initiates delivery of location events asynchronously, returning shortly after phone call it. location events delivered delegate’s locationmanager:didupdatelocations: method. first event delivered cached location event (if any) may newer event in circumstances. obtaining current location prepare may take several additional seconds, sure check timestamps on location events in delegate method.

after returning current location fix, receiver generates update events when important alter in user’s location detected. example, might generate new event when device becomes associated different cell tower. not rely on value in distancefilter property generate events. calling method several times in succession not automatically result in new events beingness generated. calling stopmonitoringsignificantlocationchanges in between, however, cause new initial event sent next time phone call method.

if start service , application subsequently terminated, scheme automatically relaunches application background if new event arrives. in such case, options dictionary passed locationmanager:didupdatelocations: method of application delegate contains key uiapplicationlaunchoptionslocationkey indicate application launched because of location event. upon relaunch, must still configure location manager object , phone call method go on receiving location events. when restart location services, current event delivered delegate immediately. in addition, location property of location manager object populated recent location object before start location services.

in add-on delegate object implementing locationmanager:didupdatelocations: method, should implement locationmanager:didfailwitherror: method respond potential errors.

note: apps can expect notification device moves 500 meters or more previous notification. should not expect notifications more 1 time every 5 minutes. if device able retrieve info network, location manager much more deliver notifications in timely manner.

iphone ios geolocation location cllocationmanager

c# - Selecting a full row in DataGrid, Silverlight Navigation Application -



c# - Selecting a full row in DataGrid, Silverlight Navigation Application -

this might stupid question haven't been able find reply anywhere.

i trying create possible when user clicks on row in datagrid entire row selected.

in wpf have set selection mode fullrowselect in current project datagrid doesnt have option. 2 options have selectionmode : single or extended.

currently xaml code looks :

<sdk:datagrid x:name="showklant" grid.column="0" autogeneratecolumns="false" canuserreordercolumns="false" isreadonly="true" selectionchanged="showklant_selectionchanged" alternatingrowbackground="#ff4568c7" rowbackground="#aa73a4d4"> <sdk:datagrid.columns> <sdk:datagridtextcolumn header="klant id" binding="{binding klantid}"/> <sdk:datagridtextcolumn header="voornaam" binding="{binding voornaam}"/> <sdk:datagridtextcolumn header="achternaam" binding="{binding achternaam}"/> </sdk:datagrid.columns> </sdk:datagrid>

the reason want when entire row selected can utilize code similar value first cell.

idklant = convert.toint32(showklant.selectedrows[0].cells[0].value);

found solution question, after using error study in search.

link solution: how read value in first cell in selected row of datagrid?

have tried setting selection mode of info grid?

<datagrid x:name="test" selectionmode="single" >

c# xaml datagrid

javascript - Three.js texture for mesh with custom geometry -



javascript - Three.js texture for mesh with custom geometry -

i trying create house geometry , attach different textures faces of geometry. using r55. problem faces material created texture don't appear. faces simple color material appear. if replace material generated rooftexture simple color material, faces using material appear correctly well.

here relevant part of code:

var geom = new three.geometry(); // load roof texture var rooftexture = new three.imageutils.loadtexture('gfx/textures/roof.jpg'); // allow roof texture repeat rooftexture.wraps = rooftexture.wrapt = three.repeatwrapping; rooftexture.repeat.set(10, 10); // materials var materialarray = []; materialarray.push(new three.meshlambertmaterial({color: 0xd3e3f0 })); materialarray.push(new three.meshlambertmaterial({map: rooftexture})); // base of operations edges var edge0 = new three.vector2(obj.ridgelength/2, -obj.buildingdepth/2); var edge1 = new three.vector2(obj.ridgelength/2, obj.buildingdepth/2); var edge2 = new three.vector2(-obj.ridgelength/2, obj.buildingdepth/2); var edge3 = new three.vector2(-obj.ridgelength/2, -obj.buildingdepth/2); // floor geom.vertices.push(new three.vector3(edge0.x, -1, edge0.y)); geom.vertices.push(new three.vector3(edge1.x, -1, edge1.y)); geom.vertices.push(new three.vector3(edge2.x, -1, edge2.y)); geom.vertices.push(new three.vector3(edge3.x, -1, edge3.y)); // eave geom.vertices.push(new three.vector3(edge0.x, obj.eaveheight, edge0.y)); geom.vertices.push(new three.vector3(edge1.x, obj.eaveheight, edge1.y)); geom.vertices.push(new three.vector3(edge2.x, obj.eaveheight, edge2.y)); geom.vertices.push(new three.vector3(edge3.x, obj.eaveheight, edge3.y)); // ridge geom.vertices.push(new three.vector3(obj.ridgelength/2, obj.ridgeheight, 0)); geom.vertices.push(new three.vector3(-obj.ridgelength/2, obj.ridgeheight, 0)); // ground geom.faces.push( new three.face4(0, 0, 0, 0) ); // front end geom.faces.push( new three.face4(0, 3, 7, 4) ); // left side geom.faces.push( new three.face4(0, 4, 5, 1) ); // geom.faces.push( new three.face4(1, 5, 6, 2) ); // right side geom.faces.push( new three.face4(2, 6, 7, 3) ); // left triangle geom.faces.push( new three.face3(4, 8, 5)); // right triangle geom.faces.push( new three.face3(6, 9, 7)); // front end roof geom.faces.push( new three.face4(7, 9, 8, 4) ); // roof geom.faces.push( new three.face4(5, 8, 9, 6) ); // assign materials faces geom.faces[0].materialindex = 0; geom.faces[1].materialindex = 0; geom.faces[2].materialindex = 0; geom.faces[3].materialindex = 0; geom.faces[4].materialindex = 0; geom.faces[5].materialindex = 0; geom.faces[6].materialindex = 0; geom.faces[7].materialindex = 1; geom.faces[8].materialindex = 1; geom.computefacenormals(); obj.house = new three.mesh( geom, new three.meshfacematerial(materialarray) ); obj.house.doublesided = true; obj.house.castshadow = true; obj.sun.shadowdarkness = 1.0; obj.scene.add(obj.house);

what doing wrong?

you missing uv coordinates on geometry. uv coords go 0 1 since creating geometry can assign @ lower left corner uvs (0.0, 0.0) on lower right (1.0, 0.0), top left (0.0, 1.0) , top right (1.0, 1.0). can @ planegeometry.js file see how uvs assigned.

javascript three.js textures

c++ - How can I set Dockwidget floating mode window movable false? -



c++ - How can I set Dockwidget floating mode window movable false? -

i have qdockwidget in floating mode. want floating window steady @ particular location(window should not move threw drag/ or anyway). how can this?

c++ qt

asp.net mvc - Validation stopped working on use of formmethod.post -



asp.net mvc - Validation stopped working on use of formmethod.post -

i trying post external url eg. (www.msn.com) on press of submit button.but when none of valdation works...it create entry without info in external url 2. not going controller when press submit button. don't know if doing wrong...

here code view:

@model n.models.popupdemomodel <script src="@url.content("~/scripts/jquery.validate.min.js")" type="text/javascript"></script> <script src="@url.content("~/scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script> @using (html.beginform("demo","home", formmethod.post, new { @action = "https://www.msn.com?encoding=utf-8/post" })) { @html.validationsummary(true) <fieldset> <input type=hidden name="oid" value=""> <input type=hidden name="returl" value = "test" /> <input type="hidden" name="debug" value=1 /> <input type="hidden" name="debugemail" value = "a@test.com" /> <div class="editor-label grid_2"> @html.labelfor(model => model.first_name) </div> <div class="editor-field grid_3"> @html.textboxfor(model => model.first_name, new { @class = "demo-field-longer" }) </div> <div class="grid_3 error long" style="margin-left:250px"> @html.validationmessagefor(model => model.first_name) </div> <div class="clear"></div> <div class="editor-label grid_2"> @html.labelfor(model => model.email) </div> <div class="editor-field grid_3"> @html.textboxfor(model => model.email, new { @class = "demo-field-longer" }) </div> <div class="grid_3 error long" style="margin-left:250px"> @html.validationmessagefor(model => model.email) </div> <div class="clear"></div> <div class="editor-label grid_2"> @html.labelfor(model => model.phone) </div> <div class="editor-field grid_3"> @html.textboxfor(model => model.phone, new { @class = "demo-field-longer" }) </div> <div class="grid_3 error long" style="margin-left:250px"> @html.validationmessagefor(model => model.phone) </div> <div class="clear"></div> <div class="editor-label grid_2"> @html.labelfor(model => model.company) </div> <div class="editor-field grid_3"> @html.textboxfor(model => model.company, new { @class = "demo-field-longer" }) </div> <div class="grid_3 error long" style="margin-left:250px"> @html.validationmessagefor(model => model.company) </div> <div class="clear"></div> <div class="clear"></div> <div class="grid_2 sub-spacer">&nbsp;</div> <div class="editor-field grid_2 submit"> <input type="submit" value="submit" id="demo-submit-button"/><br /> @viewdata["demomessage"] </div> </fieldset>

here model:

public class popupdemomodel { [required] [email] [displayname("email address")] public string email { get; set; } [required] [displayname("phone number")] public string phone { get; set; } [required] [displayname("contact name")] public string first_name { get; set; } [required] [displayname("company name")] public string company { get; set; } public string messagesent { { homecoming "we'll contact shortly."; } } }

it's doing told to.

the html <form> tag sends post request url in action attribute.

html.beginform() creates <form> tag action attribute points controller.

when set action attribute explicitly, replace value mvc , create go straight url.

asp.net-mvc razor

How to mimic a Ruby on Rails development environment -



How to mimic a Ruby on Rails development environment -

i new ruby on rails development. have been given task create changes existing ruby on rails website, created ror developer. question is, how setup local development environment mimics 1 previous developer used? there files in application guide me in process? such how connect staging database, right local server run, etc..

i have been trying figure out couple of weeks now. on previous project made changes application, pushed staging version on heroku. know horrible way things, had no other choice. and, don't want have 1 time again in instance. help appreciated.

step one: if previous developer didn't leave setup notes, start taking notes on learn, next developer work on project , going quicker.

first, you'll want sure you're using same version of ruby. check project's root .rvmrc or .ruby-version file or similar. might able see version beingness used in prod well.

next, database configuration, in config/database.yml expects find database. typically there 1 development runs on local machine, 1 test, , 1 production, there may others well. in our organization config/database.yml symlink config file in config/databases, , have different setups dev, qa, , production environments, plus custom ones individual developers. if company happens have development mode database in 'central' location, might able configure setup utilize 1 instead of having set on own box.

pay special attending 'test' database settings, database destroyed , recreated each time tests run.

next, run 'bundle install' , create sure gems installed without errors. 1 time have gems installed, might want load rails console create sure environment initializes properly. next, seek running test suite via 'rake test' or 'rake spec'.

hopefully 1 time that's running, you'll able start local server via 'rails s' in console , pointing browser @ localhost:3000. if project uses other services memcached, redis, or foreman, might need additional setup things.

you might read how thoughtbot handles this, plus comments using vagrant.

ruby-on-rails development-environment