Posts

Showing posts from February, 2010

java - Regexp to match full Exception name -

i need regexp whole exception name incl. dots stacktrace , it's whitespace before it. time: sun apr 10 20:36:57 cest 2011 message: java.lang.nullpointerexception @ com.hello.world.hi.initdb(bla.java:273) something : string test = "time: sun apr 10 20:36:57 cest 2011\nmessage: java.lang.nullpointerexception\n @ com.hello.world.hi.initdb(bla.java:273)"; pattern check = pattern.compile(".*message:(\\s[\\w\\.]*)"); matcher checker = check.matcher(test); while(checker.find()) { system.out.println(checker.group(1)); } output java.lang.nullpointerexception update ok, if want match "exception" word - there way: string test = "time: sun apr 10 20:36:57 cest 2011\nmessage: java.lang.nullpointerexception\n @ com.hello.world.hi.initdb(bla.java:273)"; pattern check = pattern.compile("(\\s[\\w\\.]*exception)"); matcher checker = check.matcher(test); while(checker.find()) { system.out.println(checker.group...

SQL Server date vs smalldatetime -

i have bunch of tables consolidate data on different levels: quarterly, hourly, daily , monthly. apart there's base table contains "raw" data well, 1 contains columns. consolidated tables have same columns. the base, quarterly , hourly tables make use of column of type smalldatetime timestamp data. column available in hourly , daily tables, of course won't need time aspect here. for sake of simplicity want use smalldatetime data type here also, maybe it's better performance use date data type column? is there big difference between types when comes down performance? it's idea use smallest data type need. shouldn't use varchar(max) or varchar(10) store 2 character state abbreviation. in same sense, if need date (e.g. 4/11/2001) use date type , not datetime type. while might not huge gain in performance (datetime 5 bytes larger date.)it can start adding if have multiple fields and/or multiple rows.

.net - C# Console.ReadKey read numbers greater than 9 -

im working consolekeyinfo in c# have problems console.readkey when try write numbers greater 9 in console, example consolekeyinfo number; console.write("write number: "); number = console.readkey(); if want write 10 or 11... console reads "1" i dont wanna use console.readline because don want press "enter" each number. is there way use console.readkey wait maybe 1 second before continue? thanks the best can use console.readline() . there's no way program know have finished number. update if have fixed length number (i.e. 13-digit isbn), can use readkey, this: string isbn = ""; while (isbn.length < 13) { isbn += console.readkey().keychar; }

iphone - Testing NSWidowController using OCMock -

i've been trying come a way unit test applicationdidfinishlaunching delegate using ocmock. nswindowcontroller instantiated here , i'd test it. here's test code: id mockwindowcontroller = [ocmockobject nicemockforclass:[urltimerwindowcontroller class]]; [[mockwindowcontroller expect] showwindow:self]; nsuinteger preretaincount = [mockwindowcontroller retaincount]; [appdelegate applicationdidfinishlaunching:nil]; [mockwindowcontroller verify]; when run test, error: "ocmockobject[urltimerwindowcontroller]: expected method not invoked: showwindow:-[urltimerappdelegatetests testapplicationdidfinishlaunching]" the log gives more detail: "test case '-[urltimerappdelegatetests testapplicationdidfinishlaunching]' started. 2011-04-11 08:36:57.558 otest-x86_64[3868:903] -[urltimerwindowcontroller loadwindow]: failed load window nib file 'timerwindow'. unknown.m:0: error: -[urltimerappdelegatetests testapplicationdidfinishlaunching] : ocm...

iphone - Identify the current Navigation Bar -

i'm trying identify navigation bar in current view can add subview it. i have seen code able identify navigation bar has been dynamically created , tagged: uinavigationbar *thenavigationbar = (uinavigationbar *)[inparent.view viewwithtag:knavigationbartag]; but in case navigation bar not being created dynamically, it's not tagged. there way identify otherwise? self.navigationcontroller.navigationbar only valid when called method in uiviewcontroller, of course. otherwise, try retrieve reference view controller , take there.

javascript - Write mongodb mapReduce result to a file -

i have collection in mongodb data in collection has following structure : {userid = 1 (the id of user), key1 = value1 , key2 = value2, .... } i want write mongodb mapreduce functions put userid in map function , in reduce function need write ( key,value ) pairs in csv (?) file such : key1,key2, key3,... value1,value2,value3,.. value1,value2,value3,.. value1,value2,value3,.. how can mongodb thanks there no "file output" option. the mongodb documentation has details on exporting data . in particular, mongoexport allows export json or csv should legible other software. if want modify data output, you'll have use client library , cursor through data while writing file.

asp.net - Multiple '@' symbol in email address not working with .net 2005 -

in our application send email user of applications. when our user email address paulo.macedo@company.com.br@company, fails exception of system.net.mime.mailbnfhelper.readmailaddress so can email address have multiple '@' symbol , can .net mailmessege object handle it? it possible have few @ signs, have put other 1 in quotes.

user interface - Best GUI language/tool to quickly create cross platform (Mac & Windows) Adobe Photoshop competitor? -

if wanted create competitor adobe photoshop, language or tool allow me build on mac , windows? i assume have build separately mac , windows since java way build cross platform - , java not work (or wrong?) adobe lightroom built using lua , c , 63% of code base lua . accounts fact majority of code base application gui code. low level image manipulation code written in c, portable @ level. alternative lua python . cross platform, qt used in graphically intense cross platform applications guitar pro 6, lightwave 10 , others. there rich bindings between python , qt. lua or python can accelerate , streamline time consuming part of application letting put gui more but ... ... skeptical of kind of "competitor" photoshop ( or other mathematically complex piece of software ) because of shear scope of project. photoshop has been created team of dozens or more software developers on 10s of years. used first version before had number, barrier entry "competit...

Is a variant of this possible with C# Generics? -

