Posts

Showing posts from July, 2012

Is Mysql IF EXIST what should be used for this query? -

select social_members.* , social_mcouple.* m_id = '".$_session['userid'] . "' , c_id = '".$_session['userid'] . "' select fields social_members.* , if social_mcouple.c_id = $_session['userid'] select fields social_mcouple.* well. can done if exist , if how. thanks if undertand correctly, outer join better here. select social_members.* , social_mcouple.* social_members left outer join social_mcouple on social_members.m_id=social_mcouple.c_id m_id='".$_session['userid']."' this retrieve rows each member, , corresponding rows social_mcouple . if there no corresponding rows in social_mcouple table, social_mcouple.* rows in result null. depending upon exact needs, , relationship between 2 tables, may better running 2 queries, 1 retrieve matching rows social_members, , other retrieve rows social_mcouple. whether take outer join or 2 separate queries depend...

Correct Exceptions in C++ -

i learning how handle errors in c++ code. wrote example looks text file called file, , if not found throw exception. #include <iostream> #include <fstream> using namespace std; int main() { int array[90]; try { ifstream file; file.open("somefile.txt"); if(!file.good()) throw 56; } catch(int e) { cout<<"error number "<<e<<endl; } return 0; } now have 2 questions. first know if using exceptions correctly. second, (assuming first true) benefit using them vs if else statement? "correctly" value judgment, (unlike other classes) there's major benefit exceptions classes being monolithic hierarchy, i'd advise throwing derived std::exception , not int. second, it's open question whether incorrect file name sufficiently unexpected qualify reason throw exception @ all. as benefits vs. if/else statement: there couple. first, exceptions let segregate code deals errors, main idea , read...

php - Magento add a column to backend newsletter gridview -

in magento system, added columns subscriber_firstname , subscriber_lastname newsletter_subscriber db table. in admin area of magento, want newsletter>newsletter subscribers grid table show: customer first name if exists, otherwise show newsletter_subscriber.subscriber_firstname if exists, otherwise show nothing customer last name if exists, otherwise show newsletter_subscriber.subscriber_lastname if exists, otherwise show nothing which magento files need edit make work? how go editing files make work? app/code/core/mage/adminhtml/block/newsletter/subscriber/grid.php you'll want condition based off if subscriber_firstname or subscriber_lastname have values or not: $this->addcolumn('subscribername', array( 'header' => mage::helper('newsletter')->__('subscriber first name'), 'index' => 'subscriber_firstname', 'default' => '----' ...

ruby on rails - How are SaaS applications organized? -

consider web (mvc, example rails) application multiple clients service. how design this? one application instance per client? (+ 1 database per client) one instance clients (+ 1 database clients) former 1 simple, but... "inefficient". how latter? (best practices, design patterns) how separate client data? example: worker "a" of client "1" has 2 documents, worker "b" of client "2" has 3 documents. how build model associations protect other users (and clients) data? think joining every query client model not solution. i suggest having @ earlier response on multi-tenant apps in ruby on rails . it depends on use case, simplest way handle single database scoping particular applications. can head there depending on requirements/budget. i big fan of postgresql schema system detailed in link :p

Websphere application server network deployment trial for Windows XP platform -

i not locate link downloading trial edition of "websphere application server network deployment windows xp platform". either 6.x version or 7.x version? need urgent self-learning purpose. the link find :- http://www.ibm.com/developerworks/downloads/ws/wasnd/?s_tact=105agx28&s_cmp=trials it seems support linux. any pointers highly appreciated. if has local copy, please share. i have kept question long provide inputs. of above responses. guess have wait licensed version of nd 6.x/7.x going. should available once project started. all. you looking websphere application server developers . use link under previous versions on page download 7.0 or 6.1.

sql - How to use like in stored procedure with int parameter? -

i 've used query builder tool of visual studio 2008 build stored procedure. preview script: if exists (select * sysobjects name = 'selectquery' , user_name(uid) = 'dbo') drop procedure dbo.selectquery go create procedure dbo.selectquery ( @studentid int ) set nocount on; select studentid, studentname, studentphone, studentaddress, studentbirthday, studentdescription, studentstatus tbl_student (studentid '%' + @studentid + '%') go but when tried execute it, got error: error message: conversion fail when converting value '%' datatype int. please me! you want find rows @studentid substring of studentid ? if so where studentid '%' + cast(@studentid varchar(10)) + '%' should work.

MySQL table export to HTML -

i've got little problem exporting mysql data html. problem in 1 field have values this: <a href="http://google.com">google</a> , when export table in html format generated html table fields contains: &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt; not valid html link. there way export table without mysql convert < , > chars? im not using code. use mysql command: mysql -h "select ...." , specify output file. thanks! when export table in html format generated html table fields contains: &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt; that's weird, don't behaviour (in 5.1.34): $ mysql -h -e "select 'a&b<c>d'"; <table border=1><tr><th>a&b<c>d</th></tr><tr><td>a&b<c>d</td></tr></table> and want behaviour quote escaping! can see exampl...

java - Which variables can be accessed with the ${...} syntax in a Struts tag in a JSP page? -

