Wednesday, 15 August 2012

c++ - Can I use the static keyword to only allocate new memory once? -



c++ - Can I use the static keyword to only allocate new memory once? -

say have function run multiple times. function includes code below:

static int *hello = new int;

will hello allocated first time run?

yes, allocated once.

but allow me suggest else. suppose have function that:

int* get_static_hello() { static int* value = new int; homecoming value; }

well, next (it 1 hundred percent correct):

int* get_static_hello() { static int value; homecoming &value; }

c++ static keyword

ruby - How I can capture values in command line and add to recipe? -



ruby - How I can capture values in command line and add to recipe? -

i new chef , ruby

i need pass 2 variables chef on command line , have variables available in recipe.

how can capture these values , them in chef?

i need this:

before_deploy command execute param1 param2 deploy{ param1/param2}

where param1 , param2 values @ run-time command-line.

when provision machine running

chef-solo

or

chef-client

you cannot provide arguments these commands can visible recipes. chef recipes work attributes. thing (or not good) attributes can set many different places: roles, nodes, environments , json file.

the workaround nearest request is

create json-file on machine pass when running chef-client or chef-solo use attributes in recipe

for example: apache config.

create json file: my_attrs.json

{ "apache": { "listen_port": "81", "listen_path": "/myapp" } }

and utilize them in recipe:

node[:apache][:listen_port] node[:apache][:listen_path]

run chef-client or chef-solo -j flag.

chef-solo -j my_attrs.json

if my_attrs.json on remote server, can provide url.

chef-solo -j http://remote.host/path/my_attrs.json

ruby chef

java - primefaces autocomplete event itemSelect listener value null in ManagedBean -



java - primefaces autocomplete event itemSelect listener value null in ManagedBean -

i using primefaces 3.4.2 autocomplete.

in managedbean when select row type characters in autocomplete, not able value in method handleselect(selectevent event) {

what reason this? ideally fill or populate other columns in jsf page when select row autocomplete values.

jsf code autocomplete

<p:autocomplete value="#{empmb.selectedemployee}" id="basicpojo" minquerylength="3" completemethod="#{mymb.complete}" var="p" itemlabel="#{p.empname}" converter="#{employeenameconverter}" forceselection="true" > <p:ajax event="itemselect" listener="#{mymb.handleselect}" />

managedbean method

public void handleselect(selectevent event) { string value = (string) event.getobject(); system.out.println("selected "+value);

the reason didn't provide itemvalue attribute in p:autocomplete component.

java jsf-2 primefaces

inflection - C++ inflect library -



inflection - C++ inflect library -

i have c++ written code searches between big document base of operations (making utilize of clucene). want create agnostic singular , plural during searches , need inflect words. while working python used inflect lot of times; there c++ library same?

i think search keyword you're looking "stemming". there's c++ library (bsd licensed) linked wikipedia page (i can't comment on library though, haven't used it).

c++ inflection

java - Should I set new TextureRegion for Sprite every frame? -



java - Should I set new TextureRegion for Sprite every frame? -

the animation guide of libgdx in deprecated part, , found no replacement.therefore, intend write convenient animatedsprite class extends sprite. thought in every update (game frame), set new textureregion (or x/y coordinate) corresponding image frame.

i wonder why there no animatedsprite class built-in libgdx? solution have problem? there replacement deprecated sprite animation guide?

you can safely set new part sprite every frame, works wonders:

sprite.setregion(animation.getkeyframe(statetime, true));

java animation 2d libgdx

Optimizing my Django app on Google App Engine -



Optimizing my Django app on Google App Engine -

i'm optimising particular utilize case of django app. first step replace queryset valuesqueryset. worked quite want more. i'm considering using memcache (the app running on google app engine). plan set valuesqueryset in memcache. understanding valuequeryset not yet materialised info structure. in order cache work, valuequeryset needs materialise first , set in memcache.

according django docs:

list(). forcefulness evaluation of queryset calling list() on it.

and:

finally, note valuesqueryset subclass of queryset, has methods of queryset.

but when seek my_values_qs.list() throws exception:

attributeerror: 'valuesqueryset' object has no attribute 'list'

so, although valuesqueryset subclass of queryset apparently cannot list() contents. which, if true, mean django docs wrong or @ to the lowest degree misleading.

am missing or docs indeed wrong? best way materialise result of valuequeryset can store in memcache?

you're misreading bit docs. doesn't "call queryset.list() method": says "call list() on it". in other words, phone call list(my_queryset), not my_queryset.list() - , in fact explicitly illustrated illustration afterwards.

note has nil subclassing: queryset doesn't have list() method either.

django google-app-engine optimization

java heap size increasing -



java heap size increasing -

i compile jar file, , write log every half min check threads , memory situation.

attached start of log, , end of day log, after software stuck, , stop working.

in middle of day several automatic operations happened. received quotes 40 per seconds, , finished take care of every 1 of quotes before next came.

plus, every 4 seconds write map info db.

any ideas why heap size in increasing? (look @ currheapsize)

morning:

evening:

any ideas why heap size in increasing?

these classic symptoms of java storage leak. somewhere in application info construction accumulating more , more objects, , preventing them beingness garbage collected.

the best way find problem utilize memory profiler. answers this question explain.

java heap-memory

c++ - Using a static variable of a shared library in more than one functions of a same exe, but different object file -



c++ - Using a static variable of a shared library in more than one functions of a same exe, but different object file -

(i have edited original question create more understandable)

here prototype problem ....

//txn.h ---this has static variable, usable pgms including it.

class txn { public: static int i; static void incr_int(); }; txn::i=0;

//txn.cpp

void txn::incr_int() {i++;}

->produce libtxn.so //class1.cpp -> 1 of pgm using static var txn.h

#include txn.h txn::incr_int()

-> produce class1.o, libtxn.so. // class2.cpp ->another pgm using static var txn.h

#include txn.h cout<<"txn::i;

-> produce class2.o, including libtxn.so -> .produce class3 (an exe) using class1.o,class2.o. since, both class1 , 2 has statement "txn::i=0" "txn.h", multiple declaration issue happens. -> .if remove statement "txn::i=0" txn.h, "undefined reference" error appears. -> .at high lvl, problem kind of having session variable, should assessible func in exe. func can in obj files used form exe. fine sol, without static. can't alter creation of different .o files (which using session var) , combining .o produce exe.

i tried recreate problem described, compiled fine on computer, , hard go farther without seeing code.

in code below, header tells (declares) every .cpp file includes foo::x, foo::x lives in (is defined in) foo.cpp (and foo.o)

foo.h:

class foo { public: static int x; };

foo.cpp:

#include "foo.h" int foo::x;

main.cpp:

#include <iostream> #include "foo.h" int main(int argc, char *argv[]) { foo::x = 42; std::cout << "foo::x " << foo::x; }

c++ shared-libraries linker-error static-members multiple-definition-error

Grab client-side field value in server-side JavaScript in XPages -



Grab client-side field value in server-side JavaScript in XPages -

i seem missing xpages. have button has server side js attempting value 2 existing fields on document. come in values in form , field values empty when button clicked.

var doc:notesdocument = currentdocument.getdocument(); var email = doc.getitemvalue("email"); _dump("email: " + email); var password = doc.getitemvalue("password"); _dump("password: " + password);

i can see values empty in log.nsf using "_dump" command.

when utilize client side js grab fields, populated -- can see in alert statements:

var doc = document; var email = doc.getelementbyid("#{id:email1}").value; alert(email); var password = doc.getelementbyid("#{id:password1}").value; alert(password);

i tried partial refresh on panel email , password fields exist, still didn't help.

do have save document first , grab document 1 time again field values? have pass field values in client side js , pass in scope (i don't think can done client side js)? simple solution not sure why happening.

thanks!

retrieve values straight info source:

var email = currentdocument.getvalue("email"); var password = currentdocument.getvalue("password");

client-side xpages xpages-ssjs

c# - Receiving toast notifications on Wondows Phone when app is not running -



c# - Receiving toast notifications on Wondows Phone when app is not running -

my toast message has next format:

class="lang-cs prettyprint-override">string toastmessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<wp:notification xmlns:wp=\"wpnotification\">" + "<wp:toast>" + "<wp:text1>[string]</wp:text1>" + "<wp:text2>[string]</wp:text2>" + "<wp:param>[string]</wp:param>" + "<wp:mycustomparam1>[string]</wp:mycustomparam1>" + "<wp:mycustomparam2>[string]</wp:mycustomparam2>" + "<wp:mycustomparam3>[string]</wp:mycustomparam3>" + "</wp:toast>" + "</wp:notification>";

while app running can receive custom parameters (wp:mycustomparam1 , other) on shelltoastnotificationreceived(object sender, notificationeventargs e) event handler keys in e.collection

but when app not running , notification comes, user taps on pop-up notification , app started, shelltoastnotificationreceived doesn't calls , notification lost.

so, how can custom parameters in case?

c# push-notification windows-phone-8 mpns

vmware - BizTalk connectivity issue to SQL during VM snapshot -



vmware - BizTalk connectivity issue to SQL during VM snapshot -

we have 1 vm biztalk , separate vm sql backend. using veeam backups kicks off snapshot of vm. when snapshot beingness finalized on sql vm, biztalk services on application server fail. restart automatically requires manual intervention start services. error below logged on biztalk server.

is there timeout setting or config changes allow biztalk services remain during snapshot process?

an error occurred requires biztalk service terminate. mutual causes following: 1) unexpected out of memory error. or 2) inability connect or loss of connectivity 1 of biztalk databases. service shutdown , auto-restart in 1 minute. if problematic database remains unavailable, cycle repeat.

error message: [dbnetlib][connectionread (recv()).]general network error. check network documentation. error source:

biztalk host name: biztalkserverapplication windows service name: btssvc$biztalkserverapplication

we experienced same situation , error both biztalk 2009 , biztalk 2013, each set 2 app servers , 1 sql db server.

when our vmware final step of snapshot backup on application servers, freezes application server 10 seconds, preventing receiving packets. on sql server 2008 , 2012, default send out keep-alive packets clients every 30 seconds (30,000 ms). if sql server fails receive response app server, send out 5 retries (default setting) of keep-alive request 1 sec (1,000 ms) apart. if sql still not receive response back, terminate connection, cause biztalk hosts on app server reset, , in our case, when our german-made erp scheme sends edi documents on biztalk during reset period, transmission fail.

we trapped issue running netmon on db , app servers, waiting next error message. upon inspection, see 5 sql keep-alive packets beingness sent app servers 1 sec apart, , @ same time there no packets @ received on application server. @ first guess, 1 might think "just dropped network packets", case. made correlation timing of vm snapshots, , confirm each time snapshot finishes each day, app servers freeze.

as short-to-mid-term workaround, raised number of retries sql attempts before declaring connection dead, (5 default), adding registry value tcpmaxdataretransmissions , setting 30 (thus 30 seconds before sql declares client unresponsive). has masked problem us, , utilize @ own discretion.

we looking @ agent-based version of vm snapshot, may alleviate status of freezing server.

sql vmware biztalk

java - Reloading a JTree from a saved file -



java - Reloading a JTree from a saved file -

i read jtree file. want show in jpanel. reload defaulttreemodel after reading file but, doesn't work.

public class dynamictree extends jpanel { protected mydefaultmutabletreenode rootnode; protected defaulttreemodel treemodel; protected jtree tree; private transient toolkit toolkit = toolkit.getdefaulttoolkit(); private url helpurl; public void reloadmodel(){this.treemodel.reload();} }

read file loading dynamictree

address = (dynamictree) readdynamictreefromfile(); mainpanel.settree4load(address);

the settree4load(address) method is:

public static void settree4load(dynamictree tree) { treepanel=tree; //treepanel current dynamictree in frame treepanel.reloadmodel(); }

thanks in advance :)

instead of changing tree. seek set model , datamodel loaded tree panel tree

java swing jtree reloaddata defaulttreemodel

How to add a few properties at UITableViewCell class? -



How to add a few properties at UITableViewCell class? -

i'm using uitableviewcontroller , uinavigationcontroller. save info on tableviewcell.

uitableviewcell_extensionof.h file

#import <uikit/uikit.h>

@interface uitableviewcell ()

@property (strong, nonatomic) nsdate *ondate;

@end

masterviewcontroller.m file

#import "uitableviewcell_extensionof.h"

......

-(void)viewdidload {

..... uitableviewcell *cell = [[uitableviewcell alloc] init];

cell.ondate = [nsdate date]; //crash

}

error log : -[uiaccessibilitybundle setondate:]: unrecognized selector sent instance 0x7381b90

how can add together properties @ uitableviewcell? lastly card subclass, way work? (actually, haven't tried subclass yet)

class properties

amazon ec2 - Apache Whirr on EC2 with custom AMI -



amazon ec2 - Apache Whirr on EC2 with custom AMI -

i trying launch cluster of custom ami images. ami image ubunutu 12.04 server image amazon free tier selection java installed (i want create ami numpy , scipy). in fact, created image launching ubuntu 12.04 instance whirr , noop role. installed java, , in aws online console selected create image (ebs ami). using same whirr recipe script used launch original ubuntu server image-id changed.

whirr launches image, shows in console. tries run initscript noop , nil happens. after 10min throws exception caused script running long. whirr.log containts record

error acquiring sftpclient() (out of retries - max 7): invalid packet: indicated length 1349281121 big

i saw error mentioned in 1 of tutorials, suggested solution add together line

whirr.bootstrap-user=ec2-user

to allow jcloud know username. know right username , used default anyway. after adding line, whirr.log shows authentification error, problem public key. finally, when utilize 'ubuntu' user, error dying because - java.net.sockettimeoutexception: read timed out

here's file utilize launch cluster

whirr.cluster-name=pineapple whirr.instance-templates=1 noop whirr.provider=aws-ec2 whirr.identity=${env:aws_access_key_id} whirr.credential=${env:aws_secret_access_key} whirr.private-key-file=${sys:user.home}/.ssh/id_rsa whirr.public-key-file=${sys:user.home}/.ssh/id_rsa.pub whirr.env.repo=cdh4 whirr.hardware-id=t1.micro whirr.image-id=us-east-1/ami-224cda4b whirr.image-location=us-east-1b

the exception log help solve problem.

also, setting next may solve issue.

whirr.cluster-user=<clu>

amazon-ec2 ami apache-whirr

python - Issue with designing function for data scraping using BS4 -



python - Issue with designing function for data scraping using BS4 -

data require nowadays under 2 different combination of tag + class. want function search under both combinations , nowadays info under both together. both combinations mutually exclusive. if 1 combination nowadays other absent.

code using is:

# -*- coding: cp1252 -*- import csv import urllib2 import sys import urllib import time bs4 import beautifulsoup itertools import islice def match_both2(arg1,arg2): if arg1 == 'div' , arg2 == 'detailinternetfirstcontent empty openpostit': homecoming true if arg1 == 'p' , arg2 == 'connection': homecoming true homecoming false page = urllib2.urlopen('http://www.sfr.fr/mobile/offres/toutes-les-offres-sfr?vue=000029#sfrintid=v_nav_mob_offre-abo&sfrclicid=v_nav_mob_offre-abo').read() soup = beautifulsoup(page) datas = soup.findall(match_both2(0),{'class':match_both2(1)}) print datas

right now, trying utilize match_both2 function accomplish this, giving me typeerror passing 1 argument , requires 2. don't know in case how pass 2 arguments it, have called function match_both2(example1,example2). here, not able think of method can solve problem.

please help me in resolving issue.

when utilize function filter matching elements, pass in reference function, not it's result. in other words, not supposed phone call before passing .findall().

the function called one argument, element itself. moreover, class attribute has been split list. match specific elements, need difen match function as:

def match_either(tag): if tag.name == 'div': # @ *least* these 3 classes must nowadays homecoming {'detailinternetfirstcontent', 'empty', 'openpostit'}.issubset(tag.get('class', [])) if tag.name == 'p': # @ *least* 1 class must nowadays homecoming 'connection' in tag.get('class', [])

this function returns true p tag connection class, or div tag 3 classes present.

pass findall() without calling it:

datas = soup.findall(match_either)

python python-2.7 beautifulsoup

push notification - Unable to start receiver com.parse.ParseBroadcastReceiver on Trigger.io Android app -



push notification - Unable to start receiver com.parse.ParseBroadcastReceiver on Trigger.io Android app -

i've android app built trigger.io, using parse force notifications. app deployed google play , force notifications have been working fine. re-built , deployed google play new version of app, forge platform version 1.4.29.

since have been receiving next crash reports through google play:

java.lang.runtimeexception: unable start receiver com.parse.parsebroadcastreceiver: android.content.receivercallnotallowedexception: intentreceiver components not allowed register receive intents @ android.app.activitythread.handlereceiver(activitythread.java:2236) @ android.app.activitythread.access$1500(activitythread.java:130) @ android.app.activitythread$h.handlemessage(activitythread.java:1271) @ android.os.handler.dispatchmessage(handler.java:99) @ android.os.looper.loop(looper.java:137) @ android.app.activitythread.main(activitythread.java:4745) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:511) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:786) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:553) @ dalvik.system.nativestart.main(native method) caused by: android.content.receivercallnotallowedexception: intentreceiver components not allowed register receive intents @ android.app.receiverrestrictedcontext.registerreceiver(contextimpl.java:125) @ android.app.receiverrestrictedcontext.registerreceiver(contextimpl.java:119) @ com.parse.parsecommandcache.<init>(parsecommandcache.java:132) @ com.parse.parse.getcommandcache(parse.java:450) @ com.parse.parseobject.saveeventually(parseobject.java:1022) @ com.parse.parseinstallation.saveeventually(parseinstallation.java:170) @ com.parse.parsepushrouter.saveeventually(parsepushrouter.java:92) @ com.parse.parsepushrouter.ensurestateisloaded(parsepushrouter.java:208) @ com.parse.parsepushrouter.hasroutes(parsepushrouter.java:122) @ com.parse.pushservice.startserviceifrequired(pushservice.java:129) @ com.parse.parsebroadcastreceiver.onreceive(parsebroadcastreceiver.java:19) @ android.app.activitythread.handlereceiver(activitythread.java:2229) ... 10 more