am trying achieve impossible or unnecessary? code in getlist same specializations of class a, apart bit create new instance of specialization. there no default constructor, same list of parameters. at moment using instead public static list<a> getlist(int i, func<a> createmeaninstance) which feels unclean. abstract class { protected (int i) { } public static list<t> getlist<t>(int i) t : { var list = new list<t>(); for(int x = 1; x< 100; x++) { var o = new t(i); list.add(o); } } } public class b : { public b (int i) : base(i) {} } ... var list = a.getlist<b>(1); you can't call parameterized constructors on generic types. func<> version best approach here.

matlab - How can I create all combinations of characters in sets of text? -

for example, have sets of text so: column 1: a b column 2: l m n column 3 : v w x y and want combine them output this: alv alw alx aly amv amw amx amy ... which output 24 combinations of text. if use first 2 columns, output 2*3=6 combinations. i'm not able figure out how in matlab. suggestions? one solution use function ndgrid generate of combinations of indices sets: c = {'ab' 'lmn' 'vwxy'}; %# cell array of text sets sizevec = cellfun('prodofsize',c); %# vector of set sizes [index3,index2,index1] = ndgrid(1:sizevec(3),... %# create index 1:sizevec(2),... %# combinations 1:sizevec(1)); %# sets combmat = [c{1}(index1(:)); ... %# index each corresponding cell of c , c{2}(index2(:)); ... %# concatenate results 1 matrix c{3}(index3(:))].'; and should following combmat : alv alw alx aly amv amw amx amy...

connecting android to mysql database -

Image
i have been trying tutorial. doent show errors on emulator url gave appearing! my connection string was: public static final string key_121 = "http://10.0.2.2/index.php"; (i used 10.0.2.2 working on local host) when checked logcat showed me dis: error parsing data org.json.jsonexception: value <br of type java.lang.string cannot converted jsonarray i dont know whats wrong code. can please me. need on final year project. this android java code import java.io.bufferedreader; import java.io.inputstream; import java.io.inputstreamreader; import java.util.arraylist; import org.apache.http.httpentity; import org.apache.http.httpresponse; import org.apache.http.namevaluepair; import org.apache.http.client.httpclient; import org.apache.http.client.methods.httppost; import org.apache.http.impl.client.defaulthttpclient; import org.apache.http.message.basicnamevaluepair; import org.json.jsonarray; import org.json.jsonexception; import org.json.jsonobject; import...

winforms - .NET keep application alive while waiting for task to complete -

i inherited c# 4.0 winforms app (basically small dashboard) uses producer-consumer pattern. consumer task (literally system.threading.tasks.task) processing data in queue. when user wants shut down app, producer (a tcp socket server) stopped immediately. however, queue may not empty need give user option exit or exit consumer task has finished processing of queued data. if user wants wait consumer task finish, ui naturally needs remain responsive. problem i'm having since code exit application resides in click event handler "exit" button, may need wait consumer task finish while i'm inside click event handler. in nutshell, event handler contains (very ugly) code: // loop while there still data in queue while (queueddata.count > 0) { application.doevents(); // ui semi-responsive lot of cpu utilization) } // queue empty exit application can suggest alternate way of implementing functionality i'm not stuck in tight loop inside of event...

Android Left,Center and Right Alignment -

i pretty new android , trying sample app 3 elements (2 buttons , 1 text view ) placed horizontally. need text in center 2 buttons aligned left , right of view. e.g. |<button> <text> <button>| appreciate if me this. thanks in advance edit: believe solve problem. see below code. let me know if helps! know has helped me , using it. accept answer if worked! =) <?xml version="1.0" encoding="utf-8"?> <tablelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:stretchcolumns="1"> <tablerow> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button1" android:id="@+id/button1button"></button> <edittext ...

oledb - How to select the default worksheet from an excel file -

Image
in case user uploads excel file 1 worksheet, want intelligently use worksheet. however, when pull schema file see unexpected worksheet (circled): the schema retrieved via: oledbconnection.getschema("tables") in case, looks second worksheet filter defined user "peg" 2 columns scrolling. question : safe me ignore worksheets "$<filter>" appended? put way, if run through worksheets, throwing out "$<filter>" types, , find there 1 left, reasonable default use worksheet? have reference? thanks! yes, have thought so. $ means refering named range or macro in workbook. might use regex , capture within ' '. here reference on how select data named range: http://msdn.microsoft.com/en-us/library/ms971514.aspx how u pull schema file? maybe can filter has worksheets ?

.net - Logging Database Access Through ADO.NET -

we have legacy asp.net web application executes many stored procedures via ado.net. can recommend profiling tool or straightforward method log these database calls client-side when occur? i appreciate tips. log4net won't work if app isn't instrumented it. sql profiler server-side , impacts sql server performance. you should @ ado.net trace logging: http://msdn.microsoft.com/en-us/library/aa964124(sql.90).aspx i believe need do.

android - layout problem in samsung galaxy tab application -

hi friends creating application samsung galaxy tab while giving fill_parent layout not filling full screen left side , right side black screen appear can tell problem? i giving support screen tag in android manifest file got

jquery - Window not redirected to correct URL passed from Json return -

