Posts

Showing posts from January, 2012

Passing references to functions to be assigned to pointers in C++, Which way is better? -

i'm wondering 1 better of these 2 implementations of passing addresses pointers. there data exchange in 1st 1 doesn't happen in 2nd one? second 1 more efficient way? more readable? both same? version 1 void ptrfunction(int& arg) { int* ptr = &arg; std::cout<<"the pointer's value:" << *ptr << "\n"; } int main() { int x=5; ptrfunction(x); return 0; } version 2 void callviapointers(int *arg) { int *ptr = *arg; std::cout << "the pointer's value: " << *ptr; } int main() { int x = 100; callviapointers(&x); return 0; } in terms of efficiency, 2 compile down same code behind-the-scenes, references implemented automatically-dereferenced pointers. perspective, 2 solutions equivalent. as whether pass pointer or reference, that's judgment call depends on situation. if you're trying print out pointer integer (as you're doing here), pas

c++ - no appropriate default constructor available - iterator? -

i cant code compile. added in iterator design pattern , think cause of error: when click on error takes me class electricmenu constructor.. maybe virtual iterator in menu class causing it? error c2512: 'guitars::composite::inventoryparts::menu' : no appropriate default constructor available i have composite design pattern , tring incorporate iterator design pattern , maybe cause since maybe have wrong interface. here code error originating. not doing in main yet, wont compile. include 1 class if thought culprit. trying keep short possible..sorry dont lose interest please #ifndef _electric_menu_ #define _electric_menu_ #include "menu.h" #include "menuitem.h" #include "electricmenuiterator.h" namespace guitars { namespace composite { namespace inventoryparts { class electricmenu : public menu { private: static const int max_items = 6; int _numberofitems; menuitem** _menuitems; public: electricmenu() : _numberof

flash - What programming language is used to design google analytics(Charts Section)? -

i want know languages or tech. did google use view charts , statistics ?. is flex or flash actionscript ? flex developed on flash platform. whatever flex can using flash, more work. flex exported swf; and actionscript make flash functionality. probably google analytics developed in flex, can not know. can sure today flash , actionscript.

iphone - CGPoints and UIViews -

is possible place cgpoint inside of uiview subview when rotate uiview, cgpoint rotates it. a cgpoint logical construct, not graphical. said, following produce point rotated around (called point). may not apply directly, should give direction. key cgaffinetransform. cgaffinetransform translatetransform = cgaffinetransformmaketransation(point.x, point.y); cgaffinetransform rotatetransform = cgaffinetransformmakerotation(angle); cgaffinetransform customtransform = cgaffinetransformconcat(cgaffinetransformconcat( cgaffinetransforminvert(translatetransform), rotatetransform), translatetransform); newpoint = cgpointapplyaffinetransform(initialpoint, customtransform);

iphone - how can I add an array containing minutes to UIPickerView? -

i want add array containing mints uipickerview, want see output below, 1 minute 2 minutes 3 minutes 4 minutes 5 minutes ........ ........ 1140 minutes how can i, have array stored value 1 1140, want display on uipickerview 'minutes' written beside digits, - (nsstring *)pickerview:(uipickerview *)pickerview titleforrow:(nsinteger)row forcomponent:(nsinteger)component { if(i == 1) return [nsstring stringwithformat:@"%d minute", row + 1]; return [nsstring stringwithformat:@"%d minutes", row + 1]; } -(nsinteger)pickerview:(uipickerview *)thepickerview numberofrowsincomponent:(nsinteger)component { return 120; }

android - remove the color shown while selecting a widget -

when touch widget image in android, color shown surrounding showing image pressed. how remove it? according accepted answer of this question, seems if set value (any color, or drawable) background, you'll not have "shadow" effect anymore.

java - Line break in TextView adds padding -

this textview: public iconifiedtextview(context context, iconifiedtext aiconifiedtext) { super(context); /* * first icon , text right (horizontal), not above , * below (vertical) */ this.setorientation(horizontal); micon = new imageview(context); micon.setimagedrawable(aiconifiedtext.geticon()); // left, top, right, bottom micon.setpadding(0, 3, 7, 3); // 5px right /* * @ first, add icon ourself (! extending linearlayout) */ addview(micon, new linearlayout.layoutparams(layoutparams.wrap_content, layoutparams.wrap_content)); mtext = new textview(context); mtext.settext(aiconifiedtext.gettext()); mtext.settextsize(16); /* text (after icon) */ addview(mtext, new linearlayout.layoutparams(layoutparams.wrap_content, layoutparams.wrap_content)); minfo = new textview(context); minfo.settext(aiconifiedtext.getinfo()); /* info (below text) */ addview(minfo, new li

memory leaks - problem with NSmutableArray -

- (void)createtileonscreen:(cgrect)rect { myarray = [[nsmutablearray alloc] init]; cgrect bounds = rect; cgrect myrect = cgrectmake(bounds.origin.x,bounds.origin.y, (int)(bounds.size.width / 11), (int)(bounds.size.height / 10)); (int = 0; < 10; i++) { (int j = 0; j < 11; j++) { int index = 10 * + j; liv *mytile = [[liv alloc] initwithframe:myrect withindex:index]; float width = (1.0 / 11); float height = (1.0 / 10); [mytile setimagesection:cgrectmake((j / 11), (1.0 - ((i+1) / 10)), width, height)]; [self.rotationview addsubview:mytile]; [myarray addobject:mytile]; [mytile release]; myrect.origin.x += myrect.size.width; } myrect.origin.x = bounds.origin.x; myrect.origin.y = myrect.origin.y + myrect.size.height ;

how to Deal with billions of data in sql server? -

hi guys have sql server 2008 database along 30000000000 records in 1 major table. looking performance our queries. have done indexes. found can split our database tables multiple partitions data spread on multiple files , increes performance of query. unfortunatly functioning available in sql server enterprise edition. make unafortable us. could guys suggest other way maintain , query performance. eg. select * mymajortable date between '2000/10/10' , '2010/10/10' this query takes around 15 min retrieve around 10000 records. a select * less efficiently served query uses covering index. first step: examine query plan , , table scans , steps taking effort(%) if don’t have index on ‘date’ column, need 1 (assuming sufficient selectivity). try reduce columns in select list, , if ‘sufficiently’ few, add these index included columns (this can eliminate bookmark lookups clustered index , boost performance). you break data separate tables (say date rang

ajax - jQuery adding elements to slideshow after load event -

i using nivoslider plugin create slideshow effect on page. currently, when page loads, randomly selects 5 images cycle through using php script. the images used placed inside div so: <div id="slider"> <img src="image1" /> <img src="image2" /> <img src="image3" /> <img src="image4" /> <img src="image5" /> </div> this working ok, load more images via ajax after page has loaded. i have php script html images can't new images included in cycle. is there anyway take these new images account? any advice appreciated. thanks. it seems there no easy way reset plugin. tried call nivoslider on updated container, returns (it checks if installed element). bypassing check (by running $('#slider').removedata('nivoslider') ) breaks it. i guess there 2 ways tackle problem. either remove slider container entirely, , rebuild using existing images , new on

how to differentiate grails url mappings -

i have mappings: "/$controller/$action?/$id?"{ constraints { // apply constraints here } } // used scaffolding , think required generated stuff '/'(controller:'home') //for home page '/$param1?/$param2?'(controller:'search') //for search page the required url displayed in browser is: www.site.com/ - home www.site.com/keyword1/keyword2 - search these optional keywords this seems work question is: can expect correct or in situation grails things mixed up? it not. grails sort url mappings based on given set of precedence rules ( specific general ). your urls same , return same page. however, because mappings ambigous, might return page don't expect. better design have search mapped to: /search/params1?/params2? this way unambigous.

MySQL Query - Transpose -

how if have 1 column , want make become 1 row. please using mysql query. thank you. column ------ 1 0 1 1 0 1 0 col1 col2 col3 col4 col5 col6 col7 | 1 | 0 | 1 | 1 | 0 | 1 | 0 |

c# - Javascript event like window.onload for subsequent loads -

we have function changes iframe height @ window.onload event can adjust page contents. problem after clicking in asp:menu height restored default , window.onload event doesnt fire...so need event fire in subsequent loads (tried window.unload didnt trigger) the resize function cant called on asp:menu click because window wouldnt have finished loading height calculation fail... any ideas?? asp.net ajax exposes client event model. execute code after content refreshed, use bind pageloaded event: sys.webforms.pagerequestmanager.getinstance().add_pageloaded(pageloadedfunction); learn more of asp.net ajax javascript events here: http://msdn.microsoft.com/en-us/library/bb386417.aspx

Convert J2EE 1.3 application into Java EE 5 or above -

i maintain old j2ee application uses ejb's. involved in converting j2ee ejb's java ee ejb's here's starter list: convert ejbs new 3.x standard. replace xml annotations possible. change java ee 6 jar dependencies needed. repackage ear.

xcode - How to put Objective C code into Word (Office) with syntax highlighting -

i writing documentation app , want explain code. want copy parts of objective c code xcode microsoft word. don't know how put code syntax highlighting (and maybe line numbers, ?!) word. does know usable solution little problem? copy , paste works ! nevertheless, make sure option "copy colors , fonts" in preferences>fonts & colors checked !

linux kernel - Disabling all interrupts to protect CPU register state on multi processor systems -

i need ensure in code portion (in kernel mode) no 1 else can modify/check cr0 register. on one-processor system think disabling interrupts best. on multi-processor systems : is there way disable interrupts processors during code section (with spinlock mechanism example)? is necessary? when modifying cr0 register on multi-processor system, guess register modified current cpu? --> disabling interrupts current cpu sufficient? --> there way check/modify other cpus (on same system) register cpu? many in forward answers (and sorry approximative english) jérôme. jérôme, have looked using spin_lock_irqsave() , spin_unlock_irqrestore() ? disables local interrupts. i believe more all-encompassing version spin_lock_irq() , spin_unlock_irq() stops interrupts unconditionally (like cli()/sti() ). there many conditions take account when using these locking mechanisms. 1 of primary examples losing ability call kernel functions may sleep while inside spin_lock

c - using memcpy to copy a structure -

possible duplicates: copying 1 structure another copying 1 structure another struct node { int n; struct classifier keys[m-1]; struct node *p[m]; }*root=null; i have created newnode of type node (*newnode)->keys[i] i want copy data keys structure structure clsf_ptr of same type can this,i don't want initialize each member function memcpy((*newnode)->keys[i], clsf_ptr) for start, should be: memcpy(&(newnode->keys[i]), &clsf_ptr, sizeof(struct classifier)); (assuming newnode pointer-to- node , , clsf_ptr classifier`). also, struct assignment legal in c, do: newnode->keys[i] = clsf_ptr; note both of these approaches shallow copy . if struct classifier has pointers memory, pointers copied, rather creating new copies of memory.

android - classnotfoundexception -

i'm working on app has got face detection in it. i'm using android's facedetector class , 1 of it's methods. i'm getting frame previewframe callback format yuvimage. need bitmap facedetection work. problem when run program there's error saying classnotfoundexception regard yuvimage. i've imported yuvimage class , there's no errors in source file. why can't yuvimage class found? thanks if activity or service must , should mention in android manifest file

JQuery in internet explorer cant parse a string html -

i trying parse html string in internet explorer using jquery, based on: parsing html string ajax/jquery . here code: alert(result); alert($(result)); the first alert prompts html, second alert gives me object. on firebug lite console gives me blank object: [] !! console.log(result) console.log($(result)) result big xhtml code, received through ajax call. same code works on firefox.. anyone has idea why happening? appreciated..! without seeing html code, it's hard say, have guess you're hitting "unknown runtime error" occurs when you're invalidly trying put element it's not allowed. you see, jquery builds dom (x)html creating detached element , applying (x)html element's innerhtml property. fwiw, neither browsers care if you're passing xhtml or html, unless you're serving xhtml mime type giving bigger problems. if consider following plain js code: var p = document.createelement("p"); p.innerhtml = "<l

Python C APi Deep Copy -

how do deep copy of python object using c api? know can use copy.deepcopy, i'd prefer use c api if can. the functionality of copy.deepcopy() completely written in python . don't think have done if there single c call achieve same thing, guess have call copy.deepcopy() .

jquery keyboard pause catch -

am catching keyup events makes calls each keyup. jquery('#search').keyup(function() { }); but need when user continuously types characters , gave pass @ 5th character or in n'th character time want trigger ajax call. here can use timeout function catch event each keypress call timeout function again same thing happening and if user again started typing after pause again have trigger event/ajax call after pause only. here need abort previous events or ajax calls since again user started searching. so used .abort(); function abort previous calls. is there better way catch event @ after period of time in jquery. please advice me, thanks in advance var search = $('#search'), search_delay = 100; search.keyup(function() { var request = search.data('request'); if(request) { // if request running - abort request.abort(); search.data('request', null); } cleartimeout(search.data('timer&

iphone - Program received signal: "EXC_BAD_ACCESS" while adding subview to main view -

i adding 2 labels , 2 image view subview. when ever tap on button add subview mainview. i getting images web server , save in local simulator documents. nsmutablestring *about_name_str = [[nsmutablestring alloc]init]; [about_name_str appendstring:[mydictionary objectforkey:@"firstname"]]; [about_name_str appendstring:@" "]; [about_name_str appendstring:[mydictionary objectforkey:@"lastname"]]; [about_name_label settext:about_name_str]; nsmutablestring *about_addr_str = [[nsmutablestring alloc]init]; [about_addr_str appendstring:[mydictionary objectforkey:@"state"]]; [about_addr_str appendstring:@","]; [about_addr_str appendstring:[mydictionary objectforkey:@"country"]]; [about_addr_label settext:about_addr_str]; about_image.image = [uiimage imagewithcontentsoffile:imagepath]; about_logo.image = [uiimage imagewithcontentsoffile:logopath]; if ([mydictionary objectforkey:

java - How to get Hibernate Tools to generate POJOs with toString,equals and hashcode? -

hibernate tools plugin (version 3.2.4) eclipse hi all, i'm using plugin reverse engineer pojos , daos db-schema , reason tostring,equals , hashcode methods aren't created in pojos. i'm doing following: create new jpa project. configure it's persistence.xml file follows: <persistence-unit name="pu"> <provider>org.hibernate.ejb.hibernatepersistence</provider> <exclude-unlisted-classes>false</exclude-unlisted-classes> <properties> <property name="hibernate.connection.driver_class" value="com.microsoft.sqlserver.jdbc.sqlserverdriver"/> <property name="hibernate.connection.password" value="pass"/> <property name="hibernate.connection.url" value="jdbc:sqlserver://****:1433;databasename=mydb"/> <property name="hibernate.connection.username" value="user"/> <property name="hibernate.default_catalog" value=

iphone - NSMutableDictionary -

how use nsmutable dictionary in class read , write data plist file in iphone.... any ideas? as can find in in nsdictionary reference , class has method create nsdictionary file initwithcontentsoffile:(nsstring *)path . can like: nsstring *plistpath = [[nsbundle mainbundle] pathforresource:@"mydictionary" oftype:@"plist"]; nsdictionary *dict = [[nsdictionary alloc] initwithcontentsoffile:plistpath]; where mydictionary plist name (in case of plist inside resource bundle). can write plist on disk method: [dict writetofile:filepath atomically: yes]; where filepath destination path.

mysql - How to create pseudo document oriented model? -

currently, using rails mysql backend. unfortunately, application has scaled in data not expected or foreseen when started. now, facing lot of performance issues increasing entries in database , activerecord taking hit due in-numerous queries fired result of enjoying relational logic. i have come point feel paying penalty enjoying advantages of proper relational model. since speed has come under hammer, had research on document-oriented models mongo db , found offer speed compensating relational features. my question here is, how migrate relational model document model. perhaps, store temporary schemas or tables returned , dump them bulk document on fly instead of setting proper document-oriented db (at least during initial phase). space not issue me. care time. then, cannot in 1 single sweep. know how approach problem, links/references kind of problem has been solved before appreciated. i highly recommend against migrating document db unless data better suited such dat

java.lang.ClassNotFoundException: javax.servlet.Servlet -

i receive exception when try run jar file java.lang.classnotfoundexception: javax.servlet.servlet the file servlet-api-2.5-6.1.14.jar lives in same dir jar im trying run. servlet-api-2.5-6.1.14.jar contains class javax.servlet.servlet any ideas ? thanks you need include path in class-path entry of manifest.mf file of jar you're running. assuming both jar's in same folder: class-path: servlet-api-2.5.6.1.14.jar i wonder how it's useful have servlet api dependeny of plain java application.

email - PEAR Mail, Mail_Mime and headers() overwrite -

i'm working on reminder php script called via cronjob once day in order inform customers smth. therefore i'm using pear mail function, combined mail_mime . firstly script searches users in mysql database. if $num_rows > 0 , it's creating new mail object , new mail_mime object (the code encluded in posts starts @ point). problem appears in while-loop. to exact: problem is $mime->headers($headers, true); as doc. states, second argument should overwrite old headers. outgoing mails sent header ( $header['to'] ) first user. i'm going crazy thing... suggestions? (note: it's sending correct headers when calling $mime = new mail_mime() each user - should work calling once , overwriting old headers) code: // sql query , if num_rows > 0 .... require_once('/usr/local/lib/php/mail.php'); require_once('/usr/local/lib/php/mail/mime.php'); ob_start(); require_once($inclpath.'/email/head.php'); $head = ob_get_clean()

PHP MYSQL Access all columns in the same field using an array using FOR loop -

clear , direct question here. have loop using access data in array. know if more 1 column exists in same field, last 1 takes precedence. how 1 access data in columns same field? here loop for($counter=0;$counter<$found;$counter++) { $cellphonenumber=$details['cellphone_number']; $childname=$details['child_first_name']; $parentname=$details['first_name']; $msg="dear $parentname, child $childname due shots"; i have hundreds of records , need access each 1 of them , send msg. using mysql_fetch_assoc. heard can use numeric index of columns. how do that? your question not clear, code should this: $sql = "select email, cellphone_number, child_first_name, first_name table"; $result = mysql_query($sql); while ($row = mysql_fetch_assoc($result)) { $cellphonenumber = $row['cellphone_number']; $childname = $row['child_first_name']; $parentname = $row['first_name']; $msg="

Synchronizing time between two Windows 7 machines connected with a LAN cable -

i have number laptops run our application while connected each other in pairs ethernet cable, not connected external network or internet. t i need connected pair synchronize system times, since every computer needs able synch other computer, can't define 1 computer time-server , other client. is there way ntp? or other way? net time way go. if net time \computername /set ask confirm if want set time. "assign" 1 of systems master.

python - how using django-filebrowser at apache? -

hi all: have quirky question django-filebrowser, my project @ /home/q/django/myapp, save django-filebrowser @ /home/q/django/myapp/filebrowser . **myapp.settings.py** installed_apps=( ..... myapp.filebrowser, .... ) **myapp.urls.py** urlpatterns=patterns('', (r'filebrowser/',(include("filebrowser.usls")), .... ) everything tutorials http://code.google.com/p/django-filebrowser/wiki/installationbasic . but it's not work.when saved django-filebrowser django's directory:/usr/local/lib/python2.6/.... it's work fine. so,if want modify settings,i need change filebrowser.settings.py @ django root directory(/usr/local/lib/...),not project directory(/home/q/django/myapp/filebrowser) i think not advisable.someone me advice? &_& thks my os:ubuntu 10.04 django version :1.24 grappelli:3.x python version:2.6(own system) web server:apache+mod_python you can modify settings, includ

asp.net - Enterprise Library 3.1 Logging Formatter Template - Include URL Request -

we have custom web app built using ektron v8.0 uses el 3.1 , format template in logging config configured such: <add name="text formatter" type="microsoft.practices.enterpriselibrary.logging.formatters.textformatter, microsoft.practices.enterpriselibrary.logging" template="timestamp: {timestamp} message: {message} category: {category} priority: {priority} eventid: {eventid} severity: {severity} title:{title} extended properties: {dictionary({key} - {value} )}" /> is there template item request url? without request url querystring parameters, it's difficult debug errors. there no template item request url. can add request url extended properties information logged: string requesturl = system.web.httpcontext.current.request.url.absoluteuri; dictionary<string, object> dictionary = new dictionary<string, object>(); dictionary.add("requesturl", requesturl); logger.write(&qu

ruby on rails - Syntax highlighting in HAML's markdown filter -

i'm using haml's markdown filter, this: :markdown markdown text, yay! but want syntax highlighting code inside text, like: :markdown markdown text, yay! <code lang="ruby"> def hello(world) puts "hello #{world}" end </code> any ideas how it? know how use coderay, don't see how grab ahold of text. markdown support code blocks out of box, not support syntax highlighting. see http://haml-lang.com/docs/yardoc/file.haml_reference.html#markdown-filter markdown libraries haml looks parse markdown. if want pass code filter makes highlighted can write own filter extension haml. quite easy. http://haml-lang.com/docs/yardoc/haml/filters/base.html if though, put code in block , use javascript library geshi highlight code. http://qbnz.com/highlighter/index.php so can like: %pre.ruby puts "this syntax highlighted" and if have geshi included, highlighted.

android - Multiple calling of getView() in GridView -

my activity consists of gridview holds 40+ elements. after starting activity user see maximum 15 items (3 rows, 5 items in each row). wrote in getview() body pass logcat number of getting view: log.i("getview()", "getting view_position[" + string.valueof(position) + "]" + (convertview != null?convertview.tostring():"null")); after launching app such log: 02-09 14:34:56.900: info/getview()(388): getting view_position[0]null 02-09 14:34:57.300: info/getview()(388): getting view_position[0]android.widget.framelayout@44c7a9c0 02-09 14:34:57.300: info/getview()(388): getting view_position[1]null 02-09 14:34:57.400: info/getview()(388): getting view_position[2]null 02-09 14:34:57.510: info/getview()(388): getting view_position[3]null 02-09 14:34:57.620: info/getview()(388): getting view_position[4]null 02-09 14:34:57.720: info/getview()(388): getting view_position[5]null 02-09 14:34:57.840: info/getview()(388): getting view_position[6]null

blackberry - webpage designed for mobile platforms with reflow-like qualities -

i looking way use css , viewport properties force 1 div of formatted text content take exactly screen width , regardless of user specified zoom. reflow functionality pdf readers have. i'd prefer not use javascript. is possible? targeting blackberry browser specifically. can't tell blackberry browser specifically, here's bit of general considerations: don't give page fixed width, except maybe 100% ; check on actual device. don't measure things in pixels (except raster images), use pt , em , % possible. be careful floats , absolute-positioned things.

c# - How to distinct a list using LINQ? -

i have class event have 2 properties : "id", , "expirationtime". have list have many events, of them same id. want create an efficient linq query distinct events id, , each id keep event smallest expirationtime. thanks! the grouping easy enough, doing efficient "minby" standard linq objects messy: var lowestbyid = items.groupby(x => x.id) .select(group => group.aggregate((best, next) => best.expirationtime < next.expirationtime ? best : next)); it's cleaner minby operator, such 1 provided morelinq . var lowestbyid = items.groupby(x => x.id) .select(group => group.minby(x => x.expirationtime));

inheritance - Java: Using one Method for different types in the array parameter -

i cant't figure out maybe can me. the problem: public class class1 implements comparable<class1> { public int compareto(class1 o) { //some code } } public class class2 implements comparable<class2> { public int compareto(class2 o) { //some code } } public class foo { private arraylist<class1> abc = new arraylist<class1>();  private arraylist<class2> def = new arraylist<class2>(); } in following o = abc or def public int foo1 (arraylist<object> o) { o[0].compareto(o[1]); } this code keeps getting me error: the method compareto(class1) undefined type object i understand why can't find workarround don't have duplicate code, necessary because have more arraylist objects , longer code. i hope 1 of has idea. problem solved!!! solution : public <t extends comparable<t>> int foo1 (arraylist<t> o) { return o.get(0).compareto(o.get(1)); } by peter law

javascript - How to call a sibling method in an object defined with object syntax? -

how this? var obj = { func1 : function(){ // stuff }, func2 : function(){ func1(); // not work this.func1(); // not work } } edit: missed semicolon var obj = { func1 : function(){ // stuff }, func2 : function(){ obj.func1(); // works fine } }

jquery - Visually disable a checkbox but allow it to still submit its value -

i have checkbox updated other selections important show checked status user. want read in functionality , represented such in display. it works fine disabling checkbox (gives greyed out box assist user visually) means upon submitting value not saved. conversely, if set checkbox read-only disables checkbox still appears normal checkbox. i kinda want bit each, checkbox submits it's value looks disabled checkbox , still displays check status... have ideas? use hidden field <input type="hidden" /> . populate hidden same values expect checkbox. way visual element separate data element , not have these concerns.

visual studio - Deploying MS Lightswitch applications -

can microsoft lightswitch desktop applications deployed single executable?. no, current options are: desktop client, 2-tier desktop client, 3-tier browser client, 3-tier

php - MySQL 5.1 Order by query not working -

i trying run order query, , cannot seem figure out problem is. can tell, should work. no errors whatsoever order of table not change. the table has 6 columns of type char , unsigned auto_incrementing id. last_name column in query of type char(25). $query="select * employees order last_name"; $result = mysql_query($query); "but order of table not change" how getting results out of $result populate table? if output results using print_r in expected order? while ($row = mysql_fetch_assoc($result)) echo $row['last_name'] . "\n";

vector - Help With Small C++ Game -

i'm writing game of solitaire runs in terminal. of now, program compiles , runs , gives player 4 cards, placed in 4 columns , allows them press 0 more cards, added onto columns. column grows, it's output should placed in vector (actually, vector of vectors). ideally, after gathering more cards if necessary, player inputs number ranging 1-4 select column they'd compare others. should compare top card of column other top cards , see if 1 can deleted. part i'm having trouble with. first of all, i'm not sure if i'm inputing cards correctly vector of vectors , i'm not sure how compare them each other. i've tried using like: column[2].back().getsuit() acces suit of top card of column two, giving numerical value , comparing suit of other. did similar thing compare ranks of cards i'm not having luck. can show me example using or own code? how should compare suit , rank of top cards in each column? here code far: #include <iostream> #incl

javascript - Get file directory with MooTools -

is there whay file location or dir js or moo ? my file called this filepath:'link_to/file.swf'; issue when url sef , on page like domainname/this_is_the/page.html the path above file here domainname/this_is_the/page.htmllink_to/file.swf now can add own domain free script , can have people path in js files . trying make dynamic

reporting - I need to generate a report from a WCF service what are my options? -

i’ve created “winform” application communicates wcf service. the winform displays datagridview many rows. user able select (checkbox) rows wishes print, clicks print button. the selected rows sent method in wcf service in turn, returns collection of binary data (the documents printed). once returned, create pdf file on disk each binary data in returned collection. once done, newly created documents sent printer… note: before creating these pdf documents, need create “summary” report document printed before of pdf documents. to so, call method in wcf service return binary data. binary , create summary pdf document it… here question: best approach in order create “summary report”? so far, i’ve been trying design summary report using reporting services, i’m grasping @ straws of things wish in report (ie: trying add checkbox column , make “selected” or not depending on rule and/or make report bilingual…). i’m thinking maybe rs not flexible/intuitive thought would… my wc

groovy - web.xml changes to enable development mode in Groovlet -

i using cruise control jetty container deploy groovlet application. appears if change groovy files in webapp directory jetty not recompile source , changes aren't reflected in webapp. how can modify web.xml file check updates on every load? i'm using simple web.xml: <web-app> <servlet> <servlet-name>groovyservlet</servlet-name> <servlet-class>groovy.servlet.groovyservlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>groovyservlet</servlet-name> <url-pattern>*.groovy</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>myapp.groovy</welcome-file> </welcome-file-list> </web-app> groovyscriptengine checks last-modification date of source file. if newer last cache entry, recompile done.

c# - What is the overhead on PostAuthenticateRequest? -

i implementing custom ticket system using application_postauthenticaterequest method in global.asax file (asp.net mvc). i'm wondering overhead kind of thing - since deserialize information on every request. generates cookie of around 1.8 kb, ton - better alternative frequent database trips? information being deserialized user id (int) roles (string[]) email (string) associated ids (int[]) // (hard describe these are, each user have around 3 of them) it seemed smarter implement custom formsauthenticationticket system continuously round-trips database based on user.identity.name . i'm worried constant deserialization inhibitive. looks this... protected void application_postauthenticaterequest(object sender, eventargs e) { httpcookie authcookie = httpcontext.current.request.cookies[formsauthentication.formscookiename]; if (authcookie != null) { string encticket = authcookie.value; if (!string.isnulloremp

stop user feedback to copy command in batch file -

i use following batch command copy file @copy /y app_offline_template.htm app_offline.htm however gives feedback in batch file user eg. 1 file copied etc. is there switch prevent this? @copy /y app_offline_template.htm app_offline.htm > nul

asp.net - Updating Only Changed Rows Using GridView Control -

what best way of updating db changed rows using gridview? i have gridview control has inline editing , when user edit row there 2 options "update" or "cancel" user might click update button without updating row... how can make sure that, user changed row? i don't use sure gridview doesn't handle automatically if using built in edit functionality. try debugging onrowupdated , onrowupdating methods see if called when save clicked , nothing has been changed. if don't need them add them can put break point there see if triggered.

asp.net mvc - How do I measure traffic to my dynamic rss feeds? -

i've got website tagging system similar stackoverflow's. , i'm in process of creating ability user subscribe tag-based search through rss. think i've got figured out except 1 thing. because of flexibility i'm creating, potential number of different rss feeds coming site staggering (thousands , thousands). , can't input each of feedburner. i'd still measure traffic. in particular, want number of unique rss views, or unique subscribers. i'm not going picky being 100% accurate... think uniquely identifying rss traffic in way make figures more useful. at simplest level, determine uniqueness based off of ip address. if reading rss feed through online feed aggregator, won't ip address obscured? tracking ip address of aggregator, , if many people visited site through same aggregator, might same ip. suggest? i posted comment pubsubhubbub, think applies analytics. you'll able know how many service subscribe each feed. (note it&#

javascript - json keys as numbers -

i have json passed script. not know json keys dynamic. actually, numbers. that's i'm getting. var countries = {"223":"142,143","222":"23,26,25,24","170":"1,2"}; i tried access data this: var objkey = 223; (var objkey = "223";) countries.objkey; i tried changing json to var countries = {"country223":"142,143","country222":"23,26,25,24","country170":"1,2"}; ... , access this: var objkey = "country"+223; (var objkey = "country"+"223";) countries.objkey; ... again nothing. any advice appreciated. instead of this: countries.objkey; do this: countries[objkey]; with square bracket notation, can use value referenced in variable (or use string or number) reference property name.

php - A few questions about Form processing.? -

i know ways add more security forms prevent attacks. past few days of searching in web, , methodology adopt, i've found number of solutions know take before proceeding. is have include form keys prevent xss (cross-site scripting) , cross-site request forgery? which best way process form data: ajax place form processing code on top of same page , process using $_server['php_self'] set action of form page , process value there. process form value through single php class file. which best way filter or sanitize form data? thank you here normal set. use custom framework, basically. i setup models handle specific data. example, if have employee form creates new employees. have employee model. model has specified values requires in order generate new employee in database. if values missing in model, when try save it, throw exception. second layer of "input validation". first layer simple java script form validator, make sure values aren'

Stopping specific jQuery animations -

i have multiple animations on single object, , need stop specific animation rather of them. doesn't .stop() method can this. for instance, when animating opacity , width simultaneously, may need cancel opacity animation while still completing width animation. seem not possible, hoping knows trick or api call i'm missing. note: i'm not talking queued animations, i'm looking animate multiple attributes @ same time ability stop of attribute animations after have started i hate guy answers own question (thanks detailed responses , putting brain power it!) have found direct answer. apparently there parameter .animate() method called "queue" defaults true can set false in order have animation take place immediately. this means setting queue false can run multiple animations using separate calls without having wait previous 1 finish. better yet, if try run animation property being animated, second override first. means can stop property's

c# - Query facebook wall of a specific profile -

i need post on website wall notifications of facebook group, group , website belong same entity. i've looked @ many of options available, apreciate if bit facebook developing experience told me best path (most straighforward). the website not intented interact facebook in other way, there exist no facebook login button, , 1 wall 1 being consulted. i've looked @ possibility of grabbing rss feed wall, option doesn't seem exist. the website being done asp.net (c#). and social plug-ins purpose. requirement can use live stream plugin. here: http://developers.facebook.com/docs/reference/plugins/live-stream/ enter link description here

I need a pattern for constructing trees of objects -

i've got code (c#) builds tree of polymorphic objects. depending on type, object may have 0-7 children. right now, objects' constructors nothing, , construct whole object tree using recursive helper function: // pseudocode void buildtree(node root) { if(root a) { root.a_data = ... root.a_child = generatenewnode(some_constraints); buildtree(root.a_child) } else if(root b) { // same stuff, b. note b may have different chldren, etc } } this seems inelegant, i'm looking pattern can me here. buildtree function seems policy of kind, , i'd able use different policies in future. oh, complicating factor. there things in buildtree conditional on earlier things buildtree has done. example, if i've ever generated b, need xyz c nodes. or if i'm generating children of a, don't generate d. sounds need stick polymorphic method on each node, every node becomes capable of building itself. public class no

How do I wrap a span around the last word of an element's inner text, using jQuery? -

i know should simple task i'm having problems selecting heading elements last word , wrapping in span can add style changes. here's have far $('.side-c h3').split(/\s+/).pop().wrap('<span />'); any appreciated the problem jquery objects wrap dom nodes. each word in element not dom node itself, you'll need little more work break apart text , rejoin it. need account multiple nodes being selected jquery. try this: $('.side-c h3').each(function(index, element) { var heading = $(element), word_array, last_word, first_part; word_array = heading.html().split(/\s+/); // split on spaces last_word = word_array.pop(); // pop last word first_part = word_array.join(' '); // rejoin first words heading.html([first_part, ' <span>', last_word, '</span>'].join('')); });

ruby on rails - Capitalize f.text_field -

i have form_for , want value inside x.textfield appear first letter in upcase (i'm talking edit textfield prefilled db values). you can capitalize this: <%= form_for ... |f| %> <%= f.text_field :name, :value => f.object.name.capitalize %>

linux - using C code to get same info as ifconfig -

is there way in linux, using c code, same information "ifconfig eth0" return? i'm interested in things ip address, link status, , mac address. here's sample output ifconfig: eth0 link encap:ethernet hwaddr 00:0f:20:cf:8b:42 inet addr:217.149.127.10 bcast:217.149.127.63 mask:255.255.255.192 broadcast running multicast mtu:1500 metric:1 rx packets:2472694671 errors:1 dropped:0 overruns:0 frame:0 tx packets:44641779 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 rx bytes:1761467179 (1679.8 mb) tx bytes:2870928587 (2737.9 mb) interrupt:28 yes, ifconfig written in c. :) see: http://cvsweb.netbsd.org/bsdweb.cgi/src/sbin/ifconfig/ifconfig.c?rev=1.169&content-type=text/x-cvsweb-markup do man netdevice see details (on linux). use ioctl() system call.

java - Serialize an array of ints to send using KSOAP2 -

i'm having problem trying send array of ints .net web service expects array in 1 of arguments. that's @ least understand api description on web service says this: <dataindexids> <int>int</int> <int>int</int> </dataindexids> so when send single int below not errors , think works fine. request.addproperty("dataindexids", 63); but when try send array of ints: request.addproperty("dataindexids", new int[] {63, 62}); // array of ints or arraylist of integers: arraylist<integer> indexes = new arraylist<integer>(); indexes.add(63); indexes.add(62); request.addproperty("dataindexids", indexes); // arraylist of integers i thrown "java.lang.runtimeexception: cannot serialize" exception. please? doing wrong? thanks! i'm sending android client .net server, worked me soapobject myarrayparameter = new soapobject(namespace, my_array_param_name); for( int : mya

netbeans 6.91 and gdb - attaching to a process run by another user -

i trying debug program run user, using netbeans. can manually @ command line, running sudo gdm , attaching pid. however, make use of netbeans gui easier/quicker/visual debugging. when select pid list of running processes, error: gdb failed attach process when attempt attach manually (i.e. running gdb @ command line - without sudo), 'operation not permitted', know netneans failing attach because of permissioning. does know how can attach processes being run user?. btw running on dev machine @ home (ubuntu), security not issue. have tried running netbeans target user? you can "sudo -u username netbeans" that, shouldnt have problem attaching process. if target user in computer, suggest ssh x forwarding (ssh -x user@machine). actually, if target (local) user has no password set, can try changing gdb command "sudo -u username gdb" start debugger user.

Android ListView filter fail with NPE -

in app have listview, adapter it, , filter adapter. filter: private filter namefilter = new filter() { @override protected void publishresults(charsequence constraint, filterresults results) { list<contact> resultcontacts = (list<contact>) results.values; filteredcontacts = resultcontacts; notifydatasetchanged(); } @override protected filterresults performfiltering(charsequence constraint) { list<contact> filteredcontacts = new arraylist<contact>(); for(contact c : rawcontacts){ if(!c.getname().tolowercase().contains(constraint.tostring().tolowercase())){ continue; } filteredcontacts.add(c); } filterresults filterresults = new filterresults(); filterresults.values = filteredcontacts; return filterresults; } }; do understand correctly publishresults invoked after performfiltering done job? job veeeery hard

ruby on rails - input from form being converted to decimal on insert -

i have db column upc codes setup 'numeric' data type in postgres. i generated scaffolding input values table, rails converting input in float reason, eg, 13 digit number entry 1234567890000 converted 1234567890000.0 from logs: insert "upc_codes" ("upccode") values (1234567890000.0) returning "id" where data type sql statement being set, or not set case may be? what data type using column? try changing column type integer in migration: change_column :upc_codes, :upc_code, :integer

ios4 - How do I make it so that every time my app is opened, it goes to the 'main menu'? -

right now, every time iphone app opened in simulator, goes window last opened. how make goes 'main menu' every time app opened? you can opt out of fast app switching: how disable fast application switching (multitasking) on ios 4? this force app launch fresh each time.

c# - Using MS Moles with datacontext and stored procedures without using a Connection string -

i have begun work ms moles testing , have followed idea/pattern in jcollum(thanks) uses mole table in stackoverflow question here . but having problem not want have pass connection string when use datasource such: using (thedatacontext datacontext = new thedatacontext(myconnectionstring)) { datacontext.executestoredprocedure(value, ref valueexists); } i fact need mole table , else done me. realize mole executestoredprocedure method, wondering if somehow avoid sql exception getting here when not pass in connection string. or, if there better way this? therefore, have solution can avoid placing in connection string? in advance.

iPhone CoreData migration of data only -

i have iphone application uses coredata storage. the persistent store (an sqlite3 database) shipped several of entities populated data. these data used create various menus , options in application. let's call these data "application data". several other entities used application store user data. although schema changes, need update application data provide new options users. i have macruby script gets new data bunch of csv files , updates sqlite3 database on development machine, not sure best way update existing deployed apps new application data (remember, no schema change) without affecting user data. any ideas? _ update _ after bit of thinking, getting oriented towards setting application download new sqlite3 file web server contains new data. once received, app copy data update sqlite3 file app's working database file, replacing application data, not touching user data. a mechanism determining if update has been applied can use text file singl

Python module logging with eclipse -

i trying logging going across couple of different modules using logging.config.fileconfig() directory looks this: > package > source __init__.py somesource.py > test __init__.py sometests.py __init__.py inside in package.__init__.py have following: directory = 'c:/user/me/workspace/package/' logfile = 'logger.conf' logging.config.fileconfig(directory+logfile) log = logging.getlogger('package') log.info('logging initialized.') import test inside in package.test.__init__.py have log = logging.getlogger('package.test') log.info('test module started') so expected output like: logging initialized. test module started. i can run , log correctly while using eclipse using ctrl+f11. however, calling interpreter results in nothing @ all: >>> import package the log file remains empty. ideas? check python directory. in there.

linux - Include additional files in .bashrc -

i have stuff want perform in .bashrc prefer exist in file on system. how can include file .bashrc? add source /whatever/file (or . /whatever/file ) .bashrc want other file included.

nservicebus - Publisher messages not reaching subscriber -

publisher config <!-- 1. in order configure remote endpoints use format: "queue@machine" 2. input queue must on same machine process feeding off of it. 3. error queue can (and should) on different machine. 4. community edition doesn't support more 1 worker thread. --> <msmqtransportconfig inputqueue="homeofficepublisherqueue" errorqueue="error" numberofworkerthreads="1" maxretries="5" usejournalqueue="true" /> <dbsubscriptionstorageconfig> <nhibernateproperties> <add key="connection.provider" value="nhibernate.connection.driverconnectionprovider"/> <add key="connection.driver_class" value="nhibernate.driver.sqlclientdriver"/> <add key="connection.connection_string" value

java - Include Swing when compiling with javac -

i compile , jar source fine, when run it, complains: java.lang.classnotfoundexception: javax.swing.jpanel i guess have include swing library when compiling, how do that? i included every rt.jar on system: javac -classpath /usr/lib/jvm/java-1.5.0-gcj-4.4/jre/lib/rt.jar:/usr/lib/jvm/java-6-sun-1.6.0.20/jre/lib/rt.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar:/home/me/equinox.jar *java still compiles fine, still crashes when run. it looks using gcj . it's old project attempted produce java implementation pure open source. they got halfway, implementation far perfect. these days, it's better avoid entirely , instead use openjdk (or oracle/sun jdk , if open source not requirement). on ubuntu can use update-java-alternatives configure system different java implementation: sudo update-java-alternatives -s java-6-openjdk by way, never need specify rt.jar explicitly on classpath, it's available automatically. also, using multiple rt.jar differen

jQuery sortable receive events -

i have li list jquery sortable attached it. receive function never executed. when drag list item 10 2nd position way expect code execute execute receive function. never gets executed. doing wrong? // same our playlist. $(".admin-left").sortable({ opacity: '0.5', tolerance: "intersect", handle: ".handle", appendto: 'appenttoholder', items: "li.admin-song", update: function(event, ui) { $(ui.item).css("opacity", "0.0").animate({ opacity: "1.0" }, "medium"); if ($.browser.msie && $.browser.version == "7.0") { $(ui.item).css("margin-bottom", "-6px"); } }, receive: function(event, ui) { addtoleftlist(ui.item); }, start: function(event, ui) { $(".admin-left li.ui-selected").removeclass