i have tested app thoroughly on next android handsets , not been able replicate bug myself.

samsung galaxy nexus samsung galaxy s2 samsung galaxy s

can suggest going wrong here , how can prepare trigger.io?

this issue fixed in forge v1.4.37, included update parse android sdk v1.2.3.

trigger.io release ntes bug study on parse q&a

android push-notification trigger.io parse.com

cuda - Automatically adding function prefixes to C++ functions -



cuda - Automatically adding function prefixes to C++ functions -

i'm porting little c++ codebase callable on graphics card, via cuda. cuda requires functions prepended __host__ __device__ in order callable both on cpu , in gpu kernel code. e.g.,

void foo() {} // callable on cpu, not on gpu __host__ __device__ foo() {} // callable on cpu , on gpu

it's tedious straight-forward task add together __host__ __device__ every function in codebase, i'm wondering: there efficient method prepend qualifiers c/c++ functions?

i happy text-editor technique detected function declarations, or compiler feature. however, unaware of solution involves either.

ideas?

i'm not aware of such compiler feature. i'd wary of broadly applying these directives anyway though, calling conventions , stack management might different (e.g. slower?) normal host conventions when not needed. i'd set own macro , e.g. #define hdfn __host__ __device__ such it'd easy add/change.

that aside, might able dig regex detecting methods , write macro simple...

c++ cuda metaprogramming

multithreading - Set TCL vwait variable from a thread -



multithreading - Set TCL vwait variable from a thread -

i need able set variable end vwait within thread. because have loop locks interperator , hence gui running until completes.

i'm wanting function sleep command this:

global endsleep after ${sleeptime_ms} set endsleep 1 vwait endsleep

only need set vwait variable when while loop querying device exits.

here code currently:

