Posts

Showing posts from May, 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.

database - Historicity in Django -

i want create couple of object's in django model. such room[idroom, nameroom] , user[iduser, nameuser]. i want have multiple users in room's , room's user. want user's in specific room , rooms user. also, want make history of changing room , user table. anybody can me this? this sketch of need have: class user(models.model): pass class room(models.model): users = models.manytomanyfield(user, related_name="rooms") class history(models.model): room = models.foreignkey(room) user = models.foreignkey(user) time = models.datetimefield(auto_now_add=true) # add objects first_user = user() first_user.save() first_room = room() first_room.save() first_user.rooms.add(first_room) history(room=first_room, user=first_user).save() # ^^^ automatically adds current date , time # fetch them this: room.objects.get(pk=the_room).users.all() user.objects.get(pk=the_user).rooms.all() user.objects.get(pk=the_user).history_set.order_by(&qu

vb6 - VB.NET file for compilation of CLS to DLL -

i have vb 6.0 file compiles cls file in same folder dll without creation of windows forms. know of example in vb.net? have @ implementing class library in vb.net and @ create class library project or implementing class library object in vb.net 2005 or building class library component , consumer client application vb.net

sleep - Java System Clock Independent Scheduling/Pausing -

i need way pause/sleep thread in system clock independent way. meaning, if want thread weak in dt msecs must if system time changes during time. not interested in accuracy in msecs , more in principle work. timertasks not option since work on absolute time. thread.sleep(millis);

Getting NS_ERROR_DOM_BAD_URI while JQuery Ajax -

