Posts

Showing posts from June, 2011

Architecture of an Excel application -

after 10 years of programming find myself daunting task of creating first excel application in excel 2007. have programmed in vba before on ms access not technical challenge me it's real change of "paradigm" dare say. now have implement excel app talks sqlserver (on dedicated database create), typical crud stuff cannot read on book (excel bible, excel power programming, etc...) how supposed structure app. can give names columns , use them database column when sending data sqlserver when retrieve data what's expected of spreadsheet app example retrieve id, description (hiding id in column , showing description) or should use description , store denormalized data in sqlserver tables, making them equivalent of server side excel sheet? if want use normalized data lookuptable (id, country) should store id, country information in range , if so, how force user pick value range (id, country) without using proper combobox? when retrieve data sqlserver should model

How I can create a log for web services in a dynamic web project in Java? -

i'm having problem creating own logs application i'm developing in work, next code have works running in single class method main. try { logmanager lm = logmanager.getlogmanager(); logger logger; filehandler fh = new filehandler(filelogger,true); logger = logger.getlogger(filelogger); lm.addlogger(logger); logger.setlevel(level); fh.setformatter(new simpleformatter()); logger.log(level, message); logger.addhandler(fh); fh.close(); } catch (exception e) { system.out.println("exception thrown: " + e); e.printstacktrace(); } but, when want call function in doget webservice, log appended in catalina log , not in 1 i'm creating. know catalina appends information of call webservice but, how can create new log calls want? thanks!! you should looking @ logging frameworks log4j , logback gives lot of flexibility i

mysql - Simple SQL Select Query between 2 tables -

i have 2 table first table - usertable usedid username 1 somename 2 someothername second table - ratingtable userid ratingvalue 1 5 1 3 1 5 1 3 2 5 2 5 2 3 2 5 i need write sql query userid in ascending order number of times rated (5 star) select u.userid, u.username, count(*) ratingcount usertable u inner join ratingtable r on u.userid = r.userid , r.ratingvalue = 5 group u.userid, u.username order ratingcount

android - How do I detect the FIXED keyboard on Droid Pro? -

i use getresources().getconfiguration().hardkeyboardhidden detect if device has sliding keyboard drawer open (like on g1). now have droid pro, , returns 1 always, app thinks has slider open. is there way can tell device has keyboard, , it's open ? tia i'm facing similar issue, in cm, phone application. to date phone app behave that: if keyboard open, screen stay on during call. proximity sensor won't used query if device on hear or not: mishardkeyboardopen being true leads screenonimmediately being set true also: boolean screenonimmediately = (isheadsetplugged() || phoneutils.isspeakeron(this) || ((mbthandsfree != null) && mbthandsfree.isaudioon()) || mishardkeyboardopen); in case of fixed physical keyboard, open (not slidding, , in open position). if keep actual code, phone app never off screen using proximity sensor. if there's no way of guessing if keyboa

getting a delphi app to close a dialog that popped up from a driver -