proc ::visa::wait {visaalias} { # link global variable global endwait # execute commands in thread gui not locked while executing set thread [thread::create] thread::send ${thread} [list set visaalias ${visaalias}] thread::send ${thread} { source molexvisa.tcl # temporarily create new connection device visa::connect ${visaalias} # query operation finish bit visa::query ${visaalias} "*opc?" # go on effort read opc bit until response given; typically 1 while {[string equal [visa::read ${visaalias}] ""]} {} # destroy temporary connection visa::disconnect ${visaalias} # set vwait variable set endwait 1 } # wait thread end vwait endwait # mark thread termination thread::release ${thread} }

currently thread still freezing gui. also, since variable in thread , variable i'm expecting aren't same, waits forever.

any advice or help appreciated. believe i've exhausted other more practical ways of accomplishing task, more insight welcomed.

use -async flag thread::send. default, ::thread::send blocks until script has been executed (which defeats of time utilize of threads).

if utilize -async flag, can utilize optional variable argument thread::send , vwait that, e.g.

set tid [thread::create { proc fib n { if {$n == 0 || $n == 1} {return 1} homecoming [expr {[fib [expr {$n - 1}]] + [fib [expr {$n - 2}]]}] } thread::wait }] ::thread::send -async $tid [list fib $num] result vwait result ::thread::release $tid # ... result

this should prevent gui freezing. note implementation of fibonacci not best , placeholder "some expensive calculation".

multithreading tcl visa

formatting - Formatted cliboard Java -



formatting - Formatted cliboard Java -

i having issue trying figure out how retain formatting of text in java programme when saving scheme clipboard.

it not work things such microsoft's wordpad or lotus symphony. on contrary, if create formatted string in word , re-create it, works trial cases seek paste into.

i not want utilize external sources such org.eclipse.*.

here links have compiled might help me pointed in proper direction.

i sense if not using proper info flavor? http://docs.oracle.com/javase/1.5.0/docs/api/java/awt/datatransfer/dataflavor.html

i found link talks lot dataflavors, not shed much lite on 1 utilize formatted text. understand though might not same on every os , need check create sure supported on os using.

http://www.javaworld.com/cgi-bin/mailto/x_java.cgi?pagetosend=/export/home/httpd/javaworld/javaworld/javatips/jw-javatip61.html&pagename=/javaworld/javatips/jw-javatip61.html&pageurl=http://www.javaworld.com/javaworld/javatips/jw-javatip61.html&site=jw_core

thanks of help in advanced, appreciate it!

dan

edit

i using code from: http://lists.apple.com/archives/java-dev/2004/jul/msg00359.html few little changes. issue having currently, need transmit info clipboard in 2 different formats. "text/rtf" , "text/plain" seeing programs not back upwards rtf. using within clipboard see within clipboard. can place either rtf or plain text, not both simultaneously. when do, lastly 1 gets added. help appreciated!

in summary, cannot set clipboard 2 different info flavors @ same time.

import java.awt.datatransfer.*; import java.io.*; public class clipboard { public static final string rtf_string = "{\\rtf1\\ansi\\deff0 {\\fonttbl {\\f0 courier;}}\r \n{\\colortbl;\\red0\\green0\\blue0;\\red255\\green0\\blue0;}\r\nthis line default color\\line\r\n\\cf2\r\n\\tab line reddish , has tab before it\\line\r\n\\cf1\r\n\\page line default color , first line on page 2\r\n}\r\n"; public static final dataflavor rtf_flavor = new dataflavor("text/rtf", "rich formatted text"); public static void main(string[] args){ clipboard cb = toolkit.getdefaulttoolkit().getsystemclipboard(); transferable t = new mytransferable( new bytearrayinputstream(rtf_string.getbytes()), rtf_flavor); cb.setcontents(t, null); } static class mytransferable implements transferable { private object info = null; private dataflavor flavor; public mytransferable(object o, dataflavor df) { info = o; flavor = df; } public object gettransferdata (dataflavor df) throws unsupportedflavorexception, ioexception { if (!flavor.ismimetypeequal(flavor)) throw new unsupportedflavorexception(df); homecoming data; } public boolean isdataflavorsupported (dataflavor df) { homecoming flavor.ismimetypeequal(df); } public dataflavor[] gettransferdataflavors() { dataflavor[] ret = {flavor}; homecoming ret; } }

}

after much searching around , trial , error , help friend sebastian , logan, seems figured out. allows multiple formats of info saved clip board @ 1 time in java while retaining styling , formatting of text. helps someone. resource. http://www.pindari.com/rtf1.html

import java.awt.*; import java.awt.datatransfer.*; import java.io.*; public class clipboard{ //creates rtf string private static final string rtf_string = "{\\rtf1\\ansi\\deff0\r\n{\\colortbl;\\red0\\green0\\blue0;\\red255\\green0\\blue0;}\r\nthis line default color\\line\r\n\\cf2\r\nthis line red\\line\r\n\\cf1\r\nthis line default color\r\n}\r\n}"; //creates plain text string private static final string plain_string = "this line default color \n line reddish \n line default color"; //array of info specific flavor private static final object data[] = {new bytearrayinputstream(rtf_string.getbytes()),new bytearrayinputstream(plain_string.getbytes())}; //plain favor private static final dataflavor plain_flavor = new dataflavor("text/plain", "plain flavor"); //rtf flavor private static final dataflavor rtf_flavor = new dataflavor("text/rtf", "rich formatted text"); //array of info flavors private static final dataflavor flavors[] = {rtf_flavor,plain_flavor}; public static void main(string[] args){ //create clip board object clipboard cb = toolkit.getdefaulttoolkit().getsystemclipboard(); //create transferable object transferable p = new mytransferable(data,flavors); //transfer clip board cb.setcontents(p, null); } static class mytransferable implements transferable{ //array of info private object dataa[] = null; //array of flavors private dataflavor flavora[] = null; //transferable class constructor public mytransferable(object data[], dataflavor flavors[]){ //set info passed in local variable dataa = data; //set flavors passes in local variable flavora = flavors; } public object gettransferdata (dataflavor df) throws unsupportedflavorexception, ioexception{ //if text/rtf flavor requested if (df.getmimetype().contains("text/rtf")){ //return text/rtf info homecoming dataa[0]; } //if plain flavor requested else if (df.getmimetype().contains("text/plain")){ //return text/plain info homecoming dataa[1]; } else{ throw new unsupportedflavorexception(df); } } public boolean isdataflavorsupported (dataflavor df){ //if flavor text/rtf or tet/plain homecoming true if(df.getmimetype().contains("text/rtf") || df.getmimetype().contains("text/plain")){ homecoming true; } //return false else{ homecoming false; } } public dataflavor[] gettransferdataflavors(){ //return array of flavors homecoming flavora; } } }

java formatting mime-types clipboard copy-paste

eclipse rcp - How to Click on a Tree Item in a Cell using windowTester? -



eclipse rcp - How to Click on a Tree Item in a Cell using windowTester? -

i have shell in there tree within composite. want click on particular cell of tree. when seek record actions, not giving proper recordings, want manually.

please see snapshot attached , location want click example.

this error coming after recording

warning: unsupported widget selection ignored - widget selection event: null

please help me not eclipse , it's kind of of import our project. lot.

you can manually in test code writing:

// first click on item ensure visible in scrolled view treeitemlocator itemlocator = new treeitemlocator("/tree/path/to/file"); getui().click(itemlocator); // can access tree cell (columns zero-based treeitemlocator celllocator = swtlocators.treecell(itemlocator.getpath())).at(swtlocators.column(4); getui().click(celllocator);

of course, import static com.windowtester.runtime.swt.locator.swtlocators.* create code more readable.

eclipse-rcp window-tester

javascript - trouble with a search function -



javascript - trouble with a search function -

function todo(id, task, who, duedate) { this.id = id; this.task = task; this.who = who; this.duedate = duedate; this.done = false; } // more code adds todo objects page , array todos function search() { (var = 0; < todos.length; i++) { var todoobj = todos[i]; console.log(todoobj.who); //shows both jane , scott console.log(todoobj.task); // shows both , milk } var searchterm = document.getelementbyid("search").value; searchterm = searchterm.trim(); var re = new regexp(searchterm, "ig"); var results = todoobj.who.match(re); if (searchterm == null || searchterm == "") { alert("please come in string search for"); return; } else { alert(results); } }

this search function trying match user types search bar objects have created before in code. must match "who" , "task" parameters have given objects. 1 object who: jane task: , other who: scott task: milk. problem is, in lastly alert can match scott , not jane. scott lastly 1 added. there way need modify loop or alter search criteria?

your problem looping through items, using todoobj after loop. todoobj hold lastly item in array. need reorganize little...try this:

function search() { var searchterm = document.getelementbyid("search").value; searchterm = searchterm.trim(); if (searchterm == null || searchterm == "") { alert("please come in string search for"); return; } else { var todoobj = undefined, results = undefined, re = new regexp(searchterm, "ig"); (var = 0; < todos.length; i++) { todoobj = todos[i]; results = todoobj.who.match(re); if (results) { alert("you found " + todoobj.who + ", needs " + todoobj.task + " " + todoobj.duedate); return; } console.log(re.lastindex); } alert("you didn't match anyone"); } }

here's illustration of working think want to: http://jsfiddle.net/shsdk/2/

javascript regex loops match

scala - Constructor cannot be instantiated to expected type; p @ Person -



scala - Constructor cannot be instantiated to expected type; p @ Person -

i using scala version : scala code runner version 2.9.2-unknown-unknown -- copyright 2002-2011, lamp/epfl

i trying deep case matching build here: http://ofps.oreilly.com/titles/9780596155957/roundingouttheessentials.html , code follows match-deep.scala:

class role case object manager extends role case object developer extends role case class person(name:string, age: int, role: role) val alice = new person("alice", 25, developer) val bob = new person("bob", 32, manager) val charlie = new person("charlie", 32, developer) for( person <- list(alice, bob, charlie) ) { person match { case (id, p @ person(_, _, manager)) => println("%s overpaid".format(p)) case (id, p @ person(_, _, _)) => println("%s underpaid".format(p)) } }

i getting next errors:

match-deep.scala:13: error: constructor cannot instantiated expected type; found : (t1, t2) required: this.person case (id, p @ person(_, _, manager)) => println("%s overpaid".format(p)) ^ match-deep.scala:13: error: not found: value p case (id, p @ person(_, _, manager)) => println("%s overpaid".format(p)) ^ match-deep.scala:14: error: constructor cannot instantiated expected type; found : (t1, t2) required: this.person case (id, p @ person(_, _, _)) => println("%s underpaid".format(p)) ^ match-deep.scala:14: error: not found: value p case (id, p @ person(_, _, _)) => println("%s underpaid".format(p))

what doing wrong here?

the error info clear

for( person <- list(alice, bob, charlie) ) { person match { case p @ person(_, _, manager) => println("%s overpaid".format(p.tostring)) case p @ person(_, _, _) => println("%s underpaid".format(p.tostring)) } }

here short way same thing:

for(p @ person(_, _, role) <- list(alice, bob, charlie) ) { if(role == manager) println("%s overpaid".format(p.tostring)) else println("%s underpaid".format(p.tostring)) }

edit not sure real mean of id wanted, suppose index of person in list. here go:

scala> for((p@person(_,_,role), id) <- list(alice, bob, charlie).zipwithindex ) { | if(role == manager) printf("%dth person overpaid\n", id) | else printf("something else\n") | } else 1th person overpaid else

scala scala-2.9

asp.net mvc - Where does TempData get stored? -



asp.net mvc - Where does TempData get stored? -

where tempdata stored in asp.net mvc framework (more specifically, asp.net mvc 2)? stored @ server-side, or sent client?

by default tempdata uses asp.net session storage. stored on server (inproc default). define other asp.net session state modes: stateserver , sqlserver. write custom tempdata provider , handle storage if don't want utilize asp.net session.

asp.net-mvc asp.net-mvc-2 tempdata

javascript - Re-insertion of user inputted values. php or .post -



javascript - Re-insertion of user inputted values. php or .post -

this question might sound little amatuer curious find out.

so i've got form field consists of mixed text-boxes, selectboxes , textareas. stores user-inputted values in database , have values re-inserted everytime user wants re-edit form.

my question re-insertion process of form fields via stored values in database, improve utilize 1) php mysql queries or 2) doing .post calls script, json-encode info , using jquery insert values form on .ready?

