Posts

Showing posts from January, 2012

tortoisesvn - How to transfer source code from one svn server to another? -

we have old svn server has solutions plus web site phase 2_a1821 source code need source code moved new svn server? possible? if yes pls tell me steps follow. regards zuhaib i'd suggest using svndump: svnadmin dump repositorypath | gzip > backupname.svn.gz that give gzipped backup of repository. can copy new svn server , unarchive it. you can try hotcopy or svnsync (although seems overkill puporse). hotcopy preserve control files svndump miss. can run while svn server up. svnadmin hotcopy repositorypath /path/to/backup you can gzip backup , transfer it.

python get data from an already opened file -

f=open("vmi","w") f.write("asdf") import os os.path.getsize("vmi") #0 byte f.close() os.path.getsize("vmi") # 4 bytes where can find lost 4 bytes, on program execution, before file closed? you try flush out data first: f.flush() why need this? well, os try buffer writes files performance reasons - lot slower write 1024 bytes 1 @ time write out whole buffer. so, whenever working file / pipe / socket kind of thing, keep in mind might buffering writes , need flush first. when closed file, flushed automatically.

extjs - Adding a non data bound row to a grid -

this bit of blast past, anyway... i have grid, loads store, rowselection model, , buttons etc... mygrid = function(config){ var config = ext.apply({},config,{ cm:'rowselection', store:new ext.data.store({ ajax:true, url:'someurl' })//thumbsucked config, prolly totally wrong }); mygrid.superclass.constructor.call(this, config); } ext.extend(mygrid,extx.grid.gridpanel) now question is... how add row grid without adding store? i want can violate column model ( eg wanna add row has textual info in it, , hyperlink, isn't gonna fit in 4 column wide grid ) can access dataview or something? this.store.on('load',function(store,records,e){ dowhat() //debugger; },this); }; iamagonnasay no :) grid has defined column model , view bound store - data in store exact. ... no can't insert row in grid not fit columns defined in grid. can expand rowbody of individual row , insert rando...

c++ - Mach-O error when trying to compile in Xcode -

i'm working on c++ program in xcode, , keep getting mach-o error when try build , run app (plus "build failed" error message). below code i'm using: // // quadsolver.cpp // calculator // // #include <iostream> #include <cstdio> #include <cstdlib> #include <cmath> using namespace std; int main(int nnumberofargs, char* pszargs[]) { //enter 3 variables double a; double b; double c; cout << "enter a"; cin >> a; cout << "enter b"; cin >> b; cout << "enter c"; cin >> c; //calculating discriminant double d; d = b * b - 4 * * c; double x1, x2; if (d == 0) { x1 = x2 = -b / (2 * a); cout << "there's 1 solution: "; cout << x1; system("pause"); return 0; } else if (d < 0) { cout << "there no possible soluti...

objective c - setting method with int -

i have method , when want set argument(which type int ) error message. code: @implementation playerinfo @synthesize playername; @synthesize playerscore; -(id) initplayerinfo:(nsstring*) name playerscore:(int) score { self = [super init]; if(self) { self.playername = name; self.playerscore = score; } return self; } i error in line: self.playerscore = score; what problem?? thanks!! you declared property pointer int (that is, int * ) rather int (which int ). despite both including keyword int , different things.

excel - How to look up something in a lookup table when there are two variables that change -

Image
quick question- i know easy, excel skills have gotten bit rusty. can see picture below situation is. have table reference shows something's priority based on importance , how work takes. have hundreds of things need compare table. how can fill out question marks under orange priority label , easily? if statement, 300 lines long. know vlookup won't work because there many variables. any great! =index($the_data_part_of_the_reference_table, match(current_importance_value, $importance_column_header_in_the_table, 0), match(current_aow_value, $aow_header_row_in_the_table, 0) )

session - Register Form in several steps -

i face problem form in several step. create register form in many steps (3-4), , save fosuser @ last step. principle create empty user in step 1, , fill part part until last step. my problem it's not recommended store object in session. so, wanted know if symfony2 proposed alternative. you put data of previous steps in hidden fields , submit every step again. why thing saving objects in sessions not good? if write proper serialization handlers should not big problem. entites indeed bit problematic store in session (i had problems well) create delegate object containing user inputs , store in session , after last step build symfony user object out of it. sure not leave masses of unused objects in session.

optimization - MySQL my.cnf performance tuning recommendations -

i kind of hoping might able offer assistance optimizing my.cnf file extremely high volume mysql database server. our architecture follows: memory : 96gb cpus : 12 os & mysql : 64-bit disk space : 1.2 tb db engine : myisam our web application used 300 client simultaneously. need our my.cnf tuned give best possible performance infrastructure. i aware indexes , optimized queries major factor in this, start system configured , follow systematically re-engineering our queries accordingly. here our current my.cnf file content: [mysqld] datadir=/home/mysql socket=/home/mysql/mysql.sock user=mysql log-bin=mysql-bin server-id=1 # disabling symbolic-links recommended prevent assorted security risks symbolic-links=1 log-slow-queries = /var/log/mysqld_slow_queries.log long_query_time = 10 max_connections = 500 key_buffer_size = 32768m #max_allowed_packet = 2m #table_open_cache = 128 #sort_buffer_size = 1024k #net_buffer_length = 64k #read_buffer_size = 1024k #read_...

Wrong Mouse position with different DPI settings in WPF -

i using below code current mouse position in wpf application. system.drawing.point _point = system.windows.forms.control.mouseposition; this works good. when user has 125% display settings in machine (windows 7), mouse position wrong. doing wrong? see if in blog or blog helps , since using wpf try using mouse.getposition in modified msdn example: // displayarea main window , txtboxmouseposition // textbox used display position of mouse pointer. private void window_mousemove(object sender, mouseeventargs e) { point position = mouse.getposition(this); txtboxmouseposition.text = "x: " + position.x + "\n" + "y: " + position.y; }

jquery - Restricting droppable elements on div -

i'm creating , appending droppable div element : var drop = { drop: function(event, ui) { var add = $("#"+this.id); $('<div id='+counter+' "><div class="mycss">here</div></div>').droppable( drop ).appendto( "#mydivs"); //debugger; counter++; } }; can update div allow divs of id or css allowed dropped ? yes .droppable( drop: function(event, ui) { var targetid = $(this).attr("id"); //your conditions check id/class of div . if (targetid == '<your div id restrict>'){ return; } } )

silverlight 4.0 - query to wcf ria service call -

i have domain service class contain simple poco object , class contain 2 variable , b , method make sum of it. public class domainservice1 : domainservice { abc obj = new abc(10, 20); public int sum1() { return (obj.a + obj.b); } } public class abc { public int { get; set; } public int b { get; set; } public abc(int c, int d) { = c; d = b; } } } i wish learn, how can make call wcf ria service @ mainpage @ silverlight? you can call service on silverlight side way: domainservice1 domainservice = new domainservice1(); domainservice.sum1((op) => { //op.value has result }, null); or domainservice1 domainservice = new domainservice1(); domainservice.sum1(sum1completed, null); (...) void sum1completed(invokeoperation<int> op) { //op.value has result }

x509certificate - How can I make sure that the remote certificate (public key) is issued/signed by my root ca? -

in server side, have self-signed ca (certificate , private key). use them issue device certificate, , want make sure if remote cert not signed ca, there exception. i'm referring links below, seems don't work me, please help: c# how can validate root-ca-cert certificate (x509) chain? verify remote server x509certificate using ca certificate file when receive device certificate, validate signature using ca certificate. that's need (yet need remember when ca certificate expires , reissue it, have either replace device certificates or validate device certificate several cas ensure allow device certificate signed previous ca certificate.

c - Return type of main function -

possible duplicate: what should main() return in c/c++? difference between void main , int main? i have been using main method in c void main(){ // code } and works pretty me. know other int return type: int main(void) int main() int main(int argc, char *argv[]) but have not been able find resource says can use void return type. every book suggests return type must int or else omitted. why void main() work? is dependent on version of c using? or work because use c++ ide? please reply specific c , not c++. only book authors seem privy place return type of void main() allowed. c++ standard forbids completely. the c standard says standard forms are: int main(void) { ... } and int main(int argc, char **argv) { ... } allowing alternative equivalent forms of declaration argument types (and names discretionary, of course, since they're local variables function). the c standard make small provision 'in other implementation de...

php - Page not found using paginate_links() with a no logged user -

i very strange problem. have page custom search: global $query_string; $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $the_query = new wp_query(); $the_query->query($query_string.'&paged='.$paged.'&posts_per_page=50&post_status=any'); while ( $the_query->have_posts() ) : $the_query->the_post(); it works correctly see 50 posts per page. problem pagination need show like: 1 2 3 4 last >> i found useful wordpress function paginate_links() but there strange error.... if i'm logged can see secord, third ... pages, if i'm not logged 404 not found! how possible? urls are: http://www.example.com/date/2012?cat=8 http://www.example.com/date/2012/page/2?cat=8 ( archive.php ) so, must logged see second, third etc etc pages, otherwise cann see first! how can solve it? thanks

java - Redirection from Servlet/Filter does not work -

i have problem redirection - not work valid paths. right use page forwarding in servlet, need redirection in filter. all pages reside in 'pages' folder , have .jspx extension i've tried following (this path works forwarding): httpresponse.sendredirect("/pages/login.jspx"); browser url http://[localhost]/pages/login.jspx , , shows tomcat's 404 page, context path (in case it's '/hotel') missing url, so, if add it: httpresponse.sendredirect("/hotel/pages/login.jspx"); redirect not happen, browser url not change, , i'm shown browser's 404 page (this program cannot display webpage). what doing wrong? the filter used test has following mapping: @webfilter(filtername = "securityfilter", urlpatterns = "/*") the redirected url indeed relative requested url. dynamically prepend context path it's recommended use httpservletrequest#getcontextpath() instead of hardcoding it, because conte...

Is it possible to use the spell checker from 8.5.3 iNotes in a ckeditor richt text control for xpages? -

we need have spell checking capability in our application , need ie browsers (which not have built-in spell checking). know can add plug-in use spell checker uses web spell checker service. not work in corporate setting since transmits data third party service. are there other options of have used might work? or has found way use spell checker inotes uses? thanks i have been asked several times during xpages bootcamps , , several others have looked solution and, knowledge, nobody has come it.

FTP-Plugin for Gedit -

i tried install ftp plugin in gedit, don't it. followed site: http://code.google.com/p/gedit-ftp-browser/ suggestions? in advance you may want provide more specific error information, but, make sure have right version of gedit. plugin 2.x , gedit in 3.x branch. second, file browser plugin shipped gedit can handle ftp (and ssh , pretty virtual filesystem supported os). open file browser , select file > connect server or execute command nautilus-connect-server . once you've connected server show in gedit file browser pane. can bookmark used connections quick access in gedit.

javascript - Adding Models to Backbone.js Collection Silently Fails -

i implementing blog engine learning exercise new job. have backbone.js collection class called bloglist composed of blogmodel objects (a blogmodel single post blog). have masterbloglist keeps blog posts in memory lifetime of application (i realize not realistic design, part of spec). i have chosen use masterbloglist hold canonical state of application. new posts, edits, etc. persisted database (mongodb) masterbloglist. when want display subset of posts in masterbloglist, copy them new bloglist instance , narrow new instance down based on search criteria. again, realize might not best design (cloning blogmodels , bloglists), i've got , i'd prefer not rework it. the problem copying 1 bloglist not working. when source list non-empty, destination list ends being empty. have tried debug every way no luck. here relevant portion of bloglist source code: // bloglist $ (function () { app.bloglist = backbone.collection.extend ({ model : app.blogmodel, url : '/blog-...

extjs - Add data to Store from external Javascript -

i have chart store using extjs4 mvc structure , data online api via javascript file , want know if possible add data store externally load when call store.load(). the external js not extjs or part of mvc, runs on page behind chart. have transfer logic extjs controller? there way call extjs method external js? thanks. there indeed ways call methods on extjs objects outside of extjs specific code, it's js after all. you need expose method extjs code returns reference chart, along these lines (in extjs code): function getchart() { return ext.getcmp('mychartid'); } then in external js, can this: var data = ...; // can external data var chart = getchart(); chart.load(data); this depends on ability expose method extjs you'll need able reference. it may easier try , call method retrieve data in extjs mvc app. providing external js file loaded, presumably return reference can call it's methods. in mind, call methods need inside extjs app ...

c# - Stop form from closing before getting response from SmtpClient.SendCompleted Event -

i using smtpclient sent out email. create function in mail class : private void sendcompletedcallback(object sender, asynccompletedeventargs e) { // unique identifier asynchronous operation. string token = (string)e.userstate; if (e.cancelled) { mailstatus = status.cancel; mailstatusmessage = token + " send canceled."; } else if (e.error != null) { mailstatus = status.error; mailstatusmessage = token + " " + e.error.tostring(); } else { mailstatus = status.sent; mailstatusmessage = "mail sent."; } mailsent = true; } public void sentemail() { client = new smtpclient(host, port); client.credentials = new networkcredential(username, password); mailaddress = new mailaddress(merchantemail, merchantname); mailaddress = new mailaddress(customeremail); mailmessage message = new mailmessage(from, to); message.body = emailsubjecttemplate()...

wpf - Dynamically add and remove TabItem from binded source in TabControl -

something strange happens me :-) i've tabcontrol. itemsource binded list. here definition of tabitembase : public class tabitembase : usercontrol { #region properties public virtual string tabname { get; set; } public virtual string tabheader { get; set; } #endregion } here xaml declare tabcontrol : <tabcontrol itemssource="{binding views, mode=twoway}" itemcontainerstyle="{staticresource tabitemtemplate}" selecteditem="{binding selectedview}" name="maintabcontrol" /> the style works fine because here when i'm adding view in list, works , see in tabcontrol in ui. i'm adding view.add(new homeview()); then added navigationservice managing navigation name quite explicit :-). here code : public class navigationservice { #region ctor public navigationservice(mainviewmodel vm) { viewmodel = vm; } #endregion #region properties public mainviewmodel view...

php - Can I use CodeIgniter form validation class to log a user in -

i know how write custom form validation's codeigniter , considering writing login validation function form validation call function. theory is easy way use codeigniter form validation class feedback user login failed. i can't see wrong , work there inherently bad in approach? add potential weakness in security of web apps login? you can surely use codeigniter's form validation library purpose. however, advise against writing own authentication system , use existing 1 such tank auth or ion auth .

c++ - Read file from txt using 2d vectors -

is possible use operator [] in case of 2d vectors? example got following code: vector<vector<string>> data; ifstream myreadfile; myreadfile.open("stoixeia_astheni.txt"); while (!myreadfile.eof()) { for(int i=0; i<1; i++){ (int j=0; j<4; j++){ myreadfile >> data[i][j]; } } } i got message out of range. have file 5 lines , 4 columns. your vector data empty, size() 0. have resize first or add new elements using push_back() : while (!myreadfile.eof()) { for(int = 0; < 1; i++){ vector<string> tmpvec; string tmpstring (int j = 0; j < 4; j++){ myreadfile >> tmpstring; tmpvec.push_back(tmpstring); } data.push_bac(tmpvec); } } you set size right @ declaration of data : vector<vector<string>> data(5,vector<string>(4)); ifstream myreadfile; myreadfile.open("stoixeia_astheni.txt...

c# - Form instance members and static member -

i have formdlg can accessed 2 two forms button click on form1, needs instance- can have multiple formdlg but other place, need single instance of formdlg any ideas thank u following example code of class can provide answer you. class formdlg { static formdlg instance; public static formdlg getinstance() { if (instance == null) instance = new formdlg(); return instance; } } since constructor public can call new in form1 multiple instances anytime want. in form2 use static function getinstance retreive single instance everytime. hope helps.

javascript - set infowindow rounded corner in google map -

i have multiple marker google map, works fine want set infowindow rounded corner and my code is: <script type="text/javascript"> var locationlist = new array( '23.2531803, 72.4774396', '22.808782, 70.823863' ); var message = new array('kalol , gujarat , india , 382721<br /><br /> go <a href="/joomla_1.5/index.php?option=com_content&amp;view=article&amp;id=9:chinta-ta-ta-chita-chita-wwwsongspk&amp;catid=1:cat1&amp;itemid=7">kalol</a>', 'morbi , gujarat , india , 363641<br /><br /> go <a href="/joomla_1.5/index.php?option=com_content&amp;view=article&amp;id=9:chinta-ta-ta-chita-chita-wwwsongspk&amp;catid=1:cat1&amp;itemid=7">morbi</a>'); var map; var lat_min = 22.808782; var lat_max = 23.2531803; var lng_min = 70.823863; var lng_max = 72.4774396; window.onload = function() { var myoptions = { maptypeid: google....

sql - count in LEFT JOIN and WHERE -

i have little problem left join want list of designs , on each design want display how many comments each design have. i using left join select ds.*, count(com.comment) countcom tdic_designs ds left join tdic_comments com on (com.design_id = ds.id) ds.approved = 1 , ds.hidden = 0 , com.approved = 1 group ds.id order ds.date_added asc but doesn't work displays 1 design have 1 comment, have 2 designs in table, second design doesn't have comment. if change sql to select ds.*, count(com.comment) countcom tdic_designs ds left join tdic_comments com on (com.design_id = ds.id) group ds.id, com.approved, ds.approved order ds.date_added asc that removing clause. bad select both designs , comments haven't been approved. what miss / wrong? move filters on comments on clause: select ds.*, count(com.design_id) countcom tdic_designs ds left join tdic_comments com on com.design_id = ds.id , com.approved = 1 ds.approved = 1 ...

perl - Invocation of SUPER::new() -

i've seen 2 ways implement new method in derived class. method one: sub new { $invocant = shift; $class = ref($invocant) || $invocant; $self = {}; bless($self, $class); $self = $self->super::new( @_ ); return($self); } method two: sub new { $self = shift; $class = ref($self) || $self; return $self if ref $self; $base_object = $class->super::new(@_); return bless ($base_object, $class); } i'm not sure understand difference is. can please explain? from comments , answers can see ref() part bad. but use of super::new(@_) ? in first example, hashref blessed derived class , object's super 's new called , saved same object. in second example on other hand, base object created class's super s new method , blessed new class. what difference between these 2 ways? looks first overwrites object base object. second seems "double-bless". i'm confused. update you ask: what differe...

rest - how to publish and discover a java web service -

i new developing web services using java. have academic project need dynamic service composition. can't directly create service-client particular service because if client call particular service only. client need search various web services , out of services select 1 @ run time , call service @ run time. i able develop web service(jax-ws) using eclipse(indigo), created client web service , every thing working fine. problem while creating client hard coding client call particular web service only(since creating client using wsdl file of service). need call 1 of searched service, need publish service discover , call it. i tried publishing service juddiv3. on juddiv3 publish sample service supplied juddiv3. when try publish service created me not getting displayed in group of published services. is there other uddi server install on local machine , publish , discover service that. not able figure out how create client modify @ run time call 1 service out of various searche...

html - Any workaround to customise the radiobutton and display a CROSS instead of the Dot? -

hello, following piece of code. here, want instead of default dot, cross (x) should appear on it. kindly let me know possible or not, if how? thanks <html> <head> <title>my page</title> </head> <body> <form name="myform" action="http://www.mydomain.com/myformhandler.cgi" method="post"> <div align="center"><br> <input type="radio" name="group1" value="milk"> milk<br> <input type="radio" name="group1" value="butter" checked> butter<br> <input type="radio" name="group1" value="cheese"> cheese <hr> <input type="radio" name="group2" value="water"> water<br> <input type="radio" name="group2" value="beer"> beer<br> <input type=...

cakephp - How can I persist a form if I am using an API to validate the data? -

normally, if use cakephp's magic , validate forms "persist form" mean user wouldn't have re-input everything. also, cakephp default marks fields failed validation. question is, since sending form data api, how can still use of cakephp's magic? i looked custom validation methods, problem have send data api @ once , i'll errors @ once (billing information). then doing wrong. default "cake" way persist form - (or especially) after unsuccessful validation without seeing actual code 1 cannot tell more, though. check out bake templates , how done correctly. question resolves immediately.

Git (EGit in Eclipse) misunderstands changes (false markup) -

i have encountered problem git. use eclipse ide , egit plugin. after doing changes c++ file, see egit marks of lines did not touch being added, whereas others - deleted. seems somehow 'diff' (or whatever used) not work correctly particular modifications made. there way 'help' egit (git) , mark lines unchanged? preferably gui of egit, not command line.... if commit is, thinks changed deal of initial file, did not. seem mixed line endings or eclipse autoformats. not sure c++, java editors likes add trailing spaces. menu in quickdiff barcan used revert changed lines unchanged state.

javascript - jquery each loop in a each loop -

i have divs use containers, want loop on them , loop on items in it. so not $('.stackcontainer .stackitem').each( this: // setup stacks $('.stackcontainer').each(function(containerindex) { //console.log($(this)); console.log(containerindex); $(this).('.stackitem').each(function(itemindex) { console.log(itemindex); } }); only working. how possible? try $('.stackcontainer').each(function(containerindex) { //console.log($(this)); console.log(containerindex); $(this).find('.stackitem').each(function(itemindex) { console.log(itemindex); } });

c# - Ignore capitalization of letters set through JsonPropertyAttribute -

i have class 3 simple properties: public class newcard { [jsonproperty( "name" )] public string name { get; set; } [jsonproperty( "desc" )] public string desc { get; set; } [jsonproperty( "idlist" )] public string idlist { get; set; } } i expected result this: {"name":"a name","desc":"","idlist":"listid"} unfortunately, result looks this: {"name":"a name","desc":"","idlist":"listid"} the remote service rejects json, need have them lowered. json.net version: 4.5.6 downloaded using nuget. i result expect when serialize as var json = jsonconvert.serializeobject(new newcard() {name="a name",desc="a desc",idlist="ids" });

python - Split string based on a regular expression -

i have output of command in tabular form. i'm parsing output result file , storing in string. each element in 1 row separated 1 or more whitespace characters, i'm using regular expressions match 1 or more spaces , split it. however, space being inserted between every element: >>> str1="a b c d" # spaces irregular >>> str1 'a b c d' >>> str2=re.split("( )+", str1) >>> str2 ['a', ' ', 'b', ' ', 'c', ' ', 'd'] # 1 space element between!!! is there better way this? after each split str2 appended list. by using ( , ) , capturing group, if remove them not have problem. >>> str1 = "a b c d" >>> re.split(" +", str1) ['a', 'b', 'c', 'd'] however there no need regex, str.split without delimiter specified split whitespace you. best way in cas...

knockout.js - Custom parameters on knockout click binding -

i'm trying call function custom parameter, i'm unable access parameter, , observable() object instead. i'm trying retrieve index of specific element in list. point me in right direction on how so? html: <div id="formula"> <b>formula</b><br/> <!-- ko foreach: formula --> <span data-bind="text: $data, attr: {name: $index}, click: $parent.convert.bind($data,$index)"></span><br/> <!-- /ko --> </div> javascript: var listmodel = function(formula) { var self = this; self.formula = ko.observablearray(formula); self.convert = function(index) { alert(index); //this should show index of clicked element } }; listmodel = new listmodel(formula); ko.applybindings(listmodel); should $parent.convert.bind($data,$index()) <div id="formula"> <b>formula</b><br/> <!-- ko foreach: formula --> <span data-bind=...

import to excel a text file using cell value -

i have .txt output files import in excel. ideally want use sheet1 index; write title, name of sheet , path , name .txt file. macro should create newsheet named cell , in sheet import corresponding .txt file. i been trying record macros , changing vba code, far failures. with activesheet.querytables.add(connection:= _ "text;c:\documents , settings\userxp\my documents\my dropbox\cippec\1-mira\procesamiento base\oede\tablas\trim\q_employ_pcia_23.txt" _ , destination:=range("$a$1")).name = "q_employ_pcia_23" any idea? thanks with activesheet.querytables.add(connection:= _ "text;c:\documents , settings\userxp\my documents\my dropbox\cippec\1-mira\procesamiento base\oede\tablas\trim\q_employ_pcia_23.txt" _ , destination:=range("$a$1")) .name = "q_employ_pcia_23" .refresh backgroundquery:=false end activesheet.name = "q_employ_pcia_23" works import new sheet , want name new sheet also.

linux - How can i get input stream to a program running with nohup and & in shell -

i running program nohup add.sh & this scripts take inputs @ runtime console. how can hold of input stream process can pass 2 numbers? thanks that depends of how script works, can send input command via pipe: nohup echo "this input" | add.sh & however don't know if can more 1 argument. may need enhance add.sh script in order accept , use parameters if provided.

mongodb - Need a map reduce function in mongo using php -

need map reduce function mongo in php this mongo structure [_id] => mongoid object ( [$id] => 4fcf2f2313cfcd2454500000d ) [id] => 454 [table] => people [news] => array ( [03-06-2012] => 2 [04-06-2012] => 3 [05-06-2012] => 5 [06-06-2012] => 4 ) here try sum array news below code, $map = new mongocode('function() { emit(this.news, 1); }'); $reduce = new mongocode('function(previous, current) { var count = 0; (index in current) { count = count + current[index]; } return count; }'); $sales = $db->command(array( 'mapreduce' => 'mycollection', 'map' => $map, 'reduce' => $reduce, 'query' => array('table' => 'people'), 'out' => 'news' )); //pr($sal...

ios - CoreAnimation rotating an object and changing it's position at the same time -

what i'm trying rotate view left , right , @ same time move it's position , down. here's code have: cgaffinetransform leftwobble = cgaffinetransformrotate(cgaffinetransformidentity, radians(-12.0)); cgaffinetransform rightwobble = cgaffinetransformrotate(cgaffinetransformidentity, radians(12.0)); flyingguy.transform = leftwobble; // starting point [uiview beginanimations:@"wobble" context:flyingguy]; [uiview setanimationrepeatautoreverses:yes]; [uiview setanimationrepeatcount:1000]; [uiview setanimationduration:1.3]; [uiview setanimationdelegate:self]; [uiview setanimationdidstopselector:@selector(wobbleended:finished:context:)]; flyingguy.transform = rightwobble; cgrect frame = flyingguy.frame; frame.origin.y += 10; [flyingguy setframe:frame]; [uiview commitanimations]; - (void)wobbleended:(nsstring *)animationid finished:(nsnumber *)finished context:(void *)context { if ([finished boolvalue]) { uiview* item = (uiview *)context; ...

java - Determine if JOIN resulted in any columns -

i have sql statement multiple joins; there records resulting joins , not. not error when joins empty. is there way test whether particular join empty without having trap exception occurring when resulting column not found in result set? in other words, if, using jdbc, execute following sql statement: select * aa left outer join bb on aa.keyfield = bb.keyfield keyfield = "123" i know whether join found fields without having trap exception. if execute java statement: string valuestring = rs.getstring("bb.keyfield"); i exception. cannot compare rs.getstring("bb.keyfield") null, because getstring throws exception if did not find values in join. i hope makes question more clear, , apologize not having expanded on more in first place. the query won't return columns such names. use simple names of columns ( name , keyfield , etc.). execute query inside database query tool, , you'll see names assigned retrieved columns. yo...

iphone - MPMoviePlayerController Performance Hit -

i use mpmovieplayercontroller because want play movie. one question. when create mpmovieplayercontroller, app stops little. this code: nsstring *path = [[nsbundle mainbundle] pathforresource:@"test" oftype:@"m4v"]; nsurl *videourl = [nsurl fileurlwithpath:path]; movieplayer = [[mpmovieplayercontroller alloc] initwithcontenturl:videourl]; movieplayer.scalingmode=mpmoviescalingmodefill; movieplayer.controlstyle=mpmoviecontrolstylenone; movieplayer.shouldautoplay=no; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(movierestartcallback:) name:mpmovieplayerplaybackstatedidchangenotification object:nil]; [movieplayer.view setframe:cgrectmake(20, 20, 280, 200)]; [self.view addsubview:movieplayer.view]; ` why app stop? problem resolution way? if @ ...

delphi - Updated to Indy 130 packages from 120 and now this code does not work -

so used work without hitch "socket error #10054 connection reset peer." i assume started happening once updated indy packages. today first time running code since then. can explain how update might have changed behavior of code , how resolve it? thank you function postdata(url : string; param: tstringlist) : string; var text: string; shttpsocket: tidhttp; sshsockethandler: tidssliohandlersocketopenssl; resstream: tstringstream; begin shttpsocket := tidhttp.create; sshsockethandler := tidssliohandlersocketopenssl.create; shttpsocket.iohandler := sshsockethandler; shttpsocket.request.contenttype := 'application/x-www-form-urlencoded'; shttpsocket.request.method := 'post'; resstream := tstringstream.create; shttpsocket.post(url, param, resstream); resstream.seek(0, sofrombeginning); text := resstream.datastring; result := text; end; if posting https url, make sure tidssliohandlersocketopenssl configured server tr...

ruby - Is there a particular function to retrieve then delete random array element? -

i know can in couple of steps, wondering if there function can achieve this. i want array#sample, remove element retrieved. how this: array.delete_at(rand(array.length))

error handling - Ninject ToFactory not working with parameters -

i attempting use tofactory extension ninject, running few problems. if have constructor this: public listenerreader(idepen1 depen1, idepen2 depen2, udpclient client, datareceivemodes datareceivemode, int receiveport) { } and create factory automatically create items this: public interface ilistenerreaderfactory { listenerreader createlistenerreader(udpclient client, datareceivemodes datareceivemode, int receiveport); } i receive activation error when try call injected factory: error activating int no matching bindings available, , type not self-bindable. seems ninject not inject primitive types in factories. have seen same error string type in factory? if not work have separate parameters called method? edit: it appears type in question being injected outside of factory. ninject trying create bindings enum , int types failed. the problem factory not being called , type being injected directly instead.

memory - How to have a Moving graph or chart in android? -

i new android , need know how make graph or chart (eg. line chart) move i.e, right left. basically going draw graph in accordance ram memory usage of phone. need draw graph present in task manager of windows. please on this. it's sample code. i did not test yet. but think code works fine. public class drawgraph extends activity{ /** * variable array graphview * verlabel : background height values * horlabel : background width values * values : max values of foreground active graph */ private float[] values = new float[60]; private string[] verlabels = new string[] { "600","500","400","300","200","100","80","60","40","20","0", }; private string[] horlabels = new string[] { "0","10", "20", "30", "40", "50", "60"}; private graphview graphvie...

java - How do we call a super class method if we already have a super class of sub class? -

my question if there child class extend father class , extended grandfather class how can child class directly access grandfather's method. this best illustrated example: public class gf { public void one() { ... } public void two() { ... } } public class f extends gf { public void two() { ... } } public class c extends f { public void one() { super.one(); // calls 1 in gf } public void two() { super.two(); // calls 2 in f } } the syntax calling overridden method within subclass super.method(....) . can call first level overridden method. if method override, cannot call 2nd-level override; e.g. there no way c.two() directly call gf.two() . can't reflectively, , jvm bytecodes won't allow it.

json - Kendoui databind with Jquery datasource not working -

hi i'm trying bind data kendochart, no bars appearing on chart. if url in web browser, following string returned. [{"areaname":"rondebosch","numberofincidents":2}, {"areaname":"claremont","numberofincidents":2}, {"areaname":"athlone","numberofincidents":2}] the code follows var reports = {}; $.ajax({ url: "home/getincidentperarea", async: false, datatype: 'json', success: function (json) { reports = json; $("#chart").kendochart({ title: { text: "incidents per area" }, datasource: { data: reports }, series: [{ name: "incidents per area", field:"numberofincidents"}] }); } }); please help... the datasource option spelled in camel case. in addition, data source can request d...

php - Can I extract html from mysql table instead of plain text? -

i'm using code extract text database , works strips html tags. $this->data['getshorty'] = utf8_substr(strip_tags(html_entity_decode($product_info['description'], ent_quotes, 'utf-8')), 0, 640); i rather able extract string html tags included , choose stop @ first or second paragraph break instead of counting 640 characters. do-able? the function strip_tags() removes html. remove function line , should fine. $this->data['getshorty'] = utf8_substr(html_entity_decode($product_info['description'], ent_quotes, 'utf-8'), 0, 640);

c - How to write a macro that does malloc, formats a string and then returns the formatted string? -

i have tried this: #define format(f, ...) \ int size = strlen(f) + (sizeof((int[]){__va_args__})/sizeof(int)) + 1); \ char *buf = malloc(size); \ snprintf(buf, size, f, __va_args__); \ buf but returns lot of syntactic errors. how do properly? c macros not functions 1:1 substitutions. if want use macro this: mystring = format("%d", 5); you this: mystring = int size = strlen(f) + (sizeof((int[]){5})/sizeof(int)) + 1); \ char *buf = malloc(size); \ snprintf(buf, size, f, 5); \ buf; which not make sense. in case better off defining inline function should not worse in terms of performance on decent compiler. if really has macro , on gcc, can use compound statement achieve goal. allows this: mystring = ({ statement1, statement2, ..., statementn}) execute statements in local scope , assign statementn mystring . make code non-portable , hell debug. so he...

Compound assignment operators in Python's Numpy library -

the "vectorizing" of fancy indexing python's numpy library gives unexpected results. example: import numpy = numpy.zeros((1000,4), dtype='uint32') b = numpy.zeros((1000,4), dtype='uint32') = numpy.random.random_integers(0,999,1000) j = numpy.random.random_integers(0,3,1000) a[i,j] += 1 k in xrange(1000): b[i[k],j[k]] += 1 gives different results in arrays 'a' , 'b' (i.e. appearance of tuple (i,j) appears 1 in 'a' regardless of repeats, whereas repeats counted in 'b'). verified follows: numpy.sum(a) 883 numpy.sum(b) 1000 it notable fancy indexing version 2 orders of magnitude faster loop. question is: "is there efficient way numpy compute repeat counts implemented using loop in provided example?" this should want: np.bincount(np.ravel_multi_index((i, j), (1000, 4)), minlength=4000).reshape(1000, 4) as breakdown, ravel_multi_index converts index pairs specified i , j integer indices c...

php - Session Management with Sharp UMS -

i new mvc style of programming. have management script able integrate user credentials browser application. user information such username, email, name, etc. documentation system provides clear explanation generating information. have done in following script works fine, return "auth_no_session" because have no way of allowing user log in information , issue: user information (user_cred.php) include_once("includes.php"); $auth = new tauthentication(); $accept_roles = array('plugin'); $auth_result = $auth->validatesession($accept_roles); if ($auth_result->auth_code == auth_no_session) { header('access-control-allow-origin: *'); echo "auth_no_session"; // means no session found, therefore page being accessed anonymously. } elseif ($auth_result->auth_code == auth_okay) { header('access-control-allow-origin: *'); echo "auth_okay"; // means there session , user owns required role...

How do I build simple boost program on Mac OS (Lion) -

steps: 1. sudo port boost boost file installed in /opt/local/boost, library files in /opt/local/lib 2. use xcode create c++ project #include <iostream> #include <boost/asio.hpp> int main () { return 0; } 3. set xcode find out boost in "build settings" -> "header_search_paths" in both debug , release add path /opt/local/include 4. "build settings" -> "library_search_paths" --> add /opt/local/lib both debug , release. 5. build program , failed. error messages, undefined symbols architecture x86_64: "boost::system::generic_category()", referenced from: ___cxx_global_var_init1 in main.o ___cxx_global_var_init2 in main.o "boost::system::system_category()", referenced from: ___cxx_global_var_init3 in main.o boost::asio::error::get_system_category() in main.o "boost::asio::error::get_netdb_category()", referenced from: ___cxx_global_var_init5 in main.o <br...

ios5 - iOS 5.1 Monotouch View Qustions -

is possible have following "view" structure? 1) rootviewcontroller uitabbarcontroller. 2) 1 of "tabbed" views uisplitviewcontroller. 3) "detail" view of "splitviewcontroller" uinavigationcontroller. what i'm trying accomplish "detail" view can create sub view has "back" button. the problem calling pushviewcontroller(newview, true) in "detail" view never displays newview. a uisplitviewcontroller must the top level controller. see here: split view controller must root view controller instead of using uitabbarcontroller @ root, should use split controller. the detail , master sections both have uinavigationcontrollers can push many new screens need.

ruby - Activerecord in rails 3.2 within an engine throws NameError: uninitialized constant when using accepts_nested_attributes_for -

i building rails engine. have following 2 model classes: module landingpageeng class landingpage < activerecord::base attr_protected # debugging right has_many :slide_show_images, :dependent => :destroy accepts_nested_attributes_for :slide_show_images, allow_destroy: true end end the second class is: module landingpageeng class slideshowimage < activerecord::base attr_accessible :image, :landing_page_id belongs_to :landing_page validates :image, :presence => true end end the tables associated them landing_page_eng_landing_page , landing_page_eng_slide_show_image. when run following in console error nameerror: uninitialized constant slideshowimage. 1.9.3-p194 :001 > landingpageeng::landingpage.new({"title"=>"wd", "tagline"=>"wed", "slide_show_images"=>{"_destroy"=>""}}) nameerror: uninitialized constant sli...

php - PHPUnit codecoverage halts without reporting any error -

when executing phpunit codecoverage, coverage generating halts without error, , no report generated. the problem caused fatal error in 1 file, it's hard find error without error showing up. i have confirmed display_errors on, , have set error_reporting -1 in php.ini after testing excluding files coverage, have found file in error, , error (class not implementing inherited abstract methods), have gone faster if had actual error. the problem in phpunit config being used. i had set error reporting this: <php> <ini name="error_reporting" value="e_all & ~e_strict" /> </php> i thought should work, appears can provide constants ( e_all ) or literal values, not expressions that. config set error_reporting 'e_all & ~e_strict' , instead of correct numeric value, causing errors muted. i have solved setting error_reporting in phpunit bootstrap file.

java - how to convert list of string to csv format -

i want convert treeset of strings (which in java) csv format. samle treeset : desktop/netbeans-7.1.2.desktop downloads/jasper.jar downloads/may_2012_report netbeans-7.1.2-ml-linux.sh ppt/ankit_ppt/cloudppt.ppt ppt/ankit_ppt/dataplacement.pptx ppt/vir047_wh06.ppt pro1 rough struts2 struts2-jquery-plugin-3.3.0.jar sample csv format: desktop,0,desktop desktop/netbeans-7.1.2.desktop,desktop,netbeans-7.1.2.desktop downloads,0,downloads downloads/jasper.jar,downloads,jasper.jar downloads/may_2012_report,downloads,may_2012_report netbeans-7.1.2-ml-linux.sh,0,netbeans-7.1.2-ml-linux.sh ppt,0,ppt ppt/ankit_ppt,ppt,ankit_ppt ppt/ankit_ppt/cloudppt.ppt,ppt/ankit_ppt,cloudppt.ppt ppt/ankit_ppt/dataplacement.pptx,ppt/ankit_ppt,dataplacement.pptx ppt/vir047_wh06.ppt,ppt,vir047_wh06.ppt pro1,0,pro1 rough,0,rough struts2,0,struts2 struts2-jquery-plugin-3.3.0.jar,0,struts2-jquery-plugin...

jQuery show background image only on startpage -

how can display fullscreen, resizing background image startpage. have div in background stretches on full background, resizing on window.load. how can hide div unless current page startpage? css: .pagebg { display: none; position: absolute; // set background , other properties } html: <body> <div class="pagebg"> </div> <div> page content </div> javascript: $(function() { if(isstartpage()) { $(".pagebg").show(); } });

android - How to make Rotate3dAnimation more smoother? -

Image
in app using rotate3danimation show google map. code working fine, animation not smooth, lines visible while rotating view. please take @ code , suggest me how can make animation more smoother? suggestion on achieving type of animation in other efficient way highly appreciated. public class eventsactivity extends mapactivity implements dialoginterface.ondismisslistener { private eventsitemmodel eventsitemmodel; private integer eventitemid; private integer eventcategoryid; private static mapoverlay mapoverlay; drawable marker; context context; private static string my_location = "my location"; private viewgroup mcontainer; private imageview mimageview; private mapview mmapview; private static boolean isflipped = false; @override public void oncreate(bu...