i using jquery ajax. below jquery code: $.ajax({ type: "post", url: "http://stackoverflow.com/login.aspx", // send login info page data: str, success: function(result) { //$("#logindetails").ajaxcomplete(function(event, request, settings) // { // show 'submit' button $('#loginbutton').show(); // hide gif spinning rotator $('#ajaxloading').hide(); var reslength = $.trim(result).length; if(reslength!=0) { var arr = result.split(","); var fname = arr[0]; var lname = arr[1]; var activecardno = arr[2]; var multipletier = arr[3]; var activestatus = arr[4]; var access = arr[5]; if(access!='' && access!='undefined

python - Is there a function that can turn a string into a hash? -

ideally, 14 characters? or, whatever works. hashlib this module implements common interface many different secure hash , message digest algorithms. included fips secure hash algorithms sha1, sha224, sha256, sha384, , sha512 rsa’s md5 algorithm.

asp.net mvc - How to host a web service in MVC3? -

Image
how can use web service in mvc3? should include web service? new that...help please. in latest versions of vs can click here: in opened window able enter service address , required configuration. you can place service references in project. id suggest create separate project , hold them there.

java - Typical network socket timeout -

i'm interested know, typical network socket timeout value, used in production today. i'm using 30 seconds in our java application, hear other using, internet communications. thanks. there no such thing "typical" socket timeout. rather should chose timeout(s) according application requirements. issues such as: is there user waiting response? is timeout event? does setting "too long" timeout tie down lots of resources, or delay proccessing? does setting "too short" timeout result in wasted processing when waiting bit longer have given results? is there keep-alive mechanism ... can distinguish between (say) network failure , remote server taking long time? the best strategy pick intuitively sensible values, , tune them.

sql - Can I check which database is running configuration and content for a WSS 3.0 site? -

the problem have full access server sharepoint site hosted etc, i've ever done maintained site. didn't set up. there issue sharepoint can't connect config or content databases. don't know of our servers run these, there anyway can find out, maybe config file or server/database need check. other websites on web server still running fine, know database isn't on same server because i've checked. any ideas? check out event viewer log. there entry similar this: event type: error event source: windows sharepoint services 3 event category: database event id: 3760 date: 4/16/2009 time: 11:51:07 user: n/a computer: imiapp03 description: sql database **'sts_config'** on sql server instance 'np:\\.\pipe\mssql$microsoft##ssee\sql\query' not found. additional error information sql server included below. cannot open database "sts_config" requested login. login failed. login failed user 'nt authority\network service'

c# - Intercepting method called from a method of the same object -

here's situation: /// <summary> /// business logic class. /// </summary> public class businessclasswithinterceptor : businessclass, ibusinessclass { /// <summary> /// initializes new instance of <see cref="businessclasswithoutinterceptor"/> class. /// </summary> /// <param name="logger">the logger.</param> public businessclasswithinterceptor(logger logger) : base(logger) { } /// <summary> /// displays cows. /// </summary> public void displayallcows() { this.logger.write("displaying cows:"); var repository = new cowrepository(); foreach (cowentity cow in repository.getallcows()) { this.logger.write(" " + cow); } } /// <summary> /// inserts normande. /// </summary> public void insertnormande(int id, string name) { this.displayallco

I want to give monthly subscription to my android application -

i have application in in month free , after 30 days paid.. n every month user needs subscribe services. how that? cloudware city has api can called can talk on web, web app or native app on device long can talk on http/https. there integration kit silverlight, not android natively, documentation there feeling writing code integrate :) it service alexander says - send username/password , it'll tell if valid or not, , how long run until expiry, , how many other subscriptions user may have subscribed (e.g. tiered subscriptions or multiple products. cloudware city http://cloudwarecity.com/vendor makes easy offer free or paid subscriptions web app, service or content, , handles sales, marketing, authentication, subscriptions/account management, recurring billing , other nifty features.

silverlight - Does the new Microsoft Lync 2010 Client API work in non-IE browsers? -

i'm writing silverlight app uses lync 2010 client api communicate lync 2010 client. works fine in internet explorer, in chrome/firefox this: microsoft.lync.model.unsupportedbrowserexception: browser doesn't support activex @ microsoft.lync.model.lyncclient.handlejavascriptexception(string error) @ microsoft.lync.model.lyncclient.ensureofficeintegration() @ microsoft.lync.model.lyncclient.getclient() @ lyncsilverlightapplication2.page.button1_click(object sender, routedeventargs a) the documentation hints api might work in ie: " internet explorer 7 , internet explorer 8 support lync controls. " statement doesn't really exclude other browsers , api independent controls. still. so; new microsoft lync 2010 client api work in non-ie browsers? unfortunately, no - lync api work in activex enabled browsers - silverlight controls use activex under hood talk lync. the recommended way achieve cross-broswer

how to access remote computer windows service using asp.net -

how access remote computer windows service using asp.net one easy way open dos command inside asp.net , call the net command , example starting service call " net start servicename " code how run interactive command shell or bath files asp.net

serialization - c# Incorrect XML to deserialize -

i have xml, , need deserialize type incorrect. <consumer> <sex type="int">man</sex> </consumer> how fix out? allow int , string. thx in advance, the way going accomplish manually parsing xml. all of regular tools going throw fit on fact "man" no means integer.

graphics - How to create crisp background image for 1x1 Android widget? -

i'm creating 1x1 widget, , no matter try, can't background image looking nice , crisp. i've read resource can find, yet still can't win. i'm designing htc desire/nexus 1, , love tell me when creating background in photoshop, dpi/height/width use (currently using 72/100/80). i'll worry other devices resolutions once can looking nice on test device first. also, if there's special need putting in @layout/main.xml , widget_provider.xml files. can't find examples 1x1 gadgets, have following: main.xml <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/widget" android:layout_width="fill_parent" android:orientation="vertical" android:background="@drawable/background" android:layout_gravity="center" android:layout_height="wrap_content"> widget_provider.xml <appwidget-provider xmlns:android="http://schemas.android.com/apk/

hibernate - NHibernate sub sub class property query -

i have class a contains class b contains class c property p . should work shouldn't it?: var query = session.createcriteria(typeof(a)); query.add(expression.insensitivelike( projections.cast(nhibernateutil.string, projections.property("b.c.p")), "%bla%", matchmode.exact)); i could not resolve property exception. i understand can use createalias etc., have tried no avail. @ moment opted 'implicit association join'. any feedback appreciated. many thanks. chris createalias (or createcriteria) way it. var query = session.createcriteria<a>() .createalias("b", "b") .createalias("b.c", "c"); query.add(expression.insensitivelike( projections.cast(nhibernateutil.string, projections.property("c.p")), "%bla%", matchmo

asp.net mvc - ASP MVC3 with razor running on Azure -

i create simple asp mvc3 web applications learning , have hosted. familiar asp mvc don't yet know azure cloud. if possible have these hosted on cloud i'm not sure start. can give me advice. example very low usage , making use of sql ce database kind of azure account need , approximately how cost. thanks in advance help. for asp.net mvc 3 thing "bin deploy" - scott hanselman has post on doing on blog: http://www.hanselman.com/blog/bindeployingaspnetmvc3withrazortoawindowsserverwithoutmvcinstalled.aspx i recommend download windows azure platform training kit , work through first few labs feel of azure. http://www.microsoft.com/downloads/en/details.aspx?familyid=413e88f8-5966-4a83-b309-53b7b77edf78&displaylang=en i agree nathan , xiii - have ditch sql ce doesn't work in elastic cloud model, @ azure table storage instead, it's cheap , scalable. (and it's in first lab) if you're playing around grab introductory offer on nathan

Does Azure have support for HttpRuntime.Cache for an ASP.Net application? -

my asp.net application uses httpruntime.cache. if host on azure: will there compilation errors assuming httpruntime.cache not supported on azure there not compliation errors, httpruntime.cache returns null requested key httpruntime.case works fine which of assumptions correct? you can use httpruntime.cache in azure web role without problem using it. thing keep in mind cache machine specific, in case have multiple instance running, each have own cache data.

java - How to map a Map of Sets in JPA -

is there way in jpa map attribute type map<string, set<address>> given following classes: class company { int id; map<string, set<address>> addresses; // key country of address } class address { int id; string country; } there 3 tables: tbl_company id int tbl_address id int country varchar(40) tbl_company_address company_id int address_id int how can map scenario jpa one of possible solutions having address-wrapping class, , insert set class. in case able use map (using @onetomany, @mapkey annotations). e.g. @onetomany(mappedby = ...) @mapkey(name = "countrykey") private map<string, addresswrapper> addresswrappers; .. , addresswrapper contain @onetomany set<address> addresses; , along string countrykey .

mailto - Analytics - Email tracking -

i'm trying track email links google analytics, reasons not work. here code: <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setaccount', 'xxxxxx']); _gaq.push(['_trackpageview']); (function() { var ga = document.createelement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getelementsbytagname('script')[0]; s.parentnode.insertbefore(ga, s); })(); </script> and here's onclick function in page source code: <a href="mailto:mail@mail.sk" onclick="_gaq.push(['_trackevent', 'index','klik - email','mail@mail.sk']);">mail@mail.sk</a> i tried same tracking link on other page , worked. after installed ga debug, found out when i'

