Posts

Showing posts from August, 2015

python - Why doesn't sqlalchemy modify the database when I add/remove a column? -

if run python script, creates tables correctly. however, if add/remove column , run script again, doesn't modify database. why this? i doing after defining everything: mapper(product, products) mapper(category, categories) metadata.create_all(engine) session = session() create_all creates. doesn't modify. http://www.sqlalchemy.org/docs/core/schema.html?highlight=create_all#sqlalchemy.schema.metadata.create_all if you've changed columns need either drop/readd table, or manually add column outside of script. there tools sqlalchemy-migrate full migrations manager project. http://code.google.com/p/sqlalchemy-migrate/

artificial intelligence - Making a deductive program -

i'm thinking writing program asks user think of object(a physical one) , asks questions object , tries figure out user thinking. (similar http://20q.net ) i tried in python figured approach naive , inefficient. how guys this? doing efficiently requires advanced method in probability called kullback-liebler divergence . applied decision trees (which want do) called information gain . but don't let stop you! searches implementation samples of decision trees , start there. i'd write simpler program before go solving 20 questions. also, take @ http://www.20q.net/ . click "think in english" "classic 20q". it's scary good, sometimes.

debian - Create destination path for .deb file -

i have created debian package according http://ubuntuforums.org/showthread.php?t=51003 . not able find installed files, on installing .deb file. can tell me default destination path of .deb file , how modify default destination path ? if have .deb file, should first check "dpkg -c" what's content (which tell what's destination path files). for example if deb file 'apackage.deb': dpkg -c apackage.deb once installed, can check destination paths "dpkg -l". example (assuming package name 'apackage'): dpkg -l apackage that give hint (there's chance building process failed , package "empty").

java - Swing update puzzle -

i have jtree nodes representing images user can call , view. takes images 4 or 5 seconds load. ideally, wait cursor show while user waiting , node selected in tree selected. however, i'm find user clicks on node, nothing appears happen , image appears , node selected (the wait cursor never appears or more appears briefly , disappears immediately. i've tried repainting both tree , applet try force behavior happen in sequence want. far, i've not had luck. suggestions? here section of swing code giving me problems: thisapplet.setcursor(new cursor(cursor.wait_cursor)); selectdocumenttreeleaf(); // jtree nodes representing images tree.repaint(); thisapplet.repaint(); tree.setenabled(false); //disabled users don't keep clicking on it. result = createimage(queue.q[pointer].currentpage); //where image fetched thisapplet.setcursor(new cursor(cursor.default_cursor)); i think pace on money. use background thre

ios - Show an image in the alert body of a local notification -

i using local notifications, want put image in message body of alert. how can that? i searched same question . , found can't customize uilocalnotification , handled in application:didreceivelocalnotification: showing custom uialertview .

objective c - Html file parsing in iPhone sdk -

how can parse html file under ios? tutorials or sample code available? check out nsxmlparser . it's apple's class parsing xml documents. should start, if know format of document in advance

jquery - set target.id to div id and a number? -

