Posts

Showing posts from April, 2012

Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

c++ - Which function to call? (delegate to a sister class) -

i read in c++ faq lite [25.10] mean "delegate sister class" via virtual inheritance? class base { public: virtual void foo() = 0; virtual void bar() = 0; }; class der1 : public virtual base { public: virtual void foo(); }; void der1::foo() { bar(); } class der2 : public virtual base { public: virtual void bar(); }; class join : public der1, public der2 { public: ... }; int main() { join* p1 = new join(); der1* p2 = p1; base* p3 = p1; p1->foo(); p2->foo(); p3->foo(); } "believe or not, when der1::foo() calls this->bar(), ends calling der2::bar(). yes, that's right: class der1 knows nothing supply override of virtual function invoked der1::foo(). "cross delegation" can powerful technique customizing behavior of polymorphic classes. " my question is: what happening behind scene. if add der3 (virtual inherited base), happen? (i dont have compiler here, couldn't test ri

Rails gem/plugin that gives suggestions how to optimize your DB queries -

some time ago saw in screencast showing gem or plugin, able suggest how optimize rails db queries, use include or add index , on... can't remember screencast was, maybe knows talking about, mean gem/plugin. actually have found on screencast , , called bullet

scroll - Doing the opposite of CSS Sticky Footer -

i'm trying reverse situation of stickyfooter: footer should visible (it overlap content), should stick page content when browser height exceeds content (content fixed height). basically, want behave position:fixed when browser height smaller content. i have tried through css way stickyfooter (using max-height instead of min-height), but... my problem: when browser smaller content, footer sticks bottom initially, doesn't keep sticking bottom scroll. as shown here i'm guessing there javascript involved keep stuck bottom, haven't found script (and don't know how write 1 myself...) any help, suggestions, links appreciated! thanks. html, body { height: 100%; font-family: helvetica, arial; font-size: 8pt; } #wrapper { margin: 0 auto; width: 800px; position:relative; height:100%; max-height: 516px; } #content { width:800px; height:400px; position: absolute; background: #999; border: 4px solid #000; } #footer {

PHP Search engine friendly urls and caching -

i'm considering ways develop site, planning 100-10.000 visitors daily. (fingers crossed). i used prado framework "backend" (admin access), i'm not sure how prado work on visitors frontent. have godaddy hosting , not sure if things work fast enough not lower google rating result of slow site loading. ( if guys think differently, please feel free so ). however, if i'm not going use prado (and i'm lazy learn framework project alone , don't have time right now), i'm having problem sef urls , page caching. i searched around tutorials on subject, noticed of them old. so, guys propose up-to-date tutorials, or verify old tutorials tutorials :) thx if lazy learn different framework how can learn use "sef urls , page caching" without being able integrate them properly? also shouldn't worried google ranking slow-loading website, should worried how slow-loading website impact user experience (which result in drop of traffic).

java - Using "Simple" XML Serialization to load data from res/raw on Android -

i new java , android development, please keep in mind. goal deserialize data xml files packaged application. i'm attempting using simple 2.4 "unhandled exception type exception" error in code when using .read or .write my code looks this: import java.io.inputstream; import android.app.activity; import android.os.bundle; import android.view.view; import org.simpleframework.xml.serializer; import org.simpleframework.xml.core.persister; public class ftroster extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); //load in available ship files here } public void myclickhandler(view view) { inputstream istream = getresources().openrawresource(r.raw.ship); serializer serializer = new persister(); shipsystem newsystem = serializer.read(shipsystem.class, istream);

gcc - How to set the dynamic linker path for a shared library? -

i want compile shared library .interp segment. #include <stdio.h> int foo(int argc, char** argv) { printf("hello, world!\n"); return 0; } i'm using following commands. gcc -c -o test.o test.c ld --dynamic-linker=blah -shared -o test.so test.o i end without interp segment, if never passed --dynamic-linker=blah option. check readelf -l test.so . when building executable, linker processes option correctly , puts interp segment in program header. how make work shared libraries too? ld doesn't include .interp section if -shared used, @michaeldillon said. can provide section yourself. const char interp_section[] __attribute__((section(".interp"))) = "/path/to/dynamic/linker"; the line above save string "/path/to/dynamic/linker" in .interp section using gcc attributes . if you're trying build shared object that's executable itself, check this question out. has more comprehensive descriptio

ASP.NET MVC 2 How to check the user's permissions before action is executed? -

i have controller, , invoke actions user has have privilages that. question how check before action executed? if user doesn't have permissions want render view error message. tried use overriden onactionexecuting method, can't return view method i tried use overriden onactionexecuting method, can't return view method as matter of fact can: public override void onactionexecuting(actionexecutingcontext filtercontext) { bool userhaspermissions = checkuserpermissionsfromsomewhere(filtercontext); if (!userhaspermissions) { filtercontext.result = new viewresult { // can specify master page , view model viewname = "forbidden" }; } else { base.onactionexecuting(filtercontext); } }

.net - Possible bug in Html.DropDownList, selected values not reflecting? -

Image
i know has been asked few times before, existing solutions hacks rather proper pattern. i have simple drop down list. trying populate data , have item pre selected. succeeding @ 'populate data part' failing preferred item pre-selected. i using asp.net mvc 3 rc2. the important code bits: { // bunch of code categoryoptions = new selectlist(categories, "id", "slug", article.category.id); } now... categoryoptions being passed html helper so: @html.dropdownlistfor(a => a.category, model.categoryoptions) i have looked @ values being passed helper , have confirmed 1 of items has selected value set true: however, not reflecting in html being generated helper. none of ... tags have selected="selected" attribute. i used reflector examine code bit, , line (selectextensions.selectinternal) looks dicey: item.selected = (item.value != null) ? set.contains(item.value) : set.contains(item.text); am doing wrong here? or framew

In perl, what is the difference between $DB::single = 1 and 2? -

what difference between putting $db::single=1 , $db::single=2 in code? both seem have identical effect of halting execution @ statement following assignment when 'c' on perl debugger command line. perldebug says value of 1 equivalent having pressed 's' next statement, , 2 same 'n', difference make how got statement? from perldebug : if set $db::single 2 , it's equivalent having typed n command (which executes on subroutine calls), whereas value of 1 means s command (which enters subroutine calls). that know already. from user point of view, i'm pretty sure there no difference. base on examination of actual db.pm source code . let's follow logically. may want refer source code. i've simplified of code remove unnecessary detail should able idea descriptions. when executing code in debugger, there (at least) 2 important variables, running , single . combination of these decides whether code run: running single

javascript - JS/jQuery/PHP: trying to generate an URL using PHP variables -

i'm generating code $.ajax({ url: '/orders/modify/action/', type: "post", datatype: 'json', data: 'id='+10+ '&commento='+$('#shop_order_status_history_comments').val()+ '&id_status='+$('#shop_order_status_history_orders_status_id').val()+ '&notify_client='+$('#shop_order_status_history_notify_client').val()+ '&local_part_email='+j.garpe+ // error goes here '&domain_email='+domain.com, success:function(data){ but i'm getting error: "uncaught referenceerror: j not defined". the code this: ... '&local_part_email='+<?php echo $local_part_email?>+ ... any help? regards javi it needs in quotes, this: '&local_part_email=<?php echo $local_part_email?>'+ ...

android - AsyncTask: where does the return value of doInBackground() go? -

when calling asynctask<integer,integer,boolean> , return value of: protected boolean doinbackground(integer... params) ? usually start asynctask new asynctaskclassname().execute(param1,param2......); doesn't appear return value. where can return value of doinbackground() found? the value available in onpostexecute may want override in order work result. here example code snippet google's docs: private class downloadfilestask extends asynctask<url, integer, long> { protected long doinbackground(url... urls) { int count = urls.length; long totalsize = 0; (int = 0; < count; i++) { totalsize += downloader.downloadfile(urls[i]); publishprogress((int) ((i / (float) count) * 100)); } return totalsize; } protected void onprogressupdate(integer... progress) { setprogresspercent(progress[0]); } protected void onpostexecute(long

asp.net - Reports on .Net and SQL Server -

my client wants report bars/charts analysis data. so how give him type of reports iam using .net 1.1 , sql server 2008.. is requirement possible bi, .net1.1? or there other solution type of requirement? please send ur suggestions. why not use sql server reporting services? although depend on version of sql server client has.

asp.net - Refactoring session variables -

i'm visiting app that's been in use past 2+ years , in desperate need of refactoring. of own work, know it's when visit old code again. anyway i've been using excellent advice @ sourcemaking refactor , code looking better. the problem there loads of session["variable"] sprinkled throughout code, what's accepted way refactor these out? found this article @ code project apparently can quite dangerous. the best way refactor random session usage create static sessionwrapper static properties encapsulate asp.net session store: static class sessionwrapper { public static string variable { { return session["variable"]; } set { session["variable"] = value; } } } this allow put logic around getting , setting of these values , keep them in centralized place. i recommend have integration tests in place before start process can sure haven't missed anything.

IOException when Uploading Videos to YouTube via Java API -

i have been attempting upload videos youtube via javaapi using direct uploading. have been having problem when call insert() method, ioexception error message "error writing request body server" i have verified file object creating correct details in videoentry object. have been using fiddler monitor activity machine , no request made upload api problem not there. here summary of code using: videoentry newvideo = new videoentry(); //defined video properties such title , description here. mediafilesource ms = new mediafilesource(videofile, "video/flv"); newvideo.setmediasource(ms); videoentry createdentry = settings.insert(new url(apiurl), newvideo); the ioexception thrown on insert call (settings youtubeservice instance) , api url appears correct. prior have succeeded in uploading video using c# api know video file valid. --update apiurl value: http://uploads.gdata.youtube.com/feeds/api/users/default/uploads make videofile points correc

memcached - Memcache(d) vs. Varnish for speeding up 3 tier web architecture -

i'm trying speed benchmark (3 tier web architecture), , have general questions related memcache(d) , varnish. what difference? seems me varnish behind web server, caching web pages , doesn't require change in code, configuration. on other side, memcached general purpose caching system , used cache result database , require change in get method (first cache lookup). can use both? varnish in front web server , memcached database caching? what better option? (scenario 1 - write, scenario 2 - read, scenario 3 - read , write similar) varnish in front of webserver; works reverse http proxy caches. you can use both. mostly write -- varnish need have affected pages purged. result in overhead , little benefit modified pages. mostly read -- varnish cover of it. similar read & write -- varnish serve lot of pages you, memcache provide info pages have mixture of known , new data allowing generate pages faster. an example apply stackoverflow.com: addin

compact framework - C#: how to use Microsoft.Win32.SafeHandles -

why using microsoft.win32.safehandles cause c# compiler error: the type or namespace name 'safehandles' not exist in namespace 'microsoft.win32' this code lifted http://zachsaw.blogspot.com/2010/07/serialport-ioexception-workaround-in-c.html the problem you're trying use sample code written normal .net framework in compact framework project. class not supported cf.

asp.net mvc - How to integrate Azure ACS with local (custom) STS? -

what best practice integrate azure acs local custom authentication in asp.net mvc application running on azure? requirement web application must have custom authentication , must support main identity provides. i think best approach use azure acs (to nicely support main identity provides) , since acs in based on wif (identity foundation) nicely fit local sts. what recommendations approach? have better suggestions? maybe have examples how integrate acs local sts? do thinking wrong , entities (acs , local sts) separated? , not have aware of each other? make sense me. i new azure acs in wif. the short answer yes, possible. "local sts" part 1 might or might not necessary. if wanted keep own authentication, don;t need own sts so. start simplest thing possible: mvc app relying on sts (e.g. first local one, acs, maybe both). there're many examples here .

javascript - How to prevent from downloading and running script? -

i wonder if possible in javascript prevent <script src="unwantedscript.js" type="text/javascript"></script> object running? i need make never existed. there event can prevent executing script (based on src argument)? i'm targeting internet explorer 8 solution other browsers welcomed (though won't me in ;)). and please no jquery or other libraries. i'm writing in c++ ie add-on can use interfaces mshtml 'use' javascript. in ie (mshtml) it's simple. 404 http request unwantedscript.js .

c# - Hooking in .Net -

i want hook function in .net there way it? don’t mean windows hooking, want hook clr function when dataadapter.fill called thanks, this not possible in general. diagnostics purposes, can use moles , wouldn't recommend production use, in specific cases, can make inherited class overrides virtual function.

asp.net - Multiple paths in location element of web.config -

how can specify multiple paths in 1 location element in web.config? <location path="images"> <system.web> <authorization> <allow users="?" /> </authorization> </system.web> </location> we add styles , images location, e.g. <location path="images, styles"> . is possible put multiple paths in location element (and how that)? you cannot unless share same root folder. i've been known dump images/styles/javascript single folder "_res" or "_system" , authorize folder more info on location element: http://msdn.microsoft.com/en-us/library/b6x6shw7(v=vs.71).aspx on path attribute: specifies resource contained configuration settings apply to. using location missing path attribute applies configuration settings current directory , child directories. if location used no path attribute , allowoverride false, configuration settings can

oracle - Showing only actual column data in SQL*Plus -

i'm spooling out delimited text files sql*plus, every column printed full size per definition, rather data in row. for instance, column defined 10 characters, row value of "test", printing out "test " instead of "test". can confirm selecting column along value of length function. prints "test |4". it kind of defeats purpose of delimiter if forces me fixed-width. there set option fix this, or other way make print actual column data. i don't want add trim every column, because if value stored spaces want able keep them. thanks i have seen many sql*plus script, create text files this: select || ';' || b || ';' || c || ';' || d t ... it's strong indication me can't switch variable length output set command. instead of ';' can of course use other delimiter. , it's query escape characters confused delimiter or line feed.

performance - Javascript and website loading time optimization -

i know best practice including javascript having code in separate .js file , allowing browsers cache file. but when begin use many jquery plugins have own .js , , our functions depend on them, wouldn't better load dynamically js function , required .js current page? wouldn't faster, in page, if need 1 function load dynamically embedding in html script tag instead of loading whole js js plugins? in other words, aren't there cases in there better practices keeping our whole javascript code in separate .js ? it seem @ first glance idea, in fact make matters worse. example, if 1 page needs plugins 1, 2 , 3, file build server side plugins in it. now, browser goes page needs plugins 2 , 4. cause file built, new file different first one, contain code plugin 2 same code ends getting downloaded twice, bypassing version browser has. you best off leaving caching browser, rather trying second-guess it. however, there options improve things. top of list us

c# - how to refresh bindings in textBox? -

how can refresh bindings mean run property of field bound text manually :/ cant find solution. textbox bound bindingsource. want refresh bindingsource manually bindingsource.resetcurrentitem(); causes control bound bindingsource reread selected item , refresh displayed value. bindingsource.resetbindings(); causes control bound bindingsource reread items in list , refresh displayed values.

vba - ADO Text Driver Trimming Leading Space -

i'm using adodb microsoft text driver parse text file in excel. the problem lines of file have leading space, , leading space getting chopped. when getstring(,1) on recordset, line like: " description not use" gets trimmed to: "description not use" ...this problematic because i'm parsing cisco config file, , leading space useful in figuring out if i'm still in same object or not. for example text like: object-group network abc_group network-object host 192.10.24.71 network-object host 192.10.24.72 network-object host 192.10.24.20 network-object host 192.10.24.21 object-group network xyz_hosts network-object host 192.10.24.55 network-object host 192.10.24.26 ...i using leading space tell me still in same object-group. any ideas on how adodb keep leading space when reads text file? i tried using filestreamobject, discovered file reading had lines ending in chr(13) , ending in both chr(13) , chr(10), throwing off readline metho

Git workflow for small web team -

i know there many questions here on topic, i've had trouble finding need. we're small team of developers using svn making switch git. used checking in changes , pushing live website throughout day lack formal testing procedures, we'd add. way i'm used doing svn is: develop in personal test environment check in changes send current repository files global (production-like) testing webserver, , test send current repository files live webservers this can create problems, if communication not good. i've experienced times when untested changes have gone live , that's we'd avoid. what i'm envisioning master git repository holds tested code running on live servers. have clone of repository used test revisions. i'd have script responsible pulling changes requesting developer, putting them in branch on test repository, , running automated tests make sure nothing major broken. when checks out, branch can merged , pushed master , out liv

flex - Visualization: Oscillations of Spring- FLASH -

i want visualize spring oscillations , hence need create visual of spring- stretching , vibrations. working in flash need demo oscilations based on user input. typically, springs represented pencil sketch below, , wanted check if more 3d , natural can built without complexity(e.g stretch/ compression shows on color of spring body etc). again , guidance/ pointers. http://www.flashkit.com/movies/scripting/physics/damped_o-achyut_v-877 0/index.php

How to set background color in MAC OSX in Objective c -

i new mac osx implementation. can guys please suggest documentations how grip on menus,background colors, text fields , uielements programatically out using interface builder. thanking you, s. here! http://developer.apple.com/library/mac/#documentation/cocoa/reference/applicationkit/classes/nstextfield_class/reference/reference.html check setbackground:(nscolor *)color method mucking around colours lots of fun, read apple human interface guidelines before publishing app coloured textfields...

c# - WebException Could not establish trust relationship for the SSL/TLS secure channel -

my company has developed .net web service , client dll uses web service. webservice hosted on our server on ssl , cert provided , signed godaddy. have clients in hosted environment getting following error message client dll when tries access our web service. system.net.webexception underlying connection closed: not establish trust relationship ssl/tls secure channel. our fix has been have them open ie on server, challenge in , of lot of hosted services, , go wsdl url. ie prompts them security alert dialog. says cert date valid , valid name matching name of page, issued company have not chosen trust. when click yes proceed, client dll can succesfully connect web service , operate normal. does have idea why godaddy not have been in there valid publishers list? of servers have running has godaddy valid authority. i'm guessing, security reasons, they've uninstalled authority godaddy, not totally convinced there's not other underlying issue. unfortunately, haven'

In HTML5, is it better to use <section> and <h1> instead of <h2>–<h6>? -

in studying on html5's new section tag, i'm wondering handling of h1, h2, h3, h4, h5, , h6 tags... the html5 specification says "[h1, h2, etc.] elements represent headings their sections " ( http://www.w3.org/tr/html5/sections.html#the-h1-h2-h3-h4-h5-and-h6-elements ). further in spec's "4.4.11 headings , sections" section, there 3 examples of structuring document apples. if follow first specification, states heading elements "should represent headings sections," seems third apple example most correct structure (i.e., using h1 tags heading in each section , subsection). using logic seems h2, h3, h4, h5, , h6 tags used rarely, if @ all. this i'm wondering: should h2, h3, h4, h5, or h6 tags used if, in reality, marking subsections? not make more sense use section tags separate sections, each own header, rather relying on h2, h3, etc. start implicit sections? (the "headers , sections" section talks sections implied using h

python - check if a number is present in a list, app engine templates -

i trying generate board (10x10) using app engine templates , html table. means putting break after 10 iterations of loop. how can acieve using app engine's inbuilt template engine (django 0.96)? update lukes answer solved problem of automatically inserting break. still need find way check each number if present in list , give specific class. there way achieve this: {% number in list } <td {% if number in another_list %}class="special"{% endif %}>{{number}}</td> {% endfor } at point might better off writing own templatetag, or using smartif , should let {% if foo in bar %} .

exception - C++ -- Difference between "throw new BadConversion("xxx")" and "throw BadConversion("xxx")" -

// http://www.parashift.com/c++-faq-lite/misc-technical-issues.html class badconversion : public std::runtime_error { public: badconversion(std::string const& s) : std::runtime_error(s) { } }; inline std::string stringify(double x) { std::ostringstream o; if (!(o << x)) throw badconversion("stringify(double)"); // throw new badconversion("stringify(double)"); return o.str(); } [q1] when throw exception in function, difference between throw new classname() , throw classname()? [q2] 1 better? thank you [a1] throw new , you'll have catch pointer. language doesn't specify in case responsible deallocation, you'll have establish own convention (typically you'd make catcher responsible). without new , you'll want catch reference. [a2] if you're in framework commonly throws pointers, may want follow suit. else, throw without new . see c++ faq, item 17.14 .

file - Detect empty directory with Perl -

what easy way test if folder empty in perl? -s, , -z not working. example: #ensure apps directory exists on test pc. if ( ! -s $gappsdir ) { die "\n$gappsdir not accessible or not exist.\n"; } #ensure apps directory exists on test pc. if ( ! -z $gappsdir ) { die "\n$gappsdir not accessible or not exist.\n"; } these above, not work tell me folder empty. thanks! thanks all! ended using: sub is_folder_empty { $dirname = shift; opendir(my $dh, $dirname) or die "not directory"; return scalar(grep { $_ ne "." && $_ ne ".." } readdir($dh)) == 0; } a little verbose clarity, but: sub is_folder_empty { $dirname = shift; opendir(my $dh, $dirname) or die "not directory"; return scalar(grep { $_ ne "." && $_ ne ".." } readdir($dh)) == 0; } then can do: if (is_folder_empty($your_dir)) { .... }

c# - Elegant way to combine multiple collections of elements? -

say have arbitrary number of collections, each containing objects of same type (for example, list<int> foo , list<int> bar ). if these collections in collection (e.g., of type list<list<int>> , use selectmany combine them 1 collection. however, if these collections not in same collection, it's impression i'd have write method this: public static ienumerable<t> combine<t>(params icollection<t>[] tocombine) { return tocombine.selectmany(x => x); } which i'd call this: var combined = combine(foo, bar); is there clean, elegant way combine (any number of) collections without having write utility method combine above? seems simple enough there should way in linq, perhaps not. i think might looking linq's .concat() ? var combined = foo.concat(bar).concat(foobar).concat(...); alternatively, .union() remove duplicate elements.

c++11 - External memory management and COM -

having trouble memory management of third party library. have source it's complex (com stuff), full of macros , annoying microsoft annotations, etc, , interacts library source of don't have boot. quick debug runtimes have shown it's leaking memory , in pretty big way. make extensive use of self-releasing pointers unique_ptr , know released created. option try , clean (and understand) source? in addition, safe allocate com objects operator new, or have go in com heap? com quite agnostic how allocate own com objects. created class factory , iunknown::addref , release methods keep reference count. using operator new in class factory , delete this in release fine. you have careful pointers return in interface methods. typical automation objects bstr , safearray indeed need allocated in com heap client code can release them. pretty hard mess up, api work. the client code can responsible leak, fumbling reference count pretty standard com bug. easy diagnos

python - Pyparsing: How can I parse data and then edit a specific value in a .txt file? -

my data located in .txt file (no, can't change different format) , looks this: varaiablename = value = thisvalue youget = the_idea here code far (taken examples in pyparsing): from pyparsing import word, alphas, alphanums, literal, restofline, oneormore, \ empty, suppress, replacewith input = open("text.txt", "r") src = input.read() # simple grammar match #define's ident = word(alphas + alphanums + "_") macrodef = ident.setresultsname("name") + "= " + ident.setresultsname("value") + literal("#") + restofline.setresultsname("desc") t,s,e in macrodef.scanstring(src): print t.name,"=", t.value so how can tell script edit specific value specific variable? example: want change value of variablename, value new_value. variable = (the data want edit). i should make clear don't want go directly file , change value changing value new_value want parse data, find variable

windows phone 7 - Panorama control truncating long titles -

i'm trying create simple windows phone 7 app in 1 of pages uses panorama control . control has 5 panoramaitem children. using code below, title truncated on fourth screen in middle of word "anyone." how can make panorama control display full title? <controls:panorama title="this longest title has ever seen" > i expect limited 1024px in width. (the same background image width.) this constraint fine within intended use of panorama header/title. ui design , interaction guide: it meant let user identify application and use same panorama title launch tile in start consistency. due space restrictions on start tile , application list guideline of 13 characters suggested avoid text clipping. fit on panorama header.

jQuery templates - Load another template within a template (composite) -

i'm following post dave ward (http://encosia.com/2010/12/02/jquery-templates-composite-rendering-and-remote-loading/) load composite templates blog, have total of 3 small templates (all in 1 file) blog post. in template file, have these 3 templates: blogtemplate , render " posttemplate " inside "posttemplate", render template displays comments, called " commentstemplate " the " commentstemplate " here's structure of json data: blog title content posteddate comments (a collection of comments) commentcontents commentedby commenteddate for now, able render post content using code below: javascript $(document).ready(function () { $.get('/getpost', function (data) { $.get('/content/templates/_postwithcomments.tmpl.htm', function (templates) { $('body').append(templates); $('#blogtemplate').tmpl(data).appendto('#bl

javascript - Uncaught TypeError: Object function () -

i wrote following functions. @ run time browser complains uncaught typeerror ...has no method 'init'. what's wrong of code? function build_results_grid (response) { // build grid grid_ui.init(); } // build results grid var grid_ui = function () { return { init: function () { //build_grid(); } }; // return } you assigned grid_ui function, without calling it. change var grid_ui = (function() { ... })();

iphone - Libarchive to extract to a specified folder? -

anybody can show examples of using libarchive extract zip files specified folder? looks sample programs provided ( untar.c , tarfilter.c , minitar ) extracts archive current working directory. there way "extract folder , below" libarchive , not clobber program's active folder? one of main drivers extraction code run in background thread, , changing program working directory may create problems. used in ios application (iphone, ipad), picky on folders application can write to. thanks in advance. you can rewrite each archive_entry's pathname before calling archive_read_extract. example: const char* path = archive_entry_pathname( entry ); char newpath[path_max + 1]; snprintf( newpath, path_max, "/someotherdirectory/%s", path ); archive_entry_set_pathname( entry, newpath );

php - A good web hosting service that allows more then 1GB MySQL databases -

i looking mysql , php hosting service allows more 1gb mysql databases cheap price , great service. can 1 give suggestions go vps. don't limit on mysql. can have database large assigned disk space. following awesome , cheap vps providers: virpus vpslatch try finding coupon codes , save around 30% in holiday season :). both accept paypal.

c++ - Where is string::size_type documented? -

i searching web how manipulate (tokenize) strings, , started find many references string::size_type, didn't understand @ @ first... have searched more , found many places concept explained, including useful questions/answers here @ so: https://stackoverflow.com/questions/tagged/size-type the question is: documented? found q&a , forum posts. usual c++ std library documentation web site didn't mention it: http://www.cplusplus.com/reference/string/string/ so: string::size_type documented? i guess answer can two-fold: 1- actual c++ standard ultimate documentation. may quote it. can find online? (i searched didn't find it). 2- actual standard document bit difficult read , understand newbie me. know of web site cplusplus.com std api documented example code? well place start c++ tag: https://stackoverflow.com/tags/c%2b%2b/info which leads too: find current c or c++ standard documents? where find current c or c++ standard documents? which lead

gwt intellij 10 plugin does not generate javascript output -

with intellij 10, can create module gwt sample application (mysampleapplication.gwt.xml), using built-in gwt plugin. runs fine in hosted mode , can step through java code. but, don't see build options have generate actual output javascript files generated gwt compiler (which of course point of gwt). do have fiddle ant or maven files myself? presumably there must way intellij gwt plugin make gwt compiler run. gwt compiler invoked when build artifact containing gwt compiler output element. such artifact added automatically idea new projects created via wizard. to build such artifact use build | build 'artifact name' artifact . note can configure idea build artifacts on build | make automatically, it's not recommended gwt invoke gwt compiler , take considerable time on every make .

ios4 - Retweet using Oauth+MGTwitterEngine ...not getting update response -

i had done retweet using oath library,but there problem twitter database.... what thing sucks after retweet database ..i.e in response never gets update,although tweet count gets increment not status . for example response in json after retweet is: { contributors = ""; coordinates = ""; "created_at" = "mon dec 20 19:57:11 +0000 2010"; favorited = false; geo = ""; id = 16945227428265984; "in_reply_to_screen_name" = ""; "in_reply_to_status_id" = ""; "in_reply_to_user_id" = ""; place = ""; "retweet_count" = 7; retweeted = false;------------------------------------>>>>>>problem sucks here after retweet no change in status "retweeted_status" = "\n "; source = web; "source_api_request_

flex - the efficient and accurate way of parsing a web html to text field with formating? -

i want parse web html flex text field have 3 approaches in mind soo to use string function splice etc. replace tags 1 text fields can understand complex , processing on head there reduces efficiency have max control changes needed. parsing html xml , use text input text field efficiency , control need know question. regular expressions . which 1 suitable in paring web text. help required regards. i'd suggest change approach. if need simple html displayed, can directly parse flash/flex. in other cases, when have complex html page(s), should use iframe. that's simple , efficient approach , useful in case. here can find description: flex , iframe , flex iframe project site . good luck!

OpenFOAM, PETSc or other sparse matrix multiplication source code -

could tell me, can find source code matrix multiplication realized openfoam, petsc or similar? can't trivial algorithm. have found homepages of openfoam , petsc in doc cant find multiply methods , source code. petsc implements matrix multiplication many formats, @ part of matmult_seqaij basic implementation. sparse matrix stored in compressed sparse row form row starts ai , column indices aj , , entries aa , multiplication consists of following simple kernel. for (i=0; i<m; i++) { y[i] = 0; (j=ai[i]; j<ai[i+1]; j++) y[i] += aa[j] * x[aj[j]]; }

c# - Should I compress the data being exposed via wcf service? -

i'm creating wcf service exposes object graph expected grow in size while service , running. in playing test data (85k), smaller expected when live, hit default 65k message size limit. quick on net showed simple enough extend in config. as i'm creating service , client consumes it, wondered if there added value in compressing data before sent it. having run brief test, test data shrunk around 7k, looks aid in time message sent on wire , increase amount of data send. the service pre-prepares data before first call made , there no initial overhead on every call due compression. is idea sake of scalability, , trying optimise performance, or adding complexity not needed? by reading post, seems able implement compression quite easily. if control both sides, adding layer of compression/decompression not increase complexity general scenarios when gain lot of bandwidth benefit out of it. what minimize complexity implementing patterns interceptor or decorator

jsp - what will be the mime type for java application if I want to show both image and html content? -

in java web application need show image exits in database anchor tag moving jsp page. in jsp page mentioned response.setcontenttype("image/jpg;"); so while running jsp page shows image not show html below or anywhere. what want jsp page should show image html content @ single jsp page. please tell what mime type should use desire result. thank you, your problem twofold. first, send html-page contains img-tag appropriate reference source image. of course can surrounded a-tag. page should of text/html . secondly, return image. separate call server. call should of image/jpg .

silverlight - Create MS Excel Sheet -

how can create ms excel sheet , download moonlight/silverlight app? regards lennie basically want run report in siverlight client , allow user download ms excel report. i had previously, pretty time consuming can write xml file on client side. a place start create new excel sheet save xml file , can work out bits need change , work out way write correct information xml file. although said take fair bit of time!! edit- just found take at- http://www.rshelby.com/post/creating-excel-worksheet-from-silverlight.aspx

java - Launch an URL in Blackberry App -

how open, or launch, url blackberry application? not interested in doing through browser, such opera. think there java class called browsercontentmanager or similar, can't figure out how use it. check demo code browsercontentmanagerdemo.java blackberry jde installation sample folder: blackberry jde 4.5.0\samples\com\rim\samples\device\blackberry\browser\ or eclipse plugins folder: eclipse/plugins/net.rim.ejde.componentpack6.0.0_6.0.0.29/components/samples/com/rim/samples/device/browser/browsercontentmanagerdemo/

iphone - Cocoa Touch - Display an Activity Indicator while loading a UITabBar View -

i have uitabbar application 2 views load large amounts of data web in "viewwillappear" methods. want show progress bar or activity indicator while data being retrieved, make sure user knows app isn't frozen. i aware has been asked before. need clarification on seems rather good solution . i have implimented code in example. question's original asker later solved problem, putting retrieval of data "thread". understand concept of threads, not know how impliment this. with research, have found need move of heavy data retrieval background thread, of ui updating occurs in main thread. if 1 kind provide example me, appreciative. can provide parts of existing code necessary. if use nsurlconnection runs on thread automatically. in viewdidload: nsurlrequest *req = [nsurlrequest requestwithurl:theurl]; nsurlconnection *conn = [nsurlconnection connectionwithrequest:req delegate:self]; then need custom methods. if type in -connection , press

wcf security - WCF, DataPower integration - secure binding necessary? -

i have been developing wcf service using basic http binding. has been integrated datapower. want follow best practice enabling secure binding. necessary? referring slide 8 in datapower wcf integration : datapower designed off-load security wcf services. thank you. only security architects can tell if needed case. remember, whatever sending on wire unsecured when using basic http. within enterprise, maybe, isn't problem. sniffing trafic intercept messages , data within. at tellago, have done wcf-data power integration using custom federated security (almost identical geneva aka wif) our clients. but, odds are, if asking if need security, not using federated security.

asp.net - how to disabled each items in gridview according to the textbox text? -

Image
if booking closed column values equal or more textbox1 text book button in gridview disabled each gridview item booking closed time greater , equal textbox1 time .. how ? m using vs 2008 , vb you should handle issue in rowbound event handler of gridview. update #1 protected void books_rowdatabound(object sender, gridviewroweventargs e) { if(e.row.rowtype == datacontrolrowtype.datarow) { //do if textbox value .... button btn = (( gridview )sender).findcontrol("button"); btn.enabled = false; } } update #2 protected sub books_rowdatabound(sender object, e gridviewroweventargs) if e.row.rowtype = datacontrolrowtype.datarow 'do if textbox value .... dim btn button = directcast(sender, gridview).findcontrol("button") btn.enabled = false end if end sub

authentication - Grails acegi plugin remember me not working -

im having problems remember me functionality of grails acegi plugin (version 0.5.3) the first time login check remember me check box , login. works. shutdown browser , restart , browse app. login page presented user name populated, password empty , remember me check box checked. have expect navigate straight application (http://localhost:8080/application redirects landing page). if try , manually login (enter password) doesnt work, cant past login page. here login form: <form action='${posturl}' method='post' id='loginform' class='cssform'> <p> <label for='j_username'>email</label> <input type='text' class='text_' name='j_username' id='j_username' value='${request.remoteuser}' /> </p> <p> <label for='j_password'>password</label> <input

cocoa touch - ttf font not available for iPhone in interface builder or simulator -

i added font file (.ttf) xcode project, resources. also, added uiappfonts in info.plist. when want use font though, don't see choice in ib. after installing font on system, started seeing in ib, still - changing doesn't change - default system font displayed in interface builder in iphone emulator. are there steps more should able use own font? to use custom fonts ios have set them programmatically. for example, suppose have font file called swellfont.ttf add project. go app-info.plist file , add full name of file next index of array keyed uiappfonts, mention. <key>uiappfonts</key> <array> <string>swellfont.ttf</string> </array> then, use font: label.font = [uifont fontwithname:@"swellfont" size:12]; assuming label uilabel , swellfont.ttf not protected . it's important note uifont's fontwithname not referring filename, instead wanting actual name of font. if open font fontforge can see inf

apache - Not able to login in my phpmyadmin -

could not able loggin in phpmyadmin after writing single line of code @ top of index.php under phpmyadmin folder.but have deleted single line of code. giving me following error after providing credential--> #0 pma_sendheaderlocation(http://linux.mydomain.com/phpmyadmin/index.php?token=8515d1390fbb0db27bebe4abd0668791) called @ [/opt/lampp/phpmyadmin/libraries/auth/cookie.auth.lib.php:612] #1 pma_auth_set_user() called @ [/phpmyadmin/libraries/common.inc.php:828] #2 require_once(/phpmyadmin/libraries/common.inc.php) called @ [/phpmyadmin/index.php:35] please me. if have spaces in code @ start of file, php may interpret these mean put these onto browser. doing causes problems header() function needs first thing output browser work properly. make sure there no spaces before or after

CSS/javascript hover error in IE8 - fine in chrome etc -

i have strange error css/javascript hover script on ie versions. the culprit here: http://www.gardensandhomesdirect.co.uk underneath main banner , featured products area there 3 'buttons', christmas, garden , home have on-hover effects. in firefox/chrome etc working fine , hover goes on original area should do. in ie hover moves item on right? ive looked @ css , im not sure isnt working ie's point of view. any on appreciated :) under style .hover-panel add: left: 0;

email - ASP.NET MVC2 e-mail templates -

with web forms used generate e-mails loading ascx control , capturing it's output. what clean solution use asp.net mvc 2 default webforms view engine generate e-mail? here solution i'm using: http://msug.vn.ua/blogs/bobasoft/archive/2010/01/07/render-partialview-to-string-asp-net-mvc.aspx

ssh - Linux server, locating files containing nothing but 4 specific lines -

i'm dealing compromised website, in hackers injected htaccess instruction redirect traffic. can locate .htaccess files contain forwarding hack, in cases directory contained htaccess file, appended dangerous instructions, cannot deleted htaccess file or harm site letting formerly pw-protected directories wide open, or urlrewrite instructions (wordpress) deleted, etc. not find way locate files contain 4 lines of redirect hack, shed light ? far, using find . -type f -exec grep -q targetpiratedomain {} \; -exec echo rm {} \; thanks ! use 1 of .htaccess files template. issue following command: find . -type f -name .htaccess -exec cmp -s <template> {} \; -exec rm {} \; cmp compare file template file , if returns true, rm executed. might want test first echo or cat instead of rm . be sure rename or move template file before starting command, else template removed during process.

c++ - How to get text from unmanaged application to a c# application? -

i have 3rd party application, creates several windows of each has textbox text want. want use information within application, need obtain information (possible trigger commands later on pressing buttons) the 3rd party application un-managed c++. application c# (.net 4.0). i have seen can 'hooks' other application i'll honest lost of route take , how go it. some advice great. the easiest interop unmanaged c++ via c++/cli. if there's simple c wrapper p/invoke sufficient.

java - Creating Spring Framework task programmatically? -

i need create task on fly in app. how can that? can scheduler @autowired annotation, scheduler takes runnable objects. need give spring objects, tasks can use @autowired annotation too. @autowired private taskscheduler taskscheduler; you need wrap target object in runnable , , submit that: private target target; // spring bean of kind @autowired private taskscheduler taskscheduler; public void schedulesomething() { runnable task = new runnable() { public void run() { target.dothework(); } }; taskscheduler.schedulewithfixeddelay(task, delay); }

exchange server 2010 - How to configure catch-all in Exchange2010 hub-transport environment? -

this link explaining how in edge transport environment, indicating not relevant hub-transport. http://technet.microsoft.com/en-us/library/bb691132(exchg.80).aspx do know way done in hub-transport environment? you need use catchallagent on codeplex. written work exchange 2007 work 2010 well. the key trick install in transportroles directory per these links: http://catchallagent.codeplex.com/discussions/218519?projectname=catchallagent http://catchallagent.codeplex.com/discussions/62204?projectname=catchallagent 1) download zip 2) unzip "c:\program files\microsoft\exchange server\transportroles\agents\catchall" [or wherever transportroles\agents path is] 3) edit config.xml file in directory define domains handled 4) run exchange management shell end execute these commands: install-transportagent -name "catchall agent" -transportagentfactory:catchall.catchallfactory -assemblypath:"c:\program files\microsoft\exchange server\transp

xamarin.ios - Error importing wsdl into monodevelop -

i having issues importing wsdl mono develop. this wsdl , xsd implementation works flawlessly under visual studio, cannot imported mono develop. i have checked against several wsdl verification sites , pass. the process use create project , “add web reference”. select .net 2.0 type of wsdl. paste in link wsdl. , hit “jump to”. then error listed below. preventing me finishing evaluation of product, , can provide beneficial. the wsdl files located here: ftp.echelon.com/fae/na/outgoing/gdahl/wsdlissue/v4.0.zip wsdl file in question ilon100.wsdl. **system.xml.schema.xmlschemaexception: xmlschema error: target namespace required, include schema has own target namespace related schema item sourceuri:** http://216.254.101.36/wsdl/v4.0/ilon100.wsdl, line 31, position 4. @ system.xml.schema.validationhandler.raisevalidationevent (system.xml.schema.validationeventhandler handle, system.exception innerexception, system.string message, system.xml.schema.xmlschemaobject xsobj, sy

android - DatePicker Widget Format -

Image
i have defined xml layout datepicker widget follows: <datepicker android:id="@+id/selectdate" android:layout_margintop="10dp" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center|center_horizontal|center_vertical"> </datepicker> and being displayed in mm/dd/yyyy format, below: but how can display datepicker widget in (dd/mm/yyyy) format, below? the picker take date format chosen user, means don't have format it, user enjoyes see format he's used to. i've tested hellodatepicker tutorial , in phone, have date in (dd/mm/yyyy) format, picker shows same format; in emulator, i've put date in mm/dd/yyyy format, picker displays same. according this answer there no method set display format.

java - JTestcase for data in xml files with JUnit? -

i looked upon years old code uses jtestcase separating data test case(jtestcase helps manage data in xml files). jtestcase integrated junit test cases code. jar available jtestcase 2006 version guess there no new release same. makes me think jtestcase old thing use otherwise have provided new version. please tell me if there new technology in place of jtestcase , if not negatives of jtestcase(like 1 can performance considering fact allows use of xml files in trade off better organization of complex data). i couldn't find maven artifact jtestcase. please let me know if available on site. which site dependable source find maven artifact. see https://repository.sonatype.org/index.html#welcome same purpose. that seems lot of effort go write unit test. think negative of using jtestcase doubling amount of code have write. wouldn't use framework unless see significant benefit putting test data xml. think doing tests make harder maintain in cases!

python - lxml objectify does not call constructors for custom element classes -

lxml.objectify not seem call constructors custom element classes: from lxml import objectify, etree class customlookup(etree.customelementclasslookup): def lookup(self, node_type, document, namespace, name): lookupmap = { 'custom' : customelement } try: return lookupmap[name] except keyerror: return none class customelement(etree.elementbase): def __init__(self): print("made customelement") parser = objectify.makeparser() parser.set_element_class_lookup(customlookup()) root = objectify.parse(fname,parser).getroot() suppose file being parsed is <custom /> i print "made customelement", not. can make call constructor? how possible instance of customelement class created without constructor being called? >>> isinstance(root,customelement) true from lxml docs : element initialization there 1 thing know front. element classes must not have __i