php - scatter chart formula -

i trying create scatter chart on web page css , few dots images. have created design successfully, can't figure out how scatter chart works. can provide me idea how can arrange them? chart width 968 , height 432. chart http://chart.apis.google.com/chart?cht=s&chd=t:12,16,16,24,26,28,41,51,66,68,13,45,81|16,14,22,34,22,31,31,48,71,64,15,38,84&chs=250x100&chl=hello|world i cannot use want know how works thanks help. <?php $w = 968; $h = 432; $xmin = 0; $xmax = 968; $ymin = 10; $ymax = 100; $x = 10; $y = 10; $xc = 20; $yc = 20; $r = (20)/ 2; $xc = $w * (($x - $xmin)/($xmax - $xmin)) - $r . "<br>"; $yc = $h * (($ymax - $y)/($ymax - $ymin)) -$r; $tr =''; $data = array("120|90","345|456","45|66","45|45"); foreach($data $value){ $new = explode("|",$value); $tr .='<a href="#" style="top:'.$new[0].'px; left:'.$new[1].'px;" class="d

Pinch to Zoom on ListBox on windows phone 7 -

i trying add pinch zoom feature data bound listbox. efficient way this? have placed listbox inside grid control , made scrollable. this current code. <grid x:name="contentpanel" grid.row="1" margin="10,0,10,10" background="black" > <listbox name="lsttext" fontsize="24" foreground="white" selectionmode="single" margin="10,0,10,10" scrollviewer.verticalscrollbarvisibility="visible" > <listbox.itemtemplate> <datatemplate> <stackpanel > <textblock text="{binding text}" textwrapping="wrap"></textblock> </stackpanel> </datatemplate> </listbox.itemtemplate> </listbox> </grid> <toolkit:gestureser

math - Galois field computations on Linux -

is there software available on linux galois field calculus? i did little bit of searching, , found couple of options: sage sage can used study elementary , advanced, pure , applied mathematics. includes huge range of mathematics, including basic algebra, calculus, elementary advanced number theory, cryptography, numerical computation, commutative algebra, group theory, combinatorics, graph theory, exact linear algebra , more. here's part of tutorial on polynomials. octave a high-level language, intended numerical computations. provides convenient command line interface solving linear , nonlinear problems numerically, , performing other numerical experiments using language compatible matlab. singular a computer algebra system polynomial computations, special emphasis on commutative , non-commutative algebra, algebraic geometry, , singularity theory. note have not used software listed above, , merely trying provide helpful links. asking q

c# - The SMTP server requires a secure connection or the client was not authenticated -

