Posts

Showing posts from April, 2011

How to get and change encoding schema for a DB2 z/OS database using dynamic SQL statement -

a db2 z/os database has been setup me. want know encoding scheme of database , change unicode if database other type of encoding. how can this? can using dynamic sql statements in java application? thanks! you need specify encoding scheme unicode when creating table (and database , tablepsace) using ccsid unicode clause. according documentation: by default, encoding scheme of table same encoding scheme of table space. default, encoding scheme of table space same encoding scheme of database. can override encoding scheme ccsid clause in create tablespace or create table statement. however, tables within table space must have same ccsid. for more, see creating unicode table in db2 z/os documentation . you able create tables via java/jdbc, doubt able create databases , tablespaces way. wouldn't recommend anyway, find closest z/os dba , person you.

Rails 3 submit form with link -

how can submit form link on correct rails 3 format? thanks. <%= form_for @post |f| %> <%= f.label :title %><br> <%= f.text_field :title %> <p><%= f.submit %></p> <% end %> my code sample. "correct" tricky word in context ;) . 1 ask why you're not taking button element , make link? anyways — can't achieve plain html (at least not knowledge). javascript framework e.g. jquery this: $('a').click(function(){ $('form').submit(); return false; }); rails 2.3.x had link_to_remote helper let's specify :submit parameter (= dom element's id, default parent form). able write: link_to_remote 'submit', :url => {…}, :submit => "my_form" but rails 3's push ujs, helper gone.

How to make a div not scroll off the page using jquery -

basically have structure this: <body> <div> main content </div> <div> toolbar </div> <div> results </div> when scrolling down, want "main content" disappear off screen. 'toolbar' stay flush top of page, , 'results' scroll, disappearing 'toolbar' scroll. edit: toolbar starts off in middle of screen. want scroll top, no further, rest of page (below) keeps scrolling. i found tutorial http://www.wduffy.co.uk/blog/keep-element-in-view-while-scrolling-using-jquery/ but different. in example above, although toolbar stays near top, prevents results being scrolled. i have position:fixed; toolbar. way stay fixed in view. <body> <div> main content </div> <div style="position:fixed;"> toolbar </div> <div> results </div>

Iphone app - How to show the digital clock with current time -

hello working iphone app need show current time in watch there watch displays static time or static image . need find current time move hrs,mins ,seconds pins such tht should set time. u have ideas here code: //calculate angles: float minutesangle = (0/60)*360; float hoursangle = (10/12)*360; //begin animation block [uiview beginanimations:@"movehands" context:nil]; [uiview setanimationduration:0.5]; minsimageview.transform = cgaffinetransformrotate(minsimageview.transform, minutesangle); hoursimageview.transform = cgaffinetransformrotate(hoursimageview.transform, hoursangle); [uiview commitanimations]; where minsimageview ,hoursimageview imageviews set in xib shows static image but not effecting @ all.. once have individual time values (it sounds you've figured out already) can position hands needed. this means it's time brush on math skills. think this'll give start: a circle has 360 degrees in it. means whatever time unit g...

java - fetching values from class -

i new java. problem is i have created class database connections.now want access class methods in class.so have created object of class. when using object access methods of database class showing error "dbcon(object) cannot resolved type" i can't understand issue. please help. make valid reference. the error getting because code uses class not able reference class. if these classes in different packages, need add import line top of class you're working in import dbcon class. you should aware case matters. dbcon not same dbcon . in java, standard class names should begin uppercase letters , variables lowercase letters. so, class dbcon @ least named improperly. standard helps identify , resolve problems 1 you're having before ever happen. finally, highly suggest work sort of ide eclipse . software can make development process easier helping solve common problems these through suggested steps.

iphone - Multitouch don't work in cocos2d -

