Posts

Showing posts from January, 2015

.net - Error when rolling out my software revision to terminal sessions instead of desktops? -

i'm doing maintenance on software built predecessor @ company (who has since moved on greener pastures). i'm rolling out new version of software. at company, installation procedure shove /bin/release directory out our automated program updater's magic directory, allowing automatically copy contents of directory on local /program files/ , let magic happen. magic seems happen, there's no big issue, there, although weird me out somewhat, after many years of .msi installers... anyway, rolling out new software went fine on 2 of our file servers, rolling out third , final location went bit differently. the third section of company doesn't use auto-rollout software. use windows' remote desktop connection software run software directly on server. so go along server, check current version working (which is), up, etc. copy exact same software works fine on of our other machines. the new software fails play nice third-party libraries it's using (crystal r

themes - google.Load jQuery UI Specific CSS -

i loading jquery ui as google.load("jqueryui", "1.8.6"); from google cdn , want theme ui darkness associated it. other methods other than <link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/ui-darkness/jquery-ui.css" /> something like google.load("jqueryui", "1.8.6","{theme: 'ui-darkness'}"); so far google loader doesn't support syntax jqueryui, can check documentation here. http://code.google.com/intl/zh-cn/apis/loader/#googleload i think refer link in tag still best way in case.

java - Spring @Autowired in Servlet -