i getting error the smtp server requires secure connection or client not authenticated. server response was: 5.7.0 must issue starttls command first. e17sm974159fak.34 web.config <mailsettings> <smtp deliverymethod="network" from="emailaccount@gmail.com"> <network defaultcredentials="false" host="smtp.gmail.com" port="587" username="emailaccount@gmail.com" password="12345678" /> </smtp> </mailsettings> code file public void submit() { ensurecurrentlyvalid(); // send via email var message = new stringbuilder(); message.appendformat("date: {0:yyyy-mm-dd hh:mm}\n", datetime.now); message.appendformat("email from: {0}\n", name); message.appendformat("email: {0}\n", email); message.appendformat(&quo

oop - Missing methods in Python class inheritance? -

i not experienced class inheritance. please me , have @ code below: class handle(stafhandle): def __init__(self, handlename): handle = stafhandle.__init__(self, handlename) self.initlogger(handle) def initlogger(self, handle): self.logger = logging(handle, 'test') handle = handle('test') handle.logger.info('test') it says submit method not defined: result = handle.submit(system, service, logrequest) attributeerror: 'nonetype' object has no attribute 'submit' but if change to: class handle(stafhandle): def __init__(self, handlename): handle = stafhandle.__init__(self, handlename) def initlogger(self, handle): self.logger = logging(handle, 'test') handle = handle('test') handle.initlogger(handle) handle.logger.info('test') it works. why there difference? lot!! cheers, zhe stafhandle.__init__ returns none . want: class handle(stafhan

Python readability through descriptive naming -

i have been using python year now, coming java background. found python quite easy learn because of focus on readability , simple design. thing don't understand python why language focuses heavily on readability, uses non-descriptive names modules, functions, constants etc.. 1 thing java descriptive class/attribute/method names (i objective-c more reason). seems python programmers in general seem have taken c type approach naming use short names possible everything. know wants little typing possible lot of programmers spend majority of time reading code rather writing find choice between short non-descriptive names , long descriptive names, easy 1 make. (i longer descriptive names xd) a few examples, looking @ modules in standard library, sched — event scheduler, have been eventscheduler? asyncore — asynchronous socket handler, asynchronoussockethandler? imghdr — determine type of image, determineimagetype? pickle? i know isn't huge issue find myself more not hav

php - Is salting with a hashed version of the user's password just as secure as salting with a pre-defined string? -

basically, i'm asking if salting password appending hashed version of end of secure salting different string. so: is this: $pass = "pass"; $salt = sha1(md5($pass)); $pass = md5($pass.$salt); as secure this? $pass = "pass"; $salt = "4d9ds*^dkrui45^#dkd*3fd8&!dlvd*"; $pass = md5($pass.$salt); the first example secure hashing without using any salt @ all, because still requires password , nothing more crack. in other words, applying hashing functions same thing few times more. a better bet still create salt each user , store alongside, separately. fixed salt alright, guess, because cannot use password determine salt. however, generating unique salt each user better because take more information password crack (e.g. username, date registered, or other info).

php - can attributes be hidden in a simplexmlobject? -

i have simplexml object , looks fine, when convert part of it... like: $xmlmeshheading = $meshheading->asxml(); i attributes can't find in simple xml object...? here parts of 2 files: simplexmlobject: [meshheadinglist] => simplexmlelement object [descriptorname] => acoustic stimulation ( [meshheading] => array ( [0] => simplexmlelement object ( [qualifiername] => methods ) [1] => simplexmlelement object ( [descriptorname] => adolescent )

.net - Getting data into Silverlight app -

i new silverlight (and .net well, part) , working on creating silverlight business application. followed tutorial @ http://msdn.microsoft.com/en-us/library/ee796239%28v=vs.91%29.aspx , seems work fine except 1 problem: not tables/data making way over. i using windows xp sp3, microsoft sql server 2008 , visual studio 2010 reference. i created app in vs default template silverlight business application. created sql connection database. then, following tutorial, created entity classes , domain service, tutorial says to. alright, here happens: dragged , dropped data grid onto xaml form. first 1 worked fine , displays data rows correctly. second 1 not, instead throws following error: system.servicemodel.domainservices.client.domainoperationexception: load operation failed query 'getmydata'. remote server returned error: notfound. ---> system.servicemodel.communicationexception: remote server returned error: notfound. --> system.net.webexcepti

project management - Suitable technology for very small user base -

my friend wants way organize projects , tasks better @ work. able to: define projects define (weekly) tasks each project a task associated particular week (day/time granularity not needed) define sub-tasks each task view week's worth of tasks , subtasks @ time zoom in see particular task in more detail zoom out see whole month's tasks in less detail and last, not least, share data supervisor, can see , make comments / adjustments. i'd know options available , pros/cons of each... i've considered: excel sheet pros: easy share, availability (she , boss both have excel installed) cons: harder maintain , create multiple views of same data. access pros: easy share (perhaps via storage on shared drive), availability cons: ui options not rich, in opinion .net local db file pros: rich ui options, quick development (i familiar .net) cons: availability - both have have app installed, or have live on shared drive somewhere (which option guess..

css - javascript element.style is undefined in FF -

i want set css display property in javascript code: var div = document.createelement('div'); div.innerhtml = content; div.childnodes[0].style.display = ''; it works in ie doesn't in ff. says "style" undefined element div. how can in ff? thanks what content ? if starts white space, there textnode first child , don't have style properties (htmlelementnodes do). you can either: loop on children until either end or find htmlelementnode strip whitespace start of content switch using createelement , friends instead of innerhtml

Javascript namespace and problem with IE7 -

i implemented javascript namespacing solution based on answer stack overflow question: how declare namespace in javascript? let's call isigma-ns.js: var isigma = { messages: { novalidid: "no valid id found", reason: "reason", // etc... }, language: "ca", sign: 2, pause: 400, params: {}, init: function(params) { // etc... }, delay: function(callback) { // etc... }, // etc... signurl: function(cert, url) { // etc... } }; i include script in page, plus other stuff: <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>isigma signature widget</title> <meta http-equiv="content-type" content="text/html;charset=utf-8"/> <!-- required ja

iPhone Icons retina/normal with Ending: @2x.png -

my question tabbar-icons: define standartsized tabbaricons (20x20) , retina resolution i'll add same image in big (40x40) , name xxx@2.png. thats it, right ? cheers simon the retina display has double screen resolution (640px x 960px). appending @2x @ end of image filename allow iphone 4 use images instead. apple developer article: http://developer.apple.com/library/ios/#qa/qa2010/qa1686.html

Swap rows with columns (transposition) of a matrix in javascript -

for instance have matrix this: |1 2 3| |4 5 6| |7 8 9| and need convert matrix this: |1 4 7| |2 5 8| |3 6 9| what best , optimal way achieve goal? see article: transpose array in javascript , jquery function transpose(a) { // calculate width , height of array var w = a.length || 0; var h = a[0] instanceof array ? a[0].length : 0; // in case 0 matrix, no transpose routine needed. if(h === 0 || w === 0) { return []; } /** * @var {number} counter * @var {number} j counter * @var {array} t transposed data stored in array. */ var i, j, t = []; // loop through every item in outer array (height) for(i=0; i<h; i++) { // insert new row (array) t[i] = []; // loop through every item per item in outer array (width) for(j=0; j<w; j++) { // save transposed data. t[i][j] = a[j][i]; } } return t; } console.log(transpose([[1,2,3],[4,5,6],[7,8,9]]));

iphone - Objective-c Novice - Needs help with UIViews -

im new iphone development , after lots of reading on im still trying figure out how uiviews operate properly. have been playing , @ far: i have created new xcode project using view-based application. have mmappviewcontroller classes , created new uiviewcontroller subclass called "level1view". there button titled "level 1" takes me "level1view" viewcontroller. in viewcontroller there there "next" button, "main menu" button (that returns mmappviewcontroller) , there label, titled "level 1". my problem code have used change title of label not work! know why is? here code: @class mmappviewcontroller; @interface mmappappdelegate : nsobject <uiapplicationdelegate> { uiwindow *window; mmappviewcontroller *viewcontroller; } @property (nonatomic, retain) iboutlet uiwindow *window; @property (nonatomic, retain) iboutlet mmappviewcontroller *viewcontroller; @end and @implementation mmappviewcontroller -(

How to check for # of lines using jQuery -

example: div width of 30px words "this text". let's that, since width narrow, renders on page this: this is text (3 lines). there way in jquery tell how many lines takes render page? example, like, $("#container").linecount() . business purpose: if content exceeds number of lines, want manipulate scroll bar not appear, have fixed height, don't want mess overflow css prop. thanks! this tricky can done, if there no specified line-height or other style. involve bunch of moving parts. first, build "sacrificial" container <div> . fill known number of lines of text, 1 character each, , position far off-screen: // calculate height per line $calcdiv = $('<div/>').css({ width: '50px', position: 'absolute', // don't affect layout left: '-2000px' // position far off=screen }).html('a<br />b<br />c<br />d<br />e'); // add 5 lines $('body'

if statement - MySQL - subtracting certain rows of a table and presenting the results alongside other rows -

i have been struggling getting query right hours now. have huge amount of data , want show departments ids 10,15,18 , 25. here, want subtract profits each dept id 18 15, i.e. 15-18. i filter data following query: select * depttable id in(10,15,18,25) , date = '2009-01-25' dept ---------- date ---------------- id ----------------- profit uk ---------- 2009-01-25 ---------- 10 ---------------- 2000 brazil ------- 2009-01-25 ---------- 10 ---------------- 1300 japan------- 2009-01-25 --------- 10 ---------------- 2500 spain------- 2009-01-25 ---------- 10 ---------------- 3200 uk ---------- 2009-01-25 ---------- 15 ---------------- 4000 brazil ------- 2009-01-25 ---------- 15 ---------------- 1700 japan------- 2009-01-25 ---------- 15 ---------------- 3500 spain-------- 2009-01-25 ---------- 15 --------------- 1200 uk ---------- 2009-01-25 ---------- 18 ---------------- 2500 brazil ------- 2009-01-25 ---------- 18 ---------------- 1300 japan------- 2009

c# - Timer in View Model -

i have service class in external assembly, inject class in view model class mef. need call service method every 3-4 seconds view model. i service new data dictionary. dictionary bind listbox in view. , need refresh data listbox in view. in solution use dispatchertimer, absolute begginer in calibur.micto mvvm , wpf. don’t know suitable solution in case. if have advance gratefull. my solution here: [export("mainscreen", typeof(imainviewmodel))] public class mainviewmodel : screen, imainviewmodel { [import] private service _service;//import mef external assembly [import] private connection _conn;//import mef external assembly //this dictionary bind listbox in view private myobservabledictionary<string, user> _users = null; //temp dictionry private myobservabledictionary<string, user> _freshusers = null; private int _selecteduserindex; private dispatchertimer _dis

c# - Issues with Updating EF 4 Proc in Model Browser -

i'm having issues updating select stored procedure in model browser. deleting function import , proc isn't updating object correctly. what's happening when remap it, says function returns no columns. execute in sql, , returns data associated columns fine. i don't understand why ef having problems; able map correct way. when deleting complex object found similar issue, not using dynamic sql. using function though: entity framework 4: selected stored procedure returns no columns any ideas? i'm assuming allowing entity modeler generate complex type based on results of stored procedure. in stored procedure, try adding set fmtonly off before final select of result set. then, @ end of procedure, set fmtonly on . can remove both statements once entity modeler has generated complex type. more information in this question .

sql - How to change results in Access query? -

i have table, we'll call users. id username type the type field 2 character type, each user either has us, mo, ad. not sure why original developer did this, cannot change method, unfortunately. 1 mike 2 tim ad 3 mark mo instead of returning us, ad... etc types in access, i'd query replace user, replace mo moderator, , replace ad admin. is possible? kind of select * users , if statements within access (if us, user). not sure how proceed? you can create table user, mo moderator etc mappings , use in join. lot easier maintain, extend (i.e. different languages) hard-coding drawback need maintain mapping table.

xml - JAXB 2 annotation and XSD -

in jaxb 1.0 era, recommended way of working java object, xsd , xml start xsd definition, use jaxb generate java classes xsd , maintain xsds. but jaxb 2.0 annotations, it's convenient generate xsds java classes. recommended take approach of starting java classes , annotations , generate xsd's? thanks, i recommend developers start object model , annotate desired xml. gives more flexibility when creating application (such mapping database using jpa). need generate xml schema when want share structure (for example part of wsdl). check out blog examples of jaxb starting model classes: http://bdoughan.blogspot.com

Java-based workflow solutions -

we use sequential workflow process documents. have total of 10 distinct workflow steps. have re-analyzed workflow , realized restructure workflow process in parallel number of workflow steps. able process steps 1,2,3,4 in parallel, wait until steps 1-4 completed , process step 5, process steps 6,7,8,9 in parallel wait until steps 6-9 completed , process step 10. if able implement new workflow boost our processing throughput dramatically. my question is: java-based open-source workflow projects recommend? typically support outlined above? thanks replies. after taking quick @ the websites have listed think have more enough chew on while. i have used jbpm , , it's pretty nice. has parallel processing (forking) , waiting tasks done (joining) workflow. the latest version supports standard notation business processes - bpmn 2.0

reverse - Context-free grammar and Reversal -

i'm designing context-free grammar generate language: { w in {a,b}* | w of form uvu^r, u , v strings in {a,b}* } i define first 2 strings as: u -> au | bu | _ v -> av | bv | _ and combine those: s -> uv but how express reversal context-free grammar? you need make use of context-free-ness of grammar (what you're presenting far regular grammar): u-> aua | bub | | b | _ will match things "ababa" , "aabaa", not "aabba". i'll leave alter needs - keep in mind specified language has possibility of u being empty string, hence generates strings in {a,b}* .

iphone - xcode debugging goes back and forth during stepping through the code -

i have weird problem xcode 3.2.5 in normal code sequence xcode steps couple of lines continues, again , continues again during step mode. this happens in 1 project, there in files. here example: when jumping in function xcode goes through lines in following sequence: 2 -> 1 -> 2 -> 3 ->5 -> 8 -> 3 -> 4 -> 5 -> 6 -> 7 ->... i dont understand going on here. please have idea? rebooting machine , iphone doesn't help. by way, complete code works fine , runs without errors. seems cursor goes lines code not being executed. if line entered twice cursor, second time changes variables in assignments etc.. really weird! thanks hint... 1 - (void)viewwillappear:(bool)animated { // d_in; 2 [super viewwillappear:animated]; //get datamanager global object, have structured accesss data! 3 webiappdelegate *maindelegate = (webiappdelegate *)[[uiapplication sharedapplication]delegate]; 4 self.webidatamanager = maindelegate.webidatamanager;

ruby - HAML and iterated XML -

i'm trying generate xml file. i've got tags repeat numerically so: # necessary xml namespace , metadata stuff... %img{:src => "foo002.jpg#full"}/ %img{:src => "foo003.jpg#full"}/ %img{:src => "foo004.jpg#full"}/ %img{:src => "foo005.jpg#full"}/ # , on few hundred lines %img{:src => "foo435.jpg#full"}/ i'm given "foo" , ending number (435 in case) parameters. how go telling haml this? thanks edit : forgot mention, leading zeros important. - 2.upto(435) |n| %img{:src => "foo%03d.jpg#full" % n} or - (2..435).each |n| %img{:src => "foo%03d.jpg#full" % n} proof: phrogz$ haml !!! xml %root - 2.upto(10) |n| %img{ src:"foo%03d.jpg" % n } ^d <?xml version='1.0' encoding='utf-8' ?> <root> <img src='foo002.jpg' /> <img src='foo003.jpg' /> <img src='foo004.jpg'

asp.net - Browser displaying "Directory Listing -- /" -

i'm developing simple asp.net application giving me annoying error. i'm having textbox- , button-control, text in textbox saved database table when clicking button. text propagated database means of wcf service. since i'm rather mediocre programmer, tend errors , results in lots of error messages displayed in browser. can understand. fix them , build solution , press f5 going. after fixing errors, everytime browser displays directory listening 1 below instead of astonishing ui. directory listing -- / monday, december 20, 2010 10:10 pm <dir> bin saturday, december 18, 2010 10:10 pm 1,303 mainform.aspx monday, december 20, 2010 10:28 pm 467 mainform.aspx.cs saturday, december 18, 2010 10:09 pm 2,118 mainform.aspx.designer.cs friday, december 17, 2010 10:25 pm <dir> obj friday, december 17, 2010 10:25 pm <dir> properties sunday, december 19, 2010 10:09 pm <dir> service references monday,

How to create modules in C -

i have interface want able statically link modules. example, want able call functions (albeit in seperate files) called foo or match prototype, make call function in file without header in other files. dont impossible since found hack can it, want non hacked method. (the hack use nm functions , prototypes can dynamically call function). also, know can dynamic linking, however, want statically link files. ideas? this common in writing test code. e.g., want call functions start test_. have shell script grep's through .c files , pulls out function names match test_.*. script generates test.c file contains function calls test functions. e.g., generated program like: int main() { inittestcode(); testa(); testb(); testc(); } another way use linker tricks. linux kernel initialization. functions init code marked qualifier __init. defined in linux/init.h follows: #define __init __section(.init.text) __cold notrace this causes linker put fun

entity framework 4 - Ordering sub-collections in an EF/LINQ query -

i having trouble figuring out how (and where) order subcollection in linq/ef query. basically have collection of subscriptiontypes, each having own collection of subscriptions. each subscription in collection ordered numberofmonths. here current query: public iqueryable<subscriptiontype> subscriptiontypesbyproperty(string propertycode) { return in db.subscriptiontypes.include("subscriptions") a.subscriptions.any(x => x.propertycode == propertycode) select a; } i subscriptions ordered numberofmonths. tried this: public iqueryable<subscriptiontype> subscriptiontypesbyproperty(string propertycode) { return in db.subscriptiontypes.include("subscriptions") a.subscriptions.orderby(q => q.numberofmonths).any(x => x.propertycode == propertycode) select a; } .. did not order subscriptions correctly. does know of easy way this? update: subscriptiontype , su

sanitize data for SQL with JavaScript -

i have bunch of forms have various input elements. want sanitize these on server side ( yes , i'm using server-side javascript) use these inputs parameters, , prevent special characters malformed. before go, "this belongs not in realm of javascript", etc., etc. i using multi-million licensed software solution, has javascript apparently has no standard functions out of box. so, whatever using, can assure you have never touched or heard of it. , supports server side javascript, because well, language cool. my first objective sanitize data before goes in database, , love way example how ruby labels foreign data: tainted. , rather have no tainted data. google , copy paste poor regex here , there, , got sad example. however, have function said "well, takes off 70% of possible stuff data , pretty darn sanitize". basically string these elements should escaped , assume best practices existing wish of mine. function sanitize(mystring) { ... ; return mystrin

Return the contents of an image in php file? -

i not know php i'd love 1 simple thing: access php page within <img src="/myhumbleimage.php" /> , i'd have image returned url. i came with: <?php header('content-type: image/png'); readfile('i' . rand(1,3) . '.png'); exit; and works: avatar selection http://vercas.webuda.com/img.php?.png (reload page few times!) check out readfile() . the basic idea send appropriate mime type headers (using header()) deliver file contents using readfile() . for example <?php // myhumbleimage.php // whatever myhumbleimage.php before image delivered header('content-type: image/jpeg'); readfile('path/or/url/of/image/file.jpg'); exit;

c# easiest way to extract substring -

i have string: string somestring = "\\\\tecan1\\tecan #1 output\\15939-e.esy" i need extract 15939 it 5 digit number, preceeded '\' , "-" after it string result = path.getfilename("\\\\tecan1\\tecan #1 output\\15939-e.esy").split('-')[0]; perhaps?

How to identify a country from a normalized phone number? -

i have list of international phone numbers , list of country calling codes . identify country numbers can't find fast , elegant way it. any idea? got have hardcoded check (eg. "look @ first number, @ second number: if it's x check third number. if second number y country foo", etc.). i'm using php , db (mysql) lists, think pseudocode help. i after similar this, wanted determine region/state - if available. in end hacked based on tree of digits leading digits (spurred on description @ wikipedia ) my implementation available gist .

r - Optimizing apply function output -

i have following function: library (reshape) phenotype <- rnorm (100) data <- matrix(rnorm(1000), nrow = 10, ncol=100) spearman.p <- reshape( melt( apply(data, 1, function(y){ cor.test(y,phenotype,method="spearman") }[c("p.value", "estimate")] ) ), timevar="l2", idvar="l1", direction="wide" ) that know if there more efficent way of getting out p.value , estimate "apply"ed cor.test can provide suggestions? this more compact , delivers p.values duplicated data. wanted?: dtt <- do.call(rbind, apply(data, 1, function(y){ cor.test(y,phenotype,method="spearman") }[c("p.value", &qu

DatePicker not responding to user input from Keyboard in Android -

i have datepicker in activity. works fine except when user enters date via keypad , not use + or - buttons change date. date returned when user edits via keyboard datepicker initialized with. when debug notice ondatechanged() callback never called except when date change using buttons. yep, meet issue too. datepicker save change if remove focus active edittext. have run "mdatepicker.clearfocus();" before date it.

database - do I need multiple tables or single? -

i developing tool may got more million data fill in. current have designed single table 36 coloumns. question need divide these multiple tables or single?? if single advantage , disadvantage if multiple advantage , disadvantage and engine use speed... my concern large database have atleast 50000 queries perday.. any help?? yes, should normalize database. general rule of thumb if column isn't foreign key contains duplicate values, table should normalized. normalization involves splitting database tables, , helps to: avoid modification anomolies. minimize impact of changes data structure. make data model more informative. there plenty of information normalization on wikipedia . if have serious amount of data , don't normalize, come point need redesign database, , incredibly hard retrospectively, involve not changing code accesses database, migrating existing data new design. there cases might better avoid normalization performance reasons,

ruby - Mapping multiple test classes to the same file for autotest -

i'm using standalone autotest in projects along minitest . in 1 of projects, have single file ( validation.rb ) validates document different internal format levels. (a level 2 document has more features level 1 document.) testing validation particular level requires repeatedly loading in known-valid document, subtly mutating in broken way, , ensuring broken. in short: class testvalidation < minitest::unit::testcase def setup @l1 = document.load( l1doc ) end def test_valid assert @l1.valid_level_1? end def test_unbalanced_data @l1.instance_eval{ @tracks[0].data.pop } refute @l1.valid_level_1?, "validation must ensure tracks have same amount of data" end # many more tests level 1 here end the problem autotest (as far can tell) knows tests run based on name of test classes. testvalidation have tests automatically run when validation.rb changed. without autotest, have named above class testl1validation , , created new class test

php - htaccess configuration - With CodeIgniter - A3M library -

i downloaded a3m, comes packaged ci 1.7.2 went ahead , removed of files needed run , put them in pre-existing installation. after going a3m controller on site received: message: undefined property: ci::$session so assume it’s because of htaccess looking a3m files in a3m folder, here’s a3m htaccess: rewriteengine on rewriterule ^$ /a3m/index.php [l] rewritecond $1 !^(index\.php|css|img|js|scripts|system|uploads|robots\.txt|favicon\.ico) rewriterule ^(.*)$ /a3m/index.php/$1 [l] and existing htaccess mod rewrite follows: <ifmodule mod_rewrite.c> rewriteengine on rewritebase /beta/ #removes access system folder users. #additionally allow create system.php controller, #previously not have been possible. #'system' can replaced if have renamed system folder. rewritecond %{request_uri} ^system.* rewriterule ^(.*)$ /index.php?/$1 [l] #when application folder isn't in system folder #this snippet prevents user access appl

GIT re-merge files from dev to master -

my master git branch seams have errors i'd recheck, re-merge or possibly clone dev branch on master branch master branch copy of dev. how can that? thx. if problem checked-out files don't match branch, use git reset normally: git reset --hard head that should need. however, if still want overwrite master dev, read on. if want overwrite master branch contents of dev branch, use git reset so: $ git checkout master $ git reset --hard dev and if want push somewhere else: $ git push origin master note if dev branch doesn't fast-forward master branch (which i'm guessing won't, since said master branch has screwed stuff in it), you'll need add --force flag push overwrite on remote: $ git push origin master --force note, however, can involve of normal caveats of rewriting history la git rebase - if else uses remote, they'll need deal equivalent of upstream rebase. to avoid problem in future, advise friend using --force nev