Posts

tsql - How do you turn off a specific bit in a bit mask? -

in tsql, how turn off specific bit in bitmask without having check see if bit set or not? found it! use & ~ this... update mytable set mybitmask = mybitmask & ~128 -- 8th bit myid = 123 the ~ operator flips bits (1s become 0s , 0s become 1s). set value flip 1 want turn off , use & safely turn off 1 specific bit without having check see if bit set.

regex - Get Div Content with Regular Expressions in C# -

i have html code: <div id="top" style="something dont know"> text </div> and want string "text". script looks this: regex search_string = new regex("<div id=\"top\".*?>([^<]+)</div>"); match match = search_string.match(code); string section = match.groups[0].value; messagebox.show(section); is possible c#? use xpath easier http://www.codeproject.com/kb/cpp/myxpath.aspx use xpath selector //div[@id='top'] then u can inner value

forms - SiteFinity 4.0: Trouble Accessing Postback Data in Custom User Control -

i'm trying highly customized hand built form sitefinity 4.0 , problem no matter can't access form's postback data in code behind. form user control , i've added in way described here: http://www.sitefinity.com/40/help/developer-manual/controls-adding-a-new-control.html after struggling several hours, created basic test form , i'm still not able access postback data. i've tried adding enableviewstate="true" on place form data still empty on postback. exact same user control runs , posts data outside of sitefinity. tried other methods of accessing postback data , discovered request.form contain data need. i'd still love access form elements in usual way though, don't have request.form every control on page , loop way, seems hokey. here's code basic form: "basicusercontrol.ascx" <%@ control language="c#" autoeventwireup="true" codebehind="basicusercontrol.ascx.cs" inherits="sitefinity...

Regex to validate dates in this format d/m/yyyy -

i found regex works wonders,but forces leading 0's on month , day , need accept dates have month and/or day in single digit format i tested regex tester: ^(((0?[1-9]|[12]\d|3[01])\/(0?[13578]|1[02])\/((1[6-9]|[2-9]\d)\d{2}))|((0?[1-9]|[12]\d|30)\/(0?[13456789]|1[012])\/((1[6-9]|[2-9]\d)\d{2}))|((0?[1-9]|1\d|2[0-8])\/0?2\/((1[6-9]|[2-9]\d)\d{2}))|(29\/02\/((1[6-9]|[2-9]\d)(0?[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$ this same @ant18 linked, added ? every leading 0 . edit: sry misread asker's name, corrected

iPhone/iPad WebApps don't allow cookies? -

when use <meta name="apple-mobile-web-app-capable" content="yes"> , page doesn't set, load, or retrieve cookies. there way around this? can't find useful in google. uiwebviews don't store cookies. use html5 local storage instead.

Connecting to MySQL database from PHP -

everything find on net tells me provide database user , password connect database. being paranoid usual, don't because means has php source can log database , screw data. way access database? context: http://www.cyberciti.biz/tips/facebook-source-code.html since php parsed interpreter , html output, need not fear there no way hold of php source (guessing have set appropriate measures php source cannot downloaded). block traffic mysql server outside. allow localhost use it.

c# - Running PsExec From IIS: PsExecSVC hanging on remote host -

i trying run .bat file on remote host web page. psexecsvc (on host) hang , not close after execution of batch causing server wait indefinitely. when running exact same code (see @ bottom) in console application service closes , fine... the weird part when batch file consists of 1 liner echo: @echo off echo ------ start ----- exit psexecsvc close , "------ start -----" shown on page. (this want..) on other hand, @echo off echo ------ start ----- echo echo2 exit psexecsvc hang @ end of execution... when manually killing psexecsvc, "------ start -----" shows , stderr prints: psexec v1.98 - execute processes remotely copyright (c) 2001-2010 mark russinovich sysinternals - www.sysinternals.com the handle invalid. connecting novi2... starting psexec service on novi2... connecting psexec service on novi2... starting c:/dbinfo.bat on novi2... error communicating psexec service on novi2: ...