Posts

Showing posts from February, 2012

php - How to switch ZendX_JQuery back to use CDN rather than local library? -

i have following settings jquery in application.ini because it's used in every controller , every action: [production] pluginpaths.zendx_application_resource_ = "zendx/application/resource" resources.jquery.version = 1.5 resources.jquery.ui_enable = true resources.jquery.ui_version = 1.8.9 [development : production] resources.jquery.localpath = "/js/jquery-1.5.min.js" resources.jquery.ui_localpath = "/js/jquery-ui-1.8.9.custom.min.js" i don't want use cdn in development because might slow because i'm behind proxy. in 1 case want use cdn because base uri has different. the below trick core library: $this->view->jquery()->setlocalpath(''); but doesn't work ui library: $this->view->jquery()->setuilocalpath(''); any ideas? you try if works $config = new zend_config_ini( application_path . '/configs/application.ini', application_env ); $this->view->jquery()->

How to create a mixed data buffer in Java? -

i need create buffer contains byte , string data. how can in java? you can use plain array of objects object[] or implementation of collections (list, set) etc. but why? if want store different types of data in same collection, check design. if still wish create wrapper interface , many want implementations. each implementation store type if data. create collection stores these wrappers: interface storagecell<t> { } class stringcell implements storagecell<string>{} class bytecell implements storagecell<byte>{} and buffer is: collection<? extends storagecell> buffer = new linkedlist<storagecell>();

Execute .bat file from java? -

i come previous problem executing .bat file java program. when execute java code, don't understand why it's looking .bat file in project directory of eclipse. i declare path : "cmd.exe", "/c", "start", "c:\\file\\batfile.bat" if explain me clearly, please. thank much! i use win xp , eclipse helios. here code: string cmd; try { string[] command = { "cmd.exe", "/c", "start", "c:\\file\\batfile.bat" }; runtime r = runtime.getruntime(); process p = r.exec(command); p.waitfor(); } catch (exception e) { system.out.println("execution error");} the process cmd.exe (picked path environment variable) created current working directory same in parent process (eclipse.exe = java). c:\eclipse or workspace dir. if cant find file (c:\file\batfile.bat) tries curr

Handling field types in database interaction with R -