i'm getting little bit frustrated since can't find out variables can access ${...} syntax in struts tag, placed in jsp page. as example i've got following code: <c:set target="${status.menue}" property="activemenuepath" value="whatever" /> where object "status.menue" have defined in order can accessed dollar sign , braces. defined in struts tile or in form? it should placed in of page, request, session or application scopes using respectively jspcontext#setattribute() , servletrequest#setattribute() , httpsession#setattribute() or servletcontext#setattribute() . either directly or indirectly inside servlet. mvc frameworks indirectly, configureable giving model object "request", "session" or "application" scope. the expression language (el) access them using jspcontext#findattribute() . this way unrelated struts. it's legacy mvc framework built on top of jsp/servlet api...

c++ - List - Strings - Textfiles -

i've got few questions concerning text files,list , strings. i wonder if possible put in code reads text in textfile,and using "string line;" or else define each new row of text , turn of them 1 list. can sort rows, remove row or 2 or of them or search through text specific row. in c++, you'd typically std::vector: std::vector<std::string> data; std::string temp; while (std::getline(infile, temp)) data.push_back(temp); sorting them like: std::sort(data.begin(), data.end()); deleting row n like: data.erase(data.begin() + n);

zend framework - zendX Jquery - Plugin by name was not found in the registry -

i've followed tutorial on zendcast creating autocomplete ajax: http://www.zendcasts.com/autocomplete-control-with-zendx_jquery/2010/07/ i "plugin name 'autocompleteelement' not found in registry" which must code have in indexaction ` $this->view->autocompleteelement = new zendx_jquery_form_element_autocomplete('ac'); $this->view->autocompleteelement->setlabel('autocomplete'); $this->view->autocompleteelement->setjqueryparam('source','index/results'); ` does know should looking resolve this? solved it, wasn't calling correctly in index.phtml :/

Rails double nested routes, broken up -

i have these routes: map.resources :categories |category| category.resources :sub_categories end map.resources :sub_categories |sub_category| sub_category.resources :events end this url doesnt have doubly nested, want keep url max of 2 objects deep. the problem events, i want require there /sub_categories/:sub_category_id path_prefix , using map.resources :events, path_prefix => '/sub_categories/:sub_category_id' gives me routes event_path what want have is sub_category_event_path because time user wants *sub_category*, want url require *category_id* provided, if user wants see event, sub_category_id must provided. you're right, generate event_path , event_path require :sub_category_id option. sub_category_event_path helper, write one: class applicationcontroller < actioncontroller::base private def sub_category_event_path(sub_category, event) event_path(event, :sub_category_id => sub_category) ...

Help with my PHP template class -

i want separate output of html program code in projects, wrote simple database class. <?php class template { private $template; function load($filepath) { if(!$this->template = file_get_contents($filepath)) $this->error('error: failed open <strong>' . $filepath . '</strong>'); } function replace($var, $content) { $this->template = str_replace("{$var}", $content, $this->template); } function display() { echo $this->template; } function error($errormessage) { die('die() template class: <strong>' . $errormessage . '</strong>'); } } ?> the thing need display() method. example use code: $tplobj = new template(); $tplobj->load('index.php'); $tplobj->replace('{title}', 'homepage'); $tplobj->display(); and index.php file this: <html> <head> ...

php - POST parameters to PHPUnit test -

i'm new on testing, i'm using phpunit write test. site has been designed using mvc pattern. i test each method on controllers, problem such methods receives parameters though $_post variable. how can overwrite variable? thanks in advance alejandra the best approach abstract request separate class , not access superglobals @ all. way decouple actual server , request environment application. can mock request easily.

java - Canvas in JScrollPane only repaints when a scrollbar is at most extreme point -

i'm working on game project myself improve java skills , today i've hit problem cannot seem solve aid of internet. of problem has been solved last little bit still remains defiant! i've got object extends canvas , creates map want display. i've added canvas jpanel, added viewport of jscrollpane (which added jframe of game). changelistener added jscrollpane's viewport, perform validate method on jframe , repaint method on viewport. jframe has jmenubar, in menu structure there 'new game' option (among other not yet implemented jmenuitems) create new canvas object , replaces old 1 , validates (using validate methods) repaints jscrollpane. the result when press new game jmenuitem, new map drawn out in scollpane. displays map (the canvas object) correctly, scollbars showing up. menu on top of canvas , scrollpane, correct. when change position of scollbar (horizontal or vertical, using bar or buttons in bar) results in canvas object being translated acr...

.net 4.0 - Can I Populate a Databound DataGrid with bogus empty rows in a WPF Application? -

i wondering if there cohesive trick populate datagrid in wpf application empty rows user can leave rows empty , fill others following them?? datagrid databound collectionviewsource create dummy rows in source collection referenced collectionviewsource.

android - Saving cursor state with activity instance? -