i have delphi app tries open webcam. under windows 7 fails (that's story/ question /thread) webcam driver pops dialog titled "video source" inviting me select one. if try open driver repeatedly in loop , close dialog manually each time appears, can going. close dialog app. findwindow (nil, 'video source') doesn't find it. if process explorer dialog shown belonging app. if force close pe closes app!. how close dialog? have suspicion (confirmed) app hanging while dialog open, make pretty difficult execute code close dialog. if main application thread stalled waiting user input due popup dialog solution have thread running regularly attempts locate popup. when find use postmessage uses wm_close or similar popup handle. might have send either mousedown/mouseup messages button on popup. further, write small debug application uses windows api windowfrompoint find out popup window, ie. not it's visible caption it's class. can use debug

wpf - Binding preference: Name or Type? -

knowing mycontrol has depprop. px1 , binding should prefeer, line1 or line2 ? <usercontrol x:class="myproject.mycontrol" xmlns:my="clr-namespace:myproject" x:name="parentcontrol"> <canvas> <line x:name="line1" x1="{binding relativesource={relativesource ancestortype={x:type my:mycontrol}}, path=px1}" /> <line x:name="line2" x1="{binding elementname=parentcontrol, path=px1}" /> </canvas> </usercontrol> i mean, should ensure uniqueness of name "parentcontrol" per possible parents in second case? i prefer latter syntax in cases, it's easier read intent, long choose clear name parentcontrol. down side fails if change name, whereas first continue work. side note: px1 doesn't need dp, long usercontrol implements inotifypropertychanged , notifies when px1 changes.

jquery - How to use jsonp to get javascript based ad calls onto a page, asyncronously -

i trying use jsonp solve page performance problem i've been having. on site display ads writing out script tag document.write("<scr" + "ipt src='advendor.com\myad.php'></scr" + "ipt>"); . , except fact sites script tags point have nasty habit of being slow. when have page 5 ads on it can hold entire pages load time due blocking syncronous requests. so idea make jsonp call ad service give me script tag needs written page. problem there <script> tag on page but, script tag nothing. script work if written before document.ready? clarification: have our server side code making calls ad serving system determines ad code server side(in script tag "src=" points vendors site, generates actual ad , tracking). i'm trying stop ad calls blocking loading of content. want content first , ads next. putting script tags @ bottom of page not acceptable solution because need determine ads appear on page. ie, <div id=&quo

c++ - Generating Qt Q_OBJECT classes pragmatically -

how might 1 go making q_object based class (one has signals and/or slots) through metaprogramming? don't care if it's templates or preprocessor, neither appears work , need too. what want able bind arbitrary function things qt signals. qt signals incapable of this, boost signals are. so, need qt object can connect qt signal , forward on boost signal. i'll need bunch, nice automate. the main problem appears be--no big surprise--the moc processor. doesn't understand basic preprocessing (except ifs) , apparently can't template classes either. any ideas? here's i've discovered qt moc system: using of http://www.codeproject.com/kb/cross-platform/qt_reversing.aspx ... since know generated object going have one, single slot, , nothing else (that's it's for) generating moc stuff preprocessor should possible, though maybe difficult. most of information in qt_moc_data_???[] array can hard coded. line of interest seems slots , th

dns - webhost4life make root domain point to www, httpd.ini -

in webhost4life, know how can redirect user when hit root domain, i.e. gogo.com redirect www.gogo.com thanks -mantisimo i've found configuration file in root called httpd.ini this contains followig [isapi_rewrite] ### subdomain redirect v2 ### rewritecond host: ?gogo\.com rewritecond url ^gogo.com/(.*) rewritecond method rewriterule .? www.gogo.com/(.*) /$1 [i,r] rewritecond host: (?:.+\.)?gogo\.com rewritecond method post rewriterule ^/gogo.com/(.*) /$1 [i] rewritecond host: (?:.+\.)?gogo\.com rewriterule (.*) /gogo.com/$1 [i,l] can explain how can change this? i've found code on mod_rewrite iis. dont have great understadning of regular exressions bit of black art me can help? thanks technically you're not talking domain rather webserver's response request. can done number of ways, check out apache's mod_rewrite. see section "canonical hostnames" @ http://httpd.apache.org/docs/2.0/misc/rewriteguide.html

iphone - What encoding do strings found in the Mach-O __DATA segment, __cfstring section use? -

i'm wondering how read strings specific section of mach-o binary. (this binary ios.) i'm curious strings found in __data segment, __cfstring section. these sections appear contain arrays of simple structures: nsconstantstring { class class; const char *string; int length; } the question comes down to: how decide encoding of string ? it's described in source of cfstring available here . it's either in ascii or utf16 (in processor endian-ness.) see source code of clang , available here . generateconstantstring . constant strings generated this piece of code , getaddrofconstantcfstring . source code says constant cfstring of format struct __builtin_cfstring { const int *isa; // point __cfconstantstringclassreference int flags; const char *str; long length; }; (at least on os x, i'm not sure ios.) flags tells whether it's ascii or utf16.

javascript - Passing HTML through JSON (PHP and DOJO) -

i have datastore querying database , outputting json... this: $data[] = array('id' => $i, 'prod_id' => $product_id, 'link' => $link); i'm wondering how can pass link using $link variable. if had example: $link = "<a href=\"google.com\"> clicky </a>"; the datagrid display clicky , not actual html link... there anyway pass html? i suggest passing link url , link text separately, reconstructing them anchor link in javascript on client-side. you try escaping html, unescaping on client-side. i have no idea why won't send links- perhaps browser trying parse sent html early?

rubygems - What is the canonical mechanism for creating a Ruby gem? -

i've looked in lot of places - including www.rubygems.org - can't find tutorial describes easy, straightforward, technique producing gems doesn't rely on other (non-standard-ruby) components, such newgem , hoe. i have several requirements gem production, simplest case of 1 library file+one test file, complex ones involving c source files , multiple utility .rb files. all gratefully received! i researching gem making , surprised there wasn't single, obvious way how rubygems one-stop shop managing gems. discovered can use bundler create gems, , i've chosen route own gems. take @ guide on gem development bundler radar.

guid - generate mysql ids as a string instead of a integer -

i sure called don't know name of. i want generate ids like: 59aa307e-94c8-47d1-aa50-aaa7500f5b54 instead of standard auto incremented number. it doesn't have that, long unique string value it. is there easy way this? i want reference attachments not used, attachment=1 i know there ways around that, figure string based id better if possible, , im sure not searching right thing. thank you last time checked, can't specify uuid() default constraint column in mysql. means using trigger: create trigger newid before insert on your_table_name each row set new.id = uuid() i know there ways around that, figure string based id better i understand you're after security obscurity, aware char/varchar columns larger 4 characters take more space int (1 byte). impact performance in retrieval , joins.

How to add the new contacts on android 2.2? -

i need add new contacts on android 2.2 version. how add fields firstname, lastname, url, nickname, im, addresses , mobile number? take at: http://developer.android.com/resources/articles/contacts.html the process involves steps, insert name contact+name first, field field. example phone number: import android.provider.contactscontract.commondatakinds.phone; ... contentvalues values = new contentvalues(); values.put(phone.raw_contact_id, rawcontactid); values.put(phone.number, phonenumber); values.put(phone.type, phone.type_mobile); uri uri = getcontentresolver().insert(phone.content_uri, values); additionally, have read here: http://developer.android.com/reference/android/provider/contactscontract.commondatakinds.html

c++ - Converting units in boost.units from angular_velocity to degrees_per_second -

i need make conversion general angular_velocity degrees/second. to illustrate problem example boostunits.cpp: #include <boost/units/systems/si.hpp> #include <boost/units/systems/angle/revolutions.hpp> #include <boost/units/systems/angle/degrees.hpp> #include <boost/units/conversion.hpp> #include <boost/units/pow.hpp> #include <iostream> #include <iterator> #include <algorithm> int main() { boost::units::quantity< boost::units::si::angular_velocity> m_speed( (30.0*boost::units::si::radians_per_second) ); std::cout << "m_speed: " << m_speed << std::endl; uint32_t result = static_cast<uint32_t>( boost::units::quantity<boost::units::si::angular_velocity,uint32_t>( m_speed*boost::units::degree::degrees/boost::units::si::seconds ).value() ); std::cout << " result: "<< result << std::endl; return(0); } produces compiler output:

Why does hibernate/jpa set @OrderColumn field to null for a removed element in a mapped list before deleting it? -

i'd map tree structure of "chapters". every chapter has reference parent, , ordered list (by "position") of subchapters. jpa 2.0, hibernate 3.5, entity "chapter" looks follows: @entity public class chapter { @id @generatedvalue private long id; @column(name="position", nullable=false) private int position; @manytoone @joincolumn(name="parentchapter_id", updatable=false, insertable=false) private chapter parentchapter; @onetomany(cascade=cascadetype.all, orphanremoval=true) @ordercolumn(name="position") @joincolumn(name="parentchapter_id") private list<chapter> subchapters = new arraylist<chapter>(); public list<chapter> getsubchapters() { return subchapters; } } the problem is, if 1 of elements of subchapters removed // entitymanager em chapter parent = em.find(chapter.class, 1); subchapters = parent.getsubchapte

sql - Why NOLOCK is ignored "in the FROM clause that apply to the target table of an UPDATE or DELETE statement"? -

i confused bol phrase: "readuncommitted , nolock cannot specified tables modified insert, update, or delete operations. sql server query optimizer ignores readuncommitted , nolock hints in clause apply target table of update or delete statement" [ 1 ] for example, if write --script 1) update test set txt=(select txt test with(nolock) id=1) id=1 it run without errors (or warnings) , equivalent to --script 2) set transaction isolation level serializable; begin tran declare @nvarm nvarchar(max); select @nvarm=txt test id=1; --select @nvarm; update test set txt=@nvarm id=1; commit; which run without errors or warnings. equivalent? the table same in logically source table not target table have re-written 1) different source table (physical) table: --script 3) select * testdup test; go; update test set txt=(select txt testdup with(nolock) id=1) id=1 why should nolock ignored on table? or, if wrong, question then how write update having

