Posts

Showing posts from March, 2010

c# - StreamWriter and Samba2 (SMB2) -

ok guys, 1 tough one. the scenario : i have multiple services running on multiple machines each service has multiple threads, , each thread writes file on filer - shared storage used machines (using share such \\filername\foo\bar) the filer machine netapp machine both filer , machines running services using smb2 (http://en.wikipedia.org/wiki/server_message_block) the instruction used write file simple 1 listed below in [the code] [the code] using (streamwriter outfile = new streamwriter(pathtothefile, false)) { outfile.write(stringtowriteinthefile); } [/the code] the problem : sometimes service remains "stuck" on instruction. error given is: the process cannot access file '\\filername\foo\bar\myfile.txt' because being used process. after of these errors, service refuses release lock on file. happens then? you can delete file, file recreated. if sort-of permanent stream alive , keeps writing file indefinitely. you can stop service: it...

java - How to execute Metrics2 plugin from command line? -

is possible run metrics plugin command line. i not interested in ant task. looking run shell script passing file name parameter , output metrics on stdout is possible so. i don't believe can. metrics2 designed work in eclipse environment, , highly dependent on eclipse functionality. output goes table in eclipse. metrics2 open source, may able contribute useful there.

WPF Treeview (with Children) move item up and down -

i have problem movement of treeitem in wpf treeview. here item of problem public class workflow { public string name { get; set; } public int rank { get; set; } private observablecollection<workflow> childworkflowsvalue = new observablecollection<workflow>(); public observablecollection<workflow> childworkflows { { return childworkflowsvalue; } set { childworkflowsvalue = value; } } public workflow() { } public workflow(string name, int rank) { name = name; rank = rank; } } and logic of movement private void fillwithdata() { myworkflow.add(new workflow("airbag ausgelöst", 0)); myworkflow.add(new workflow("abstand halten", 1)); workflow subworkflow = new workflow("vorgehen", 2); subworkflow.childworkflows.add( new workflow("innenraum kontrollieren", 0)); subworkflow.childworkflows.add( new workflow("spure...

android - TextView does not display < symbol -

textview not display < symbol. how can make does? html encoding try htmlencode() android.text.textutils textutils.htmlencode("my string <"); htmldecoding to decode html encoded strings use fromhtml(htmlencodedstring) android.text.html html.fromhtml(htmlencodedstring).tostring(); [edit] asked how must proceed after retrieving textview id resource xml. set text that: textview t=(textview)findviewbyid(r.id.textview); t.settext(textutils.htmlencode("my html encoded string <")); don't forget import android.text.textutils first!

c# - How to create an instance for a given Type? -

this question has answer here: get new object instance type 12 answers programmatic equivalent of default(type) 12 answers with generics can var object = default(t); but when have type instance only constructor = type.getconstructor(type.emptytypes); var parameters = new object[0]; var obj = constructor.invoke(parameters); or even var obj = type.getconstructor(type.emptytypes).invoke(new object[0]); isn't there shorter way, generics version? the closest available activator.createinstance : object o = activator.createinstance(type); ... of course relies on there being public parameterless constructor. (other overloads allow specify constructor arguments.) i've used explicitly typed variable here make clear don't have variable of type itself...

using wininet in C++ -

i have server if sent "https://mydomain/dir1/dir2/login.html?u=1234&t=5678" respond xml document. know how can in wininet? here have done far: std::string getlogindata(void) { hinternet hinternet, hconnection, hrequest; std::string retval; hinternet = internetopen(l"my application", internet_open_type_direct, null, null, 0); if(null != hinternet) { hconnection = internetconnect(hinternet, l"mydomain", internet_default_https_port, l"", l"", internet_service_http, 0, null); if(null != hconnection) { const wchar_t* lplpszaccepttypes[] = {l"text/xml", l"application/xml", l"application/xhtml+xml", null}; hrequest = httpopenrequest(hconnection, l"get", l"dir1/dir2/login.html", null, null, lplpszaccepttypes, internet_flag_dont_cache | internet_flag_ignore_cert_cn_invalid | internet_flag_ignore_cert...

model view controller - custom error in Remote validation in mvc3 -

i've remote validation(with remote attribute) , want display user different error message according validation logic. how can so? just set errormessage attribute: [remote("username", "registration", errormessage = "user name taken!")] edit: for idea on how do multiple remote validations on same property, check out interesting post , self-answer @fabian: passing errormessage clientside validation

Create a file with echo in DOS without inserting a carriage return -

i want create new file on cifs mount in dos. if do.. echo hello > foo.txt there going cr @ end of hello. how can create file @ dos cmd using echo , not have cr automatically appended. causing problems samba , cifs mount. from this post : echo.|set /p ="hello" > foo.txt

php - Returning distinct values in either column X or Y in MySQL -

how select distinct values combination of 2 columns? creating threaded inbox, iphone sms system , want along lines of: select distinct (senderid or recipientid - whichever value != $userid), name, body messages $userid = (either senderid, recipientid - whatever discovered first). sorry that's confusing, idea return latest message (regardless of whether message sent or received) create distinct threads in messaging system. 1 thread can exist between 2 users. edit : here's code i'm using // pull girls being followed $userid $sql = "select * messages left join ( select distinct case when '$userid' != senderid senderid else recipients end otherid, users.username sendername, messages.body, messages.time messages messages.recipients = '$userid' or messages.senderid = '$userid' ) subq on users.id = subq.otherid order subq.time"; mysql has case expression can try select distinct case when $userid !...

java - Dragging speed in android -

this might simple question, stuck. want set levels of dragging speed , increment myint accordingly in application. small part of app. int myint=0; case motionevent.action_move: //calculate speed //speed=event.geteventtime(); if(speed==?){ level=1; myint++; } if(speed==?){ level=2; myint=myint+2; } tv.settext(" sped level "+level); many in advance!

streaming - How to stream live video in HTML5? -

i'm looking way broadcast live video taken webcam or camera rooted pc. broadcast should displayed in html5 page using tag (which support rtp, , rtsp think). the user viewing stream should not have install plug-in or video player such quicktime. i need video in mp4 format such as: rtsp://www.mywebsite/streaming/video.mp4 this link i'd put src of html 5 video tag. so i'd know if it's possible, options such things. it's possible. have major problems if you're looking cross browser support. can offer html5 video browsers supporting , offer quicktime browsers not supporting it. <video src="stream.mp4"> <!-- don't support <video> --> <object> <param name="src" value="video.mp4" /> 
 <param name="autoplay" value="true" /> 
 <param name="type" value="video/quicktime" height="256" width=...

javascript - mootools vs jquery for web application -

i have web application registration university , other work university... this rich web application , find desktop application... there un suggestible feature , other things i worked jquery people suggest thing mootools ( , dojo ) class simulator , other things you thing 1 better project , why? also think learn line mootools , other things ... do? this dup. search on jquery/mootools/dojo. without offering specific information on want comparison on, you're going lot of answers based on personal bias. each toolkit has similar features @ core, different programming styles, , vastly different features available in plugin communities.

resize - Jquery resizing lost cursor -

i create small resizing box (red dot resize): http://jsfiddle.net/a66zc/ works fine, when use mouse cursor slowly, when use cursor faster resizing blocking or doesn't work good. why? i'm fast?:p just have done mouseup , should set mousemove on document.. example @ http://jsfiddle.net/gaby/a66zc/1/

tsql - How to properly frame a collate command in T-SQL? -

i'm trying write query across 2 linked servers. having set link appropriate logon, i'm getting collate error: cannot resolve collation conflict between "sql_latin1_general_cp1_ci_as" , "latin1_general_ci_as" in equal operation. this new me, looks charset conflict, googled , discovered collate command can added join. i've tried both va on v_id1 = c1.strdata collate latin1_general_ci_as and va on v_id1 = c1.strdata collate sql_latin1_general_cp1_ci_as and neither seems resolve error. doing wrong? edit: entire query big post , expect people filter through, here's relevant bit: select rel.intparentattributeid intitemid, case va.type when 'sm' 120000000 when 'fb' 110000000 when 'ro' 100000000 when 'sp' 90000000 when 'a' 80000000 when 'd' 70000000 when 'p' 60000000 when 'sr' 5000000...

html - How do I disable TextBox using JavaScript? -

earlier asked disabling button when drop down menu item selected. given code did trick need same textbox , odd reason not working can have me... html: <form id="frmcolor"> <input type='textbox' id='color' /> <input type='submit' value='change color' id="colorsubmit"/> </form> javascript: tools.eraser = function () { var tool = this; this.started = false; var varpencolor = "white"; context.strokestyle = varpencolor; document.getelementbyid('frmcolor').colorsubmit.disabled=true; document.getelementbyid('frmcolor').color.disabled=true; any ideas why wont disable text box? thanks form elements can accessed via form's dom element name , not "id" value. give form elements names if want access them that, or else access them directly "id" value: document.getelementbyid("color").disabled = true; e...

javascript - EXT JS Session Timeout -

ext js - know how check json response session time out if user idle 20 minutes or if session expired or not there no standard way of handling session timeouts in extjs. extjs client-side library, used create user interface/front-end layer of application, while session management takes place on server side. extjs ajax requests implement callback mechanism. means javascript function assigned callback function, called when ajax request has finished (either or unsuccessfully). here's example taken extjs api documentation - see parameters success , failure define callback functions: // basic request ext.ajax.request({ url: 'foo.php', success: somefn, failure: otherfn, headers: { 'my-header': 'foo' }, params: { foo: 'bar' } }); so, in case of session timeout, (for example) construct json response, contain error code (defined you), , error message shown user. callback function should check if error returned serve...

python - How to preserve case using re.IGNORECASE and .sub? -

import re def bold_partial(long_string, partial): replacer = re.compile(partial, re.ignorecase) new_long_string = replacer.sub('<b>' + partial + '</b>', long_string) print new_long_string bold_partial('my name roger shrubber. arrange, design, , sell shrubberies.', 'roger shrubber') returns: name roger shrubber . arrange, design, , sell shrubberies. i'd return original case: my name roger shrubber . arrange, design, , sell shrubberies. sorry, i'm total noob. appreciated. def bold_partial_rep(matchobj): return '<b>' + matchobj.group(0) + '</b>' def bold_partial(long_string, partial): replacer = re.compile(partial, re.ignorecase) new_long_string = replacer.sub(bold_partial_rep, long_string) print new_long_string or if want shorten code can rid of new function , use following line in bold_partial() : new_long_string = replacer.sub(lambda m: '<b...

xml - Adding namespace to a css should make the IDE validate the code? -

in css file, using eclipse ide, adding header: @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); should make eclipse check elements errors? (becouse it's not doing it). if not, what's difference of adding header or not? the @namespace module in css creating styles apply namespaces. it's useful applying css styles xml documents. can use xhtml , html5 well, apply styles documents , elements xml namespaces (defined xmlns attribute, in html tag). for example, take @ following xhtml document: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>@namespace examples</title> <!-- stylesheet defines namespace prefix called "xhtml", , uses style p elements in namespace --> <style type="text/css...

memory profiler for ironpython -

i've downloaded python memory validator , trying install heapy try profile ironpython application. so far pmv seems choke reason message: failure injecting executable image using createprocess() this seems issue integrating ironpython pmv. can provide advice? it looks python memory validator commercial product, i'd ask creator.

php - phpmyadmin, how to update table,field support full-text search with aql sentence? -

i have database, there has 300,000+ rows in it. want add full-text search function? want update table field myassac.title support full-text search. how control in phpmyadmin sql sentence? thanks. as long myassac table myisam type table (innodb not support fulltext indexes), it's simple matter of alter table myassac add fulltext (title);

asp.net - Get the ID? of the current user like SharePoint can? -

Image
i'm @ client site have application began in sharepoint , migrating away custom asp.net application. of data elements still hosted within sharepoint lists, 2 of in question "notes" , "tasks" (fairly simple data elements in sharepoint setup, nothing special them). 1 of things need able within asp.net automatically create new items these lists , add them code. so far it's pretty easy. found existing web part handled editing items, attached debugger it, tracked how got values , added list, etc. however, 1 of fields being added list item isn't quite obvious. in existing web part ui, field looks this: essentially, it's field entering user current windows domain. book icon opens pop-up allows user search name, etc. in current testing, i'm running local administrator on development machine. "admin" in pop-up , populates field "[machine name]\administrator" expected. then, in debugging, value gets pulled field , ente...

How to upgrade Eclipse from Galileo to Helios on Ubuntu (10.04) -

from other related posts, recommended "best practice" create "parallel" installation of eclipse 3.6 (helios). wish simple ... on system, installation package 3.5 (galileo) seems have distributed eclipse system files on many different file-system locations: /usr/lib/eclipse /usr/bin/eclipse /usr/share/ /var/lib/dpkg/info/ /etc/eclipse.ini ~/.eclipse it's not @ clear me "parallel" installation in case. can enlighten me? would better off deleting other workspace files appears involve eclipse, , try clean install of helios? thanks. i, personally, download zip package of eclipse eclipse.org , don't use system's eclipse package @ all. makes cleaner. then, when upgrading, delete old eclipse folder, unzip new one, , maybe keep options in eclipse.ini . difficulty plugins keep links update sites it's no big deal download , install them again.

testing - What tests would you write to verify an MD5 implementation's correctness? -

assume have access "oracle" implementation output trust correct. the obvious way seems to run set of known plaintext/hash combinations through implementation , see if come out expected. arbitrary number of these cases constructed generating random plaintexts (using static seed keep deterministic) , using oracle find hashes. the major problem see it's not guaranteed hit possible corner cases. generating more cases reduce likelihood of missing corner cases, how many cases enough? there's side issue of specifying lengths of these random plaintexts because md5 takes arbitrary-length string input. purposes, don't care long inputs (say, longer 16 bytes), can use fact "special purpose" md5 implementation in answer if makes things simpler or can answer general case if it's same. if have algorithmic error, it's extremely every hash wrong. hashes unforgiving nature. since majority of possible errors exposed quickly, won't need many...

python - image upload in django -

could point me towards example on image uploading in django. have tried documentation , djangobook, found examples file uploads. new django , first try see how example works before writing own form. lot. you can check out these links. see meets requirements. using ajax , django django photologue

indexing - Using Jquery to append div index within same div -

i have basic set-up this: <div class="stop"> <span class="point"></span> </div> <div class="stop"> <span class="point"></span> </div> and append index of div.stop within nested span.point of each, this: <div class="stop"> <span class="point">1</span> </div> <div class="stop"> <span class="point">2</span> </div> this jquery i'm using, it's not working: $("div.stop").each(function() { var stopnumber = $("div.stop").index(this); $("div.stop span.point").append(stopnumber); }); thanks in advance tips or suggestions. -brian there's no need index call, .each supplies index parameter callback: $("div.stop").each(function(n) { $('span.point', this).append(n + 1); }); see http://jsfiddle.net/55abr/ ...

java - Change number in listview with button(s) on same row -

Image
i have created custom listactivity shows list of skills , buttons next them number. list looks this: the skill names drawn database points (pts). need figuring out how set buttons on side clickable , increase or decrease related points column number. i'll try double bonus , ask if knows how can retrieve these values , update database drawn from, possibly on "finalize" button @ bottom of screen. after inflate xml view use findviewbyid find buttons , add onclicklistener() public view getview(int position, view convertview, viewgroup parent) { ... final skill s = (skill) getitem(position); if (convertview == null) { layoutinflater li = (layoutinflater) this.getcontext() .getsystemservice(context.layout_inflater_service); convertview = li.inflate(r.layout.yourlayout, null); } else { // use cached view } button buttoninc = (button) convertview.findviewbyid(r.id.buttoninc); buttoninc.setonclicklistener(new view.onclicklistener() { ...

What is the YUI2 alternative selector for jquery selector "*" (or) YUI Event/Selector Issue -

i new yui or yui2 here have criteria, when there 10 image tags in page (""). when click on image need it's parent(i.e) anchor href value . when trying functionality using the following yahoo.util.event.addlistener or yahoo.util.event.on , able fire event on first img tag , able value of it's parent anchor href value , till fine. here problem is , from second image event not @ firing. how able fire event images . thanks in advance. with yui2, need add classes elements , use stuff getelementsbyclassname: http://developer.yahoo.com/yui/examples/dom/getelementsbyclassname.html with yui3, use selectors jquery.

PHP ImageMagick getImageType returns array... how to associate with type? -

the php imagemagick function getimagetype returns array number, can't find documentation how associate type. i need know if it's png, jpg, gif, etc... $image = new imagick("test.png"); $ext = $image->getimagetype(); // prints 6 echo $ext i suggest way works fine me $image = new imagick('image.gif'); $image->getimageformat(); echo $image; // output gif

Form security. PHP MYSQL -

ok have user form has values submitted database. my values follows, $type = $_post['type']; $username = mysql_real_escape_string($_post['username']); $gender = $_post['gender']; $email = mysql_real_escape_string($_post['email']); $password = mysql_real_escape_string($_post['password']); i insert them, follows, mysql_query("insert accounts (username, email, password, gender, type) values ('$username', '$email', '$password', '$gender', '$type')"); now totally fine research, , called bobby tables gets me worried security, find out mysql_real_escape_string should used radio buttons well, , find out need define if input value integer , check it?? has got me worried site thought secure, not, can please explain bobby tables , how secure more using standard real escape? thanks it's concept of sanitizing data , especially unpredictable inputs public facing.

asp.net - Javascript with ASP:TextBox inside Repeater -

okay i've got little problem combining own javascript asp server controls. the picture: i've got couple of asp:textboxes on page created repeater. goal sum values user types these textboxes. must happen whenever user changes content of textboxes. (on bottom of page got little price calculator, works server side code want make more dynamic, i'm talking txtteam , txtpart) <asp:content id="content3" contentplaceholderid="contentplaceholder" runat="server"> <script type="text/javascript"> </script> <div id='inputdiv'> <h1> students per team</h1> <table> <tr> <td> team </td> <td> actual </td> <td> maximum </td> </tr> <asp:repeater id="repeater2" runat="server...

debugging - What is wrong with this jQuery .blur? -

i have jquery: var testtitleval = $('#testtitle').val(); $('#testtitle').blur( function(){ if(testtitleval.length == 0){ $('#testtitle').val('title'); } }); to work on html: <input type="text" id="testtitle"> what want accomplish when focus leaves input , there no text in input makes value title . reason not doing that. ideas? you code bit off in if statement: do instead: $('#testtitle').blur( function(){ if($(this).val().length == 0){ $(this).val('title'); } }); fiddle: http://jsfiddle.net/maniator/c6aau/

c# - Deleting Images in a GridView Control -

i'm designing gridview control allow editing , deleting of rows contain images. whenever try use auto-generated delete method following error: "operand type clash: varbinary(max) incompatible sql_variant" here's code: <div id="content"> <asp:sqldatasource id="sqldatasource1" runat="server" conflictdetection="compareallvalues" connectionstring="<%$ connectionstrings:inventoryconnectionstring %>" deletecommand="delete [inventory] [id] = @original_id , [stocknum] = @original_stocknum , [make] = @original_make , [model] = @original_model , [year] = @original_year , (([miles] = @original_miles) or ([miles] null , @original_miles null)) , (([engine] = @original_engine) or ([engine] null , @original_engine null)) , (([drive] = @original_drive) or ([drive] null , @original_drive null)) , (([color] = @original_color) or ([color] null , @original_color null)) , (([description] = @o...

python - Invalid mode: wb when trying to upload file using Django and AJAX -

so i'm trying use ajax file upload form django , running issue fileio. specifically, with bufferedwriter( fileio( filename, "wb" ) ) dest: results in valueerror: invalid mode: wb i'm running python 2.6/django 1.3 locally on osx 10.6.7. tried chmod +x directory i'm targeting filename. idea i'm missing? thanks. http://docs.python.org/release/2.6.6/library/io.html#raw-file-i-o fileio represents file containing bytes data. implements rawiobase interface (and therefore iobase interface, too). the mode can 'r', 'w' or 'a' reading (default), writing, or appending. file created if doesn’t exist when opened writing or appending; truncated when opened writing. add '+' mode allow simultaneous reading , writing. the "mode" you're trying set use "rb," in documentation isn't valid mode. either way, fact it's reading in raw data file seems indicate fileio set in binary mod...

sockets - sleep() function (python) -

if data.find('!google') != -1: nick = data.split('!')[ 0 ].replace(':','') try: gs = googlesearch(args) gs.results_per_page = 1 results = gs.get_results() res in results: sck.send('privmsg ' + chan + " " + res.title.encode("utf8") + '\r\n') sck.send('privmsg ' + chan + " " + res.url.encode("utf8") + '\r\n') print except searcherror, e: sck.send('privmsg ' + chan + " " + "search failed: %s" % e + " " + '\r\n') ok i'm trying make script wait few seconds before user can "!google" prevent users flooding channel or bot, not sure if should use sleep() function because might stop whole script, want make wait few seconds before can use "!google" again. there sleep function inside time module . however, make script not block, ...

iPhone - Detecting if the iDevice has a front camera -

apple recommends not searching hardware version, specific feature in interested. so how may detect if there front camera on device able disable features ? [uiimagepickercontroller issourcetypeavailable: uiimagepickercontrollersourcetypecamera] tells there camera somewhere. try method of uiimagepickercontroller: + (bool)iscameradeviceavailable:(uiimagepickercontrollercameradevice)cameradevice this class method , uiimagepickercontrollercameradevice can take 2 values: uiimagepickercontrollercameradevicerear uiimagepickercontrollercameradevicefront example code: if( [uiimagepickercontroller iscameradeviceavailable: uiimagepickercontrollercameradevicefront ]) { // } note available ios 4.0 , later.

Any way to lower Python memory footprint? -

i'm developing python 2.6 (tested both on 2.6.5 , 2.6.6) application going run daemon on vps. during tests, i've found out app it's consuming (during sleep time, no activities or allocations whatsoever) 37.53mb of memory. i've spent last few hours optimizing code reduce app memory footprint miserably failed xd i'm using line of bash code memory used app: ps u -p $(pidof python) | awk 'nr > 1 {nm += $5} end {print nm * 1024}' *(yes, im sure have 1 python instance running ;))* so, sure not goin waste time, ran python interpreter session (no script, no args, no modules loaded) , same script use memory consumed ... know what? it's same entire app! so, there's way reduce python interpreter memory footprint? tried set gc threshold 3 first generation , call gc.collect() in safe places of app ... nothing changed :( are sure not reading python virtual memory? python here consumes 3.4mb of private memory.

how to specify photo type with Facebook PHP API -

i'm new php , facebook , i'm trying specify want album photos in small type. i'm sure once see how easy can work out how send arguments request. i'm working with: // albums $albums = $facebook->api('/me/albums'); foreach($albums['data'] $album) { // photos album $photos = $facebook->api("/{$album['id']}/photos"); foreach($photos['data'] $photo) { echo "<img src='{$photo['source']}' />", "<br />"; } } how send want type=small $photos = $facebook->api("/{$album['id']}/photos?type=small"); this isn't working thanks // session object returns array contains [session_key], [uid], [expires], [secret], [base_domain], [access_token], , [sig] $session = $facebook->getsession(); // want our session access_tokken photos. , photos of type = small $photos = $facebook->api("/".$album['i...

iphone - Determine correct RGBA value for bar tint color given a client's design image? -

i given mockup images define how iphone app supposed look. these can come many different methods there projects, balsamiq or hand-drawn, photoshop. 1 thing common bar tint color specified match corporate branding or overall app design. if open 1 of these design images in app , use paint dropper tool rgb value color there many places it, darkest regions @ lower edge of included buttons lightest regions @ top of bar. can't find place sample color programmed result matches mockups, wrong in regard leading me squinting @ 2 images trying tweak 1 or more color values match enough. given sample of how client imagines navigation bar should appear*, how determine right uicolor apply bar's tintcolor attribute? *ignoring mockups containing rainbow effects, misapplied gradients , other flights of fancy. matching color , brightness along centre line enough. that's @ least defensible position - "what ask isn't how ios works!" set app uinavigationbar/uitoo...

Why does google suggest to use trailing underscores when naming iVars in Objective-C? -

in google's objective-c style guide follow many people , google says class member variables have trailing underscores why? there reason doing this? found apple name ivar when beginning underscore. heavy users of core data have noticed core data attributes cannot begin non-alpha characters. if want name ivars consistently across app , various projects, reason append, rather prepend, ivars underscore. if you're not using core data lot, or don't have ocd tendencies towards consistency in naming conventions, whatever works best right answer.

Sending the HTTP sender in WCF calls ( used SOAP on .net compact framework ) -

i having mobile application calling wcf using proxy generated using netcfsvcutil.exe. need send simple http header information ( required server side) each wcf calls. as iclientmessageinspector not supported in .net compact framework , want know there way send http header. -vivek

Construct Quartz.Net Cron Expression for a requirement -

i have requirement send email reminder customers. i'm trying trigger quartz job based on datetime x weeks later after event. in quartz job, i'm supposed check condition whether happened or not. if condition false (e.g. no action customer), have send reminder y weeks later. check again same condition, if false, send last reminder on specific datetime known me right @ start of whole process. any idea how construct cron expression? thanks lyf i suppose you're using c#, right? can use cron: var cronreminderexpression = string.format("0 0 9 1/{0} * ? *", (periodicitylength*7).tostring()); where periodicitylength number of weeks. multiplying 7 cause there's no proper expression weeks or, @ least, haven't been able find it. can find cron expression builder here . quartz.net 2.0 supports new trigger called calendarintervaltrigger . can read more here . can chain jobs way .

android - invalidate only works in custom view -

so created view called "drawable view" class drawableview extends view{ context mcontext; int touches=0,k,xoffs,clicks=0; double x_1 = 0,x_2=0; private float mlasttouchx, mlasttouchy; public drawableview(context context) { super(context); mcontext = context; } .... @override protected void ondraw(canvas canvas){ paint mypaint = new paint(paint.anti_alias_flag); canvas.drawcolor(color.blue); mypaint.setcolor(color.white); canvas.drawcircle(200, 100, 20, mypaint); } ..... more code.... } and can invalidated within ondraw command! ie: calling "invalidate();" @ end of ondraw command causes loop. i have tried many times call g_draw.invalidate(); or g_draw.postinvalidate(); (g_draw name of created drawable view)from other classes , main activity class , doesnt work. why , how can fix it? thanks if want continious ondraw invoking try doing in thread. create thre...

jquery - Plugin with javascript intellisense and autocomplete support? -

Image
i know question has been asked previously, asked long time ago , answers questions weren't satisfactory. asking again - best eclipse plugin available out there can provide basic javascript jquery auto-completion , intellisense if possible. looking other aptana studio here. i using eclipse j2ee developers version 3.6 helios package (probably has wtp installed start). in term of pure auto-completion, bugs 159508 , 121871 or 125088 seem suggests exists, though doesn't have options of visual studio intellisense . however, more complete version of intellisense available aptana (as reported in 2008), still best (in eclipse world) in 2009 , , can installed plugin in eclipse (using p2 update site http://update.aptana.com/install/studio ): see blog post jquery intellisense (code assists) on eclipse 3.5 (late 2010).

java - How can I switch the database context of an existing DataSource? -

let's have existing datasource master database. need create new database, , execute ddls on database. possible e.g, "use" command, or need create new datasource name of new database in jdbc url? you can run "use" command regular jdbc statement. statement stmt = connection.createstatement(); stmt.execute("use the_other_db"); dependending on dbms , driver might able use jdbc api call setcatalog(): connection.setcatalog("the_other_db")

c# - distinguish between the scanner and the keyboard -

hey all. have barcode scanner connected pc working c# program.now want distinguish between scanner , keyboard 1 sending data program. can me code or advise in c#? somebody said me in topic(but can't yet): can configure scanner send characters tell computer "hi, it's me". when see characters in input stream, know information coming barcode scanner, not user typed on keyboard. did check manual came barcode scanner? should have more information this. if application works particular barcodes (eg same char length or ones can matched regex) possibly work out coding robot typing test. eg: vb.net: private sw stopwatch private sub firstcharacterentered() sw.start() end sub private sub txt_textchanged(byval sender system.object, byval e system.eventargs) handles txt.textchanged if txt.length = 0 firstcharacterentered() if txt.length = barcodeseriallength or new regularexpressions.regex("your pattern").ismatch(txt.text) sw.stop() ...

iphone - Scaling a UIView during transitionFromView? -

i'm using container uiview replicate kind of behavior itunes store when tap on album artwork , flips , scales. current code looks like: //mainview 300x300x, smallview 30x30 [uiview beginanimations:nil context:nil]; [uiview setanimationduration:2.0]; [uiview transitionfromview:mainview toview:smallview duration:3.0 options:uiviewanimationoptiontransitionflipfromleft completion:nil]; containerview.frame = cgrectmake(275, 415, 30, 30); [uiview commitanimations]; i can't seem content of containerview scale during animation, frame closes in on content. tried applying transforms both view , layers , bunch of other things can't seem behave properly. rather setting frame, try using transform instead: - (void)setstarttransform:(cgaffinetransform)transform; - (void)setendtransform:(cgaffinetransform)transform; something like [uiview beginanimations:nil context:nil]; [uiview setanimationduration:2.0]; [uiview transitionfromview:mainview toview:small...

css - IE7: background-img on multipleline text -

on anchor-tag url external site have little icon indicates link external site. icon included via additional span-element around link-text , displayed via css background-image position 100% 50% @ end of text , padding-right text-gap between link , following text now works fine in every browser — as long link-text not longer 1 line … if on multiple lines, whole thing works still fine everywhere, except ie7 (ie6 not supported project)… ie7 displays icon @ end of first line , few pixels bottom, instead of @ end of link-/span-text on second or third line… sometimes picture says more 1000 words: http://img859.imageshack.us/i/spdexternalerror.jpg/ html-code: <a href="#"><span class="external">link-text multiple lines</span></a> css span-element: {background: url(/#/icon-new-window.png) no-repeat center right; padding-right: 14px;} adding zoom:1 css property resolves problem @ situations

c# - How to make my wpf app wait for 3 minutes before re-loading data? -

i using vs2010 - wpf - c# in application fetch data web server , view on interface problem want keep fetching data , keep refreshing interface every 3 minutes don't know how that... i tried (thread.sleep(18000)) , didn't work because interface wouldn't show @ all i don't know how use timer such reason , couldn't find i'm looking elsewhere please can me ? best regards what programming model? stock or more sane mvvm approach? anyhow, use timer request callback after 3 minutes. in callback invoke dispatcher thread of window once got results of web service call. finished.

reporting services - how to make bold only speciifc text in rdl file -

i have rdl file. i have 1 column displays: "this queue builder record" i want make word "queue" bold , other words remain normal. e.g.: queue builder record" when trying entire column becomes bold. how can achieve this? i assume when rdl, have referring ssrs report file. if running rdl file in 2005, cannot cleanly, split column 3 columns , bold middle column contains "queue" messy , ugly. if using 2008 there couple ways it, easiest to: click text box (so cursor in text box) right click , select "create placeholder" in markup type select "html - interpret html tags styles" in value: ="this <b>queue</b> builder" you're ready go.

installer - how to remove the .net framework launch condition from .msi setup? -

i creating windows installer (.msi package) project using visual studio 2010. want remove launch condition .net framework manually performing same check in custom action events. project “delete” option “.net framework” launch condition showing disabled. so, not able delete it. i have tried following solutions: 1) have installed orca3.1. have open .msi in orca , searched “vsdca_vsdlaunchconditions” word. have deleted references same , saved .msi file project. when try install same on client machine giving following error during installation: error 1001. error 1001. installutillib.dll: unknown error description event id 11001 source msiinstaller cannot found. either component raises event not installed on local computer or installation corrupted. can install or repair component on local computer. if event originated on computer, display information had saved event. following information included event: product: soundbite -- error 1001. error 1001. ...

x++ - filter look up in dialog -

i have created dialog in class, dialog method below static void dialog(args _args) { dialog dialog; dialogfield dialogfieldcurrentstate; dialogfield dialogfieldnewstate; custinvoicetable custinvoicetable; ; custinvoicetable = _args.record(); dialog = new dialog("change state"); dialogfieldcurrentstate = dialog.addfield(typeid(state_lt),"current state: "); dialogfieldcurrentstate.value(custinvoicetable.state); dialogfieldcurrentstate.enabled(false); dialogfieldnewstate = dialog.addfield(typeid(state_lt),"new state: "); if (dialog.run()) { custinvoicetable.state = dialogfieldnewstate.value(); } } in dialog there 2 fileds current state , new state .now when select new state list of states displayed(irrespective of country) dont want. states respective of country has shown in lookup . need make use of filter e.g. while select while select addressstate addressstate.count...

What is php's performance on directly accessing array's row with key specified -

i have question regarding array's performance.... how php handle array keys? mean if $my_city = $cities[15]; .... php directly access exact row item in $cities array or php iterate trough array until finds matched row? and if access row directly... there difference in performance between array 100 rows , array 100,000 rows? like in example $my_city = $cities[15]; php's arrays implemented hash tables, elements accessed directly possible, without iterating through everything. read more algorithm here: http://en.wikipedia.org/wiki/hash_table

php - Find a value that could appear multiple times but only use other value once -

title maybe bit confusing because didn't know how explain myself... the problem have have comments table in stored instance comment about, comment , user commented, i'm trying collect instances have been commented user. if instance has been commented twice select instance once. currently have code returning instances $test = @mysql_query("select * comments user_id = '$idd'"); while($result = mysql_fetch_array($test)) { $id = $result['instance_id']; $gender = $result['gender']; $name = $result['name']; $test2 = @mysql_query("select * media_link instance_id = $id"); $result2 = mysql_fetch_array($test2); $media = $result2['media_id']; $test3 = @mysql_query("select * comments instance_id = $id"); $result3 = mysql_fetch_array($test3); $comments = $result3['comments']; the attributes arranged in table , echoed out within while loop. sounds job dist...

php - Why print_r() still exists? -

print_r(array('name'=> 'bob', 'age' => 20, 'sex' => 'man')); then : array { [name] => bob, [age] => 20, [sex] => man } var_dump(array('name' => 'bob', 'age' => 20)); will display: array(2) { ['name'] => string(3) 'bob' ['age'] => int(20) } var_dump perfect debug , better print_r . why print_r still exists? or print_r has advantage don't know a big difference between print_r , var_dump print_r takes optional second argument , allows store contents in variable. example: $debug = print_r($somearray, true); echo $debug; (note achieved var_dump using output control functions , though) additionally, readability of print_r far better of var_dump : var_dump: array(3) { [0]=> int(1) [1]=> int(2) [2]=> array(3) { [0]=> string(1) "a" [1]=> string(1) "b...

mysql - PHP: mysql_ping - auto reconnect problem -

i'm working old complex piece of php code, relies on direct mysql access via mysql_* functions. code uses mysql_ping extensively, assumes each mysql_ping call reconnect in case finds out connection timed out. problem since mysql 5.0. something mysql_ping doesn't reconnect automatically . in doc's found need call mysql_options appropriate flag, there's no such function mysql_options . instead, there's mysqli_options literally can't switch mysqli_* now, it'd take way time. downgrading mysql not considered solution. ideas how fix that? thanks upon checking php manual found piece of code may handle db connection status: <?php $conn = mysql_connect('localhost','user','pass'); mysql_select_db('db',$conn); if (!mysql_ping ($conn)) { //here major trick, have close connection (even though not working) recreate properly. mysql_close($conn); $conn = mysql_connect('localhost','user','pass...

asp.net - FormsAuthentication.RedirectFromLoginPage Vs Response.Redirect -

this reference question asked here login user after signup , here formsauthentication.redirectfromloginpage reload page . though have answered first question admit it's "programming co-incidence". if see, answers above 2 questions contradict each other still both worked respective users. i know exact difference between this formsauthentication.setauthcookie(user_name, true); response.redirect("copypastpage.aspx"); and formsauthentication.redirectfromloginpage(mainsignup.username, true); in terms of usage, can see logical difference response.redirect can allow redirecting url against redirectfromloginpage redirect referrer. that's usage difference. is there fundamental diffence in way of execution? if not, thoughts why 1 work @ times , why other @ times? happens under hood of each of them? i have google bit not concrete answer. if @ code in redirectfromloginpage same setauthcookie get return url query string clear return ur...

Matching of cells in excel -

it sum of columns storing in 1 cell , if want same answer printed in cell, formula this? let's sum stored in b1 , want same in c1 can =b1 inside c1 cell

What is attr in R class in Android? -

hello i've seen empty class named attr inside autogenerated r.java class; meaning? know styles can defined in style.xml style tag, don't know attr is? in advance c. r.attr "theme attributes" (not styles). they're defined in values xml file this: <attr name="textappearancelarge" format="reference" /> they're used in view contructors defstyle parameter, in: public textview (context context, attributeset attrs, int defstyle) i'd imagine it's pretty rare apps add own attr values. ones in android.r.attr used if @ all.

xcode - Memory Leaks tutorial in iphone -

is there tutorial link can me in memory leaks of iphone,, b/c facing problem whenever allocate memeory , in dealloc releasing memeory, problem when run application in (run-> run performance tools -> leaks) got leaks through there.. how can resolve it... reply me plz in xcode, can run build , analyze . xcode shows memory leaks arrows of bad memory management. this tutorial : iphone-memory-management-tips

Programmatically reading the output of Hadoop Mapreduce Program -

this may basic question, not find answer on google. have map-reduce job creates multiple output files in output directory. java application executes job on remote hadoop cluster , after job finished, needs read output programatically using org.apache.hadoop.fs.filesystem api. possible? application knows output directory, not names of output files generated map-reduce job. seems there no way programatically list contents of directory in hadoop file system api. how output files read? seems such commonplace scenario, sure has solution. missing obvious. the method looking called liststatus(path). returns files inside of path filestatus array. can loop on them create path object , read it. filestatus[] fss = fs.liststatus(new path("/")); (filestatus status : fss) { path path = status.getpath(); sequencefile.reader reader = new sequencefile.reader(fs, path, conf); intwritable key = new intwritable(); intwritable value = new...

flash - How to search for specific words and values in a long string? -

ok objective is: 1.read in text file. e.g containing text this, teacher/student/1/sn/2/3/4/5/9/f/tn/02/ 2.pass string. 3.then beable extract different parts of string , place them in different arrays. the bit dont know how extracting specific parts of string? possible search / , treat comes after specific peice of information until next / read? or perhaps there more efficient approach? help , advice sought kindest regards adrian if strings have separator, can split them: var string:string = "teacher/student/1/sn/2/3/4/5/9/f/tn/02/"; var parts:array = string.split("/"); // ["teacher", "student", ...] to search specific words, regexp might good: var re:regexp = /teacher|student/; var match:object = re.exec(string); //match[0] = "teacher" of course, check out docs.