Posts

Showing posts from July, 2011

java - intellisense in eclipse error -

i use eclipse version: 3.4.2 build id: m20090211-1700 problem have when use intellisense error pops out problems during content assist org.eclipse.jdt.ui.java.typecompletionproposalcomputer' plug-in did not complete normally. execution took long return computecontextinformation() operation is there fix it? thanks check, in window > preferences > java > editor > content assist > advanced if there unusual item checked. let java , template proposals checked , apply... maybe 'cause of 1 of other code completion tools.

Why would the return type for a function be specified when it is called in C? -

possible duplicate: need prefixing function (void)… hi, i working c code , author has used syntax unfamiliar with. following call function: (void) msleep(&gactivationcount, null, puser, "com_apple_dts_kext_kauthorama.removelistener", &onesecond); it appear author casting return void or stating function prototype (i because can't resolve function it's prototype), says return value. isn't equivalent to: msleep(&gactivationcount, null, puser, com_apple_dts_kext_kauthorama.removelistener", &onesecond); thanks, scott this old (and extremely eyesore) trick explicitly mark intention ignore return value of function, lint , compilers issue warning. forget ever saw it. on modern compilers, have go out of way turn on warning, , (such gcc) offer extensions flag specific functions ignoring return value dangerous.

core data - "_Unwind_Resume" called upon dead simple fetch request -

i'm trying port on core data code on test mac os application iphone app. set helper method manage of code fetches, , works great on mac os, error on iphone: detected attempt call symbol in system libraries not present on iphone: _unwind_resume called function -[nssqladapter _newselectstatementwithfetchrequest:ignoreinheritance:] in image coredata. here code calls helper method: // authors , title works nsarray *bookinfofetchresults = [self getentitiesbyname:koc_cd_objectkey_bookinfo usingpredicatevalue:@"contentroot.bookinfo.bookauthors > \"\"" withsubstitutionvariables:[nsdictionary dictionarywithobjectsandkeys:nil] inmodel:model andcontext:context sortbyattribute:nil]; int thisresult = 0; int lastresult = [bookinfof

NServiceBus: Message handler types not loading correctly when configuring via code -

after changing subscriber2 project in pubsub sample, getting error when message received subscriber: error nservicebus.unicast.transport.msmq.msmqtransport [(null)] <(null)> - not extract message data. system.typeloadexception: not handle type 'mymessages.eventmessage'. i changed endpointconfig.cs file this: using nservicebus; namespace subscriber2 { public class endpointconfig : iconfigurethisendpoint, asa_server, iwantcustominitialization { public void init() { configure.with(new[] { typeof(eventmessagehandler), typeof(nservicebus.unicast.transport.completionmessage) }) .defaultbuilder() .xmlserializer() .unicastbus() .donotautosubscribe(); } } } does know why doesn't work? you did not specify message type in list. if use overload of with() have supply types. recommend pointing specific assembly instead , letting nsb s

Using Ruby, how do I convert all array values to a given type? -

i need convert fixnums strings. solution is: arr.map {|a| a.to_s} is there better way? arr.map(&:to_s) this uses spiffy new feature in ruby >= 1.8.7, "symbol proc" shortcut , , equivalent code in question.

programming a client to send a HTTP request message to a server with a UDP connection in Java -

i need client send http request message server don't know how in udp, using http 1.1 it needs have specific word in method field, specific name in url field , specific integer in version field. so if wanted send http request message had "inform" in method field, "host1" in url field , 40000 in version field, how this? this have doesn't use http, don't know how change it. bufferedreader infromuser = new bufferedreader(new inputstreamreader(system.in)); datagramsocket clientsocket = new datagramsocket(); inetaddress ipaddress = inetaddress.getbyname("this-pc"); byte[] senddata = new byte[128]; byte[] receivedata = new byte[128]; system.out.println("enter:"); string request ="inform "; string sentence = infromuser.readline(); // request.concat("/r/n"); request.concat(sentence); // request.concat("/r/n"); send

android - Animation BEFORE activity change -

