Posts

Showing posts from March, 2010

ms access - nested if statement in query -

(please excuse didn't use aliases). query output "none" if 3rd qrtr sales equals 4th quarter sales, output saying "up" when equal each other. please me correct code trend: iif([qryquarterlycustomersales3rdquarter_final] .[3rd qrtr sls]=[qryquarterlycustomersales4thquarter_final] .[4th qrtr sls],"none", iif([qryquarterlycustomersales3rdquarter_final] .[3rd qrtr sls]>[qryquarterlycustomersales4thquarter_final] .[4th qrtr sls],"down","up")) are sure 2 values same? written there appears slight mistake in inner iif statement, doesn't explain results you're getting. pseudocode helps me understand how these expressions work: if q3 = q4 "none" else* if q3 > q4 "up" else* "down" *note else implied; not legal syntax here making few changes possible, should work expect to: trend: iif([qryquarterlycustomersales3rdquarter_final] .[3rd qrtr sls]...

linux - Programmatically accessing files within a zip file? -

can access file/folder within zip file without extracting temporary file? this on linux system. right now, need "read" file, possible "write" well? edit 1: sorry not clarifying, hoping command line tool allow work language, alternate, php solution / toolkit need. you don't mention language, java has whole library can used read , write zip file. see: http://download.oracle.com/javase/6/docs/api/java/util/zip/package-summary.html for c or c++, you'll have use 3rd party library.

java - Log4J SMTP appender issues -

i use log4j smtp appender , doubt effect application memory when it's tries send many emails.and errors located (memory or other) before send? if application crashes lost "errors" not send yet? if concerned memory investigate e.g. "jvisualvm" in jdk. the contents of mail , events needed generate stored in memory. encourage investigate source code. if application exits jvm no more actions can taken, mails errors should have been sent immediately. if concern you, consider adding shutdown hooks run when jvm shutting down.

javascript - jQuery UI Dialog, Checkboxes and the mysterious case of IE6 -

i have jquery ui dialog containing checkboxes. want conditionally set state of these checkboxes , open dialog. unfortunately causes problems in ie6. checkbox never checked if it's value set before opening dialog. for example in following code "dialog checkbox 1" never checked in ie6, in every other browser. [ update ] problem how ie6 resets state of checkbox appended anywhere. , when dialog opened, jquery ui appends top of body. apparently "it's known fact when working ie, checked state of checkboxes lose state when appended [anywhere]" (see link below) this jquery forum post suggests resolution concerned changing jquery ui code; i'd rather not if @ possible. are there solutions this? thanks, d. code: <script type="text/javascript"> $(document).ready(function() { $('#dialog').dialog({ autoopen : false, modal : true }); $("a#opendialog").click(function() { $(...

c# - Databinding to CLR property in code-behind -

binding dependency property easy in code-behind. create new system.windows.data.binding object, , call target dependency object's setbinding method. but how do when property we're binding clr property , can't provide dependencyproperty argument setbinding ? edit: object implements inotifypropertychanged , if that's relevant. binding targets must dependency properties! that's requirement databinding work! read more here: http://msdn.microsoft.com/en-us/library/ms531387(vs.85).aspx http://msdn.microsoft.com/en-us/library/ms752347.aspx

sql - 80 3 column rows, or 1 81 column rows -

i have data store, i must store data every user, the data more or less key: 0 value: 107, key: 1 value 213 there 80 key/value sets per user so question is, do have 1 row basically user_id key1, key2... key80 or have 80 rows of user_id, key, value data must store: can see actual data must store here: http://219.89.41.169/reachapi/?gt=the%20hailwood i cant copy/paste approx 8mb of data, page may take while load. but can see given data in format, hence why must store way. i'd cringe @ thought of 81 columns in table. however, if: the number of keys/fields unlikely change, and all of fields relate directly user, , apply every user, and/or you're need query more 1 key @ time given user, then makes more sense have many columns store each user/key combo own row. type safety, ability constrain , index data better, , query user's stats without needing dozen joins (or getting bunch of rows have assemble data structure). if numb...

assembly - TASM how to get command line arguments? -

how command line argument in tasm? pretty simple in masm32 invoke getcl,1,addr buffer i presume should able use os's api functions. windows programs, start getcommandline .

How to specify encoding bitrate while capturing from a webcam - MS Expression Encoder 4 -

i have program capture , save live webcam video. taken sample programs coming expression encoder 4. livejob job = new livejob(); encoderdevice video = encoderdevices.finddevices(encoderdevicetype.video).count > 0 ? encoderdevices.finddevices(encoderdevicetype.video)[0] : null; encoderdevice audio = encoderdevices.finddevices(encoderdevicetype.audio).count > 0 ? encoderdevices.finddevices(encoderdevicetype.audio)[0] : null; livedevicesource devicesource = job.adddevicesource(video, audio); job.activatesource(devicesource); //when start encoding button clicked. fileout.outputfilename = "c:\\output\\capture\\video1.wmv"; job.publishformats.add(fileout); job.startencoding(); //when stop encoding button clicked. job.startencoding(); how specify bitrate of encoded video. you need add format windowsmediaoutputformat outputformat = new windowsmediaoutputformat(); advancedvc1videoprofile profile = new advancedvc1videoprofile(); profile.bitrate = 1; ou...

c# - NullReferenceException in MySqlClient.NativeDriver -

i have long running program exectues mysql-queries every 5 minutes (timed thread). after has run approximately 10 hours nullreferenceexception thrown following stacktrace: at mysql.data.mysqlclient.nativedriver.getresult(int32& affectedrow, int32& insertedid) bei mysql.data.mysqlclient.driver.getresult(int32 statementid, int32& affectedrows, int32& insertedid) @ mysql.data.mysqlclient.driver.nextresult(int32 statementid) @ mysql.data.mysqlclient.mysqldatareader.nextresult() @ mysql.data.mysqlclient.mysqldatareader.close() @ mysql.data.mysqlclient.mysqlcommand.resetreader() @ mysql.data.mysqlclient.mysqlcommand.executereader(commandbehavior behavior) @ mysql.data.mysqlclient.mysqlcommand.executenonquery() @ myownprogram.mysql.senddata(string sqlcommmand) the senddata method following (lockdb of type object) public void senddata(string sqlcommmand) { try { using(mysqlcommand command = connection.createcommand()...

How to track a completed file download in ASP.NET -

i have this asp.net web site allows users download program installation packages (just normal files). want able track when download completed (i.e. file has been downloaded user's computer) , invoke google analytics script reports completed download 'goal' (obviously, 1 of goals increase file downloads). the problem need support direct file urls, opposed "redirect page" solution. because lot of traffic comes software download sites explicitly demand direct file url when submitting product. perhaps, own file analysis (i.e. virus checking). set of limitations, typical scenario is: the user visits product listing on software download site the user clicks "download" button on site the "download" page typically redirect brings user file via direct url i've submitted, i.e. http://www.ko-sw.com/somefile.exe if under these conditions, exact solution monitoring not possible, maybe there exists workaround? comes mind temporarily stori...

jquery - Best way to put delay after calling javascript functions -

i'm using jquery call javascript functions delay between them. i'm using jquery wait when call below function,all functions called recpectively,there no delays between each other. $(this) .call(f1) .wait(5000) .call(f2) .wait(5000) .call(f3); here call function calls function did $.fn.call = function (f) { if (f) f(); return this; }; what doing wrong ? how can achieve ? thank you if want call function every 5 seconds use settimeout(function(){f1},5000); settimeout(function(){f2},10000); settimeout(function(){f2},15000); if want call each function 5 seconds after last 1 terminated use settimeout(function(){f1;settimeout(function(){f2;settimeout(function(){f3},5000);},5000);},5000);

statistics - Formula/Algorithm for Weighting Game Outcomes -

i have interesting conceptual problem, , i'm wondering if can me quantify it. basically, i'm playing set of games... , each game know probability win, probability tie, , probability lose (each game have different probabilities). at high level, want know is: games should focus attention on? example, i'm not going put effort games have 0% chance of winning (or games have 100% chance of winning). 50/50 game, care lot , want put in effort. if ties not involved, simple as: "care-ability" = how close chance of winning 50%? ties, complicates things. i'm not sure it's strictly necessary, if need to, can assume win 0 points, tie give 1 point, , win give 2 points. in other words, valuable go loss tie, go tie win. you can assume games independent. basically, i'm looking quantitative metric "care-ability" (a value 0 1 example). anybody have ideas how approach this? if you're economics person, can imagine have finite number of doll...

c# - How to perform own assertions with coded UI testing -

i'm working visual studio 2010 codedui tests. i want able perform little more can @ moment. e.g. can can assert if particular field "areequal" or "contains" etc, want more. eg, want check if field contains numerical value within it. edited uimap.designer.cs , able achieve wanted. the problem is file gets overwritten when new test added. so question how can "fiddle" fields/stings in ui , implement own assertions on them? thanks use partial class created (uimap.cs) add custom code. file doesn't blown away , has full access internals of uimap (since it's part of it).

mysql - Find parent with child -

i have 2 tables parent{ parent_id } child{ child_id parent_id } i need find parent parameters children id ex: find parent has children (1, 2, 3) i tried "where child_id in (1, 2, 3)" return incorrect parent in case parent has children(1, 2, 3, 4) i can hard code php ask mysql solution. maybe add count() condition, if parent has (1,2,3) children , 3 children it's ! select * parent natural join child child.child_id in (1, 2, 3) group parent.parent_id having count(child.child_id) = 3 (not tested)

postdata - ASP.Net using multiple form tag and post them to another page -

i don't know it's possible try achieve post data 1 page using second form. problem need form tag user interface containing callback panels etc. want put second form hidden-field: <form id="postform" method="post" action="target.aspx"> <input type="hidden" id="id" /> </form> i submit form javascript jquery: $("#id").val(id); $("#postform").submit(); is there way access value of hidden field on target page? you should give hidden field name attribute: <input type="hidden" id="id" name="id" /> you'll able use request.form in target page access posted data: string postedid = request.form["id"];

jquery - How to hide a table row that has no unique id -

how hide table row has no unique id, row contains td specific text, note cannot adjust classnames or add id's there either. nested tr. eg. <tbody><tr> <table id="baskettable"><tbody> <tr class="separaterow "> <td class="separatecolumn" colspan="2"> not hide row</td> <td class="separatecolumn"></td> <td class="separatecolumn"></td> <td class="money">100,39 </td> <td></td> </tr> <tr class="separaterow "> <td class="separatecolumn" colspan="2"> yes hide row</td> <td class="separatecolumn"></td> <td class="separatecolumn"></td> <td class="money">100,39 </td> <td></td> </tr> ...

python - figuring out how to get all of the public ips of a machine -

i running code on multiple vpses (with more 1 ip, set aliases network interfaces) , trying figure out way such code acquires ip addresses network interfaces on fly , bind it. ideas on how in python without adding 3rd party library ? edit know socket.gethostbyaddr(socket.gethostname()) , 3rd party package netifaces , looking more elegant standard library ... , parsing output of ifconfig command not elegant :) the ip addresses assigned vpses, no possibility change them on fly. you have open ssh tunnel or install proxy on vpses. i think ssh tunnel best way how it, , use socks5 proxy python.

refactoring - Is there a ReSharper-like tool for C++ projects? -

i'm searching tool resharper c++. want have more flexible refactoring tool visual assist. really if there exists tool resharper c++, want know tool's name. in question while suggested "refactor pro", 2008 there may more modern tools better suited after. resharper (or it) visual c++?

c - Suggestions for concise index handling in circular buffer -

i've implemented circular buffer, , concise means of updating buffer pointer while handling wrap-around. assuming array of size 10, first response like: size_t ptr = 0; // work... p = ++p % 10; static analysis, gcc -wall -wextra , rightly slapped wrist unspecified behavior due sequence point violation. obvious fix like: p++; p %= 10; however, looking more concise, (i.e., one-liner) "encapsulate" operation. suggestions? other p++; p%= 10; :-) p = (p + 1) % n; or avoid modulo: p = ((n-1) == p) ? 0 : (p+1);

Update OSGi bundle while starting -

i have several osgi bundles, each of can updated osgi bundle repository. when start osgi framework (apache felix), want first bundle start , check updates installed bundles. if updates available, should update each of them (including itself) continue starting (or possibly shutdown, , os restart app). how best done in osgi compliant manner? how should first bundle update itself? can update while starting? there couple of things should do: make sure have 1 bundle (the "management agent" called in spec) starts first on framework (re)starts giving lower start level other bundles. make sure tell system start start level equal of management agent. way bundle able update other bundles in framework before started. after management agent done updating refresh packages , go next start level, starting other bundles. to update management agent, best way temporarily install second bundle performs update. spawning threads within management agent not best solution, thre...

.net - dotnet System.Web.Caching.Cache vs System.Runtime.Caching.MemoryCache -

i've got class needs store data in cache. used in asp.net application used system.web.caching.cache. now need use in windows service. now, understand it, should not use asp.net cache in not asp.net application, looking memorycache. the problem not compatible, either change use memorycache in asp.net application, or need create adapter ensure 2 cache implementations have same interface (maybe derive objectcache , use asp.net cache internally?) what implications of using memorycache in asp.net? nadav i go second option , refactor things little bit. create interface , 2 providers (which adapters): public interface icachingprovider { void additem(string key, object value); object getitem(string key); } public aspnetcacheprovider : icachingprovider { // adapt system.web.caching.cache match interface } public memorycacheprovider : icachingprovider { // adapt system.runtime.caching.memorycache match interface }

operator= in c++ -

possible duplicate: trouble inheritance of operator= in c++ hello everyone, let's assume have 2 classes: base{}; //inside have operator= derived{}; //inside don't have operator= why 1 working perfectly: derived der1, der2; der1=der2; //<-here know calls base::operator= and 1 not: derived der1; base bas1; der1=bas1; //<-here why can't call base::operator=? the implicitly declared copy assignment operator looks like derived& operator=(const derived&); this implicitly declared function calls operator= each base class , member subobject (this why base class operator= overload called). bas1 of type base , not derived , , there no implicit conversion base derived , hence doesn't work. need declare appropriate assignment operator in order support assigning object of type base object of type derived (this bit unusual though).

How can I change the Android SeekBar Thumb drawable after 'onCreate' method? -

currently attempting change drawable image of thumb of seekbar in android. in oncreate() method able change thumb using following mseekbar.setthumb(mydrawable); however, after oncreate method called, attempt change again using different drawable same method , thumb disappears. api description 'sets thumb drawn @ end of progress meter within seekbar.' mean image drawn off screen (if 'fill_parent' seekbar)? have tried changing offset no avail, has else run issue? or know how change thumb image while progress changing? i should mention setting background drawable seekbar blank xml file (i.e. not have background image). one thing has partially worked me use setbounds method problem have run in app resets position of thumb drawable beginning of line. don't know if related how code works or if happens no matter how implemented. drawable mythumb = getresources().getdrawable(r.drawable.slider_button); mythumb.setbounds(new rect(0, 0, mythumb.getint...

silverlight - HLSL for getting cylinder effect -

Image
i need write application silverlight 4 , need show images wrapped on cylinder. need hlsl code, wont effects of silverlight. don't wont 3d libarries silverlight. need hlsl code changing pixels. need image this thanks. this seems effect want, may wish change 0.2 value increase or decrease effect or make adjustable in shader that's simple change do. i'd recommend shazzam if not using writing shaders wpf or silverlight. sampler2d input : register(s0); float4 main(float2 uv : texcoord) : color { float y = uv.y+(sin(uv.x*3.14) * lerp(-1,1,uv.y) * 0.2); if(y < 0 || y > 1) return float4(0,0,0,0); else return tex2d(input,float2(uv.x,y)); }

debian - Keeping a bash script running along the program it has started, and sending the program input -

i'm writing simple script control process, script checks if process running, if not: executes it. i need expand ability kill specific process instance (very 1 one script has started) after specified amount of time. problem is, once bash script executed isn't running until executed program finishes.ability pass input process useful, have graceful exit function built in service i'm running. basically, bash script should run along process it's started, , send kill command via stdin after sleep x times out. how forward scripted input process script has started, , how keep script running after executing process? thanks in advance. if want run process alongside script, need run in background: command & pid=$! now pid contain pid of process started. next need way communicate process. if need send input process, use "here document": command <<eof input more input more input var=$home eof that gets more tricky if still need run p...

java - Idiomatic way to use for-each loop given an iterator? -

when enhanced loop (foreach loop) added java, made work target of either array or iterable . for ( t item : /*t[] or iterable<? extends t>*/ ) { //use item } that works great collection classes implement 1 type of iteration, , have single iterator() method. but find myself incredibly frustrated odd time want use non-standard iterator collection class. example, trying use deque lifo/stack print elements in fifo order. forced this: for (iterator<t> = mydeque.descendingiterator(); it.hasnext(); ) { t item = it.next(); //use item } i lose advantages of for-each loop. it's not keystrokes. don't exposing iterator if don't have to, since it's easy make mistake of calling it.next() twice, etc. now ideally think for-each loop should have accepted iterator well. doesn't. there idiomatic way of using for-each loop in these circumstances? i'd love hear suggestions use common collections libraries guava. the best can come in...

c# - How to install dynamic loaded xaps together with the main silverlight application? -

i have application loads xaps dynamically according user permissions. is possible install shell application (oob) , dynamically loaded modules user doesn't have download them every time? i combine advantage of thin shell (fast initial loading time) out of browser 1 (no download until next version). any ideas? as far know there no "out of box" way this. try have first time oob app launched, download external xaps , store them locally in isolated storage. in future oob app can load xaps there instead of re-downloading them.

zend framework - php setcookie vs Zend_Http_Cookie -

why code not working, , how can make works setcookie('cookie_name','cookie_value'); the code not create cookie : $cookie=new zend_http_cookie('cookie_name','cookie_value','.google.com'); or difference between: setcookie('cookie_name','cookie_value'); vs $cookie=new zend_http_cookie('cookie_name','cookie_value','.google.com'); thanks zend_http_cookie not setting cookies, companion class zend_http_client. let's wanted screen scape content off site content available if logged in. use zend_http_client post credentials login form, server send session cookie. include session cookie in subsequent request page want scrape in order simulate logged in user viewing page. to set cookies in zf can use native php function, or possibly store data in session instead.

Maintaining a Python Object when embedding in C -

due refactoring/reworking on controller i've had embed python interpreter inside c application. can call python functions , pass/get objects python fine. the python code controller robot (currently simulated), needs make use of c code comparisons i'm making. previously python code created objects, read sensors, ran control code , wrote outputs motors. of except control code needs done in c. problem have objects created in init function (in python) which, when come run control code no longer exist. what best way solve this? idea return controllers init function , store references them in c, passing reference controller each time called. thanks help. this may not answer want, there ways of working c , python other embedding interpreter inside c application. namely, why don't opposite? create c libraries python? can control general flow of application in python, more comfortable, , call c code whenever see fit. again, i'm not addressing actual...

Phone 7 Bing map control - ManipulationStarted event not starting -

i created regular phone 7 template. drug bing map control main grid. , reason manipulationstarted event not fired when click/interact bing map control in emulator. why happening ? (i using latest phone 7 tools rtm). you need track zoom , pan events instead - i'm never seeing manipulationstarted event firing either. chris

audio - no sound heard while playing a MIDI file in C#.Net -

i use code play midi file game, can not hear sound speakers. me? it's kind of emergency, please... speakers turned on ;) [dllimport("winmm.dll", entrypoint="mcisendstringa")] private static extern long mcisendstring(string lpstrcommand, string lpstrreturnstring, long ureturnlength, long hwndcallback); public static long playmidifile(string midifile) { long lret = -1; if (file.exists(midifile)) { lret = mcisendstring("stop midi", "", 0, 0); lret = mcisendstring("close midi", "", 0, 0); lret = mcisendstring(("open sequencer!" + (midifile + " alias midi")), "", 0, 0); lret = mcisendstring("play midi", "", 0, 0); return lret; } else { //error message return lret; } } i not sure implementation of winmm.dll have tested , working code it. i got source code open source project: tea timer . the implementation of code pretty straight for...

c# - RegistrationServices.RegisterAssembly error - help! -

i have assembly on shared folder (unc-path only, no mapped drive). when try register programmatically via registrationservices , i'm getting strange error. here's code: using system; using system.io; using system.reflection; using system.runtime.interopservices; namespace blregisterassembly { public static class blregisterassembly { public static void register() { var asm = assembly.loadfile(@"\\myuncpath\myassembly.dll"); var rs = new registrationservices(); rs.registerassembly(asm, assemblyregistrationflags.setcodebase); // i've tried assemblyregistrationflags.none : same error. } } } this error i'm getting: "could not load file or assembly '[xxxxxxxxxxxxx], version=1.0.0.0, culture=neutral, publickeytoken=[xxxxxxxxxxxxxx]' or 1 of dependencies. system cannot find file specified." (the file in question referenced assembly main a...

sql server - SqlBulkCopy unable to Parse "0", "1" bool values into BIT on database table -

i using custom csvdatareader : idatareader {} insert bulk values in database table. every datatype bit (from "1"/"0") parsed perfectly. getting following error " value of type string data source cannot converted type bit" while parsing 0 or 1 bool if change these values "true"/"false". taken without problem. i can't alter csv file. replace specific column "0"/"1" "false"/"true" during iteration. not elegant solution. please ! thanks panks i guess you're sending "1" , "0" rather 1 , 0 fyi, sql server accept true , false bit

constructor - Automatically setting class member variables in Python -

say, have following class in python class foo(object): = none b = none c = none def __init__(self, = none, b = none, c = none): self.a = self.b = b self.c = c is there way simplify process? whenever add new member class foo, i'm forced modify constructor. please note class foo(object): = none sets key-value pair in foo 's dict: foo.__dict__['a']=none while def __init__(self, = none, b = none, c = none): self.a = sets key-value pair in foo instance object's dict: foo=foo() foo.__dict__['a']=a so setting class members @ top of definition not directly related setting of instance attributes in lower half of definition (inside __init__ . also, aware __init__ python's initializer . __new__ class constructor . if looking way automatically add instance attributes based on __init__ 's arguments, use this: import inspect import functools def autoargs(*include,**kwargs):...

ruby on rails - Overwriting data to the model -

i using reading table oracle , writing data model using cronjob everymidnight me caching data , enhance speed. using create method writing data in model create new entries , duplicate data in model everytime. there method in model update data or overwrite? model.each |model| p = model.create model.attributes p.save end why want save models? won't caching. should instead profile application , implement caching techniques memcached. but anyways here's code read table: model.each {|model| model.new model.attributes } update according clarification: copying 1 db without duplication done (given model1 accesses source db , model2 access destination db): model1.each |model1| model2 = model2.find_or_initialize_by_id model1.id, model1.attributes model2.save! } this won't handle deletions, however. may still want memcached , maybe database sharding. may worth thinking master/slave replication on database level "slow" database ...

Determine IP address of CONNECTED interface (linux) in python -

on linux machine, 1 of 3 network interfaces may connected internet. need ip address of connected interface, keeping in mind other 2 interfaces may assigned ip addresses, not connected. i can ping website through each of interfaces determine 1 has connectivity, i'd faster waiting ping time out. , i'd not have rely on external website being up. update: all interfaces may have ip addresses , gateways. embedded device. allow user choose between eth0 , eth1 . if there's no connection on interface user tells use, fall eth2 (in theory) work. so need first check if user's selection connected , if return ip. otherwise need ip of eth2 . can ips of interfaces fine, it's determining 1 connected. if default gateway system reliable, grab output route -n line contains " ug " (note spaces) contain ip of gateway , interface name of active interface.

user interface - android UI: ImageButton with animation -

i'm looking make imagebutton contains animation drawable, more precisely repetitive tweened animation of progressbar spinner (like view/widget exists this). in xml specified imagebutton in activity's layout: <imagebutton android:id="@+id/i_back_cover" android:layout_width="wrap_content" android:layout_height="wrap_content" android:scaletype="centerinside" android:gravity="center" android:layout_weight="1" android:adjustviewbounds="true" android:src="@anim/progress_large"> </imagebutton> the "progress_large" animation in res/anim/: <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_interpolator"> <rotate android:drawable="@drawable/spinner_black_76" android:pivotx="50%" android:pivoty="50%" android:...

javascript - How to display the current time continously in a different time zone? -

i display current time continuously in different time zone? the following code display current time continuously. can update time in different time zone.? <script type="text/javascript"> function showtime() { var dt = new date(); document.getelementbyid("<%= textbox1.clientid %>").value = dt.tolocaletimestring(); window.settimeout("showtime()", 1000); } </script> <asp:textbox id="textbox1" runat="server" cssclass="time"></asp:textbox> <script type="text/javascript"> // startup script put in motion window.settimeout("showtime()", 1000); </script> please help thank you joe this article talks how calculate time in timezone: https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-10878_11-6016329.html

c# - WSS3 - setting a default value on a SPFieldType.Boolean after creation -

i'm using wss3 , c# create site , creating class change fields on lists after have been created. have created spfield.boolean type no default value, after upgrade need default value set true. current code not work follows: //web defined current web var list = web.site.rootweb.lists["listwithfieldonit"]; var field = list.fields.getfield("booleanfield"); field.defaultvalue = "1"; field.update(true); list.update(true); i have tried change default value through sharepoint instance , sharepoint manager 2007 , neither of have worked. know of way set default value or doing wrong? thanks in advance code below should more enough update list field definition: var list = web.site.rootweb.lists["listwithfieldonit"]; var field = list.fields.getfield("booleanfield"); field.defaultvalue = "1"; field.update(); you don...

calling jquery function from a dropdown list -

i have following dropdown list box: <select name="ddlconditional1" size="1"> <option selected="selected">is equal to</option> <option>begins with</option> <option onclick="showbetween();">is between</option> <option>is not equal to</option> <option>is greater than</option> <option>is less than</option> </select> i want show() textbox , label based on selecting "is between" option of dropdown list. have multiples of these dropdowns , of them have same thing. in other words have ddlconditional1 2 3 4... infinite. i've been able make button work appends new conditionals. i'd rid of inline handler assignment, , use jquery manage handler. it sounds <select> elements being dynamically added dom, uses jquery's .live() method handle dynam...

python - Segmentation fault in Prime Number generator -

i aware following isn't fastest way of generating list of primes posed myself problem , before googling wrote following program. works fine numbers < ~ 44,000 gives segmentation fault when ran on 2ghz core 2 duo macbook. not interested in alternative methods @ moment in why giving me seg fault. the last prime able calculate 42751 before dies saying 'segmentation fault'. from sys import argv, exit, setrecursionlimit def isprime(no, halfno, x = 3): # if counted through , numbers 3 x not factors prime if x > halfno: print no return 1 # x factor? if no % x == 0: return 0 else: isprime(no, halfno, x + 2) path, limlow, limhigh = argv limlow = int(limlow) limhigh = int(limhigh) setrecursionlimit(limhigh) # negitive numbers, 0 , 1 not primes answer invalid if limlow < 2: exit('invalid input'); # if lower limit not prime increase 1 if limlow % 2 == 0: limlow += 1 while (limlow <= limhigh): isprime(limlow, limlow / ...

actionscript 3 - AS3 I need to convert a string from input to an AS3 object -

how can this? here's have: function send(input):void{ // input.text = "{key: 'value'}" var x:* = stringtoobject(input.text) // able var y:* = x.key; // y must equal 'value' trace(y) // string } you'll need include json library able parse json strings objects. reference as3corelib library more info.

Make changes to main form with ahah callback in Drupal? -

i have form poll form.when there no data in db want show add button , when user clicks "more" want show him/her submit button. used following code seems doesn't works. if ($form['count']['#value'] > 0) { $form['submit'] = array( '#type' => 'submit', '#value' => t('submit') ); } how can this? the values in $form_state['values'] try: if($form_state['values']['count'] > 0){.... i expect @ point $form['count']['#value'] not set.

html - Why is this JavaScript advertisement cropped only when it's loaded inside of an <iframe>? -

as part of project i'm working on, need load admeld ad (a major ad network) inside of <iframe> . can't call add directly due complicated cross-browser limitations. here simple page loads 1 of our ad slot, rotating ad creatives: http://troy.onespot.com/static/stack_overflow/4949/iframe.html i can load page day, , ad looks expected - styling i'm including on page is: * { margin: 0; padding: 0; } this removes margin , padding on <body> element, ad butts against top-left of viewport. this page more accurately simulates how i'm loading ad in project: http://troy.onespot.com/static/stack_overflow/4949/test.html it includes <iframe> loads former page, , same basic styling above remove margin , padding. in general, rendered output of page looks same in first example. however, in internet explorer 6 & 7 , opera 10 (the browsers i've observed in far), (as in 1 in every 5-30 times page loaded) there gap above ad: http://skitc...

silverlight - Applying a style to ItemContainerStyle in C# -

when i'm applying style listbox.itemcontainerstyle in c# isn't making change @ runtime. i'm using; mylistbox.itemcontainerstyle = (style)(app.current.resources["newitemstyle"]); however other styles being supplied, such buttons etc i'm going mybutton.style = (style)(app.current.resources["mymainbuttonstyle"]); i don't errors either, nothing , reverts default system style. i using app.current.resources instead of resources because "newitemstyle" wasn't defined in whole application. mistake.

c++ - Big-O notation Help -

while (n >= 1) n /= 2; i unable big-o notation this i'll follow pointy's advice sake of exposition. try 8. 4 2 1 0: 4 iterations. try 32. 16 8 4 2 1 0: 6 iterations. try 66. 33 16 8 4 2 1 0: 7 iterations. so… how initial numbers changing, , how numbers of iterations changing?

android - imeoptions on HTC devices -

i cannot see imeoptions done , on htc devices while same code works fine motorola. here code <tablerow> <edittext android:hint="name" android:id="@+id/name" android:background="@drawable/chegg_topcorner_rounded" android:layout_width = "50dp" android:layout_height="wrap_content" android:gravity ="left" android:paddingleft = "10dp" android:paddingtop = "9dp" android:paddingbottom = "9dp" android:imeoptions="actionnext" android:textsize="14dp" > </edittext> </tablerow> can help. thanks in advance if "imeoptions done" mean action button, htc sense not appear support action button, except own purposes. soft keyboards not required support action button, cannot assume...

java - Add to menu using addIntentOptions providing multiple intents for a single activity -

i want use addintentoptions drive menus when ever possible. seems cleanest way provide them. rather explicitly detailing activities, ask menu listing activities available data item. so i'm trying put context menu listview . works great. problem have activity has 2 intents consume data type, , first shows up. the activity in question in androidmanifest.xml <activity android:name=".ui.myactivity" android:label="the title"> <intent-filter android:label="first context label"> <action android:name="com.sample.action.first_action" /> <category android:name="android.intent.category.default" /> <category android:name="android.intent.category.alternative" /> <category android:name="android.intent.category.selected_alternative" /> <data android:scheme="myscheme" /> </intent-filter> <intent-filter andr...

Debugging PHP - selecting a request for an Xdebug session -

i work on php code netbeans , xdebug. use xdebug step-by-step debugging , like. i'm able debug flow of default request, not flows generated specific _get/_post or ajax requests. anybody has idea how can done? when run debugger, tab in browser opened automatically following url: http://localhost/?xdebug_session_start=netbeans-xdebug thanks. gidi ok, it goes way: at projects tab (top left of screen in configuration), right click on name of project, , properties => run configuration there have fill 3 forms: 1. project url - base url of project on web, typically http://localhost 2. index file - use browse button , go local copy of index.php or whatever file serves role you. form should contain path file in local filesystem , not on web 3. arguments - arguments wish path script through url this should give ability choose custom url debugging a possible problem: in process may loose synchronization between web addresses , corresponding files in system...

java - Configuring string externalization in Eclipse to use ${key} as field name -

Image
suppose have simple code this: public class externalizestringdemo { public static void main(string[] args) { system.out.println("hello world"); } } now, want externalize greeting, perhaps facilitate internationalization/localization/etc. using eclipse, can use string externalization wizard (source/externalize strings), , configure this: i can proceed wizard , propose these changes: create file personal toys/src/messages.java create file personal toys/src/messages.properties edit externalizestringdemo.java "hello world" becomes messages.getstring("demo_greeting") my question simple: can ask eclipse externalize access use key field names instead? is, want access e.g. messages.demo_greeting . note: if [substitution pattern] simple ${key} , generated code messages."demo_greeting" , not valid java code. if not possible, what's next best thing? (i'm thinking eclipse regex find/replace?). ...

java - ant: handling jar whose contents have file permissions 000 -

i trying overwrite default icon of installer jar created izpack, 1 application: <jar update="yes" jarfile="${pwd}/dist/${release}_installer.jar"> <zipfileset src="${pwd}/dist/app.jar" includes="com/izforge/izpack/panels/**"/> <zipfileset src="${pwd}/dist/app.jar" includes="com/xyz/img/logo.png" fullpath="img/jframeicon.png"/> </jar> this task works in ordinary jar file, img folder of installer jar appears have 0-0-0 file permissions on it, such if extract (notice no r s or w s): $ ll ---------- 1 bguiz staff 742 2004-05-29 11:39 jframeicon.png this means ant task above execute, fails replace required file. there way work around this? note: constrained using ant 1.7.1, preserve0permissions attribute of jar task unavailable.

redirect - In UNIX what "cat file1 > file1 does?" -

when output of command redirected file, output file created or truncated shell before command executed, idea cat foo > foo does? in cases, file truncated. that’s because redirection handled shell, opens file writing before invoking command. cat foo > foo the shell truncates , opens foo writing, sets stdout file, , exec’s ["cat", "foo"] . gnu cat smart , refuses redirect file itself. checking device/inode pair on input , output file descriptors; can read wonderful low-level details in src/cat.c . prints message , quits. bsd cat doesn’t have such safety, since file has been truncated, there nothing read, nothing write, , halt. you can spice things bit appending instead of truncating. echo hello > foo cat foo >> foo now same except shell opens file appending instead of truncating it. gnu cat sees you’re doing , stops; file untouched. bsd cat goes loop , appends file until disk fills up.

Reading from a file in C++ and sending to socket until eof -

i trying read file , write output socket in c++. when trying compile code 2 errors. 1 #include <cassert> #include <arpa/inet.h> #include <cstdlib> #include <iostream> #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <errno.h> #include <string.h> #include <fstream> #include <time.h> #include <strings.h> #include <sstream> #include <vector> #include <netdb.h> #include <netinet/in.h> #include <sys/sendfile.h> #include <fcntl.h> using namespace std; using std::endl; int newscount = 0; int doccount = 0; int photocount = 0; int johns = 0; vector<string> newsvector; vector<string> photosvector; vector<string> docsvector; void serverlogs(const char*msg) /* writing log file */ { time_t rawtime; struct tm * timeinfo; time (&rawtime); timeinfo = localtime(&rawtime); ofstream file; file.open(...