Posts

Showing posts from June, 2015

java - The Microsoft Jet database engine could not find the object 'G:\DATA\Sheet1$.XLS' -

i have got error in executing below code, says microsoft jet database engine not find object 'g:\data\sheet1$.xls'. make sure object exists , spell name , path name correctly. xls sheet named correctly, dono mistake, here code: public static void main(string[] args) { try{ class.forname("sun.jdbc.odbc.jdbcodbcdriver"); string url = "jdbc:odbc:accountmaster"; connection conn1 =drivermanager.getconnection(url,"",""); statement st = conn1.createstatement(); string query = "select * [sheet1$]"; resultset rs = st.executequery(query); while (rs.next()) { string s = rs.getstring("accountid"); string s1 = rs.getstring("projectid"); string s2 = rs.getstring("positionid"); insert_am(s,s1,s2); getamdetails(); conn1.close(); }

jquery - js get the window.location.hash and split it into an array and replace certain array element -

hey extremely smart people! i have been boggled , have tried week , can't find logical solution. basically whenever user clicks on either 2 different sets of links want prepared url appended. so far in code happens $(selecter a.1).live('click', function(){ window.location.hash = '!/' + usr + '/' + $(this).attr('href').replace('.php', '/'); } this make url like: http://www.site.com/!#/username/page1/ then call function detect hash change in url , return url should be: $(window).bind('hashchange', function(){ hash = window.location.hash; //if( hash.indexof( "/files/" ) == 6 ) //newhash = window.location.hash.substring(3).replace(usr + '/files', '').replace('/', '.php'); //else newhash = window.location.hash.substring(3).replace(usr + '/', '').replace('/', '.php'); ...

function - How to tell whether Haskell will cache a result or recompute it? -

i noticed haskell pure functions somehow cached: if call function twice same parameters, second time result computed in no time. why happen? ghci feature or what? can rely on (ie: can deterministically know if function value cached)? can force or disable feature function calls? as required comments, here example found on web: isprime = isprimehelper primes isprimehelper (p:ps) | p*p > = true | `mod` p == 0 = false | otherwise = isprimehelper ps primes = 2 : filter isprime [3,5..] i expecting, before running it, quite slow, since keeps accessing elements of primes without explicitly caching them (thus, unless these values cached somewhere, need recomputed plenty times). wrong. if set +s in ghci (to print timing/memory stats after each evaluation) , evaluate expression primes!!10000 twice, get: *main> :set +s *main> primes!!10000 104743 (2.10 secs, 169800904 bytes) *main> primes!!10000 104743 (0.00 secs, 0 bytes) this means @ least prime...

iphone - stringByReplacingOccurrencesOfString not working as expected -

having problem. here's code: latitude = [tbxml textforelement:lat]; //latitude & longitude both nsstrings longitude= [tbxml textforelement:lon]; nslog(@"lat:%@ lon:%@",latitude,longitude); nsstring *defaulturl = @"http://api.wxbug.net/getliveweatherrss.aspx?acode=000000000&lat=+&long=-&unittype=1"; newurl = [[defaulturl stringbyreplacingoccurrencesofstring:@"+" withstring:latitude] stringbyreplacingoccurrencesofstring:@"-" withstring:longitude]; nslog(@"%@",newurl); and here's output: lat:-33.92 lon:18.42 http://api.wxbug.net/getliveweatherrss.aspxacode=000000000&lat=18.4233.92&long=18.42&unittype=1 as can see, strange happening appending code. doing wrong here? before replacing longitude, string is http://....&lat=-33.92...

c++ - Can't output through std::cout from static library -

i'm linking static library has std::cout wrapper works if use application code, non of library's internal outputs (used in same fashion) show output. maybe it's not important, i'm using qt creator , qmake project files build. have added console application's config (and tried static library, had no effect). what going wrong , how can fix this? thanks! update : well, wrapper adapted version of this one : the std::cout wrapper won't able 'reach in' library implicitly. have thought redirecting cout altogether? like src : int main() { std::streambuf* cout_sbuf = std::cout.rdbuf(); // save original sbuf std::ofstream fout("cout.txt"); std::cout.rdbuf(fout.rdbuf()); // redirect 'cout' 'fout' // ... std::cout.rdbuf(cout_sbuf); // restore original stream buffer } that way you'd have control on data fed std::cout , regardless of library doing output (unless, of course, redirect ...

c++ - Integrating 'google test' and 'boost program options' -

i have program uses google test, , boost program options library parsing options. problem google test has it's own option parsers, need filter out before giving options google test. for example, when run hello use follows hello --option1=x --gtest_filter=footest.* --option1 option use before passing --gtest_filter option google test. when run following code, got exception --gtest_filter not option use boost program options. how can combine options boost program options doesn't recognize give gtest's input? #include <boost/program_options.hpp> namespace po = boost::program_options; #include <iostream> #include <fstream> #include <iterator> using namespace std; #include <gtest/gtest.h> int main(int argc, char **argv) { // filter out options google related options survive try { int opt; string config_file; po::options_description generic("generic options"); generic.add_options...

unit testing - Get QUnit Results Using MSTest/MSUnit -

i'd load browser page static html test harness page running qunit tests. i'd values success/failure <span> s , test those. how can load page , interrogate elements on using mstest/msunit? if don't mind starting actual browser, , don't want put dependency on seleniumrc (which required c#), can use watin . below little example watin. [test] public void searchforwatinongoogle() { using (var browser = new ie("http://www.google.com")) { browser.textfield(find.byname("q")).typetext("watin"); browser.button(find.byname("btng")).click(); assert.istrue(browser.containstext("watin")); } } or if don't want start real browser on machine can try selenium, , htmlunit. selenium start htmlunit, tell load given page, , read need via xpath. example example selenium documentation how similar: using openqa.selenium; using openqa.selenium.remote; class example { static void main(st...

PHP custom error page -

ok, so. says "enabling errors shown" in active site bad (due security issues). now, have consider 2 cases: the site in debug mode the site not in debug mode now, case #1: we want see errors. how? well: ini_set('error_reporting', e_all); ini_set('display_errors', 1); nothing more simple. can customize error handler errors except parse , fatal. instead, if case #2: we able deactivate messages: ini_set('error_reporting', 0); ini_set('display_errors', 0); and it's ok. showing users friendly message such "hei man, f**ked up. don't assure working fix it, since lazy.". should enable errors again , use function set_error_handler() , hope no parse or fatal errors occur. first question is: question 1 : possible avoid error reporting , have custom offline page loaded when goes wrong? mean, possible have ini_set('error_reporting', 0); , ini_set('display_errors', 0); , still able tell php ...

.net - Why use TestDriven.net when you have Resharper? -

as far can tell, testdriven.net focused on giving direct access running tests within visual studio. yet, resharper, while being more general tool, provides functionality well. if 1 uses resharper, there point in using testdriven.net? if have resharper, no, don't need it. if don't, great, free tool.

Get todays date in Javascript -

how can current date in javascript in format? "m/d/yyyy"? thanks. if today be "2/17/2011", if 3rd "2/3/2011". thanks var currenttime = new date() var month = currenttime.getmonth() + 1 var day = currenttime.getdate() var year = currenttime.getfullyear() document.write(month + "/" + day + "/" + year) i assigned each part own variable example it's more clear returns.

Jquery capture when select list value changed without change event -

i have form select lists show/hide more input fields when values selected. the problem of users data entry people heavily use keyboard when entering data , select list's change event fires when focus has left input if done via keyboard. i've tried adding same functionality keypress , keydown , work great, not in ie. unfortunately users state workers forced use ie, know workaround? here code: $("div.error_editor select.refreason").live({ 'change': function() { var text = $(this).find(":selected").text(); $(this).parent().siblings("span").toggle(); }, 'keypress': function() { $(this).change(); } }); edit: appears doesn't work in chrome, works fine in firefox i found solution works in ie , chrome, changed keypress keyup $("div.error_editor select.refreason").live({ 'change': function() { var text = $(this).find(":selected")....

c# - Enable Excel "View Side by Side" and "Synchronous Scrolling" -

i created c# program opens 2 excel worksheets ex: process.start(@"c:\test\test1.xlsx"); process.start(@"c:\test\test2.xlsx"); all want after opening excel these 2 sheets enable "view side side" , "synchronous scrolling". these 2 options under view tab. enable them manually, love have option enabled automatically. have idea how achieve this? thank in advance. you can use automation c# control excel application. create reference excel application , open both workbooks. there should simple matter of writing code enable "side side" view: windows.comparesidebysidewith "test1" windows.syncscrollingsidebyside = true

spring - org.springframework.jdbc.datasource.DriverManagerD ataSource is it threadsafe? -

we know whether following data source org.springframework.jdbc.datasource.drivermanagerd atasource is threadsafe , can used in production environment? links source confirms helpful. regards aravias no, can not use drivermanagerdatasource in production. not because not thread safe (i believe is), because not perform connection pooling, results in horrible performance , unnecessary network overhead. see notes in javadoc. you should consider using dbcp or c3p0 data sources, drivermanagerdatasource fine testing purposes.

actionscript 3 - Flash CS5 + AS3 Timeline Navigation -

new cs5 , as3 if making fundamental mistake please don't hesitate correct me. i trying build lengthy , complicated form. require navigation through different pieces of it. new flash , as3 started prototyping , got 2 buttons navigate forward , backwards in timeline. problem when trying bring out of "code snippet" (correct term?) area , main actionscript file. buttons appear, pressing them not execute mouseevent. so 2 questions. 1. doing right? 2. why doesn't mouseevent work when code in .as file? form.fla - frame 1 code snippet var form:form = new form(); addchild(form); form.as package { import flash.display.movieclip; import fl.controls.button; import flash.events.mouseevent; public class form extends movieclip { private var nextbutton:button; private var prevbutton:button; public function form() { setupnavigation(); } private function setupnavigation():void ...

how to make facebook chat? -

i want create android facebook chat application , found open source project .. http://coderrr.wordpress.com/2008/05/06/facebook-chat-api/ but want ask whether "facebook chat api" still working ? if no, way creat facebook chat ? dig bit deeper http://developers.facebook.com/docs/chat/ . there number of xmpp , related apis java, c#, ios, , android alike found on web - or can base such work on libpurple api pidgin (http://www.pidgin.im/). behoove become familiar xmpp concepts.

asp.net - count of last item of the day -

i have query in 1 of fields contains count of status. status can change several times day , count should based on final status of day. instance, have status1. countstatus1 = (from status in mydatacontext.statushistory status.userid == theuserid status.statusdatetime.month == themonth.month status.statusdatetime.year == themonth.year status.newstatus == 1 // last status of day == 1 select status.statusid).count() the problem want select last status of day equal 1, , count those. status day can change 1 4 2 5 3 , 1; if write query this, count include 2 1's , 4,2,5 , 3 counted in countstatus4, countstatus3, countstatus"n". the return data monthly report grouped day, each day row. the structure of query looks this: var outputstatusreport = w in mydatacontext.workhistory w.userid == theuserid w.workdatetime.month == themonth.month w.workdatetime.year == themonth.year group ...

html - Javascript event after a form has been processed -

how javascript register callback run when server has completed processing form? particular setup: <form id="saveplaylistform" name="saveplaylistform" target="saveplaylistiframe" method="post" action="<?=base_url()?>index.php/saveplaylist"> <input type="hidden" id="saveplaylistentire" name="saveplaylistentire" /> </form> <iframe id="saveplaylistiframe" name="saveplaylistiframe" style="display: none"> </iframe> i've tried following no avail: onsubmit attaching onsubmit form not right event because onsubmit happens when client tries submit. server hasn't been contacted yet. onload i attached onload target iframe. doesn't fired in case. server script sets headers emulate m3u playlist file. iframes fire onload when normal html page loaded, not when file sa...

hyperlink - HTMLUnit collecting all links by class name -

i scrape / collect links on page under specific class name e.g. html agriculture (92) <a href="http://www.specificurl/page.html" class="generate">agriculture</a> i have been toying following pieces of code: list<?> links = page.getbyxpath("//div[@class='generate']/@href"); or list<?> links = page.getanchors(); system.out.println(links); the getbyxpath option returns null , other option grabs anchors. there way grab links list? this terrible xpath having issues narrowing down. (i can better xpath if necessary, 1 worked: list<?> links = page.getbyxpath("/html/body/div[2]/div[2]/table/tbody/tr/td/table/tbody/tr[7]/td/table/tbody/tr/td/div/table/tbody/tr[2]/td/div/table/tbody/tr/td/table/tbody/tr/td/ul/li/a/@href").aslist() i'm not quite sure why wasn't allow grab class name. let me know how works when chance

swing - JColorChooser with Substance look and feel, Java 7 -

i'm writing application uses substance , feel along jcolorchooser. works fine java 6, on trying things out java 7 doesn't jcolorchooser's: java.lang.nullpointerexception @ org.pushingpixels.substance.internal.ui.substancelistui$substancelistselectionlistener$1.run(substancelistui.java:135) i'm guessing new jcolorchooser that's being introduced in java 7, , substance tied current 1 in way. however, aside writing own colour chooser, there nice way round issue knows of? suspect (hope) substance updated in due course solve issue, i'd play around of new features in builds of java 7 before it's released. i somehow suspect answer no, if there quick fix / patch somewhere (i couldn't find one) useful! this interesting study in "bug compatibility." if color set null , try , color color chooser, nullpointerexception resulted. kirill expected , trapped in try/catch block. however, in java 7 instead return null method instead of throwi...

Formatted input in Python -

i have file has following: b c d 1 2 3 4 5 2 2 4 3 1 3 4 note 4 on line 2 followed new line. i want make dictionary looks this ['a']['1'] = 2, d['b']['1'] = 3, ..., d['d']['1'] = 5, d['b']['2'] = 2, etc the blanks should not appear in dictionary. what's best way in python? the data single digits right? lines column headers? in case, can this: it = iter(datafile) cols = list(next(it)[2::2]) d = {} row in it: col, val in zip(cols, row[2::2]): if val != ' ': d.setdefault(col, {})[row[0]] = int(val) based on author's data , code added, above code isn't enough. if format of document 31 pairs of data 12 months in groups of 6, handle in many ways. wrote. it's not elegant, not efficient can be, get's job done. 1 of reasons why index row first, column. def process(data): import re hre = re.compile(r' +([a-z]+)'*6) sr...

xcode - git diff with opendiff gives "Couldn't launch FileMerge" error -

i have git configured use ~/bin/opendiff-git.sh external diff tool. script looks this: opendiff $2 $5 when try , git diff command line, message: 2011-02-18 13:58:55.532 opendiff[27959:60f] exception raised trying run filemerge: launch path not accessible 2011-02-18 13:58:55.535 opendiff[27959:60f] couldn't launch filemerge external diff died, stopping @ source/some_file.m. what's going on? has worked many months, stopped working recently. so after deleted beta developer folder try , solve (couldn't fix work merge tool) stumbled upon in command line: error: no developer directory found @ /developer beta. run /usr/bin/xcode-select update developer directory path. turns out can set developer path need use: usage: xcode-select -print-path or: xcode-select -switch <xcode_folder_path> or: xcode-select -version arguments: -print-path prints path of current xcode folder -switch <xcode_folder_path> sets path ...

Ruby: Compare two arrays for matches, and order results in DESC order -

i have user model. each user has restaurant names associated them. have view (index.html.erb) shows users. i want order users in view based on how many restaurants current_user , other user have in common in descending order... (it opposite!) ex. user1 (current_user) has been mcdonalds, burger king, arby's user2 has been ivar's user3 has been mcdonalds, burger king when user1 loads index view, order users should displayed is: user1 (3/3 restaurants match) user3 (2/3 restaurants match) user2 (0/3 restaurants match) my user.rb file def compare_restaurants self.restaurants.collect end my users_controller.rb def index @users = user.all.sort_by {|el| (el.compare_resturants & current_user.compare_resturants).length } end if you're dead set on using sort_by can negate numbers: def index @users = user.all.sort_by { |el| -(el.compare_resturants & current_user.compare_resturants).length } end this trick works becau...

How can we add ASP.NET Machine account in windows server 2003 -

i wand download files in windows server 2003. asp.net application needs access control directory. searched asp.net account. cannot find. how can find or add? 1 please help if try add aspnet account using user accounts panel. cannot open localusers says error "the computer domain controller. snap-in cannot used on domail controller. domain accounts managed active directory users , computers snap-in" try executing command in command prompt: c:\windows\microsoft.net\framework\v4.0.30319\aspnetregiis.exe -i -enable note v4.0.30319 different based on .net version want. if .net 2.0, 3.0, or 3.5, it'll v2.0.50727 (because both use .net 2.0 clr). also, try right click computer, choose "manage" , navigate "system tools", "local users , groups", "users" local users management of machine being memeber of domain. update: i assumed know this, in case: note in windows 2003, asp.net account not called "aspnet"...

How to lock serialization in Java? -

i starting java serialization: have 1 exercise , need lock serialization on class, suppose throw exception when attempt serialize class. does know how it? if add implementation of writeobject throws exception, serialization aborted, e.g. private void writeobject(objectoutputstream stream) throws ioexception { throw new runtimeexception("don't want serialize today"); } see http://java.sun.com/developer/technicalarticles/alt/serialization/ introduction overriding default serialization behaviour.

How to make Drag & Drop Button in Android -

i want make drag , drop button. drag want , stays there. below code scales button, doesn't change position. package com.dynamic; import android.app.activity; import android.os.bundle; import android.view.motionevent; import android.view.view; import android.view.viewgroup.layoutparams; import android.widget.button; import android.widget.framelayout; import android.widget.imageview; import android.widget.textview; import com.dynamic.r; import com.dynamic.r.layout; public class dy extends activity { int status; private framelayout layout; imageview image; button b; layoutparams params; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.frm); final button tv=(button)findviewbyid(r.id.txt_birth); tv.setdrawingcacheenabled(true); layout = (framelayout) findviewbyid(r.id.frm); params = new layoutparams(100,100); ...

entity framework - Filtering a Linq / Odata query over a 1 to many navigation property -

the following query works fine expand on navigation property, schedules , has many 1 relationship associatedlisting property: from la in listingassociations.expand("associatedlisting").expand("associatedlisting/schedules") la.listingid==60 select la in results, can see multiple schedule objects corresponding each associatedlisting object. good. however, when try add filter on of schedules fields: from la in listingassociations.expand("associatedlisting").expand("associatedlisting/schedules") la.listingid==60 && la.associatedlisting.schedules.startdate > datetime.today select la i error: "'system.collections.objectmodel.collection' not contain definition 'startdate' , no extension method 'startdate' accepting first argument of type 'system.collections.objectmodel.collection' found...". so guess problem startdate field of schedule class, , " schedules " nav...

jquery - using jwysiwyg and validation issues -

i'd focus cursor in jwysiwyg iframe when user forgets enter value i'm not sure how this. can please? first of all, there no mechanism moving mouse via javascript. to focus in iframe use script (if use jquery) $(".wysiwyg").find("iframe").focus(); to access content of iframe have use above script : $(document).ready(function(){ $(".wysiwyg").find("iframe").load(function(){ var test = $(".wysiwyg").find("iframe").contents().find('body').html(); //do job content. //remember jwysiwyg produse code if seems there //nothing.(couse wysiwyg base on browser behavor }); });

Integrating Twitter in an Android application -

i want simple example of implementing twitter in our application. prefer not browsable; should open on our application area only. after login user can post tweets on his/her account. good question leaves room counter-questions :-) i see @ least 2 ways walk down path (note don't know twitter or how it's used): you synchronize twitter data ("tweets"?!?) on phone later viewing. you view snapshot of current tweets on given channel , don't store (except user credentials). as of first alternative you'd typically want synchronize sqlite database (perhaps custom content provider ) on target data twitter channel on twitter web servers (you can read bit on public twitter api looks here ). this synchronization done background service on phone. actual gui not communicate service itself, rather read data (and from) local sqlite database. way gui wouldn't depend on network latency, data traffic or data availability web. depend on database conne...

Text comparison {{if}} JQuery Template -

i looking use jquery templates plugin forms creating - data loaded in json rest uri. the issue having trying conditional show either label or textfield depending on variable value. i jquery templates maybe wrong way go - jsut seems better me building element - think? here have: template: <script type="x-jquery-tmpl" id="tmplform"> <table> <tr> <td><label for="title">title</label></td> <td><input type="text" name="title" id="title" value="${title}" /></td> </tr> <tr> <td><label for="description">description</label></td> <td><textarea name="description" id="description" rows="5" cols="20">"${description}"</textarea></td> </tr> <t...

iphone - Problems with Float on core-data -

the following code largely inspired example found on net seems work fine, core data entity called "contact" , property called "address" having attribute string, in xcdatamodel. saves data no problem. question : how need modify code ? in order make work after change attribute of property "address" string float in xcdatamodel. coredatatestoneappdelegate *appdelegate = [[uiapplication sharedapplication] delegate]; nsmanagedobjectcontext *context = [appdelegate managedobjectcontext]; nsmanagedobject *newcontact; newcontact = [nsentitydescription insertnewobjectforentityforname:@"contacts" inmanagedobjectcontext:context]; [newcontact setvalue:address_inputfield.text forkey:@"address"]; nserror *error; [context save:&error]; to store float in core data float attribute, wrap in nsnumber object this: [newcontact setvalue:[nsnumber numberwithfloat:floatvalue] forkey:@"address"];

java me - File connection+j2me -

i want make application can images no matter whether in phone or in external memory. want import images in application. how can possible? came know possible through file connection. not getting exact idea. get file system roots using filesystemregistry.listroots() open connection each root in turn using fileconnection fconn = (fileconnection)connector.open(root) list folder using fconn.list() . for each entry in list, if ends image extension ( file.getname().endswith(".png") etc), it's image. if entry folder ( file.isdirectory() returns true) use fconn.setfileconnection(folder) traverse directory/ do same recursively folders in roots.

c - optimization of static function referenced once -

i writing embedded code msp430, using iar compiler @ highest optimization level (speed or size not change anything). i define function static, reference once, in same file. since function has internal linkage, , used once, expected optimizer perform inline expansion. can see no reason not to. the function short, results in 16 words of machine code. called isr. adding inline keyword makes function inline, optimizer seems need hint. having inline saves 2 push / pop s stack, 1 calla , 1 reta . am right expect inline expansion performed (even without inline keyword), or missing something? edit: few more tests showed inline expansion dependent on size of function, , threshold quite low. seems around 15 or 16 words of machine code. above , optimizer not expand if not given keyword. i still don't see why wouldn't (readability shouldn't concern of optimizer, should it?), understand iar can answer this. i'm using iar arm compiler version that's fe...

parsing - How to keep only some keywords in text file -

have text file emails inside. need remove emails without keywords inside (ie: gmail, yahoo...). there way ? in advance. yes. in language want it? example in smalltalk: ((filestream filenamed: 'emails.txt') substrings: emailseparatorchar) reject: [:a|a includessubstring: akeyword]

C: Any way to convert text string to float, i.e. 1e100? -

unfortunately in log have there strings notation (1.00e4), know can use printf "%e" specifier create notation, how read it? unfortunately strtof , scanf seem return 0.00000 on "1e100", need write own parser this? (updated) what have input: string "4.1234567e5", or "4.5e5" desired output: float 412345.67, or integer "450000" start code: #include <stdio.h> int main (void) { double val; double val2 = 1e100; sscanf ("1e100", "%lf", &val); // that's letter ell, not number wun ! printf ("%lf\n", val); // that. printf ("%lf\n", val2); // , that. return 0; } it outputs: 10000000000000000159028911097599180468360810000000000... 10000000000000000159028911097599180468360810000000000... the reason it's not 1 100 because of nature of ieee754 floating point values. changing to: #include <stdio.h> int main (int a...

php - Problem with "Cannot add or update a child row: a foreign key constraint fails" -

i can seem fix little bug have. have dynamic list menu carries establishment id's of club establishments. user can add event on site info such : event_id, event_name, event_venue, event_date, establishment_id ...etc. field establishment_id can null , default null. the above establishment_id fk of table establishments(establishment_id). a user can either choose pick establishment if event adding happening there or can leave blank if there no establishment connected it. e.g. select crooked q'z haven brew bistro my code dynamic list menu <label for="establishment_link"></label> <select name="establishment_link" id="establishment_link"> <option selected value="" <?php if (!(strcmp("", $row_establishment_list['establishment_id']))) {echo "selected=\"selected\"";} ?>>select</option> <?php { ?> <option value="...

Add rules and extract text from PDF using C# .net -

i want build pdf text extraction tool having similar features application (a-pdf data extractor) http://www.a-pdf.com/data-extractor/index.htm i planning in c# .net want build own interface similar app buy referencing application(dll or exe). wont let me add reference. how can ? there way run application inside c# desktop application ? if have better options please let me know thank any appreciate!! if want use exe file must use process class in .net framework. have example here: http://dotnetperls.com/process-start if need library extract text pdf try use itextsharp: http://www.codeproject.com/kb/cs/pdftotext.aspx hope helps

python - how to import py file from different upper folder? -

all, file structure: \ util utils.py modules __init__.py modules1.py submodule __init__.py submodule.py i want know how import utils.py in __init__.py for example, run python interpreter in \ level, run import modules , suppose code from ..util.utils import * may works, not. may know mistake? , may know if there's way can import utils.py in universal format? import \util\utils.py i know may use path.append(), alternative? thanks ============ got answer post: import module relative path if developping python package (what doing, have init .py), simple way import module via package. example, if package called mypackage , then: import mypackage.utils

c# - Declaring an array of base class and instantiating inherited members -

i have class defined generic: public class genericdatastore<t> { // underlyingdatastore class manages queue, or linked list private underlyingdatastore<t> dataqueue = new underlyingdatastore<t>(); public void adddata(t data) { dataqueue.add(data); } public t getlastdata() { dataqueue.getlastdata(); } } i have different derived classes based on class: public class bytedatastore : genericdatastore<byte> { } public class doubledatastore : genericdatastore<double> { } public class pobjdatastore : genericdatastore<pobj> // pobj class declared somewhere { } then, have "manager" class looks like: public class datamanager { /* here, want declare 2 dim array [,] holds pointers data stores. depending on other variables, array may need point doubledatastore, bytedatastore, etc. following doesn't work, since genericdatastore must declared generic type: */ genericdatastore [,] m...

javascript - how to get the Y value on the curve using flot js -

using flot js graphing library, can (x,y) position of mouse. given curve represented plot values, how can interpolated y value on curve given mouse position? there's crosshair/tracking demo on pages. has updatelegend method takes nearest x values @ crosshair line , linear interpolation.

android - Is it possible to bind a TableLayout with a ArrayAdapter? -

is possible bind tablelayout arrayadapter? there no such api in framework. can manually querying adapter yourself. this: int count = adapter.getcount(); (int = 0; < count; i++) { tablelayout.addview(createtablerow(adapter.getitem(i)); // or tablelayout.addview(adapter.getview(i, null, tablelayout)); }

JQuery Datepicker only showing when no jquery stylesheet included -

i have datepicker configured use on page.. , if don't add jquery theme, datepicker shows.. problem when add jquery theme ( such ui-lightness), datepicker doesn't show anymore. can see in firebug datepicker there, doesn't show!! i use $this->jquery()->addstylesheet('path'); add stylesheet , when check browser source code, stylesheet present.. i removed other css check if interference issue, without luck. help? question expanded: working in cms book apress pro zend framework techniques - build full cms. datepicker initialized through following files : bootstrap.php $view->addhelperpath("zendx/jquery/view/helper", "zendx_jquery_view_helper"); layout.phtml echo $this->jquery(); with these commands full working datepicker, in basic layout. when add stylesheet through: layout.phtml $this->headlink()->prependstylesheet('js/jquery/css/ui-darkness/jquery-i-1.8.9.custom.css') echo $this->headli...

xml - Need help with XMLList in Flex -

i have xml following structure, example <root> <node flag="false"/> <node flag="true"/> <node flag="false"/> <node flag="false"/> <node flag="true"> <node flag="false"/> <node flag="true"/> <node flag="false"/> <node flag="true"/> </node> <node flag="true"/> <node flag="false"> <node flag="false"/> <node flag="true"/> <node flag="false"/> <node flag="true"/> </node> <node flag="false"/> </root> all children have name "node". need xmllist (or xml, no matter), same hierarchy, containing nodes flag "true". the result need example is: <root> <node flag="true"...

c# - How do I get the X,Y position of a UserControl within a Canvas? -

i have simple usercontrol implemented below - place in canvas. move using multi-touch , want able read new x,y postion using procedural c# code. ideally have x , y 2 properties or point (x,y). <usercontrol x:class="touchcontrollibrary.mycontrol" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:ignorable="d" d:designheight="64" d:designwidth="104"> <border name="controlborder" borderthickness="1" borderbrush="black"> <dockpanel margin="1" height="60 " width="100"> <stackpanel dockpanel.dock="left" backgr...

Delphi Datasnap-XE :How does one setup a filter pragmatically? -

i using following code setup datasnap connection pragmatically procedure tconnectthreed.execute; var datasnapcon : tsqlconnection; proxy : tsystemrdmclient; begin proxy := nil; datasnapcon := nil; try datasnapcon := tsqlconnection.create(nil); datasnapcon.connected := false; datasnapcon.drivername := 'datasnap'; datasnapcon.loginprompt := false; datasnapcon.params.values['port'] := '211'; datasnapcon.params.values['hostname'] := devicesaddr; // // code must added here setup zlib + pc1 +rsa filter ? // try datasnapcon.open; proxy := tsystemrdmclient.create(datasnapcon.dbxconnection); question: how setup zlib & pc1 & rsa filter pragmatically? if have @ dfm file see going on magic driver property in object inspector. selections make stored in tsqlconnection.params name filters. to add filters can this. datasnapcon.params.values['filters...

JSF ajax listener -

i'm trying figure out how log out user f:ajax call using jsf , backing managed bean. problem i'm having can't quite figure out why call order ajax listener , rerender of login form. below simplified code. basic idea of code this if (uid != null) { // show log out } else { // show log in } i not understanding how ajax listeners , form rerender done. the jsf page <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:c="http://java.sun.com/jsp/jstl/core"> <h:head> <title>facelet title</title> </h:head> <h:body> <f:view> <h:form id="loginform"> <c:choose> <c:when test="${userbean.uid != null}"> <span>hi, #{userbean.uid}</span> <h:commandbutton value="logout"> ...

to include a piece of code in existing unix script -

i have filewatcher.txt file . want include piece of code in existing unix script(final) ask user input(y/n) check whether file has been renamed(*filewatcher.txt e.g.sav_filewatcher.txt or xyz_filewatcher.txt ) or original name(filewatcher.txt) exists. if file watcher has not been renamed existing code(final) exit. i'm not positive understand you're looking do, here few basic scripting tips: if [ -f "filewatcher.txt" ]; echo "file has not been renamed" fi echo "please give me input" read var echo "your input $var"

java - CGLib Proxy for Integer (Final class) in Spring MVC -

i need such usage: for each request want inject userid democontroller because of being final class without empty constructor can not inject it. best practice in such cases? service request scope fine? @configuration public class cityfactory{ @bean(name = {"currentuserid") @scope(value = webapplicationcontext.scope_request,proxymode = scopedproxymode.target_class) @autowired public integer getuserid(httpservletrequest request) { return userutil.getcurrentuserid(request.getservername()); } } @requestmapping("/demo") @controller public class democontroller { @autowired ingeter userid; @requestmapping(value = "/hello/{name}", method = requestmethod.get) public modelandview helloworld(@pathvariable("name") string name, model model) { map<string, object> mymodel = new hashmap<string, object>(); model.addattribute("user", userid); return new modelandview(...

c# - How to store images on disk and link to database with EF? -

i have table id | imagepath ------------------- 1 | ~/files/1.png my model class has public int64 id { ... } public string imagepath { ... } i trying find approach store image on file. thinking in creating byte[] property , write file when call savechanges . is possible? there event fires when changes saved can use in case? or there better approach store path on database , files on disk ? in 1 of projects store files in folder , filepath in database linked entity(relation 1-to-1). created entity file byte[] property , domain service saving files on server. in insertfile call filehandler saves bytes on disk. public iqueryable<webfile> getfiles() { string path = "~/upload"; list<webfile> webfiles = new list<webfile>(); if (string.isnullorempty(path)) return webfiles.asqueryable(); directoryinfo di = new directoryinfo(httpcontext.current.server.mappath(path)); ...

encryption - Which c++ free (none GPL) library to use if I like to encrypt text? -

does crypto++ fine? use public keys method crypto++ excellent , can handle public/private keys. openssl excellent, non-gpl, c library. , botan choice, non-gpl

c# - How do I maintain user login details in a Winforms application? -

hi can i'm new windows forms. here want maintain state (like session in web applications) in windows forms. actually want store user login details in session. think there no concept of session in winforms. alternative method handle type of situation. regards, nagu there no concept of session variables in windows forms. can is: create internal class holds user name , password , other variables , enumerations needed across application (something common.cs). these can accessed through public properties across application. have parameterized constructor forms , send user name , password whenever showing form.

Facebook iframe rails app without change now returns a "406 Not Acceptable" response -

using facebooker gem. 2 separate apps both start returning blank pages in facebook app iframe , rails logs show 406 errors. note direct access site same url called in iframe works if fb_sig parameter dropped. have facebook changed either parameters (naming) pass app or deprecation of fbml? or facebooker issue? i ran same problem recently. this fix it: please check if facebook turned on "post canvas" in "advanced" tab in application settings on www.facebook.com/developers/. if so, deactivate. hope helps!

c# - Using custom httphandler from a custom assembly -

is possible register custom httphandler in stand alone assembly? i'm writing control toolkit uses httphandlers perform ajax , make use of toolkit low friction web developers possible. there quite few handlers , dont want developer have register them in web.config. can referenced directly in assembly? i'm not sure if possible, strikes me wrong approach. if developing own toolkit instead make http handler identifies , calls other http handlers based on whatever logic want: public class mytoolkithandler : ihttphandler { public void processrequest(httpcontext context) { ihttphandler handler = toolkit.gethandler(); if (handler != null) { handler.processrequest(context); } } } this mean need register 1 handler in web.config.

Plot from Mathematica to Matlab -

Image
i have problem in mathematica : l=16; f[x_]:=-x; mlat = table[2 randominteger[] - 1, {l}, {l}]; arrayplot[mlat, colorfunction -> (if[# == 1, white, black] &), mesh -> all] and did in matlab: l=16; f=@ (x) -x; mlat=2*randint(l,l)-1; if mlat(:,:)==1 plot(mlat,'ws') hold on else plot(mlat,'ks') hold off grid on end but can't graph. first, want create array ones , zeros, using randi l = 16; mlat = 2*(randi([0,1],l,l)-0.5); then, can display image (i open new figure every plot) figure imshow(mlat,[]) %# [] scales min...max to make image bigger, set axes size 90% of figure window set(gca,'units','normalized','position',[0.05 0.05 0.9 0.9],'visible','on') note axes label correspond index of matrix elements, (1,1) top left.

oop - Class diagram: Create an extra class to concentrate information from an existing system? -

i'm undecided classes have adapt existing system online video game. here's want achieve: get series of settings objects in server. listen clients connect. for each client, check settings on client correspond server. if settings don't correspond (something has been tampered with), either disconnect client or change settings. this handled class act entry point , can serve form of controller. now, settings strewn accross number of instances: players, weapons, flags, lights, etc. in procedural programming, i'd information , store array. however, there better way of doing according oo approach? can make 1 or more classes have values of these settings , act form of facade? encapsulate settings data , behavior @ least 1 object (i.e. settings ). depending on how system constructed becomes part of other objects' composition (e.g. player , weapon , etc...), perhaps via dependency injection, or referenced global context. settings responsible validation...