i use rmysql , mysql database store datasets. data gets revised or store results database well. long story short, there quite interaction between r , database in use case. most of time use convenience functions dbwritetable , dbreadtable to write , read data. unfortunately these ignoring r data types , mysql field types. mean expect mysql date fields end in date or posix class. other way around i´d think these r classes stored corresponding mysql field type. means date should not character – i not expect distinguish between float , doubles here... i tried use dbgetquery – same result there. there have missed when reading manual or not possible (yet) in these packages? nice work around? edit: @mdsummer tried find more in documentation, found these disappointing lines: `mysql tables read r data.frames, without coercing character or logical data factors. while exporting data.frames, factors exported character vectors. integer columns imported r integer vectors, except cas

iphone - when an action sheet is visible in a mode (i.e. portrait), should it rotate in the other one (i.e. landscape)? -

i have app supports both orientations. when action sheet displayed in portrait mode, view doesn't rotate in landscape mode. should so? or view should rotate , action sheet resize? thank in advance. fran ... action sheet displayed in orientation displayed. not rotate. try official app mail or notes.

c++ - Pass data as code -

i'm trying interpret formula given input: y= y argv[1][s] 5; where argv[1][s] can + - * example. y= y+5; y= y*5; i use check specific values, it's more interesting find out why doesn't work. error c2146: syntax error : missing ';' before identifier 'argv' i think happens + passed '+' no operation results. there way unquote this? no, because that's not how c++ works. code must make sense @ compile-time, compiler can convert fixed set of assembler instructions. run-time text not "substituted" in; there no equivalent of "eval" in interpreted languages. if want this, you'll need like: switch (argv[1][s]) { case '+': y = y + 5; break; case '-': y = y - 5; break; case '*': y = y * 5; break; default: std::cerr << "unrecognised operator: \"" << argv[1][s] << "\"" << std::endl;

contenttype - SharePoint 2010: RemoveFieldRef and Inherits="TRUE" -

i have created custom content type inherits ootb sharepoint picture content type. customisations have made add simple url field, , remove 2 of fields on base type. see below: <elements xmlns="http://schemas.microsoft.com/sharepoint/"> <!-- parent contenttype: picture (0x010102) --> <contenttype id="0x0101020027f16ab27e6e45a6848c25c47aaa7053" name="custom picture" description="" group="custom" inherits="true" version="0"> <fieldrefs> <removefieldref id="{b66e9b50-a28e-469b-b1a0-af0e45486874}" name="keywords" /> <removefieldref id="{a5d2f824-bc53-422e-87fd-765939d863a5}" name="imagecreatedate" /> <fieldref id="{c29e077d-f466-4d8e-8bbe-72b66c5f205c}" name="url" displayname="u

java - How do I use Throwables.propagateIfInstanceOf() from Google Guava? -

the javadoc example try { somemethodthatcouldthrowanything(); } catch (iknowwhattodowiththisexception e) { handle(e); } catch (throwable t) { throwables.propagateifinstanceof(t, ioexception.class); throwables.propagateifinstanceof(t, sqlexception.class); throw throwables.propagate(t); } is not concrete. how real program like? don't understand purpose of methods throwables.propagateifinstanceof(throwable, class) , propagate() , propagateifpossible() . when use them? the purpose of these methods provide convenient way deal checked exceptions. throwables.propagate() shorthand common idiom of retrowing checked exception wrapped unchecked 1 (to avoid declaring in method's throws clause). throwables.propagateifinstanceof() used retrow checked exceptions if types declared in throws clause of method. in other words, code in question public void dosomething() throws ioexception, sqlexception { try { somemethodtha

c# - Bouncy Castle, RSA: transforming keys into a String format -

i'm using rsa (bouncy castle api) in c# project. generated keypair method: rsakeypairgenerator r = new rsakeypairgenerator(); r.init(new keygenerationparameters(new securerandom(), 1024)); asymmetriccipherkeypair keys = r.generatekeypair(); asymmetrickeyparameter private_key = keys.private; asymmetrickeyparameter public_key = keys.public; now want save them in txt file problem can't convert them string format. read in post keys must serialized using: privatekeyinfo k = privatekeyinfofactory.createprivatekeyinfo(private_key); byte[] serializedkey = k.toasn1object().getderencoded(); is right way? if yes, should after this? convert them byte[] string? you use pemwriter store them in pem format: textwriter textwriter = new stringwriter(); pemwriter pemwriter = new pemwriter(textwriter); pemwriter.writeobject(keys.private); pemwriter.writer.flush(); string privatekey = textwriter.tostring(); now privatekey contain this: -----begin rsa private key----- m

java - application development -

i developing application. how can implement open , save operations? require connecting user's file system. sample code in regard? still can give guidelines. you need decide technologies want use build application java swing or other web related technologies. if going java swing there components allow save or open file no interaction file system. please go through filechooser

java - Do I have to close FileInputStream? -

i working trainee in test automation. working creating junit code eclipse , run using eclipse. in retriving datas excel sheet using fileinputstream function. fileinputstream fi=new fileinputstream("c:\\search.xls"); workbook w=workbook.getworkbook(fi); sheet s=w.getsheet(0); is necessary close inputstream function? if please guide me codings. yes, need close inputstream if want system resources released back. fileinputstream.close() need.

grails - How to order by number of keywords found in sql/namedQuery -

i created query , or select * xxx title ('%bon%') or title ('%test%') i receive result : bonjour je test bonjour test bonjour test and ordered number of word in title : bonjour je test test bonjour bonjour test i use grails namedqueries. is possible ? thanks you can use little trick count number of space characters , sort that. select * xxx title ('%bon%') or title ('%test%') order (len(title) - len(replace(title, ' ', '')))

c# - Is it possible to remove an existing registration from Autofac container builder? -

something along lines: builder.registertype<mytype>().as<itype>(); builder.registertype<mytype2>().as<itype>(); builder.deregistertype<mytype>().as<itype>() var container = builder.build(); var types = container.resolve<ienumerable<itype>>(); assert.istrue(types.count == 1); assert.istrue(types[0].gettype == typeof(mytype2)); scenario: go through bunch of assemblies , go register types want make sure have 1 implementation of given type. need before create container. track on own nice if autofac me bit. this cannot done directly using containerbuilder , unless start on new one. mind you, having first built container should able construct new container filtering away unwanted types , reusing registrations first container. this: ... var container = builder.build(); builder = new containerbuilder(); var components = container.componentregistry.registrations .where(cr => cr.activator.limittype != typ

templates - Variadic functions (without arguments!) -

let's assume want in c++0x: size_t count_int() { return 0; } template<typename t, typename... tn> size_t count_int(t a0, tn... an) { size_t n = is_integer<t>::value ? 1 : 0; return n + count_int(an...); } nice, feels unnecessary pass around arguments. unfortunately, not work: size_t count_int() { return 0; } template<typename t, typename... tn> size_t count_int() { size_t n = is_integer<t>::value ? 1 : 0; return n + count_int<tn...>(); } gcc complains error: no matching function call 'count_int()' in next-to-last line. why , how can fixed? thanks. this works : template <typename t> size_t count_int() { return is_integer<t>::value ? 1 : 0; } template<typename t, typename t1, typename... tn> size_t count_int() { size_t n = is_integer<t>::value ? 1 : 0; return n + count_int<t1,tn...>(); };

iphone - "[CFString release]: message sent to deallocated instance" when using CoreData -

i have started using coredata in project. without pieces of code codedata project working pretty fine. added methods accessing nsmanagedobjectcontext coredata project template. try create new coredata object following code: - (void)savesearchresulttohistory:(nsarray *) productsarray { [productsarray retain]; nslog(@"context: %@", self.managedobjectcontext); product *product = [nsentitydescription insertnewobjectforentityforname:@"product" inmanagedobjectcontext:self.managedobjectcontext]; product.productid = [(product *) [productsarray objectatindex:0] productid]; nserror *error; if (![self.managedobjectcontext save:&error]) { nslog(@"whoops, couldn't save: %@", [error localizeddescription]); } [productsarray release]; } when method ran once fine, when try run second time, processing stopped at: product *product = [nsentitydescription

java - parameter constructor for class.forName in j2me -

how create parameter constructor class.forname in j2me sample code: class { a() { } a(int a) { } } //here code call constructor object o = class.forname("org.java.datamembers.a").newinstance(); how call parameter constructor in j2me..plz help pretty sure answer can't. if it's class in charge of, you'll need create parameterless constructor... if not, you'll need find way want.

Google Analytics & Adwords delayed javascript link to App Store ignored? -

Image
i'm trying measure conversion both google adwords campaign , normal traffic going app store. had link "/app_store/" on page load, wait 1 second , continue app store. i found more elegant solution somewhere using javascript. adwords loads pixel image , analytics calls google javascript function, pauses fraction of second , follows link. unfortunately it's not working me. google analytics , google adsense don't see going app store (not myself). <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setaccount', 'ua-18180332-1']); _gaq.push(['_trackpageview']); (function() { var ga = document.createelement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getelementsbytagname('script')[0]; s.pare

c# - WinForms Application.Exit does not exit the app necessarily -

on msdn have read calling application.exit not have exit every time. know cause that? mean when expect application.exit not exit application? application.exit call formclosing every opened form, , event can cancelled. if form has cancelled event, application.exit stop without doing anything. else forms closed. but, if have non-background threads working (in additional main thread) application not finished application.exit.

Is there an eBook (ePub) version of the android user guide -

is there ebook (epub version of android developer's guide available somewhere can carry around , read parts without carrying laptop? thanks p.s. understand such product not dynamic online version, looking portability. there pdf version available, 1 can read using pdf reader on mobile devices, adobe reader. i used following link download android device: http://www.scribd.com/doc/14757121/android-the-developers-guide

php - unexpected cast to boolean? -

given input: http://example.com/item.php?room=248&supply_id=18823 , following 2 blocks ought produce same result. why don't they? missing other coffee? this block gives expected values: if (isset($_get['supply_id']) && isset($_get['room'])) { $id=validkey($_get['supply_id']); //18823 $room=validkey($_get['room']); //248 $arr=array('s'=>$id,'r'=>$room); //s=>18823, r=>248 } but if check , assignment in 1 step, $id ends equal 1 instead of 18823. why? if (isset($_get['supply_id']) && isset($_get['room'])) { if($id=validkey($_get['supply_id']) && $room=validkey($_get['room'])) $arr=array('s'=>$id",'r'=>$room); //s=>1, r=>248 } this function i'm using: function validkey($value){ if(is_scalar($value)){ $value=(int)$value; return ($value>0) ? $value : false; } ret

c - Untyped arguments in main -

possible duplicate: “int main (vooid)”? how work? main(a,b,c) { a=1; b=2; c=3; printf("%d %d %d",a,b,c); } how 3 integer arguments a , b , c possible inside main, know second formal parameter has pointer pointer character? argument parameters implicitly int , unless specify otherwise. main required main(void) or main(int, char **) on hosted platform (i.e., running under os, basically). in freestanding implementation, prototype main implementation-defined.

How do I randomly generate HTML hex color codes using JavaScript? -

possible duplicate: random color generator in javascript i have data i'd display in different colors , want generate colors randomly if possible. how can generate hex color code using javascript? '#'+(math.random()*0xffffff<<0).tostring(16);

c# - randomize display order for controls in asp.net -

i know how can randomize order in controls displayed. basically, have 5 hyperlinks, , want on each load order in displayed randomized. way can accomplish that? thanks, laziale assuming 5 links in asp panel named "pnllinks", , links controls in panel: <asp:panel id="pnllinks" runat="server"> <asp:hyperlink id="hyperlink0" runat="server" text="test1" /> <asp:hyperlink id="hyperlink1" runat="server" text="test2" /> <asp:hyperlink id="hyperlink2" runat="server" text="test3" /> <asp:hyperlink id="hyperlink3" runat="server" text="test4" /> <asp:hyperlink id="hyperlink4" runat="server" text="test5" /> </asp:panel> use code randomize order: protected void page_load(object sender, eventargs e) { var ctrls =

Java ClassCastException when generating WSDL in Eclipse? -

i trying create new web service in eclipse (bottom up, apache axis 1, tomcat 6), warnings before attempt , error after. error: iwab0398e error in generating wsdl java: java.lang.classcastexception: org.apache.axis.encoding.ser.beanserializer cannot cast org.apache.axis.encoding.serializer here use serializable: public class integrationutils extends utilities implements java.io.serializable { private static final long serialversionuid = 7515033201857603982l; summary of warnings: lot of warnings have classes used web service class not having default constructors . here warnings: the service class "net.abc.indy.webservice.integrationutils" not comply 1 or more requirements of jax-rpc 1.1 specification, , may not deploy or function correctly. service class "net.abc.indy.webservice.integrationutils" not comply 1 or more requirements of jax-rpc 1.1 specification, , may not deploy or function correctly. field or property "headers" on val

Loading an Ontology in Python -

i have ontology written in owl. know can load python? packages or manually? rdflib mentioned in other questions not suitable me because concerns rdf , "seth" nice library doesn't work, because requires "pellet" library website seems down , it(seth) works jvm 1.4! i've not tried this, @ loading ontology sesame database , query using python wrapper. i've played rdfalchemy , pysesame little, still don't have feel how are. rdf/owl databases feel immature me in general, expect encounter significant technical hurtles.

.net 4.0 - MVVM-Light/WPF Navigation Application -

Image
as write wpf application mvvm light, i'm trying determine best way allow navigation in application. i've been reading creating services, interfaces, , helpers, unfortunately head still hasn't grasped great advice being offered on so. got down spiral of starting simple class , code behind use mef and/or unity accomplish task. what find simplest way add basic navigation of frame mvvm light application built on wpf? the problem seems light, it's hard. solution must cover several aspects navigating existing view, closing view, injecting viewmodel before navigating view, animated transitions, etc. please check out magellan wpf framework created paul stovell covers issues , more!

erlang list filter question -

i have list - sep1: [ .... ["message-id", "aaaaaaaaaaaaaaaaaaa"], ["to", "bbbbbbbbbbbbbbbbb"] ... ] i try element first item = message_id example: lists:filter(fun(y) -> (lists:nth(1,lists:nth(1,y)) =:= "message-id") end, sep1). but error: exception error: no function clause matching lists:nth(1,[]) in function utils:'-parse_to/1-fun-1-'/1 in call lists:'-filter/2-lc$^0/1-0-'/2 but if i: io:format(lists:nth(1,lists:nth(1,sep1))). > message-id what's wrong? thank you. it's better change representation [{key, value}, ...] can use lists:key* functions, proplists module, or convert dict dict:from_list/1 . but if still want use lists:filter/2 can filter list of lists first element following: lists:filter(fun ([k | _]) -> k =:= "message-id" end, listoflists). if want extract tails of lists first element match "message-id" can use l

javascript - Is it possible to send a function to another window using postMessage without having to eval it? -

postmessage accepts strings, has converted string (which isn't problem). once there needs executed. best way this? don't send function, , don't eval receive in onmessage event - come anywhere. cross document messaging designed hole in same origin security policy implemented browsers, if you're going purposely work around policy incumbent on understand you're doing , handle security yourself. calling eval on you're offering run on page, presumably containing user's data, javascript hacker can trick page accepting. a better way whitelist allowed operations , select among them based on what's passed onmessage . function receivemessage(event) { // trust sender of message? // test domain sending messages if (event.origin !== "http://example.com:") return; if (event.data == 'command1') docommand1(); //define these functions elsewhere if (event.data == 'command2') docommand2(); //note no data passe

java - How to enable enums directive in Struts2 for FreeMarker results? -

say have enum class "sample.enums.enum", , have struts2 applications default configuration part. if configure beanwrappers correctly, should work. ${enums["java.math.roundingmode"].up} it not work. how configure struts2 freemarker configuration allow enums directive. i.e. root.put("enums", beanswrapper.getdefaultinstance().getenummodels()); ok not difficult, extend freemarkermanager , override @override public simplehash buildtemplatemodel(valuestack stack, object action, servletcontext ervletcontext, httpservletrequest request, httpservletresponse response, objectwrapper wrapper) in method, set enums hash model on model. set struts property, <constant name="struts.freemarker.manager.classname" value="your.freemarker.configclass">

c# - ComboBox ListItem Help -

i have code here, trying output contents of combobox, label. error cannot convert char system.web.ui.webcontrols.listitem foreach (listitem mine in listsitesdropdownbox.items) { mylabel.text += mine.value.tostring() + " " + mine.tostring() + "<br>"; } how suggest go doing can output value , name of list item? thanks you want text property of mine in second part. foreach (listitem mine in listsitesdropdownbox.items) { mylabel.text += mine.value + " " + mine.text + "<br>"; } here's msdn reference listitem . tostring unnecessary value string .

windows - IE8 Rendering Incorrectly (not just CSS/HTML hack) -

that sounds familiar i'm sure, it's not css hack issue. i'm literally having trouble version of ie rendering page different (same) version of ie8 on different computer. i've checked display settings, encoding, , zoom options on afflicted computer. interestingly printing incorrectly. the anomalies include, aren't limited incorrect margins, incorrect font sizing, incorrect line height. the operating system windows xp. browser ie8. thoughts? -jkt make sure compatibility mode consistent between 2 computers, i.e. want on both.

ruby on rails - '.each do' is leaving some line like "#<Table:0x224af70>" -

i'm trying prepare json object rails app. here code: #videos_controller def show @video = video.find(:all, :conditions => { :published => true, :trash => false }, :order => 'random()', :limit => 1) respond_to |format| format.html # show.html.erb format.json {render :partial => "videos/show.json"} end end #_show.json <%= @video.each |video| %> { "video_link": "<%= video.link %>", "video_id": "http://website.com/videos/each/<%=video.id%>" } <% end %> but @ videos/show.json i'm getting that { "video_link": "http://www.youtube.com/watch?v=6rmwnwtps6i", "video_id": "http://website.com/videos/each/51" } #<video:0x220a060> how avoid nasty last line , getting from? think, becouse of that, doesn't allow me work json object properly.

database - Does Silverlight Support sqlce or Ms Access DB -

does silverlight support sqlce or ms access databe.? my requirement application outofbrowser need crud trasaction throught how can use this. i had try isolation storage database, phase issue inserting data , reading data(at first time able create db , table , insert data, second time phase issue of inserting means append , create diffrent different file reading problem), so confuge this, had try domain entity framwork , domain service ria, not support in outofborwser. what actual solution this.? thanks..!! no sqlce not implemented silverlight platform.

iphone - UIWebView loadData and iWork Files -

i attempting open iwork 10 numbers file placed on web site uiwebview. tried following, , happens uiwebview loads blank. if download file local documents folder , load in uiwebview works. i'd read iwork file without downloading them... fyi, have no issues pdf, ppt, doc, xls... can tell me how load iwork file nsdata uiwebview? [webview loaddata:receiveddata mimetype:file.mediamimetype textencodingname:nil baseurl:[nsurl urlwithstring:pathtofile] ]; the tested values mediamimetype are: application/vnd.apple.numbers application/x-iwork-numbers-sffnumbers you need compress iwork file .zip extension display in webview. refer link detail: http://developer.apple.com/library/ios/#qa/qa1630/_index.html

ios - UISearchBar in navigationbar -

how can show uisearchbar in navigationbar? i can't figure out how this. your appreciated. to put searchbar center of navigationbar: self.navigationitem.titleview = self.searchbartop; to put searchbar left/right side of navigationbar: uibarbuttonitem *searchbaritem = [[uibarbuttonitem alloc] initwithcustomview:searchbar]; self.navigationitem.rightbarbuttonitem = searchbaritem;

jsp - java.lang.IllegalStateException: Component javax.faces.component.UIViewRoot@19ded20 not expected type -

i'm retrieving exception when open jsf page. how caused , how can fix it? org.apache.jasper.jasperexception: exception occurred processing jsp page /searchresultjsf.jsp @ line 18 15: <body> 16: <h1>search result</h1> 17: 18: <h:datatable id ="abc" value="#{searchbean.dealerlist}" var="dealer"> 19: <h:column> 20: <f:facet name="header" > 21: <h:outputtext value="dealer name "/> stacktrace: org.apache.jasper.servlet.jspservletwrapper.handlejspexception(jspservletwrapper.java:505) org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:398) org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:342) org.apache.jasper.servlet.jspservlet.service(jspservlet.java:267) javax.servlet.http.httpservlet.service(httpservlet.java:

.net - C# 4.0 - Multidimensional Associative Array (or way to mimic one?) -

i'm experienced php developer transitioning c#. @ present working on windows forms application. i found in searches c# doesn't support associative arrays in same loose fashion php does. have found info on dictionary , "structs" seem class objects. the trouble having getting head around not associative array, multi dimensional 1 want use keeping multiple counts in series of loops. the application reading text log file, searching predefined string, pulling out date on line when string found, , incrementing count string match on date. in php, easy this: // initialize $count_array[$string_date][$string_keyword] = 0; ... // if string found $count_array[$string_date][$string_keyword] += 1; ... // ouput contents of array foreach($count_array $date -> $keyword_count_array) { echo $date; // output date foreach($keyword_count_array $keyword -> $count) { echo $keyword . ": " . $count; } } it seems little more involved in c

LINQ build in time Silverlight c# -

i have method this: the parameteres can null public string getall(string d1, string d2, string d3){ linq } i want linq query if d1 no null, if d2 not null, if d1 , d2 no null , posible convinations whit parameters. i dont want do: if(d1 != null) //linq opt1 if(d2 != null //linq opt2 if(d1 != null && d2 != null) //linq opt3 please :( generally queries in these types of questions have -some- commonality (otherwise, why use 1 method?). perhaps looking conditional filtering. public string getall(string d1, string d2, string d3) { using(customdatacontext dc = new customdatacontext()) { iqueryable<customer> query = dc.customers; if (d1 != null) { query = query.where(c => c.name.startswith(d1)); } if (d2 != null) { query = query.where(c => c.orders.any(o => o.ordernumber == d2)); } if (d3 != null) { query = query.where(c => c.favoritecolor == d3); } quer

sql - Identify Row as having changes excluding changes in certain columns -

within our business rules, need track when row designated being changed. table contains multiple columns designated non-relevant per our business purposes (such date entered field, timestamp, reviewed bit field, or received bit field). table has many columns , i'm trying find elegant way determine if of relevant fields have changed , record entry in auditing table (entering pk value of row - pk cannot edited). don't need know column changed (although nice down road). i able accomplish through stored procedure, ugly sp using following syntax update (or statements shortened considerably post): insert [tblsourcedatachange] (pkvalue) select d.pkvalue deleted d inner join inserted on d.pkvalue=i.pkvalue ( i.[f440] <> d.[f440] or i.[f445] <> d.[f445] or i.[f450] <> d.[f450]) i'm trying find generic way designated ignore fields , stored proc still work if added additional relevant fields table. non-relevant fields

asp.net mvc - MVC, display a list of images asynchronously with AJAX / JQUERY -

i have site, load list of images (thumbnails) database. problem images displayed rather slowly, fetching each thumbnail url.action rather time-consuming (when going through whole mvc pipeline). therefore, load images asynchronously ajax & jquery, while displaying standard loading image (ajaxloag.info) each image, until image loaded. similar question has been raised here , need more complete example, new mvc , jquery. thanks in advance, view (partialview) // foreach product, display corresponding thumbnail <% foreach (var p in model) { %> . . <img width="100" src="<%= url.action( "thumbnail", "products", new { productid = p.id } ) %>" alt="" /> controller public actionresult thumbnail(string productid) { try { guid pid = new guid(productid); byte[] thumbnaildata = _productsrepository.getproductthumbnail(pid); if

c - Writing to 0xb8000000 yields output on screen without any print statements such as `printf` -

#include <stdio.h> #include <conio.h> void main() { char far *v = (char far*)0xb8000000; clrscr(); *v = 'w'; v += 2; *v = 'e'; getch(); } output is: we i don't how output getting printed without printf or other print statements. this x86 real-mode ibm pc program assumes cga/ega/vga compatible graphics adapter in color text mode mapped @ default memory location (b800:0000); era of ms-dos (1980s/1990s). in case it's old school! char far *v=(char far*)0xb8000000; memory address (in real mode) of video buffer (use 0xb0000000 if have old hercules) clrscr(); clears screen *v='w'; writes @ row 0 , column 0 character w v+=2; skips 2 bytes (in character mode buffer interleaved: 1 byte character , 1 byte color. 1 bit flashing, 3 bits background 0-7 , 4 bits foreground 0-15 , packed in way: foreground + 16 * background + 128 if want flashing ) *v='e'; writes @ row 0 , column 1 chara

How do I upgrade my asp.net mvc2 project to asp.net mvc3 in Visual Studio 2010? -

i have started process of upgrading mvc projects 2 3 using guide: http://mattsieker.com/index.php/2010/11/21/converting-asp-net-mvc2-project-to-mvc3/ . so far, have removed old reference system.web.mvc. when looked system.web.mvc (version 3) wasn't listed. find version 2. i know have 3 installed. used web platform installer download , install mvc3. in vs2010 have option make mvc3 project. how add reference system.web.mvc v3? look? re-target web project .net 4.0 before being able see system.web.mvc, version 3.0.0.0 in references list.

ruby on rails - Scoping require class loading, etc -

i have file booking.rb in model directory. contains class definition class booking < activerecord::base def self.setup_connection wsdlurl = 'http://10.14.47.201:7001xxx/webservice/retrievebookingsbycclv1_01.wsdl' factory = soap::wsdldriverfactory.new(wsdlurl) @@driver = factory.create_rpc_driver @@driver.return_response_as_xml = true end end i attempt invoke method application.rb see code below. module pnr2 class application < rails::application ... ... booking.setup_connection end end this fails following when run app... c:/users/sg0209028/rubymineprojects/pnr2/config/application.rb:49:in `<class:application>': uninitialized constant pnr2::application::booking (nameerror) c:/users/sg0209028/rubymineprojects/pnr2/config/application.rb:18:in `<module:pnr2>' c:/users/sg0209028/rubymineprojects/pnr2/config/application.rb:17:in `<top (required)> the reason reference

linux - TAP::Harness perl tests tee output -

i running tests using tap::harness , when run tests command line on linux system test results on stdout run when try capture output file stdout using perl harness.pl | tee out.tap results buffered , displayed @ end, tried passing in file handle new results still buffered before being written file , there way not buffer output, have long running suite , @ results while tests running capture output. tap::harness version 3.22 , perl version 5.8.8 here sample code harness.pl #!/usr/bin/perl use strict; use warnings; use tap::harness; $|++; @tests = ('del.t',); $harness = tap::harness->new( { verbosity => 1, } ); $harness->runtests(@tests); and test del.t use test::more qw /no_plan/; $|++; $count =1; (1 ..20 ) { ok ( $count ++ == $_, "pass $_"); sleep 1 if ( $count % 5 == 0 ) ; } using script instead of tee want: script -c 'perl harness.pl' file found simple change make tee work well: specify formatter_class :

asp.net - F7 in Visual Studio 2010 - What is the opposite? -

when viewing aspx page in visual studio 2010 can hit f7 , opens codebehind. there input gesture can use bring me aspx frontend code? f7 goes , forth me. shift + f7 toggles between design , source views on aspx.

c# 4.0 - Specification Pattern using SQL without an ORM, with the repository pattern -

i have been looking specification pattern briefly described in martin fowler's patterns of enterprise architecture under repository pattern section, several examples on web. however, of examples/descriptions created utilizing orm , methods such issatisfiedby executed specification objects(and converted sql orm). i can see how might adapt work sql, due general lack of sql examples, wondering if people using pattern sql data access layer , repository pattern, , experience/approach if are, or alternatives may better suited task if there any. i believe linq implements need specification pattern (i believe ties request work sql). i suspect there apis spit out sql without linq parse trees. so, entity framework or linq sql worth looking into. i hope answers question.

jquery effect highlight not working in asp.net update panel -

i have 2 update panels follows (when linkbutton clicked i'm trying highlight div) <asp:updatepanel id="updatepanel1" runat="server"> <contenttemplate> <asp:linkbutton id="btnchange" runat="server" oncommand="linkbutton_command"/> <asp:linkbutton id="btnchange2" runat="server" oncommand="linkbutton_command"/> </contenttemplate> </asp:updatepanel> <asp:updatepanel id="updatepanel2" runat="server"> <contenttemplate> <div id="shdr">hello there!</div> </contenttemplate> </asp:updatepanel> i'm overriding onloadcomplete , registering script on page follows scriptmanager.registerclientscriptblock(me, me.gettype(), "divhigh", "$('#shdr').effect('highlight', {}, 3000);&

Making a Silverlight WCF SOAP service secured with UserNameOverTransport work over HTTP for network architecture -

i have silverlight 4 application uses wcf soap service. authentication/authorization happens per call (quasi restful). done using authenticationmode=usernameovertransport - means that username/password in each wcf call, protected ssl encryption of each message. great thing scheme can configure membership provider in web.config authentication, making flexible different installations. i have client set website on network scheme is: internet <= ssl traffic => external facing ssl enabled forwarding server <= unsecure http in internal network => server hosts application. assure me common architecture , believe them, not experienced internet application developer. i not sure application set on ssl enabled server (usernamewithtransport on ssl). in plain http not sure how username need provide user specific application data. wcf not provide "usernamewithnotransport" authenticationmode mean sending username/password in plain text, silly. right server side c

asp.net mvc - mvc script / content items 404 on page load -

when run mvc 2 application locally works fine, , request log looks this: get /scripts/jquery-1.4.1.min.js http/1.1 accept: */* referer: http://localhost.:2846/ accept-language: en-us ua-cpu: x86 accept-encoding: gzip, deflate user-agent: mozilla/4.0 (compatible; msie 7.0; windows nt 5.1; .net clr 1.1.4322; .net clr 2.0.50727; .net clr 3.0.4506.2152; .net clr 3.5.30729; .net4.0c; .net4.0e) connection: keep-alive host: localhost.:2846 after moving project remote test server of css , javascript files coming 404 get /scripts/jquery-1.4.1.min.js http/1.1 accept: */* referer: http://vnt2k3qa3/newemployee accept-language: en-us ua-cpu: x86 accept-encoding: gzip, deflate user-agent: mozilla/4.0 (compatible; msie 7.0; windows nt 5.1; .net clr 1.1.4322; .net clr 2.0.50727; .net clr 3.0.4506.2152; .net clr 3.5.30729; .net4.0c; .net4.0e) connection: keep-alive host: vnt2k3qa3 response http/1.1 404 not found content-length: 1635 content-type: text/html server: microsoft-iis/6.0 x-powe

iphone - In Objective-C, how do you declare/use a global variable? -

i have been researching problem long time, , can't seem find answer question. new iphone programming, sorry if stupid question. if has specific code post showing how can done, helpful. objective-c superset of c, c way: int globalx = 100; and header file: extern int globalx;

android - Passing a Resource to an Activity via an Intent -

i have been trying hours pass resource 1 activity via intent. here code 'source' activity: intent myintent = new intent(view.getcontext(), activity3.class); int res = r.raw.voicefile; myintent = myintent.putextra("soundfile", res); startactivityforresult(myintent, 0); as can see, have file called voicefile in raw folder , setting res equal , passing intent. (i assuming of type int) in receiving activity, have: intent sender=getintent(); int file=sender.getextras().getint("soundfile"); at point hoping file equal r.raw.voicefile in destination activity , use variable 'file' in mediaplayer call such: mediaplayer.create(getbasecontext(), file).start(); versus: mediaplayer.create(getbasecontext(), r.raw.voicefile).start(); my problem whenever click button source activity launches destination activity, force close. do experts see glaringly wrong code?

mysql - What is a better way to set up a database for an app? Normalized vs real world -

consider, please setup database backed application. ( in case db mysql , app in ruby ( rails 3), don't think matters question) let's have app warehouse. i have multiple items have categories , statuses. for example table has parts have few statuses such as: in stock, discontinued, backordered , multiple categories, such as: hardware, automotive, medical, etc. also have other tables need statuses , categories, such vendor: approved, out of business, new order: open, processes, shipped, canceled. etc. here question: i think if wanted normalize db - have table called categories, categories_types, statuses, statuses_types. then store categories in table, , category of type, such categories of parts, have foreign key category_type - parts, , on. same types. this normalized way. however see people create separate tables specific categories, example, there table called part_categories, vendor_categories, order_statuses, part_status. less normalized db, guess wh

java - How to get a range of characters? (alphabet) -

i have been working on hours , im kinda stuck....please me. im complete programming handicap. methods work fine except alphabet one. it receive 2 characters (either upper or lower case) , return string composed of range of char values given. maintain same case (upper or lower) passed in method. if upper case , lower case char (one of each) passed method, convert upper case char lower case , use lower case range. note, range inclusive of starting char , exclusive of ending char. also, observe if starting (first) char given greater ending (second) char, example 'm' , 'h', method return empty string since there no chars in range. can give me on how can above on alphabet method? import java.util.*; class characteroperations { public static void run() { int number=1; scanner scanner = new scanner(system.in); while(number > 0) { system.out.println("(1) insert 1 change letter lower case value upper case value"); system.out.println("(2) insert 2 ch

size - How to check an Android device is HDPI screen or MDPI screen? -

i want check fetch different images internet. how that? density = getresources().getdisplaymetrics().density; // return 0.75 if it's ldpi // return 1.0 if it's mdpi // return 1.5 if it's hdpi // return 2.0 if it's xhdpi // return 3.0 if it's xxhdpi // return 4.0 if it's xxxhdpi

c# - A few questions regarding web based c#programming with visual studio 2010 and mysql -

i'm making web based inventory database connected mysql, , have purchase order(po) page incoming stocks, delivery receipt(dr) page outgoing stocks , stock list page. in po page grid view of po table connected mysql edit , delete enabled , edit linked separate page. same goes dr page. stock page has grid view of stock table connected mysql edit enabled. i have separate add new page , edit page po , dr. both add , edit pages have details view in them. here questions. 1. how automatically insert records inserted in add page using details view both po , dr stock table. stock table looks this: stock_id | date | po_id | dr_id | product_id | stock_in | stock_out | stock_balance | what want happen when enter either new dr or po, it'll go stock table automatically respective tables , stock balance adjust automatically. 2. in details view of add new po, edited details view when choose supplier , product choose drop down list connected respective table, how limit product user can

windows vista - "COM Surrogate stopped working" error -

how can fix error "com surrogate stopped working" in windows vista business? right click computer, select properties - select advanced system settings left side pane - in performance box, click settings - click data execution prevention tab. check "turn on dep programs , services except select" option - click "add". a navigation box opens, navigate c:\windows\system32\dllhost.exe , click add , hit ok. this should add "com surrogate", checked box, list area, ok out, reboot , you're done. com surrogate errors should disappear taken here

exception handling - How can I find out the result of sending a MadExcept bug report from a Delphi app -

i can't find way of determining whether possible send bug report d2006 app. if madexcept can make sort of return code available can maybe provide guidance user might wrong. the problem madexcept can't reasonably determine that. there's whole chain of things can go wrong after madexcept sends email. exception if madexcept can't build report or there's immediate problem sending email. email client comes message, user doesn't hit send email client broken or misconfigured smtp host broken, down or missing your client on rbl subscribe (perhaps unknowingly) your client's domain on rbl or otherwise blocked your mail system hiccups , lose email the best can madexcept "no exception thrown, sending might have gone ok".

Config file parser in Fortran -

i able use simple configuration file pass parameters program. configuration file consist of list of arguments values can of different types (integer, real, logical, list of words, etc.). here example of configuration able parse in simple way: ! first comment param1 = 1234; param2 = true; ! second comment param3 = abc def ghi jkl mno pqr stu vwx yz; ! type of instruction, ! i.e. specify var1-var3 depend on var4-var10: var1 var2 var3 ~ var4 var5 var6 var7 var8 var9 var10; line breaks allowed, , different types of instructions passed program. i aware namelist somehow allow (except last part of config file in example), not appear flexible enough needs. instance, don't think allows insert comments in configuration file. i found many libraries in c , c++ offering such configuration file parser, quite surprisingly, nothing in fortran. know of such library? thanks in advance help! we have library called aotus,