Posts

Showing posts from August, 2010

Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

algorithm - Software Profiling Tools -

is there software/profiling tool given algorithm , set of inputs gives efficiency of algorithm in terms of o-notation big-o describes how running time (and memory space) of algorighm scales inputs of different sizes, such tool have not accept particular input. if can generate range of inputs on range of sizes, feed each input algorithm, measure execution time (and/or memory size), , plot result, can compare against various possible big-o curves. i don't know of such general symbolic algorithm, , sounds bit of ai problem. writing 1 exercise. there algorithms not analyze, might able analyze useful subset.

java - How to do carousel animation in Android? -

i have images, want rotate circularly in carousel fashion. please let me know how in android platform if knows... you can use viewflipper couple of imageviews inside.

javascript - correctness of json document for elasticsearch? -

Image
i new json document,i hava database following fileds: on basis of database field have created json document: ================================================================ {"id":["fifth","first","four","second","thrid"],"keyword":["michel","sam","jerry","john","smith"]} ================================================================ i want know prepared json document correct elastic search or not? if wrong correct document that. thanks i dont think good. should create json in following format. var data = { "fifth" : "michel", "first" : "sam", "four" : "jerry", "second" : "john", "thrid" : "smith" } so when need fourth element, can following var fourth = data["four"]; hope helps!

java - Scrollable JPanel in JTable cell -

i want create custom cell in jtable. used custom renderer , returned jpanel object. works there 1 problem. while program running jpanel draws on using paintcomponent() method. on each "tick" (usually each 100ms) panel getting wider (i m drawing kind of graph) , when becomes big rest hidden. i d resize , create scrollbar. tried several ways of putting scrollpane none of them worked. basically, want thread view in java visualvm. ideas? it hard work put scroll pane inside ordinary table cell, because 1 component used render cells in table. may remove jtable , put large set of components in ordinary jpanel grid layout? if still want use jtable: every scroll pane contain special jviewport control. jviewport control scrolling work, , jsrollpane layout scroll bars. because single viewport used cells, must store somewhere viewport scroll position , restore every painting cell (on getcellrenderer method). jsrollpane need heavy layout work slow solution. may prefera

.net - What is the point of DBNull? -

in .net there null reference, used everywhere denote object reference empty, , there dbnull , used database drivers (and few others) denote... pretty same thing. naturally, creates lot of confusion , conversion routines have churned out, etc. so why did original .net authors decide make this? me makes no sense. documentation makes no sense either: the dbnull class represents nonexistent value. in database, example, column in row of table might not contain data whatsoever. is, column considered not exist @ instead of merely not having value. dbnull object represents nonexistent column. additionally, com interop uses dbnull class distinguish between vt_null variant, indicates nonexistent value, , vt_empty variant, indicates unspecified value. what's crap "column not existing"? column exists, doesn't have value particular row. if didn't exist, i'd exception trying access specific cell, not dbnull ! can understand need differentiate between vt_null

html - jQuery.toggle() extremely slow on many <TR> elements -

i have table this: <table> <tr class="a"><td></td></tr> <tr class="b"><td></td></tr> </table> there 800 rows , of them of class a. want toggle these rows this: $("#toggle_a").click(function(){ $("tr.a").toggle(); }); $("#toggle_b").click(function(){ $("tr.b").toggle(); }); but extremely slow , of time browser wants stop action. has idea how make thing faster , usable? seems because jquery searching element class name.. note: class selector among slowest selectors in jquery; in ie loops through entire dom. avoid using whenever possible. also check this article

network programming - What causes udp reception delay? -

i have noticed when sending packets @ intervals udp socket, first packet sent seems delayed. example, if sending packets every 100 ms, find delay between receiving packets distributed mean 100ms , average standard deviation of 4, on network. however, gap between receive time first , second packets around 10 40 ms - can see, that's statistically significant difference, , question is, what's causing it? i'm using sendto function c on linux. suggested delay might caused arp resolution preventing packet being sent until destination ip has been converted mac address - likely? if restart sending program first packet again takes long though, , delay inconsistent - 10 40 ms pretty big range. i need find out why first packet taking long, , how work around it. edit: further analysis pcap indicates sending program sending packets @ right interval. problem must receiver, using select() wait readable socket, calling recvfrom , printing packet. there sort of buffering going on

php - foreach and preg_match on a heavy amount of data not working properly -