function getopenurl(transactionid, legacyindication) { var json = { id : transactionid, legacyindication : legacyindication }; $.ajax({ type: "post", url: "<%= url.action("opensavedindication", "indications") %>", data: json, success: function(data) { alert(data); //window.location = data; } }); } so when perform alert, correct url: "/extranet/mvc/indications.cfc/economics/02559e2e-d48e-4623-b877-69f36aa8b011" however, if let run, error page says: description: http 404. resource looking (or 1 of dependencies) have been removed, had name changed, or temporarily unavailable. please review following url , make sure spelled correctly. requested url: /extranet/mvc/indications.cfc/"/extranet/mvc/indications.cfc/economics/02559e2e-d48e-462...

graphics - How can I make colors in Adobe Illustrator line up more closely with colors on the iPhone 4? -

images vibrant purple colors in them washed out , faded on iphone 4's screen. effect happens other colors too. also, purples in illustrator blue on phone. should add don't have problem when viewing images on iphone 3g. edit: has else had marked color difference between illustrator/photoshop , iphone 4? take care 3g/3gs/4 doesnt have same display components , consequently not same colors. got 4 devices, lining them brightness @ maximum reveals impressive differences... and 1 model there variations depending guess on production site/date...

Where can I download nhibernate.caches.syscache 3.1 -

i've been looking on internet , can't seem find can download v3.1 of nhibernate.caches.syscache works nhibernate 3.1.0.4000. i have version 3.0.0.4000 of syscache, there newer version? the official place here: http://sourceforge.net/projects/nhcontrib/files/nhibernate.caches/ don't know if cache officially mantained in place, have look.

c++ - The error representation and handling -

i designing cross-platform application protection library communicate dongle. dongle able send , receive blocks of data, create , delete directories , files inside dongle's internal file system, etc. put simple, main dongle object has methods implement of these functionalities. unfortunately, of these methods may fail. right thinking if :) the obvious solution return boolean type result of these methods indicate if fail or success. however, leads loss of details nature of error. the next possible solution return error code, there more 30 types of errors. also, need design separate function convert of these return codes more readable string representation. the third solution return boolean type result, keep error state object in main dongle object possible retrieve using getlasterror() method. considering using one. now question. there other reasonable error representation , handling patterns , suggest me use in case? thanks, ilya of options have presented...

javascript - Drop down that instantly switches info -

i looking write html page has drop down menu on , content. instance, drop down menu has 7 days of week listed , depending day selected div contains day's activities. know how make work can pick day want, press button, , browser loads new page desired info. how go writing user clicks on drop down menu entry page's info alters. thinking maybe store info in bunch of hidden divs that, upon clicking on drop down menu's entry, swapped in , out. i'm not sure, however, how capture event of entry in drop-down menu being selected. i thinking maybe store info in bunch of hidden divs that, upon clicking on drop down menu's entry, swapped in , out. you can use ajax load data. i'm not sure, however, how capture event of entry in drop-down menu being selected. javascript has lots of events: http://www.w3schools.com/jsref/dom_obj_event.asp i've done poor example using divs: <html> <body> <select id="day"> <opt...

java - Problems with two threads accessing a frequently updated Arraylist -

i have arraylists store many objects, , objects added , removed arraylists. 1 thread operates on data structures , updates arraylist's objects every 20ms or so. thread traverses arraylists , uses elements paint objects (also every 20-30ms). if arraylists traversed using loop, indexoutofboundsexceptions abound. if arraylists traversed using iterators, concurrentmodificationexceptions abound. synchronizing arraylists so: list list = collections.synchronizedlist(new arraylist()); synchronized(list) { //use iterator traversals } throws no exceptions has substantial performance drain. there way traverse these arraylists without exceptions being throw, , without performance drain? thanks! a approach problem make threads work on different copies of list. however, copyonwritearraylist doesn't fit here well, since creates copy @ every modification, in case better create copies less frequent. so, can implement manually: first thread creates copy of updated list ,...

javascript - Quick jQuery question on toggle events -

hey all, i'm using jquery ui div toggles on , off screen. on document load div object on screen. works great wondering if there way set hidden on document load, user have ability click button make appear. tried having function run on document.ready didnt seem work. here code directly jqueryui. help! $(function() { // run selected effect function runeffect() { // effect type var selectedeffect = "slide"; // effect types need no options passed default var options = {}; // effects have required parameters if ( selectedeffect === "scale" ) { options = { percent: 0 }; } else if ( selectedeffect === "size" ) { options = { to: { width: 200, height: 60 } }; } // run effect $( "#effect" ).toggle( selectedeffect, options, 500 ); }; // set effect select menu...

perl - How can I use Net::FTP to get a file matching a pattern? -

how can use net::ftp file matching pattern? basically want is: $ftp->get("test*"); should match files starting test , get() . thanks help! try this solution perlmonks.org. remote ls, filter out don't want grep , fetch files. $ftp->get($_) grep /\.txt$/, $ftp->ls; btw, took 10 seconds find google "net::ftp mget"

python - Test specific models in Django -

is possible have set of models testing purposes? idea i've written app contains helper abstract model helperbase. i'd provide models inherit in order test it, derivedtest1, derivedtest2. wouldn't test models appear in production database in end. want tables constructed in test database. possible , if - how it? i've tried creating models in tests.py file doesn't seem work. you try creating whole new app use on development server. e.g., if app called myapp call testing app myapp_test . then in myapp_test 's models.py from myapp import models , subclass models in there. then in settings.py either try , remember comment out myapp_test application installed_apps when deploying production server. or can use local_settings.py methodology have myapp_test included in installed_apps on test machine.

html - Odd javascript XSS error -

i'm designing simple way communicate between iframes, , getting odd xss error, though both urls have save domain. unsafe javascript attempt access frame url file:///home/bryre/shareddata/programs/javascript/pong/htdocs/connectionwindow.html frame url file:///home/bryre/shareddata/programs/javascript/pong/htdocs/connectiontest.html. domains, protocols , ports must match. do need have them on server work? here code: connectiontest.html <html> <head> <title>connectiontest</title> <script src='connection.js'></script> </head> <body> <script> var windowtoconnectto = document.createelement('iframe') windowtoconnectto.src = 'connectionwindow.html' document.body.appendchild(windowtoconnectto) var connection = new connection({}); connection.connect(windowtoconnectto, 10); </script> </body> connectionwindow.html <html> <...

c++ - In ICU UnicodeString what is the difference between countChar32() and length()? -

from docs; the length number of uchar code units in unicodestring. if want number of code points, please use countchar32(). and count unicode code points in length uchar code units of string. a code point may occupy either 1 or 2 uchar code units. counting code points involves reading code units. from inclined think code point actual character , code unit 1 possible part of character. for example. say have unicode string like: 'foobar' both length , countchar32 6. have string composed of 6 chars take full 32 bits encode length 12 countchar32 6. is correct? the 2 values differ if use characters out of base multilingual plane (bmp). these characters represented in utf-16 surrogate pairs . 2 16-bit characters make 1 logical character. if use of these, each pair counts one 32-bit character 2 elements of length .

c# - How do you use Moq to mock a simple interface? -

okay, have business logic class this: note: context, vendor briefs simple entities describe "download" pdf document. /// <summary> /// houses business level functions dealing vendor briefs. /// </summary> public class vendorbriefcontroller : ivendorbriefcontroller { /// <summary> /// vendor brief controller requires instance of ivendorbriefrepository. /// </summary> ivendorbriefrepository _vendorbriefrepository; /// <summary> /// initializes instance of vendorbriefcontroller. /// </summary> public vendorbriefcontroller(ivendorbriefrepository vendorbriefrepository) { _vendorbriefrepository = vendorbriefrepository; } /// <summary> /// list of string filters vendor briefs. /// </summary> /// <returns>a list of string filters.</returns> public dynamic getfilters() { list<string> filters = new list<string> { ...

How would the following c(++)-struct be converted to C# for p/invoke usage -

im trying wrap older dll , running issues representing structure uses in c#. nothing have tried seems working. magicians able help? typedef struct _param_byname_data { n_char *szpntname; /* (in) point name */ n_char *szprmname; /* (in) parameter name */ n_long nprmoffset; /* (in) parameter offset */ parvalue *pupvvalue; /* (in/out) parameter value union */ n_ushort ntype; /* (in/out) value type */ n_long fstatus; /* (out) status of each value access */ } param_byname_data; if helps below vb port. type param_byname_data point_name string param_name string param_offset long padding1 long 'for byte alignment between vb , c param_value variant param_type integer padding2 integer 'for byte alignment between vb , c status long status long end type and following delphi well... param_byname_data=record pntname:pchar; // (in) point name prmname:pchar; // (in) parameter name prmoff...

Post multipart/form-data in C# to upload photos on facebook -

i have closely looked each of links on stackoverlow , tested them facebook , none of them working facebook. throws error each time (improper format). please me , need facebook developer in c# me out. we have samples on uploading video , photos in facebook nuget sample package. can try , check out code please? install-package facebook.sample

.net - Best data structure to store an object indexed by a 3-tuple for fast retrieval along each dimension and low memory profile? -

i want store objects indexed 3-tuple of (string, string , datetime). lets call these identifier,category,day any object in data structure guaranteed unique 3-tuple (no duplicates) the data structure should support fast answers questions such as: - unique identifiers? - categories identiifer "xyz"? - days identifier = "xyz" , category "mycategory"? removal possible. great maintain low memory profile. as baseline, i'm using dictionary<string , dictionary<string , dictionary<datetime , object>>> theoretically should give me o(1) retrieval, i'm not familiar internals of dictionary , have feeling solution sub-optimal. i know there's no 1 right answer here , provide numerous usage details, perhaps can give me few ideas play with? edit retrieval performed equality (i.e. identiifer = "xyz"). don't use inequalities (greater-than, less-than, etc.) it depends on relative numbers of values i...

javascript - How can I easily edit code embedded in an xml element -

i have xml records javascript code embedded in element. like: <?xml version="1.0" encoding="utf-8"?> <xml> <script> <sys_id>011fb5f68fb679a200b0af5a531815ae</sys_id> <sys_updated_on>2010-06-04 04:05:18</sys_updated_on> <js_script>function myjavascriptfunction(){&#13; var count =0 ;&#13; alert('entering myjavascriptfunction');&#13; } </js_script> <name>myjavascriptfunction</name> </script> </xml> this file saved .xml file (but happy change suffix if helped). purpose of command line utility roundtrips files database. i edit script element using notepad++ - javascript language formatting help. i'd save script element contents file. i have considered "inverting" file , saving javascript element contents directly .js file , put xml elements extended file properties. make easy edit language support, feels lot of work...

c# - Returning Concatenated String with LINQ for Dropdown -

this follow on question: format list<t> concatenate fields . answer correct, post-answer wanted return list method re-used. got far, not correct (because know iqueryable not correct, prevents anonymoustype error): public static iqueryable getcitiesincountrywithstate(string isoalpha2) { const string delimiter = ", "; using (var ctx = new atomicentities()) { var query = (from c in ctx.cities join ctry in ctx.countries on c.countryid equals ctry.countryid ctry.isoalpha2 == isoalpha2 select new { cityid = c.countryid, cityname = c.cityname + delimiter + c.state }); return query; } } i want able return list<string> here (if possible) , on ui: ddlcity.datasource = getcitiesinc...

R sometimes does not save my history -

i have program in r. when save history, not write history file. lost histories few times , drive me crazy. any recommendation on how avoid this? first check working directory ( getwd() ). savehistory() saves history in current working directory. , honest, better specify filename, default .history . : savehistory('c:/myworkingdir/mysession.rhistory') which allows : loadhistory('c:/myworkingdir/mysession.rhistory') so history not lost, it's in place , under name weren't aware of. see ?history . to clarify : history no more text file containing commands of current session. it's nice log of you've done, never use it. construct "analysis log" myself using scripts, hinted in answer.

Force Mercurial to always use --subrepos -

is possible configure mercurial check subrepos? i'd enabled time without having specify on command each time. you can use alias this. add entries .hg/hgrc like: [alias] status = status --subrepos add = add --subrepos ... and on other subrepo-aware commands want. looking @ text hg subrepos , add, archive, commit (i'm using v1.8.1 , commits subrepos default, seem recall earlier versions didn't), diff, incoming, outgoing, pull, push, status , update.

javascript - Extending jQuery UI methods -

i'm looking see if it's possible add methods or interactions jquery ui library without editing code itself? want able upgrade new versions come out, still able add own features extend base ui script. example: i want use .dialog() method have pointer tips provide messaging specific areas. is there easy way add this, or end having download source , myself each time release comes out? access ui widget's prototype: var proto = $.ui.autocomplete.prototype; proto.mynewmethodforautocomplete = function(){ // ... }; you can directy extend prototype this: how extend jquery ui widget ? (1.7)

mysql - Escape character for underscore in Ruby on Rails queries -

what i'm trying write query following: foo.where("bar 'bam\_%'") the idea being return rows bar, contains string, starts 'bam_' , of indeterminate length thereafter. i've tried pure mysql query in mysql workbench , seems work expected. when in ror, however, seems ignore escape character , treats underscore wildcard is. there not way write in rails can include underscore in query? thanks. the backslash escape character in ruby strings, \_ means treat _ literal. since _ treated literal anyway, nothing, except treat \ if wasn't there. 1 of ways have backslash in string given ruby literal escape using backslash (e.g. "bar 'bam\\_%'" ).

GWT: How to apply a CSS3 gradient -

i tasked build front-end of web application , i'm trying apply css3 gradient on button. i'm using eclipse gwt plugin , i'm viewing ui in google chrome gwt plugin. my problem gwt seems remove whitespaces in between parenthesis that: .gwt-button { background: -moz-linear-gradient(top, white, #72c6e4 4%, #0c5fa5); background:-webkit-gradient(linear, left top, left bottom, from(white), to(#0c5fa5), color-stop(0.03, #72c6e4)); becomes: .gwt-button { background: -moz-linear-gradient(top,white,#72c6e44%,#0c5fa5); background:-webkit-gradient(linear,lefttop,lefbottom, from(white), to(#0c5fa5), color-stop(0.03, #72c6e4)); which makes them invalid. there way go or maybe way prevent whitespaces being removed when application compiled? thanks. you have use literal() function. believe may work styles used via acssresource gwt function. background: -webkit-gradient(linear, literal("left top"), literal("left bottom...

Maximum Cy extents for a PowerPoint slide -

for given powerpoint 2003 slide, maximum cy extents it? looked in xml structure , unable find such number. google wasn't helpful either. thanks. i don't think maximum value looking value corresponds bottom of current slide. don't know off top of head find out trial , error. the maximum value equate somewhere way out in middle of nowhere, lost in space. don't forget convert values emu.

Using Autofac with Domain Events -

i'm trying introduce domain events project. concept described in udi dahan's post - http://www.udidahan.com/2009/06/14/domain-events-salvation/ here's domain event code public interface idomainevent { } public interface ihandledomainevents<t> t : idomainevent { void handle(t args); } public interface ieventdispatcher { void dispatch<tevent>(tevent eventtodispatch) tevent : idomainevent; } public static class domainevents { public static ieventdispatcher dispatcher { get; set; } public static void raise<tevent>(tevent eventtoraise) tevent : idomainevent { dispatcher.dispatch(eventtoraise); } } the important part ieventdispatcher implementation decouples domain event whatever needs happen when event raised. trick wire coupling through container. here's attempt code registering domain event handlers.... var asm = assembly.getexecutingassembly(); var handlertype = typeof(ihandledomainevent...

reflection - Java: accessing private constructor with type parameters -

this followup this question java private constructors . suppose have following class: class foo<t> { private t arg; private foo(t t) { // private! this.arg = t; } @override public string tostring() { return "my argument is: " + arg; } } how construct new foo("hello") using reflection? answer based on jtahlborn's answer , following works: public class example { public static void main(final string[] args) throws exception { constructor<foo> constructor; constructor = foo.class.getdeclaredconstructor(object.class); constructor.setaccessible(true); foo<string> foo = constructor.newinstance("arg1"); system.out.println(foo); } } you need class, find constructor takes single argument lower bound of t (in case object), force constructor accessible (using setaccessible method), , invoke desired argument.

google app engine - GWT Hosted Mode not working in Eclipse Helios on Mac -

i'm trying run shell 'new gwt' project in hosted mode through eclipse no luck. the server starts shuts down before can anything. here full console output: 2011-04-11 22:20:09.415 java[546:903] [java cocoacomponent compatibility mode]: enabled 2011-04-11 22:20:09.416 java[546:903] [java cocoacomponent compatibility mode]: setting timeout swt 0.100000 initializing appengine server logging jettylogger(null) via com.google.apphosting.utils.jetty.jettylogger processed /users/me/documents/workspace/game/war/web-inf/appengine-web.xml processed /users/me/documents/workspace/game/war/web-inf/web.xml server running @ http://localhost:8888/ it says server running , url there under development tab, red box indicating running application/server off. here specs: mac osx snow leopard 10.6.7 eclipse helios gwt 2.2.0 , associated plugins in eclipse a google search shows there issues 64 bit java 6 fixed in gwt 2.0. what doing wrong? mac put out java update brok...

Inconsistent results in Eclipse for Java Swing -

i teaching myself java , reading "java in 1 desk reference dummies." using code provided in book practice swing. here code using comes book: `import javax.swing.*; public class javabook6 extends jframe { public static void main(string[] args) { new javabook6(); } public javabook6() { this.setsize(400, 400); this.setlocation(500, 0); this.setdefaultcloseoperation(exit_on_close); this.settitle("sample"); this.setvisible(true); jpanel pnlmain = new jpanel(); jcheckbox chkmy = new jcheckbox("save"); jbutton btnmy = new jbutton("search"); jtextfield txtmy = new jtextfield(20); pnlmain.add(chkmy); pnlmain.add(txtmy); pnlmain.add(btnmy); this.add(pnlmain); } } i seem inconsistent results when press run. window shows up. however, thing displayed in window frame title , other times components such jcheckbox, jtextarea , jbutton show up, expect. my question why components show...

vb.net - if clause using image in datagridviewimagecolumn -

is possible set if case using images present in datagridviewimagecolumn? example: if current row image = "red.png"... show error msg if current row image = "green.png"... insert database thank you! you can achieve in fashion need assign text identify image displaying in datagridviewimagecell , while adding image set description cell (datagridview1[2, 2] datagridviewimagecell).description = "red";// or green then when loop through check description of imagecell , stuff foreach (datagridviewrow row in datagridview1.rows) { if(row.cells[2] datagridviewimagecell) { if((row.cells[2] datagridviewimagecell).description == "red") { // stuff} } }

How to get the output on this PHP script? -

i'm newbie programming , php learning 2 dimensional arrays. when run code below, gives me blank page. when put echo in front of function call echo usort($a, 'mysort1'); page shows me 1 (i have no idea why). what want see output of array after it's been sorted. doing var_dump($a); not i'm after. how show result of function? how? if can help. <?php $a = array ( array ('key1' => 940, 'key2' => 'blah'), array ('key1' => 23, 'key2' => 'this'), array ('key1' => 894, 'key2' => 'that') ); function mysort1($x, $x) { return ($x['key1'] > $y['key']); } usort($a, 'mysort1'); ?> for starters think have 2 typos in comparison function: //should $y not $x function mysort1($x, $y) { return ($x['key1'] > $y['key1']); // should $y['key1'] } next, usort sorts array in ...

How to convert a C++ Struct with Union into C#? -

guys having difficulties on retrieving struct member values after calling function in dll. tried convert c++ codes c# i’m not sure if correct or not. please me understand mistakes here (if there is) , how correct. my problem here can’t correctly retrieved values of inner structs (union) after called receivemessage function dll. example m_objmsg.msgdata.startreq.msgid 0. when try use c++ .exe program, msgid has correct value. (not 0) c++ code: extern int receivemessage(session, int, msg*); typedef struct { char subsid[15]; int level; char options[12]; } conxreq; typedef struct { char msgid[25]; } startreq; typedef struct { long length; short type; union { conxreq oconxreq; startreq ostartreq; } data; } msg; ///////////////////////////////////////////////////// msg omsg; int rc=receivemessage(session, 0, &omsg); switch(rc) { case 0: switch(omsg.type) { case 0: // conxreq … ...

asp.net mvc 2 - How to write an action method in a controller to reference a partial view? -

Image
i have written action method in reservationcontroller class. code work should move getcoretab file reservation folder. not want since give path of getcoretab file in reservationcontroller class. want give path, such code getcoretab method work reservation controller class. structure: code: public partialviewresult getcoretab() { return partialview("tabs/getcoretab"); } html: <a href="<%= url.action("getcoretab", "reservation") %>" class="a"> <b> <div id="home" class="menu"> </div> </b> </a> any ideas? thanks you specify path partial: public partialviewresult getcoretab() { return partialview("~/views/shared/tabs/getcoretab.ascx"); }

vb.net - How to loop through two lists simultaneously? -

i have referred following question at: using foreach loop iterate through 2 lists . question this, regards chosen answer: can o.dosomething comparison? in: for each in lista.concat(listb) if(a lista=a listb) here end if next as might've guessed, i'm using vb.net , know how can have shown here. iterate through joined list separately/independently. thanks! your question indicates need join operation, because it's not want iterate on 2 lists, want match items 1 list other. dim joinedlists = item1 in list1 _ join item2 in list2 _ on item1.bar equals item2.bar _ select new {item1, item2} each pair in joinedlists 'do work on combined item here' 'pair.item1' 'pair.item2' next other answers recommend zip . function takes 2 sequences , produces single result, join, geared work in fifo method on both lists. if need connections ...

Need help to fix a script with dynamic content -

i can't figure out why not working. i'm trying different div tags have different text content in cycle loop. <script type="text/javascript"> var text1 = ['foo', 'bar', 'baz']; var i1 = 0, var text2 = ['hug', 'kiss001', 'bank22']; var i2 = 0, $(document).ready(function() { setinterval(function (){ $("#div1").fadeout(function () { $("#div1").text(text[i1++ % text1.length]).fadein(); }); }, 1000); setinterval(function (){ $("#div2").fadeout(function () { $("#div2").text(text[i2++ % text2.length]).fadein(); }); }, 1000); }); </script> <div id="div1"><div> <div id="div2"><div> seems bunch of syntax errors ( text instead of text1 / text2 , no closing /div, etc. works fine here: http://jsbin.com/obaqi4/3

xcode4 - Simplest way to separate reusable code in XCode 4 for iOS? (library, project, etc) -

i'd separate reusable code in xcode 4 separate project/library/something else. reusable code in case game engine, , main project game itself. idea make game engine code easy use in future projects. xcode 4 lets me create blank project or static library ios. 1 preferred (or else work better?) under kiss principle? want separate 2 logical set of files 2 projects (it's ok if 1 child of another), , able compile them @ same time. don't have need obfuscation , i've heard static library 1 has worry architecture built for, sounds overkill. i feel blank project might better way go static library, don't have practical experience this. preferences , why? i ended going static library since seems preferred way of doing in xcode 4. when works, works great, took me while set - these 2 links invaluable: http://blog.carbonfive.com/2011/04/04/using-open-source-static-libraries-in-xcode-4/ and compile, build or archive problems xcode 4 (and dependencies)

javascript - Why we should check for the variable being defined var m = m || function(){} -

lot of libraries have seen methods defined this common.deepcopy = common.deepcopy || function(oldobject) { return $.extend(true, {}, oldobject); }; what need of defining methods objects this. because js files executed once there no chance of deepcopy being defined previously. that's not case. never know whether js file included twice or whether initialized again. better check whether object exists , assign if does. otherwise create new object

c# - Cannot apply indexing to an expression of type 'IntPtr' == IntPtr ptr1 = [...] --> ptr1[0] -

i found code snippet want implement. problem 1 function isn't running. cannot apply indexing expression of type 'intptr' fixed (byte* numref = this.tribuf) { (int = 0; < num; i++) { item = this.trihash.getitem(ch + s.substring(i, 3)); if (item != null) { this.trigramchecked += item.count; foreach (int num3 in item) { if ((num3 != id) && (numref[num3] < 0xff)) { intptr ptr1 = (intptr) (numref + num3); /* todo: error */ ptr1[0] = (intptr) ((byte) (ptr1[0] + 1)); } } } } } regards chris as said in comment, try avoid unsafe code in first place, looks it's trying do: if ((num3 != id) ...

javascript - Redirect user after 60 seconds of inactivity? -

how can use javascript on site redirect user /logout page after 60 seconds of inactivity? setting timer straightforward know: want redirect inactive users, not disrupt someone's session. is possible javascript? i belive looking this: http://paulirish.com/2009/jquery-idletimer-plugin/ if code yourself, need capture mouse , keyboard events , restart timer after of these events. if timer ever reaches threshold or counts down 0 threshold can reset url of page.

c# - in ASP.NET MVC3 how can I see the request? -

i'm using simple route as routes.maproute( "default2", // route name "{cliurl}/{id}", // url parameters new { cliurl = "none", controller = "abook", action = "index", id = "none" } // parameter defaults ); routes.maproute( "default", // route name "{cliurl}/{controller}/{action}/{id}", // url parameters new { cliurl = "none", controller = "abook", action = "index", id = "none" } // parameter defaults ); and when debug website (vs2010 sp1), have breakpoint in abook controller, inside index action method witch contains only: // // get: /abook/ public actionresult index() { if (currentclient == null) return redirecttoaction("empty"); return view(); } // // get: /empty/ public actionresult empty() { return view(); } the thing that, when insert in browser: http://localhost:14951/client_name/hashed...

jQuery Draggable IFrameFix -

i have little problem jquery draggable iframefix. have container (as shown below) iframe inside of it. turned on iframefix in draggable setup, doesn't change thing. had same problem or might know how solve this? <div class="container"> <div class="toolbar"> <div class="opt1"></div> <div class="opt2"></div> </div> <iframe src="url" class="frame" frameborder="0" scrolling="no"><p>no support iframes</p></iframe> </div> this if javascript code. $(".container").draggable({ snap: ".snapper_col", containment: "#element_container", handle: '.opt1', snaptolerance: 20, iframefix: true, cursor: "crosshair", start: function(ev,ui){ }, drag: function(ev,ui){ }, stop: function(ev, ui){ ...

python - where is the instancemethod decorator? -

in code have method returns instance of class, this: class myclass: def fun( self, *args ): # method return props( self, *args ) class props: # returned object def __init__( self, parent, *args ): self.parent = parent self.args = args to keep things organized considering place props inside myclass. bypass fun , directly make class instance method of myclass, this: class myclass: @instancemethod # not exist! class fun: def __init__( self, parent, *args ): self.parent = parent self.args = args note comment - instancemethod decorator not exist. is there way this, i.e. turn callable object instance method? if change @instancemethod @classmethod construction works, except of course parent class, not instance. surprised cannot find seems opposite operation. curious have cleared up! edit: it seems question not clear. have member function, fun, returns not single value or tuple object full of data. data generated based on contents of myc...

web applications - ASP.NET: Implementing Init and Dispose methods -

can asp.net web application have 1 init , 1 dispose method or can implement these per class want associate such methods? more have customer component , customerrecord classes , implement init , dispose methods in both of them. what proper way this? requirement: i want have independent init , dispose methods each aforementioned class. for classes should disposable, exposing public dispose method, idispsable interface must implemented 'disposability' effective out of scope of explicit user disposal. has been covered many times in many places, including here , example: public class customer : idisposable { public void dispose() { dispose(true); gc.supressfinalize(this); } protected virtual void dispose(bool disposing) { if (disposing) { //dispose of managed resources } //dispose of unmanaged resources } ~customer() { dispose(false); } } note...

php - Images not displaying in drupal nodes -

i have added images in header inside page.tpl.php shows fine in home page /admin. when add page, /node/1, images not display. please me........... i think have 2 template file pages. front-page.tpl.php , page.tpl.php. aslo need add images in header inside front-page.tpl.php.

java - Getting stack trace from NullPointerException -

my servlet throwing nullpointerexception . want show full stack call trace can find out line number exception being thrown at. how can that? have used fillinstacktrace() . not printing line number. have tried using e.printstacktrace() ?

Finding out which Linux process was executing when system locked up by evaluating CPU registers -

i need find out executing when linux (debian) system hangs (x86 platform). managed extract following information before system locked up: es: 0x7b cs: 0x73 ss: 0x7b ds: 0x7b fs: 0x0 gs: 0x33 ldtbase: 0x0 tr: 0x80 dr7: 0x400 dr6: 0xffff0ff0 eax: 0xbfbde820 ecx: 0xa908f9a0 edx: 0xb708a000 ebx: 0xb71b5278 esp: 0xbfbde730 ebp: 0xbfbde838 esi: 0x9d36b58 edi: 0x9d50bb8 eip: 0xb71b13e8 eflags: 0x203206 cr3: 0x1e9de000 cr0: 0x80050033 from values of segment registers, know when linux hangs, it's on user-space mode. find out process/library causing crash, , ideally exact part of it. by looking @ cr3 , eip, should able information getting confused. far know, virtual address 0xb71b13e8 relative page table used (0x1e9de000). now, instruction pointer points physical address, right? think should convert (eip value) virtual address offset of page table pointed cr3. could please me bit on that? where did extract information from? if usermode crash/lockup, presumably informat...

iphone - how to manage accelerometer value .x and .y -

hello making game application in game moving game using accelerometer want ball should not move in upper direction , move ball in right ,left , bottom side please me........ you can change value of gravity +ve or -ve.

javascript - onchange on date inputs -

possible duplicate: what events <input type=“number” /> fire when it's value changed? i have date input field <input type="date" name=".."> in webkit , firefox, added 2 up/down arrows on side of input. when clicking them, date goes forward or backwards, onchange event doesn't trigger until field loses focus. there workaround this? you store value in global , check difference onclick. <input type="date" name="mydate" id="mydate" /> var myapp = {}; myapp.mydate = ""; document.getelementbyid('mydate').onclick = function (e) { if (this.value != myapp.mydate) { // run onchange code // set last value current value myapp.mydate = this.value; } }; see example → edit: or, duplicate question, comments suggest. (see oninput event)

java - Display validation messages in struts 2 -

i have form in application in want validate user inputs. has combo box populated db table. have go action class first populate it(for eg: populateformaction). go form.jsp page. but problem @ time of validation. have set populateformaction input result follows <result name="input" type="redirect">/populateformaction</result> but when returned form.jsp, doesn't show validation errors. think because of use of populateformaction in between action handler , form.jsp. there 2 solutions problem call method populating combo, efore returning input (if there validation error). , dont use type redirect, instead directly move form.jsp. of course, possible if have populate combo , validate methods in same action class. pass action errors parameters populateformaction follows.take here i m not sure whether there 's' after actionerror or not, try both

iphone - How to run phone gap with xcode4? -

since moving xcode4, have been getting errors like: /version: no such file or directory cp: /javascripts/phonegap..js: no such file or directory cp: /javascripts/phonegap..min.js: no such file or directory error: /version: no such file or directory for projects were working under xcode3. open xcodes preferences, , navigate source trees. if there no phonegaplib entry there, try adding new setting following values: setting name: phonegaplib display name: phone gap lib path: /users//documents/phonegaplib note path should location of phonegaplib folder, , may not in documents folder, depending on how installed phonegap.

actionscript 3 - How to integrate Flash Professional and Flash Builder? -

i'm as3 developer used working flash builder. i'm working designer who's using flash professional design sprites , backgrounds game. i'm looking create integrated workflow us, can layout levels in flash pro , can add events in flash builder. as triggering events when player collides items, triggering animations etc., i'm looking switch between scenes when player changes level , game changes state (start menu, in-play, game on etc.). i'd load flash builder , manipulate programatically - showing , hiding scenes, scrolling, checking collisions etc. i've found guides exporting swc flash pro , accessing library in flash builder, gives me classes, not positioned instances of objects. possible access on stage i'm looking do? this seems obvious workflow i'm not finding clear how it's done. approach correct, or there better way this? advice on how setup workflow generally, or avoid? more specifically, how can access entities on stage , switch be...

MSVS 2010. Solution projects refuse to be debugged -

i have created several new solution configurations based on debug 1 , killed standard debug , release . i wonder why of solution project refuse debugged. when put break point first line of code (no matter if windows-forms application, console, test project...) msvs tells me, "breakpoint not hit". i cleaned solution , rebuild after in vain. what should check make projects debuggable? thank in advance! alike question asked here . i should have set [project properties/build/advanced/output/debug info] except [none] option.

hibernate - SQL Replace in HQL -

any idea why snippet of hql failing.. replace function requires 3 arguments error. there other way perform replace in hql>? " where :url ('%' || replace(atf.title,'*','') || '%')" + hql not support replace function. so have make own custom dialect , register replace function throught dialect::registerfunction method for example registering replcae in postgres dialect in next code import org.hibernate.dialect.postgresql9dialect; import org.hibernate.dialect.function.standardsqlfunction; public class mypostgresql9dialect extends postgresql9dialect { public mypostgresql9dialect() { super(); registerfunction("replace", new standardsqlfunction("replace")); } } then refer custom dialect in persistence.xml or hibernate.cfg.xml file

python - Django code only works in debug -

very confused one. code in views.py works, when i'm debugging using pycharm. if runserver 500 error. views.py: def add_post(request): if request.method == 'post': form = postform(request.post) cd = form.cleaned_data if form.is_valid(): print "valid" post = post(nickname=cd['nickname'], body=cd['body'], category=cd['category']) post.save() return httpresponse("success") return httpresponseservererror("fail") error seen in chrome inspector <th>exception value:</th> <td><pre>&#39;postform&#39; object has no attribute &#39;cleaned_data&#39;</pre></td> no attribute cleaned_data? why...? the cleaned_data attribute becomes available after calling is_valid() on form. should move cd = form.cleaned_data below if .

javascript - Include file.php + id. Is this possible with php? -

i've built site php include , index follows: menu.php (menu system) main.php (index site) footer.php (footer obv.) anyway, when main.php (index) opens, i've added news script uses $_get fetch news-data our mysql database. generates id each news, , shows few characters of full news. so, i've added link in each news says "read more" expand news, looks this: <a href="news.php?id=<?=$row['id']?>">read more</a></p> so, there way me include site (replace news.php?id=x main.php )? it gives me syntax error when i'm trying use <?php include in link since it's using <?=$row['id']?> . the got far people telling me change menu system javascript (ajax, jquery) i'm not familiar this. there can more simple changing menu javascript? thanks , understanding, have great day! yeah, include adds code of file execution of code using. if have variable in index file can use in...