Posts

Showing posts from January, 2015

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.

iphone - Save current data from UITableView -

trying figure out how data storage uitableviews ment work. practices when saving uitableview data on e.g. viewdiddisappear. do have update array every changes made while working in view, or can collect current values form table on exit view? can point me in right direction? thanks! first, on when save data, suggest save data in method instead of viewdiddisappear:. - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { second, there bunch of ways store data in iphone applications, such plist or sqlite3 database.

VB6 Manifest not working on Windows 7 -

i have created manifest file vb6 application running on windows 7 (not visual style changes, make sure accesses common registry , not virtualised one) the exe name capadm40.exe, manifest named capadm40.exe.manifest , contains following: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestversion="1.0"> <assemblyidentity version="1.0.0.0" processorarchitecture="x86" name="companyname.capadm40" type="win32"/> <description>administers system</description> <!-- identify application security requirements. --> <trustinfo xmlns="urn:schemas-microsoft-com:asm.v3"> <security> <requestedprivileges> <requestedexecutionlevel level="asinvoker" uiaccess="false"/> </requestedprivileg

html - How to make a site's content stick in the middle? -

in html, how make site ~60-80% of screen wide, , if window bigger centers, otherwise there's scroll bar? i'm talking way content here @ stackoverflow. i tried this, failed: <html> <head> <style type="text/css"> </style> </head> <body> <center> <div style="width: 60em; align: center;">kdsjlglkdfjgolksdjflgojsdfsdoljfglsdfghsdkjfgkdhfgkhlglkdfjgolksdjflgojsdfsdoljfglsdfghsdkjfgkdhfgklglkdfjgolksdjflgojsdfsdoljfglsdfghsdkjfgkdhfgklglkdfjgolksdjflgojsdfsdoljfglsdfghsdkjfgkdhfgklglkdfjgolksdjflgojsdfsdoljfglsdfghsdkjfgkdhfgklglkdfjgolksdjflgojsdfsdoljfglsdfghsdkjfgkdhfgklglkdfjgolksdjflgojsdfsdoljfglsdfghsdkjfgkdhfgklglkdfjgolksdjflgojsdfsdoljfglsdfghsdkjfgkdhfgkkjdghkdsfjgksdjfhg</div> </center> </body> </html> here's 1 follow: <body> <div class="wrapper"> content </div> </body> and in css, body{text-align:center

how to send ajax request in jQuery with data encoded -

when send ajax request got error that $.ajax({ type: "post", url: furl2, cache: false, contenttype: "application/json;charset=utf-8", data: { id: id, url: $("#id" + id + " .customurl").val() }, success: function (msg) { //some code here }, }); } i got error id undefined put them. how can send ajax request server using ajax. // create empty object var data = {}; // create , populate nodes in object data.id = id; data.url = //what ever wanted $.ajax({ type: "post", url: furl2, cache: false, datatype: "json", data: data, // send object server post data success: function (result) { // try , grab node in json object console.lo

java - why does the method invoke() in InvocationHandler have an parameter Object proxy? -

when r checking out method invoke(object proxy, method method, object[] args) declaration & doc statement,you find input parameter proxy proxy - proxy instance method invoked on when doing test on java dynamic proxy,i find proxy produced vm.so want know why method invoke has param,which surely nothing except object ($proxy0 )but don't have actual action our usage? this useful if have single invocation handle multiple proxy objects. can use hash map store proxy states information. example - mokito test framework store proxy invocation history.

jpa 2.0 - JPA 2 Criteria API - Exception converting JPQL to Criteria API query with Eclipselink -

i'm having trouble converting jpa query use criteria api i have following query attempts find serviceuser matching passed address parameter. serviceuser abstract entity concrete subclasses child , adult. i'm using joined inheritance strategy on serviceuser class. everything works fine when call method. public set<t> findbyaddress(address address) { query query = manager.createquery("select distinct s serviceuser s join s.addresshistory h h = :address"); query.setparameter("address", address); hashset<t> result = new hashset<t>(); (object s : query.getresultlist()) { // tclass runtime type of generic session bean. if (this.tclass.isinstance(s)) { result.add((t) s); } } return result; } but, if try replace function following uses generated metamodel , typedquery getting exception public set<t> findbyaddress(address address) { criteriabuilder cb = manag

javascript - help me wrap up a slider into a function I can call -

a while ago posted question jquery slider here this works treat need wrap in function each day of week can pass in values of values hard coded. i've tried doing , firebugs telling me slider undefined. all want call function 7 times each day of week , pass in id slider, id div holds times, id div holds generated table, id table , id button. the current code this: var starttime; var endtime; $("#slider-range").slider({ range: true, min: 0, max: 1439, values: [540, 1020], step:5, slide: slidetime, /*change: */}); function slidetime(event, ui){ var minutes0 = parseint($("#slider-range").slider("values", 0) % 60); var hours0 = parseint($("#slider-range").slider("values", 0) / 60 % 24); var minutes1 = parseint($("#slider-range").slider("values", 1) % 60); var hours1 = parseint($("#slider-range").slider("values", 1) / 60 % 24); starttime = gettime(hours0, minutes0

c - Expected specifier-qualifier-list before 'b3Vec' -

this should simple one, can't figure out problem. i have struct defining vector in 3d space, in vectors.h : /** * struct defining vectors in 3d space. */ struct b3vec { /** * size of vector. */ double size; /** * first direction of vector in degrees. */ double dir1; /** * second direction of vector in degrees. */ double dir2; }; in struct, called b3world in world.h have this: b3vec gravitation; i'm getting error on line expected specifier-qualifier-list before 'b3vec' . i'm including header files right , it's error get. can me? you need use struct keyword: struct b3vec gravitation;

Saving UI state with cookie and jquery -

i'm trying save state of collapsible menu, , using jquery cookie plug in .. i'm having trouble far though.. help? the script collapse/expand <script type="text/javascript"> $(document).ready(function() { $(".login-holder > ul > .logintitle").click(function() { $(this).parent().find("li").slidetoggle("fast"); if ($(this).parent().find(".toggle").html() == "+") { $(this).parent().find(".toggle").html("-"); } else { $(this).parent().find(".toggle").html("+"); } }); }) </script> the xhtml <ul class="account-links"> <div class="logintitle">user options<span class="toggle">-</span></div> <div class="menulinks"> <li> <%= html.actionlink<eventcontroller>( x =&

c++ - Erasing a container element using iterators -

my current homework assignment has me creating iterator class list. i'm stuck @ creating erase(iterator where) function. current code (reduced fit question): class list { class _iter { friend class list; public: _iter(listelem *pcurr, list *plist); /* *, ->, ++, --, == , != operators overloaded */ private: listelem *pcurr_; list *plist_; }; typedef _iter iterator; iterator erase(iterator where); }; with erase being implemented so: // precondition: list has been checked size > 0. list::iterator list::erase(list::iterator& where) { // erasing element in list. if(where == end() && == begin()) { pop_back(); // or pop_front(); return iterator(0, this); } // elem @ end if(where == end()) { pop_back(); return end(); } else { // elem @ beginning if(where == begin()) { pop_front();

c# - how to get the co-ordinates of an underlying image of a picture box -

i have picture box image associated it. the size mode of picturebox has been set centerimage my question how can image co-ordinates underlying image. regards i think best bet calculate using formula this: int xoffset = (picturebox1.width / 2) - (picturebox1.image.width / 2); int yoffset = (picturebox1.height / 2) - (picturebox1.image.height / 2); xoffset , yoffset should equal (x,y) of image top left corner of picture box. keep in mind, formula above uses integer math , truncate values.

project management - Using personas in software development -

we using personas @ work. however, use of quotes imaginary user thing add? personas archetypes intended model class of users single, specific person. they're intended communicate user needs clearly, , "engage empathy of design , development towards human target of design" [alan cooper, "about face"]. you can convey persona in multiple ways. i've seen third-party narrative. cooper suggests photographic collage 1 way of multiple. so question whether quotes convey persona, , make team feel driven meet needs of archetype user , actual users represented. if do, yes, using them thing.

python - Numpy: Multiplying a matrix with a 3d tensor -- Suggestion -

i have matrix p shape mxn , 3d tensor t shape kxnxr . want multiply p every nxr matrix in t , resulting in kxmxr 3d tensor. p.dot(t).transpose(1,0,2) gives desired result. there nicer solution (i.e. getting rid of transpose ) problem? must quite common operation, assume, others have found different approaches, e.g. using tensordot (which tried failed desired result). opinions/views highly appreciated! scipy.tensordot(p, t, axes=[1,1]).swapaxes(0,1)

php - How do I add taxonomy terms using Drupal Migrate -

i'm using migrate module copy data several sources new drupal installation. far, i'm able replicate lot of need examples provided module. i'm stuck on adding terms or taxonomy newly created nodes. example shows: // these related terms, default looked name $this->addfieldmapping('migrate_example_beer_styles', 'terms') ->separator(','); i've tracked down migrate_example_beer_styles destination mapping , seems machine name taxonomy. i've tried imitating behavior every variation of machine_name should be, terms never seem associated: by id: // source breed_id '1,100' - finds mapped values accordingly $this->addfieldmapping('breeds', 'breed_id') ->sourcemigration('breedmigration') ->separator(',') and, name: // source breeds 'dogs,german shepherd' $this->addfieldmapping('breeds', 'breeds') ->separator(','); am

c# - SRP: Why use instance field values instead of parameters? -

i've read srp, easy 123… , , of resonates me except 1 paragraph, in section named "cohesion" (i've claimed before "get" cohesion, talk of parameters vs instance fields gives me pause...): take class. @ methods. have parameters or using instance fields? if using parameters, remove them. make them instance fields. end methods use 1 of 5 instances? warning of low cohesion exists between method , class. is removal of parameters merely temporary exercise reveal methods approaching static-ability (low cohesion), idea being return use of parameters when you're finished? or preference instance fields on parameters actual design technique maintain high cohesion? have somehow taken quote out of context? crud real common approach interface based programming. take 2 concrete classes implement crud interface: employee , building. now imagine how code being parameter based: employee employeeobj = new employee(); buildin

Sandboxes and Wordpress, Joomla or Drupal Sites? -

i'm looking building database driven websites based on opensource platforms in sandbox area rather having them accessible via final url until clients have paid up. is aware of problems may cause paths or functionality, or, know of articles on subject? many shaun i suggest having cut-down, less privileged or demo account signup users can still enjoy overall experience of site without full functionality of killer-webapp services. "restricting" them in sandbox area not actual site not appealing , convincing them go "freemium premium" customers.

c++ conversion operators no candidate is better -

#include <iostream> #include <string> using namespace std; class test { private: std::string strvalue; int value; public: test():value(0) { }; test(int a):value(a) { }; test(std::string a):strvalue(a) { }; ~test(){}; operator int () { return value; } operator const char* () { return strvalue.c_str(); } }; int main() { test v1(100); cout << v1 << endl; return 0; } when run above, gcc error saying no candidate better conversion.. aren't exclusive types? std::ostream has numerous operator<< overloads, including both of following: std::ostream& operator<<(std::ostream&, const char*); std::ostream& operator<<(std::ostream&, int); your test class convertible both const char* , int . compiler can't select conversion use because both conversions work equally well. thus, conversion ambiguous.

linux - Cron Terminates Python Script? -

i have 'long' python script takes 45[min] run. use (a 'scheduler' script) python script run long script. when run 'scheduler' script using terminal, works (meaning, 'long' script runs without issues). i had struggles, succeeded adding 'scheduler' script run through cron every minute. 'runs' other script , works ok. here problem: whenever script (that being 'run' 'scheduler') has line says: print "hello" or 'print' statement, cron job runs, terminates after 20-30 seconds. when remove 'print' statements, cron runs jobs , not terminate. i'd fix situation, , have scripts continue run if have 'print' statements in them. hints how it? p.s. within 'scheduler', use subprocess.popen([sys.executable, command]) to 'run' other python scripts. i have hunch it's due way cron handles stdout. how redirecting output? from http://aplawrence.com/bdd/bbc

Rails: (Devise) Two different methods for new users? -

i have rails 3 app authentication setup using devise registerable module enabled. i want have new users sign using our outside register form use full devise registerable module, happening now. however, want admin user able create new users directly, bypassing (i think) devise's registerable module. with registerable disabled, standard userscontroller works want admin user, other rail scaffold. however, new users can't register on own. with registerable enabled, standard userscontroller never called new user action (calling devise::registrationscontroller instead), , crud actions don't seem work @ (i dumped onto root page no new user created , no flash message). here's log request: started post "/users" 127.0.0.1 @ 2010-12-20 11:49:31 -0500 processing devise::registrationscontroller#create html parameters: {"utf8"=>"✓", "authenticity_token"=>"18697r4synnwhfmtkdcwcdyphjos+68rpfsaykvjo8y="

jquery/ajax json data function not working -

i have following function suppose talk server retrieve json data , display problem function not initiating query i'm doing wronge? code uploaded apache tomcat server , used wireshark traces , there none on http port here code $(document).ready( function() { var home_add='http://wcf.net:3300/gateway'; $('#handshake').click(function(){ alert(" sending json data"); function handshake(){ /*testing function */ var data_send = { "supportedconnectiontypes": "long-polling", "channel": "/meta/handshake", "version": "1:0" }; $.ajax({ /* start ajax function send data */ url:home_add, type:'post', datatype:'json', co

drop down menu - Using jQuery to change value of one dropdown from another -

i have 2 drop down lists , make when selects example value 2 dropdown1, dropdown2 automitacally changed value 2. possible using jquery? <select id="dropdown1"> <option value="1">item1</option> <option value="2">item2</option> <option value="3">item3</option> </select> <select id="dropdown2"> <option value="1">item1</option> <option value="2">item2</option> <option value="3">item3</option> </select> this should it: $("#dropdwon1").change(function(){ $("#dropdwon2").val($(this).val()); }); working version here: http://jsfiddle.net/xkt3u/

Forwarding a Django template dictionary to another template? -

is possible reuse template dictionary in view ? for instance, imagine view performs search on db , provide search results in dictionary template. template displays first 10 results , has link display results in page. is possible forward template dictionary containing search results avoid having perform same search again ? not really. can't preserve across page views - except storing somewhere, eg in session. couldn't put in template itself, need sent server via post next request. in case, there's not need this. if use built-in paginator class paginate search, django automatically use limit , offset in query objects you're displaying queried.

delimiter - c# reading in a text file into datatable -

i need read files datatable: a02 blank031 b02 f357442 c02 f264977 d02 blank037 e02 f272521 f02 e121562 g02 f264972 h02 f332321 a03 e208240 b03 f313854 c03 e229786 d03 e229787 e03 f307584 f03 f357478 i have weird delimitter , trailing spaces. how read datatable such first column contain 'a02','b02'... , second column contain 'blank031','f357442',etc.. currently doing: datatable dt = new datatable(); using (textreader tr = file.opentext(batchesaddresses[index])) { string line; while ((line = tr.readline()) != null) { string[] items = regex.split(line, ' '); if (dt.columns.count == 0) { // create data columns data table based on number of items // on first line of file

php - xml + xpath, print element -

notice: undefined property: domnodelist::$id in d:\wamp\www\xml\index.php on line 15 id: notice: undefined property: domnodelist::$name in d:\wamp\www\xml\index.php on line 16 name: <?php $xml = new domdocument(); $xml->load('test.xml'); $xpath = new domxpath($xml); $query = '/people/person[id="33333"]'; $entries = $xpath->query($query); echo 'id:'. $entries->id.'<br/>'; echo 'name:'.$entries->name.'<br/>'; ?> xml file sample: <people> ... <person> <phone>33333</phone> <name>aadgar</name> <last_name>adas</last_name> </person> ... </people> first, id node doesn't exists... $query = '/people/person[id="33333"]'; i think want: $query = '/people/person[phone="33333"]'; then, must do: $entries = $xpath->query($query); foreach ($entries

wpf controls - Getting the top left coordinates of a WPF UIElement -

i working on extending microsoft resize adorner example , need able reposition element after bottom left drag handle has been dragged. so if have textbox of 150 wide, 35 high postitioned on form, , bottom left drag handle changes width 200 wide, right hand of text box remains unchanged left hand edge moves left. so need know top left coordinates of uielement. have tried canvas.getleft , canvas.gettop return nan confusing. i tried visualtreehelper.getoffset return offset when try , use in arrange method of element disappears, presumably values in offset high. in days before wpf coordinate system quite simple, wpf has overcomplicated things think. and if wants control's screen coordinates : point targetloc = targetctrl.pointtoscreen(new point(0, 0)); (this doesn't match thread's description, match title. figured might people coming in off search results)

asp.net - save client html changes -

i have div element contains ul element starts off empty when page first loaded. user can drag li elements div box populate ul element. need able retain li elements have been added ul container can show li elements after post back. how can achieve this? <div class="sidebar-drop-box"> <p class="droptitle"><strong>drop box</strong><br /> drag , drop tracks here temporarily if you’re working long playlist.</p> <ul class="admin-song-list"></ul> </div> the drag , drop done javascript , jquery. of sits on asp.net page. when drag completed code executed function addtodropbox(obj) { $(obj).children(".handle").animate({ width: "20px" }).children("strong").fadeout(); $(obj).children("span:not(.track,.play,.handle,:has(.btn-edit))").fadeout('fast'); $(obj).ch

php - $_GET undefined index -

by passing js variable php code displays value @ end of program. but problem no mather try initialise score disapears @ end. if leave alone displays should, annoying undefined message until last screen (where value gets displayed). $varone = $xml->addchild('one', $_get['resultone']); the variable in js being past using window.location.href i have tried several isset ways none of them seem have succeeded in resolving annoying problem. kind regards. have tried testing $_get , $_get['resultone']? if( isset($_get) && isset($_get['resultone']) ) { }

python - DSA verification calculation -

am missing something? fips180-2 , on page 25, gives values of u1, u2, g^u1 mod p, y^u2 mod p , v. have calculated values except v. yet, when math, calculations refuse v = 0x8bac1ab66410435cb7181f95b16ab97c92b341c0. instead, v = 0xc5a54698ae8e5b94661134260594ff4e3f488e26, not equal r, before. im doing (pow(g, u1, p) * pow(y, u2, p)) % q calculation, pow builtin function, not math module function you're skipping 1 mod p calculation. should compute: (((pow(g, u1, p) * pow(y, u2, p))) % p ) % q

backup - rsync - what means the f+++++++++ on rsync logs? -

i'm doing rsync make backup of server files, , have 2 questions: 1 - on middle of proccess need stop , start again rsync, i'd know if rsync start @ same point stoped or restart sync? 2 - on log files show string files "f+++++++++", i'd know means? eg: 010/12/21 08:28:37 [4537] >f.st...... iddd/logs/website-production-access_log 2010/12/21 08:29:11 [4537] >f.st...... iddd/web/website/production/shared/log/production.log 2010/12/21 08:29:14 [4537] .d..t...... iddd/web/website/production/shared/sessions/ 2010/12/21 08:29:14 [4537] >f+++++++++ iddd/web/website/production/shared/sessions/ruby_sess.017a771cc19b18cd 2010/12/21 08:29:14 [4537] >f+++++++++ iddd/web/website/production/shared/sessions/ruby_sess.01eade9d317ca79a thanks. let's take @ how rsync works , better understand cryptic result lines: 1 - huge advantage of rsync after interruption next time continues smoothly. the next rsync invocation not transfer files again

python - Has anybody been able to install PyWeka? -

i need install in python 2.6 or 2.7 windows library pyweka0.3dev, says requires setuptools, installed told me deprecated instalation library , installed distribute, downloaded pyweka compressed package , each time try install neither setup.py nor easy_install (where says no module ez_setup). can give me clue how this? as mentioned via aardvark (yes, omnipresent), module in question broken. can't easy_install it. it's bug in pyweka. you can download file pypi, http://pypi.python.org/pypi/pyweka/0.3dev , , unpack it. in file setup.py, remove following 2 lines: from ez_setup import use_setuptools use_setuptools() and install running python setup.py install you need have installed numpy , namedmatrix (which has same bug pyweka) first. however, mentioned on windows. doubt pyweka work on windows. there unix specific code in it. and still want know why authors reading files calling cat subprocess . seems pretty pointless , broken install, enough reason m

dictionary - How does one test item membership in an unordered sequence (C++)? -

i've used python long time, , i'm beginning use c++ in python, if 1 has set or dictionary relatively easy boolean value indicating whether or not particular item in sequence using in keyword. i.e. a = set(2,4,3) if 4 in print "yes, 4 in a, thank asking!" it's more efficient doing this: a = [2,3,4] number in >if number == 4 >>return "yes, 4 in a, thank asking!" is there way make membership test simple , efficient in cpp or have iterate through ordered sequence? you have functionality in std::set , tr1::unordered_set (not yet in c++ standard). #include <set> #include <cstdio> int main() { std::set<int> s; s.insert(1); s.insert(2); s.insert(4); if (s.find(4) != s.end()) puts("4 found!"); return 0; } in reality, if data set small, linear search may still faster option.

java - what is the exception being thrown in this code: -

public class testex { public static void main ( string[] args ) { double [] scores = new double [5]; scores [5] = 95.75; } } im not sure exception being thrown here, please double[5] not last element in array, double[4] (arrays zero-based in java)

How do you store a list of directories into an array in Bash (and then print them out)? -

i want write shell script show list of directories entered user , user select 1 of directories index number based on how many directories there are i'm thinking kind of array operation, im not sure how in shell script example: > whichdir there 3 dirs in current path 1 dir1 2 dir2 3 dir3 dir want? > 3 selected dir3! $ ls -a ./ ../ .foo/ bar/ baz qux* $ shopt -s dotglob $ shopt -s nullglob $ array=(*/) $ dir in "${array[@]}"; echo "$dir"; done .foo/ bar/ $ dir in */; echo "$dir"; done .foo/ bar/ $ ps3="which dir want? " $ echo "there ${#array[@]} dirs in current path"; \ select dir in "${array[@]}"; echo "you selected ${dir}"'!'; break; done there 2 dirs in current path 1) .foo/ 2) bar/ dir want? 2 selected bar/!

windows 7 - Visual studio .SLN executing Exe file / .VBS script -

how launch .exe file or .vbs script when visual studio solution(.sln) opened ? associate .sln file own executable instead of devenv . in executable, if solution being opened matches delete necessary files. execute devenv , pass solution full path , name parameter.

javascript - Why aren't options being overridden? -

in module pattern, options 'undefined' reason.. see why aren't being passed in properly? framework.mymodule = (function(options) { var defaults = { someoption : 1, stuff : 2 }; if (!options) { var options = defaults; } else { (var index in defaults) { if (typeof options[index] == 'undefined') options[index] = defaults[index]; } } var module = {}; // initialize _something(); // private methods function _something() {} // public methods module.click = function() {}; return module; })(); ... docready function ... var options = { someoption : 9, stuff : 10 }; framework.mymodule(options); ... end doc ready ... please see fiddle: http://jsfiddle.net/kwhez/1/ var options = { /* ... */}; framework.mymodule = (function(options) { /* .. options undefined ... */ })(); framework.mymodule = (function(options) { /* ..

Django form field errors in templates -

django templates allow access field errors via field.errors.as_ul. in python, however, field has no attribute errors. how work? my particular problem tried serializing forms (and errors) , on deserialization works in python, errors don't show if ask explicitly them via field.errors.as_ul. show via field.errors, though: basically, list of strings shows. can explain this? there 2 separate classes fields - field elements declare in form, , boundfield class automatically created form , contains bound data , errors.

c# - Multiple database connection in classic ASP with SQL 2008 -

i have page (default.asp) of right need connect data 2 different databases. problem keep getting error "multiple-step ole db operation generated errors. check each ole db status value, if available. no work done." before adding following connection site worked fine includes file connection..i found out error out on conn.open <% set conn = server.createobject("adodb.connection") conn.connectionstring = "provider=sqlncli10.1;integrated security=true;persist security info=false;initial catalog=member;data source=608;" conn.open conn.close %> any suggestions can here? ps 1 hardcoded page itself. that common error message, need check errors collection on connection, should give more info: <% each objerr in objconn.errors response.write("<p>") response.write("description: ") response.write(objerr.description & "<br />") response.write("help c

iphone - Can I fade / animate the tintColor of a UIToolbar? -

i trying animate uitoolbar's tintcolor property, change 1 tintcolor another. here code trying. unfortunately, change occurs , not fade green blue. strange because know apple fades , "pulses" toolbar tint colors when tethering or on phone call. why doesn't work? // set initial tint color mybottomtoolbar.tintcolor = [uicolor colorwithred:0.15 green:0.95 blue:0.15 alpha:0.6]; //animation stuff [uiview beginanimations:nil context:nil]; [uiview setanimationduration:1.95]; [uiview setanimationdelegate:self]; //thing animate mybottomtoolbar.tintcolor = [uicolor colorwithred:0.15 green:0.35 blue:0.45 alpha:0.6]; //animation stuff [uiview commitanimations]; the tint color in not animatable through public apis. can work around manually changing tint color on timer. have interpolate intermediate color levels.

statistics - Nonlinear e^(-x) regression using scipy, python, numpy -

Image
the code below giving me flat line line of best fit rather nice curve along model of e^(-x) fit data. can show me how fix code below fits data? import numpy np import matplotlib.pyplot plt import scipy.optimize def _enegx_(p,x): x0,y0,c,k=p y = (c * np.exp(-k*(x-x0))) + y0 return y def _enegx_residuals(p,x,y): return y - _enegx_(p,x) def get_enegx_coefficients(x,y): print 'x is: ',x print 'y is: ',y # calculate p_guess vectors x,y. note p_guess # starting estimate minimization. p_guess=(np.median(x),np.min(y),np.max(y),.01) # calls leastsq() function, calls residuals function initial # guess parameters , x , y vectors. note residuals # function calls _enegx_ function. return parameters p # minimize least squares error of _enegx_ function respect original # x , y coordinate vectors sent it. p, cov, infodict, mesg, ier = scipy.optimize.leastsq( _enegx_residuals,p_guess,args=(x,y

class design - Foward declaration of classes in Python -

the following program can run successfully: class simple(object): def __init__(self, name): self.name = name def __add__(self, other): c = composite() c._members.append(self) c._members.append(other) return c def __repr__(self): return "simple('%s')" % self.name class composite(object): def __init__(self): self._members = [] def __add__(self, obj): if isinstance(obj, simple): out = composite() out._members = [k k in self._members] + [obj] elif isinstance(obj, composite): out = composite() out._members = [k k in self._members + obj._members] else: raise typeerror return out if __name__ == "__main__": s1 = simple('one') s2 = simple('two') s3 = simple('three') c1 = s1 + s2 c2 = c1 + s3 print c1._members print c2._members # output: # [simple('one'), simple('

sendmail - Send Mail using PHP failing -

i using same php code have used try , send form via email , getting message: warning: mail() [function.mail]: failed connect mailserver @ "localhost" port 25, verify "smtp" , "smtp_port" setting in php.ini or use ini_set() in sendmailsuscribete.php on line 44 this lines 40 - 54: $header .= "from: $email" . "\r\n"; $header .= "reply-to: $email" . "\r\n"; $header .= "return-path: $email" . "\r\n"; if(mail($to, $subject, $msg, $header)){ //message sent! redirect("http://www.domain.com/suscribete.html"); }else{ // display error message if message failed send echo " <div class=\"msgerror\"> <h1>error&hellip;</h1> <p>disculpa <b><?=$name;?></b>, tu mensaje fall&oacute; en ser enviado. por favor vuelve intentar.</p> </div>"; } i checked using phpinfo()

ios - Bundle ID Blunder - But is this really an issue? -

i have seen lot of documentation describes "correct" or "recommended" format appstore bundle id's follows: com.companyname.appname this makes sense, , how named our first 2 apps in appstore. but confusing ui change on apple's web interface, our newest app ended getting created in itunes connect bundle id of "appname". un-editable once entered, , reportedly deleting app try , recreate correctly blocks ever again using app's name. changing app's name @ last minute not solution if have invested in art, branding, , marketing. i unable upload our binary until changed bundle id in info.plist match "incorrect" version on itunes connect. our app has been approved, haven't yet made available in store yet. know once bundle id out in wild, forever unchangeable. imagine if fixed, needs happen before release our app world. my question -- there way salvage situation having "incorrect" bundle id? , - situation?

asp.net - SQLException: incorrect syntax near '2' -

whenever call " executenonquery " command on following commandtext , above sqlexception mycommand.commandtext = "insert fixtures (round_id, matchcode, date_utc, time_utc, date_london, time_london, team_a_id, team_a, team_a_country, team_b_id, team_b, team_b_country, status, gameweek, winner, fs_a, fs_b, hts_a, hts_b, ets_a, ets_b, ps_a, ps_b, last_updated) values (" _ & round_id & "," & match_id & "," & date_utc & ",'" & time_utc & "'," & date_london & ",'" & time_london & "'," & team_a_id & ",'" & team_a_name & "','" & team_a_country & "'," & team_b_id & ",'" & team_b_name & "','" & _ team_b_country & "','" & status & "'," & gameweek & ",

c# - Simplest way to listen to another server? -

i have server (windows, c#.net), needs send alert/signal server b (linux, java, apache) everytime process done. need using method call .net. easiest way this? thinking of setting web server on server b on port listen requests server a. how should go this? new java , have no experience writing java web services, , need quick, why want easy possible. look sockets. instead of setting entire webserver, can have server b listen on port , have server allow connections, , send data on same port. there millions of examples online sockets, , java , .net both have them (most languages do). http://ondotnet.com/pub/a/dotnet/2002/10/21/sockets.htm http://download.oracle.com/javase/tutorial/networking/sockets/

sql - How to fetch 4 characters from a string in oracle? -

by using following query able fetch particular string.now output string contains alphanumeric characters.e.g.abcd123,pqrs542356. want fetch first 4 characters of string alpha bates. query:: (select substr(in_msg, instr( in_msg,'?', 1, 10 )+ 1, instr(in_msg,'?', 1, 11 ) - instr( in_msg,'?', 1, 10 )- 1) emp_message emp_no in (select emp_no main_table name '%abcd%') this query returns output e.g.abcd1234,pqrs145423. again want fetch first 4 characters query output. can me in this. you can use substr (like do): substr(value, 1, 4)

Ruby on Rails Oracle DB connection -

my main database local mysql database, connect oracle database directly in applications code. the oracle database hosted on rhel server. i unsuccessfull tried install ruby-oci8 gem (error: failed build gem native extension.) i wondering whether oracle database has local in order use gem, or if there better ways of achieving this. gem install ruby-oci8 building native extensions. take while... error: error installing ruby-oci8: error: failed build gem native extension. /usr/bin/ruby extconf.rb checking load library path... ld_library_path... checking /opt/instantclient... yes /opt/instantclient/libclntsh.so.11.1 looks instant client. checking cc... *** extconf.rb failed *** not create makefile due reason, lack of necessary libraries and/or headers. check mkmf.log file more details. may need configuration options. provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${o

how to call subactivity of another application android? -

to call main activity saw componentname class in android. intent = new intent(new componentname(packagenam,classname); if same used in case of child activity, got error , "is activity delcared in andorid manifest?" error. how call app1 child activity in app2 using intent ? in app1 activity declared in manifest <activity android:name=".activity.messagecompose" android:label="@string/app_name" android:enabled="false"> - <intent-filter> <action android:name="android.intent.action.view" /> <action android:name="android.intent.action.sendto" /> <data android:scheme="mailto" /> <category android:name="android.intent.category.default" /> <category android:name="android.intent.category.browsable" /> </intent-filter> - <intent-filter android:label="@string/app_name"> <action android:name="android.intent.

windows - What is Zone Identifier? -

Image
i saw files named 'blabla.exe:zone.identifier' monitoring i/o process monitor. files seen network-drive. what zone.identifier? what colon mean in filename. is colon related file's extended attributes? the text after colon identifier "alternate data stream". ads used store meta-information file. example, zone identifier stores whether file downloaded internet. some specific info: about url security zones , zone.identifier stream name best google around more information. eg. this , this , this . finally, here's streams , sysinternals tool ads.

java - Lib for Android and MIDP? -

is possible share java library (in form of jar file) between android , midp projects? if case, java version should compile with? library not use android or midp specific stuff. no it's impossible, since android , j2me use different vm. android's 1 called dalvik vm , j2me's kvm - they're generating different bytecodes.

asp.net login Page -

i have asp.net webpage. want other pages expire when user clicks logout button. im not using login control, im using textbox login page. when user enters username , password, check see if matches 1 in database. how make when user logs out, cant click button, or cant type specific url without goin through login page first this should automatically handled asp.net. make sure abandoning session when user clicks logout , have configuration similar in web.config <authentication mode="forms"> <forms loginurl="~/login.aspx" defaulturl="default.aspx" timeout="30" slidingexpiration="true"/> </authentication>

java - How to mass upload PDF files and save into MySQL using Servlet? -

how mass upload pdf files or folder pdf files , save mysql database using servlet? the best ask user specify files using several <input type="file"...> elements on page. , on submit check if files pdf or not, perform desired action in either case. or can check pdf extension right away using javascript. can validate using ajax, send ajax request server on onblur event of input field . otherwise, privileged applet might able little more this. example asking directory , scanning pdf's etc.

interrupt - Ada - does pragma Attach_Handler() can attach handler with System.Priority'Last priority? -

the next 2 declarations equivalent: protected type prot_type .... pragma priority(system.priority'last); end; protected type prot_type .... end; one way of attaching interrupt handler is: protected type prot_type procedure handler; pragma attach_handler(handler, ...); end; --//attach made @ creation of next object: object : prot_type; it's legal attachment (it works). how possible handler has ceiling priority of system.priority last ? (as far know legal priority in range priority'last+1 .. any_priority'last). another thing: if add pragma priority(system.priority'last); protected declaration, program_error exception raised @ elaboration (when attaching handler). someone can please spread fog? i manage understand to: http://www.iuma.ulpgc.es/users/jmiranda/gnat-rts/node33.htm the fact hadler defined in protected ceiling priority system.priority'last managed attached interrupt seems me bug in compiler. o

smartcard - Contact-less card through an OmniKey, how to get "UID"? -

Image
i trying read information off of smartcard, using contact-less omnikey 5321 card reader. edit : added bounty. i'm writing c# 3 in .net 3.5 program, windows application. the card has information stamped onto it, assume, in way, present in card data (there photo of card , reader below.) the card has following information stamped onto it: 1* 00447 21091328-32 when using diagnostics application comes omnikey card reader, following information: smart card name: iclass 16ks uid:ee 74 0e 00 fb ff 12 e0 atr : 3b 8f 80 01 80 4f 0c a0 00 00 03 06 0a 00 1a 00 00 00 00 78 protocol : iso 15693 (part 2) now, here's conversions i've considered: 447 decimal = 1bf hexadecimal (not found) 447 octal = 295 decimal (not found bcd-type encoding) 447 octal = 127 hexadecimal (not found) 447 hexadecimal not found here's questions: is "uid" number unique number can rely on? don't care 447 number, need know information pick card

sql - foreign keys without on delete cascade -

i have 2 tables: challenge: challengeid integer primary key ... and userchallenge: id integer primary key challengeid integer not null ... foreign key(challengeid) references challenge(challengeid) if have 1 row on challenge table, challengeid = 1, , 1 row on userchallenge table challengeid = 1. what happen userchallenge table if delete row challenge? may use on delete cascade userchallenge.challengeid ? thanks. you test... if delete row challenge, constraint on challengeid in userchallenge gets violated. have delete referencing records in table well, or update these records using (correct) value or use null. use on delete cascade when want delete referencing records.

seo - Canonical URLs and Google -

as far google , canonical urls go - there advantage adding 301 redirect from: http://www.mydomain.com/index.php to http://www.mydomain.com/ no default page open when no page name specified either " index.html " or " index.php ", priority given latter default. there not advantage such & moreover, it's not needed. for other page (except home page or " index " named pages), if specify redirect header 301, notifying google & other search engines store target url active & latest 1 (not first one), in database. it's setting permalink in databases of search engines latest active urls. there 1 big advantage, however. when specifying " http://www.mydomain.com/index.php ", notifying search engines load " index.php " page times. however, if specify " http://www.mydomain.com/ " search engines, it's upto ( mydomain.com ) server's interpretation (after understanding server's htaccess

mysql - php search help -

following posted variables search form: $city = $_request['city']; $location = $_request['location']; $bedrooms = $_request['noofbedrooms']; $addeddate = $_request['addeddate']; $minprice = $_request['pricefrom']; $maxprice = $_request['priceto']; $minarea = $_request['areafrom']; $maxarea = $_request['areato']; $propertytype = $_request['proptype']; so far good. need suggestions following scenario. every element in field optional. means can empty values in above variables. what should scenario create mysql query above variables. on case can use conditions each , every scenario. eg if($city=="") $query=""; elseif($location=="") $query=""; , on.... i need professional approach this. $city = mysql_real_escape_string($_request['city']); $location = mysql_real_escape_string($_request['location']); $bedrooms = mysql_real_escape_str

php - Retrieving images - MySQL based or file system based, which one is faster? -

i'd know if it's faster/better retrieve image(s) particular product or blog post or whatever in website getting path/filename database along rest of data, or if should create folder product id , use glob iterate on or use id filename in case of single image, example. what advantages/disadvantages these approaches? it's faster use paths/name methods (- 1 database calls; composing string not time/memory consuming operation). way, in case you'll have different images same product id, might create foreach loop looks in given folder pic1.png, pic2.png [...] picn.png. there problem, though: changing images become more convoluted process - instead of uploading new ones , updating db, have delete previous (or previous set) relative thumbnails if before uploading new ones; mean image change process won't reversible unless store old ones in backup directory, etc. so, (you plan change them || users change them often) ? database : paths

iphone - Setting the background colour/highlight colour for a given string range using Core Text -

Image
i have text laid out using core text in iphone app. i'm using nsattributedstring set styles within text given ranges. i can't seem find attribute setting background / highlight colour, though seem possible. couldn't find attribute name constant sounded relevant , documentation lists: kctcharactershapeattributename kctfontattributename kctkernattributename kctligatureattributename kctforegroundcolorattributename kctforegroundcolorfromcontextattributename kctparagraphstyleattributename kctstrokewidthattributename kctstrokecolorattributename kctsuperscriptattributename kctunderlinecolorattributename kctunderlinestyleattributename kctverticalformsattributename kctglyphinfoattributename kctrundelegateattributename craig hockenberry, developer of twitterrific has said publicly on twitter uses core text render tweets, , twitterrific has background / highlight i'm talking when touch link. any or pointers in right direction fantastic, thanks. edit: here's l