i have files, 1 full of keywords sequences (~20k lines), other full of regular expression (~2.5k). i want test each keyword each regexp , print 1 matches. tested files , makes around 22 750 000 tests. using following code : $count = 0; $countm = 0; foreach ($arrayregexp $r) { foreach ($arraykeywords $k) { $count++; if (preg_match($r, $k, $match) { $countm++; echo $k.' matched keywords '.$match[1].'<br/>'; } } } echo "$count tests $countm matches."; unfortunately, after computing while, parts of actual matches displayed , final line keeping counts never displays. more weird if comment preg section keep 2 foreach , count display, works fine. i believe due excessive amount of data processed know if there recommendations didn't follow kind of operations. regular expressions use complicated , cannot change else. ideas anyone? increase execution time usethis line in .htaccess

model - Grails additional columns in table or list -

i'm trying several days receive list data. domain looks this: class alpha { string string b etc. static hasmany = [beta:beta] } class beta { string integer foo string status static belongsto = [alpha:alpha] static constraints = { status(nullable:false, inlist:["val1","val2","val3", "val4"]) } } i'd have in alpha sum of beta.foo , of beta.foo in status. best additional row ( integer sumval1 ... ). i tried named queries: static namedqueries = { erledigterprobeaufwend { createalias ('beta', 'b') eq ('b.status', 'val1') projections { groupproperty('b.alpha') sum('b.foo', 'sumfooval1') } } } but give me 1 sum @ time. i'm looking forward on that. greetings bas this calculated formula field , subquery trick :

c++ - Why/when is __declspec( dllimport ) not needed? -

in project using server.dll , client.exe, have dllexport ed server symbol server dll, , not dllimport ed client exe. still, application links, , starts, without problem. dllimport not needed, then??? details: i have 'server' dll: // server.h #ifdef server_exports #define server_api __declspec(dllexport) #else #define server_api // =====> not using dllimport! #endif class server_api cserver { static long s; public: cserver(); }; // server.cpp cserver::cserver(){} long cserver::s; and client executable: #include <server.h> int main() { cserver s; } the server command line: cl.exe /od /d "win32" /d "_debug" /d "_windows" /d "_usrdll" /d "server_exports" /d "_unicode" /d "unicode" /d "_windll" /gm /ehsc /rtc1 /mdd /yu"stdafx.h" /fp"debug\server.pch" /fo"debug\\" /fd"debug\vc80.pdb" /w3 /nologo /c /wp64 /z

java - Problem logging out user on chat applet -

i wish users of java chat applet automatically logged out when closing browser window. i use following: public void destroy() { sendlogoutmessage(); } however works 3/4 of time (probably due network delays). the chat applet pings server , logs them out after 90 seconds (this allows them reconnect due internet problems) - removed eventually, way better catch close event. i think code not work in 100% cases because called in destroy method not wait , closes including network connections being opened. so, if network slow applet output streams killed before sends logout message server. if theory correct can check it. try see whether logout command in server logs (in case of failure). believe find command did not arrive. open java console on client side. ioexception or socketexception. hope examining of exception may give idea how improve solution. additionally i'd suggest following. add servlet session listener on server side , logout automatically

GWT and Search Engines -

does gwt app indexed search engines???? if yes, how accomplish that? thanks. gwt apps , more ajax can't indexed search engines... yet . work being done make ajax applications crawlable . common alternative used developers gwt app referenced publish html version.

objective c - Changing the Trashcan icon in the dock -

is possible write program mac os x monitors trashcan , changes icon dynamically when fill can? yes, it's possible. candybar it. expect rather dynamically changing icon, register new 'empty' , 'full' icon dock process.

Jquery body replacement when flash is messing around -

hello stackoverflow friends, i'm trying replace contents in website using following code: var newbody = $('body').html().replace(oldvalue, newvalue); $('body').html(newbody); the problem have flash embedded on dom , whenever try replacement browser crashes. should thing prepend or append in right place should better method achieve this, elements i'm trying locate , replace html comments , append prepend methods not seem work kind of nodes have treated literal strings. any light on this? thanks in advance! you using replace on body. may accidentally destroying of document elements or element attributes. example: <html> <head> <script type="text/javascript" src="http://code.jquery.com/jquery-1.5.1.min.js"></script> <script> jquery(document).ready(function(){ var newbody = jquery("body").html().replace("div", "input"); jquery("body").html(newbo

Is it possible to generate PDF using jQuery? -

i using ajax functionality retrieve content , need export pdf on success of jquery.ajax() . how can that? jquery cannot (because javascript cannot) create pdf data, no...it can get 1 server (like other request), cannot generate one. javascript doesn't have mechanism (though there html5 options being implemented now) create/save file works cross-browser, binary file.

shell - Automated string insertion on windows -

normally i'm mac person, @ new job i'm finding myself using pc. have open html files , every href link insert target blank argument. rather manually wondering if there script use automate process. say: search href find second double quotation after href string insert string "target = _blank" mind have never used shell script on pc in life, explanation might needed here. thanks, i use groovy kind of tasks. thing groovy (as other famous scripting languages), might have done task want accomplish. in case, found this article . demonstrates similar case mentioned (search , replace).

php - Zend Framework: Controllers in separate directories -

i'm quite new in zend framework, learning. i've encountered following problem, don't know if solution :) i've created application uses widgets. widget class implements widget_interface , executed widget_manager. widgets can loaded via widgetcontroller (which calls widget_manager, etc). problem encountered is: widgets can configured, , make code more transparent, i'd widget have own controller (currently, class). problem is, i'd widget configurations addressed via widgetcontroller , , passed specific widget controller. an example: let's i've got widget named 'scrobbler'. when configuring in ui, i'd make ajax request updated settings. make request http://myapp.com/scrobbler/update-info/ , framework run scrobblercontroller , i'd process information here on. idea make request on http://myapp.com/widget/update/scrobbler/ , framework runs widgetcontroller . widgetcontroller call scrobblercontroller , pass other parameters. i'

Does Android really exist on other platforms than ARM? -

i want port aplication written in c++ android. converting application c++ java take lot of work prefer use on making application better platform instead of fixing convertion bugs , solving refactoring problems. the ndk seems route take don't want miss platform(if considerable % of market) because ndk doesn't or won't support it. android claims support mips, arm, x86 , others ... implementations have seen on arm (or arm compatible). checked on site: http://www.pdadb.net/ would bad desision use ndk? there non arm devices run or run android? can find more information this? thanks in advance! at point problem not not lose market share due cpu architecture, there few non-arm android devices @ moment, problem may lose market share due requiring users run android 2.3 or later, have use in order create native application access window, sensor, , input subsystems. avoiding rewriting code goal have rewrite portions of code anyway due android's dissimilar

java - problem with INIT=RUNSCRIPT and relative paths -

i use maven conventions source paths (src/main src/test) , have sql scripts in src/main/resources/scripts. i want run app h2 memory , i'd use jdbc url initialize db : database.url=jdbc:h2:mem:;init=runscript 'src/main/resources/scripts/create.sql'; my problem relative path (src/main/... ) not work, , h2 won't crash if init=runscript command targets nothing. does know path should use make work ? thanks you can use following url: "jdbc:h2:mem:sample;init=runscript 'classpath:scripts/create.sql'" with 1 possible run script classpath. can put src/main/resources/scripts or src/test/resources/scripts in maven (or else) project.

jquery - How to display div dynamically on window -

when click on point of screen need display div on clicked point how this. explain me example example: http://jsfiddle.net/patrick_dw/erg9q/ $(document).click(function(e) { $( "<div class='mydiv'></div>" ).offset({top:e.pagey,left:e.pagex} ) .appendto(document.body); }); css div.mydiv { width: 50px; height: 50px; position: absolute; background: orange; } assign a .click() handler document in handler, create new element $( "<div class='mydiv'></div>" ) set page .offset() point of click .offset({top:e.pagey,left:e.pagex} ) .appendto() page .appendto(document.body)

continuous integration - how to build multiple visual studio targets in team city -

i'm using "visual studio (.sln)" builder in teamcity 6.0, compile both "debug" , "release" configuration targets. can using single builder dont repeat myself? in teamcity build steps try this. in both build steps use same solution. it's crap there isn't better. buildstep0 runner type : msbuild command line parameters: /p:configuration=debug buildstep1 runner type : msbuild command line parameters: /p:configuration=release

oracle - How to get text data from the user in PL/SQL block -

i'm trying text data user when if conditions true, please tell me how in pl/sql developer. presumably, conditions in question known before call user interface pl/sql code. if case, test conditions before call pl/sql (in user interface). if necessary, text user, call pl/sql , pass text.

ms word - Google search with Python -

how perform search query on google using python? how store search results in microsoft word document? see question google search python app contains answer alex martelli (python 2.6) , python 3 port well. should able modify accordingly. uses json , urllib @aphex mentions

sharepoint - XSL changing spaces in a link to %20 -

i need change links automatically created moss07 spaces include %20. example: {$safelinkurl} which output https://stackoverflow.com/example of spaces https://stackoverflow.com/example%20of%20spaces if can shed light on please do. thanks in advance, nick the xslt 2.0 function(s) dimitrie mentioned are: fn:encode-for-uri() fn:iri-to-uri() fn:escape-html-uri() see links detailed specification , examples. in case (if could've used xslt 2.0 processor) fn:iri-to-uri() would've solved problem. but none of these functions not work in current xslt 1.0 environment . please see post future reference other people.

How to convert yuy2 to a BITMAP in C++ -

i'm using security camera dll retreive image camera. dll call function of program passing image buffer parameter, image in yuy2 format. need convert buffer rgb, tried every formula found on internet no success. every example tried (including http://msdn.microsoft.com/en-us/library/aa904813(vs.80).aspx#yuvformats_2 ) gives me wrong colors. i'm able convert buffer bw image using y component of pixel, need color picture. debugged (assembly only) dll shows image in screen , uses directdraw this. using information microsoft link in question: for (int = 0; < width/2; ++i) { int y0 = ptrin[0]; int u0 = ptrin[1]; int y1 = ptrin[2]; int v0 = ptrin[3]; ptrin += 4; int c = y0 - 16; int d = u0 - 128; int e = v0 - 128; ptrout[0] = clip(( 298 * c + 516 * d + 128) >> 8); // blue ptrout[1] = clip(( 298 * c - 100 * d - 208 * e + 128) >> 8); // green ptrout[2] = clip(( 298 * c + 409 * e + 128) >> 8); // red

Dynamic CSS for ASP.NET MVC? -

it looks .net community in general has not picked on css compilers. in searching google i've not found remotely relevant. has using asp.net mvc figured out scheme more intelligently generate css? i'd love able run css through razor example, or sass ported on or have you. maybe have new side project on hands :) i'd love able run css through razor what stops you? public class cssviewresult : partialviewresult { public override void executeresult(controllercontext context) { context.httpcontext.response.contenttype = "text/css"; base.executeresult(context); } } public class homecontroller : controller { public actionresult index() { return new cssviewresult(); } } and in ~/views/home/index.cshtml : @{ var color = "white"; if (datetime.now.hour > 18 || datetime.now.hour < 8) { color = "black"; } } .foo { color: @color; } now that's l

Google Maps Transit: Time it takes from point A to B -

i found code shows map , calculate travel time driving. possible find travel time using transit (e.g. bus) ? code found using google.maps.directionstravelmode.driving , looked api , driving, bicycling , walking available. thanks in advance! unfortunately, google maps supports static route computation. when talk satic means system considers route , average speeds, fixed, determine travel time. taking buses account require comprehensive knowledge of bus lines, stops , timetables. it's not impossible do, hard. example, estimated bus travel time must take account waiting time next bus @ stop, , must have knowledge of timetables too! (not lines , speeds). the same applies merging bus , underground (where available). i hope believe that, in future, google maps able provide these information too.

Reading PDF form field data from Flex 4 ( via php or coldfusion ) -

been searching web answer month. not expert in coldfusion. supposedly easy in cf -- mark-up confuses heck out of me. here am. i have managed import , read pdf using cf proxy actionscript: http://forums.adobe.com/thread/754629?tstart=0 --- --- after trouble there, precious form filed information looking not there in pdf info object. grrrr. looking way cfc's or cfm's or php. all want this: read pdf flex app. get form field information. write new pdf form field values. i have found many close no cigar options ... , have tried many failed. there many free pdf , out there. adobe seems reserve real functionality themselves. free options don't seem have access form data? anyways exhausted looking ways this. need help! it possible collect form data , not whole pdf file lot more efficient in case not need pdf form data. assuming interested in form data. you can have pdf file submit fdf or xfdf (in acrobat, create button, select action submit ,

knockout.js - Updating view model from object not working -

i want able observe object inside view model. have simple example doesn't work expected, can see problem? using knockout 1.1.1, have 2 inputs such: <form data-bind="submit: save"> <input type="text" data-bind="value: deckname" /> <input type="text" data-bind="value: deck().name" /> <button type="submit">go</button> </form> when page loads, inputs default values, on submitting form viewmodel.deck().name not updated viewmodel.deckname is. <script type="text/javascript"> var initialdata = {"name":"test"}; var viewmodel = { deck: ko.observable(initialdata), deckname: initialdata.name, save: function() { ko.utils.postjson(location.href, { deck: this.deck, deckname: this.deckname }); } }; ko.applybindings(viewmodel); </script> on form post, deck still send "t

osx - Applescript to make new folder -

i want make new folder command in apple script why dosent script work? tell application "finder" activate end tell tell application "system events" tell process "finder" tell menu bar 1 tell menu bar item "file" tell menu "file" click menu item "new folder" end tell end tell end tell end tell end tell you can more directly applescript: tell application "finder" set p path desktop -- or whatever path want make new folder @ p properties {name:"new folder"} end tell

python - SqlAlchemy equivalent of pyodbc connect string using FreeTDS -

the following works: import pyodbc pyodbc.connect('driver={freetds};server=my.db.server;database=mydb;uid=myuser;pwd=mypwd;tds_version=8.0;port=1433;') the following fails: import sqlalchemy sqlalchemy.create_engine("mssql://myuser:mypwd@my.db.server:1433/mydb?driver=freetds& odbc_options='tds_version=8.0'").connect() the error message above is: dbapierror: (error) ('08001', '[08001] [unixodbc][freetds][sql server]unable connect data source (0) (sqldriverconnectw)') none none can please point me in right direction? there way can tell sqlalchemy pass specific connect string through pyodbc? please note: want keep dsn-less. the example @singletoned not work me sqlalchemy 0.7.2. sqlalchemy docs connecting sql server : if require connection string outside options presented above, use odbc_connect keyword pass in urlencoded connection string. gets passed in urldecoded , passed directly. so make work used:

javascript - checking for an array in an multidimensional array (pref-jQuery) -

i've got multi-dimensional array, , i'm trying check if holds array. i'm using jquery.inarray function @ moment (i trying array.prototype kept getting errors, never used before). i trying ensure parent array doesn't add same child array twice if(jquery.inarray(new array(step[0],step[1],r2),unavailarray)==-1){ alert(jquery.inarray(new array(step[0],step[1],r2),unavailarray)); unavailarray.push(new array(step[0],step[1],r2)); } i've tried jquery.inarray("[step[0],step[1],r2]",unavailarray)==-1 and jquery.inarray([step[0],step[1],r2],unavailarray)==-1 they return -1, , when @ array, have [[630,690,09],[3180,3220,2],[3180,3220,2]] so isn't working. i believe you're issue keep adding new array() arrays instead of giving them variable name point to, hence they're never same though may have same exact content each other. for work wish need assign new array([step[0],step[1],r2]) variable , check varia

python - How to override save() method of modelform class and added missing information? -

i started learn django , had question. i'm trying automatically add missing information, when saving form data. change/add desired "cleaned_data" information overriding save() method of modelform class, changes not recorded in database. actually, how write modified information? code: def save(self, commit = true, *args, **kwargs): temp = servicemethods(url = self.cleaned_data.get('url'), wsdl_url = self.cleaned_data.get('wsdl_url')) if not temp.get_wsdl_url(): temp.make_wsdl_url() if temp.get_wsdl_url(): temp.make_wsdl() self.cleaned_data['wsdl_url'] = temp.get_wsdl_url() self.cleaned_data['wsdl_description'] = temp.get_wsdl_description() super(serviceform, self).save(commit = commit, *args, **kwargs) and model: class services(models.model): name = models.charf

Android, Facebook SDK and Single Sign On: Either my App fails with "invalid_key" or Facebook App fails -

in november 2010 facebook introduced single-sign-on android-applications. supposedly can login facebook-app, , dont need login again in other applications, if connect facebook-login. experienced, 1 of applications, either facebook-app, or app fails login. if facebook-app installed, , i'm logged in, cant log onw app, instead error "invalid_key" if on other hand, first install app, i'm logged app facebook-login, , afterwards install facebook app , try logon their, facebook app fails , cant login. others seem have same issue: https://github.com/facebook/facebook-android-sdk/issues/closed#issue/140 is there out there ran same issue , solved it? this issue because of number of reasons, related wrong key-hash. have answered similar question here .

javascript - Passing IDs of table rows -

i new javascript , not long ago ask following question: i have normal html table each row has own id. want achieve each time click link in row id row should stored in variable , later passed function. let's click row#1 id#1 should passed , on... how can achieve this? i got answer. example works in jsfiddle http://jsfiddle.net/andrewwhitaker/9heqk/ but if copy javascript , table html file whole thing doesn't work , can't find answer. me again please? thank much! if need row id why not using simple code this: html: <table id="table-one"> <tr id="row-one"> <td><a href="javascript: void(0)" id="one" onclick="saverow( 1 )">one</a></td> </tr> <tr id="row-two"> <td><a href="javascript: void(0)" id="two" onclick="saverow( 2 )">two</a></td> </tr> </table>

sql server 2005 replication article conflict -

i have sql server 2005 database want setup replication for. problem database has 2 schemas both of have table same name in it. for reason though tables in different schemas replication creation fails when done through management studio due conflicting article names (i assume trying create same name both tables in different schemas). is there workaround doing in studio, can write script or program 1 thign bit annoying , wont allowed run in production. perhaps there hot fix or i'm not aware about? cheers, there doesn't appear way around purely using new publication wizard in ssms - article name table name without schema-qualifier, , can't customised wizard - although there work-around if use scripting options. go through wizard normal, @ end of process, untick "create publication" option , select "generate script file..." option. once file created, open , edit article names no longer conflict, execute script in publication database

Using SAS to format a string as a substring -

i new sas formats. say have string in form of nnn.xxx nnn number in format of z3. , xxx text. e.g. 001.nul , 002.abc now can define format, fff, such b = put("&nnn..&xxx.",fff.); returns &xxx. part? i know can achieve using b = substr("&nnn..&xxx.",5,3); want have format can assign format variable , not have create new variable out of it. thanks in advance. probably way code own custom character format using sas/toolkit. easier create variable substr().

android - How do you get the user to add to a list? -

i want make user clicks button, opens dialog box, user types in name of item, adds item list. far, i've gotten dialog box opens edittext, ok , cancel button dismisses box. how do this? here .java file: package com.shoppinglist; import android.app.listactivity; import android.app.dialog; import android.os.bundle; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; public class shoppinglist extends activity { public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); button button1main = (button) findviewbyid(r.id.button01main); button1main.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { final dialog dialog = new dialog(shoppinglist.this); dialog.setcontentview(r.layout.maindialog); dialog.setcancelable(true); button button = (button) dialog.findviewbyid(r.id.cancel); button.s

security - Getting System.UnauthorizedAccessException while trying to write to a file from the web service -

my code: [webmethod] public string helloworld() { string path = @"d:\data\wwwroot\myservice\myservice\log.txt"; if (file.exists(path)) { using (streamwriter sw = new streamwriter(path)) { sw.write("some sample text file"); return "wrote file"; } } else { return "file doesnt exist"; } } what getting is: system.unauthorizedaccessexception: access path 'd:\data\wwwroot\myservice\myservice\log.txt' denied. @ system.io.__error.winioerror(int32 errorcode, string maybefullpath) @ system.io.filestream.init(string path, filemode mode, fileaccess access, int32 rights, boolean userights, fileshare share, int32 buffersize, fileoptions options, security_attributes secattrs, string msgpath, boolean bfromproxy) @ system.io.file

rubygems - conflicting ruby gems -

i need use 2 gems in project both claim pdf namespace: pdf-reader , htmldoc. is there way them play nice together? way can think of rewrite own version of htmldoc give different namespace. there's no elegant solution problem. if need 2 gems working side side think best option fork 1 of them (or possibly both) , use fork. how i'd go it: if either gem hosted on github fork it, or if both on github fork 1 seems least work. if neither gem on github, see if can hold of source (grabbing gem possibility, finding real repository might helpful there may other files there not included in gem), , put in repository on github. make sure gem's license allows (which if it's 1 of common open source licenses). make changes. make sure there .gemspec file in root of repository, next step not work otherwise. use bundler manage projects dependencies. instead of specifying dependency library you've modified gem 'the_gem' specify this: gem 'the_

python - Measuring bytecode usage -

i'm looking absolute method benchmark/measure computations performed in python. in java, it's possible calculate bytecode usage given set of instructions. there similar approach take in python? i'm open alternative suggestions measuring computation performed long variance minimal (time example, far sensitive machine code being run on). check out dis module . >>> import dis >>> def x(a,b): ... return a+b ... >>> dis.dis(x) 2 0 load_fast 0 (a) 3 load_fast 1 (b) 6 binary_add 7 return_value

android - How to load an image stored in a byte array to WebView? -

everyone! have compressed lots of pictures "pictures.zip" file. want load 1 of these pictures webview this: webview wv = (webview)findviewbyid(r.id.webview01); wv.loaddatawithbaseurl(null,"<img src=\"abc.jpg\">", "text/html", "utf-8", null); here,"abc.jpg" picture has been compressed pictures.zip file. i want decompress picture zip file , picture's byte stream, , load image webview byte stream. i don't want decompress picture zip file , save sdcard , load it. moreover, don't want encode pitcture's byte base64 , load image webview either, because these 2 ways slow. as far know, there no way have 3 of these requirements. base64 encoding , loading image tag directly best bet if don't want write storage, although can still write internal storage , show in webview. private static final string html_format = "<img src=\"data:image/jpeg;base64,%1$s\" />"; pr

user interface - Print msg to the console from GUI app - C# -

hi want print messages when i'm running c# gui app on visual studio. it's debugging. tried it, not worked. console.writeline() didn't work or may work, couldn't see messages. knows this? give me solution if know. thank you. call debug.writeline , print visual studio's output window.

Duplicate interface definition when mixing Objective-C files in projects in XCode -

i have situation have 1 xcode project, , have project shares of code it, small differences. in project, of files references files original project, , anywhere need make differences, copy file , change copy. useful because files shared, changes made in 1 project automatically reflected in other. has worked fine part. now running problem need make change in header file included among lot of files. call file "shared.h". same thing did before, delete reference , copy file on , change it. but problem when compile, hundreds of "duplicate interface declaration" errors files include header. understand why, can't think of way fix it. the reason suppose have file includes headers both original project , new project. in files references original project, when #import "shared.h" , import file directory of original project; , in files copied new project, when #import "shared.h" , import file directory of new project. classes defined in header im

abstract syntax tree - Groovy AST Transformations - How can I figure out the return type of a MethodCallExpression? -

with groovy ast transformations , how can figure out return type of methodcallexpression ? methodcallexpression.gettype() returns java.lang.object if explicitly define return type of method in method definition. due dynamic nature of groovy, ast can't know return type of method call expression @ compile time. example: class example { string foo() { "foo" } } def e = new example() assert e.foo() == "foo" looks simple enough. foo returns string, methodcallexpression e.foo() should have type of string , right? if foo changed in metaclass? class example { string foo() { "foo" } } def e = new example() if (someruntimecondition) { e.metaclass.foo = { -> 42 } } assert e.foo() == "foo" // foo string or int? the groovy compiler doesn't have enough information make assumptions method call since change @ runtime, has compile down object.

spring - Showing the URL of the view in the address bar, instead of the one of the action -

@requestmapping(value = "updatepatient", method = requestmethod.post) public modelandview postupdatepatientbyid( @modelattribute("patient") patientform patientform, httpsession session) { long id = (long) session.getattribute("refid"); if (id != 0 || id != null) { patient patient1 = hospitalpatienthelper .getpatientfrom_patientform(patientform); patientservice.updatepatient(patient1, id); patientservice patientservice) { patient patient = patientservice.getpatientbyid(id); modelandview mv; patientform patientform = hospitalpatienthelper .getpatientform_frompatient(patient); list<weight> weights = patientservice.viewlast10recordedweight(patient); weighttable weighttable = new weighttable(); list<weightsummarytable> summaryweights = weighttable.summary(weights, patient.getheight()); mv = new modelandview("patient1/patientde

codeigniter - Calling same model function with different parameters not returning values -

soooo....long time reader first time poster. first time, can't find answer! i've got model returns array of results (working). loop through results foreach , append array additional values second function in model. problem first of several function calls return results. function get_offering_total() returns value first listed call (cash). returning correct value, subsequent attempts use same function returns nothing. var_dump shows array structured correctly on output, values null. there issue calling same model method different parameters? needs cleared/reset? here's code... //$data['offerings'] stores results first query foreach( $data['offerings'] $key => $value ) { //set filters $cash_filter = array( 'method' => '5' ); $checks_filter = array( 'method' => '6' ); //get totals $data['offerings'][$key]['cash'] = $this->model_records->get_offering_total( $value['offer

Style first 2 TextViews in Android ListView differently -

i have listview , want first 2 entries in displayed differently rest. nothing fancy, want them text views. first 2 entries need have different sizes , weights rest. tried modifying arrayadapter class so: private class busstopadapter<t> extends arrayadapter<t>{ public busstopadapter( context context, int textviewresourceid, list<t> objects) { super(context, textviewresourceid, objects); } public view getview(int position, view convertview, viewgroup parent) { textview toreturn = (textview)super.getview(position, convertview, parent); if(position == 0){ toreturn.settextsize(12); toreturn.settext("previous bus: " + toreturn.gettext()); toreturn.setpadding(0,0,0,0); } else if(position == 1){ toreturn.settextsize(20); toreturn.setpadding( toreturn.getpaddingleft(), 0, toreturn.getpaddingright(), 0 ); toreturn.settext("next bus: &

C++ Graphics Library in Visual Studio and Eclipse -

is there graphics library available in vs or eclipse c++? creating pacman game graphics library should try? sdl c library, if you've been using c++ while, may find simple interface cumbersome. however, widely-used library in category. sdlmm c++ library wrapper sdl presents friendly c++ face sdl. sfml c++ media library features similar sdl. rather quite it, , works well.

python - import xml.parsers.expat does not work after PyXML installation -

Сonsequently, pyxml not work too. before pyxml installation command import xml.parsers.expat works well. error message: >>> import xml.parsers.expat traceback (most recent call last): file "<pyshell#0>", line 1, in <module> import xml.parsers.expat file "c:\python27\lib\site-packages\_xmlplus\parsers\expat.py", line 4, in <module> pyexpat import * importerror: dll load failed: specified module not found. python 2.7.1, pyxml 0.8.4, ms windows 2003 32-bit.

Error in asp.net c# code (mysql database connection) -

my code update record if exists in database else insert new record. my code follows: protected void button3_click(object sender, eventargs e) { odbcconnection myconnection = new odbcconnection("driver={mysql odbc 3.51 driver};server=localhost;database=testcase;user=root;password=root;option=3;"); myconnection.open(); string mystring = "select fil_no,orderdate temp_save fil_no=? , orderdate=?"; odbccommand mycmd = new odbccommand(mystring, myconnection); mycmd.parameters.addwithvalue("", hiddenfield4.value); mycmd.parameters.addwithvalue("", textbox3.text); using (odbcdatareader myreader4 = mycmd.executereader()) { //** if (myreader4.read()) { string mystring1 = "update temp_save set order=? fil_no=? , orderdate=?"; odbccommand mycmd1 = new odbccommand(mystring1, myconnection);

c# - How to start a thread to keep GUI refreshed? -

i have window button triggers lengthy processing. put processing in separate thread, -- surprise -- makes gui frozen anyway. no control refreshed, cannot move window. so the question how start thread, won't interfere gui, i.e. gui date (while processing change data, , gui displays pieces of it)? that how start thread currectly: var thread = new thread(dolearn); thread.isbackground = true; thread.start(); edit 1 jon: i don't use locks @ all no join calling the ui thread left alone -- sits there the processing big loop math operations, not allocating memory, on ui side have controls binding (wpf) data, number of current iteration of main loop. should refreshed each time main loop "ticks". counter of loop property triggers onpropertychanged each change (classic wpf binding). edit 2 -- there! ok, jon hit nail @ head (who surprises? ;-d) -- thank you! problem comes changing counter. when used instead counter, local counter

oop - object-oriented shell for linux? -

is there similar microsoft powershell (an object-oriented shell built on .net framework) linux (possibly built on java, gobject, or own object type/nothing)? edit: if similar bash or powershell or cmd etc. syntax (=''standard'' shell syntax) python. no joking. scripting languages scripting languages, , python particularly nice 1 many people find approachable.

javascript - Get country from latitude longitude -

i know how can country name latitude & longitude using javascript. open use of google maps’ javascript api. can city , zip? edit: aim fill address field automatically, not display on map. i don't know if works google maps, there web service returns country code , takes parameters lat , long. here example: http://api.geonames.org/countrycodejson?lat=49.03&lng=10.2&username=demo i found little description: the iso country code of given point. webservice type: rest url: ws.geonames.org/countrycode? parameters: lat , lng , type , lang , radius (buffer in km closest country in coastal areas) result: returns iso country code given latitude/longitude with parameter type=xml service returns xml document iso country code , country name. optional parameter lang can used specify language country name should in. json output produced type=json see docs edit: please note demo demonstration user , should create user account

java - Xerces behaving differently on SUN JRE v1.5 and IBM J9 v1.5 -

i trying parse html using nekohtml . the problem when below code snippet executed on sun jdk 1.5.0_01 works fine (this when using eclipse sun jre). when same thing executed on ibm j9 vm (build 2.3, j2re 1.5.0 ibm j9 2.3 windows xp x86-32 j9vmwi3223ifx-20070323 (jit enabled) not working (this when using ibm rad development). nodelist tags = doc.getelementsbytagname("td"); (int = 0; < tags.getlength(); i++) { element elem = (element) tags.item(i); // elem } by working fine mean getting list of "td" elements can process further. in case of j9 not entering for loop. i using latest version of nekohtml (along bundled xerces jars). doc in above code of type org.w3.dom.document (the runtime class used org.apache.html.dom.htmldocumentimpl ) the ibm j9 details follows: java version "1.5.0" java(tm) 2 runtime environment, standard edition (build pwi32devifx-20070323 (ifix 117674: sr4 + 116644 + 114941 + 116110 + 114881)) ibm j9 vm (build

java - Why Joda DateTimeFormatter cannot parse timezone names ('z') -

from datetimeformatter javadoc : zone names: time zone names ('z') cannot parsed. therefore timezone parsing like: system.out.println(new simpledateformat("eee mmm dd hh:mm:ss z yyyy").parse("fri nov 11 12:13:14 jst 2010")); cannot done in joda: datetimeformatter dtf = datetimeformat.forpattern("eee mmm dd hh:mm:ss z yyyy"); system.out.println(dtf.parsedatetime("fri nov 11 12:13:14 jst 2010")); //exception in thread "main" java.lang.illegalargumentexception: invalid format: "fri nov 11 12:13:14 jst 2010" malformed @ "jst 2010" //at org.joda.time.format.datetimeformatter.parsedatetime(datetimeformatter.java:673) i think reason 'z' timezone names conventional (not standardized) , ambiguous; i.e. mean different things depending on country of origin. example, "pst" can "pacific standard time" or "pakistan standard time". if interested, this site

c# - Programatically import cert into IIS? -

i have .pem certificate ssl, want distribute web application in msi (has run on clients' computers). need import (into credentials store?) , tell site bindings use it. how can in code? i've discovered microsoft.web.administration, not sure go there … this in iis7 btw. edit: goal here have web application customers can run on intranets. acts api iphone app. (maybe isn't best design we're locked in now.) customer installs msi, , voila, have web service. there needs password authentication between iphone , web service; simplest way seemed to in https. made self-signed cert. i'm aware redistributing single cert bad idea, we're trying defeat casual hackers here … going intranet , businesses only, seems unlikely going doing crazy, , api severely restricts amount of bad things able database anyways. so there go, goal have password authentication on intranet web app, one-click(ish) installation. :-d the answer, dear readers, this: // assume '

How to delete/create databases in Neo4j? -

is possible create/delete different databases in graph database neo4j in mysql? or, @ least, how delete nodes , relationships of existing graph clean setup tests, e.g., using shell commands similar rmrel or rm ? you can remove entire graph directory rm -rf , because neo4j not storing outside that: rm -rf data/* also, can of course iterate through nodes , delete relationships , nodes themselves, might costly testing ...

c - How to set conditional breakpoint if malloc returns NULL via gdb -

sample source code: #include <stdio.h> #include <stdlib.h> #include <errno.h> #define gigabyte 1024*1024*1024 int main (void) { void *foo; int result; foo = (void *) malloc (gigabyte*5); result = errno; if (foo != null) { return 2; } else { fprintf (stderr, "error: %d\n", result); return 1; } return 0; } question: how instruct gdb ( # gdb -silent ./huge_malloc ) stop/halt execution, if malloc() returns 0x0 , without checking if foo 0x0 you identify exit point of malloc , put conditional breakpoint there. such as: (gdb) tbreak main breakpoint 1 @ 0x4005c4: file t.c, line 13. (gdb) r starting program: /var/tmp/a.out main () @ t.c:13 13 foo = malloc (64); (gdb) br *__libc_malloc+211 if $rax==0 breakpoint 2 @ 0x7f26d143ea93 (gdb) n 14 foo = malloc (gigabyte*64)

java - Native functions throw UnsatisfiedLinkError in custom view, despite working in main activity -

for reason can call native functions main activity , not custom views i've created. here example file (i followed tutorial, renamed classes http://mindtherobot.com/blog/452/android-beginners-ndk-setup-step-by-step/ ) see usage of native function "getnewstring". package com.example.native; import android.app.activity; import android.app.alertdialog; import android.content.context; import android.graphics.bitmap; import android.graphics.canvas; import android.os.bundle; import android.view.view; public class nativetestactivity extends activity { static { system.loadlibrary("nativetest"); } private native string getnewstring(); @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); this.setcontentview(new bitmapview(this)); string hello = getnewstring(); // line works fine new alertdialog.builder(this).setmessage(hello).show(); } }

c - count the number of zero group bits in a number -

how count number of 0 group bits in number? group bits consecutive 0 or 1 bits, example, 2 represented ....0000000000000000010 has 2 0 bits groups least significant bit , group starts after one. also, in bad need algorithms on bits manipulation if 1 has reference, please share here couple fun ways it. #define-s @ beginning being able express function inputs in binary notation. 2 functions work variations on theme: first 1 uses de bruijn sequence , lookup table figure out how many trailing zeros there in parameter, , rest accordingly. second uses mod37 table same, similar in concept involves modulo operation instead of multiplication , bit shift. 1 of them faster. lazy figure out one. this lot more code obvious solution. can effective if have zeros in input, requires 1 loop iteration (just 1 branch, actually) every 1-bit, instead of 1 loop iteration every bit. #define hex__(n) 0x##n##lu #define b8__(x) ((x&0x0000000flu)? 1:0) \ +((x&0x0

virtuemart - joomla1.5 extension virtue mart :sample data installation problem -

i error after clicking go directly shop or install sample data virtuemart component. module installed fatal error: maximum execution time of 30 seconds exceeded in d:\hosting\7116670\html\administrator\components\com_virtuemart\tar.php on line 1443 please help is live site? in experience better off using joomla+virtuemart package rather trying install on existing joomla site.

unit testing - Parameterized jUnit test without changing runner -

is there clean way run parameterized junit 4 tests without changing runner, i.e. without using @runwith(parameterized.class) ? i have unit tests require special runner , can't replace 1 parameterized . maybe there kind of "runner chaining" both runners @ same time? (just wild guess...) org.junit.runners.parameterized created org.junit.internal.builders.annotatedbuilder reflect mechanism. maybe extend parameterized own runner: @runwith( myparameterized .class).

mysql - how often optimize table query called -

actually queried optimize table query 1 table. didn't operation on table. again i'm querying optimize table query @ end of every month. data in table may changed once in 4 or 8 months. create problem in performance of mysql query? if don't dml operations on table, optimize table useless. optimize table cleans table of deleted records, sorts index pages (brings physical order of pages in consistence logical one) , recalculates statistics. for duration of command, table unavailable both reading , writing, , command may take long large tables.

LINQ orderby int array index value -

using linq sort passed in int arrays index. so in code below attribueids int array. i'm using integers in array clause results in order in while in array. public list buildtable(int[] attributeids) { using (var dc = new mydc()) { var ordering = attributeids.tolist(); var query = att in dc.dc.ecs_tblattributes attributeids.contains(att.id) orderby(ordering.indexof(att.id)) select new common.models.attribute { attributeid = att.id, displayname = att.displayname, attributename = att.name }; return query.tolist(); } } i recommend selecting attributeids array instead. ensure items correctly ordered without requiring sort. the code should go this: var query = id in attributeids let att = dc.dc.ecs_tblattributes.firstordefault(a => a.id == id) att != null s

model view controller - Dynamic button .net MVC -

i wish create follow style button on view in mvc not sure whether should using htmlhelper or not. button need show different text depending upon whether or not user following item , call different script when clicked if user deciding follow or unfollow. should helper create button entirely or contents of button? mvc purists argue decision on whether user can follow item should made in controller , passed in model. boolean value passed htmlhelper. public static string followbutton(this htmlhelper source, bool isfollowing) { if (isfollowing) { return "<button>unfollow</button> //unfollow button } else { return "<button>follow</button> //follow button } } then on view <%= html.followbutton(model.isuserfollowing) %> and following standards, javascript should created separately. use class="follow" on follow button means javascript identify script should used.

visual c++ - What is the fastest way to get just the preprocessed source code with MSVC? -

i'm trying find fastest way complete preprocessed source code (i don't need #line information other comments, raw source code) c source file. i have following little test program includes windows header file ( mini.c ): #include <windows.h> using microsoft visual studio 2005, run command: cl /nologo /p mini.c this takes 6 seconds generate 2.5mb mini.i file; changing to cl /nologo /ep mini.c > mini.i (which skips comments , #line information) needs 0.5 seconds write 2.1mb of output. is aware of techniques improving further, without using precompiled headers ? the reason i'm asking wrote variant of popular ccache tool msvc. part of work, program needs compute hash sum of preprocessed source code (and few other things). i'd make fast possible. maybe there dedicated preprocessor binary available, or other command line switches might help? update: 1 idea came mind: define win32_lean_and_mean macro strip out lots of needed code. speeds ab

xsd of a web service -

i need generate xsd of .net web service. can let me know how can go doing it. have tried using xsd.exe /u:url of web service. can tell me if possible. soap-based web services don't have "an xsd" - have wsdl, either include or reference 1 or more xml schemas. i not know of tool extract wsdl , schemas cases. if ".net web service" legacy ".asmx" web service, can browse wsdl adding "?wsdl" end of service url. can save document disk. if wsdl refers other wsdl xml schema documents, may able browse them in turn. if ".net web service" modern, wcf service, , if configured share metadata, can use command: svcutil.exe /t:metadata <url>