this cctouchesmoved method. whats wrong? use cocos2d framework. -(void) cctouchesmoved:(nsset *)touches withevent:(uievent *)event { ccnode *sprite = [self getchildbytag:ktagplayer]; ccnode *sprite2 = [self getchildbytag:ktagenemy]; cgpoint point; //Собрать все касания. nsset *alltouches = [event alltouches]; (uitouch *touch in alltouches) { point = [touch locationinview:[touch view]]; point = [[ccdirector shareddirector] converttogl:point]; if (point.y > 384) { if (point.x > 992) sprite2.position = ccp(992, size.height - 100); else if (point.x < 32) sprite2.position = ccp(32, size.height - 100); else sprite2.position = ccp(point.x, size.height - 100); } else { if (point.x > 992) sprite.position = ccp(992, 100); else if (point.x < 32) sprite.position = ccp(32, 100); else sprite.position = ccp(point.x, 100); } }...

ruby on rails - The scope of custom helper -

i have defined helper function in helper: module carshelper def my_helper ... end end but can neither used it(my_helper) in carscontroller nor in car model, custom helper can used in view? helpers views. can include them in controllers well. add helper :cars to controller. ( docs ) models out of scope helpers. use class or instance methods in there instead.

asp.net mvc 3 - Razor reference for VB.Net? -

mvc 3 great in cases having trouble translating razor syntax. know of vb.net razor reference? here's good resource might take at.

c# - How do I update changes in a datagridview back to the database? -

i use datatable source datagridview. how save changes made in datagridview database? i think have call update method of adapter when want save changes. http://msdn.microsoft.com/en-us/library/system.data.common.dataadapter.update%28v=vs.100%29.aspx

Installation of Visual Studio 2010 Service Pack 1 Beta and Asp.net MVC 3 -

has tried install beta sp1 vs2010 , mvc3 @ same time? safe install, or better wait rtm of sp1? remember reading issues mvc3 rc2 , sp1 beta. there problem vs2010 sp1 beta , mvc 3 rc (what became rc1 - planning 1 rc until problem came up) affected razor intellisense. resolved second rc release of mvc 3. there no issue mvc 3 rtm , vs 2010 sp1 beta. source - see "beta caveats"

c# - DataGrid CellStyle Setters with Freezable StaticRecource -

i wanted set command of button in wpf datagrid setter. seems dp property commandproperty gets ovewritten default value null after returned copy in createinstancecore() , original command gets lost. if bind staticresource directly works without problems. there way stop behavior or solution? public class resourcecommand : freezable, icommand { public icommand command { { return (icommand)getvalue(commandproperty); } set { setvalue(commandproperty, value); } } // using dependencyproperty backing store command. enables animation, styling, binding, etc... public static readonly dependencyproperty commandproperty = dependencyproperty.register("command", typeof(icommand), typeof(resourcecommand), new uipropertymetadata(null, commandpropertychangedcallback)); static void commandpropertychangedcallback(dependencyobject d, dependencypropertychangedeventargs e) { resourcecommand resourcecommand = (resourcecommand)d; ...

Implementing asynchronous file system with FUSE on Linux -

i tried ask on fuse's mailing list haven't received response far... have couple of questions. i'm going implement low-level fuse file system , watch on fuse_chan 's descriptor epoll. i have fake inodes objects in file system right? there rules choosing inodes objects in vfs (e.g. have use positive values or can use values in range)? can make fuse_chan's descriptor nonblocking? if yes, please tell me whether can assume fuse_chan_recv() / fuse_chan_send() receive/send whole request structure, or have override them functions handling partial send , receive? what buffer size ? see in fuse_loop() new buffer allocated each call, assume buffer size not fixed. maybe there maximum possible buffer size? can allocate larger buffer , reduce memory allocation operations. (1) inodes defined unsigned integers, in theory, use values. however, since there programs not careful, i'd play safe , use non-zero, positive integers int_max. (2) fuse uses special k...

zend framework - Switching db connection in Doctrine models -

i'm researching zend+doctrine performance on existing shard database system. of application models connect main database (db1) whilst models need dynamically connect different databases (db2, db3 etc.) of models connect different database, need easy way switch connection. there method in doctrine_record can override provide new connection instance? no need override anything. simple create many connections need (per default, should have 1 connection has name, have n connections different names. $conn1 = doctrine_manager::connection('mysql://username:password@localhost/database1', 'connection1'); $conn2 = doctrine_manager::connection('mysql://username:password@localhost/database2', 'connection2'); different models can bound different connections. put them in base models. doctrine_manager::connection()->bindcomponent('your_model', 'connection1'); alternatively, can use method of connection manager setcurrentc...

php - Drupal content sync -

i have 3 drupal sites. 2 of drupal sites public site (.com site), third 1 internal site behind firewall. site behind firewall runs in linux , mysql, pull data office ms-sql , create nodes it. questions is: how can update other 2 drupal sites content office drupal site? note: might not need same fields in public sites in internal one. have setup not push content 2 external sites, if internal site update node, have content update in external sites well. thank you. you use feeds module on external sites poll the office site content , import new , updated content. since may not need fields on external sites, feeds let map fields want office site, fields want stored on external sites. depending on data needed make available office site, might need customize available feeds, using views .

ruby - Streaming web uploads to socket with Rack -

i have sinatra app running in fcgi handler. want write handler sit within rackup file (probably in front of sinatra app) , stream big file uploads server via sockets (without buffering on disk first) , in interlock request. kind of stream-decode-send workflow without param preparsing. i've read somewhere there problem because due way rails team wants see middleware pipeline uploads in rack have been made rewindable implies upload buffered, not cannot provide upload progress within rack have buffer file on disk , send downstream. is there cross-backend solution ties request loop of webserver rack responder , not force rewinding on input (and not force in-memory buffering of upload absolute stupid madness)? current approaches kind of problem? you right: rack spec mandates rewindable input, implies buffering. seems rack not tool job. you may want try fastcgi, indeed allow non-buffered streaming. or maybe java servlet. 2¢: need it? if not, don't worry, disk space c...

c# - Modern UI desktop design using .NET -

Image
wondering how create such app microsoft expression blend 4, modern design. very interested scroll , tab panel. scroll modern look, small , thin, unlike wide scroll bars found in windows explorer. expression blend 4 windows presentation foundation (wpf) application. wpf allows customize every aspect of ui (including scrollbars if you'd like). since call out scroll panels, here's tutorial shows how customize of scroll bar modifying wpf template: sachabarber.net >> styling scrollviewer/scrollbar in wpf the nice thing wpf once understand how modify things changing template, can use same method change look/feel of anything.

Can the NServiceBus distributor report progress from workers? -

i investigating nservicebus , unsure how (or if) use handle scenario: i have multiple clients sending work requests, distributor farms out workers. work take long time complete , workers report progress client sent original request. i have looked @ full duplex sample , how add distributor sample . i've got these working, when modify them reply series of progress messages (with delay between messages, per code shown below), client receives progress messages @ same time. public class requestdatamessagehandler : ihandlemessages<requestdatamessage> { public ibus bus { get; set; } public void handle(requestdatamessage message) { (var = 0; < 10; i++) { var count = i; var response = this.bus.createinstance<dataresponsemessage>(m => { m.dataid = message.dataid; m.progress = count * 10; }); this.bus.reply(response); ...

exception - java.lang.ClassCastException problem -

i want ask, why java.lang.classcastexception triggered in program ?? i not sure reason this, could mind giving advice me? thanks lot!!! <%@ page contenttype="text/html; language=java"%> <%@ page import="java.io.*" %> <%@ page import="java.sql.*" %> <%@ page import ="javax.sql.*" %> <%@ page import="java.util.*" %> <%@ page import="java.lang.*"%> <%! public class goods implements comparable{ private string id = null; private string name = null; private float price = 0.00f; private int number = 0; private string percent = null; public goods(string id,string name,float price,int number,string percent){ this.id = id; this.name = name; this.price = price; this.number = number; this.percent = percent; } public string getid() { return this.id; } public string getname() { ret...

javascript - Why is "$" a valid function identifier? -

possible duplicates: can explain dollar sign in javascript? why javascript variable start dollar sign? why can assign function $ in javascript, not # or ^ ? from ecma standard (section 7.6) the dollar sign ($) , underscore (_) permitted anywhere in identifiername .

Detecting input keystroke during WPF processing -

greetings, i want write code executes within event handler, inside wpf windows application, can detect keypress, "escape" character keypress, within processing loop. allow user escape processing. realize may accomplished kind of multi-threaded approach, problem seems simple wondered if might accomplished follows: // attempt 1: see if keyboard static iskeydown method detects key presses while executing. // note not successful. keyboard states not appear updated during processing. bool iskeypressed = false; while (!iskeypressed) { system.threading.thread.sleep(1000); if (keyboard.iskeydown(key.enter)) iskeypressed = true; } so, on attempt #2. saw articles , samples using pinvoke "getkeyboardstate" method. i'm not sure used method correctly, here attempt. bit clumsy refer windows.forms enumeration in wpf application, seems work. // attempt 2: use pinvoke getkey...

.net - Binding a listbox with value and text -

i creating listcollection this: dim rislist new listitemcollection dim cuser new clsuser() dim ds dataset = cuser.getuserris(1) each row in ds.tables(0).rows dim li new listitem li.text = clookup.getxname(row.item("xcode")) li.value = row.item("xcode") rislist.add(li) next i need bind dropdownlist it ddlris.datasource = rislist ddlris.databind() however text , value in drop down, both show text. when debug above code li.value = row.item("riscode") shows code correctly, why not reflect when try bind dropdown list? why don't add directly listbox/dropdownlist workaround, way should work though. dim rislist new listitemcollection dim cuser new clsuser() dim ds dataset = cuser.getuserris(1) each row in ds.tables(0).rows dim li new listitem li.text = clookup.getxname(row.item("xcode")) li.value = row.item("xcode") ...

Search Ada Lib for open a file over http -

i'm searching library can include in program open file given internet address. http://foobar.com/foobar.txt . like ada.text_io.open (file, ada.text_io.in_file, "bla.txt"); not limited on local files. well, aren't liable find exact interface, text_io standard library , can't extended third parties in way. if platform's underlying filesystem support http, work want. don't know of platform works way however. what want general solution aws (ada web server) . person use implement full-blown web server if want, contains http client facilities. http client want (see aws.client). bit more work on part making 1 standard api call, no work. here's example, cribbed rosetta code : with ada.text_io; use ada.text_io; aws.client; aws.response; procedure http_request begin put_line (aws.response.message_body (aws.client.get (url => "http://www.rosettacode.org"))); end http_request;

cygwin - Fixing colors in XCygwin emacs -

i using emacs 23 in cygwin x, , colours nothing should be...e.g. in color-theme-gray30, background chocolate brown rather gray30. suspect might have export setting in cygwin bat file, can't find out should be...any ideas? thanks! i doubt problem emacs or cygwin. think may problem how monitor adjusted (or angle viewing if lcd). emacs uses same color references x11 (found in rgb.txt). did quick check reference page ( enter link description here ) vs. emacs 23 in x11 under cygwin, , colors match. isn't "chocolate brown" normal monitor setup, can change tint playing color controls on monitor.

debugging - Using gdb from inside process to get stack trace -

in code have runtime assert macro (let's call runtime_assert). should in multi threaded application. when condition passed evaluated false, runtime_assert terminates program dumping stack trace , followed calling _exit(). as know, dumping stack trace isn't trivial task ( how stack trace c++ using gcc line number information? ). the idea invoke gdb pid of process calling system(). is idea in general? or it's better use process tools backtrace? (e.g. gcc backtrace()/backtrace_symbols()) when ptrace() invoked, somehow effect other threads? if system out of resources (e.g. memory/disk space) may gdb fork fail? how print stack trace of current thread only? (i can address of current method gcc backtrace()) don't think idea - time system() done , gdb attaches other threads way beyond trouble point. don't think bothering stack trace worth in case (it might when give app "less-sophisticated" users , any info out of them useful). here...

geolocation - How to get the location of a web request? -

what's best way location (to country level) of web request coming from? there 3 ways, speaking: use geoip or similar database or service maps ips physical locations use w3c geolocation api (supported newer browsers only) google gears geolocation

java - How do I upload a new version of my project to SVN (eclipse)? -

Image
i have java project in svn server. created whole new version of , want "commit" keep previous version on server. i'm not allowed use branches on project. i've changed new project's name projectname_improved . created new folder project on server. want upload projectname_improved new folder. i'm using eclipse (+svn plugin). how technically (without branching)? edit: plugin i'm using subclipse . in eclipse, go svn repositories perspective. right click on folder in want put new (improved) project. import (to import project server). browse... find project on computer. ok. ok. that's it. new (improved) project being uploaded server. done.

webforms - Javascript form specification -

i have multiple forms on web page created using javascript , populate field in appropriate form value (startdate). i have tried following code: oform = document.forms['bookingform' + fleetid]; oformelement = oform.elements['startdate']; oformelement.value = startdate; ...but error "oform.elements null or not object". until have been using document.getelementbyid('startdate').value instead of creating forms object. correct approach when specifying form value should populate? form.elements plain array. either know index or have search it. form = document.forms['bookingform' + fleetid]; oformelement = oform.elements[0]; // index of element oformelement.value = startdate; if have search it's this: form = document.forms['bookingform' + fleetid]; var oformelement; (var = 0, len = oform.elements.length; < len; ++i) { if (oform.elements[i].name == "startdate") { oformelement = oform.elemen...

SQL Server 2005 how to use pivot instead of a bunch of case statments? -

please show me how can modify sql select use pivot instead of case testaments. select t.projectid, coalesce(max(executivechampion), 'n/a'), coalesce(max(businessowner), 'n/a'), coalesce(max(businessanalyst), 'n/a'), coalesce(max(generalcontractor), 'n/a'), coalesce(max(primarypm), 'n/a'), coalesce(max(developmentmanager), 'n/a'), coalesce(max(developmentlead), 'n/a'), coalesce(max(tdm), 'n/a'), coalesce(max(ptm), 'n/a') ( select pl.projectid, case when stakeholdercid = 95 fullname else null end 'executivechampion', case when stakeholdercid = 96 fullname else null end 'businessowner', case when stakeholdercid = 97 fullname else null end 'businessanalyst', case when stakeholdercid = 100 fullname else null end 'generalcontractor', case when stakeholdercid = 101 fullname else null end 'primarypm', case when stakeholdercid = 102 fullname else null end 'developmentmanager...

c++ - How to write a good program for blocking unwanted / harmful websites -

i intend write simple application block network traffic (http , https) unwanted / malicious web sites. assumptions: at beginning logic simple. after entering in browser address "black list" logic should take control under communication , send defined me site contents later want add logic search web body looking unwanted / harmful words the program written in c++ i not want use existing libraries (open source etc.) write scratch. j want learn windows network mechanism , layers unfortunately, layman when comes play network layer in windows. where start? , how should inject filtering logic? you should windows filtering platform . api gives access network stack @ low level.

mysql - Omitting Wikipedia maintenance categories from sql query -

i retrieving list of categories given page_title, results include categories such as: "all_articles_to_be_split" "articles_with_unsourced_statements_from_july_2008" "all_articles_with_specifically-marked_weasel-worded_phrases" ...etc...i wish omit these types of categories maintenance. here example sql call making: select categorylinks.cl_to categorylinks join page on categorylinks.cl_from = page.page_id , page.page_namespace = 0 , page.page_title = "ice_hockey"; what missing in query omit maintenance categories? or have manually parse these out of results? thanks. i did manually this: select categorylinks.cl_to categorylinks join page on categorylinks.cl_from = page.page_id , page.page_namespace = 0 , cl_to not '%article%' , cl_to not '%article%' , cl_to not '%wikipedia%' , cl_to not '%redirect%' , cl_to not '%page%' , cl_to not '%redire...

c# - Order the lines in a file by the last character on the line -

can please me this: want build method in c# order lot of files following rule every line contains strings , last character in every line int. want order lines in file last character, int. thanks to order ascending last character, interpreted integer do: var orderedlines= file.readalllines(@"test.txt") .orderby(line => convert.toint32(line[line.length-1])) .tolist(); edit: with clarification in comment - integer following space character, can more 1 digit: var orderedlines= file.readalllines(@"test.txt") .orderby(line => convert.toint32(line.substring(line.lastindexof(" ")+1, line.length - line.lastindexof(" ")-1))) .tolist();

c - Why am I getting a memory access violation here? -

this file part of goahead webserver , implements fast block allocation scheme. at line 284 web server process crashes, @ random times. } else if ((bp = bqhead[q]) != null) { /* * take first block off relevant q if non-empty */ bqhead[q] = bp->u.next; //memory access violation here what possible reasons this? edit bp pointer structure , union in this header file typedef struct { union { void *next; /* pointer next in q */ int size; /* actual requested size */ } u; int flags; /* per block allocation flags */ } btype; thanks. here's possible reasons. you've screwd , corrupted of data structures or stack. bqhead null or invalid pointer q outside bounds of bqhead bp null or invalid pointer step through code debugger, or use printf debugging, , see if values if bqhead,q,bp should be.

iphone - NSURLConnection synchonous methods from within NSOperation -

suppose have multiple nsoperation objects attached concurrent queue. within these nsoperations, call synchronous method of nsurlconnectionclass, sendsynchronousrequest ... not mess code tracing different connections within single delegate. apple says sendsynchronousrequest ... going automatically create separate thread run loop trace nsurlconnection delegate messages. but have several additional threads (running inside nsoperation )! question is: if have, say, 10 nsoperation objects , each call synchronous method of nsurlconnection , produce 10 more additional ("automatically created") threads run loops or there one of them? don't worry thread nsurlconnection creates. internal detail. i'm pretty sure 1 global thread shared nsurlconnection instances.

c# - Get users NT Credentials in Winform App -

i have winform app requires me check whether page exists on our wiki or not. however, query requires users network credentials passed. i don't want hardcode credentials, , don't want users have manipulate app.config everytime else uses (there's issue of them having expose password in app.config). there way can current user's nt credentials? don't need see (that obvious security issue), need following line of code: httpwebrequest wikipagerequest; wikipagerequest.credentials = new networkcredential("user", "pass", "dom"); //maybe wikipagerequest.credentials = getntcredentials(); can try using credentialcache.defaultcredential ? seems current logged in users credential.

android - Why is my rotate animation all wonky when applied to an Activity transition? -

what below animation supposed do? <?xml version="1.0" encoding="utf-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromdegrees="0" android:todegrees="360" android:pivotx="50%" android:pivoty="50%" android:interpolator="@android:anim/linear_interpolator" android:duration="1000" /> easy enough. should represent clockwise rotation centre. spin around once, stop. right? and does... when apply view. but when animate activity transition instead, entirely different happens. activity starts rotate counterclockwise , @ same time flies off top right of screen. comes back, still rotating counterclockwise , upside-down, , flies off bottom left of screen. finally, comes , ends rotation upright. no matter specify pivotx , pivoty , behaviour same. seem ignored completely. , either way, thing not rotating around fixed pivot @ all...

c# - simple asp.net login page -

i needed create simple fast login form internal company project i'm working on. saw this tut on how using vb - looked fast , easy. ran through converter change c# when load page, error get: cs0103: name 'session' not exist in current context with following code: <script runat="server"> public void login(object s, eventargs e) { if (tbusername.text == "admin" & tbpassword.text == "admin") { session("admin") = true; response.redirect("dashboard.aspx"); } else { session("admin") = false; litlogin.visible = true; litlogin.text = "<p>sorry have provided incorrect login details.</p>"; } } </script> edit adding brackets helps on login page, on page im trying protect have check session this: <form id="form1" runat="server"...

javascript - Any Lightbox for Cross-Domain Iframe -

searching alot on topic no solution... :( looking lightbox pictures in cross domain environment thankx in advance. i'm not sure you're asking here, if you're looking circumvent cross-domain js restrictions, can create php page (or similar) on server fetches images domain , serves them local. here jquery code change image object's src attribute show specific picture. lets want show image http://www.someotherdomain.com/images/pictureofbacon.png .... var urlstr = 'http://www.someotherdomain.com/images/pictureofbacon.png'; //encode image's url passing var url_enc = encodeuricomponent(urlstr); $('#imagebacon').attr( 'src', 'http://www.yourdomain.com/getphoto?url=' + url_enc ); //call php page, passing encode image url then, in php page, can url , process image locally. php tested work (requires gd2), assuming pass valid image url. getphoto.php <?php $url = $_request['url']; sendimagetob...

Having problems getting data out of an xml element in Python -

i parsing xml output program. here's example of xml fragment: <result test="passed" stamp="2011-01-25t12:40:46.166-08:00"> <assertion>multipletesttool1</assertion> <comment>multipletesttool1 passed</comment> </result> i want data out of <comment> element. here code snippet: import xml.dom.minidom mydata.cnodes = mydata.rnode.getelementsbytagname("comment") value = self.getresultcommenttext( mydata.cnodes def getresultcommenttext(self, nodelist): rc = [] node in nodelist: if node.nodename == "comment": if node.nodetype == node.text_node: rc.append(node.data) return ''.join(rc) value empty, , appears nodetype element_node, .data doesn't exist new python, , causing me scratch head. can tell me i'm doing wrong? try e...

data binding - How do I access elements within a WPF window to alter them? -

i have wpf window has 2 elements. mediaelement , textblock. want access textblock either change text or toggle visibility. want code. there anyway accomplish other dependency properties , data binding? i've spent hours looking @ dependency properties , data binding , can't wrap head around them or example shows binding other xaml elements. databinding in regards complex , i'm still pretty new @ this. well, can give name textblock , manipulate code-behind of window: <textblock x:name="mytextblock" .../> mywindow.xaml.cs: private void someeventhandler(object sender, eventargs e) { mytextblock.text = "foo"; mytextblock.visibility = visibility.visible; }

javascript - inconsistent line ending behavior on firefox in windows -

we having real bizarre issue, when post, line endings \r\n , when pull value using javascript, gets \n . causing issues, because our system create doing normal form post, , update pulling values form build out ajax request. later, doing string comparison on given field, , seeing strange mix between \r being there or not being there. ie handles fine (always \r\n ), ff on windows submit \r\n , , in javascript report \n . freakin strange though on linux, both firefox , chrome post \r\n , , doing document.getelementbyid('text-area-id').value show \n . is dusty corner of http spec or that? browsers implement windows servers won't die? there way around it, sanitizing every field? expect both js , http posts behave same way, , use system default on whatever system happen on. \r apparently illegal character in dom, why won't see script. firefox converts platform linebreaks \n when set textarea's value. on other hand, when submitting form thinks needs us...

If Java application has a memory leak, the JVM would eventually run out of memory and flag, right? -

i think answer question should yes...but guess i'm not sure, since i'm asking it:) i'm trying determine if webapp has memory leak somewhere. if memory usage continues increase, out of memory error should produced eventually, right? yes. if have substantial leak outofmemoryerror. although, if have small leak, it's possible run long time without running out of memory. depends on size of leak, heap size, , how long servers run before update or restart.

c# - Extracting Byte Arrays from a File -

i'm trying read file , extract 2 blocks of data, let's call them block1 , block2, file file contain many blocks of data. both blocks need returned in byte array. block1 begin @ place in file line begins "block1:" followed number of bytes read. block2, not appearing after block1, begin @ place in file line begins "block2:" followed number of bytes read. limited .net 3.5 @ highest. you can use file.readallbytes , extract blocks returned byte[] using 1 of array.copy overloads if know indexes in.

google app engine - Django version in GAE -

in google app engine documentation , said can use different versions of django: from google.appengine.dist import use_library use_library('django', '1.1') so need download other (>0.96) django versions , put them in application directory, or other place, because django 0.96 included app engine sdk? also, need remove them before uploading project server? can describe process? django 0.96, 1.0.2, , 1.1 available on appengine, 0.96 comes appengine sdk download. can still use 1.0.2 or 1.1, need download , install separately. don't need put in app directory; when upload appengine environment pick copy have.

python - Numpy.genfromtxt method works in windows but not Linux -

i doing data crunching , have built program python in windows , want run on linux box can crunch while go home drink beer, etc. one piece of code (an important one) ingests columnar values csv file via numpy's genfromtxt method. snippet of code in question is: rfd_values = np.genfromtxt(file_in, delimiter=',', skip_header=1, invalid_raise=0, usecols = cols) so idea here is, skip header, delimiter comma, , give me columns list callled cols. works hunky-dorey on windows laptop (same version of python , numpy, 2.6 , 1.5 respectively), when run in linux tells me: *typeerror: genfromtxt() got unexpected keyword argument 'skip_header'* i tried putting on 1 line, , changing quotes around delimiter keyword, didn't seem work. silly, can't seem put finger on it. looked through bunch of forums , numpy docs , didn't see sounded close seeing. wondering missing. i appreciate insight. thanks in advance! -j...

sql server 2008 - Indexing large number of XML files -

i have difficult problem lying before me , thought best seek guidance community before formulating plan of attack on own. i have couple thousand xml files need searchable sql server 2008 database. xml files reside on disk , not part of repository. mean "searchable" need able (psuedo-code here) select * tbl_xmldata contains('xmldata', 'some search word') tbl_xmldata table xml files being stored, , xmldata column actual xml data. the last requirement (and tough one) when hit found (and 'hit' mean xml file found contain term being searched upon) need have access wording surrounds search term found out. instance, if had xml file had following in it: < root> we hold these truths self-evident, men created equal < /root> and searched upon word "self-evident", need able return around 20 characters before , after search term found. bring last point because - in experience anyway - sql server's full-text indexing limite...

Android - setSelected in OnItemClick in ListView -

i trying set item selected in onitemclick event in listview , wouldn't leave item selected. doing wrong? lview.setonitemclicklistener(new onitemclicklistener() { @override public void onitemclick(@suppresswarnings("rawtypes") adapterview parent, view clickedview, int position, long id) { clickedview.setselected(true); mitemsadapter.select(position); } }); few things: 1. trying implement multiple select on list view. 2. cannot extend listactivity because activity extends baseactivity custom class already. 3. mitemsadapter custom itemsadapter adapter extends baseadapter. 4. don't need checkbox in there, able see row selected fine. 5. itemsadapter overrides getview() , sets layout of row inflating xml i don't have time. i'll take again later day. anyway take @ previous questions, struggling same: change listview background - strange behaviour clickable listview in case solution not in there (i th...

ASP.NET Global Class | Global Variables -

i have global.cs within app_code. here variable have set: static string _constring; //connection string public static string constring { { return _constring; } set { _constring = configurationmanager.connectionstrings["breakersconnectionstring"].tostring(); } } when use global.constring in web form code behind comes null. what doing wrong? first, i believe should use configurationmanager.connectionstrings["breakersconnectionstring"].connectionstring http://msdn.microsoft.com/en-us/library/system.configuration.connectionstringsettings.aspx second, did check web.config make sure connection string there? also, need return in acessor. get { return configurationmanager.connectionstrings["breakersconnectionstring"].connectionstring }

php - Is a CMS appropriate for expense tracking website? -

i in initial stages of developing website track expenses should have following functionality: -users can create account -users have own admin section in can... -create categories such 'doctor visit', 'drugs', 'home visit', etc. -for each category, user can enter date , cost in essence, website should enable users track how money spending per month on several aspects of health care. similar in structure to, example, www.dailyburn.com (where create account , can track meal calories, minutes of exercise etc). would cmss joomla, drupal appropriate job? thanks! drupal or joomla both capable of doing asking but, anything, if you've never used them before there's bit of learning curve.

sql - Query where two columns are in the result of nested query -

i'm writing query this: select * mytable x in (select x y) , xx in (select x y) values columns x , xx has in result of same query: select x y . i think query invoked twice senseless. there other option can write query more efficiently? maybe temp table? actually no, there isn't smarter way write (without visiting y twice) given x mytable.x , mytable.yy matches may not same row. as alternative, exists form of query is select * mytable exists (select * y a.x = y.x) , exists (select * y a.xx = y.x) if y contains x values of 1,2,3,4,5 , , x.x = 2 , x.xx = 4 , both exist (on different records in y) , record mytable should shown in output. edit: answer previously stated you rewrite using _exists_ clauses work faster _in_ . martin has pointed out, not true (certainly not sql server 2005 , above). see links http://explainextended.com/2009/06/16/in-vs-join-vs-exists/ http://sqlinthewild.co.za/index.php/2009/08/17/exists-vs-in/

iphone - How can i create a horizontal view -

i don't want change view when user rotate device, , need view horizontal when initialized. - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation { return no; } - (void)viewdidload { [super viewdidload]; [self.view settransform:cgaffinetransformmakerotation(m_pi / 2)]; uiview *myview = [[uiview alloc] initwithframe:cgrectmake(0, 150, 768, 500)]; myview.backgroundcolor = [uicolor bluecolor]; [self.view addsubview:myview]; } the problem view not close left side when app start. still have blank space. frame set cgrectmake(0, 150, 768, 500), don't know reason. thanks! i can't tell question, but: if want view in landscape mode, want try following code: - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation { return (interfaceorientation == uiinterfaceorientationlandscapeleft); }

c++ - Header file order -

possible duplicate: c++ header order // here module this.cpp #include <boost/regex.hpp> #include <iostream> #include <math.h> #include "mystring_written_by_c.h" #include "mystring_written_by_cpp.h" #include <list> #include <string> #include <stdio.h> #include "stdafx.h" // precomp #include <tchar.h> #include "this.h" #include <windows.h> #include <winsock2.h> they ordered alphabet now. i'm finding best practice ordering them. (is there nice formula?) how order these header files? why? headers should written to, as possible, 1) independent of may have included, , 2) not introduce problems (such macros common identifiers) headers later included. when both of these true, order in include doesn't matter. if these aren't true, should fix in own headers, or deal necessary otherwise. thus, choice arbitrary, still important make choice! "the plan n...

constructor - c++ copy initialization & direct initialization, the weird case -

before continue reading this, please read is there difference in c++ between copy initialization , direct initialization? first, make sure understand talking about. i'll summarize rule here first (read standard n3225 8.5/16, 13.3.1.3, 13.3.1.4, , 13.3.1.5), 1) direct initialization, constructors considered overloading set, overloading resolution select best 1 according overloading resolution rules. 2) copy initialization , source type same destination type or derived destination type, rule same above except converting constructors (constructors without explicit) considered overloading set. means explicit copy/move constructors not considered overloading set. 3) copy initialization cases not included in (2) above (source type different destination type , not derived destination type), first consider user-defined conversion sequences can convert source type destination type or (when conversion function used) derived class thereof. if conversion succeeds, result used dire...

When checking out a svn repository by date, does the date request propagate to external repositories? -

if have repository several external repositories pointed svn:externals, , svn checkout --revision specified date, retrieve older revisions of external repositories, or checkout head of external repositories? for example: svn checkout https://www.example.com/svn/myproject --revision {"2010-07-01 12:00"} no, svn checks out revision specified in externals directive, or head of referenced url if there no revision specified.

c++ - what type-conversion is taking place when a boolean value used to construct a string object? -

in code, there typo: instead of using "false" while initializing std::string object, typed false (which bool ). did not report compilation error. later in code, when string-object being used, std::logic_error during runtime. can please explain, why construction allowed in case (else have received compilation error , found problem there) ? here small snippet - #include <iostream> int main () { std::string str = false; std::cout << str << "\n"; } the o/p while running - xhdrdevl8@~/mybackup=>g++ -o test_string -g test_string.cxx xhdrdevl8@~/mybackup=>./test_string terminate called after throwing instance of 'std::logic_error' what(): basic_string::_s_construct null not valid aborted std::string has constructor takes const char* null-terminated string. false can used null-pointer constant because integral constant expression value of zero, std::string constructor used. passing null pointe...

bitwise operators - What is the most portable way to get/set highest bit of an integer in GNU C -

what portable way get/set highest bit of integer in gnu c? this bloomberg interview question. didn't give best answer @ time. can answer it? thanks if type unsigned, it's easy: (type)-1-(type)-1/2 for signed values, know no way. if find way, answer several unanswered questions on so: c question: off_t (and other signed integer types) minimum , maximum values is there way compute width of integer type @ compile-time? maybe others.

java - How to create GUI in Android instead of using XML? -

i don't manage xml , java together, can create same gui using java language? how can that, can tell me code simple button ? appreciate proper answer. yes, can. public class myactivity extends activity { protected void oncreate(bundle icicle) { super.oncreate(icicle); final button button = new button(this); button.settext("press me!"); setcontentview(button); button.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { // perform action on click } }); } }

flash - Height percentage + static height of image -

i created swf file not long ago, , have meaningless 'broken' link once existing affiliate. wanted take link off of game, appears though lost .fla file. =/ so want display main game content @ 100%, broken link not being displayed. ad affiliate static 100px. so want set height 100% + 100px, link out of view unless scroll down. possible? not sure if right. you can embed swf , set size need new swf file. you can play html , css hide content don't want show. update: try explaine idea first method more clear. create new flash movie in flash. set stage width , height width = old_swf_file.width; height = old_swf_file.width - bunner.height; //-100px import old swf file stage point(0,0), banner should out stage, , shouldn visible user. `

C# problem with HttpListener -

i wrote windows service using httplistener process requests points asynchronously. it works fine, runs problem requires restarting service or server fix. declared listener object with: public httplistener pointslistener = new httplistener(); here code of method, starting listening. i'm calling onstart method of service: public string listenerstart() { try { if (!pointslistener.islistening) { pointslistener.prefixes.add(string.concat("http://*:", points_port, "/")); pointslistener.start(); pointslistener.begingetcontext(pointprocessrequest, pointslistener); logwriter("http listener activated on port " + points_port); return "listener started"; } else { return "listener started!"; } } catch (exception err) ...

php - CSV to Associative Array -

i've seen numerous examples on how take csv file , create associative array headers keys. for example: brand,model,part,test honda,civic,123,244 honda,civic,135,434 toyota,supra,511,664 where create array such array[$num][$key] $key brand, model, part, test. so if wanted access test value "434" have loop every index in array , ignore brands not honda, , models not civic what need access value directly, instead of running through loop going through each $num index. want able access value test "434" with: array['honda']['civic']['135'] or control statement looping through every model honda has... like foreach $model in array['honda'] at least need able go through every model given known brand , access relative info each. edit: just confirm setting example. data has headers like: brand model part price shipping description footnote of need access information tied part (price, shipping,desc...

asp.net - @Html.DropDownListFor error -

i having function returns > ienumerable<selectlistitem> public ienumerable<selectlistitem> listitems { using @html.dropdownlistfor( m=>model.listitems) having error message error 1 no overload method 'dropdownlistfor' takes 1 arguments however, works fine @html.dropdownlist("listitems", model.listitems) why having error message @html.dropdownlistfor? there no overloads satisfy parameters. in other words, there's no method html.dropdownlistfor() accepts selectlistitem. http://msdn.microsoft.com/en-us/library/system.web.mvc.html.selectextensions.dropdownlistfor.aspx try this: public class yourviewmodel { public selectlist yourselectlist { get; set; } public string selecteditem { get; set; } } then in view: @html.dropdownlistfor(c=>c.selecteditem, model.yourselectlist) when form posted, selecteditem hold whichever item selected in dropdown list.

matlab - How to make 3D plots in Python? -

Image
this matlab version of 3d plotting code: edit: current code: plt.figure(2) fig_b = axes3d(fig2) xx2 = np.arange(0, l+h_grid*l, h_grid*l) yy2 = np.arange(-b, b+h_grid*b, h_grid*b) x, y = np.meshgrid(xx2, yy2) w = np.zeros((41,21), float) mx = len(xx2)*len(yy2) x = np.reshape(x, (1, mx)) y = np.reshape(y, (1, mx)) w = np.reshape(w, (1, mx)) j in range(0, mx): w[0][j] = np.sin(np.pi*x[0][j]/l) surf = fig_b.plot_surface(x, y, w, rstride=1, cstride=1, cmap=cm.jet, linewidth=0, antialiased=false) # line number 168 plt.xlabel('x') plt.ylabel('y') this error message get: traceback (most recent call last): file "nonhomog.py", line 247, in <module> main() file "nonhomog.py", line 245, in main nonhomog(nu) file "nonhomog.py", line 168, in nonhomog surf = fig_b.plot_surface(x, y, w, rstride=1, cst...

ada - How does rendezvous work? -

i studying exam , having difficult time understanding rendezvous. here's example i'm looking a while(1) { select{ when == true : accept a() {f1; b=false} when b == true : accept b() {f2; a=false} else {a=true; b=true} } } the following calls arrive in given order: a(), b(), b(), a(), a(), b() in order calls accepted? , can caller of or b starve? i'd appreciate help. in advance. that's not ada. @ all. for guidance on tasking actual ada read chapter 14 of ada distilled . and honest, if didn't recognize example not ada, ought start chapter 1.

objective c - Shared array between multiple classes -

i have array "myarr" contains objects of custom class..e.g. objs of type myclass i need share array across multiple classes.. could please me exact code should using.. i have referred singleton patter on apple , other references, ver confusing me...so great if highlight things/code need add. i recommend read on object delegation. @property (nonatomic,copy) nsarray *myarr; on other classes, implement delegate object point class, use: nsarray *retrievedarray = [self.delegate myarr]; edit: if interested use singleton believe along way: static myclass *obj = nil; on class array, create class method return singleton object +(myclass*) sharedinstance { if (obj) { obj = [[self alloc]init]; } return obj; } on other classes use nsarray *retrievedarray = [[myclass sharedinstance] myarr]; to array. cheers.

Where is the mercurial.hg source repository -

i looked @ mercurial website, , couldn't find single link location of mercurial source repository itself. know might me? the official repository seems sit @ https://www.mercurial-scm.org/repo/hg/ or https://www.mercurial-scm.org/repo/hg-stable different branches. more information available @ developer repositories wiki page.

GWT - setStyle on gwt-MenuBarPopup (multiple popup)? -

i have several menubar in same page, , want apply specific style each one. applying different styles menubarpopup problem here. with instance of popup, call addstylename() method. can 1 menubar.addclosehandler(closehandler<popuppanel> handler) method, can't find way retrieve instance when popup displayed. found way: the default style applied popup menubar.getprimarystylename() + "popup" so using menubar.addstylename("mystyle") won't affect popup, menubar.setstylename("mystyle") will.

html - what's the best way (fastest) to sort divs on a div ? (in javascript without JQuery) -

i have following: <div id='a'> <div id='a1' /> <div id='a2' /> <div id='a3' /> <div id='a4' /> <div id='a5' /> </div> suppose when button pressed need rearrange this: <div id='a'> <div id='a2' /> <div id='a4' /> <div id='a3' /> <div id='a1' /> <div id='a5' /> </div> or similar. now, know how children div a. know how can sort them (whatever algorithm is) the question what's best way rearrange them ? i remove them all. , readd them 1 one in correct order. that'd work think wrong because of reflow everytime new item added ? can ? point me article on web or write down solution thanks so you've got sorted array, can 2 things [ performance test ] var array = [ ... ]; // sorted array of elements var len = array.length; detach parent b...

Scala Code — I fail to understand -

i've got part of code friend , i'm trying understand , write in other way. "gotowe" sorted list of ("2011-12-22",-600.00) elements val wartosci = gotowe.foldleft (list(initial_ballance)){ case ((h::t), x) => (x._2 + h)::h::t case _ => nil }.reverse that quite okay how usage of foldleft? (i've put necessary lines): val max = wartosci.max val min = wartosci.min val wychylenie = if(math.abs(min)>max){math.abs(min)}else{max} def scale(x: double) = (x / wychylenie) * 500 def point(x: double) = {val z:int = (500 - x).toint z} val (points, _) = wartosci.foldleft(("", 1)){case ((a, i), h) => (a + " " + (i * 4) + "," + point(scale(h)), + 1)} when print points i've got list of values, , don't know why not pairs of values there couple of concepts @ work here, we'll examine in turn work out what's going on: foldleft pattern matching let's ...