i appreciate if able advise me improve way , explain complications of each method. say, method take , why take it?

would incur more bandwidth? disk space on host computer?

any help appreciated.

either way valid, go php approach. reason if via ajax you're form load , sec later fields populate. doesn't sense professional , damages client experience. whereas php prebuilding data, form built , ready go =)

as far optimization, it's going un-noticable on php side. notice un-populated fields beingness populated.

php javascript jquery database forms

html5 - html 5 doc mode still opening up in quirks -



html5 - html 5 doc mode still opening up in quirks -

i'm working on wordpress site , when delcare html5 docmode, site still forces open in quirks in ie9 , 8. url is: http://teknikor.bethmotta.com

my header.php contains next code:

<!doctype html> <html> <head> <meta http-equiv="x-ua-compatible" content="ie=edge" />

any ideas on why still opening in quirks? help!

i viewed site , you've got 38 lines of html above doctype, looks related google analytics. ie's going want doctype first line of source, believe.

html5 doctype

Differences Between Software Engineering and Systems Analysis and Design -



Differences Between Software Engineering and Systems Analysis and Design -

i wondering if there substantial differences between software engineering science , systems analysis , design. both of them seem methods of producing high quality software. same animal different names? if not,

is 1 improve other? -if so, is? or, -if so, in instance or domain 1 is?

is 1 newer way of doing things? -if so, 1 is?

what differences, , 1 improve suited other?

many, many in advance. :)

additional info: have done programming on , off since 90's, have never designed new scheme scratch nor managed project. there design/architecture already. now, tasked design new system. phase 1 of scheme not complicated, mind you, want right, , don't know start. browsed books systems analysis , design , books software engineering. i'm not sure book read posted question here. @grzegorz's , @eoin's answers below suggests saad subset of se, mean i'll go se route?

software engineering science consists - among others - of analysis , design.

analysis gathers requirements software:

functional - describing scheme in terms of business processes, non-functional - describing else (performance, security, technology, hardware, etc).

design represents requirements in documents. these may be:

informal specifications - text documents, diagrams, or formal specifications next standarized process, rup and/or prototypes, wireframes, and/or else may help implementors understand expected implement.

then need develop software, test it, deploy , maintain. latter includes introducing changes system.

how design scheme - question , no matter how hard seek cannot reply in general. if take 1 major rule - utilize pen , paper, imagine, observe risks, inquire questions, imagine again... more think , imagine @ origin less errors create later. start formal design or coding after basic thought sits firmly in mind. luck :)

software-engineering software-design system-analysis

Unknown column on 'on clause' in sql joins? -



Unknown column on 'on clause' in sql joins? -

can guys help me please in understanding sql specifications on join. don't understand it. kept getting errors called unknown column list on on clause. got error on sql syntax, rubbed in face can't understand why not working, have read article regarding because of precedence etc confused on have done wrong here.

select product.name , product.price product inner bring together product_category on (product_category.product_no = product.product_no ) product_category.sub_category = "coffin";

i know question have been inquire hudred , 1000000 times here, ones saw complicated close in basic sql syntax.

thanks helping me out.

edit: had realize have product_category not direct kid product table have typed

select * product bring together specifications bring together product_category on ( specifications.product_no = product_category.product_no);

but still gave me error, unknown column product_category.

i've read , followed instruction sites: mysql unknown clause bring together column in next join unknown column {0} in on clause mysql "unknown column in on clause"

i frustrated. can't work.

for each new table bring together in query, each table must have @ to the lowest degree 1 on clause. it's hard know you're trying without knowing schema (table names, columns, etc), here's example

select * product p bring together specifications s on p.product_no = s.product_no bring together product_category pc on pc.spec_no = p.spec_no

check out link on table aliases well. gives illustration on joins + useful info on how increment readability of sql http://msdn.microsoft.com/en-us/library/ms187455(v=sql.90).aspx

i found article useful visually displays different types of joins http://www.codinghorror.com/blog/2007/10/a-visual-explanation-of-sql-joins.html

sql

c++ - cast float to wchar_t win32 -



c++ - cast float to wchar_t win32 -

it freaks me out cannot find anyway cast float wchar_t or maybe looking in wrong places!