i using spring framework (2.5.4) in app load time weaving , works fine everywhere (in spring beans, in non-spring entities), except when try autowire field in servlet annotated @configurable, nice nullpointerexception... @configurable(dependencycheck=true) public class captchaservlet extends httpservlet{ @autowired private captchaserviceiface captchaservice; @override public void init(servletconfig config) throws servletexception { super.init(config); // applicationcontext ctx = webapplicationcontextutils.getrequiredwebapplicationcontext(config.getservletcontext()); // captchaservice = (captchaserviceiface) ctx.getbean("captchaservice"); } @override protected void doget(httpservletrequest req, httpservletresponse resp) throws servletexception, ioexception { captcha c = captchaservice.getcatpcha(); req.getsession().setattribute("captchaanswer", c.getanswer()); resp.setcontenttype(&quo

iphone - NSString out of scope problem? -

Image
i'm pulling hair out, must simple problem, can't see it. i'm trying assign value variable text field. in h file have nsstring *currentpass; @property (nonatomic, retain) nsstring *currentpass; my m file. @synthesize currentpass; - (void)alertview:(uialertview *)alertview willdismisswithbuttonindex: (nsinteger)buttonindex{ if (alertview.tag == alertpasswordask) { uitextfield* thetextfield = ((uitextfield*)[alertview viewwithtag: 5]); currentpass = [nsstring stringwithformat:@"%@", thetextfield.text]; if ([thetextfield isediting]) { [thetextfield resignfirstresponder]; } } } - (void)alertview:(uialertview *)alertview diddismisswithbuttonindex:(nsinteger)buttonindex{ nslog(@"diddismisswithbuttonindex tag=%i", alertview.tag); if (alertview.tag == alertpasswordask) { if(buttonindex == 1){ nsuserdefaults *mydefaults = [nsuserdefaults standarduserdefaults]; nsstring *strpassword = [

extjs - EditorGrid dynamic/dependant Combo Box Editor Fields -

in extjs, have simple editorgrid 2 columns, x , y, both of have combo box editor. how is possible make values available in second column's combo box (y) depend on selected value in first column (x)? so, depending on selected in x, values available in y change accordingly. assuming have store backing each combobox, can use store's filter or filterby methods narrow down results of 1 combobox based on other's current selection. can call either filter function on 'select' or 'change' events of combobox. i've used method in past, , worked needs. had around 200 records per combobox, i'm not sure how solution scales if have deal records more that.

iphone - How do I call and app deletage method (which uses an alertview) and get the value in view controller after the events? -

i'm calling method i've written in app delegate calls alertview ask user password, use method in applicationwillenterforeground also. so value set in clickedbuttonatindex in app delegate. how determine when value has been set in view controller (where i'm calling method) ? the simplest way delegate viewcontroller. your app delegate have ability access pointers viewcontrollers/navcontrollers have. (scope depends on design of course) here post on objective-c delegates. i found myself doing kind of thing quite simplify process had method contained in singleton called 'toolbox' went this. -(void)showalertwithtitle:(nsstring*)_title message:(nsstring*)_message cancelbuttontitle:(nsstring*)_canceltitle alternitivebuttontitle:(nsstring*)alternitivebuttontitle anddelegate:(id)del { uialertview *alert = [[uialertview alloc] initwithtitle:_title message:_message delegate:del cancelbuttontitle:_canceltitle otherbuttontitles:alternitivebuttontitle, ni

javascript - How can I resize a modal iframe when a new page loads in it? -

i have several linked pages want display in modal iframe. pages not same size , want able resize iframe when each new page loaded. have looked @ several jquery plugins create iframe, can't figure out how resize of them. experimenting prettyphoto , nyromodal, open suggestions. need make work. not javascript, trying learn. note: pages on web server, there no issue cross domain. thanks quick responses. i'm headed bed forward trying out suggestions when wake up. try putting in iframe: document.onload = function() { var = parent.document.getelementbyid('myiframe'); i.style.width = document.body.offsetwidth+"px"; i.style.height = document.body.offsetheight+"px"; }

ajax - which client side architecture should be followed -

i developing web site in using rest web services, there 2 ways of making calls rest web services.. 1. directly through ajax 2. ajax calling servlet in turn make call rest web service personnel experience have observed companies tend follow 2 approach... there reason following approach ?? though can bring same effect following first approach less coding effort... there advantage being achieved second approach missing ?? thanks... the advantage of second case have back-end process on data before hits front-end. can manipulate before goes client, store , use caching , track analytics on data. doing on front-end makes processes hard, though it's possible. also have manipulate data it's read on client. if none of important you, first option way go.

java - Combing Metro and Jersey -

i've been @ little while , mind has gone mush. i'm wondering if can me out here. i'm trying make java web service (using own http server , not tomcat), supports metro , jersey. way client can connect web service anyway want whether soap or rest. i've got metro part down can support doc/lit wsdls , rpc/lit wsdls i've having difficultly understanding jersey part support rest/xml , rest/json also idea there 1 class endpoint methods written in , other classes extend it. has used these 2 combined before? can point me direction of decent article or have example yourself? thanks metro implementaion of jax-ws used wsdl/soap based webservices. jesery implementation of jax-rs used maily restful based webservices. have used both in same project different purposes. can use apache httpclient restful services, jersery provides lot of useful annotations converting json, xml etc. hope helps.

Grails Spring Security Core Plugin - adding flash message to login page -

i using grails spring security core plugin secure action using following annotation. @secured(['is_authenticated_remembered']) this causes action redirect login page if user not logged in. once logged in redirected original action. how can add flash message login page in scenario, i.e. flash.message = "you must logged in submit news story" to clarify, want message displayed if user redirected login page after attempting access specific action. other actions not trigger message. i have solved follows. remote annotation action. add following code @ beginning of action (news , submit being relevant controller , action respectively). if (!springsecurityservice.isloggedin()) { flash.message = "you must logged in submit news story." redirect(controller:"login", action: "auth", params:["spring-security-redirect" : "/news/submit"]) } add following login form. <input type='hidden&

linux - How to find the memory map of a device? -

i know in linux source code should search finding board specific packages, more clearly, memory map of different devices. i browsing through link : http://lxr.linux.no thanks if it's pci device, lspci -vvv show you. you can check /proc/iomem , /proc/ioport memory , port mappings, respectively.

sql - Indexing & alternatives for low-selectivity columns -

what range of tactics available selecting records on low selectivity columns? an example might orders table where, on many years, build large number of completed orders need select active orders. order might go through lifecycle such placed, stock-allocated, picked warehouse, despatched customer, invoiced , paid. order might additionally cancelled, held, etc. majority of records in final state (e.g. paid) might need select, say, allocated orders. in case sequential read slow. similar questions on indexing mysql: low cardinality/selectivity columns = how index? do indexes suck in sql? what indexes , how can use them optimize queries in database? defining indexes: columns, , performance impact? , numerous others decreasingly related. the approaches have read (in stackoverflow , elsewhere) include use bitmap index use partial index ( create index x on t(c2) c1='a' ) use clustered index? don't index low selectivity columns, use sequential read partition da

jQuery hover for colorbox image collection overlay -

i came upon requirement use colorbox or similar jquery lightbox plugin mouse on function fired jquery hover event this seems place use $.colorbox() , pass collection rel parameter, can’t work.. http://colorpowered.com/colorbox/ .hover , colorbox work when pass href param .. 1 picture <!doctype html> <html lang="en"> <head> <meta charset=utf-8 /> <title>colorbox examples</title> <style type="text/css"> body{font:12px/1.2 verdana, arial, san-serrif; padding:0 10px;} a:link, a:visited{text-decoration:none; color:#416ce5; border-bottom:1px solid #416ce5;} h2{font-size:13px; margin:15px 0 0 0;} </style> <link media="screen" rel="stylesheet" href="colorbox.css" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script> <script src="./jquery.colorbox.js"

Cocos2d: Calling function from one CCLayer in another (parent?) CCLayer -

Image
hello awesome dev community. have looked answer days , can't seem find handle, decided post q myself. i have game has menus picking items. menus can have 2 -> 30+ items, need scroll. there category menus, when item clicked, new menu category's items appears. i figured efficient way go creating elements needed menu on dedicated layer. issue have no idea how call addnewitems:itemsarray function defined in main game scene, cclayer containing menu. or, should use 1 layer? bit messy , difficult move multiple items together. thank - or pointing me in direction of clear tutorial or examples of how since couldn't find any. below flowchart of i'm looking create. thanks!! hanaan finally got answer david994a (cocos2d forum) the answer pass layer pointer it's parent layer initialize cclayer this: -(id) initwithparent:(cclayer *)parentlayer; and call this: itemsmenulayer *templayer = [[itemsmenulayer alloc] initwithparent:self]; then, in

python - ImportError : No module named _sqlite3 on GAE -

while trying start local google app engine (v1.3.8) server on fedora 14 python 2.5 (installed source) importerror importerror: no module named _sqlite3 i have following package installed - sqlite, sqlite-devel, python2.5, python2.7. did google , looks error comes when there no c binding sqlite. however, since have both sqlite , sqlite-devel installed c bindings should present. same error when import sqlite3 on python console. possibly can resolve error? install sqlite-devel , rebuild python.

c# - Having both an InRequestScope and InTransientScope for Ninject resolving to same type -

i've got ninject setup creates jobcontext resolver inrequestscope() works fine, however, have specific call in website requires me loop through few databases (all data in databases year). couldn't quite figure out going on because had forgotten jobcontext inrequestscope last block of code not acting how thought should. here setup //ninject module bind<data.ijobcontext>().to<data.jobcontext>().inrequestscope(); //controller's initialize protected override void initialize(system.web.routing.requestcontext requestcontext) { base.initialize(requestcontext); //set connection string jobcontext this.jobcontext = dependencyresolver.current.getservice<ijobcontext>(); jobcontext.setyear(currentyear); } since jobcontext in request scope keeps reusing same object each year. instance need intransientscope rather inrequestscope . //special function foreach (int year in activeyears) { jobcontext = dependencyresolver.current.getservi

visual studio 2010 - vs2010 Extensibility Tips and Tricks -

diving vs2010 extensibility , gotta subject seems wide deep. have tips, tricks or hacks leverage jumping intimidatingly huge niche of visual studio? i wrote 9 hours of visual studio extensibility material pluralsight ( part 1 , part 2 ). if you're msdn subscriber can one-month free subscription should give more enough time through both courses. put 2008 , 2010 talks on vsx topics , both slides , demos (along videos) on code project .

python - How to find out how many clients are on a certain address range? -

i tried googling didnt find anything... building port scanner , make so, can scan network range e.g 192.168.2.* , find out how many computers on range online. alot nmap. programming in python. possible in python? here draft example can start with: import socket addr_range = "192.168.1.%d" ip_address_up = [] # use udp. s = socket.socket(socket.af_inet, socket.sock_dgram) s.settimeout(2.0) in range(1, 254): try: ip = addr_range % socket.gethostbyaddr(ip) ip_address_up.append(ip) except socket.herror ex: pass print ip_address_up or using icmp ( ping ) rather thank udp: import socket import ping ip_address_up = [] addr_range = "192.168.1.%d" in range(1, 254): try: ip = addr_range % delay = ping.do_one(ip, timeout=2) ip_address_up.append(ip) except (socket.herror, socket.timeout) ex: pass print ip_address_up

html - How to detect if JavaScript is disabled? -

there post morning asking how many people disable javascript. began wonder techniques might used determine if user has disabled. know of short/simple ways detect if javascript disabled? intention give warning site not able function without browser having js enabled, want redirect them content able work in abscence of js, need detection place holder start. i assume you're trying decide whether or not deliver javascript-enhanced content. best implementations degrade cleanly, site still operates without javascript. assume mean server-side detection, rather using <noscript> element unexplained reason. there not way perform server-side javascript detection. alternative possible set cookie using javascript, , test cookie using server-side scripting upon subsequent page views. not suitable deciding content deliver not able distinguish visitors without cookie new visitors or visitors blocking cookies.

Can an Archos 28 be used as a test device for Android development? -

i start doing android development, , cheap device deploy apps to, testing , demo purposes. possible deploy apps to, instance, archos 28 ? don't know android development yet, , haven't found answer question elsewhere. thanks. yes, running android 2.2 froyo. should work fine development purposes. keep in mind people using app on cell phones may "larger" archos' screen size.

validation - Enabling/disabling a button with jquery.validationEngine -

i'm using this jquery form validator cannot understand how make 1 simple thing here: if form not valid disable submit button, otherwise enable submit button. a little bit of code: <script type="text/javascript"> $(document).ready(function() { $("#registration_form").validationengine({ // }); }); </script> <?php echo "<form id=\"registration_form\">"; echo "<label for=\"name\">name</label>"; echo "<input class=\"validate[required,custom[onlyletter],length[3,100]]\" id=\"name\"><br />"; echo "<button type=\"submit\" id=\"submit_button\">go</button>"; echo "</form>"; ?> this script <script type="text/javascript"> $(document).ready(function() { $("#registration_form").validationengine( { inlinevalidation:

silverlight - Binding to container not working, but binding to objects works -

i have following xaml (silverlight, shouldn't matter): <listbox x:name="results"> ... </listbox> <stackpanel datacontext="{binding elementname=results, path='selecteditem.attributes'}"> <textblock text="{binding elementname=results, path='selecteditem.attributes[id]'}" /> <textblock text="{binding '[id]'}" /> </stackpanel> when populate listbox, second textblock populated, first textblock not. when select item listbox first textblock populated, second doesn't change. i'm assuming i'm missing tell stackpanel's datacontext needs refresh time change selecteditem in listbox, i'm @ loss on need do. ideally, i'd not have bind whole path each of textblocks (there going bunch of them). gaah... found it. nitwit (you read.. me) decided it'd smart override stackpanel's datacontext when populated listbox. sorry working on this.

objective c - Is it possible to store document fields in a SearchKit index? -

is possible in searchkit (on os x) store document fields in search index, possible in other search libraries? allow displaying fields (author, subject, date, etc) without having read files corresponding underlying documents result of search. do want able read attributes or want able search against them? if want able read them, can add them attributes document via skindexsetdocumentproperties call. retrieve them skindexcopydocumentproperties call. in both cases, properties stored in dictionary. this assumes know how read properties file , you're not blindly relying on search kit / spotlight importers. if want able search against properties, you're going have search index properties want search.

php - how to insert array of data into database -

here code- $things = mysql_real_escape_string(implode(',', $_post['things']),$link); $q = "insert tblslider(src) values ('".$things."')"; print_r($q); $result = $mysqli->query($q) or die(mysqli_error($mysqli)); but query getting generated insert tblslider(src) values ('4368122.jpg,5440051.jpg,1047428.jpg') should insert tblslider(src) values ('4368122.jpg'),('5440051.jpg'),('1047428.jpg') thats why taking 1 record not three. you do: $things = array_map('mysql_real_escape_string', $_post['things']); $q = "insert tblslider(src) values ('". implode("'),('", $things)."')"; it generates (with test data): insert tblslider(src) values ('a.jpg'),('b.jpg'),('c.jpg') i forgot: use functions mysql_real_escape_string on real data, not sql string. in example apply function on concatenated data.

c# - How to find printer status? -

i try write code finding status of printer print crystal reports in pdf format. have following doughts: how can fire code after click print button in crystal report? there events(lick click) check printer staus? what properties change when printer in different modes lid open, no paper, lidopen , no paper, swtch off, switch on, warmup ect.? numeric values returns? , there changes in return values different catagery printers(hp laser printes, canon ect..)? how can display message "success" after successful printing of report? pls, clarify one. you can use system.management win32_printer class query printer information. there win32_printjob , enumerate determine when given job completes. status property may give additional granularity on printer status. can monitor creation , deletion of these objects - give new , completed job info. other printer classes listed here .

How to handle HTTP 403 with Spring Security 3.0.x -

i'm facing little issue spring security 3.0.x (3.0.2 in particular @ moment). whole application i'm working on working except when doesn't have authorities tries log on. when occurs, users redirected "welcome" page, since username/password valid, , receive cute white page : "error 403: access denied" so, i've been looking on net trying find how behavior can handled. far i've come conclusion, please correct me if i'm wrong, managed exceptiontranslationfilter . don't quite understand how make use of information. i've tryied edit securitycontext.xml add access-denied-handler tag http tag, doesn't work. need add more tag make work? there other possibilities make application more user-friendly? edit : redirect page, let's says 403.html, example. sincerly, thanks i still don't why had implement own access handler... have faced same task: <security:access-denied-handler error-page="/accessden

Lucene term boosting with sunspot-rails -

i'm having issue lucene's term [boosting][1] query syntax, in ruby on rails via sunspot_rails gem. whereby can specify weight of specific term during query, , not related weighting of particular field. the html query generated sunspot uses qf parameter specify fields searched configured, , q parameter query itself. when caret added search term specify boost (i.e. q=searchterm^5) returns no results, though results returned without boost term. if, on other hand, create http query manually , manually specify field search (q=title_texts:searchterm^5), results returned , scores seem affected boost. in short, appears though query term boosting doesn't work in conjunction fields specified qf. my application calls search across several fields, using respective boosts associated fields, conditionally in turn boosting on individual terms of query. any insight? [1]: http://lucene.apache.org/java/2_9_1/queryparsersyntax.html#boosting term sunspot uses dismax p

ruby on rails - db:migrate fails in Emacs shell -

when rake db in emacs, fails– although works fine in terminal. error related environment variable emacs doesn't seem picking on. best way resolve in .emacs? need source profile every time start emacs? which emacs shell using? there few different types different cases. read article may find informative: http://www.masteringemacs.org/articles/2010/11/01/running-shells-in-emacs-overview/ i suggest trying m-x shell run default shell in emacs (usually bash).

.net - Does SmartAssemby support multiple-assembly app? -

my console application contains 1 exe , 10 dlls. want , can obfuscate 5 of dlls. rest shared dlls , contain common code cannot obfuscated. current design obfuscated assemblies cannot merged or app break. can smartassembly used situation? lets me pick 1 assembly obfuscate. seems have create project each dlls want obfuscated. true? if wish leave dlls separate files need separate projects. if shared need this. the recommendation merge can (those assemblies aren't shared) .exe's project.

cocoa touch - Using gradient background in UITableViewCell -

possible duplicate: uitableviewcell custom gradient background, gradient highlight color hey trying use gradient background of tableview cell , have tried using code: uiview *view = [[[uiview alloc] initwithframe:cgrectmake(0, 0, 320, 100)] autorelease]; cagradientlayer *gradient = [cagradientlayer layer]; gradient.frame = view.bounds; gradient.colors = [nsarray arraywithobjects:(id)[[uicolor blackcolor] cgcolor], (id)[[uicolor whitecolor] cgcolor], nil]; [view.layer insertsublayer:gradient atindex:0]; [cell setbackgroundview:view]; any idea why isn't working correctly? don't add view directly cell, add cell's contentview . ensure when orientations occur, resizing occurs expected , not screwed way. ensure that, in other cases may have other view (such scrollview) embedded in view, scroll fluidly, etc. things work expected when placed they're...expecting.

linux - Subversion checkout in shared hosting? -

i know shared hostings don't allow svn installation. i got question whats best way copy website repository shared hosting. now: my repository on other vps. i checkout computer , copy shared hosting. how can copy data repo hosting 1 step? if have ssh access target webserver , give rsync , scp look: http://en.wikipedia.org/wiki/rsync http://en.wikipedia.org/wiki/secure_copy i not advise installing subversion server (either svnserve or via apache) on production web server. nor advise copying, or checking out, working copy on web server. many security issues. basically, want generate local copy of site in staging area, , rsync (or scp) production server. you can manually, or better yet, make small "deploy site" shell script will: svn export version/tag want deploy in clean local folder. rsync folder production server. hope helps... luck! :)

Difference between different string types in SQL Server? -

what difference between char , nchar , ntext , nvarchar , text , varchar in sql? is there application case each of these types, or of them deprecated? text , ntext deprecated, lets omit them moment. left, there 3 dimensions: unicode (ucs-2) vs. non-unicode: n in front of name denotes unicode fixed length vs. variable length: var denotes variable, otherwise fixed in-row vs. blob: (max) length denotes blob, otherwise in-row value so this, can read type's meaning: char(10) : in-row fixed length non-unicode of size 10 nvarchar(256) : in-row variable length unicode of size up-to 256 varchar(max) : blob variable length non-unicode the deprecated types text , ntext correspond new types varchar(max) , nvarchar(max) respectively. when go details, meaning of in-row vs. blob blurs small lengths engine may optimize storage , pull blob in-row or push in-row value 'small blob' allocation unit, implementation detail. see table , index organiz

Erlang Internationalization of a web app? -

i'm looking internationalize strings in erlang web app. came across gettext on trapexit . other suggestions how externalize strings in erlang app? gettext has been in daily use since 2003. actually, today @ euc in stockholm, tool named polish presented built on top of gettext. polish helps coordinating translation efforts. see demo here: http://www.youtube.com/watch?v=udhe2yokbcu you'll find polish (and gettext) @ github.

downcast problem in c++ -

#include <iostream> using std::cout; using std::endl; class base { public : void f(); void g(); int mbasedata1; }; class derived : public base { public : int mderiveddata1; }; void main() { base* base = new base(); derived* derived = (derived*)(base); // downcast derived->mderiveddata1 = 6; cout<< derived->mderiveddata1<<endl; // result = 6; } in code new base() allocate memory in heap and derived* derived = (derived*)(base) cast base derived how can use mderiveddata1? cant find allocate memory mderiveddata1 or when call constructor of derived allocate mderiveddata1 ? the reason can't find memory mderiveddata1 allocated because no memory allocated . have performed invalid type-cast . thing stored in base pointer base instance. using type-cast tell compiler it's pointer derived instance doesn't make (but compiler believe anyway because you're 1 in charge). object still base . if wa

After image rotation with php I get jagged edges -

so rotate image php , make background transparent. problem jagged edges. there way anti-alias edges? i'm using http://www.exorithm.com/algorithm/view/rotate_image_alpha code find let me have transparency background i don't have solution jaggies produced php's rotation, but.... you haven't stated you're doing rotated images once they've been rotated? displaying them on web site? if that's you're doing, may suggest consider letting browser rotation css. the following stylesheet code work current browsers (including older versions of ie): .tilted { transform: rotate(45deg); /* css3 (for when gets supported) */ -ms-transform: rotate(45deg); -moz-transform: rotate(45deg); /* ff3.5+ */ -o-transform: rotate(45deg); /* opera 10.5 */ -webkit-transform: rotate(45deg); /* saf3.1+, chrome */ font-weight:bold; filter: progid\:dximagetransform.microsoft.matrix(sizingmethod='auto expand', m11=0.7071067811865476, m12=

sql - MySQL Single Row Returned From Temporary Table -

i running following queries against database: create temporary table med_error_third_party_tmp select `med_error_category`.description category, `med_error_third_party_category`.error_count error_count `med_error_category` inner join `med_error_third_party_category` on med_error_category.`id` = `med_error_third_party_category`.`category` year = 2003 group `med_error_category`.id; the problem when create temporary table , select * on returns multiple rows, query above returns 1 row. seems return single row unless specify group by, returns percentage of 1.0 should group by. select category, error_count/sum(error_count) percentage med_error_third_party_tmp; here server specs: server version: 5.0.77 protocol version: 10 server: localhost via unix socket does see problem causing problem? standard sql requires specify group clause if column not wrapped in aggregate function (ie: min, max, count, sum, avg, etc), mysql supports "hidden columns

c# - Visual Studio view StandardOuptut stream from DLL -

i have c# application using custom dll (written in c, built cl). the dll has many printf's i'd able view while running c# app. far havnt been able figure out how view output dll in visual studio (2010 or 2005). i have test app in c runs dll command line , can see output fine there. is possible see output in visual studio? need build dll differently enable somehow? you might consider free utility sysinternals called debugview: http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx i'm not sure if solve problem if calls going through right place might able pick them up. can't hurt try.

integer - if/then conditional statements using ints -

super easy, sure - in conditional if/then statements using droid, how go using them integers, ie: int currenthour = calendar.getinstance().get(calendar.hour_of_day); public void getresult(int currenthour, intent intent) { if (currenthour < 14) then: //do } i know isn't right way it, having brain fart comparing ints...thanks! public void getresult(int currenthour, intent intent) { if (currenthour < 14){ //do } else { //do else } }

jquery - why the last Value Row values are repeated for the HTML Table -

i have static html table contains 1 button "add" , when clicking on button creates new row contains text boxes , append table .but problem have 3 rows , when click "add" able create new row previous row values copied in new row being generated .here function iam using $('#btn1').click(function(){ tr= $("#tbl tr:last").html(); num= $('#num').val()*1; first= $("#tbl tr:last").attr('id').substr(4)*1; last=first+num; for(i=first+1;i<=last;i++) { var newtr= tr.replace(first,i); $('#tbl').append('<tr id="txt_'+i+'">'+newtr+'</tr>'); } }); how make value selected "abc" in select box when new row being added.iam using statement did not workout .how can make value selected $('#tbl tr:last :input').find('input[name="code"]').val('abc'

c# - .NET Memory size -

i have pretty basic question storing data , memory footprint. i have list<t> stores base objects need. type t has int id define it, along other fields. i have dictionary. if create dictionary<t, int> , t object value, memory allocation higher if create dictionary<int, int> , ie copy of t object stored, or refence t stored again? thanks that depends on t is. if t reference type (that is, class ), reference stored in dictionary. if t value type (a struct ), copy stored.

java - Can I make a variable final after it has been declared? -

i'm making banking model, , account class has accountnumber field. account number should never change, cannot set field final because prevent constructor setting it. if it's not possible this, doesn't matter. it's cs assignment want make sure i'm doing best way can. would best implementation make field , setter method private? the constructor can set if marked final e.g. following legal: public class bankaccount { private final int accountnumber; public bankaccount(int accountnumber) { this.accountnumber = accountnumber; } } in fact if field marked final not initialised in declaration must set in constructors. if not put public setter on class account number can't changed outside class marking final prevent (accidentally) being changed methods inside class.

c# - Am I using DataContext.Dispose() properly? -

i've been getting lots of connection pool timeouts in asp.net mvc project. i've been reading though linq-to-sql should disposing me doesn't work , not manually disposing inherits idisposable bad practice. i'm using repository pattern linq-to-sql statements use. not knowing put datacontext.dispose() method, put in submitchanges() function consists of 2 lines of code: public void submitchanges() { db.submitchanges(); db.dispose(); } is place or doing wrong? if implements idisposable easiest way is: using(var context = new datacontext()){ blah blah } this ensures disposed @ appropriate time. open it. do need do. close it. this way don't have worry hanging around, , not getting called because of exception etc. the dispose key word (msdn link) . since related, here link dispose , finalize . sounds in case, want implement repository implements idisposable. way calling object can create it, needs , close it. can clean data

r - Only keep min value for each factor level -

i got problems bugs me time… here can me. i got following data frame f <- c('a','a','b','b','b','c','d','d','d','d') v1 <- c(1.3,10,2,10,10,1.1,10,3.1,10,10) v2 <- c(1:10) df <- data.frame(f,v1,v2) f factor; v1 , v2 values. each level of f, want want keep 1 row: 1 has lowest value of v1 in factor level. f v1 v2 1.3 1 b 2 3 c 1.1 6 d 3.1 8 i tried various things aggregate, ddply, by, tapply… nothing seems work. suggestions, thankful. using dwin's solution, tapply can avoided using ave . df[ df$v1 == ave(df$v1, df$f, fun=min), ] this gives speed-up, shown below. mind you, dependent on number of levels. give notice ave far forgotten about, although 1 of more powerful functions in r. f <- rep(letters[1:20],10000) v1 <- rnorm(20*10000) v2 <- 1:(20*10000) df <- data.frame(f,v1,v2) > system.time(df[ df$v1 == ave(df$v1, df$f, fun=min), ])

sql - A simple database version control -

if have table stores questions and answers, example using column called such parent. if question doesn't have value in parent, it's question , if does, reply, how version control this? for well-developed example of how keep past revisions of text, @ mediawiki database layout . database layout used mediawiki software, many wikis (notably wikipedia) run on. specifically, page , revision , , text tables primary tables involved keeping track of historic changes.

actionscript 3 - Giving/obtaining a reference to (or the name of) a UIScrollBar in a TextArea -

this such mindnumbingly simple question, apparently forums actionscript discussed (or @ least ones on google) aren't managed. i have textarea. has uiscrollbar. want able reference scrollbar. heard there's update() function, , may able save me inexplicable things damnable uiscrollbar doing on own. (btw, actionscript = joke language) when scrollbar added textarea, dispatches event added. can catch scrollbar this: textarea.addeventlistener(event.added, ontextareachildadded); private function ontextareachildadded(event:event):void { if (event.target uiscrollbar) { //you got var scrollbar:uiscrollbar = event.target uiscrollbar; } } event scrollbar fired once. there many other stuff adds textarea, type check needed. know ya jokes , cool ^_^ edit: wrong... real solution seems textarea.verticalscrollbar.

Should I use a global variable and if not, what instead? (Javascript) -

i'm working several functions need pass variable , forth. should use global variable or method instead? appreciate example or 2 on how implement it. thanks, elliot bonneville psuedocode of functions: function getxml() {//this function reads in xml file. //preferably generate or set object hold xml data. } function usexmldata() { //i use xml data here. } function usexmldatahereaswell() { //and here well. } the best solution you're trying wrap data object , make functions methods on object: function myxmlclass() { this.data = null; } myxmlclass.prototype = { getxml: function() { this.data = ...; }, usexmldata: function() { // use this.data }, /* etc. */ }; and can use this: var x = new myxmlclass(); x.getxml(); x.usexmldata(); ...

menu - How do i get the data?(Drupal 6.x) -

i have form accepts user’s input. is, base on user input, i’d retrieve data , display user. so far, have implemented hook_menu , registered respective url of form, , implemented submit function referred “#submit” attribute of submit button. i’ve implemented data retrieval code , works great. here’s problem – don’t know how display retrieved data. i’ve tried several approaches in attempt find solution. first, theme function, hoping printing return value of display data. second, setting “#action” element of form array newly registered url, thought using same url form cause drupal return form instead , not data. so, creates static variable , stores retrieved data in it;this done inside submit function way. when checked variable inside menu callback, variable not set. to summarize problem, form has different access url form submit, such as form url – http://....?q=mymodule/form submit url (value of ”#action”) – http://....?q=mymodule/execute , , data i’ve set inside submit

regex - Need help with regular expression -

i using django application , needed pattern matching pattern matched: users/?q=john regular expression : '^users/\?q\=(?p[\w]+)[/]?$' like in urls.py url(r'^users/\?q\=(?p[\w]+)[/]?$', user_handler, {'emitter_format' : 'json'}) however it's not matching url, pointers helpful. thanks in cgi, after ? put request.get , not url matching - take here: http://docs.djangoproject.com/en/dev/ref/request-response/ in handler ( user_handler ), can use: request.get['q'] to john above sample url.

gtk - gtkmm button not maintaining size and location -

Image
i have created 2 gtkmm button , added hbox object. called pack_end, , maintained size 21,20. but, sizes not maintained. here code have written , window got while running program. note: mywindow subclass of gtk::window void mywindow::customizetitlebar() { //create vertical box gtk::vbox *vbox = new gtk::vbox(false,0); //create horizontal box gtk::hbox *hbox = new gtk::hbox(true,0); hbox->set_border_width(5); //create title bar image gtk::image *titlebarimage = new gtk::image("src/windowtitlebar.png"); titlebarimage->set_alignment(gtk::align_left); // hbox->pack_start(*titlebarimage,gtk::pack_expand_widget,0); //create cloze button window mbuttonclose = new gtk::button; (*mbuttonclose).set_size_request(21,20); gtk::image *mimage = new gtk::image("src/maximize.jpeg"); (*mbuttonclose).add(*mimage); (*mbuttonclose).set_image_position(gtk::pos_top); // connecting close window function when cliked on close button //(*mbuttonclose).sign

checking if condition in stored procedure( sql server 2005) -

i have sp need check if condition alter procedure [dbo].[spcheck] @strempname varchar(50), @intreturn int output, @intworkdid int, @intempid int begin if(@intworkdid not null , @intworkdid != '') begin if exists ( select * employee [empname] = @strempname , workid = @intworkdid ) select @intreturn = '1' end else if(@intempid not null , @intempid != '') begin if exists ( select * employee [empname] = @strempname , peopleid = @intempid ) select @intreturn = '1' end else if(@intempid not null , @intempid != '') and(@intworkdid not null , @intworkdid != '') begin select @intreturn = '0' end end here based on workid,empid 1 condition , 2 condition should execute if both condition fail need excute third condition ca

c# - referencing other class methods without creating a new instance -

i have class called clientchat basic network stuff. have several other classes linked different window forms. in first form have variable referenced chat class so: clientchat cc = new clientchat(); everything works okay their, class has been initialized , in motion. after first forms done performing it's duty bring second form that's linked new class file. now question is, how can reference what's going on in clientchat class without setting new instance of class? need pass data form networkstream , if create new instance of class wouldn't require new connection server , require start on since it's "new"? i'm bit confused , great, thanks. c# on .net4.0 you create instance of clientchat in beginning of program , then, pass reference classes need it.

c# - Using Interfaces With WCF -

i have googled , read hours , can't find deals specific scenario... i want use interfaces in wcf service contracts loosely couple service classes used on each end of wire. enable have low-level assembly contains service , data contracts (just interfaces) can hand consultant. on end of wire can instantiate data classes implement our data contract interface, send on wire us, , our wcf service translate/cast/whatever incoming data our version of data class implements same interface. here's example. idatacontract contains bare information want transmit on wire. endpoints , other wcf-specific config default stuff (my problems may lie in that, can include more of if that's need change things). edit : i've included more of code , renamed couple classes less confusing. name & namespace additions datacontractattributes, 2 sections in config files new additions based on information this blog post . if switch abstract base class instead of interface, it works . how

linq - How do Group by a child property of a child property that may be null? -

how go grouping following? people.groupby(p=>p.addresses.getfirstordefault().state); without failing on people don't have address? can done in 1 statement? if not, have first distinct() list of various addresses members? how? (actually -- if possible -- great learn how b :-) ) i havn't seen it, there equivalent getfirstornew() can used instantiate , return non-null? thank much! it can done in 1 statement, yes: // set whatever need address dummyaddress = new address { state = "" }; people.groupby(p => (p.addresses.getfirstordefault() ?? dummyaddress).state); alternatively, might want write helper method: public string getstate(address address) { return address == null ? null : address.state; } then can use: people.groupby(p => getstate(p.addresses.getfirstordefault()));

removing deplicate entries based on first column and keeping the latest entry, using Perl -

i need perl code following problem. in advance efforts. my input in file in format: 'name' 'version number' tech-sgla-zustand-ts.ini 1.1 tech-sgla-zustand-ts-feld.ini 1.1 tech-sgla-stamm-cds-feld.ini 1.1 tech-sgla-zustand-ts-feld.ini 1.2 tech-sgla-zustand-ts-feld.ini 1.4 tech-sgla-zustand-ts-feld.ini 1.3 i need in format (without blank lines in between): 'name' should unique maximum 'version number' tech-sgla-zustand-ts.ini 1.1 tech-sgla-zustand-ts-feld.ini 1.4 tech-sgla-stamm-cds-feld.ini 1.1 you use : my %inifiles = (); while (<>) { ($ini, $vers) = split / +/, $_; if (exists $inifiles{$ini}) { $inifiles{$ini} = $vers if ($inifiles{$ini} < $vers); } else { $inifiles{$ini} = $vers } } while (my ($k,$v) = each %inifiles) { print "$k $v\n" } or if input order important : my @inis = (); %inifiles = (); while (<>) { ($ini, $vers) = split / +/, $_; if (exis

c++ - Operator overloading -

why overloaded operator= mandated member function ($13.5.3), not compound assignment operator e.g. operator+= ($13.5.2)? overlooking here? a copy assignment operator= , member, provided compiler if user doesn't define one. believe simplicity , avoid unexpected ambiguities made requirement operator= can't defined free function. conversion operators take care of case when want assign user-defined type built-in type.

Problem creating subreports in iReport -

i have created report contains subreport. subreport in turn contains 2 more subreports , each of them display graph. when preview main report loads partially , incomplete, each subreport previews fine. why happening , solution it? i using ireport 3.7 professional. kindly help. thanks it depends on have kept sub reports in page , proper alignment. also please check there should query returns values in main report , in sub reports.

java me - Where to store API KEY in j2me? -

in project, calling webservice http request. api key there in http parameter. in j2me devices before connecting internet showing url , asking permission user.here user can see api key. and don't want store api key in application also.because using decompiler can api key applciation. so question store api key , how use calling web services? if api key required use webservice, must store somewhere in app...by way, can store in kind of encrypted way, simple decompile not reveal it. if user should enter api key, can store in standard rms store outside of app, again maybe encrypted. an url issue, use http post request instead of http get, , send key in post data.

java - Seam Interceptor abstract base class -

i'm experimenting seam interceptors. i have custom annotation defined as: @target(type) @retention(runtime) @interceptors(someinterceptor.class) public @interface myinterceptannotation { } and have superclass annotated @myinterceptannotation @myinterceptannotation myabstractsuperclass{...} is possible have subclasses derived myabstractsuperclass intercepted?? best regards no, suppose. can try out. however, can done on package level, using package-info.java . so, classes belong particular package intercepted. below, package-info.java @myinterceptannotation package my.package.name; import my.annotation.package.name.myinterceptannotation; in order force subclasses define annotation, @ this thread . just came across related thread , spring . wonder if have similar way in seam . can try find out.

Maven - Exclude certain resource files into WAR from the default src/main/resources location -

currently, want exclude files default src/main/resources folder war when packaging i tried using maven-war-plugin following configuration failed. <webresources> <resource> <directory>src/main/resources</directory> <targetpath>web-inf/classes</targetpath> <excludes> <exclude>*.xml</exclude> </excludes> </resource> </webresources> ...web-inf/classes still contain xml files. how so? as pointed out in https://stackoverflow.com/a/2737635/722997 , quick way exclude files war package exclude them in build->resources section, like: <build> <resources> <resource> <directory>src/main/resources</directory> <excludes> <exclude>*.xml</exclude> </excludes> </resource> </resources> ... </build> note : take account following co

ios - Bluetooth programming in iPhone -

i planning develop iphone application transfer files/data to/from windows desktop using bluetooth. please let me know whether programming interface(sdk)is available in iphone sdk purpose. in windows mobile, can transfer file either using ftp profile or writing application on top of serial port profile(rfcomm). can tell me, whether can possible iphone writing appropriate application. if not, please let me know alternative way transfer files/data on bluetooth iphone windows desktop pc. no, ftp or spp bluetooth profile not open in iphone...

memory management - External allocation too large for this process in Android -

i'm getting " external allocation large process " errors in app. lots of these @ once: 11-16 10:56:59.230: error/dalvikvm-heap(2875): 1303680-byte external allocation large process. 11-16 10:56:59.230: error/graphicsjni(2875): vm won't let allocate 1303680 bytes 11-16 10:56:59.230: error/dalvikvm-heap(2875): 1536000-byte external allocation large process. 11-16 10:56:59.230: error/graphicsjni(2875): vm won't let allocate 1536000 bytes it appears produced while layout being rendered, after loading large bitmaps. errors, however, not produced while bitmap being decoded. how can debug these errors? additional pointers? adamp's comment answer in particular case: the framework capture views onscreen temporary bitmaps drawing performance. looks app pushing right against memory limit , bumps over. take @ other suggestions limiting app's memory usage.

TextView in android -

i developing application in layout independent of screen resolution. problem in textview textview layout change when resolution of screen changes size of text remain same. i want when resolution high, according text size should adjust itself(i.e. text size should changed). , simillarly when resolution low text size sholud shrink. but here when reduce y-axis extent text vanishes. i appriciate answer. thank you. you should using sp android:textsize .

Index verification tools for Lucene -

how can know index in lucene correct? detail i created simple program created lucene indexes , stored in folder. using diagnostic tool, luke inside index , view content. i realise lucene standard framework building search engine wanted sure lucene indexes every term existed in file. can verify lucene index creation dependable? not single term went missing? you build small program perform same analysis use when indexing content. then, terms, query index make sure document among results. repeat content. personally, not waste time on this. if can open index in luke , if can make couple of queries, fine. often, real question whether or not analysis did on content appropriate queries made against index. have make sure index have balance between recall , precision .

android - Help create TableLayout inside .java activity -

i having problem create tablelayout inside activity. far managed display resulting query using textview. ( (textview) view.findviewbyid(r.id.tv_id) ).settext( listitem.getid()+""); ( (textview) view.findviewbyid(r.id.tv_name) ).settext( listitem.getname() ); ( (textview) view.findviewbyid(r.id.tv_age) ).settext( listitem.getage()+"" ); i appreciate if can me turn textview tablelayout. thanks help you need in layout xml. if output of activity xml like: <table_layout android:layout_width="fill_parent" android:layout_height="fill_parent" android:stretch_columns="*"> <tablerow> <textview android:id="@+/tv_id" android:layout_width="wrap_content" android:layout_height="fill_parent"/> <textview android:id="@+/tv_name" android:layout_width="wrap_content" android:layout_height="fill_parent"/> <textview android:id="@+/tv_age"

Can php a href post not use a link like index.php?id=value -

i want post value through href. however, not use link index.php?id=value . there other method? i want post test1 , test2 . <div id="div1"> <li><a href="index.php">test1</a></li> <li><a href="index.php">test2</a></li> </div> <div id="div2">this <? $_post["name"]; ?>, test.</div> use form, method=post, , hidden form field value want post. 'href' either becomes submit button, or have onclick action on link submits form.

sql server - Full text search vs LIKE -

my question using fulltext.as know queries begin % never use index : select * customer name %username% if use fulltext query can ı take better performance? can sql server use fulltext index advantages queries %username%? short answer there no efficient way perform infix searches in sql server, neither using like on indexed column, or fulltext index. long answer in general case, there no fulltext equivalent operator. while works on string of characters , can perform arbitrary wildcard matches against inside target, design fulltext operates upon whole words/terms only. (this slight simplification purpose of answer.) sql server fulltext support subset of prefix term operator. docs ( http://msdn.microsoft.com/en-us/library/ms187787.aspx ): select name production.product contains(name, ' "chain*" '); would return products named chainsaw, chainmail, etc. functionally, doesn't gain on standard like operator ( like 'chain%' ), , l

.net - Can big ViewState content result a HTTP Error 504 - Gateway timeout? -

i have 1 asp.net page seems return big content (5,648,733 bytes , mostly consumed viewstate) ending 504 gateway timeout error. tracking http request/response using fiddler. and basically, when post-back same page -by clicking button- post-back fails thoose errors shown in ie , in ff: internet explorer cannot display webpage --> in ie the connection server reset while page loading. --> in ff question : can because of big size injected in viewstate; , if yes, main reason loads page cannot post page after? i wonder if hitting maxrequestlength of application; default 4mb.

Spring WebMVC: interceptor which has access to the method definition and the HttpServletRequest -

i'm trying intercept spring controller calls annotated, similar to: @requestmapping("/my/page") @accessrestriction(module = module.audit, action = auditactions.log) public modelandview mypage() { // pls type teh codez } at point want access both values of @accessrestriction method, httpservletrequest object check if values match restrictions , httpservletresponse object in order send redirect , if applicable. being able throw exception might suitable well. i've looked interceptors don't offer access method, handler. options of achieving this? my suggestion decouple 2 concerns, 1 check annotation , throw exception, catch exception , translate redirect. the first concern done using auto-proxy facility , apply aop-style interceptor invocations on controller objects. check annotation, validate invocation, , throw custom runtimeexception conditions violated. you have custom handlerinterceptor checked exception in aftercompletion method

php - How to replace every second white space? -

i want replace every second white space " , " using preg_replace . , input string this: $string = 'a b c d e f g h i'; should result in output this: a b,c d,e f,g h,i thanks you can use combination of explode , array_chunk , array_map , implode : $words = explode(' ', $string); $chunks = array_chunk($words, 2); $chunks = array_map(function($arr) { return implode(' ', $arr); }, $chunks); $str = implode(',', $chunks); but assumes each word separated single space. another , easier solution using preg_replace this: preg_replace('/(\s+\s+\s+)\s/', '$1,', $string) the pattern (\s+\s+\s+)\s matches sequence of 1 or more non-whitespace characters ( \s+ ), followed 1 or more whitespace characters ( \s+ ), followed 1 or more non-whitespace characters, followed 1 whitespace character, , replaces last whitespace comma. leading whitespace ignored. so matches in case: a b c d e f g h \__/\__/\__/\__/ th