Posts

Showing posts from June, 2010

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# - How to bind ObservableCollection<LineSeries> to Chart -

i have litle problem chart binding. possible have dynamic number of series wpf toolkit line chart? i found many examples how manualy. for example if have like: <chartingtoolkit:chart grid.columnspan="4" grid.row="3" horizontalalignment="stretch" verticalalignment="stretch" name="chart_distribution" title="chart title"> and model like: public class test : baseviewmodel { private readonly observablecollection<lineseries> _lineseries = new observablecollection<lineseries>(); public observablecollection<lineseries> lineseries { { return _lineseries; } } private void test() { var collection = new observablecollection<requestsinprocess>(); var collection2 = new observablecollection<requestsinprocess>(); collection.add(new requestsinprocess(0, 4)); collection.add(

objective c - Execute multiple statemens in a single STAssert… macro? -

i’d execute more 1 statement in stassertxx family of macros, possible? like: stasserttrue([foo dosomething] && [bardosomethingelse], @"should…"); the code above works methods return booleans, i’d similar void return types: stassertnothrow({ [foo dosomething]; [bar dosomethingelse]; }, @"should…"); of course, here preprocessor complains. since valid c code valid objective-c; can use , operator c single argument, long use in parenthesis. like this: nsassertnothrow(([foo dosomething], [bar dosomethingelse]), @"whatever"); the , operator lets composite several expressions single statement returning value of last expression. i advise strongly against using in stassert… statements since loose important information tests failed.

Hudson - different build targets for different triggers -

i have different build targets periodic builds , triggered polling scm. more specific: idea nightly builds should call 'mvn verify' includes integration tests, while normal build calls 'mvn test' executes unit tests. any ideas how can achieved using hudson? cheers chris you create 2 jobs - 1 scheduled , other polled. in scheduled can specify different maven goal polled.

Java classpath, jar file with no .jar extension in Weblogic over Unix -

if place file called liba.jar in classpath folder, , rename old 1 to: liba.jar.old will classloader load classes? i'm using weblogic on solaris 8. thank you! udo no. if you're using java 5 or earlier, must explicitly name classes , jar files loaded. obviously, since old one, liba.jar.old isn't named, won't loaded. it's bit of different story if you're using java 6, since concept of wildcard matching exists there. still, non jar files won't loaded. info taken official site . quote: class path entries can contain basename wildcard character *, considered equivalent specifying list of files in directory extension .jar or .jar. example, class path entry foo/* specifies jar files in directory named foo. a classpath entry consisting of * expands list of jar files in current directory. class path entry contains * not match class files. match both classes , jar files in single directory foo, use ei

java - JSF 2 : tag wrapper to encapsulate common attribute values? -

based on previous question how id of calling component in getter method? , here's idea want ask opinion : there lots of duplicated code across jsf pages such these examples (notice repeating size , maxlength attribute) across components : <h:inputtext label="#{msgs.userid}" id="userid" value="#{userbean.userid}" required="true" size="#{variableconfigbean.getsize(component.id)}" maxlength="#{variableconfigbean.getmaxlength(component.id)}" /> <h:inputsecret label="#{msgs.password}" id="password" value="#{userbean.password}" required="true" size="#{variableconfigbean.getsize(component.id)}" maxlength="#{variableconfigbean.getmaxlength(component.id)}" /> im thinking of : using composite component input text tag, hardcoding size , maxlength in implementation section of composite component, so dont have duplicate thes

serial port - RS232 communication problem in Java -

can found out in java if cable pluged in rs232 port on comp? work on application, have convertor usb rs232 on com6 port , need info if there cable pluged in or not. try open port "com6" @ regular interval, careful put inside try-catch. thanks:)

php - array: store multiple values per key -

i once trying adding 2 values same key, didn't work. overrode old value. isn't possible add more 1 value same key, , when retrieving key, linked list can iterate different values? not unless store array value. hashtables in php map key one value. value array, you have build array yourself. might consider creating class you.

Delphi Translating Strings -

i'm using delphi 2007 , wonder how following problem can solved: i have translate acomp.caption example, string want assign caption, depends on data (for example date or number, gets formatted ). therefore have save data , string in new variable every translation, annoying. what want that: // add string , data internal list of translator // , return dynamicstring, represents translated value acomp.caption := t.newtranslatedstring("hello %s, cheese?", user) (note acomp.caption ("hello %s..") can changed in different methods) when switching language, call t.translateagain() , value of strings translated and, if data given, formatted again. is possible or know way solving given problem? thanks in advance additional question: strings normal objects, can subclass , add dynamic behaviour changes string in special cases? delphi strings not objects, can't add behaviours them. need develop own class. the windows way localize applica

asp.net - display data differently in a datagrid -

i have following in data table , want display differently in second example below in datagrid. 1 know if there way this? userid questions answers 1 dog’s name belle 1 tell why should win. because need win 2 dog’s name leigh 2 tell why should win. i’ve never won before i'd result displayed below in grid view. userid question: dog’s name question: tell why should win. 1 answer: belle answer: because need win 2 answer: leigh answer: i’ve never won before this going: public class questionanswermap { public string question { get; set; } public string answer { get; set; } } class program { static void main(string[] args) { var list = new list<questionanswermap>();

c# - Linq - Is there are way to build up a linq statement from several snippets of linq -

i have several methods use similar linq statements different enough them in own methods. say, sake of arguemnt, had following linq snippet repeated across methods (the real snippets longer this): su.objid == serviceuserid cl.staffmemberid == staffmemberid if working in sql contatenate repeated sql follows: private string getrepeatedsql() { return "where su.objid = serviceuserid , cl.staffmemberid = staffmemberid"; } private void dosomething() { string mysql = "select * ...... lots of sql .." + getrepeatedsql() + ".. more sql"; } (usual health warnings around contatenating sql string noted). is there equivalent in linq? i'm sick of having make changes in several places - seems contravene dry principle. thanks! correct me if i'm wrong thought linq statements weren't executed until used them. (coming linq nhibernate) if case add whatever need existing statement. example: var temp=from x in sometable

Find remaining memory available to a process in 32 bit Linux using C++ -

my c++ program caches lots of objects, , in beginning of each major api call, want ensure there @ least 500 mb available api call. may either running out of ram+swap space (consider system 1 gb ram + 1 gb swap file), or may running out of virtual address in process.(i may using 3.7 gb out of total 4gb address space). it's not easy me approximate how data have cached, can purge of if becoming issue, , iteratively till have 500 mb available in system or address space (whichever becoming bottleneck). requirements find in c++ on 32 bit linux: a) find how ram + swap space free. b) how user space address space available process. c) how virtual memory process using. consider similar 'commit size' or 'working set size' of process on windows. any answers appreciated. take @ source vmstat : here . search domem() function, gather information memory (occupied , free).

java - numbers problem in code -

i'm having problem code. works fine when compile until point when numbers divide. i'm not getting numbers decimal, zero. can see, changed last variables double didn't have meaningful result. what must change this? int[] arr = new int[2]; system.out.println("enter 2 numbers: "); arr[0] = sc.nextint(); arr[1] = sc.nextint(); int summa = arr[0]+arr[1]; system.out.println("what's "+arr[0]+" + "+arr[1]+" ?"); int vad = sc.nextint(); if (summa == vad) system.out.println("correct!"); else system.out.println("wrong - right answer "+summa); int summa2 = arr[0]-arr[1]; system.out.println("what's "+arr[0]+" - "+arr[1]+" ?"); int vad2 = sc.nextint(); if (summa2 == vad2) system.out.println("correct!"); else s

sql server - parsing comma seperated values in MS-SQL (no csv or such) -

i use closed source commercial application uses ms-sql database. regularly have query database myself various purposes. means table , database design fixed, , can't @ all. have live it. have 2 tables following layouts (abstracted, not discredit software/database designer) t1: id (int), att1(varchar), att2(varchar), .... attx(varchar) t2: id (int), t1_ids(varchar) now contents of t1_ids (shudder) comma separated list of t1 id's. (for example 12, 456, 43, 675, 54). want (you guessed it) join 2 tables. fortunately me, these small tables, , don't care performance in terms of complexity @ (could o(n^m) far care). ideally make view joins these 2 tables. don't have requirements inserting or updating, select statements. easiest , clearest (in terms of maintainability) way this? to first , last use this: select * t1 join t2 on '%,' + t1.id + ',%' ',' + t2.t1_ids + ',' it doesn't matter if t2.t1_ids start or en

Parsing a log file in Java -

all, i have log file below content. request centercord. 2010-12-14 12:42:13.724 [ 6796] **************************** 2010-12-14 12:42:13.724 [ 6796] 1111111111111111 2010-12-14 12:42:13.724 [ 6796]22222222222 response centercord. 2010-12-14 12:42:21.802 [ 5960] 11111111111111 2010-12-14 12:42:21.802 [ 5960] ffffffffffffffffffffffffffff 2010-12-14 12:42:21.802 [ 5960] tttttttttttttttttttttttttttt request centercord. 2010-12-14 12:42:13.724 [ 6796] **************************** i need create 2 log files 1 storing request details , other 1 storing response details. how can parse , prepare 2 log files?. i need below answer. log 1: request centercord. 2010-12-14 12:42:13.724 [ 6796] **************************** 2010-12-14 12:42:13.724 [ 6796] 1111111111111111 2010-12-14 12:42:13.724 [ 6796]22222222222 2010-12-14 12:42:13.724 [ 6796] **************************** log 2: response centercord. 2010-12-14 12:42:21.802 [ 5960] 11111111111111 2010-12-14 12:42:21.802 [ 5960] ff

Having trouble with the output/structure of a nested Array in PHP and MySQL -

im trying make neat, structured list of, in case, films , showdates. $shows = array( array( "thursday" => array( "17:00", "19:00")), array( "friday" => array( "16:30", "18:45" "20:10")), array( "saturday" => array( "18:30", "21:00")) ); the problem cant seem able print things out in reasonable way. days supposed dynamic, not hard corded of case. for ($row = 0; $row < $shows.length(); $row++) //haven't got clue 'length()' { print $shows[$row] . "<br>"; //print day. ( $col = 0; $col < $shows[$row].length(); $col++) //loop through each day. { print (">" . $shows[$row][$col] . "<br>"); //print each time of day. } } and im trying print out each day corresponding

Access Device hardware (Camera Flash) Programically ina android -

i have 1 question can access android device camera's flash light programmically.is possible turn on , off flash light programmically? please give me answer . in advance. package com.thedevelopersinfo.tutorial.android.soundrecordingexample; import java.io.file; import android.app.activity; import android.content.contentresolver; import android.content.contentvalues; import android.content.intent; import android.hardware.camera; import android.media.mediarecorder; import android.net.uri; import android.os.bundle; import android.os.environment; import android.provider.mediastore; import android.provider.mediastore.mediacolumns; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; public class main extends activity { private mediarecorder mediarecorder; private file file = null; static final string prefix

search - Sitemap.xml or Sitemap.html -

i working on 1 web application. want submit site web crawlers using site-map file. there many ways so use sitemap.xml use sitemap.html use urllist.txt use compressed sitemap files all need add 1 of these files in root directory of applications. my question option out of these use ? i'd go xml sitemap defined here http://sitemaps.org/ html sitemaps more geared towards user navigation , urllist.txt seems old method of providing links yahoo. xml sitemaps in format defined on above site created google, yahoo! , microsoft , recognised three. the others wont harm believe biggest benefit come xml sitemap. as compression, that's you, if want conserve bandwidth gzip keep in mind must no larger 10mb when uncompressed.

How does the non executeable exploit work? -

hello question how works non executable exploit's, when non executable mean don't have file extension .exe, word exploits .doc or other. how did make executable action if not compiled? that varies exploit exploit. while .doc isn't executable format contain interpreted vba code malicious content hidden. when opened document there onopen event or such fired execute malicious payload. hence why office installations have macro's disabled default these days, far scope abuse. there plenty of things run on system without being .exe example .com , .vbs , .hta then there formats have no normal executable content can attacked in other ways, taking advantage of poorly written routines load files can allow things buffer overflows

javascript - JQuery wrong ID in an inner click -

i'm trying make colorpicker. got few colorcubes class colorcube. when clicking, opens colorpicker few list items have different color. when clicking on list items should return de color/text de colorcube. the first colorpick after document ready works. after doesnt work properly, because remembers al previous colorcube id's al other cube's change :( is there way clear cache or that? $('.colorcube').click(function() { var colorcubeid = $(this).attr("id"); $('#choicecolor').show(); $(".li_color").click(function() { var colorid = "#" + this.id; var colorli = $(colorid).text(); $('#' + colorcubeid).text(colorli); $('#' + colorcubeid).css({ 'background-color': '' + colorli + '' }); $('#choicecolor').hide(); savecolor(); }); }); you're assigning redundant click event handlers every click on colorcub

deployment - Deploying c# application issues -

i have application 1 folder added right clicking project, selecting add folder. inside folder have xml files set build action:content, copy output directory: copy if newer (i have tried setting embedded resource) have few text files , on. in bin/debug output directory have exe, folder xml, stand alone .txt files , on. problem is, if send exe friend try gets exception thrown. say puts exe on desktop, programme @ point reads filenames of xml files in folder. uses following code string[] filepaths = directory.getfiles(@"datasources\"); i assume because of this, when exe runs desktop, expect folder of .xml files in same place? have same type of exception when trying read .txt files too. doing wrong here? thanks time when reading files using relative paths 1 relative applications current directory. tip: in c# can see directory using environment.currentdirectory . so if create shortcut on desktop, need make sure right click shortcut , set "start in&q

getting JSON data-tree from MySQL -

i have newsfeed similar facebook's newsfeed. it means need not "straight" rows & cols datasets mysql more "trees" of data different length of branches (and different contents). if go straight end lots of nested cycles in php - because each type of news needs different data sets. example of newsfeed: 1) user "a" has added 2 new images (here have user_name, user_avatar, image_path_1, image_path_2 etc..) 2) user "b" has commented users's "a" image (here need user's "b" name, user's "b" avatar, image_path, comment_text, user's "a" name etc...) see mean? so want data mysql stored procedure converted json format. {"news": [ {news_type: "new_images", user_name: "john", user_avatar: "0002.jpg", image_path: "/images/00123.jpg"} {news_type: "comment", user_name: "john&qu

profiler - profiling a method of a class in Python using cProfile? -

i'd profile method of function in python, using cprofile. tried following: import cprofile profile # inside class method... profile.run("self.mymethod()", "output_file") but not work. how can call self.method "run"? thanks. use profilehooks decorator http://pypi.python.org/pypi/profilehooks

c# - Server action never invoked - JSON deserialization failure? -

i have simple action in controller: [httppost] public jsonresult action(menuset menuset) { //... } where menuset is: public class menuset { private ienumerable<menuentry> _menuentries; public ienumerable<menuentry> menuentries { { return _menuentries; } set { _menuentries = value; } } } public class menuentry { private string _parentpagename; private ienumerable<string> _orderedpages; public string parentpagename { { return _parentpagename; } set { _parentpagename = value; } } public ienumerable<string> orderedpages { { return _orderedpages; } set { _orderedpages = value; } } } from client side, i'm invoking action in way below: $.post("controller/action", $.param({ menuentries: preparedata() }, true), null, "json"); where preparedata() function returns menuentries collection: function pr

How to keep GDB tracing in the same emacs frame -

i use gdb in emacs 23.2 , while there 1 thing find annoying. when stepping through code if trace function located in source module in emacs buffer , happens visible in different frame frame raised , stepping continues there. there way have gud make buffer visible in current gdb frame , keep active frame? i've had exact same problem. way i've dealt date close out other frames, appears in gdb frame, that's awful workaround. i've done pretty serious searching through docs , stackoverflow , found these customizations... pop-up-windows sticky windows dedicated windows hope help.

iphone - Open-source YouTube-style UITableViewController -

does know of open-source uitableviewcontroller implementations styled ones in youtube application? check out three20 project: https://github.com/facebook/three20 . if try ttcatalog demo app, you'll see youtube's uitableviewcontroller implementation.

unix - Drawing tables in terminal using ANSI box characters -

Image
i'm trying print table that's more pleasant eye pure text representation of it. want convert this: +-----+--------+ | age | weight | +-----+--------+ | 10 | 100 | | 80 | 500 | +-----+--------+ to this: ┌─────┬────────┐ | age | weight | ├─────┼────────┤ │ 10 │ 100 │ │ 80 │ 500 │ └─────┴────────┘ here screenshot of see in terminal: notice gaps between rows. problem not connecting while other unix tools use ansi printing fine in terminal. example, tree, if run tree -a in terminal `i this: notice how vertical lines connected together. it's funny because when copy , paste output of tree text editor , run script this: obviously i'm missing printing ansi chars in terminal , couldn't find googling it. can shed light on topic? i guess should answer own question. after little research , of friend , boss ,linus, found need force terminal go graphical mode first, print special characters , return text mode. ascii code switching

c++ - Getting a past-the-end pointer -

possible duplicate: take address of one-past-the-end array element via subscript: legal c++ standard or not? const int n = ...; t a[n]; t* begin = &a[0]; //or t* end = begin + n; i know legal , fine. wondering if following undefined behavior or legal well. answer depend on type t? t* end = &a[n]; p.s. question curiosity question, please refrain mentioning vector better alternative arrays , :) yes. undefined behavior. no, type of t doesn't matter. the accepted answer in linked duplicate in error own selection of standard citations. unfortunately muddles logic @ end come opposite conclusion. note in 3.9.2/3 contained within paragraph quite talking type , not ability dereference. type of pointer (array+size) same "as-if" there valid object of type t there; not mean there valid object there , in fact there isn't. there citation in duplicate of c99 standard states &array[index] not result in pointer dereference implied a

ruby on rails - RoR app deployed on Heroku and working with SQL Server database -

is feasible have ruby on rails app, is: a) deployed on heroku, , b) working remote sql server database? i take i'll need unixodbc installed on heroku, cannot find way so. possible? or, there other way (without odbc?) accomplish this? thank guidance or tip. updated: info on subject: 1) heroku pre-installs both unixodbc , freetds default, have them. 2) also, possible run shell commands via heroku console in backticks, e.g.: heroku console `odbcinst` (runs "odbcinst" command in heroku shell , shows result) 3) not have access filesystem outside of slice packages installed. if need driver path, heroku support can provide (/usr/lib/odbc/libtdsodbc.so in case). 4) cannot run sudo commands in heroku shell. at moment, connect ms sql server @ least need append ‘freetds.conf’ file. when using tinytds (there open ticket#2 in tinytds gitgub issue page). dsn-less connection instructions "wiki.rubyonrails.org slash database-support slash ms-sql

hex - Binary coded decimal (BCD) to Hexadecimal conversion -

can explain me how convert bcd hexadecimal? example how can convert 98(bcd) hexadecimal. thanks. i don't quite understand question, i'm guessing e.g. gives number 98 encoded in bcd, be: 1001 1000 and you supposed get: 62h what propose: 1) convert bcd-encoded value decimal value (d) 2) convert d hexadecimal value. depending on programming language choose, task easier or harder. edit: in java be: byte bcd = (byte)0x98; // bcd value: 1001 1000 int decimal = (bcd & 0xf) + (((int)bcd & 0xf0) >> 4)*10; system.out.println( integer.tohexstring(decimal) );

c# - update field or redirect page using jquery and asp.net mvc -

im new jquery , stuck want achieve. heres want using jquery , asp.net mvc. click submit button this calls action method called logon in controller account if call allows users log in succesfully redirect url (sepecified logon) if fails replace div(with id="error") "sorry error occured" so far tried this: $("#submit") .button() .click(function () { $.ajax({ type: "post", url: "account/logon", datatype: "json", success: function (data, textstatus) { if (data.redirect) { // data.redirect contains string url redirect window.location.href = data.redirect; } else { // data.form contains html replacement form $("#e

java - swing layout: vertical flow -

Image
what layoutmanager should use achieve transposed version of flowlayout? essentially, want vertical list occupies multiple columns if can't fit of it's components within 1 column. +------------------------+ | item 1 | | item 2 | | item 3 | | item 4 | | item 5 | | item 6 | | item 7 | | item 8 | +------------------------+ or +------------------------+ | item 1 item 7 | | item 2 item 8 | | item 3 | | item 4 | | item 5 | | item 6 | +------------------------+ this wrapping logic needs happen dynamically, ie container resized. i'm working on solution my own question (very similar: need flow vertically constrain width horizontally), got quick example sort of working , maybe gets started custom layout manager: import java.awt.component; import jav

linux - logrotate - compression files modified x number of days -

is there way logrotate compress files modified x number of days ago (e.g. mtime +2) well can use delaycompress wait 1 more cycle. if rotate daily keep yesterdays logs uncompressed. besides try not using logrotate compress files , write bash script run once day , compress files older date. here tutorial bash like: http://www.linuxconfig.org/bash_scripting_tutorial

javascript - On focus, how to place the caret after the last character in an already populated field in IE? -

on focus, how place caret after last character in populated field in ie? textareaname.scrolltop = textareaname.scrollheight; works textareas nevermind, try this: http://blog.vishalon.net/index.php/javascript-getting-and-setting-caret-position-in-textarea/

asp.net - Stop HTML/Javascript page from loading mid initialization -

so imagine piece of javascript first script on page along lines of var mysuperobject = new (function () { this.superobjectinit(); })(); now imagine proceeds script (or large portion therein) requires superobject have met load conditions , loaded correctly. assuming whatever reason loading of object fails need abort loading rest of page , scripts in particular. i know majority of going scream why not have function issue callback onsuccess , onfailed problem in asp.net project masterpages, nestedmasterpages, usercontrols , forth (each of have own dependencies , scripts); rendering such approach problematic. the other option (i assume) use window.location = "myerrorpage.html"; dont idea of having create page error message or fact causes redirect. what hoping along lines of stoploadingpage(); document.write("error has occurred"); but not sure how might accomplished. what you're trying achieve isn't how web pages designed, far k

iphone - Issue with HTTP request in Objective C -

iam trying submit values external db using http request my code below nsstring *post =[nsstring stringwithformat:@"user=%@&child=%@&content=%@",userid,childid, crackcontent.text]; responsedata = [[nsmutabledata data] retain]; nsstring *hoststr = @"http://myhost.com/additem.php?"; post = [utilityobj getencodedurl:post]; hoststr = [hoststr stringbyappendingstring:post]; nslog(hoststr); nslog(hoststr); nsurlrequest *request = [nsurlrequest requestwithurl:[nsurl urlwithstring:hoststr]]; [[nsurlconnection alloc] initwithrequest:request delegate:self]; my issue if space contains of parameter not submitted, otherwise submitted. help highly appreciated. you may parameter encoded before send. nsstring* escapedurlstring = [unescapedstring stringbyaddingpercentescapesusingencoding: nsasciistringencoding]; alternative nsstring * escapedurlstring = (nsstring *)cfurlcreatestringbyaddingpercentescap

How to query for status of "Scheduled Jobs" in ClearCase? -

i have setup several custom scheduled jobs in clearcase task scheduler, these jobs supposed automated sync , have no problem them. occasionally jobs might fail, , looking cli way of querying status of these scheduled jobs , generate basic report. is there such cli utility? the cleartool schedule presented in viewing job properties seems complete enough: to view messages , information such time , status last execution of job, use command: cleartool schedule –status job-id-or-name these commands display properties of jobs using job-definition syntax documented on schedule reference page.

MSMQ with asp.net and wcf -

currently i'm developing apllication sends sms via asp.net. i'm using msmq queuing incase of multiple sending of sms. wcf check new queue , using teh queue send out sms. i've few question. how create new queue msmq via asp.net how schedule in wcf ? 1 . how create new queue msmq via asp.net in order create queues on fly, can use system.messaging in .net - see e.g. article on how it . 2 . how schedule in wcf ? why need schedule in wcf? trying do, trying achieve here?? wcf service-oriented framework - it's messages , stuff - not scheduling.

.net - Organising T4 Templates -

i have begun using t4 templates few dal enhancements. however, find unwieldy , produce poorly formatted code. i wondering if has tips on organising these templates, , on getting great formatted code @ end. so far experience is: stick existing published templates (e.g. subsonic) if indentation playing attempt blank line after closest #> lots of comments. split templates control/data preparation logic , 'views' output rendering. set data need first , write output minimal logic possible. if can parcel output reusable chunks, can put in method wrappers in <#+ #> blocks , structural work set of method calls.

Reporting Services and SQL Server Mirroring -

in installation 2 sql server 2008 sp2 standard servers use mirror have failover partner databases. one of purposes of databases supply reports through sql server reporting services. my question how set have failover of reports , keep cost @ minimum. i can see 1 solution reporting databases mirrored user databases use. reporting services failover? another way install 2 separate instances of reporting services on each database server reporting databases not mirrored , both running. how redirect users browsers 1 entry address running reporting service? there's witness server running sql server 2008 express. upgraded standard , run reporting services (should able failover through native client connection), reporting service self has no failover. i don't know if i'm missing here impossible in way without using sql server enterprise , failover cluster solution? any ideas, thoughts , links appreciated, aware have read lot of guides , best practices around interne

django class-based views with inline model-form or formset -

i have following models: class bill(models.model): date = models.datetimefield(_("date of bill"),null=true,blank=true) class item(models.model): name = models.charfield(_("name"),max_length=100) price = models.floatfield(_("price")) quantity = models.integerfield(_("quantity")) bill = models.foreignkey("bill",verbose_name=_("bill"), related_name="billitem") i know possible: from django.forms.models import inlineformset_factory inlineformset_factory(bill, item) and process via standard view. now wondering, if there way achieve same (meaning: using inline adding/editing items belonging bill) using class based views (not admin-interface). key points is: generated formset s within forms.py using inlineformset_factory : bookimageformset = inlineformset_factory(bookform, bookimage, extra=2) bookpageformset = inlineformset_factory(bookform, book

.net - How do I offset the labels in a System.Windows.Forms.DataVisualization.Charting.Chart? -

i'm trying display results of fft 128 bins, when following add new data: datavisualization::charting::series^ series = m_chart->series[0]; series->points->databindy(m_databuffer); m_chart->refresh(); ...it labels spectra 1 128. need labels read 0 127. what's easiest way achieve this? just in case else wants along these lines, can can using custom labels: system::windows::forms::datavisualization::charting::chartarea^ chartarea1 = this->m_chart->chartareas[0]; for( int = 0; < 128; += 16 ) { system::windows::forms::datavisualization::charting::customlabel^ customlabel1 = (gcnew system::windows::forms::datavisualization::charting::customlabel()); customlabel1->fromposition = i-1.5; customlabel1->text = (i).tostring(); customlabel1->toposition = i+1.5; chartarea1->axisx->customlabels->add(customlabel1); }

c# - How can I convert a date from the format "dd/mm/yyyy" to "yyyy/dd/mm"? -

i have textbox in user supposed enter date in format dd/mm/yyyy , date stored yyyy/mm/dd in database. so want user enter date in dd/mm/yyyy format , later want convert yyyy/mm/dd can query database. how can convert user input date dd/mm/yyyy yyyy/mm/dd ? quick , maybe dirty: string reformatteddate = datetime.parseexact(textbox1.text, "dd/mm/yyyy", null).tostring("yyyy/mm/dd"); this, of course, assumes content of textbox in assumed format, should checks in before ensure that. there's safer way not need additional checks: datetime result; if(datetime.tryparseexact(textbox1.text, "dd/mm/yyyy", null, system.globalization.datetimestyles.none, out result) { // here can safely use result string reformatteddate = result.tostring("yyyy/mm/dd"); } else { // screw user } this try parse content of textbox , return via out result , if successful, return true. otherwise can rest assured input either not in assumed f

Ruby/ RoR - String Hash to Integer Hash -

i have hash @answers = params[:answers].to_hash; <%= debug @answers %> outs --- "1": "2" "7": "3" "6": "4" "4": "0" need make @answers 1 below @ans = {1 => 2, 7 => 3, 6 => 4, 4 => 0} <%= debug @answers %> outs --- 1: 2 7: 3 6: 4 4: 0 black magic wizard reporting in: answers = {"1" => "2", "3" => "4"} hash[*answers.to_a.flatten.map(&:to_i)] # => {1=>2, 3=>4}

Iphone game development switching between scenes -

i have created pause button on touch scene replaced pause menu.... and when resume scene comes back...however function keep calling themselves.... how can pause every thing in current file when switch scene... "on touch", running scene should call: [[ccdirector shareddirector] pushscene: [pausemenu scene]]; the pause menu's "back game" button should call: [[ccdirector shareddirector] popscene]; pushing pause menu place, should "pause" scene being pushed , when pop should continue running. documentation: http://www.cocos2d-iphone.org/api-ref/latest-stable/interface_c_c_director.html

flash - How to implement javascript blocking modal dialog in with DHTML -

i have website flash image viewer. once user clicks on flash button, need give confirmation modal dialog before saving file , if user clicks on ok have pop file download dialog. confirmation dialog in flash not option me. have invoke js function pop confirmation. within site, custom dhtml confirmation modal dialog used , has 2 js callback functions 1 "ok" , other "cancel" button click event handers. have use modal dialog need. with flash player 10 security features, unable pop flash file download dialog via javascript. simple js confirm dialog works me can return user's action calling js function flash js confirm dialog blocking dialog. how can implement same blocking type custom confirm dialog ? you need wrap popup div . make div top element in page, eg: using z-index . , give fixed position height , width of 100%. can leave transparent or give effect using semi-transparent colors. if have select elements in page, go through div .

c# - typeof() parameter - how does it work? -

in code below: string getname(type type) { return ((type)this.obj).name; } void run() { string name = getname(typeof(myclass)); } im getting "the type or name space cannot found (are missing using directive or assembly reference?)" error. should correct this? you can't cast instance ! type instance of type class, if want cast type, use generics void getname<t>() t : iobjectwithname { return ((t)this.object).name; } then can call string name = getname<myclass>(); if makes sens.

xml - Best way to perform XSL transformation in Ruby (XSLT 2.0) -

what best , efficient way to perform xsl transformation in ruby? have tried nokogiri, no matter tried results in: compilation error: element stylesheet the stylesheet works in xml editor. i'm using ruby 1.9.3 on linux. after poking around, found out nokogiri not support xslt 2.0: nokogiri uses libxml2, supports xpath 1.0/xslt1.0 my stylesheet written using xslt 2.0 syntax. updated title of question reflect this. wish nokogiri responded in more meaningful way. why want perform xsl transformation? curious. i'm working on website submits xml feeds other sites. every feed has different format, source of data feed same. so, instead of writing custom code every feed decided use xsl stylesheets, served database. way can create new feeds uploading new stylesheet. it possible use xslt 2.0 in jruby via saxon-xslt gem . don't think it's possible via other ruby implementations. mri ruby depend on libxml hasn't implemented xpath 2.0 yet. se

Full documentation on Scala's XML support? -

i'm reading preprint of 2nd ed of programming in scala, says "only scratched surface of can xml". there resources understanding entire xml support in scala 2.8? (right now, want know namespace handling, i'd have complete refer to). scaladoc doesn't count. this book author of scala xml supoort. scala xml support did not change on versions still date: http://burak.emir.googlepages.com/scalaxbook.docbk.html this article: http://www.codecommit.com/blog/scala/working-with-scalas-xml-support there's nice article here: http://www.ibm.com/developerworks/library/x-scalaxml/

autofill - C# control browser -

please suggest how can write c# control browser go url , auto fill in specific element why don't use webbrowser control in c#? drag control toolbar form. webbrowser1.navigate("http://www.example.com/bla"); fill in element want this: webbrowser1.document.getelementbyid("yourid").innerhtml = "some content"; hope helps, alex

iis - directory listing denied -

whenever click on hyperlink, error says "directory listing denied". should do? you have turn on feature in iis enables directory listing. check if works http://technet.microsoft.com/en-us/library/cc731109(ws.10).aspx

javascript - modifying text of a div using dojo -

i have dojo widget.for widget have 2 files a.js , a.html.now inside a.html have like <div id ="xyz" dojoattachpoint="xyz"> </div> the above line 1 line inside widget template , normal html div now in a.js make asynchronous call server.in callback function of remote method want modify text of span xyz.i tryed following 3 ways, none of them working. 1) dojo.byid("xyz").innerhtml = "some text" 2) this.xyz.innerhtml ="some text" 3) var mywidget = dijit.byid("pack1.abc.widget.widgetname_id"); mywidget.xyz.innerhtml ="some text" none of above approach works. when use approach 1 in other functions of a.js(non callback functions) works fine. you cannot hardcode id of widget in it's template. id has identify instance of widget-type uniquely, has given on creation. you can example like, programmatic in js: var mya = new mywidgets.a({}); mya.startup(); mya.xyz.in

sql - mysql: most efficient method to store parameters with unknown type (string/int) to the db -

i have messaging system contains default templates. example: you won x coins friend x wants share url y you so number of parameters varies in each message/template type. i thought of 4 types of solutions resolve issue: creating parameters table , represent each parameter type string. problem here user_ids represented strings joins slower. e creating parameters table each row contains following boolean tells if parameter int or string, , 2 other columns 1 type text , other type int. here we're kind of wasting space because whenever use int parameter row contains unused string cell. not create parameters table @ all, each notification contains parameters string contains each needed parameter seperator ; . 1 may slowest solution. creating 2 different tables each time of parameters: notification_param_int , notification_param_string , table contains each parameter in notification relevant table. solution may slower solution 2 because need check table fetch informatio

c# - How to append parameter? -

how can string appending parameter(s) request.url.query? let have parameter "value=100" request.url.query after appending "" "?value=100" "?" "?value=100" "?page=15" "?page=15&value=100" "?page=15&sort=col" "?page=15&sort=col&value=100" you cannot append parameters current query string. querystring readonly. if want manipulate querystrings in application use url helpers generate , manipulate urls. you checkout parsequerystring method useful in asp.net mvc application have routes , url helpers. sample usage: string query = "?page=15&sort=col"; var values = httputility.parsequerystring(query); values["value"] = "100"; query = values.tostring(); // page=15&so

standalone C++ preprocessor -

i'm looking standalone c++ preprocessor. i'll use language, there's no point in running through full fledged compiler, it's limited script language, #define , #if , other directives me lot. for example, i'd writing file this: #define debug stuff #ifdef debug show message box or whatever #endif more stuff i found fits needs, mcpp . it's simple use preprocessor , supports output other languages command line switch.

bloated jquery xml requests -

i wondering if had alternative this. $(xml).find("a").each(function(){ $(this).find('b').each(function(){ $(this).find('c').each(function(){ $(this).find('d1').each(function(){ sectionvalidation.registerterms.setregistertermsarray(this); }); $(this).find('d2').each(function(){ sectionvalidation.registerterms.checkvalidvariations(this, val); }); }); }); }); it seems bloated , there has more elegant approach getting nested xml data. thank you you can @ least combine a through c selector decendant selector (space in-between), this: $(xml).find("a b c").each(function(){ $(this).find('d1').each(function(){ sectionvalidation.registerterms.setregistertermsarray(this); }); $(this).find('d2').each(funct

Proper SQL datatables query writing -

i have table t1 3 columns id,c1,c2,c3 certains numbers. have different table t2 id,name values in id values of c1,c2,c3. i unable write query can results id | names of c1 | names of c2 | names of c3 can help. one way write subqueries retrieve name each column: select t1.id , (select name t2 t2.id = t1.c1) c1name , (select name t2 t2.id = t1.c2) c2name , (select name t2 t2.id = t1.c3) c3name t1 or use tripe join: select t1.id , t2_1.name c1name , t2_2.name c2name , t2_3.name c3name t1 join t2 t2_1 on t1.c1 = t2_1.id join t2 t2_2 on t1.c2 = t2_2.id join t2 t2_3 on t1.c3 = t2_3.id

inno setup - How to display a larger license box in an InnoSetup installer? -

innosetup default displays license agreement in tiny text area user can't make bigger in way. while know people don't read these, feel providing in format makes particularly hard read bad idea, , might form part of defense in court. is there way in innosetup display license in large separate window? pre-rolled pascal script perhaps? you can change wizardform size , rearrange controls in if want make bigger. made example show how change form height license page. [setup] appname=stackoverflow large license box appversion=1.0 createappdir=no disableprogramgrouppage=yes defaultgroupname=my program uninstalldisplayicon={app}\myprog.exe licensefile=license.txt ;outputdir=userdocs:inno setup examples output [code] var defaulttop, defaultleft, defaultheight, defaultbacktop, defaultnexttop, defaultcanceltop, defaultbeveltop, defaultouterheight: integer; const licenseheight = 600; procedure initializewizard(); begin defaulttop := wizardfo

c# - How to implement a generic RepositoryFactory? -

i'm trying implement generic repository. i've got far ... public interface irepositoryfactory { irepository<t> repositoryof<t>() t : class; } public class entityframeworkrepositoryfactory : irepositoryfactory { private readonly iwindsorcontainer _container; public entityframeworkrepositoryfactory(iwindsorcontainer container) { _container = container; } public irepository<t> repositoryof<t>() t : class { var repository = _container.resolve<irepository<t>>(); return repository; } } the repositoryfactory used unit of work implementation public interface iunitofwork : idisposable { irepository<t> repositoryof<t>() t : class; void commit(); } anyway, question want ask whether having repositoryfactory implementation depend on iwindsorcontainer correct? i needed way of asking irepository of type, installer code ... // windsor container container.register(

linker - Specify makefile location to link libraries -

i stumbled upon in project i'm working on. in package a , there required configuration option --package-b-makefile-location a 's makefile borrows variable values. is common design pattern has merit? seems me b 's package source important binary compiling a . might there reasons wouldn't want tamper it? thanks, andrew it far unheard of 1 package need other packages pre-installed, , have specify locations. for example, building gcc (4.5.2), need specify locations of gmp, mpfr , mpc libraries if won't found default. complex systems extensible - perl, apache, tcl/tk, php - provide configuration data users in various ways (config.pm perl, apxs apache, etc), configuration data crucial dependent modules. my suspicion package needs of configuration data related package b, there isn't fully-fledged system providing it. workaround, package needs see configuration data encapsulated in makefile. it not common need makefile; not uncommon need inf

css - Go width of the screen behind main content -

similarly way facebook achieve blue bar @ top, how make 1 bar go width of screen (dependent on resolution) rest of content restriction 1024px. this have never done before have go at. thanks just don't put element inside 1 constrained width.

php - Prevent application from introducing harmful changes on the server side -

this small little hobby project in php. use 0sites.org server (linux os). try imitate functionalities of http://www.codepad.org , http://www.ideone.com . trying have online compiler/interpreter lanuages. as of now, can compile/run applications php exec(..) , unsure how going filter out harmful function calls c/c++ system(..) . also, have little idea how going prevent network access. i planning add few more languages. difficult implement things specific every language. wondering if there way stop things @ more general level. i have thought on lines of parsing code manually , comment out problematic lines of code. since there more 1 way things, can broken. :-p any ideas/suggestions/pointers ? shall highly grateful same. :-) (ps: hobby project. want make professional possible.. ) you need os support creating these sandboxes. approach involving filtering source code going have security problems, , nightmare maintain. just think: if implement parser correctly, there

php - mysql lots of text columns or integer columns and a new table? -

i'm new mysql , have choice regarding mysql database structure new database. can have: table1:(id,text1,text2,text3,text4,up text7) or table1:(id,int1,int2,int3,...up int7) int values link table 2 unique index table2:(id2,text) so basically, should put text in columns in single table or saparate , store index values in 1 table , text data in second table... queries given id code, return strings text 1 text 7. table large, ~1 million id's (meaning table 2 if method 2 used have ~7 million entries) which method faster in opinion? edit1: each text 250 letter characters in length. edit2: clarify, given id , query table getting 7 text items id. query done on tables , information ever required. need know faster use. if neither, please offer better way! won't make speed difference if you're not querying based on text. keep simple , use 1 table. if have query text, you're going want change it.

In Java, how do you convert all of the words of a string to sentence case? -

in java, how convert this: little bo peep has lost sheep , doesn't know find them to this: little bo peep has lost sheep , doesn't know find them wordutils.capitalizefully(string input) commons lang