i've got android app pulls random 20 questions (rows) cursor sqlite db , loops through questions ask user 20 questions. is there way save cursor's state/location when activity paused or stopped when activity resumes cursor restored , in same position when activity paused/stopped? if need me post code ask. thanks time! getting save position @ easy, put code in onpause method so: protected void onpause(){ position = yourcursor.getposition(); super.onpause(); } where position class field (i.e. declared outside of method, @ top). in onresume can move cursor position. if aren't familiar onpause()/onresume(), read on activity lifecycle . however, suspect want save questions randomly selected well. don't think cursor persist across onpause/onresume since they're closed in onpause avoid memory issues. thing can think of, i'm no expert, you'd have save rowids of questions , requery database rows. how clumsy solution depends on how query rando...

visual studio 2010 - Multi targeting hell and changing project defaults -

ok. going little crazy today wpf project. i'm using vs2010 .net 4.0 , added simple reference project in solution, added member variable of 1 of referenced types , tried compile. nothing. well, something. did not recognize type @ all. i verified @ namespace using statement. intellisense seemed it. in fact, visual studio content let me browse class via go definition function. some of reading know is, thought going crazy. the wpf project defaults client profile, while other projects targeting full .net 4.0. had warnings turned off (stupid), wasn't seeing warning message client profile mismatch. does else think it's stupid have wpf projects default client profile targeting, while rest of projects default targeting full .net 4.0? ...which leads me question. possible change default, scenario doesn't happen again? target 1 platform or other. many project types in vs2010 target client profile. ms making bigger push time around 4.0 client prof...

MySQL Query Optimization -

i have web application use similar table scheme below. want optimize selection of articles. articles selected based on tag given. example, if tag 'iphone' , query should output open articles 'iphone' last month. create table `article` ( `id` int(11) not null auto_increment, `title` varchar(100) not null, `body` varchar(200) not null, `date` timestamp not null default current_timestamp, `author_id` int(11) not null, `section` varchar(30) not null, `status` int(1) not null, primary key (`id`) ) engine=myisam default charset=utf8 auto_increment=1 ; create table `tags` ( `name` varchar(30) not null, `article_id` int(11) not null, primary key (`name`,`article_id`) ) engine=myisam default charset=utf8; create table `users` ( `id` int(11) not null auto_increment, `username` varchar(30) not null, primary key (`id`) ) engine=myisam default charset=utf8 auto_increment=3 ; the following mysql query explain select article.id,users.username,article.title ...

sql - Update field with data from another database -

need update field data field in different database i have 2 sql commercial databases same company, first database has 1 field null in other i need update field/database null data of first one. ms sql server update table1 in current database table1 in database called "databasename" update table1 set col2 = t2.col2 databasename.dbo.table1 t2 table1.id = t2.id , table1.col2 null

Http 204 error in REST web service (Jersey) -