i'm trying simple, can't understand why it's not working. i'm trying is: when touch imageview, show animation on it. , then, when animation ends start new activity. instead, happens new activity starts right away , animation not shown. here animation xml: <rotate android:interpolator="@android:anim/decelerate_interpolator" android:fromdegrees="-45" android:todegrees="-10" android:pivotx="90%" android:pivoty="10%" android:repeatcount="3" android:fillafter="false" android:duration="10000" /> and code use call it: public void oncreate( bundle savedinstancestate ) { final imageview ib = (imageview)this.findviewbyid( r.id.photo ); ib.setonclicklistener( new onclicklistener( ) { @override public void onclick( view v ) { animation hang_fall = animationutils.loadanimation( curriculum.this, r.anim.hang_fall )

android - Does Typeface.createFromAsset() cache? -

simple question: typeface.createfromasset() cache? or should keep reference around in memory keep handy? reason why ask because use quite lot (all maintain single font across many activities / views), i'm wondering if typeface simple bit of caching don't have maintain reference myself. it doesn't, best can tell -- directly calls down into http://google.com/codesearch/p?hl=en#ux1gffpyozk/core/jni/android/graphics/typeface.cpp&l=115 which looks open asset , create new typeface stream. can double check yourself; check , see if same typeface object multiple calls createfromasset same asset.

compiler construction - How to stream program code? -

i've been learning lisp (scheme, racket , clojure various extents) , have read corresponding literature on famous playstation developer naughty dog. this gamasutra article mentions streaming engine streams in game code in addition game data. now, have dialect of lisp called goal use extensively. know of lisp's "code data", although have yet grok concept fully. so, wondering if ability stream code property of code being lisp data or compiled machine code, opposed being generic design pattern can used in many languages? can point me literature on topic? bonus: can point me literature on long-term-listening-compilers mentioned in wikipedia article ? a 'listener' in lisp speak repl (read eval print loop). listeners provide several services integrated debugger, command histories, command interpreters, , more. in many cases listener runs inside lisp 1 using. in cases code typed repl/listener compiled before executing (examples clozure cl, sbcl)

Send encrypted and signed email using C# -

i want send encrypted , signed mail without using third-party api. if send alternate view signature, windows mail can validate it. if send alternate view encrypted data, windows mail can decipher it. if send both, windows mail gets 2 attachements. if sign encryptedbytes , add signed bytes alternative view validates signature , message empty. idea? mailmessage message = new mailmessage(); message.from = new mailaddress(lblmail.text); message.subject = txtsubject.text; string body = "content-type: text/plain\r\ncontent-transfer-encoding: 7bit\r\n\r\n" + structform(); byte[] messagedata = encoding.ascii.getbytes(body); contentinfo content = new contentinfo(messagedata); envelopedcms envelopedcms = new envelopedcms(content); message.to.add(new mailaddress(provmail)); cmsrecipient recipient = new cmsrecipient(subjectidentifiertype.subjectkeyidentifier, this.certificate); envelopedcms.encrypt(recipient); byte[] encryptedbytes = envelopedcms.encode(); signedcms cms = ne

cryptography - How do I decrypt a private key file and sign some text using openssl calls in C? -

i have 2 separate programs (spliced below). first generates key pair , saves files (works fine). second opens private key, decrypting pass phrase , need sign string of text. code below fails on pem_read_privatekey() (last) call (can't see why). can point me @ doing wrong , openssl calls should make use private key sign text? int main (int argc, char *argv[]) { char *priv_pem = "priv.pem"; char *pub_pem = "pub.pem"; char *pass = "password"; file *fp; int bits = 4096; unsigned long exp = rsa_f4; rsa *rsa; evp_pkey *pkey; // generate key rsa=rsa_generate_key(bits,exp,null,null); if (rsa_check_key(rsa)!=1) exit(1,"error whilst checking key",""); pkey = evp_pkey_new(); evp_pkey_assign_rsa(pkey, rsa); // write encrypted private key if (!(fp = fopen(priv_pem, "w"))) exit(2,"error opening pem file",priv_pem); if (!pem_write

Newbie Site fault issue C++ -

i'm working on project create bank accounts , able deposit , withdraw. create 2 bank account , 2 people- 1 one stack , other on heap. should deposit , withdraw each twice , balance print name , id , account numbers. @ moment i'm believe site fault , reading or writing protected memory. i've left comments on think errors lie. appreciate help. thanks. #include <iostream> #include <string> using namespace std; class bankaccount { private: double *balance; int *accountnumber; public: bankaccount(){//default constructor *balance = 0.0;/***this says access violation lies*/ *accountnumber = 0; } bankaccount(double bal, int acctnum){//constructor balance = new double(bal); accountnumber = new int(acctnum); } ~bankaccount() {delete balance; delete accountnumber;} void deposit(double amt) { *balance = *balance + amt; } virtual double getbalance() { return *balance; }

debugging - Basic WPF Layout question -

i learning wpf , trying follow sort of best practice. kind of lost @ moment, , need direction. i creating simple app reads text file (error log) , splits individual error messages. want display these messages (stored in model object) list of messages. since list can consist of many items , want window resizeable, need a vertical scroll bar, want content wrap (i.e. no need horizontal scroll bar). <window x:class="errorlog.ui.wpf.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="800" width="1200" loaded="window_loaded"> <stackpanel name="maincontainer"> <stackpanel orientation="horizontal" name="menu"> <button name="refresh">refresh</button> </stackpanel> <scrollviewer verticalscrollba

Is it possible to make divs behave like tables in IE6 using only CSS and HTML? -

is possible make divs behave tables in ie6 using css , html? using display:table, table-row, or table-cell doesn't work in ie6 if it's possible, approaches? it's not possible (without using css positioning, sizing, etc. won't want)

Android getSystemService inside custom ArrayAdapter -

i trying write custom arrayadapter referencing here code package com.example.andtest; import java.util.arraylist; import android.content.context; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.arrayadapter; import android.widget.textview; public class categoryadapter extends arrayadapter<category> { private arraylist<category> items; public categoryadapter(context context, int textviewresourceid, arraylist<category> items) { super(context, textviewresourceid, items); this.items = items; } @override public view getview(int position, view convertview, viewgroup parent) { view v = convertview; if (v == null) { layoutinflater vi = (layoutinflater) getsystemservice(context.layout_inflater_service); v = vi.inflate(r.layout.list, null); } category c = items.get(position); if (c != null)

When to use "load" rather than "require" in Ruby? -

i understand require loads file once, while load loads every time called. it looks using require preferable in situations. my question is, when use load rather require ? if need force reload (a common example web server or test server). should use autoload when there reasonable chance piece of code won't hit, or want address app load time issues. should use require @ other times.

php - List page menu with children and grandchildren in wordpress -

okay it's been on year since made wordpress theme , i've started again i've run problem menu on pages. this current page hierarchy (i'm still testing hence names) home page *child 1 **grandchild 1 **grandchild 2 *child 2 **grandchild 3 **grandchild 4 **grandchild 5 *child 3 **grandchild 6 page now when visit "this page" want show link "this page" (current) , direct childs (no grandchildren here) of "this page" in sketch: http://img840.imageshack.us/img840/3006/thispage.png now when visit "child 1" of "this page" want show above menu , childs of "child 1" (grandchild 1 & 2) in sub ul under "child 1" in sketch: http://img4.imageshack.us/img4/7868/child1.png and when visit "grandchild 1" want show same menu did "child 1" "grandchild 1" current item instead in sketch: http://img819.imageshack.us/img819/1633/grandchild1.png this current cod

rendering - ASP.NET MVC: set custom name to rendered html element -

i generate html textbox in way: <%: html.textboxfor(m => m.category) %> asp.net mvc render html: <input type="text" value="" name="category" id="category"> is there way set manually name of textbox not eqaul property "category", else? thanks. <%: html.textbox("someothername") %>

java - comparing wav files -

i have (mostly) working program compare 2 wav files, see if smaller 1 in bigger one. done in java. i first making sure both wav files in canonical wave format. byte array of data out of them using audioinputstream. take out data in chunks of frame rate (such right now: 4096 bytes). take first chunk of smaller input, , go through chunks of same size in larger input. i take these chunks , create double arrays same data. fft's , use correlate function find peak in resulting array of correlation coefficients. go next chunk of smaller input, , see if similar peak appears. this works, peaks obvious when files same, , of time results correct. not false positives. do, however, false negatives. this because i'm not sure how "align" data. smaller file come point in larger file. of time, caught via chunking method this. sometimes, if files different, , no peak found, though files should return high correlation. if take 1 of files false negatives (no peak), , tweak

python - Split a list into nested lists on a value -

say have list so: [1, 4, none, 6, 9, none, 3, 9, 4 ] i decide split nested lists on none , this: [ [ 1, 4 ], [ 6, 9 ], [ 3, 9, 4 ] ] of course, have wanted on (9, none) in case, have got: [ [ 1, 4 ], [ 6 ], [ 3 ], [ 4 ] ] this trivial using list append through iteration ( in loop ) i interested know whether can done in faster - list comprehension? if not, why not ( example, list comprehension cannot return more 1 list element per iteration? ) >>> def isplit(iterable,splitters): return [list(g) k,g in itertools.groupby(iterable,lambda x:x in splitters) if not k] >>> isplit(l,(none,)) [[1, 4], [6, 9], [3, 9, 4]] >>> isplit(l,(none,9)) [[1, 4], [6], [3], [4]] benchmark code: import timeit kabie=("isplit_kabie", """ import itertools def isplit_kabie(iterable,splitters): return [list(g) k,g in itertools.groupby(iterable,lambda x:x in splitters) if not k] """ ) ssplit=("ss

c# - Binding Resource to DependencyProperty -

i building customcontrol must unfortunately contain poorly built sub-control have neither code, nor ability re-template (internal yada, yada). have access change resources, leaves me following question: if want expose dependencyproperty on new customcontrol changes value of resource (brush), better make propertychangedcallback sets resource explicitly, or create binding dp , set resource binding. i'm sure doesn't make huge difference in performance, 'right' way go? thank kindly. @ach:- right requirement change brush , may in future may need othere thing on that, better make propertychangedcallback sets resource , other stuff.

php - Active MQ - Listen For Messages -

i have edited portfolio example read data external source , publish it, it's working fine when access http://localhost:8161/demo/portfolio/ thing have app need listen these messages , publish have copied example localhost/demo/portfolio/ can't seem work can me , give me example such thing, because seems can't find this

java - How do I pause autoscrolling of an Android application? -

Image
i have created android layout: this has custom title bar , textview containing sample text. textview inside scrollview. the 'start/stop' button supposed start , stop text automatically scrolling. i using scroller object can't find method pause scrolling. such method exist or should using alternative approach (and if so, what)? put speed = 0

c# - How to mock MQ-Series object MQQueueManager with MOQ for .NET? -

i trying unit test mq-series implementation of project, , need mock connection mq-series server test implementation isolated , avoid sending messages/retrieving messages actual queue. here code: using ibm.wmq; using microsoft.visualstudio.testtools.unittesting; using moq; namespace test { [testclass] public class mqtest { [testmethod] public void sendmessage_moqunittest() { //create mock mq manager var mqmanmock = new mock<mqqueuemanager>(); //test calling send method mymqhandler.mqsender mqsender = new mymqhandler.mqsender(); //error happens when trying access moq object here mqsender.send("test message", mqmanmock.object); } } } i aware not doing setup on moq yet, problem appears before code run against it. the problem when exception. stack trace inner exception message "i/o error occurred": at ibm.wmq.mqchanneltable.create

php - how to install oracle instant client for xampp -

i have xampp windows 1.7.3 installed. i'm using zend framework , need use pdo_oci8 extension. i've enabled extension - getting error can't find oci.dll file. i've downloaded instantclient_11_2 zip file oracle. unzipped it. contains bunch of dll files. how install on windows? need run cmd prompt or move specific folder under xampp? below find instructions on how configure/install , enable oracle instant client for xampp v7, v5.5 , v5.6. download , install xampp modify php.ini in "c:\xampp\php" uncomment following line ";extension=php_oci8_12c.dll  ; use oracle database 12c instant client" restart apache download 32 bit (php 32 bit no need 64) oracle instant client you need both instant client package - basic and instant client package - sdk unzip both in "c:\php-sdk\oracle\x86\instantclient_12_1" , "c:\php-sdk\oracle\x86\instantclient_12_1\sdk" respectivly add directory "c:\php-sdk\oracle\x86\i

c# - Conditionally override all routes (MVC / ASP) -

i have asp.net mvc website connects db via web service. if webservice not contactable, want redirect user page explaining service isn't running. crashes when webservice doesnt respond properly. what best method achieve this? have lots of controllers writing error trapping code each function in each controller specific case tedious , involve lot of code repeation. one easy option write base-controller; override methods want (whether before call ( onactionexecuting ) or upon exception ( onexception )), , add : mybasecontroller each controller. another option decorate each controller filter-attribute same work.

c# - Auto Patcher (Efficient Auto Updater) -

i want auto updater detect modified files (by comparing files on client-side , server) , download modified files. want give me status lively (to show on process bar or something) the scenario there's 1 thousand clients in network, use same application. if new version of application available, have new version. but, bandwidth limited, it's not efficient give them full installer each time. (which currently) i searched around little, , found icepatch2 . exact thing want: getting newest files server when patcher run. problem clients wrote in c# , , can't use icepatch2 inside application. (i have run separate process, or write com or interact icepatch2client) so far, best solution found .net application updater component , customize fit needs. prefer solution dose not require me maintain application. any idea? we use wybuild . it produces binary delta patches - better file-level. has client auto-update component too: wyupdate .

coding style - Loop with conditions in python -

consider following code in c: for(int i=0; i<10 && some_condition; ++i){ do_something(); } i write similar in python. best version can think of is: i = 0 while some_condition , i<10: do_something() i+=1 frankly, don't while loops imitate for loops. due risk of forgetting increment counter variable. option, addressess risk is: for in range(10): if not some_condition: break do_something() important clarifications some_condition not meant calculated during loop, rather specify whether start loop in first place i'm referring python2.6 which style preferred? there better idiom this? in general, " range + break " style preferred - in python 2.x, use xrange instead of range iteration (this creates values on-demand instead of making list of numbers). but depends. what's special number 10 in context? some_condition ? etc. response update: it sounds though some_condition "loop invariant&quo

java me - Handling out of memory exception -

i devloping mobile game..in got out of memory exception in exit when playing multiple times..some of friends said due memory allocation clear memory.. clear memory allocated tiled layer, sprite etc @ each , every level while exit.. i stop thread @ time of exit. handling thread stop in 2 ways given boolean value in while within run method , in exit change boolean value false , next 1 before exit calling thread.interrupt , make thread null.. it hard tell problem suggest use memory profiler catch problem, java me sdk has 1 , nokia s40 emulators have powerful profiler.

service - SMS gateway how to program android app -

i want make sms gateway app, polls website , checks if there messages send in queue, , if there is, app send destination number. there should callback function, post information message, android did it. i thought first create service , poll check on wifi website, refering website "http://www.androidguys.com/2009/09/09/diamonds-are-forever-services-are-not/" not possible create service run forever. what should take in mind make app possible. there lot of tricks, wakelocks, startforeground etc, still service not run forever. thanks. shafqat for sending sms messages: http://developer.android.com/reference/android/telephony/smsmanager.html for checking/polling new messages, best way using push messages. since 2.2 can done cloud device messaging: http://android-developers.blogspot.com/2010/05/android-cloud-to-device-messaging.html , http://blog.boxedice.com/2010/10/07/android-push-notifications-tutorial/ that should work in background, in same way gmail

c# - Clone a container control and its child controls during runtime -

i have windows forms container control (e.g. group box or panel) child controls. want copy/clone container control, exact copy of during runtime. how can achieve c#? what want this: groupbox groupnewbox; groupbox1.cloneto(groupnewbox); hi way copying object implement iclonable interface. far know, windows controls not implement interface, should create own conrtols derived container , child control implement iclonable interface.

javascript - Function not working in Safari -

the function below works in firefox , internet explorer not work in safari. in safari, when click nothing happens. how can fix function work in safari? i've checked javascript enabled (tested in 3 different machines already). thanks ton <script> function win() { $("#main").remove(); $("#content_target").html('<div style="z-index:2;background:url(img/frame_main.png) no-repeat;text-align:left;width:726px;height:491px;"><div id="target" style="padding:5% 5%;float:left"></div> </div>'); $("#target").load("myphp.php", {variable1: "myvariable", variable2: 12}, function(){ $("#my_div").css('background', 'url("img/img_acti.png") no-repeat'); }); } </script> <div onclick="javascript:win();" ><a href="#">click me</a></div> give try, putting function click trigger..

How to commit to 2 svn repository in eclipse -

i have project in svn repository. have 2 projects in eclipse: 1 branch , other trunk. working in svn branch. whenever need commit repository, commit branch , copy/paste in trunk source files , commit trunk. there way can commit 2 repository in single operation? you can commit 2 separate repository locations in eclipse @ same time long both locations under same project. however, asking, still wouldn't work you. should doing making commits branch. once changes branch, use merge tools located under team context menu , merge changes branch project trunk project. this save lots of trouble of manually having merge changes repository's copy of branch trunk project in eclipse. once merge done, commit changes branch repository's copy of trunk. here links examples of how , when this: http://wiki.openmrs.org/display/docs/subversion+branching+and+merging+techniques http://blogs.sourceallies.com/2010/03/simple-subversion-branching-and-merging

java - Why all elements of my list seems to be the same? -

i have following code: integer[] lastexchange = new integer[ncolors]; integer[] newexchange = new integer[ncolors]; while (true) { ... (int i=0; i<ncolors; i++) { lastexchange[i] = newexchange[i]; } ... exchanges.add(lastexchange); output.log.fine("exchange:" + lastexchange[0] + "," + lastexchange[1]); } (integer[] exchange : exchanges) { output.log.fine("exchange:" + exchange[0] + "," + exchange[1]); } i have 2 outputs (one in while loop 1 in loop). first output shows me add different arrays list. while when double check in second loop see elements of exchange list same (they equal first element of list). does know doing wrong here? as unwind's answer states, you're adding reference same array in every iteration of loop. need create new array each time: // it's not clear newexchange populated integer[] newexchange = new integer[ncolors]; while (true) { integer[] lastexc

networking - fetching a webpage using java socket class -

good evening of want fetch webpage using socket class in java , have done as import java.net.*; import java.io.*; class htmlpagefetch{ public static void main(string[] args){ try{ socket s = new socket("127.0.0.1", 80); datainputstream din = new datainputstream(s.getinputstream()); dataoutputstream dout = new dataoutputstream(s.getoutputstream()); dout.write("get /index.php http/1.0\n\n".getbytes()); boolean more_data = true; string str; while(more_data){ str = din.readline(); if(str==null) more_data = false; system.out.println(str); } }catch(ioexception e){ } } } but giving null's. output http/1.1 302 found date: wed, 01 dec 2010 1

sql like - MySQL CONCAT in WHERE Statement (Multi Tables) -

my problem pretty simple - @ least hope is. try join 2 tables in mysql , perform statement on concatenated field produce result. here sample query: select a.name, b.company, concat_ws(' ', a.company, b.name) whole_name users inner join company b on a.company_id = b.company_id having whole_name '%ibm john%' limit 25 this query seems still pulling name column , return no results. i've tried doing: select a.name, b.company, concat_ws(' ', a.company, b.name) whole_name users inner join company b on a.company_id = b.company_id concat_ws(' ', a.company, b.name) '%ibm john%' limit 25 and still doesn't yield results. data absolutely in table. company john ibm computer systems. whole_name field return 'ibm computer systems john smith' query on '%ibm john%' return nothing. any help? thanks, greg need % between ibm , john... it's looking "ibm john" somewhere in text... not ibm

Why is Scala's behavior in case of overloading with by-name parameters different from the case with by-value parameters? -

given scala code: object test { def byval(a: int) = println("int") def byval(a: long) = println("long") def byname(a: => int) = println("=> int") def byname(a: => long) = println("=> long") def main(args: array[string]) { byval(5) byname(5) } } the call byval(5) compiles correctly, byname fails compile: ambiguous reference overloaded definition why? expect observe same behavior by-value , by-name parameters respect overloading… how can fixed? that's because jvm not support "by-name" parameter, scala has implement in way. => x compiles function0[x] , erases function0[object] , makes impossible scala distinguish 2 methods differ expected type of by-name parameter.

locking a specific record in MySQL -

i implement record locking mechanism follows: table1: field: "id" (autoincrement, primary) field: "name" (text) field: "more fields..." table2: field: "id" (unique) in order lock specific record in table1, i'll create record in table2 same id. if creation fails due such record existing, record must locked process , spin. if succeeds, have lock , can modify record. when i'm done, delete lock record in table2. my question whether valid way implement per-record lock, , if not, there such thing? cheers, charlie. you can use innodb row-based locking, or read-lock instead of impose locking table, (rather let mysql handle race-condition)

Are ASP.net Content Web Forms able to access variables declared in the Code Behind section of it's Master Page? -

i have master page controls styling of site. in code behind, there few class instances instantiated variables. these classes validate user access , create user objects i have few web content forms carries out instructions based on user objects. far seems on each web content form have create new instances of classes found on master page. doubling work every web content form. is there anyway can inhereit classes , objects instantiated in master page code behind? expose objects (and controls) public properties ( get controls ) on master page. then, in each aspx page want access these objects, add following declaration @ top: <%@ mastertype virtualpath="~/mymasterpage.master" %> as @kristof points out, access properties master.propertyname also, can determine if makes sense store objects in users session (don't forget must serializable if use db session state). , control access them via properties in base page class pages inherit from. actual

c# - Display HTML in a silverlight application -

i need display html in silverlight application , cannot find way of doing it. cannot use web browser control needs able run in or out of browser. does know of way this, because can think of doing @ moment running replace methods on text replace tags c# equivalents eg( <br /> \n ). the way check if application running inside browser , change means of display accordingly. if running inside browser, overlay application iframe, describe in article: http://www.silverlightshow.net/items/building-a-silverlight-line-of-business-application-part-6.aspx . otherwise, use webbrowser control. have control in source code accompanies book, downloadable apress website here: http://www.apress.com/book/downloadfile/4638 . hope helps... chris

jQuery multiple DIVs - show/hide reset -

edit 2: best see page in action - http://www.justdoors.co/product-selection - need if chooses in first selection box click next opens dropdown, if goes , changes option in first dropdown need second bit reset , hide until click next on relevent option. hi [selection box] if user chooses <option 1> shows option 1 div info , link show div a if user chooses <option 2> shows option 2 div info , link show div b if user chooses <option 3> shows option 3 div info , link show div c if user clicks on link show div a brings second selection box similar options. at moment if user has clicked show div a , changes mind first selection dropdown box div a stays there, need reset , hide div a when click link option show new selection. written way: user chooses <option 1> clicks link div a >> div a shows user changes mind , selects <option 2> >> div a needs hide >> user can click link show div b . t

c# - Finding a percentage -

here's problem. have picture have different height every time according picture that's loaded. i'd scale picture fits inside of document has 800 pixels height. if image has 2560px in height, need find out percentage needed bring pixel height down 750 fits snuggly on page. i'm stuck trying find formula simple enough problem. here's code: itextsharp.text.image pic = itextsharp.text.image.getinstance( image, system.drawing.imaging.imageformat.jpeg); if (pic.height > pic.width) { //maximum height 800 pixels. pic.height formula goes here.... } else { //maximum width 600 pixels. pic.width formula goes here.... } some number p such p * 2560 = 750 . therefore, p = 750 / 2560 = 0.29296875 . of course, make sure floating-point division.

How to get the ip address with an emulator android -

hello aim local address using emulator sdk 2.2. wrote code when run tell me close application. code package exercice1.identificateur.ex; import java.net.inetaddress; import java.net.networkinterface; import java.net.socketexception; import java.util.enumeration; import android.app.listactivity; import android.os.bundle; import android.util.log; import android.widget.arrayadapter; import android.widget.textview; import exercice1.identificateur.r; public class wifi1 extends listactivity { private static final string log_tag = null; public string getlocalipaddress() { try { (enumeration en = networkinterface.getnetworkinterfaces(); en.hasmoreelements();) { networkinterface intf = en.nextelement(); (enumeration enumipaddr = intf.getinetaddresses(); enumipaddr.hasmoreelements();) { inetaddress inetaddress = enumipaddr.nextelement(); if (!inetaddress.isloopbackaddress()) { return inetad

Quirky SELECT from Excel file via OleDbDataAdapter method (C#) -

i have got excel file in form : column 1 column 2 column 3 data1 data2 data1 data2 data1 data2 data1 data2 data1 data2 data3 that is, whole column 3 empty except last row. accessing excel file via oledbdataadapter, returning datatable: here's code. query = "select * [" + query + "]"; objdt = new datatable(); objcmdsql = this.getcommand(); objcmdsql.commandtext = query; objsqldad = new oledbdataadapter(objcmdsql); objsqldad.fill(objdt); return objdt; the point is, in scenario code returns datatable column 1 , column 2. guess jet engine tries infer column type type of first cell in every column; being first value null, whole column ignored. tried fill in zeros , code returning 3 columns; least preferable solution because have process large numbers of small files. inverting selection range (from, i.e. "a1:c5" "c5:a1" ) doesn't work either. i'm looking more

java - How can I add an attribute to a text element in JAXB? -

how can produce following xml fragment using jaxb? <sequence md5="1de2cf633901ff1f00785735c8ce7e70">mptinsalrkvarvrltsg</sequence> my class follows: @xmltype(name = "sequencetype") public class sequence { private string md5; private string sequence; @xmlattribute public string getmd5() { return md5; } // jaxb annotation here?? public string getsequence() { return sequence; } } @xmlvalue on sequence property. @xmltype(name = "sequencetype") public class sequence { private string md5; private string sequence; @xmlattribute public string getmd5() { return md5; } @xmlvalue public string getsequence() { return sequence; } }

search engine - What is the difference between web-crawling and web-scraping? -

is there difference between crawling , web-scraping? if there's difference, what's best method use in order collect web data supply database later use in customised search engine? crawling google, yahoo, msn, etc. do, looking information. scraping targeted @ websites, specfic data, e.g. price comparison, coded quite differently. usually scraper bespoke websites supposed scraping, , doing things (good) crawler wouldn't do, i.e.: have no regard robots.txt identify browser submit forms data execute javascript (if required act user)

java - JPA - "no Metadata found for type" exception -

the jpa implementation used in application kodo. when attempting query db entity, weird exception: org.apache.openjpa.persistence.argumentexception: no metadata found type "class com.verid.ims.model.addressus ". class not appear in list of persistent types: [com.verid.ims.model.birthdate, com.verid.ims.model.personname, com.verid.ims.model.addressus , com.rsa.idv.ims.feedback.imsfeedback, com.rsa.idv.ims.notification.imsnotification, com.rsa.idv.ims.provider.imsprovider, com.rsa.idv.ims.notification.notificationentry, com.rsa.idv.ims.enroll.secretuserquestion, com.rsa.idv.ims.enroll.enrollment]. please take account addressus class, according exception not appear in list of persistent types, in list! (bold) the addressus class mapped in orm.xml file (it's not in persistence.xml descriptor since it's not entity, embeddable). here mapping: <embeddable class="com.verid.ims.model.addressus"> <attributes> <basic name="city&quo

c# - DropDownList with the non-unique values is screwing up viewstate/postbacks -

okay, have dropdownlist control contains 50 listitems, 1 each of 50 states. text value reflects each state name makes each text value unique. however, value property of each list item contains state's current tax rate, means of values not unique. postbacks on control change selected item. there work around this? to duplicate, copy code below new web form. simple dropdownlist. try selecting different states. of them stick, , others not. instance, try selecting "idaho" state; reverts arkansas reason. happening before onselectedindexchanged event fires because if select "idaho" , read selected item in event method on postback, selected item arkansas! annoying. state:<br /> <asp:dropdownlist borderwidth="3px" autopostback="true" backcolor="#ffffcc" id="ddlbillingstate" runat="server"> <asp:listitem value="0" text="not specif