float cnumbers[9] = {1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0}; float x = 3.0; float temp = 0.0; wchar_t data[] = {0}; for(int i=0; < sizeof(cnumbers); i++){ temp = x / cnumbers[i]; bool isint = temp == static_cast<int>(temp); if(isint){ info = temp; //this big fail addtolist(hwnd,data); } } void addtolist(hwnd hwnd,const wchar_t * info ){ sendmessage(getdlgitem(hwnd,idc_listbox),lb_addstring,0,(lparam)data); }

the problem want convert float value wchar_t send listbox

in c++, casting pods reinterpret binary info casted-to type , not kind of type conversion want accomplish.

you have couple of options here:

you can utilize boost::lexical_cast cast-like conversion you can utilize wsprintf or std::wstringstream handle conversion float wide string if using mfc/atl, can utilize cstring::format convert float string

the sec alternative 1 doesn't utilize third-party library if restricted in can utilize library wise, you're stuck either wsprintf or std::wstringstream. recommendation in case utilize std::wstringstream both type safety reasons , protections buffer overflows.

c++ windows winapi visual-studio-2012

Python unit testing code which calls OS/Module level python functions -



Python unit testing code which calls OS/Module level python functions -

i have python module/script few of these

at various nested levels within script take command line inputs, validate them, apply sensible defaults i check if few directories exist

the above 2 examples. trying find out best "strategy" test this. have done have constructed wrapper functions around raw_input , os.path.exists in module , in test override these 2 functions take input array list or mocked behaviour. approach has next disadvantages

wrapper functions exist sake of testing , pollutes code i have remember utilize wrapper function in code everytime , not phone call os.path.exists or raw_input

any brilliant suggestions?

the short reply monkey patch these scheme calls.

there examples in reply how display redirected stdin in python?

here simple illustration raw_input() using lambda throws away prompt , returns want.

system under test $ cat ./name_getter.py #!/usr/bin/env python class namegetter(object): def get_name(self): self.name = raw_input('what name? ') def greet(self): print 'hello, ', self.name, '!' def run(self): self.get_name() self.greet() if __name__ == '__main__': ng = namegetter() ng.run() $ echo derek | ./name_getter.py name? hello, derek ! test case: $ cat ./t_name_getter.py #!/usr/bin/env python import unittest import name_getter class testnamegetter(unittest.testcase): def test_get_alice(self): name_getter.raw_input = lambda _: 'alice' ng = name_getter.namegetter() ng.get_name() self.assertequals(ng.name, 'alice') def test_get_bob(self): name_getter.raw_input = lambda _: 'bob' ng = name_getter.namegetter() ng.get_name() self.assertequals(ng.name, 'bob') if __name__ == '__main__': unittest.main() $ ./t_name_getter.py -v test_get_alice (__main__.testnamegetter) ... ok test_get_bob (__main__.testnamegetter) ... ok ---------------------------------------------------------------------- ran 2 tests in 0.000s ok

python unit-testing python-2.7 pyunit

uml - Use case diagram: of several actors of a use case, only some have access to an extending use case -



uml - Use case diagram: of several actors of a use case, only some have access to an extending use case -

how can represent diagram in several actors have access same function, or "use case" of them have additional functions or "extends" (if im right) within it, if extend on main "use case" mean accessible right?

when utilize case extends main utilize case, extension points @ main utilize case, can have conditions. status specify specific actor.

if actors can generalized, have seen solution too. prefer first 1 because not sure if technically right (as noted, extend utilize case default accessible everyone).

hope helps.

uml diagram actor use-case

c++ - GDB and NS2: how to stop program at some Function call -



c++ - GDB and NS2: how to stop program at some Function call -

i using gdb debug ns-2 simulator network protocols. takes .tcl file input , interpret it. [i think interpreter.]

some of code written in tcl (events , creation of network components) , in c++ (especially packet formats, agents etc.).

i have created agent in c++ , want stop @ function phone call can see stack trace , find other classes have been called before it.

this have done:

there error in 1 of myagent::function , giving segmentation fault , gdb stopping there automatically. see stack trace. rectified error.

now when run

gdb ./ns b myagent::function() /* when press tab after writing "b mya" gives me functions of class :). when press come in after above command -- asks me "breakpoint on future shared library load" , yes. hope ok ?? */ r myfiles/mywireless.tcl

now runs , not stop anywhere. :(

i sure function beingness called, because when segmentation fault occuring, stopping @ function.

thanks

you can add together breakpoint in function:

(gdb) break myagent::function()

you must create sure compile whatever options necessary debug symbols. on gcc, utilize -g or -ggdb options.

c++ gdb tcl breakpoints ns2

c# - Unit Test for virtual Keyboard -



c# - Unit Test for virtual Keyboard -

one of projects developing keyboard hook traps of higher numbered function buttons (f13-f20). tablet work on has buttons on mapped higher function buttons. making class has constructor input key (from system.windows.forms.keys) , abstracttask. since utilize hook perform various tasks decided slick way of doing. 1 of tasks keyboardtask. super simple class (i hope atleast)

public class keyboardtask : abstracttask { private keyboardtask () { } public keyboardtask (keyboardcommand key) { options = "{" + key + "}"; } public override void performtask() { globals.writelog("keyboardtask:performtask()+"); seek { system.windows.forms.sendkeys.send(options); } grab (system.exception ex) { globals.writeexceptionlog(ex); } globals.writelog("keyboardtask:performtask()-"); } } public enum keyboardcommand { backspace,//{backspace}, {bs}, or {bksp} break,//{break} capslock,//{capslock} delete,//{delete} or {del} down, //{down} end,//{end} enter,//{enter}or ~ esc,//{esc} //etc }

so non-unit-test compiled programme added it

ksel1 = new keyboardsystemeventlistener((keys.f13), new keyboardtask(keyboardcommand.f1));//f1 ksel6 = new keyboardsystemeventlistener((keys.f18), new ectask(embeddedcontrollercommand.decreasebacklight));//rb

(there huge bug doing way, solved have implement it) set programme on tablet, , had ie open, pressed f13 button , opened ie's help (yeah!).. pressed f18 , backlight decreased.. (no big suprise there)

so got thinking.. there has improve way of doing (what should have said is, why didn't write unit test first) started write unit test.. problem don't have f13 key.. ok not huge deal i'll alter home button on keyboard, tried check f1 , realized have no clue how unit test. prefer see instead (take me out of equation)

[test] public void testkeyboardtask() { keyboardtask kkt = new keyboardtask(keyboardcommand.f1); kkt.performtask(); assert.istrue(/*f1 key pressed*/false); }

any ideas? i'm using nunit 2.6.2 , visual studio 2012 pro. prefer utilize nunit vs test suite doesn't seem refined (althoough billion times more conveniant if worked)

test class

[test] public void testkeyboardtask() { keyboardtask kkt = new keyboardtask(keyboardcommand.f1); using (mockkeyboardtest f = new mockkeyboardtest()) { f.showdialog(kkt); assert.areequal(keys.f1, f.pressedkey); } }

mock keyboard test

class mockkeyboardtest : form { public mockkeyboardtest() { initializecomponent(); pressedkey = keys.browserback; } public void showdialog(keyboardtask kkt) { keyboard = kkt; base.showdialog(); } public void initializecomponent() { this.shown += mockkeyboardtest_shown; keyboardtesttextbox.acceptstab = true; keyboardtesttextbox.location = new point(2, 22); keyboardtesttextbox.maxlength = 50; keyboardtesttextbox.multiline = true; keyboardtesttextbox.size = new size(195, 25); keyboardtesttextbox.keydown += this.keyboardtesttextbox_keydown; controls.add(keyboardtesttextbox); } void mockkeyboardtest_shown(object sender, system.eventargs e) { keyboard.performtask(); } private void keyboardtesttextbox_keydown(object sender, keyeventargs e) { pressedkey = e.keydata; this.dialogresult = dialogresult.ok; } private textbox keyboardtesttextbox = new textbox(); private keyboardtask keyboard; public keys pressedkey; }

works charm.

c# unit-testing nunit keyboard-events keyboard-hook

php - DISTINCT after ORDER BY -



php - DISTINCT after ORDER BY -

i'm creating forum. i'm outputting topics 'posts' , 'members' table joined it. way can display post , fellow member info on topic index.

what i'm trying collect username of lastly 3 members posted, want unique values (no duplicates in case double posts) i'm using distinct, problem usernames grouped after they're ordered backwards. if did first , lastly post, won't able retrieve username among list.

here's code i'm using:

substring_index( group_concat(distinct `members`.`username` order `posts`.`date` desc separator '\\\\') , '\\\\', 3 ) member_last_username

is there way modify code usernames ordered backwards before grouping? apologize if question confusing!

sure, subselect orders info way want , utilize input.

select substring_index( group_concat(distinct sub.username order sub.`date` desc separator '\\\\') , '\\\\', 3 ) member_last_username (select m.username, p.`date` members m inner bring together post p on (some bring together or other) order backwards ordering ) sub

php mysql

database - Where to get data for a directory website -



database - Where to get data for a directory website -

i've developed site http://ratemymechanic.us couple of years ago, little hits, , have 1000 mechanics in database (which manually entered).

how people go getting info (mechanics in case)?

edit

just clear, question can mechanic info populate in database?

let's give seek ...

honestly don't think you're going answer, it's still answer. don't believe offers free database of mechanics. it's specific.

i can give ideas of how might list of mechanics, i'm not sure of them work well.

go sites angies list, craigslist, etc. , see if have api. thought utilize api download info mechanics. i'm not sure work because whole business model providing info people. give unwise.

you can scrape websites. write programme visit directory of mechanics , download html bot sees. write parser parse html , produce csv example. import database. don't bother trying sites google or yahoo. they'll notice you're scraping site , ban ip address.

you can creative , seek nail facebook or twitter's api , search things #mechanic. knows might turn up.

you can go site https://www.odesk.com/ , hire info entry. create them open local phone book , start typing names excel , send names you.

the bottom line aren't going info easily. you're going have creative.

database

Entity Framework 5 column mapping datetime -



Entity Framework 5 column mapping datetime -

this not seem work:

this.property(t => t.mydatetime) .hascolumntype("datetime") .hascolumnname("mydatetime");

looking @ sql profiler update sql string still uses datetime2(7) , uses decimal places. result of rounding differences between datetime2 , datetime.

how can forcefulness entity framework utilize datetime sql type?

thank you!

hascolumntype("datetime") specifies column type, not temporary parameter types used in sql statements. can't command , it's not necessary. if have .net datetime in application decimal places filled , want store in datetime type in sql server value (and can only) stored rounded value. doesn't matter if rounding happens on client side before sql sent database server or if rounding happens on database server itself. result same: rounded stored value loss of precision.

entity-framework-5

vb.net - Update control asynchronously -



vb.net - Update control asynchronously -

i've been reading on net how solve problem of updating controls different threads 1 contains command , read "pro vb 2010 , .net 4.0 platform" , start wonder. next code performing in synchronous fashion?

private sub savedata(byval filepath string) if invokerequired me.invoke(new methodinvoker(addressof savedata)) else ... actual code end if end sub

it depends on calling context.

if calling ui thread or main thread, yes function synchronously.

if phone call thread not ui or main thread, going function asynchronously ui or main thread, synchronously calling thread, waiting until ui or main thread done processing delegate.

so can go both ways. can operate synchronously , asynchronously. think missing code not preform in synchronous or asynchronous fashion, execution of code either synchronous or asynchronous.

the reason why create update function:

private sub updatelabel(byval tlabel label, byval value string) if tlabel.invokerequired me.invoke(new methodinvoker(addressof updatelabel) else tlabel.text = value end if end sub

is can phone call whenever want alter text, without having worry cross thread exception.

this method safe phone call ui thread during click event , safe phone call along running background thread, because alter still ever made on ui or main thread. utilize code ensure synchronicity changes controls owned other threads.

this style of updating meant synchronize changes , avoid cross threading.

vb.net asynchronous synchronous multithreading

regex matching for percentage type entry in textbox -



regex matching for percentage type entry in textbox -

i want regex matched strictly format "two digit, decimal , 2 digit" 11.11 or 11 ok 1.11 or 111.1 or 111.11 not valid

regex :

^\d{2}(?:\.\d{2})?$

example :

11.11 11 1.11 111.1 111.11

matches :

11.11 11

demo :

http://regexr.com?33prh

regex

c# 4.0 - IIS Basic auth for certain path of my MVC-website -



c# 4.0 - IIS Basic auth for certain path of my MVC-website -

i want protect 1 of pages of asp.net mvc4 (c#) website basic auth.

can iis 7.5 , how can it?

here blog post shows how incorporate basic authentication mvc 4 application. work iis 7.5.

c#-4.0 iis asp.net-mvc-4 iis-7.5

php - JSON ERROR for uploader -



php - JSON ERROR for uploader -

i have been struggling json error time now. code have uploading is,

}, addfile: function ( e ) { if (e.files) caller = e; else { caller = e.target; if (this.lastvalue==e.target.value) {return ;} } appendfile = function ( file ) { fname = !file.value ? file.name : file.value; fname = fname.split('\\'); fname = fname[fname.length-1]; fileitem = $('<div/>', { "class": "fileitem " }); delbtn = $('<div/>', {"class": "delete"}).html('<b>remove</b>'); fileitem.append(delbtn); fileitem.append($('<div/>', { "class": "progress", "style": "width:0%" })); fileitem.append($('<i/>', { "style": "position:relative;z-index:1;" }).html(fname)); this.filelistdiv.append(fileitem); delbtn.bind('click',{'fileitem':fileitem,'file':file,'fname':fname,'_this':this},function (event) { internal.filecount--; event.data.fileitem.remove(); removeitem = event.data.file; event.data._this.files.items = jquery.grep(event.data._this.files.items, function(value) { homecoming value != removeitem; }); if (event.data._this.files.items.length==[]) event.data._this.info.show(); if (event.data._this.ftext) event.data._this.ftext.val('deleted:' + event.data.fname); }); } if ((caller.files)&&(new xmlhttprequest().upload!=null)) { this.files.modern=true; (i=0;i<caller.files.length;i++) { file = caller.files[i]; if (this.checkext (file.name)) { if (internal.filecount<this.settings.maxfilecount || this.settings.maxfilecount==-1) { if (file.size<this.settings.maxfilesize || this.settings.maxfilesize==-1) { internal.filecount++; if (this.info.is(":visible")) {this.info.hide();} this.files.items.push(file); $.proxy(appendfile,this)(file); l = this.files.items.length; ct = l==1?' file':' files'; this.ftext.val(l + ct + ' added.'); } else alert('maximum file size: ' + this.settings.maxfilesize+' bytes.'); } else {alert('you cant upload more ' + this.settings.maxfilecount+ ' files.');break;} }; } } else { if (this.checkext (caller.value)) { if (internal.filecount<this.settings.maxfilecount || this.settings.maxfilecount==-1) { internal.filecount++; if (this.info.is(":visible")) {this.info.hide();} this.lastvalue=caller.value; this.files.modern=false; this.files.items.push(caller); this.filefield = $( '<input/>', { 'class':'file', 'name':'file', 'type':'file', 'multiple':'true'} ).bind('change', $.proxy(this.addfile,this)).css({'opacity':1}); $(caller).after(this.filefield); $(caller).hide(); $.proxy(appendfile,this)(caller); } else alert('you cant upload more ' + this.settings.maxfilecount+ ' files.'); }} }, sendfiles: function () { if (this.files.items.length<1) { this.ftext.val('no files selected.'); return; } $('.delete').each(function (item) { $(this).hide(); }); disable = function ( elm ) { elm = $(elm); elm.die(); elm.removeclass('button'); elm.addclass('disabled'); }; this.filefield.die(); disable(this.submit); disable(!this.fakediv ? this.fileitem: this.fakediv.children()[1]); if (!(this.upinfodiv.is(":visible"))) {this.upinfodiv.slidedown('fast');} if (this.files.modern) { this.tsize( false ); $.proxy(this.uploadmodern,this)( this.files.items[0] ); } else { $.proxy(this.tsize,this)( true ); $.proxy(this.uploadstandart, this)( this.files.items[0] ); $(this.upframe).bind('load',$.proxy(function () { this.reply= this.upframe.contentwindow.document.body.innerhtml; seek { this.reply= $.parsejson(this.reply);} grab (err) {this.uploaderror( 'jsonerror' );}; if (this.reply.success) { if (this.nform) this.nform.remove(); $(this.filelistdiv.children('.fileitem')[this.current].children[1]).css({'width':"100%"}); fname = this.files.items[this.current].value.split('\\'); fname = fname[fname.length-1]; textholder = this.settings.showlinks? $('<a/>',{"href":this.reply.file}) : $('<span/>'); textholder.html(fname); $(this.filelistdiv.children('.fileitem')[this.current].children[2]).html(textholder); this.current++; if (this.files.items[this.current]) { this.uploadstandart(this.files.items[this.current]); } else { this.alldone(); if ($.browser.msie) { $(this.upframe).unbind('load'); this.nform = $('<form/>',{'target':'upframe','action':'about:blank'}).hide(); this.filelistdiv.append(this.nform); this.nform.submit(); } } } else this.uploaderror( 'customerror' ); },this)); } }, tsize: function ( countonly ) { this.filecount = this.files.items.length; if (countonly) return; $(this.files.items).each($.proxy(function (i) { this.totalsize=this.files.items[i].size+this.totalsize; },this)); this.totalsize = (this.totalsize/1024).tofixed(); }, uploadprogress: function ( evt ) { percent = ((evt.loaded * 100) / evt.total).tofixed(); loaded = (evt.loaded/1024).tofixed(); total = (evt.total/1024).tofixed(); this.filepro.html("current file: "+percent+"% "+loaded+"kb/"+total+"kb"); this.totalpro.html('total: '+(this.current+1)+'/'+this.filecount+' files '+((this.totalloaded+evt.loaded)/1024).tofixed()+'/'+this.totalsize+'kb'); $(this.filelistdiv.children('.fileitem')[this.current].children[1]).css({'width':percent + "%"}); }, uploadfinished: function ( evt ) { percent = ((evt.loaded * 100) / evt.total).tofixed(); loaded = (evt.loaded/1024).tofixed(); total = (evt.total/1024).tofixed(); this.totalloaded = this.totalloaded+evt.total; this.filepro.html("current file: 100% "+total+"kb/"+total+"kb"); this.totalpro.html('total: '+(this.current+1)+'/'+this.filecount+' files '+(this.totalloaded/1024).tofixed()+'/'+this.totalsize+'kb') $(this.filelistdiv.children('.fileitem')[this.current].children[1]).css({'width':"100%"}); }, alldone: function () { this.upinfodiv.html('<h2>uploaded!</h2>').addclass('result').css({backgroundcolor:"#cdeb8b"}); this.settings.oncomplete(); }, uploaderror: function ( errortype ) { this.upinfodiv.html('<h2>upload failed</h2>').addclass('result').css({backgroundcolor:"#b02b2c",color:'white'}); $(this.filelistdiv.children('.fileitem')[this.current].children[1]).css({'width': "100%",backgroundcolor:"#b02b2c"}); switch ( errortype ) { case 'statuserror': response = '<b> bad response: '+this.xhr.status+' '+this.xhr.statustext+' </b>'; break; case 'customerror': response = '<b> server error: '+this.reply.details+' </b>'; break; case 'jsonerror': response = "<b>server returned invalid json response.</b>"; break; case 'filematcherror': response = '<b> file sent , file received on server dont match. </b>'; break; default : response = '<b> upload failed.</b>'; break; } this.upinfodiv.append(response); this.settings.onerror( response); }, uploadmodern: function ( file ) { if (file !== null) { this.xhr = new xmlhttprequest(); this.xhr.upload.addeventlistener("progress", $.proxy(this.uploadprogress,this) , false); this.xhr.upload.addeventlistener("load", $.proxy(this.uploadfinished,this) , false); this.xhr.upload.addeventlistener("error", $.proxy(this.uploaderror,this), false); this.xhr.open("post", this.settings.target+'?'+$.param(this.settings.data)); this.xhr.setrequestheader("if-modified-since", "mon, 26 jul 1997 05:00:00 gmt"); this.xhr.setrequestheader("cache-control", "no-cache"); this.xhr.setrequestheader("x-requested-with", "xmlhttprequest"); this.xhr.setrequestheader("x-file-name", file.name); this.xhr.setrequestheader("x-file-size", file.size); this.xhr.setrequestheader("content-type", "multipart/form-data"); this.xhr.onreadystatechange = $.proxy(function () { if (this.xhr.readystate==4) { if (this.xhr.status<400 && this.xhr.status>=200) { seek { this.reply= $.parsejson(this.xhr.responsetext);} grab (err) {this.uploaderror( 'jsonerror' );}; if (this.reply.success) { textholder = this.settings.showlinks? $('<a/>',{"href":this.reply.file}) : $('<span/>'); textholder.html(fname); $(this.filelistdiv.children('.fileitem')[this.current].children[2]).html(textholder); this.current++; if (this.files.items[this.current]) {this.uploadmodern(this.files.items[this.current]);} else this.alldone(); } else this.uploaderror( 'customerror' ); } else this.uploaderror( 'statuserror' ); } },this); if (file.getasbinary != undefined) { this.xhr.sendasbinary(file.getasbinary(file)); //mozilla case } else { this.xhr.send(file); //webkit case } }

}, have checked phpconfig countless times , looks perfect. have updated vps current versions , still nil prepare this. there way can implement like,

$.ajaxsetup({

timeout: 7000

to edit timeout of server? info valuable. give thanks time.

to reply question seem inquire in lastly line: no, can't alter server's scripting timeout browser.

php ajax json

asp.net mvc - Change Name of Html.DropDownListFor - MVC Razor -



asp.net mvc - Change Name of Html.DropDownListFor - MVC Razor -

i creating form drop downwards property named "event". unfortunately reserved word won't work usual:

@html.dropdownlistfor(x => x.event, new selectlist(viewdata["events"] ienumerable<jfs.data.model.event>, "id", "name"))

in controller can't take value separately reserved word, if this:

public actionresult create(int event) { etc etc }

it throws error.

what ideally alter name of dropdown list, this:

@html.dropdownlistfor(x => x.event eventid, new selectlist(viewdata["events"] ienumerable<jfs.data.model.event>, "id", "name"))

but doesn't work. know of right way alter name? :-)

you cannot alter name generated html helpers , design. instead alter name of action parameter , prefix @ allows utilize reserved words in c# variable names:

public actionresult create(int @event) { etc etc }

but in general not recommended utilize reserved words variable names unless absolutely necessary. , in case not absolutely necessary because there's much improve solution of course of study consists in using view model:

public class createeventviewmodel { public int event { get; set; } }

and having controller action take view model argument:

public actionresult create(createeventviewmodel model) { etc etc }

asp.net-mvc razor

format - Fluid Extbase HTML not correct -



format - Fluid Extbase HTML not correct -

i have code:

<f:format.html>{article.text}</f:format.html>

my problem if have tag object oder param in {article.text.} code doesn't compile show me normal text.

is there other possibility prevent ?

thanks

i'm not sure mean "show me normal text", problem format.html view helper uses lib.parsefunc_rte default: http://git.typo3.org/typo3v4/coreprojects/mvc/fluid.git/blob/head:/classes/viewhelpers/format/htmlviewhelper.php#l86

so seek allow tags with

lib.parsefunc_rte.allowtags := addtolist(object, param)

format typo3 fluid extbase

git - Files changed between commits but with limiting file list to older commit -



git - Files changed between commits but with limiting file list to older commit -

situation: have old commit need merge selectively latest commit. files have no changes , other files have important changes need review , merge selectively.

let's old commit 1 had files a, b, c.

the latest commit 5 has involved changing files b , c since commit 1 , added files d, e , f.

so between commits 1 , 5 files b , c have changed, is, running diff on 1:b , 5:b; , on 1:c , 5:c show differences.

i need filenames b , c only.

that is, files not belonging 1 changed or added until , including 5 should not show up.

you might try

git diff --diff-filter=m 1 5

the available filters are

a: added c: copied d: deleted m: modified r: renamed t: type changed (symlink, regular file, etc.) u: unmerged x: unknown b: pairing broken

refer git-diff(1) manual page details.

edit:

if interested in what changed how between 2 commits, can utilize --name-status option, every file changed outputs 1 of above codes. alternative can used git-log telling type of alter made files each of commits.

git merge diff

javascript - extract month day and year after parsed date d3.js -



javascript - extract month day and year after parsed date d3.js -

i parsed date json file function in d3.js:

var parsedate = d3.time.format("%m-%y").parse;

and date as:

var date = "tue jan 01 2013 00:00:00 gmt+0530 (india standard time)"

now want take out month, day, , year variable date , print it. how do that?

or can need print month, day, , year, not stuff tue (india standard time) etc.

edit: assuming mean javascript date object:

var date = new date("tue jan 01 2013 00:00:00 gmt+0530 (india standard time)"); var day = date.getday(); //returns 0 - 6 var month = date.getmonth(); //returns 0 - 11 var year = date.getfullyear(); //returns 4 digit year ex: 2000

javascript d3.js

javascript - How do I push new element with the given text to an array of selected html elements? -



javascript - How do I push new element with the given text to an array of selected html elements? -

this selected html elements:

var array = jquery.makearray($(".dersprg tr td:nth-child(6)"));

this selects table info consists of table header text , irrelevant data. can interpret irrelevant info using if statements , extract info need, can not force array since types not same suppose. code this:

for(i=0 ; i<array.length ; i++){ content = array[i].innerhtml; if(some conditions){ array.splice(i--,1); //eliminate non day elements array.push('test input <br>'); //problematic line } }

you see, utilize innerhtml compare content of selected <td> element, when comes adding test input whole array renders empty. think due type mismatch, not figure out how can solve this. help highly appreciated.

try :

var cell=document.createelement('td'); cell.appendchild( document.createtextnode('test input <br>') ); array.push(cell);

this insert <td> in array instead of string.

javascript arrays

View all keys for plone catalog result -



View all keys for plone catalog result -

how show keys items in catalog search?

links = self.catalog(portal_path='link') link in links: value in link: print value

with code can show values, don't know how show keys.

the zcatalog not homecoming dictionaries. returns sequence of result objects (called catalog brains, because can give them smarts. long historical story).

so loop on them, , each object has attributes each metadata column defined in catalog:

links = self.catalog(portal_path='link') link in links: print link.title

if need dynamically loop on available attributes, utilize .schema() keys:

for link in links: key in link.schema(): print link[attr]

plone catalog

ios - How to make a preference bundle for my mobile substrate tweak? -



ios - How to make a preference bundle for my mobile substrate tweak? -

i have theos, sdk3 installed in iphone

i have created working tweak have no thought how create preference bundle add together settings.

i want yes/no or bool button added preference button see if tweak wants enabled or not

how create tweak read if enabled or not? exmaple:

-(void)something { if (enable = yes) { /*method here*/ } else { //do nil } }

please help

try check link http://blog.aehmlo.com/2012/08/03/new-tweak-readme/ aehmlo lxaitn explains in details how create simple tweak , add together settings enable/disable it.

it works me. hope it's need.

you may want install "theos tutorials" cydia. it's author reverseeffect.

anothe tutorial http://shahiddev.blogspot.com/2011/11/mobilesubstrate-tweak-tutorial-with.html

go "settings"

if user disable our tweak? can give him ability enable or disable preference bundle. (we utilize plist simple this, we’ll utilize preference bundle project in order seek out). i’m going skip few steps this, since can figure them out yourself, looking @ source code can download below. - launch new instance creator, , initiate “preferencebundle” project. - add together project “subproject” in main tweak project, adding subprojects = tutorialsettings key in makefile. - construction of preference bundle given plist containing collection os psspecifiers, used standard preferences app. - create switch controlling “enabled” key. - “defaults” key set bundle id used before (com.filippobiga.tutorial). means it’ll write plist name in preferences folder of user. - need modify code in tweak.xm read user’s settings , determine if should flash screen or not. that’s it!

ios settings tweak theos cydia-substrate

encoding - In Perl, How do I replace UTF8 characters, such as \x91, \x{2018}, \x{2013}, \x{2014} with simple ASCII chars? -



encoding - In Perl, How do I replace UTF8 characters, such as \x91, \x{2018}, \x{2013}, \x{2014} with simple ASCII chars? -

i'm working various articles , problem i'm having various authors utilize various characters punctuation characters.

for example, several documents i'm work have characters such as:

\x91 \x92 \x{2018} \x{2019}

and these characters represent simple quote '.

what want simplify articles had same formatting style.

does know module, or method, of converting these character , similar ones (like double quotes, dashes, etc) simple ascii characters?

i'm doing things like:

sub fix_chars_in_document { $document = shift; $document =~ s/\xa0/ /g; $document =~ s/\x91/'/g; $document =~ s/\x92/'/g; $document =~ s/\x93/"/g; $document =~ s/\x94/"/g; $document =~ s/\x97/-/g; $document =~ s/\xab/"/g; $document =~ s/\xa9//g; $document =~ s/\xae//g; $document =~ s/\x{2018}/'/g; $document =~ s/\x{2019}/'/g; $document =~ s/\x{201c}/"/g; $document =~ s/\x{201d}/"/g; $document =~ s/\x{2022}//g; $document =~ s/\x{2013}/-/g; $document =~ s/\x{2014}/-/g; $document =~ s/\x{2122}//g; homecoming $document ; }

but hard i've manually find characters , replace them.

first, solution benefit hash.

my %asciify = ( chr(0x00a0) => ' ', chr(0x0091) => "'", chr(0x0092) => "'", chr(0x0093) => '"', chr(0x0094) => '"', chr(0x0097) => '-', chr(0x00ab) => '"', chr(0x00a9) => '/', chr(0x00ae) => '/', chr(0x2018) => "'", chr(0x2019) => "'", chr(0x201c) => '"', chr(0x201d) => '"', chr(0x2022) => '/', chr(0x2013) => '-', chr(0x2014) => '-', chr(0x2122) => '/', ); $pat = bring together '', map quotemeta, keys %asciify; $re = qr/[$pat]/; sub fix_chars { ($s) = @_; $s =~ s/($re)/$asciifi{$1}/g; homecoming $s; }

that said, want text::unidecode.

just punctuation characters:

use text::unidecode qw( unidecode ); s/(\p{punct}+)/ unidecode($1) /eg;

perl encoding character-encoding ascii non-ascii-characters

properties - JBoss - how programatically check values from standalone.xml? -



properties - JBoss - how programatically check values from standalone.xml? -

does know how check in runtime code if configuration has defined e.g. 'any-address' tag?

... <interfaces> <interface name="management"> <inet-address value="${jboss.bind.address.management:127.0.0.1}"/> </interface> <interface name="public"> <any-address/> </interface> </interfaces> ...

for "jboss.bind.address" can scheme property - in "any-address" case?

you can seek run co-located management client within application.

properties jboss bind

java - How to dynamically change JLabel's contents -



java - How to dynamically change JLabel's contents -

the below program, calls jframe's frame.repaint() fill within frame dynamically. on same lines, want have 2 labels( west & east) of frame , have labels dynamically changing. have tried lotta things like, jlabel label.repaint(),label.removeall(),etc, doesn't work. have left code, clean can fill in...

jframe frame=new jframe(); frame.setsize(512, 512); frame.add(image1); frame.setvisible(true); frame.setdefaultcloseoperation(jframe.exit_on_close); start_sum=0; while(true) { frame.repaint(); seek { thread.sleep(sleep_for_each_rotation); } grab (interruptedexception e) { // todo auto-generated grab block e.printstacktrace(); } start_sum+=radian/divide_size; //some calculation stuff if(start_sum>=360) start_sum=0; }

from looks of code, blocking event dispatching thread (edt).

the edt responsible (amongst other things), processing repaint events. means if block edt, nil can repainted.

the other problem have is, should never create or modify ui component thread other edt.

take @ concurrency in swing more details.

the next illustration uses javax.swing.timer, sounds of things, you'll find swing worker more useful

public class testlabelanimation { public static void main(string[] args) { new testlabelanimation(); } public testlabelanimation() { eventqueue.invokelater(new runnable() { @override public void run() { seek { uimanager.setlookandfeel(uimanager.getsystemlookandfeelclassname()); } grab (classnotfoundexception | instantiationexception | illegalaccessexception | unsupportedlookandfeelexception ex) { } jframe frame = new jframe("test"); frame.setdefaultcloseoperation(jframe.exit_on_close); frame.setlayout(new borderlayout()); frame.add(new testpane()); frame.pack(); frame.setlocationrelativeto(null); frame.setvisible(true); } }); } public class testpane extends jpanel { private jlabel left; private jlabel right; public testpane() { setlayout(new borderlayout()); left = new jlabel("0"); right = new jlabel("0"); add(left, borderlayout.west); add(right, borderlayout.east); timer timer = new timer(250, new actionlistener() { @override public void actionperformed(actionevent e) { left.settext(integer.tostring((int)math.round(math.random() * 100))); right.settext(integer.tostring((int)math.round(math.random() * 100))); } }); timer.setrepeats(true); timer.setcoalesce(true); timer.start(); } } }

java swing jframe jpanel jlabel

qt - google-bigquery how to get datasetlist with https get? -



qt - google-bigquery how to get datasetlist with https get? -

i'm trying dataset list bigquery webserver https get

following documentation here: https://developers.google.com/bigquery/docs/reference/v2/datasets/list

i'm using modified code from: http://code.google.com/p/qt-google-bigquery/source/browse/manager_bigquery.cpp

getdatasetslist(qstring strprojectid) { qstring url = qstring("https://www.googleapis.com/bigquery/v2/projects/%1/datasets?key=%2").arg(str_projectid).arg(this->api_key); //also tried without ?key= part qnetworkrequest request; request.seturl( qurl(url) ); //this urlencodes request.setrawheader("content-type", "application/json"); request.setrawheader("authorization", (qstring("bearer %1").arg(m_access_token)).tolatin1()); //here post request http asynchronously }

i error message:

reply = "{ "error": { "errors": [ { "domain": "global", "reason": "required", "message": "required parameter missing" } ], "code": 400, "message": "required parameter missing" } }

note: managed run query , results, access token seems valid, doing wrong here?

solved

ah, problem in coding, not request, posted http post, not get.

see reply in comment original poster above - create sure using instead of post method api phone call list datasets. other bigquery api methods utilize post, put, or patch.

https://developers.google.com/bigquery/docs/reference/v2/datasets/list

qt google-bigquery

xhtml - Black bar on iPad after setting viewport -



xhtml - Black bar on iPad after setting viewport -

site address: straightace.com

used next code:

<meta name="viewport" content="initial-scale=1, user-scalable=yes,maximum-scale=0.6,width=device-width"> <meta name="viewport" content="height=device-height,width=device-width">

the intent have 1085 px wide page load in ipad oriented vertically or horizontally, have separate script device under 699px wide redirects mobile site , not worried android tablets @ moment. goes smoothly when loading page in either orientation , when loading horizontally , turning vertical.

the problem when loading page in vertical orientation , turning horizontal, page pushes left , big black bar appears on right hand side of screen. upon refreshing, bar disappears.

can help removing black bar while retaining functionality of viewport?

this code might of help:

<meta name="viewport" content="width=device-width,height=device-height, initial-scale=.5">

that is, remove maximum-scale attribute code.

ipad xhtml meta joomla3.0

mobile - Can Sikuli be used for moble web testing? -



mobile - Can Sikuli be used for moble web testing? -

i know sikuli used mobile apps testing, has used mobile web testing ios safari or android browser on mobile devices?

i used sikuli testing mobile applications (not web).

it worked way (all actions performed using sikuli):

1) launch phone emulator;

2) deploy application (if needed);

3) launch application;

4) run test cases (click somewhere, come in text, swipe, check if expected etc);

5) close application;

6) close emulator.

what liked - possible perform swipe and/or drag-and-drop using sikuli.

testing mobile mobile-website sikuli

jetty 9 and intellij won't start -



jetty 9 and intellij won't start -

i'm playing around intellij new project , having bit of problem. when seek run jetty 9 intellij 12, error

"c:\program files\java\jdk1.7.0_13\bin\java" -dstop.port=0 -dcom.sun.management.jmxremote= -dcom.sun.management.jmxremote.port=1099 -dcom.sun.management.jmxremote.authenticate=false -dcom.sun.management.jmxremote.ssl=false -doptions=jmx -didea.launcher.port=7553 "-didea.launcher.bin.path=c:\program files (x86)\jetbrains\intellij thought 12.0.4\bin" -dfile.encoding=windows-1252 -classpath "start.jar;c:\program files (x86)\jetbrains\intellij thought 12.0.4\lib\idea_rt.jar" com.intellij.rt.execution.application.appmain org.eclipse.jetty.start.main etc/jetty-jmx.xml c:\users\willie\appdata\local\temp\context9038140457899104277config\jetty-contexts.xml [2013-02-17 01:49:18,784] artifact armor:war exploded: server not connected. press 'deploy' start deployment. 2013-02-17 01:49:20.055:warn:oejx.xmlparser:main: fatal@file:/c:/code/jetty-9.0.0.rc0/start.d/ line:1 col:1 : org.xml.sax.saxparseexception; systemid: file:/c:/code/jetty-9.0.0.rc0/start.d/; linenumber: 1; columnnumber: 1; content not allowed in prolog. java.lang.reflect.invocationtargetexception @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:601) @ org.eclipse.jetty.start.main.invokemain(main.java:453) @ org.eclipse.jetty.start.main.start(main.java:595) @ org.eclipse.jetty.start.main.main(main.java:96) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:601) @ com.intellij.rt.execution.application.appmain.main(appmain.java:120) caused by: org.xml.sax.saxparseexception; systemid: file:/c:/code/jetty-9.0.0.rc0/start.d/; linenumber: 1; columnnumber: 1; content not allowed in prolog. @ com.sun.org.apache.xerces.internal.util.errorhandlerwrapper.createsaxparseexception(errorhandlerwrapper.java:198) @ com.sun.org.apache.xerces.internal.util.errorhandlerwrapper.fatalerror(errorhandlerwrapper.java:177) @ com.sun.org.apache.xerces.internal.impl.xmlerrorreporter.reporterror(xmlerrorreporter.java:441) @ com.sun.org.apache.xerces.internal.impl.xmlerrorreporter.reporterror(xmlerrorreporter.java:368) @ com.sun.org.apache.xerces.internal.impl.xmlscanner.reportfatalerror(xmlscanner.java:1388) @ com.sun.org.apache.xerces.internal.impl.xmldocumentscannerimpl$prologdriver.next(xmldocumentscannerimpl.java:998) @ com.sun.org.apache.xerces.internal.impl.xmldocumentscannerimpl.next(xmldocumentscannerimpl.java:607) @ com.sun.org.apache.xerces.internal.impl.xmlnsdocumentscannerimpl.next(xmlnsdocumentscannerimpl.java:116) @ com.sun.org.apache.xerces.internal.impl.xmldocumentfragmentscannerimpl.scandocument(xmldocumentfragmentscannerimpl.java:489) @ com.sun.org.apache.xerces.internal.parsers.xml11configuration.parse(xml11configuration.java:835) @ com.sun.org.apache.xerces.internal.parsers.xml11configuration.parse(xml11configuration.java:764) @ com.sun.org.apache.xerces.internal.parsers.xmlparser.parse(xmlparser.java:123) @ com.sun.org.apache.xerces.internal.parsers.abstractsaxparser.parse(abstractsaxparser.java:1210) @ com.sun.org.apache.xerces.internal.jaxp.saxparserimpl$jaxpsaxparser.parse(saxparserimpl.java:568) @ com.sun.org.apache.xerces.internal.jaxp.saxparserimpl.parse(saxparserimpl.java:302) @ org.eclipse.jetty.xml.xmlparser.parse(xmlparser.java:204) @ org.eclipse.jetty.xml.xmlparser.parse(xmlparser.java:220) @ org.eclipse.jetty.xml.xmlconfiguration.<init>(xmlconfiguration.java:138) @ org.eclipse.jetty.xml.xmlconfiguration$1.run(xmlconfiguration.java:1209) @ java.security.accesscontroller.doprivileged(native method) @ org.eclipse.jetty.xml.xmlconfiguration.main(xmlconfiguration.java:1160) ... 12 more usage: java -jar start.jar [options] [properties] [configs] java -jar start.jar --help # more info process finished exit code -2 disconnected server

this base of operations system. have deleted profile, recreated it, i've downloaded re-create of jetty, i've done can think of. curious thing thing in start.d folder default test ini file came distribution. opened xml file ini file references , there nil wrong it. i'm stumped. know going on here?

update, jetty runs fine command line, not intellij

update 2, seems way intellij deployments thru plugin, creates new jetty-contexts.xml file. file seems not liked jetty. here file

<?xml version="1.0" encoding="utf-8"?> <!doctype configure public "-//jetty//configure//en" "http://www.eclipse.org/jetty/configure.dtd"> <configure class="org.eclipse.jetty.server.server" id="server"> <ref id="deploymentmanager"> <call name="addappprovider"> <arg> <new class="org.eclipse.jetty.deploy.providers.contextprovider"> <set name="monitoreddir">c:\users\willie\appdata\local\temp\context7950837742823871110deploy</set> <set name="scaninterval">1</set> </new> </arg> </call> </ref> </configure>

and new dump, i've deleted test wars , removed start.d config.

"c:\program files\java\jdk1.7.0_13\bin\java" -dstop.port=0 -dcom.sun.management.jmxremote= -dcom.sun.management.jmxremote.port=1099 -dcom.sun.management.jmxremote.authenticate=false -dcom.sun.management.jmxremote.ssl=false -doptions=jmx -didea.launcher.port=7538 "-didea.launcher.bin.path=c:\program files (x86)\jetbrains\intellij thought 12.0.4\bin" -dfile.encoding=windows-1252 -classpath "start.jar;c:\program files (x86)\jetbrains\intellij thought 12.0.4\lib\idea_rt.jar" com.intellij.rt.execution.application.appmain org.eclipse.jetty.start.main etc/jetty-jmx.xml c:\users\willie\appdata\local\temp\context826007528789372946config\jetty-contexts.xml [2013-02-17 05:38:31,987] artifact armor:war exploded: server not connected. press 'deploy' start deployment. 2013-02-17 05:38:33.509:warn:oejx.xmlconfiguration:main: config error @ <call name="addappprovider"><arg>|????<new class="org.eclipse.jetty.deploy.providers.contextprovider"><set name="monitoreddir">c:\users\willie\appdata\local\temp\context7950837742823871110deploy</set><set name="scaninterval">1</set></new>|???</arg></call> java.lang.classnotfoundexception: org.eclipse.jetty.deploy.providers.contextprovider in file:/c:/users/willie/appdata/local/temp/context826007528789372946config/jetty-contexts.xml 2013-02-17 05:38:33.510:warn:oejx.xmlconfiguration:main: config error @ <ref id="deploymentmanager"><call name="addappprovider"><arg>|????<new class="org.eclipse.jetty.deploy.providers.contextprovider"><set name="monitoreddir">c:\users\willie\appdata\local\temp\context7950837742823871110deploy</set><set name="scaninterval">1</set></new>|???</arg></call></ref> java.lang.classnotfoundexception: org.eclipse.jetty.deploy.providers.contextprovider in file:/c:/users/willie/appdata/local/temp/context826007528789372946config/jetty-contexts.xml java.lang.reflect.invocationtargetexception @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:601) @ org.eclipse.jetty.start.main.invokemain(main.java:453) @ org.eclipse.jetty.start.main.start(main.java:595) @ org.eclipse.jetty.start.main.main(main.java:96) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:601) @ com.intellij.rt.execution.application.appmain.main(appmain.java:120) caused by: java.lang.classnotfoundexception: org.eclipse.jetty.deploy.providers.contextprovider @ java.net.urlclassloader$1.run(urlclassloader.java:366) @ java.net.urlclassloader$1.run(urlclassloader.java:355) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:354) @ java.lang.classloader.loadclass(classloader.java:423) @ java.lang.classloader.loadclass(classloader.java:356) @ org.eclipse.jetty.util.loader.loadclass(loader.java:100) @ org.eclipse.jetty.xml.xmlconfiguration$jettyxmlconfiguration.nodeclass(xmlconfiguration.java:354) @ org.eclipse.jetty.xml.xmlconfiguration$jettyxmlconfiguration.newobj(xmlconfiguration.java:743) @ org.eclipse.jetty.xml.xmlconfiguration$jettyxmlconfiguration.itemvalue(xmlconfiguration.java:1111) @ org.eclipse.jetty.xml.xmlconfiguration$jettyxmlconfiguration.value(xmlconfiguration.java:1016) @ org.eclipse.jetty.xml.xmlconfiguration$jettyxmlconfiguration.call(xmlconfiguration.java:710) @ org.eclipse.jetty.xml.xmlconfiguration$jettyxmlconfiguration.configure(xmlconfiguration.java:407) @ org.eclipse.jetty.xml.xmlconfiguration$jettyxmlconfiguration.refobj(xmlconfiguration.java:819) @ org.eclipse.jetty.xml.xmlconfiguration$jettyxmlconfiguration.configure(xmlconfiguration.java:419) @ org.eclipse.jetty.xml.xmlconfiguration$jettyxmlconfiguration.configure(xmlconfiguration.java:344) @ org.eclipse.jetty.xml.xmlconfiguration.configure(xmlconfiguration.java:262) @ org.eclipse.jetty.xml.xmlconfiguration$1.run(xmlconfiguration.java:1221) @ java.security.accesscontroller.doprivileged(native method) @ org.eclipse.jetty.xml.xmlconfiguration.main(xmlconfiguration.java:1160) ... 12 more usage: java -jar start.jar [options] [properties] [configs] java -jar start.jar --help # more info

the utilize of org.eclipse.jetty.start.main meant utilize total , finish jetty distribution.

it bootstrap found right classpath , configuration xmls start jetty.

your command line (i have not tested this) instead ...

"c:\program files\java\jdk1.7.0_13\bin\java" -djetty.home=c:\path\to\jetty\distribution -dstop.port=0 -didea.launcher.port=7553 "-didea.launcher.bin.path=c:\program files (x86)\jetbrains\intellij thought 12.0.4\bin" -dfile.encoding=windows-1252 -jar start.jar "-dpath=c:\program files (x86)\jetbrains\intellij thought 12.0.4\lib\idea_rt.jar" org.eclipse.jetty.start.main

note need next ...

to define jetty.home property jetty knows files to have intellij jars defined via -dpath=${classpath} configurable jetty pass through running server to have intellij properties defined in ${jetty.home}/start.ini to have options command line defined in ${jetty.home/start.ini to have various jmx properties defined in ${jetty.home}/start.ini put custom jetty-context.xml ${jetty.home}/webapps/ directory, or alter deployment directory (in etc/jetty-deploy.xml) jetty-context.xml file located. sure reference war file create sense.

finally, know can inquire jetty server classpath plenty command line alternative --version list classpath server utilize (in order server utilize it) based on have configured start bootstrap process.

intellij-idea jetty