i using jersey/java develop rest services. need return xml representation carstore : @xmlrootelement public class carstore { private list<car> cars; public list<car> getcars() { return cars; } public void setcars(list<car> cars) { this.cars = cars; } here car object : @xmlrootelement > public class car { private string carname; private specs carspecs; private category carcategory; public string getcarname() { return carname; } public void setcarname(string carname) { this.carname = carname; } public specs getcarspecs() { return carspecs; } public void setcarspecs(specs carspecs) { this.carspecs = carspecs; } public category getcarcategory() { return carcategory; } public void setcarcategory(category carcategory) { this.carcategory = carcategory; } } specs , category enums : @xmlrootelement > public enum category { sedans, compacts, wagons, hatch_hybrids, suvs, convertibles, comparable; } my resource cl...

visual studio - VS2010 and Windows XP SP3 -

at home i've been running vs 2010 on windows 7 x64 machine without issues, @ work switched on vs 2010 running on winxp sp3 x86 - , gotta say, experience terrible. there severe graphical glitches. ex, intellisense doesn't quite work. can start typing , intellisense dropdown window seems working, text i'm typing vanishes. can't see until hit escape key or refresh window say, alt-tabbing application , again vs2010 if cut/copy/paste , move cursor around scrolling or using arrow keys, different parts of text window don't update properly. can see patches of different piece of code shouldn't be. other team members facing similar issues well. there patch should install? have installed uia 3 patch scottgu mentioned in blog. any appreciated. -thanks! try disabling hardware rendering (if enabled): uncheck tools->options->environment->general->enable rich client visual experience . may need uncheck tools->options->environment-...

operators - C# XOR on two byte variables will not compile without a cast -

this question has answer here: byte + byte = int… why? 15 answers why following raise compile time error: 'cannot implicitly convert type 'int' 'byte': byte = 25; byte b = 60; byte c = ^ b; this make sense if using arithmentic operator because result of + b larger can stored in single byte. however applying xor operator pointless. xor here bitwise operation can never overflow byte. using cast around both operands works: byte c = (byte)(a ^ b); i can't give rationale, can tell why compiler has behavior stand point of rules compiler has follow (which might not you're interesting in knowing). from old copy of c# spec (i should download newer version), emphasis added: 14.2.6.2 binary numeric promotions clause informative. binary numeric promotion occurs operands of predefined + , ? , ...

jquery - When I hide a textbox in a Table, is it expected that the table reformats the space? -

i have input type=text in table (in td actually) when user clicks checkbox, input hidden jquery (via hide method) makes style of input "display:none;" so far good. now, when has happened, row cell in shrunk (the height lowered) because thing left in row <span> , height lower input height. net result of row gets smaller, , when click checkbox again input re-appears , row gets larger. that doesn't nice, wondered if there way prevent this? and second: way should work (the table resizing)? try setting visibility :hidden instead of hide() , doesn't remove element document flow. $(' ... ').css('visibility', 'hidden');

ASP.NET: Thread-safety in a file-based database -

i have worked bit asp.net before. using ms sql server store , retrieve data display in dynamic pages in 1 project started learn asp.net bit. start new project time store data in file-based database , say, access file. project hobby project , i'm not afraid of scaling problem because perhaps 3 users using application @ same time , no data traffic expected. now , question: using ms sql database there no problem several users reading-writing db @ same time because db engine take care of this, using file-based database ado.net problem in case, right? what mean, need take care of multiuser synchronization myself (using synchronization mechanism, lock, mutex, whatever) guarantee thread safety when working database or ado.net takes care of well? should use perhaps singleton class data layer? as fretje mentioned, ms access isn't db use web applications. assuming know there isn't special need in order use access db ado.net (other using right provider of course). ...

c# - Reading from the Registry in ASP.NET -

i have library ( dll ) has method following: var masterkey = registry. localmachine. opensubkey("software\\microsoft\\dynamics\\5.0\\"); when running method in winforms applicaiton, masterkey not null , when running in asp.net masterkey null ! i've checked executing user windowsidentity.getcurrent().name , same user executing both applications. asp.net application executed in visual studio ( debug: f5 ) , winforms application. how come cannot read key in asp.net? edit i've set permissions none ever , gives me "access denied". , when add group users null . mean can fold strucutre , see it's there, cannot access keys/entried. i connected domain, shouldn't affect local instances of iis, should it? try granting network service http://msdn.microsoft.com/en-us/library/ms998320.aspx the network service account not have write access registry. if application needs write registry, must configure necessa...

Trying to find a good picture/diagram of SQL Server security: logins, roles, etc -

and failing miserably. i trying explain , thought it'd easier nice diagram. why bother drawing 1 when have web? alas, couldn't find clear enough. if have link shows boundaries/relationships of how works, i'd grateful thanks! is you're looking for? diagram http://i.msdn.microsoft.com/dynimg/ic169620.gif http://msdn.microsoft.com/en-us/library/ms191465(v=sql.90).aspx that article available sql server 2005/2008/2008r2/denali. i tried posting image directly, rep isn't there yet. :-)

upload - How can I check the MIME type of an uploaded file using Perl CGI? -

i'm trying mime type of <input type="file" /> element using perl, without examining contents of file itself, in other words, using http headers. i have been able "multipart/form-type" content-type value, understanding each element own mime type? how can see sub-mime types using perl? i assume using cgi.pm this. if using oo interface cgi can this. use strict; use warnings; use cgi; $cgi = cgi->new; $filename = $cgi->param('upload_param_name'); $mimetype = $cgi->uploadinfo($filename)->{'content-type'}; if using procedural interface, equivalent be: use strict; use warnings; use cgi qw/param uploadinfo/; $filename = param('upload_param_name'); $mimetype = uploadinfo($filename)->{'content-type'};

JavaScript: replace last occurrence of text in a string -

see code snippet below: var list = ['one', 'two', 'three', 'four']; var str = 'one two, 1 three, 1 four, one'; ( var = 0; < list.length; i++) { if (str.endswith(list[i]) { str = str.replace(list[i], 'finish') } } i want replace last occurrence of word 1 word finish in string, have not work because replace method replace first occurrence of it. know how can amend snippet replaces last instance of 'one' well, if string ends pattern, this: str = str.replace(new regexp(list[i] + '$'), 'finish');

php - How to make pop up blockers allow your popup windows? -

how make pop blockers allow popup windows? in general, popping them within event handler of user-generated event. instance, if have link , user explicitly clicks , raise popup onclick handler on link, popup blockers allow popup because of user's explicit action. in contrast, popups window.load event, or code executing result of settimeout or setinterval call, typically suppressed. somewhat ot, but: if can avoid using pop-up, would. i'd (unscientifically) 95-99% or of use-cases people think need pop-up, there's better design solution. answer above there 1-5% situations. :-)

Passing functions as arguments in Matlab -

i'm trying write function gets 2 arrays , name of function arguments. e.g. main.m: x=[0 0.2 0.4 0.6 0.8 1.0]; y=[0 0.2 0.4 0.6 0.8 1.0]; func2(x,y,'func2eq') func 2.m : function t =func2(x, y, z, 'func') //"unexpected matlab expression" error message here t= func(x,y,z); func2eq.m: function z= func2eq(x,y) z= x + sin(pi * x)* exp(y); matlab tells gives me above error message. i've never passed function name argument before. going wrong? you use function handles rather strings, so: main.m : ... func2(x, y, @func2eq); % "@" operator creates "function handle" this simplifies func2.m : function t = func2(x, y, fcnhandle) t = fcnhandle(x, y); end for more info, see documentation on function handles

ruby - functional test for rails controller private method -

i have private method in controller. used database update. method calling controller method. , works fine. but when trying write test case method tripping on accessing (session variable , params) in functional other methods working fine problem private method? in setup method in functional test, setting session also.? you should avoid testing private methods. "goal" behind having public/private/protected methods encapsulate logic , make easy change parts of code without having worry how 1 function or class interacts another. that being said, if still feel need test private methods, there work arounds. found utility function via jay field's blog : class class def publicize_methods saved_private_instance_methods = self.private_instance_methods self.class_eval { public *saved_private_instance_methods } yield self.class_eval { private *saved_private_instance_methods } end end check link usage details, seems quick , simple way you...

asmx - call web methods directly from other project -

i working .net solution project , there couple projects in side of solution. 1 of projects has asmx file. now, question is possible call web methods in asmx file directly other projects in same solution instead of adding web reference of it? thanks. asmx files placed in asp.net projects not suitable referenced other projects. reason recommend refactoring functionality class library referenced web service , other projects directly call methods: var result = new someclass().somemethod(); and in web service: [webmethod] public string somemethod() { return new someclass().somemethod(); }

php - Passing NULL values into mysql Stored procedure -

i trying pass few null values stroed procedure php retains varaibles empty strings '' , not null. my db insert function looks this. (i using framework , adodb if looks weird thats why). function insert_emp($f_name, $last_name, $dob) { if(!isset($dob)){ $dob = null; } $this->db->setconnection("call insert_emp('$f_name', '$l_name', '$dob')"); } i have ensured $dob being passed empty string ''. reason when calls stored proc not changed null. dob datetime field , mysql complains can not enter empty string datetime. if hard code insert such this $this->db->setconnection("call insert_emp('test1', 'test2', 'null')"); it work. help. null cannot represented string. should use string literal null. function insert_emp($f_name, $last_name, $dob = 'null') { $this->db->setconnection("call insert_emp('$f_name', '$l_name', ...

Mariadb init script -

i installed mariadb form sources on debian. used init script mysql.server. i have error when run : starting mysql .manager of pid-file quit without updating file. ... failed! there no mysqld.pid anywhere, there no mysqld executed. .err file : 110209 17:04:55 mysqld_safe starting mysqld daemon databases /var/lib/mysql 110209 17:04:55 [error] can't find messagefile '/usr/share/mysql/english/errmsg.sys' 110209 17:04:55 [error] can't open mysql.plugin table. please run mysql_upgrade create it. 110209 17:04:55 [note] primebase xt (pbxt) engine 1.0.11-7 pre-ga loaded... 110209 17:04:55 [note] paul mccullagh, primebase technologies gmbh, http://www.primebase.org innodb: innodb memory heap disabled innodb: mutexes , rw_locks use gcc atomic builtins innodb: compressed tables use zlib 1.2.3.4 110209 17:04:55 innodb: highest supported file format barracuda. 110209 17:04:55 percona xtradb (http://www.percona.com) 1.0.13-11.6 started; log sequence number 453...

Project Implementation estimates with TDD -

are there guidelines when quoting estimates projects/tasks involving tdd? for example, when compared normal development of task taking 1 day complete, how more should tdd driven task take? 50% more time or 70% more time? there statistics available, assuming developer versed language , test framework? the difference high @ first, decreases experience, factor the difference in implementation time between conventional coding , tdd decline developer becomes better @ tdd. tdd beginners, , intermediates, caught-up deciding tests write and/or write more tests end being thrown out after refactoring. experience, tdd'er become more efficient, become better , quicker @ choosing tests write i'm not sure absolute lower limit of ratio of conventional tdd is. i'd guess 1:1.5, can't believe developers can ever test-drive code fast write code, less write code write tests. and others have said, significant payoff time spent doing tdd debugging time vastly reduced tes...

Debug memory wrapping code from Writing Solid Code, or similar alternatives for C/C++ available to download? -

i'm reading "writing solid code" , stuff wrapping memory functions catch bugs , track memory leaks etc. provided in appendix b there's lot type in. know if code available somewhere download? or if there similar code source same thing available somewhere download? i'm interested in both c , c++ versions. thanks rather filling program debugging wrappers, use existing tool memory debugging. valgrind best there is.

flash - Good Actionscript or Flex website? -

just wondering if know flex tutorial website besides adobe. appreciate helps. tour de flex first steps in flex screencasts

iphone - Adding Info Button to UITabBarController's More Screen -

i'm trying add info button more screen uitabbarcontroller generates when have more 5 tabs. code i'm using this: // add info button more controller uibutton *infobutton = [uibutton buttonwithtype:uibuttontypeinfolight]; uibarbuttonitem *infobarbutton = [[[uibarbuttonitem alloc] initwithcustomview:infobutton] autorelease]; tabbarcontroller.morenavigationcontroller.navigationitem.leftbarbuttonitem = infobarbutton; this sort of thing seems work fine other uiviewcontrollers, in case, code builds , runs fine, button never appears. any idea might need changing work? aha! needed access first item in morenavigationcontroller stack, rather morenavigationcontroller itself. tabbarcontroller.morenavigationcontroller.topviewcontroller.navigationitem.leftbarbuttonitem = infobarbutton;

Git - Is there a way to view the number of lines committed by Author? -

does know of command or script output each author has committed project followed number of lines have contributed. e.g. similar following: author insertions deletions bob dole 1240 409 sarah j 481 140 jim helper 388 23 cheers, ben git shortlog -sne

php - spawn an entirely separate process in linux via bash -

i need have script execute (bash or perl or php, do) command , exit, while other command still runs , exits on own. schedule via @ command, curious if there easier way. #!/bin/sh your_cmd & echo "started your_cmd, exiting!" similar constructs exists perl , php, in sh/bash easy run command in background , proceed. edit a source generic process manipulation start scripts under /etc/init.d . sorts of neat tricks such keep track of pids, executing basic start/stop/restart commands etc.

java - Setting a value into a object using reflection -

i have object has lot of attributes , each 1 it's getter , setter. each attribute has non primitive type, don't know @ runtime. for example, have this: public class a{ private typea attr1; private typeb attr2; public typea getattr1(){ return attr1; } public typeb getattr2(){ return attr2; } public void setattr1(typea at){ attr1 = at; } public void setattr2(typeb at){ attr2 = at; } } public class typea{ public typea(){ // doesn't matter } } public class typeb{ public typeb(){ // doesn't matter } } so, using reflection, obtained setter method attribute. setting value in standard way this: a test = new a(); a.setattr1(new typea()); but how can using reflection? got setattr1() method using reflection, don't know how create new typea object inserted in setter. use class#newinstance() . class<typea> cls = typea.class; typea typea = cls.newinstance(); or, in specific case when h...

wpf - PropertyChanged Event of ViewModel in ObservableCollection -

i have observable collection of viewmodel objects. how can subscribe property changed event of each view model in collection created , track ones have been changed, can updated them database. i believe code below serves example of how solve problem. in example mycollection property viewmodel objects. viewmodel implements inotifypropertychanged interface. private void addcollectionlistener() { if (mycollection != null) { mycollection.collectionchanged += new system.collections.specialized.notifycollectionchangedeventhandler(mycollection_collectionchanged); } } void mycollection_collectionchanged(object sender, system.collections.specialized.notifycollectionchangedeventargs e) { // remove listeners each item has been removed foreach (object olditem in e.olditems) { viewmodel viewmodel = olditem viewmodel; if (viewmodel != null) { ...

php - Using mod_rewrite to convert paths with hash characters into query strings -

i have php project need send hash character (#) within path of url. ( http://www.example.com/parameter#23/parameter#67/index.php ) thought urlencode allow that, converting hash %23 but see urlencoded hash forces browser treat right url fragment (or query). is there way pass hash through, or need character substitution prior urlencode? edit add (sep 19 2017): it turns out asking wrong question. issue wasn't using hash character within path (encoding work), in using mod_rewrite convert on query string. had failed re-encode within rewriterule. i'll edit title match. here rewrite rule using: rewriteengine on # convert path strings query strings rewriterule "^(.*)/(.*)/hashtags.php" /hashtags.php?parameter_1=$1&amp;parameter_2=$2 [qsa,l] as added b tag, worked correctly: rewriteengine on # convert path strings query strings rewriterule "^(.*)/(.*)/hashtags.php" /hashtags.php?parameter_1=$1&amp;parameter_2=$2 [qsa,l,b] ...

asp.net - How do I access a module or a public class with public shared members from inline vb code <% .. %> -

i can access module code behind not aspx page in inline vb code <% ... %>. i know got simple can't seem find answer anywhere. if want run static method aspx can this: <% mynamespace.myclass.mymethod() %> if want instancate object , call method on can well: <% dim obj mynamespace.myclass obj = new mynamespace.myclass() obj.mymethod() %>

caching - How to use multiget with memcache in PHP -

just title, how multiget memcache like? is correct way of utilizing multiget? : $memcache_obj = new memcache; $memcache_obj->connect('memcache_host', 11211); $var = $memcache_obj->get(array('some_key', 'second_key')); thanks update: looking same, check out addition well: http://www.craigiam.com/blog/19/memcached-multiget-using-php-pecl-memcache-class big pascal_martin solving issue! considering memcache::get accepts, first parameter, either 1 key, or array of keys, i'd ;-) quoting : you can pass array of keys memcache::get() array of values. the result array contain found key-value pairs.

asp.net - Thoughts on streamlining multiple .Net apps -

we have series of asp.net applications have been written on course of 8 years. in first 3-4 years. have been running quite little maintenance, new functionality being requested , running ide , platform issues. apps written in .net 1.x , 2.x , run in separate spaces presented single suite of applications use common navigation toolbar (implemented user control). every time want add menu in nav have modify in apps pain. also, various versions of crystal reports , used tables organize visual elements , end mess, multi-platform .net versions running. need streamline suite of apps , make easier add on new apps without hassle. need bring these apps under 1 .net platform , ide. in addition, there wordpress blog styled match style of application suite "integrated" ui , link mediawiki wiki application well. my current thinking use open source content management system (cms) joomla (php based unfortunately, works well) user interface framework style templating , menu man...

Java PDF manipulation and rendering -

i hoping question become comprehensive guide pdf manipulation , rendering in java. have comprehensive implementation stitching multiple open source libraries, improve upon it. background my requirements , current implementation: checking existing pdf documents specific conditions (pdf version, password protection, font embedding, cross reference tables etc.) - not implemented. allow definition of acroform fields via page co-ordinates or other mechanism. - not implemented provide capability iterate on form fields in pdf, examine field type , fill data - itext v 2.0.8 render pdf image @ different resolutions/dpi - 2 implementations (pdfrenderer , icepdf ) render html/xhtml files pdf - flying saucer xhtmlrenderer do above library in java server environment (implying thread safety) what not like i dissatisfied following: itext licensing : new versions of itext under agpl license non-starter project (and commercial projects in general?). fee commercial license non-...

Android: How to open an email received on a mail account? -

android: programmatically - how open email received on mail account (for example, gmail). in blackberry, there viewlistener interface, has open() , close() methods. there similar interface in android well. please advise. this not possible on android -- sorry!

Add Sound to Flash-Like Button With jQuery -

i have made flashlike button jquery via code: $(document).ready(function() { $('#navigation li a').append('<span class="hover"></span>').each(function () { var $span = $('span.hover', this).css('opacity', 0); $(this).hover(function () { $span.stop().fadeto(500, 1); }, function () { $span.stop().fadeto(500, 0); }); }); }); but can add sound button in hover flash buttons? in advance have @ jquery sound plugin here: http://dev.jquery.com/browser/trunk/plugins/sound/jquery.sound.js?rev=5750

c# - Excel interop writes excel files that contain "empty" cells -

i have c# tool creates excel worksheets, later read in again tool. done using excel interop. when reading generated excel file, exception stating: oledbexception: many fields defined. it means file cannot read in because there amny columns, there should not be, real content takes 90 columns. workaround deleted other columns manually in excel, , tried again read in. works expected, means generated excel contain nonempty cells (which shown empty cells in excel...) is there way tell inerop not create empty cells, or there reason should check? many tom ps: experiencing problem 2003 interop libraries, while i've got office 2007 installed. i've found solution: tool copying ranges 1 sheet another. the source range defined: getrange(fromworkbookname, fromsheetname, a1, v20); the destination cell hoever adressed by: getrange(toworkbookname, tosheetname, a1).entirerow; in 2003 interop, seemed no problem. when doing towards xslx file office 2010, "empty...

javascript - jQuery Toggle on mouseup -

i have following jquery: $('#account-menu').hide(); $("#account-link").click(function(e) { e.preventdefault(); $("#account-menu").toggle(); $("#account-link").toggleclass("selected"); }); what want check if user clicks anywhere else onscreen whilst account menu shown not within account menu itself, , if hide menu. can help? thanks edit: had go @ doing myself so: $('#account-menu').hide(); $("#account-link").click(function(e) { e.preventdefault(); $("#account-menu").toggle('fast'); $("#account-link").toggleclass("selected"); }); $(document).mouseup(function(e) { var $targ = $(e.target); // if link or box, exit if ($targ.is('#account-link') || $targ.is('#account-menu')) return; // if have parent either, exit if ($targ.closest('#account-link, #account-menu...

emacs - Change font for the file -

i have line in .emacs set default font: (set-default-font "monaco-10") it works fine me, need 2 exceptions: i need change default font 1 file, example ~/some. how can it? i need change default fonr gnux (m-x gnus). how can achieve it? take @ variable `face-remapping-alist' . example, can have this: (add-hook 'find-file-hook (lambda () (if (equal "~/some" (abbreviate-file-name (buffer-file-name))) (set (make-local-variable 'face-remapping-alist) '((default :family "dejavu serif"))))))

CSS Jquery - When I change background color the text becomes fuzzy in IE6? -

i playing around script of auto scrolling text. can check out code here: http://jqueryfordesigners.com/simple-jquery-spy-effect/ then changed background color white - , text started looking fuzzy , messed - if change light color - appears messy. this portion changed background color in code: #sidebar { color: grey; background: #fff; float:left; margin:0 0 24px; padding:15px 10px 10px; width:500px; } i have noticed in 1 other site on ie7. idea why simple change in background color messes text. i used ie tested test on ie6 browser http://www.my-debugbar.com/wiki/ietester/homepage thanks are you're not using ie css filters in element further tree, such alpha transparency? can make text blurry/fuzzy when cleartype (font smoothing on lcd monitors) enabled, bolded text, so cleartype disabled elements use css filters in ie7+. see http://blogs.msdn.com/ie/archive/2006/08/31/730887.aspx edit: here's example of remove filter after...

objective c - Is there any way to control settings inside iphone app rather than settings outside the app? -

is there way control settings inside iphone app rather settings outside app? and i not find kind of item add plist in settings.bundle in order change font type example; times new roman calibri i searched other references people gave me 1 day ago not find point makes subject clear. yes, have build own ui if want let users edit them.

java - Convert a ResultSet String Into a Workable Variable to Populate a jTable -

i'm building application needs convert resultset string( rs.getstring(names); ) workable variable populate jtable , 1 collumn, rest think try doing loop. how this? hi,i assume trying display values in jtable, if case. why cant results list resultset , iterate , display in jtable. how can store data database list , same list can sent jtable try { con = ora.createconnection(); if (con != null) { pstmt = con.preparestatement(strquery.tostring()); rs = pstmt.executequery(); while (rs.next()) { khatachallanheader.setchallanno(integer.valueof(rs .getint("challan_no"))); khatachallanheader.setpropertyid(long.valueof(rs .getlong("property_id"))); khatachallanheader .setdivisionname(rs.getstring("div_name")); ...

session - Sharing $_SESSION variables across subdomains using PHP -

i trying share contents of session variable across 2 subdomains reason not working. the sessionid same on both subdomains variables aren't available. i can achieve cookies , working rather use values in session. here how i'm setting domain session: thanks, scott update sorry should have said, using following: ini_set('session.cookie_domain', substr($_server['server_name'],strpos($_server['server_name'],"."),100)); if(session_id ==''){session_start();} you looking function: session_set_cookie_params() . have 2 domains: site1.example.com site2.example.com in order share session data across both domains, call following functiontion before session_start() : session_set_cookie_params(0, '/', '.example.com'); (edit: indeed forgot dot in example code)

django - BaseInlineFormSet does not clean invalid characters -

i trying clean inline formset data. have 3 rules: 1) must supply @ least 1 name, 2) if specify name must specify both first , last, , 3) no spaces. when data saves, spaces still saved database. doing wrong? another issue validation errors not displayed. why that? forms.py: class usernameform(forms.models.baseinlineformset): def clean(self): super(usernameform, self).clean() count = 0 form in self.forms: try: firstname = form.cleaned_data.get("name_first") middlename = form.cleaned_data.get("name_middle") lastname = form.cleaned_data.get("name_last") if firstname or middlename or lastname: if len(firstname) == 0 or len(lastname) == 0: raise forms.validationerror("first , last name required.") if form.cleaned_data , not form.cleaned_data.get('delete', false): ...

c - Is it possible to avoid global variables in a strictly procedural program? -

being developer born , raised on oo, curious hear how it's possible avoid global state in procedural program. you can write object-oriented code in c. don't c++ goodies , it's ugly, , have manually pass pointer (i've seen self used this, in order make compatible c++), works. technically, don't need global state in pure procedural languages same reasons don't need in object-oriented languages. have pass state around explicitly, rather implicitly in oo languages.

How to write UPDATE SQL with Table alias in SQL Server 2008? -

i have basic update sql - update hold_table q set q.title = 'test' q.id = 101; this query runs fine in oracle, derby, my-sql - fails in sql server 2008 following error: "msg 102, level 15, state 1, line 1 incorrect syntax near 'q'." if remove occurrences of alias, "q" sql works. but need use alias. the syntax using alias in update statement on sql server follows: update q set q.title = 'test' hold_table q q.id = 101; the alias should not necessary here though.

Duplicate Column Values MySQL -

is there way can duplicate column's values column? ie: s_id img_id 1 - 2 - 3 - 4 - to s_id img_id 1 1 2 2 3 3 4 4 update your_table set img_id = s_id;

Rails controllers not working -

i've started on rails, got setup on dreamhost account passenger, except demo controller i've created isn't working. ran: $ script/generate controller demo index the files there, when go http://rails.mysite.com/demo/index 'we're sorry, went wrong' message. there's nothing in log files @ all, i'm in development mode. any appreciated, thanks! darren. you may not have initialized database yet, in case rails stack doesn't finish booting properly. if can run script/console, you're half-way there. if can't, may give hint what's wrong. generally database.yml file contains configuration sqlite3, may not available on platform. it's pretty easy switch on mysql or postgres, whatever you're using.

php array help - how to place this array inside another array? -

i have array 3 main keys. images, downloads , videos. here's dump example: array(3) { ["images"]=> array(1) { [0]=> array(3) { ["cod_teamfk"]=> string(2) "51" ["attachement"]=> string(22) "210111011642_51_57.jpg" ["bonus"]=> string(1) "0" } } ["downloads"]=> array(1) { [0]=> array(3) { ["cod_teamfk"]=> string(2) "51" ["attachement"]=> string(22) "210111011732_51_23.zip" ["bonus"]=> string(1) "0" } } ["videos"]=> array(1) { [0]=> array(1) { ["youtube"]=> array(1) { [0]=> string(150) "object video" } } } in order produce i've used methods here: function splitproof($proof) { $arr = array(); ...

python - 2D list has weird behavor when trying to modify a single value -

possible duplicate: unexpected feature in python list of lists so relatively new python , having trouble working 2d lists. here's code: data = [[none]*5]*5 data[0][0] = 'cell a1' print data and here output (formatted readability): [['cell a1', none, none, none, none], ['cell a1', none, none, none, none], ['cell a1', none, none, none, none], ['cell a1', none, none, none, none], ['cell a1', none, none, none, none]] why every row assigned value? this makes list 5 references same list: data = [[none]*5]*5 use instead creates 5 separate lists: >>> data = [[none]*5 _ in range(5)] now expect: >>> data[0][0] = 'cell a1' >>> print data [['cell a1', none, none, none, none], [none, none, none, none, none], [none, none, none, none, none], [none, none, none, none, none], [none, none, none, none, none]]