arrays - iPhone search results showing incorrect descriptions after touch -

i having trouble search. displays search results correctly, when click on item in results, opens item c's description. #import "rootviewcontroller.h" #import "fsdappdelegate.h" #import "detailviewcontroller.h" @implementation rootviewcontroller #pragma mark - #pragma mark synthesizers @synthesize maintableview; @synthesize contentslist; @synthesize descarray; @synthesize bannerimages; @synthesize childcontroller; @synthesize searchresults; @synthesize savedsearchterm; #pragma mark - #pragma mark view methods - (void)viewdidload { nslog(@">>> entering %s <<<", __pretty_function__); nsstring *filepath = [[nsbundle mainbundle] pathforresource:@"descriptions" oftype:@"plist"]; nsarray *desc = [[nsarray alloc] initwithcontentsoffile:filepath]; self.descarray = desc; [desc release]; uiimage *texas = [uiimage imagenamed:@"1andtexas.jpg"]; uiimage *cali = [ui

jquery - Edit already made html using javascript (facebox) -

i using facebox (you may know of it) , script looks like $.extend($.facebox, { settings: { opacity : 0, overlay : true, loadingimage : 'http://example.com/images/loading.gif', closeimage : 'http://example.com/images/closelabel.gif', imagetypes : [ 'png', 'jpg', 'jpeg', 'gif' ], faceboxhtml : '\ <div id="facebox" style="display:none;"> \ <div class="popup"> \ <table> \ <tbody> \ <tr> \ <td class="tl"/><td class="b"/><td class="tr"/> \ </tr> \ <tr> \ <td class="b"/> \ <td class="body"> \ <div class="content"> \ </div> \ <div id="footer"> \

php - How to identify the client is a search robot? -

i have built entire site using ajax (indeed it's gwt). have implemented ajax crawling proposed google. however, after implementation, found neither yahoo , bing, nor baidu implemented scheme! i'm wondering if there way identify web client search robot. if are, shown html snapshot created. it best if can identify them in apache level, can mod_rewrite. it's still ok if can in php or gwt. to apache can use rewriterule rewritecond on %{http_user_agent} . the rewritecond accepts regexp, have use pattern there, matches bots(you should find informations how build pattern on page linked acme). but careful: search-engines may penalize pages deliver different contents bots , others clients.

javascript - calling the jq function like you would do a js function from a form element -

i trying validate form using jquery (not use validate plugin)...what wanted know there way call same function without being attached particular node... like in js <input id="xyz" ....onblur=js:function()> <input id="abc" ....onblur=js:function()> where in jq $(#xyz).blur(); $(#abc).blur(); not exact syntax it... thanks andy $(function() { $(":input").blur(function() { // executes function every time blur event // fires on input element }); } "input element" being input, textarea, select , button elements. if want executed when blur event fires regular inputs, lose colon. hope got wanted achieve.

asp.net - MaskedEditValidator baloon tooltip - AJAX Control Toolkit -

i'm using maskededitvalidator validating date input. want show balloon tool tip instead of normal message in red color creating alignment problems everywhere. i have stick maskededitvalidator lot of implementation done around it. ajax control toolkit version : 3.5.40412.0 you can use validatorcallout extender purpose: <ajaxtoolkit:maskededitvalidator id="yourmaskededitvalidator" runat="server" controlextender="yourmaskededitextender" controltovalidate="yourmaskedtextbox" display="none" /> <ajaxtoolkit:validatorcalloutextender id="yourmaskededitcallout" runat="server" targetcontrolid="yourmaskededitvalidator" />

flash - AS3 add movie clip to stage using variable which holds the MC name -

i know how add movie clip stage library i'm strugling when need load movie clip library when name of movie clip held in variable. for(var i:number = 0; < 64; i++) { var blueicons:blueicon = new blueicon(); addchild(blueicons); blueicons.x = 100; blueicons.y = 100; } the above code works adding blueicon have variable in loop tells icon load. sectorsmcs[jewelsids[i]] the above tell me mc name load how load mc library variable value? you may have link movieclip specific class following work... var mcname:string = sectorsmcs[jewelsids[i]]; var classname:object = getdefinitionbyname(mcname); var mc:movieclip = new classname();

yui - YUI3 find current tab in TabView -

i'm using yui3 tabview component, , i'd able index of selected tab. i've been looking through api docs, can't seem find relevant way this. http://developer.yahoo.com/yui/3/api/module_tabview.html thanks! "indexof" works if use "tabview.get('selection')" argument. example: <!doctype html public "-//w3c//dtd html 4.01//en" "http://www.w3.org/tr/html4/strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>untitled document</title> <script type="text/javascript" charset="utf-8" src="http://yui.yahooapis.com/3.2.0/build/yui/yui-min.js"> </script> </head> <body> <body class="yui3-skin-sam"> <p id="msg"></p> <input type='button' value='but

iphone - Is this allowed? Content update on iOS through XML-RPC -

goodmorning, i wondering if allowed update content in ios app, through xml-rpc. it's information app. has top , bottom bar containing primary navigational items or topics, tapping on icon in 1 of bars present list sub topicsin center. tapping on 1 of bring information itself. this information topics update lot. know apps can information through feed mechanisms, why apps twitter, news etc work ...however wondering if it's allowed update primary , secondary topics (and of course information itself) through example xml-rpc. or there nuance difference in way app-store guidelines allow twitter client type's of apps, , information types of apps? hope can shed light on marco yes. allowed. some people have run afoul of app store gestapo when made prototyping apps, load entire user interface xml , simulate on screen. extreme case. if it's dynamic content, knock out.

user interface - Choice Group behavior - select element upon hover in J2ME polish -

the current implementation of choicegroup (view-type: verticalfixed) has 3 states: unselected, hover, selected. when using component on phone keypad, , down key events hover individual choice group elements , fire select element. is there way in can modify behavior hover == selection ? use getselectedindex under fire. hover css. //#style hoverchoicegroup for css .hoverchoicegroup{ } .hoverchoicegroup:hover{ }

java - Is there any third party jar files available for java6 math evaluation? -

i want calculate mathematical expression in java6.for example, c=a*b+((b/d)-c)/100-(h/2) how evaluate math expression.... please guide me solution... saravanan.p by way, jep can still downloaded (through older version, still) gpl licensed library here (see related question .) ** edit ** the jep documentation well-written , contains lot of examples.

c# - Improve the performance by multi-threading -

i'm trying improve winform application's performance make multi-threaded. class looks like: public class mainclass { list<dataitem> data; //thousands of dataitem, each independent //and lot of non-thread-safe variables here,variable1 variable2 ... public void go() { data.foreach(item => dealwithdataitem(item)); } public void dealwithdataitem(dataitem item) { //costs long time here step1(item); step2(item); //and lot of stepn(item) } public void stepn(dataitem item) { //variable1 = blabla //variable2 = blabla ..etc } } i want use threadpool each dataitem. data.foreach(item => threadpool.queueuserworkitem( s => dealwithdataitem(item) )); but many non-thread-safe variables! can't declare them in method, because it's shared between stepn methods. , it's quite hard make them thread-safe! doing wrong? solutions? thanks! try using parallelenumerable.asparallel .

java - NoSuchMethodError: org.hibernate.SessionFactory.getCurrentSession() -

hello i'm getting strange error: java.lang.nosuchmethoderror: org.hibernate.sessionfactory.getcurrentsession()lor g/hibernate/classic/session; @ org.cometd.hibernate.util.hibernateutil.getsessionfactory(hibernateut il.java:29) @ org.cometd.hibernate.util.hibernateutil.getsession(hibernateutil.java :54) but method exists in sessionfactory class in javadocs! eclipse shows me in autocomplete. other methods, i.e. opensession() or closesession() work correct. problem can hide? pom.xml: <?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <build> <defaultgoal>install</defaultgoal> <plugins> <plugin> <artifactid>maven-compiler-

dictionary - BGL: How do I get direct access to data of nodes and edges? -

i have problem regarding boost graphic library not answer myself googling nor reading documentation. it's not directly related other questions thought i'd better start new thread. i have graph adjacency layout , use bundled properties access data of nodes , edges. use typedef graph convenience. can access data stored, e.g. vertex_descriptor, typing this: graph[my_vertex_descriptor].setx(4); graph[my_vertex_descriptor].sety(10); now define reference data-storing object able type that: typedef graph[vertex_descriptor]::type vertex; vertex v = graph[my_vertex_descriptor]; v.setx(4); v.sety(10); by or similar approach seek avoid unnecessary recalculations of mapped value accessed using []operator of map , specific descriptor object. vertices , edges contain lots of data in situations current code produces many recalculations of same value deal data. seems ugly. does know if possibly achieve i'm trying do? i used bundled properties and: bundled_vertex

Good open source code for C++ -

i have had course on c++ , have done minor projects on implementing data structures in c++. can find not-so-difficult open source c++ project follows programming styles. want have understanding of real project. search on google code project hosting or sourceforge, or better still, search c++ projects on ohloh . unfortunately cannot searches on code quality, @ least can see report on projects page find quality metrics , relatively small codebases. some projects i've come across code quality , in c++: relatively small codebase: code::blocks inkscape mona os vlc not easy into: blender chromium spider monkey never looked @ interesting: codelite emule scummvm more importantly, around , see if software , use developed in c++. you'll have greater incentive contribute , see changes in real-life , used others. you may want refer these other questions: c++ projects beginners , open-source project c++ developer .

html - jquery AJAX requests -

hallo, new jquery, ajax requests. here html code in edit_page.php <td>action: </td> <td class="notselected"> <div id="action_response"></div> <select name="action_db1" id=<?php echo $sel_page['concession']; ?> onchange="updateaction(this);" > <option value=""></option> <option value="move">move</option> <option value="copy">copy</option> <option value="exclude">exclude</option> </select> </td> and javascript code is function updateaction(item)

google app engine - nosetests 'cannot import name mkdir' -

im trying use nose (nosegae) test gae app fails import error. cant understand why because fails import python builtin stuff. im testing simple wsgi app 1 handler writes out 'hello world'. does understand whats going on? im on mac osx snow leopard this traceback: traceback (most recent call last): file "/library/python/2.6/site-packages/nose-0.11.4-py2.6.egg/nose/loader.py", line 382, in loadtestsfromname addr.filename, addr.module) file "/library/python/2.6/site-packages/nose-0.11.4-py2.6.egg/nose/importer.py", line 39, in importfrompath return self.importfromdir(dir_path, fqname) file "/library/python/2.6/site-packages/nose-0.11.4-py2.6.egg/nose/importer.py", line 86, in importfromdir mod = load_module(part_fqname, fh, filename, desc) file "/users/pepe/dev/nosetests/tornado/testing.py", line 21, in <module> tornado.httpclient import asynchttpclient file "build/bdist.macosx-10.6-universa

php - Generate Text File for every new order in Magento? -

how can generate text file each new order in magento. you need create new module (use module creator extension headstart) , bind observer sales_convert_quote_to_order event. can retrieve order object event , output values of interest text file using standard php file functions (or zend_file if wish). if search stackoverflow or web in general, find number of tutorials on how use event-observer model, need adapt specifics of event interested in. hth, jd

spring - Unable to use macros with velocity in email templates? -

greetings using velocity templates when sending emails , want read texts dynamically property files depending on user locale the xml config: <bean id="messagesource" class="org.springframework.context.support.reloadableresourcebundlemessagesource"> <property name="basenames"> <list> <value>classpath:messages</value> <value>classpath:messages_ar</value> </list> </property> <property name="defaultencoding" value="utf-8"/> </bean> <bean id="velocityengine" class="org.springframework.ui.velocity.velocityenginefactorybean"> <property name="velocityproperties"> <props> <prop key="resource.loader">class</prop> <prop key="class.resource.loader.class">org.apache.velocity.runtime.resource.loader.classp

java - Define a pointcut on a member access and function call -

it's quite hard explain want define in aspectj pointcut upon call of function this: public class b{ public a; } public class a{ public void foo(){...} } and pointcut should intercept following call: b.a.foo(); i still haven't figured out way (if there any). of have idea? thanks in advance i'm aspectj newbie myself too, feeling isn't possible. if devised pointcut matched b.a.foo() , you'd still have somehow handle following case: a = b.a; a.foo(); or even public void fooa(a atofoo) { atofoo.foo(); } public void whatever(b someb) { fooa(someb.a); }

c# - Adding an image to a PDF using iTextSharp and scale it properly -

Image
here's code. correctly adds pictures want , works except images using native resolution, if image big it's being cropped fit page. is there way have picture use zoom feature stretch fit, maintain aspect ratio? there has i'm missing there. :p here's picture illustrate problem: using system; using system.io; using itextsharp.text; using itextsharp.text.pdf; using system.drawing; using system.collections.generic; namespace winformsplayground { public class pdfwrapper { public void createpdf(list<system.drawing.image> images) { if (images.count >= 1) { document document = new document(pagesize.letter); try { // step 2: // create writer listens document // , directs pdf-stream file pdfwriter.getinstance(document, new filestream("chap0101.pdf", filemode.create));

frameworks - Convert SQL statement with "having" clause to Linq -

i've been converting manual sql repository uses sqlcommand , sqlconnection use ef4 , far apart have got stuck trying right sql statement linq. i've been trying time , i'm not getting right results when run query ( sql coming ef4 crazy ). here query: select * [accounts] [a] inner join ( select [a].[id] [accounts] [a] inner join [people] [b] on [a].[personid] = [b].[id] inner join [companies] [d] on [b].[companyid] = [d].[id] left outer join [accountorganizationalunit] [c] on [a].[id] = [c].[accountid] left outer join [organizationalunits] [e] on [c].[organizationalunitid] = [e].[id] [d].[groupid] = @groupid group [a].[id] having sum(case [e].[companyid] when @companyid 1 else 0 end) = 0 ) [t2] on [a].[id] = [t2].[id] the "having" clause causing trouble cant seem ef4 create similiar sql. @groupid guid , companyid int. thanks help/guidance how can write in linq! if need more info let me know. cheers, richard.

javascript - structure for jquery in my mvc project -

whats best way of structure jqueryfiles in mvc app. have scripts in script folder , starting difficult have overview. //thanks we used following structure on last project: scripts | |- jquery |- libraries |- infrastructure |- pagespecific jquery contained jquery , plugins. libraries contained other third-party libraries (e.g. underscore.js). infrastructure contained shared javascript modules, e.g. 1 full of utility functions, or 1 handling server-side account-management communications, etc. pagespecific contained code wire event handlers , page-specific logic.

c# - Changed Database Name -- Datatable Adapters broke -

we've changed name of sql database our webapp using. now, each of datatableadapters update new connectionstring. our setup follows: 1) interface (website project) 2) business logic (class library project) 3) data access (class library project) ---> contains many dataset classes the app.config of data access project contains connection string. when creating each of datatableadapters, wizard points correctly. now, we've had change connectionstring, , of existing datatableadapters (about ~60) not work. simply changing connectionstring has not worked. missing? thanks make sure connection string name in config same 1 in settings file. because in generated code, when initialzed connectionstring setting connection string follow : private void initconnection() { this._connection = new global::system.data.sqlclient.sqlconnection(); this._connection.connectionstring = global::consoleapplication4.properties.settings.default.myconnec