the target id below map_external, map_external(and number) i have this: $('#jqt').bind('pageanimationstart', function(e, info){ if (e.target.id == 'map_external') { if (info.direction =='in') { localiser(); } and works, , target page looks this: <div id="map_external"> content.... </div> but have random number aswell, this: <div id="map_external<%=asp random number%>"> content.... </div> so how write if (e.target.id == 'map_external') gets map_external , number(any number)? thanks! try writing this: var newid = e.target.id; if (newid.indexof("map_external") > -1) { // test first instance, , find @ 0 if (info.direction =='in') { localiser(); } }

java - Why does my program not read full files? -

i have written code in java read content of file. working small line of file not more 1000 line of file. please tell me me error have made in below program. program: import java.io.datainputstream; import java.io.dataoutputstream; import java.io.file; import java.io.fileinputstream; import java.io.filenotfoundexception; import java.io.fileoutputstream; import java.util.regex.matcher; import java.util.regex.pattern; public class aaru { public static void main(string args[]) throws filenotfoundexception { file sourcefile = new file("e:\\parser\\parse3.txt"); file destinationfile = new file("e:\\parser\\new.txt"); fileinputstream filein = new fileinputstream(sourcefile); fileoutputstream fileout = new fileoutputstream(destinationfile); datainputstream datain = new datainputstream(filein); dataoutputstream dataout = new dataoutputstream(fileout); string str = ""; string[] st; string sub[] = null; string wor

java - Unknown authorization header - Error 401 -

i accessing google spreadsheet feeds using hmac-sh1 sign. code : googleoauthparameters oauthparameters = new googleoauthparameters(); oauthparameters.setoauthconsumerkey(consumer_key); oauthparameters.setoauthconsumersecret(consumer_secret); oauthparameters.setscope("https://spreadsheets.google.com/feeds/"); oauthparameters.setoauthtype(oauthparameters.oauthtype.three_legged_oauth); oauthparameters.setoauthtoken(request.getsession().getattribute("oauth_token").tostring()); oauthparameters.setoauthtokensecret(request.getsession().getattribute("oauth_token_secret").tostring()); googleservice googleservice = new googleservice("wise", "searceapps-searcegadget2-1"); googleservice.setoauthcredentials(oauthparameters, new oauthhmacsha1signer()); url feedurl = new url("https://spreadsheets.google.com/feeds/spreadsheets/private/full/"); spreadsheetfeed resu

android - Select All items of a ListView (custom row with checkbox in it) -

what have: have listview custom rows, having checkbox & 2 textviews in each row. have button "select all". what want: want when click button, checkbox in listview checked/unchecked. what problem: in onclick of "select all" button. doing this: public void onclickselectallbutton(view view) { listview l = getlistview(); int count = l.getcount(); for(int i=0; i<count; ++i) { viewgroup row = (viewgroup)l.getchildat(i); checkbox check = (checkbox) row.findviewbyid(r.id.checkboxid); check.setchecked(true); // true select , false unselect etc.. } } here l.getchildat(i) giving me visible items only. , when index goes out of visible items, problem occurs. want check checkbox in list, not visible ones. it occur, because listview adapter reuses views. way trying incorrect. don't think ever should access listview rows through listview children. introduce variable in activity, hold current state ( boo

java - JNI wrapper or alternative for callbacks -

i need call java native library , requires callback registration (and using callbacks then). is there wrapper on jni or jni alternative such situation? seems jna, hawtjni , others not support callbacks java ... thank you! let have method in our c library notify application if record has been deleted process. provides method add callback, int register_delete_monitor( void* fn); and callback expected takes parameter of record. in our java library, create callback method: interface deletedrecordcallback extends callback { void callback (record r); } ... // , in our library interface: int register_delete_monitor (deletedrecordcallback drc); now can pass in implementation of our deletedrecordcallback , have registered callback in c library. there 1 caveat use of callbacks in jna. callback must not garbage collected unless it's been unregistered. true long lived callbacks. call garbage-collected callback crash vm. can avoided hanging on instance o

php - Alter messages in Drupal 7 -

there couple of messages in drupal. when there php warning, error message raised, module can raise messages drupal_set_message(). question is: there way alter these messages? example replace every 'a' 'b' in every message. thanks! while there no message alter on set, can change them on display via hook_preprocess_status_messages , see http://api.drupal.org/api/drupal/includes--theme.inc/function/theme/7 on preprocess , http://api.drupal.org/api/drupal/includes--theme.inc/function/theme_status_messages/7 . edit: can try string overrides check http://api.drupal.org/api/drupal/includes--bootstrap.inc/function/t/7 , in short $conf['locale_custom_strings_en']['some message'] = 'some messbge'; english, change _en else if it's not english.

caching - Why did Microsoft get rid of Velocity Distributed Cache as standalone product? -

Image
i heard velocity several years ago when ms made splash going head head memcached. recently needed try out solution work best in project: memcached or .net velocity. took me while find velocity again. seems ms merged velocity wcf tools , called appfabric. http://msdn.microsoft.com/en-us/windowsserver/ee695849 i little worried, impact how ms can release new features/improvements velocity, part of bigger package. why did ms rid of standalone version of velocity, after effort spent promoting it? velocity codename while product in development, don't think there ever intention microsoft release standalone product called velocity. (apart else, there's java product called velocity ). appfabric output of 2 development projects, velocity , dublin (which workflow, not wcf). although 2 parts share installer, if want distributed caching parts of appfabric can install them; you're not obligated install whole thing. i've circled options need select in inst

java - Struts 2 encode input parameters to avoid XSS -

i have application built struts 2. has issues cross-site scripting (xss) attacks. want encode of actions input parameters in similar fashion jsp <c:out value="${somevalue}"/> there easy approach in struts 2? java api method fine. edit found 1 - http://www.owasp.org/index.php/talk:how_to_perform_html_entity_encoding_in_java any experience it? you can use <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> ${fn:escapexml(somevalue)} there api jsoup sanitize untrusted html problem you want allow untrusted users supply html output on website (e.g. comment submission). need clean html avoid cross-site scripting (xss) attacks. solution use jsoup html cleaner configuration specified whitelist . string unsafe = "<p><a href='http://example.com/' onclick='stealcookies()'>link</a></p>"; string safe = jsoup.clean(unsafe, whi

architecture - OO: Can an interface implement another interface? -

i know language-specific, possible in oo-languages interfaces implement other interfaces? in c# can do: interface yourinterface: idisposable { /// methods } and class wich implements yourinterface shall implement idisposable 's method. of course, valid: yourinterface implementation = new implementation(); idiposable disposable = implementation;

google maps - MapsDemo not working + android -

i trying mapsdemo project shipped google add-ons work. got md5 fingerprint of default debug certificate , using generated maps api key , used in layout file. in manifest file have added permissions required it. manifest file looks like <uses-permission android:name="android.permission.internet"></uses-permission> <uses-permission android:name="android.permission.access_fine_location"></uses-permission> <uses-sdk android:minsdkversion="3" /> <application android:label="@string/activity_sample_code" android:icon="@drawable/app_sample_code" > <uses-library android:name="com.google.android.maps" /> <activity android:name="com.example.android.apis.mapsdemo" android:label="mapsdemo"> <intent-filter> <category android:name="android.intent.category.launcher"></category> <action a

php - Make JSON array Flot compatible -

i have php code outputs json array when $.getjson called: . . . $data = array_combine($date_dispatched,$amount); echo json_encode($data); this collected by: $.getjson('statistics_get.php',function(output) { $.plot($("#graph_1"), [{ data: output, lines: {show:true} }] ); }); now, using firebug, response of form: {"0":"0","1296658458000":"566","1296725534000":"789","1297072385000":"890","1297072388000":"435"} flot not processing data. believe flot needs in form [[1,2],[4,5],[6,9]] etc. question is, best way of getting json array correct form flot read , produce graph. don't use array_combine , since doesn't need. doing "zip" in php little bit unpleasant, should able manage with: function make_pair($date, $amount) { retu

ruby on rails - Erron::EACCESS error -

i using windows vista os, , when tried execute method in controller, error errno::eacces in data phonecontroller#phone_selection permission denied - c:/multi/phone/rails/logprints/andrew i believe permission error (isn"t it?) when change permission folder windows vista, still not remove error. can me problem? thank in advance have checked permissions on other folders such log files , temporary correct?

prism - Need to build a WPF application with good architecture -

i trying start wpf application towards self learning curve, have explored quite wpf , time me start application myself. many them contributed excellent articles public here in internet. start mvvm + prism. can guide me through this, other articles can me furnish kind of architecture. or best architecture choose among mvvm + nhibernate, prism, + ioc (spring.net, unity, ninject) thanks in advance regards krish you check thread points prism dev's guide: thread prism dev guide.

java - What is the difference between an OutOfMemoryError amd a memory leak -

iam working on java application,whose architecture java-ee component one-end , c++ component on end. when executing app continiously got java.lang.outofmemory error in java heap.when discussed told 1 different java memory leak.if difference between outofmemory error , java memory leak.and how can analyse both things java profilers available in market.could please clarify.. thanks in advance, raghavamoorthy.k a memory leak in java when objects aren't using cannot garbage collected because still have reference them somewhere. an outofmemoryerror thrown when there no memory left allocate new objects. caused memory leak, can happen if you're trying hold data in memory @ once. the jdk includes useful tools jhat , visualvm allow inspect objects in memory , references between them. using these can find objects causing problem. example here particularly stupid memory leak. old objects never used, cannot garbage collected. while may seem ridiculous, can create e

Mathematica internal number formats and precision -

tangentially related this question, happening here number formatting? in[1] := inputform @ 3.12987*10^-270 out[1] := 3.12987`*^-270 in[2] := inputform @ 3.12987*10^-271 out[2] := 3.1298700000000003`*^-271 if use *10.^ multiplier transition naively expect be: in[3] := inputform @ 3.12987*10.^-16 out[3] := 3.12987`*^-16 in[4] := inputform @ 3.12987*10.^-17 out[4] := 3.1298700000000004`*^-17 whereas *^ takes transition bit further, albeit machine precision starts flaking out: in[5] := inputform @ 3.12987*^-308 out[5] := 3.12987`*^-308 in[6] := inputform @ 3.12987*10.^-309 out[6] := 3.12987`15.954589770191008*^-309 the base starts breaking later in[7] := inputform @ 3.12987*^-595 out[7] := 3.12987`15.954589770191005*^-595 in[8] := inputform @ 3.12987*^-596 out[8] := 3.1298699999999999999999999999999999999999`15.954589770191005*^-596 i assuming these transitions relate format in mathematica internally keeps it's numbers, know, or care hazard educated g

c# - Generics with inheritance and interfaces - why doesn't this work? -

here's entire application. me, should compile fine. namespace sampleapp { interface i<t> t : image { } class a<t> t : image { } class b : a<bitmap>, i<bitmap> { } class c : a<metafile>, i<metafile> { } class program { public static i<image> someproperty { get; set; } static void main(string[] args) { b b = new b(); someproperty = b; c c = new c(); someproperty = c; } } } however, lines "someproperty = b" , "someproperty = c" give error: cannot implicitly convert type 'b' 'i<system.drawing.image>'. explicit conversion exists (are missing cast?) but can't work out why. b implements i<bitmap> , , bitmap subclass of image, surely, definition, b implements i<image> . as sasha says, you're looking generic co

visual studio 2010 - sharepoint2010 : database connection in sandboxed web part -

i want make database connection in sandboxed web part. following code works fine when using queries. can tell me how use stored procedure & passing parameters it? how work web service? public static dataset chkconn(string strval) { public static dataset ds; public static string assemblyname = "fulltrustproxy, version=1.0.0.0, culture=neutral, publickeytoken=75e25e9dc5ff21aa"; public static string typename = "dbfulltrust.fulltrustproxy.sqlfulltrustproxy"; try { sqlproxyargs proxyargs = new sqlproxyargs(); proxyargs.connectionstring = "persist security info=false;user id=sa;password=;initial catalog=cat;data source=abc"; if (strval == "b") proxyargs.command = "select * table1"; else proxyargs.command = "select * table2"; proxyargs.returntype = typeof(dataset);

mysql - Preferred database management system for Objective-C (iPhone apps) -

what best candidate dbms use in iphone apps? database online, not on device, back-end updating administration interface beneficial (like phpmyadmin mysql). i know of mysql (not sure if can used iphone satisfactory results), , sql lite, there other managements systems great performance reliable. thanks in advance. if database online, wouldn't recommend kind of management system on device. recommend implementing kind of web service , communicate database server , own dbms via web service.

c# - What is best practise for IValueConverter? -

what best practise ivalueconverter ? is ok put exception in convert method or should return "something"? here example: [valueconversion(typeof(float), typeof(string))] public class percentconverter : ivalueconverter { public object convert(object value, type targettype, object parameter, cultureinfo culture) { if (value == null || string.isnullorempty(value.tostring())) return string.empty; if (value float) //edited support cultureinfo.currentculture, return string.format(culture, "{0:n}{1}", ((float)value) * 100, "%"); //** ok put exception here or should return "something" here? ** throw new exception("can't convert " + value.gettype().name + ". expected type if float."); } public object convertback(object value, type targettype, object parameter, cultureinfo culture) { throw new notsupportedexception("converting not im

android - Setting the text of TextView that fits the screen Height and Width independently of the text size of TextView -

i have large string wont fit in screen if shown textview. 1 tell me how select sub string fit screen height , width independently of text size of textview. add these attribute textview in xml android:singleline="true" android:layout_width="fill_parent" android:layout_height="wrap_content"

How To Check If The .Net Framework Is Installed [C# / WPF] -

before starting application (on form load) want check , ensure .net framework (3.5 or higher) installed on machine - if not want prompt user download , install (simple messagebox internet link microsoft webpage best idea no?) so, entails 2 questions... a) how determine if .net framework 3.5 or higher installed? (i don't trust or want c:\program files\microsoft.net folder, seems error-prone no?) seeing crucial there must nice way in c# determine version of .net user has running on machine? have no clue how.. b) how paste internet link (hyperlink?) in messagebox? if user not have .net framework (1.1 or 2.0) installed can have them click on link go download it? any help/hints appreciated. thanks, din a) have bootstrap program non .net language (c++, vb6, etc) instead of form_load (other posters correct - if framework isn't installed, .net program won't run). example here: http://www.codeproject.com/kb/mcpp/dotnettester.aspx b) can't put hyperlink

how to organize graph nodes to draw using java 2d -

i created program builds , draw nested cyclic graphs (with undirected edges) in jframe using java awt. the problem if position of nodes not explicitly specified, or created @ random, graph becomes messy, edges crossing , vertex colliding. i implement algorithm repositioning better distribute nodes, in more homogeneous , clean way. can me? you may want @ graphviz , program (render graphs). has java api, integrate program, , it's open-source, if you'd rather implement solution yourself, perhaps code provide inspiration (just remember check license!) in addition, website has a list of resources pertaining graph drawing theory , sounds need.

build - building a jar and including it in a zip with maven-assembly-plugin -

i have mavenized java project (maven2) want build jar, easy enough supplying jar-with-dependencies descriptorref in pom.xml. however need deploy project in zip .exe , .bat files, among others, bin folder call jar. (i using tanuki not matter use case think) in other words, need build in first sources (and dependencies) packaged jar , jar put zip additional files bin folder. what should put in pom.xml , 'assembly'.xml? maven-assembly-plugin right tool that. you have declare plugin in "build" section of pom, , create configuration file "assembly.xml" @ root of project. in file, define content of zip file. the configuration options described on official site: http://maven.apache.org/plugins/maven-assembly-plugin/ here basic configuration example of plugin should suit needs. pom config : <plugin> <artifactid>maven-assembly-plugin</artifactid> <configuration> <finalname>zipfile</finalna

ajax - JQuery Mobile Loop to add items -

how loop , add list items in jquery mobile? something found using php: while($row = mysql_fetch_array($result)) { echo "<li><h2>" . $row['post_title'] . "</h2>" . $row['post_content'] . "<p class='ui-li-aside'>" . $row['post_date'] . "<strong></p>"; } but not using php in project (using c# webservice,jquerymobile). assuming need add 5 list items stored in variable count , how can achieve in jquery mobile? any idea can find jquery mobile tutorials uses c# web service talk database? thanks in advance... lucky you, jquery mobile inherits of jquery's behaviors. iterating on collection, try using ".each()" so: $(count).each(function(index) { // add item container here }); jquery documented, , relevant documentation .each() here: http://api.jquery.com/each/ . learn love docs.

asp.net - using connectionstring from web.config instead of app.config -

i have class library project in i've added dataset talks sql server. output of project consumed web application project . intend put connection string in web application project. did couple of things. in order make adapter use different connection string, had come across this . found doing following convenient: dim adapter new myreqeusttableadapter() adapter.connection.connectionstring = smyconnectionstring then tried taking connection string configuration (app.config) kind of simulate . added section manually key "myconstr". ideas like: smyconnectionstring = configurationmanager.connectionstring("myconstr").connectionstring but intellisense couldn't not detect configurationmanager. had add appropriate reference project. next added connection string via settings designer web application project. gave above key referencing it. above statment seems throw null reference exception. suppose have created class library. in you've define

javascript - Jquery: Best way to pop-up a selection div -

greetings, assume have such hidden div: <div id="option-dialog" style="display:none;"> <a href="#" value="1">first</a> <a href="#" value"2">second</a> </div> and have text input field: <input type="text" id="myinput" /> when myinput field clicked mouse, want hidden div appear close selected input field , once user selects link div, div dissapears , value selected becomes value of text input field. how achieve this? i use jquery , jquery ui regards you can use cluetip this.

Grails and Tomcat: Where to store uploaded files in filesystem? -

i wrote small web-application using grails. resulting war-file deployed on tomcat application server. the app has upload functionality attachments. chose save uploaded files disk (rather storing blobs in db). at first chose filepath inside webapp-dir store files, realized dir overwritten every deployment of new war-file. is there best practice "where store uploaded files in local filesystem" ? thanks help. alphaone, similar asking for, use apache webserver in front of tomcat. pick full path config file , write it. "/tmp/branding". pick url path location config file (say "myapp/branding") , use within our gsps. then, in apache, map app requests url ("myapp/branding") go directly file location, bypassing tomcat.

mysql - PHP : inserting row id to another table -

how can row id of tbl_questions , send tbl_link_qa , tbl_answers send it's row number tbl_link_qa (same tbl_questions) time must correspond first row number tbl_questions inserted first @ tbl_link_qa i need link row number of question tbl_questions , row number of answer tbl_answers. need bad rec_id---qrec_id---arec_id 96------------0-----------0 95------------0-----------0 i need make >> rec_id---qrec_id----arec_id 96----------123----------456 95----------124---------- 123 , 124 row number tbl_questions inserted tbl_link_qa , 456 tbl_answers use mysql_insert_id auto_increment id of last row inserted. ex: mysql_query("insert tbl_questions values (something)"); $question_id = mysql_insert_id(); mysql_query("insert tbl_answer values (something)"); $answer_id = mysql_insert_id(); mysql_query("insert tbl_link_qa (qrec_id, arec_id) values ($question_id, $answer_id)");

asp.net mvc - SQL: Create new table check with if else in view -

sql: create new table keep definition of status in other table or check if else in view. i'm doing reservation database programming. i have table reservation contain [status](char=> 0,1,2,3) 0 mean reserved,1 check in,2 check out,3 cancelled which better between create new table keeping definition of status or use if case in view show definition such as if(status=="0") print reserved if(status=="1") pring ...... ..... ... thx,for advice if these statuses unlikely expanded in future, , used 1 table, might want keep definition within single table. if did this, might want create table following: create table t ( /* various columns */ status tinyint not null, constraint t_status_valid check (status between 0 , 3), statustext case status when 0 'reserved' when 1 'check in' when 2 'check out' when 3 'cancelled' end ) this saves having create other objects

java - About a checkbox on datatable -

i want use checkbox on datatable : <h:selectbooleancheckbox styleclass="selectbooleancheckbox" valuechangelistener="#{completedinventoriesbean.changeuid}" value="#{completedinventoriesbean.ischecked(userinventorieswithuser.id)}" id="chkuser"> <f:ajax event="change" process="chkuser"></f:ajax> </h:selectbooleancheckbox> my uids on session. , want user clicks checkbox , adding or removing ids on session. there no problem, handle values on session beans. but during click on checkboxes, javascript alert below: servererror: class javax.faces.component.updatemodelexcepton/sections/completed.xhtml @29,244 value="#{completedinventoriesbean.ischecked(userinventorieswithuser.id)}": property 'ischecked' not found on type main.com.brad.services.completedinventoriesbean my ischecked method : public boolean ischecked(int z) { boolean exist = false; for(i

winforms - Ignore Form.ShowDialog() when testing a button click event that pops up a form? -

i ask how test button click event want check results after having shown form. using nunit test. created extension method show form below,have tried different methods such checking debugger.isattached?; public static void showformdialog(this form form) { if(debugger.isattached) form.showdialog(); } but appears still popup form while running test. there other way this? your design might need work. testing ? form or class handles form events? if 2 not separated, should be. if latter, should use dependency injection, can stub form, , raise event in own way. using conditionals debugger.isattached should never used without extremely reasons (haven't seen enough reason yet). regards, morten

openxml - Programmatically format a date in an excel sheet using Office Open Xml SDK -

i'm building excel xlsx spreadsheet using office open xml sdk. can add dates sheet converting them "ao" date representation , setting cell value number. can't, however, figure out how add dd-mm-yy formatting cell. i've seen lot of complicated examples have create stylesheet scratch, add format , reference format, figure there must easier way. i'm creating sheet template, , excel has builtin formats/styles. imo should able load stylesheet excel file i'm using template , apply format. can't figure out how though. if you're creating xlsx scratch can't avoid creating style sheet. minimally need style sheet , cell format element. cell format element can reference built-in date format in case can avoid custom number format, if want date format isn't built-in need number format element too. if you're creating xlsx template xlsx, can reference cell format that's defined, can sensitive since references based on index, sa

web applications - Making Python scripts work on MAMP -

i'm using mamp server testing out web pages. i'm new python. i'm able run script in python interpreter print hello world. print "hello world!" so used same line in file name test.py . how should run on web. as new python, tried normal things, placing test.py in /htdocs/cgi-bin/ , trying open it. says forbidden page. anyone please me making work. thanks to cgi, recommend reading python cgi docs . @ minimum, need output content type , html tags: print "content-type: text/html" print print "<html>" print "<head>" print "<title>example of python cgi script</title>" print "</head>" print "<body>" print "hello world!" print "</body>" print "</html>" also, make sure web server software has permission execute script. should able use chown set ownership , chmod set permissions .

javascript - PHP encoder - Viewing some problem -

i using free php encoder testing encoded script. my script (in 1 php file) : <?php ?> <!doctype html public "-//w3c//dtd html 4.01//en" "http://www.w3.org/tr/html4/strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title></title> </head> <body> </body> </html> as see html (with javascript inside) under php code. when encoded file phpencoder seems many problems appear in html , javascript, not php. what best way encoding file? try useful <?php phpinfo(); ?> to check whether works fine.

java - RFT Exporting & running it on a server -

i'm extremely new rational tools. have script recorded , ready exported can execute. i'm not sure how so. i'm using rational function tester v 8.1.0.3 java scripting. in other words need script run without eclipse being open. also after have script ready go need run automatically few times day automatically on server, suggestions? you can use rft's command line functionality kick off scripts. http://www.ibm.com/developerworks/rational/library/run-scripts-through-the-rational-functional-tester-command-line/index.html

character encoding - URL having a & getting encoded in a ASP.NET repeater control -

i have url in asp.net repeater control: http://www.someurl.com/test.aspx?abc=t&bd=1 this gets encoded &amp; when gets rendered browser. we have tried decoding using server side tags in repeater, did not work. how can stop happening? example: on server: http://www.someurl.com/registration?pcid=free15&pid=a1v80000000pq6zeag on client: http://www.someurl.com?pcid=free15&pid=a1v80000000pq6zeag @aspnetdev, row below shows url looks in database, 1 or 2? --------------------------------------------------- | id | url | --------------------------------------------------- | 1 | http://www.example.com/?id=1&name=test | | 2 | http://www.example.com/?id=1&amp;name=test | --------------------------------------------------- is rough approximation of repeater looks like? <asp:repeater runat="server" id="repmain"> <headertemplate> <ul> </headertem

Can a Flex AIR app on Android start up as a service on boot? -

i understand can create service in android , start on boot, can used location updates, communicate server, etc. however wanted find out if possible in air. air runs on android, can set 'service' , start on boot ( sitting in background )? thank you! your application running inside air runtime not service. short answer unfortunately no. also air runtime whopping 16mb , (and more users) better if write native android service.

xslt - Substring xsl hithighlightedsummary in SharePoint -

i have in hithighlightedsummary tag <ddd /> posted: 2/8/2011 10:04 pm <ddd /> subject: subject <ddd /> text <ddd /> i 'some subject' sub string. have tried using "substring-after(hithighlightedsummary, 'subject:')", don't know how combine <ddd /> tag. did mean this? substring-after( //hithighlightedsummary /text()[ contains(.,'subject:') ], 'subject:' ) note : i've used absolute expression because didn't provide information context.

iphone - CGAffineTransformMakeRotation not only rotate, but also move and stretch UIImageView -

i'm trying rotate uiimageview degrees cgaffinetransformmakerotation() function, end image not rotates, moved coordinates , stretched o.o have no clue why happen... here code: self.arrowtopoi.transform = cgaffinetransformmakerotation( m_pi / 4 ) don't know if can help, uiimageview resides inside custom uitablecellview , automatically changes its' height accommodate webview content. any appreciated! try selecting appropriate contentmode (property how image adjusted when bounds change, do). default uiviewcontentmodescaletofill , example uiviewcontentmodescaleaspectfill there strange behavior sounds similar problem. be aware it's rotated around uiimageview 's center.

c# - Overwrite a xml file value -

i have xml file this <count>0</count> now wish overwrite value 0. how do in c#? edit <counter> <count>0</count> <email> </email> </counter>` this xml file wish write value in email element , change value of count element xmldocument doc = new xmldocument(); doc.load(counter); foreach (xmlnode node in doc.selectnodes("count")) { node.innertext = (count-1).tostring(); } foreach (xmlnode node in doc.selectnodes("email")) { node.innertext = (count - 1).tostring(); } doc.save(counter); ` when no values written file your direct problem use of doc.selectnodes("count") instead of doc.getelementsbytagname("count")

php - Debugging Wordpress Loops -

specifically in buddypress forums loop. i want able alter sql returns specific forums topics. want able find sql executed specific loop. might stumble upon on it, wonder if there way trace / debug , loops find sql generated. i'm still struggling understand loops , tags, actions , hooks. tips debugging helpful. update: tell want exactly. want able return forum topics in buddypress forums meet conditions ie want return forum topics contain search terms in topics posts. best way add conditions forums loop sql. thanks if realy whant use sql open wp-includes/query.php , go functin get_posts. rather big function magic happens. not modify here use see witch filters called , when ( eg. @ line 1869 you'll see $search = apply_filters_ref_array('posts_search', array( $search, &$this ) ); , witch means need filter on hook posts_search , , can modify sql query, example pick right filters ). now , if you're stating out easyer , better practice use que

javascript - Does jQuery UI's sortable has a bug when the handle is outside the element? -

i have list of dynamically added fields uses jquery ui's sortable() . have dragging icon inside absolute positioned tip has each fields options. when try sort fields , down, placeholder (it's red box in demo) doesn't move. after testing found if remove position: absolute; css rule using firebug works, breaks layout. here demo of problem: http://mahersalam.co.cc/projects/namodgmaker/ first add 2 or more fields, try drag 1 of them see problem. how can fix problem ? update : tried make tip outside of sorted field using negative margins , floating , problem still happened, maybe it's jquery ui bug ? have tried chrome? seems work there or have not understood app.

java - JAX-RS exception mapper does not handle the exception that is thrown when doing parameter conversion? -

i created own class fromstring method believe jaxb use convert parameter value string object. however, inside fromstring method, have try catch block bubbles exception. following. public class animal{ public static animal fromstring(final string input){ try{ ... }catch(illegalargumentexception ae){ throw new cannotconvertanimalexception(); //this custom exception } } } and have mapper cannotconvertanimalexception following: @component @provider public class cannotconvertanimalexceptionhandler implements exceptionmapper<cannotconvertanimalexception> the thing in resource method. use data type animal @get @produces({mediatype.application_xml, mediatype.application_json}) public response showanimalinfo(animal animal){....} it turns out when parameter string converted animal throws cannotconvertanimalexception custome exception mapper not handle it. goes on throw paramexception.queryparamexception instead

c# - Many to Many relationship in object design -

i have similar problem : many many object object relation in c# however, imagine championship have "last date played" property (just example) map participant. in case, property end up? must create intermediate class? (which wouldn't want do) option have? thanks! one way have array on each object containing pointers other objects either via dictionary stores object key , date value (or custom property class number of properties) or using wrapper class around object , plain list, wrapper should implement decorator pattern allow direct access object unique properties. the wrapper object use internal object properties shared between oposing wrapper objects 2 different objects property in sync. another way separate list of pairs 1 wrapped above. the later makes easy loop on objects. here code example, might not need might give basics of idea. void main() { var p = new player("david"); var c = new championship("chess");

seo - right stucture of link to better PR of homepage -

i heard better pr of homepage site needs structured : the homepage links pages, , every single page links homepage. the homepage links second level pages , links third level pages, , every single page links 1 upper level page. my questions : 1. right ? 2. if site designed every page links pages (with sidebar etc.), smart make extraneous links rel=nofollow ? not - pagerank (pr) factor of incoming links. have described above more of pr distribution recommendation. rel=nofollow pr sculpting has been debunked , google, wasted practice. should use nofollow on links can't vouch for. means not no-following own internal links. if want increase pr of homepage, real way of doing getting backlinks page. other sites.

Mysql, SubQuery problems -

select rating_id, average_rating (select rating_id, avg(rating_num) average_rating ratings group rating_id having count(*) > 50) having average_rating > 4 ; after running query, error every derived table must have own alias i know section here works: select rating_id, avg(rating_num) average_rating ratings group rating_id having count(*) > 50 what doing wrong in subquery? searched , searched , searched couldn't find mistake, no matter corrected, still errors put "as somealias" after subquery: select rating_id, average_rating (select rating_id, avg(rating_num) average_rating ratings group rating_id having count(*) > 50) having average_rating > 4 ;

php - search multi keywords from sql -

so i'm getting data sql : $date = 1-02-2011 $sql = "select * abc date='$date'" now want data multiple dates creating graph $date1 = 1-02-2011 $date2 = 2-02-2011 $date3 = 3-02-2011 $date4 = 4-02-2011 $date5 = 5-02-2011 $date6 = 6-02-2011 and on.. is there quick way? or have create different querys each date? you can use in: select * abc date in ('2011-02-01', '2011-02-03', '2011-02-05') or if dates consecutive in example use between: select * abc date between '2011-02-01' , '2011-02-06' then read results: $result = mysql_query($query) or trigger_error(mysql_error()); while ($row = mysql_fetch_assoc($result)) { $date = $row['date']; $col1 = $row['col1']; // results. } edit: show null missing values can use left join: select t1.date, t2.* ( select '2011-02-01' date union select '2011-02-02' union ... union select &#

ms access - Where can I find the documentation for the particular kind of SQL used by the Jet 4.0 engine? -

which think same 1 used ms access, think not same 1 used mysql , others. need documentation particular "kind" or "subset" of sql language. here recent version of access sql reference (access 2010). however, guides per @remou's answer useful resource microsoft makes available, noting on decade old , not take account of changes made access 2007 ace era (i.e. multi-valued data types -- shudder!) a word wise: access sql reference contains errors of inclusion , omission numerous detail here, here's brief example: create table statement (microsoft access sql) create temporary table syntax has never been supported access , access doesn't have temporary tables feature. looks writing lifted sql-92 spec thinking access sql-92 compliant! with compression syntax supported in access's ansi-92 query mode**. helpful if pointed out. quote: "you can use not null .. within named constraint clause applies to... multiple-field named

How do I NOT analyze a clause in the lucene query parser? -

i'm using lucene query parser simple search front-end , i'm running problems. each record i'm storing has fields analyzed , fields not analyzed. when try use query parser construct query looks on both analyzed not analyzed fields, analyzer processing both fields, means non-analyzed field never match. is there way tell query parser not analyze field? you can use perfieldanalyzerwrapper defining specific analysis per field. perfieldanalyzerwrapper should used both indexing , retrieval. alternatively, can use solr, , define analysis in solr schema.

c++ - How to select the right overloaded function template at compile-time? -

i'm trying understand how select right overloaded function template @ compile-time , compiler giving me hard time. can make work, don't understand going on. let me explain. i have 2 structs , b below. 1 has special function , other normal. struct { void special() { std::cout << "special called.\n"; } }; struct b { void normal() { std::cout << "normal called.\n"; } }; my intension have mechanism, @ compile-time selects right overloaded function template depending on if special function available. have 2 functions run, take struct parameter, can call appropriate function. template<class func, func f> struct sfinae {}; template <typename u> static void run(u& u, sfinae<void (u::*)(), &u::special>* = 0) { u.special(); } template <typename u> static void run(u& u, ...) { u.normal(); } i've tested following, various results: int main() { a; run<a>(a, 0); // works

qt - QProcess read and write -

i trying read , write qprocess right now. made little test program takes input , redisplays on screen in loop. here code qt qstring path = "./test"; tcd = new qprocess(this); qstringlist args; args << ""; tcd->start(path,args); if(!tcd->waitforstarted(3000)) { stdoutput->append("<h1><font color=red>there problem starting software, please try running program again.</font></h1>"); } tcd->write("hello\n"); tcd->write("hello\n"); tcd->write("hello\n"); tcd->write("hello\n"); //tcd->write("quit\n"); qobject::connect(tcd, signal(readyreadstandardoutput()), this, slot(appendtextbox())); this won't work unless send last quit command (which terminates test program). here's read command: void tcd2_gui::appendtextbox(){ stdoutput

Have GreaseMonkey automatically call a JavaScript function defined in a frame -

i want automatically call js function defined within frame on html page i'm landing on. is possible in greasemonkey? unsafewindow.top.frames[0].functionname(); but unsafe. sure read beforehead: http://www.oreillynet.com/pub/a/network/2005/11/01/avoid-common-greasemonkey-pitfalls.html

MATLAB: Saving several variables to "-v7.3" (HDF5) .mat-files seems to be faster when using the "-append" flag. How come? -

note: this question deals issue observed in 2011 old matlab version (r2009a). per update below july 2016, issue/bug in matlab seems no longer exist (tested r2016a; scroll down end of question see update). i using matlab r2009b , need write larger script converts contents of larger set of .zip files v7.3 mat files (with underlying hdf5-datamodel). reading ok. issue saving. , there no problem. files saves nicely using save command. my question more in sense: why observing following surprising (for me) behavior in matlab? let's @ issue in general. in current test-scenario generating 1 output: -v7.3 mat-file. .mat-file contain 40 blocks individual variables. each variable named "block_nnn" 1 40 , contain struct fields frames , blockno . field frames contains 480x240x65 sequence of uint8 imagedata (here random data generated using randi ). field blockno contains block number. remark: in real script (that have yet finish) doing above @ total of 370 times, conv