Posts

Showing posts from July, 2012

graphics - .net2.0 vs .net 4.0 gdi+ difference? -

i have weird problem have application lot of involved gdi+ manipulation of pictures. such cropping zooming etc. application works fine in .net 2.0, in .net 4.0 getting reports users crashing gdi+ "out of memory" error. know "out of memory" gdi+ error catch alot of errors, why work in .net 2.0 , not on .net 4. specifically have control draws "layers" on top of each other in order create composed bitmap. control worked fine in .net 2.0 , not in .net 4. it secifically happens when have 10 megapixel jpeg loaded file system , applying zoom , transform image. to give more detail. g.draw matrix scale of 4 meaning 400% bigger rotation return "out of memory error. it happens on xp boxes , not on windows 7 boxes. difference here? any takers... here extent of stack trace logged caught exception. <event> <timestamp>11/30/10 11:02:43.706</timestamp> <source>appro2</source> <eventtype>er

c# - Generating Permutations using LINQ -

i have set of products must scheduled. there p products each indexed 1 p. each product can scheduled time period 0 t. need construct permutations of product schedules satisfy following constraint: if p1.index > p2.index p1.schedule >= p2.schedule. i struggling construct iterator. know how via linq when number of products known constant, not sure how generate query when number of products input parameter. ideally use yield syntax construct iterator. public class potentialschedule() { public potentialschedule(int[] schedulepermutation) { _schedulepermutation = schedulepermutation; } private readonly int[] _schedulepermutation; } private int _numberproducts = ...; public ienumerator<potentialschedule> getenumerator() { int[] permutation = new int[_numberproducts]; //generate permutation combinations here -- how? yield return new potentialschedule(permutation); } edit: example when _numberproducts = 2 public

normalization - Is this database schema practical? -

as sort of follow previous question: normalizing variety of properties similar data types i've created setup now: http://schemabank.com/p/vwwhn my question on right path method? there obvious mistake setup i'm using, or concepts of normalization i'm missing? i'm trying go practical approach works in real world scenarios, if there better method configure database i'd happy hear it. you might want have platforms_data table, allow associate game across more 1 platform. might conscious choice not have this, thought i'd mention it. the other thing release dates, assume have separate release_dates table can select release date. if not part of plan, may not need table , include in game model. another thing consider games released in different countries on different dates. since bringing multiple countries schema rating purposes, perhaps consider adding country table , removing country specific ratings tables. have single ratings table, each rat

c# - Creating instances of classes at runtime -

i have created class (conflictingbooking) contains fields various information in regards specific reservation. i loop through database , select reservations based on criteria. i want create instance of class selected criteria. i want add each of class instances list use elsewhere. problem have @ step 3. want name new instance "found[i]" incremented each reservation found: conflictingbooking found = new conflictingbooking(); found.bookingnumber = conflictingbookingnumber; found.bookingstarts = conflictingbookingdt; conflictingbookings.add(found); in above code, need replace 'found' programatically. whilst appreciate simple code snippet follow, read reference know i'm doing :-). don't know how google problem. seems have not been entirely clear - here appropriate code: dbmanager.open(); dbmanager.executereader(commandtype.text, string.format("select bookingdate, {0} bta

vhdl - How is a variable shown in a RTL viewer in Quartus? -

how variable depicted in rtl viewer in quartus. open rtl viewer , not show register variable. for example: variable op_code : std_logic_vector(7 downto 0); is there reason why rtl viewer not show op_code in rtl viewer? using vhdl. edit: op_code(7 downto 0) <=instr_reg(31 downto 24); if ( op_code = add or op_code = mysub) <br> c_addr <= instr_reg(14 downto 10); <br> end if; case op_code(7 downto 0) --some case statments end case; has been optimised away? if elements of opcode used other things, may have been subsumed other logic , not visible in own right anymore. another thought - if haven't described behaviour of register (which variable comes down reading before writing in clocked process) no register created. it'll combinatorial logic within process, , combined other things. maybe post whole process (or bit more of it) - might able more way.

Using lightbox2 to display text instead of images -

i trying use lightbox2 display block of text after clicking heading element: something like <a href="something"><h3>name</h3></a> i have used lightbox images captions time caption come without associated image after clicking name on webpage. thanks replies. i don't think lightbox2 made such thing, why don't try http://fancybox.net/ 1 works 100%.

parsing - c language : read file content as numbers and add them together -

i have following in text file called: values.txt 1 4 2.5 3.76 122 10 277.543 165.4432 i trying read content of text file, , add each 2 pairs , output result ... output : 1 pair:(1, 4) = 5 2 pair:(2.5, 3.76)= 6.26 and on .. i opening file int c; file myfile; myfile= fopen("values.txt", "r"); if ( myfile == null ) { printf("cannot open text file\n"); return 1; } double aa,bb; while ( (c = getc(myfile) ) != eof ) { // here should output how? } any appreciated .. language = c the following code expect. myfile should declared file*. fopen returns pointer file structure. if file large, recommend reading in buffers of big size (eg: 65535 etc) , parse char char , convert float values. reduces system call overhead takes more time processing text float values. #include <stdio.h> #include <string.h> main(int argc, char *argv[]) { file* myfile; myfile = fopen("values.txt", "r")

What is wrong with this PHP MySQL Query? -

i keep getting mysql error when using query: $query = "insert subscribe (`firstname`,`lastname`,`username`,`password`,`email`,`expiration`,`status`,`policy`,`dlpolicy`,`extension`,`key`,`temp`) values ('".mysql_real_escape_string($fname)."','".mysql_real_escape_string($lname)."','".mysql_real_escape_string($user)."', '".mysql_real_escape_string($pass)."', '".mysql_real_escape_string($email)."','".$exp."', '".$userkey."', '3', '1', '.exe,.mp3,.torrent,.mov,.zip','0', '0'"; here error: you have error in sql syntax; check manual corresponds mysql server version right syntax use near '' @ line 1 any ideas? looks forgot closing ) values . this should work: $query = "insert subscribe (`firstname`,`lastname`,`username`,`password`,`email`,`expiration`,`status`,`policy`,`dlpolicy`,`e

Can current Java/Tomcat 6 application utilize 64bit windows platform advantage in term of performance and memory usage -

currently have developed application using java 6 based on windows 32bit(dual core & 3g ram). if install 64bit windows os, perform better because of resources advantage having in 64bit(same os diff. bit)? 64bit machine having quad core processor , ram more 4g. different jvm between 32bit vs 64bit. thank in advance feedback. extra info i doing security information event management sys.(siem) - log management. have 4 important parts , collector -to collect logs devices/system, aggregator -to aggregate syslog meta data reporting, real time monitoring-to display realtime analisys report/charts , dashboard must run every second gui - struts2 apps. runs web gui, log analytics, backup , other things so far resources cpu , memory used 1-collector, 2-realtime, 3-aggregator. right in 32bit, collector can recieved 2000logs per seconds. if more crash memory heap. used tanuki software auto restart collector service. use tanuki split memory usage , auto restart once detected m

algorithm - Question on Tree Data Structure: How can we fill all inorder successor pointer of all tree nodes? -

tree node contains 3 pointers *left, *right , *successor . struct node{ int data; struct node *left; struct node *right; struct node *successor; }; / \ b c / \ / \ d e f g inorder traversal: dbeafcg * note: * inorder successors f,c , g. **function prototype:** void fillsuccessornodes( struct node *root); tree's root node given , need fill successor pointer nodes. case 1) of successor pointers may null . case have fill pointer immediate inorder successor. example: if a->successor == null, fill a->successor = f case 2) of successor pointers may points correct successors. case no need modify successor pointers. example: 1) a->successor = f valid 2) a->successor = c valid 3) a-successor = g valid . these 3 cases no need modify successor pointer since these pointing correct successor nodes. case 3) of successor pointers not null these pointers pointing invalid success

Replacing / retrieving table from another database connection inside a model within Rails -

let's i'm within rails project in model named apple. i'm going switch databases server i'll call: activerecord::base.establish_connection() i want access table 'banana' in particular database. can see table exists calling table_exists? however, i'm not sure how access table... want able banana.find(:all) how should work out? have tried connection_ninja gem? pretty handy multi-db connections: https://github.com/cherring/connection_ninja

iphone - how to fit pdf page in entire view -

i read pdf files , displayed, code this: - (void)drawlayer:(calayer *)layer incontext:(cgcontextref)ctx { nslog(@"the layer height %d, %d,%d ,%d",layer.bounds.size.width,layer.bounds.size.height,layer.bounds.origin.x,layer.bounds.origin.y); int c=[currentpage intvalue]+1; nslog(@"drawing started"); if(uiinterfaceorientationisportrait([self interfaceorientation])){ layer.backgroundcolor=[uicolor blackcolor]; mypageref = cgpdfdocumentgetpage(mydocumentref, c); nslog(@"draw layer"); cgsize pagesize = [kbdatasource pagesize]; gloginfo(@"the page ize getting in draw layer %@ ",nsstringfromcgsize(pagesize)); //cgcontextsavegstate(ctx); cgsize aspectfitsize = [self getpagefitsizeofsize:pagesize insize:cgsizemake(self.view.bounds.size.width, self.view.bounds.size.height- __top_branding_bar_height)]; cgcontextsetrgbfillcolor(ctx, 1.0, 1.0, 1.0, 1.0); cgcontextfillrect(ctx, cgcontextgetclipboundingbox(c

jquery - my js is working fine on chrome and safari -

my jquery working fine on chrome , safari not in ie , mozilla. reason.i following this example. ie showing prompt save, open file. edit: assuming wan't form should shake when login fails. look in vibrate.js file, uses webkittransform (safari , chrome both based on webkit): webkittransform: 'rotate(' +rotate +'deg) there better ways rotation in browser supports css3, take @ example: http://www.robertnyman.com/css3/css-transitions/css-transitions-mac-os-x-stacks.html so, line: t.css({position: 'relative', left: leftpos +'px', top: toppos +'px', webkittransform: 'rotate(' +rotate +'deg)'}); should instead this: var r ='rotate(' +rotate +'deg)'; t.css({position: 'relative', left: leftpos +'px', top: toppos +'px', "-moz-transform": r, "-webkit-transform": r, "-o-transform": r, "transform": r});

active directory - How to replace accountExpires in LDAP / AD using ldapadd? -

my ldif-file is: dn: cn=test person,ou=foo,dc=bar,dc=oof,dc=rab,dc=de changetype: modify replace: accountexpires accountexpires: 9223372036854775808 the output: root@comp:~# ldapadd -h host -f test.ldif sasl/gssapi authentication started sasl username: [...] sasl ssf: 56 sasl installing layers modifying entry "cn=test person,ou=foo,dc=bar,dc=oof,dc=rab,dc=de" ldapadd: invalid syntax (21) additional info: 00000057: ldaperr: dsid-0c090b7c, comment: error in attribute conversion operation, data 0, v1db0 what doing wrong? wrong syntax? all other things dn, connection, host et cetera checked , okay. thank answers! it seems passed maximum (set default ad when creating user), because did work: dn: cn=test person,ou=foo,dc=bar,dc=oof,dc=rab,dc=de changetype: modify replace: accountexpires accountexpires: 9223372036854775807 (... , way: it's long.max_value). bad idea increment on test ...

SQL Server 2005 after-install logon failed -

i've installed sql server 2005 x64 sp3 on windows 7 professional. i've chosen "windows-based authentification scheme". then, have domain account, , i've added "administrators" local user group. the problem is: can't login sql server. error is: "login failed user 'domain\user'. (microsoft sql server, error 18456)" there fix available problem. see ms kb article detailed information it.

javascript - How can I make css3 transitions on height (and other dimensions) smoother on the iPhone? -

i'n trying create simple slide panel slides in bottom of screen , covers viewport. i'm loading content panel via ajax. i'm setting panel element height:0 , absolutely positioning @ bottom of viewport , css3 transitions applied to, i'm setting height height of viewport triggering animation. unfortunately, animation slow , laggy point it's pretty unacceptable. i'm applying following css panel: -webkit-transition-duration: 0.3s; -webkit-transition-timing-function: ease-in-out; -webkit-transition-property: height; the amount of content seems have affect. or maybe it's type of content? i'm not sure. don't think ajax having causing problem although wrong. any ideas? cheers. the sluggishness surely has fact browser has re-wrap text in order accomodate new height. try animating position or translate, not height. here quick prototype: http://jsfiddle.net/6gdgr/ you might encounter flickering slide problem, find answer in stackov

svn - Using Subversion and TortoiseSVN, how do you clear your local action history? -

i merge changes of file branch trunk-branch. i wrongly resolved conflict, , want start scratch, revert trunk-file it's original state. i redo step 1, nothing happens. in merge window, check log, branches want merge file grayed out. tortoisesvn's way of telling me "you merged these changes file, no need 2nd time." since nothing comitted, has client-side issue. tried cleanup, didn't help. found it, merge information kept in parent directory's property svn:mergeinfo. in windows xp can access using directory's context menu -> properties -> subversion. reverted file, tortoisesvn did not clear info.

database - can I access a remote mysql server/db from a stored procedure? -

is possible connect remote instance of mysql server stored procedure using sql statements, select , insert access? ideally, (pseudo-code): connect remotedb@remotehost select field1 remotedb.table1 ... i guess can develop user-defined function in c/c++ odbc. i'd prefer native syntax if possible, though. thanks! yes. using federated tables feature.

javascript - How do I write a regex expression saying 'and NO whitespaces'? -

i wondering how write regex expression says 'and no whitespaces'.i need implement following if statement, see below: $('#postcode').blur(function(){ var postcode = $(this), val = postcode.val(); if((val.length >= 5) && (*******)){ postcode.val(val.slice(0, -3)+' '+val.slice(-3)).css('border','1px solid #a5acb2'); }else{ $(this).css('border','1px solid red'); } }); any appreciated, thanks try this: && (!val.match(/\s/)) match return null if there no spaces (or @ least 1 space), can use condition.

c# - how to add condition in object declaration ? EF - -

i (below)... don't want full write out template.title = xxx, template.descrption =xxx etc. but can't compile, because condition not correct. seems can add condition this (lang == "e") ? doctype = "spot-ii: " : doctype = "spot-iiii " within declaration etc... does know how (lang=="e") condition working below? foreach (var item in s) { template = new rsstemplate() { title = item.titre, description = item.description, (lang == "e") ? doctype = "spot-ii: " : doctype = "spot-iiii " }; t.add(template); } maybe work: foreach (var item in s) { template = new rsstemplate() { title = item.titre, description = item.description, doctype = (lang == "e") ? "spot-ii: " : "spot-iiii "

c# - Adding a Customized Control To Designer View -

in visual studio (actually 2010, guess goes previous version) whenever use extended control such : public class mainform : form { ... class mylistbox : listbox { //my desired behavior } } i have following error in designer view : could not find type 'amc.controls.amcstockchart+xchart'. please make sure assembly contains type referenced. if type part of development project, make sure project has been built using settings current platform or cpu. any workaround appreciated. ps : not want create user control, place in dll stuff, way work little detail that. well if want workaround, don't need put custom control in other assembly, long not inner class of form seems work. of course, you'll need compile current project before being able use through designer. this works me: public partial class form1 : form { public form1() { initializecomponent(); } } class mylistbox : listbox { }

git - how to undelete a deleted remote branch -

This summary is not available. Please click here to view the post.

c++ - Tutorials / books on understanding assembly output -

there times when understanding disassemblies higher languages such c or c++ useful. reading book on assembly necessary part of understanding compiler output, in experience writing assembly code scratch quite different thing reading , understanding opcodes compiler produces. books know on assembly don't cover part well, altough believe if ever in touch assembly trying understand compiler output. do know in-depth tutorials (or maybe books) on how interpret compiler output? what have in mind presentation of common high language idioms , how translated assembly common compilers (msvc , gcc). many similar questions here on so: learning assembly resources learning arm assembly good x86 assembly book most posters aim same thing you, read assembly code , not write new one.

php - Testing if a Select Query found results -

hi i'm new php , appreciate if tell me i'm going wrong in code. put code in context, i'm using facebook authenticate users , adding signup details app database. in following code intend check if user exists in database , if not add them. reason can't test $result i've checked query variables , echo out without problem @ $con = new mysqli('localhost', 'username', 'password', 'database'); if(mysqli_connect_errno()){ echo 'error: not connect database. please try again later'; exit; } $query = "select * users oauth_provider = 'facebook' , oauth_uid ='".$uid."'"; $result = $con->query($query); if($result === false){ $insertquery = "insert ('oauth_provider', 'oauth_uid', 'username') values ('facebook', '".$uid."', '".$username."')"; $result = $con->query($query); } i should add hav

windows - Ways to add a certificate to the certificate store from a script -

i want install certificate in certificate store. there way script. meaning 1 of following true: there console utility, can invoked batch script. there com object, can instantiated vb script. adding certificate store boils down basic operations (like registry or file system changes), can performed script. there may exist other options, not see. in anyway, want able install certificate store of choice in unattended mode. thanks. certmgr.exe can used command line.

c# - .NET Denying Access to Directories After Copy Operations -

i'm performing "safe" copy of directory on directory follows: given source c:\source , target c:\target copy c:\source c:\target-incoming move c:\target (if exists) c:\target-outgoing move c:\target-incoming c:\target delete c:\target-outgoing (if exists) if of first 3 steps fail, i'll attempt put things prevent data loss. however, move of c:\target-incoming c:\target fails "access path c:\target-incoming denied" of time. at moment, inserting thread.sleep(100) before move operation fixes problem me. however, waiting .1 of second seems ridiculous me. thread.sleep(10) isn't enough fix it. have sinking feeling value have wait depends on speed of disk io. so, questions: can prevent happening? if not, there way of finding out when lock on directory released after copying it? edit: clarity, i'm doing these operations in 1 method on 1 thread, , i'm using thread.sleep() pause code flow moment. moves , copies being done standa

jscrollpane - Jscroll is not working in chrome and safari -

i tried teh jscroll plugin kelvin luck. first of wonderful script. working fine text, ie text contents, in browesers. when insert images in scroll not working in safari , chrome... please me. beginner in javascrpt...:) retheesh another way of doing initialise plugin once entire page loaded $(window).load(function(){ $('.scroll-pane').jscrollpane(); })

.net - VB.NET: Input string was not in a correct format -

with following snippet foo = iif(string.isnullorempty(txtfoo.text), 0, integer.parse(txtfoo.text.trim)) i error when submit field without value: "input string not in correct format." don't have space or else , string.isnullorempty(txtfoo.text) returns true. wrong? thank you. iif evaluate: integer.parse(txtfoo.text.trim) irrespective of whether: string.isnullorempty(txtfoo.text) is true or not (as function 3 arguments passed it, arguments must valid). if txtfoo.text empty , it's still trying parse integer in case. if you're using vs2008, can use if operator instead short-circuit you're expecting iif do.

c - Number of processes running -

i have c program n number of loops. how many processes , child processes running program , how? the c language not support multi-processed program. should depend on api's provided os implement multi-processed version. can use fork function under linux , createprocess in windows environment , corresponding platform dependent api's can give details on how use these functions. luck!

Ruby interpreter name -

possible duplicate: how find ruby interpreter? how running ruby 1.8 interpreter name in ruby (e.g. /usr/bin/ruby ), i.e. argv[0] passed c main() function. i'm not interested in $0 , because that's name of .rb script file. i'm not interested in config::config , because filled when ruby installed -- i'm interested in running now . let's suppose /usr/bin/ruby symlink /usr/bin/ruby1.8 . how know if ruby script has been started /usr/bin/ruby1.8 myscript.rb or /usr/bin/ruby myscript.rb ? see how find ruby interpreter? require 'rbconfig' ruby_interpreter_path = file.join(config::config["bindir"], config::config["ruby_install_name"] + config::config["exeext"]) if want ruby specific information check out ruby_* constants >> ruby_ ruby_copyright ruby_engine ruby_platform ruby_revision ruby_description ruby_patchlevel

windows - Can two DCs share one GDI object (brush, pen, etc.)? -

can 2 device contexts (dcs) share 1 gdi object, such brush or pen? the documentation selectobject mentions bitmaps cannot selected more 1 dc @ time. essentially because gdi operations can write bitmap, , complex manage multiple write operations @ time. other gdi objects, once created (with exception of regions - copied), immutable, therefore have no restrictions on being selected multiple dcs @ time.

python - Determining HTTP request charset -

is there way reliably determine in character set browser sends data? i'm jumping around accept-charset/accept-language headers in conjunction server locale (as web-sites not that world-wide), still nothing comes in mind. specifically, msie sends data in locale's charset if user types in address bar custom values (that's why started count in accept-language header). second question is, can determine charset both , post or there chance data in different encodings?

sql server - Find the connection-string -

i creating database application in vb 2008. how find connection-string application? facts have include in connection-string? you don't database connecting to. find lots of details on variety of databases here: http://connectionstrings.com/ also, put connection string app.config or web.config file. see msdn how read connection strings web.config

Correct calculations of floats in OpenGL ES -

i'm making game in 3d. correct in code, although i'm confused 1 thing. when setting perspective (gluperspective) set znear = 0.1f , zfar = 100.0f . far good. now, wanna move things in x or y direction via gltranslate... . but, origo starts in absolute centrum of screen. have zfar , znear , why isn't x , y coordinates? if move sprite -2.0f left on x-axis , make gltranslate... handle that, out of screen. , z-axis not behave that. that's make lot more difficult handle calculations in directions. it's quite hard add unique float value object , add these randomly make them stay inside screen. so, have problem calculate corrects value each object. have missed something? should change or thinkig of something? reason important because need know absolute left , right of screen make these calculations. this onsurfacechanged : public void onsurfacechanged(gl10 gl, int width, int height) { gl.glviewport(0, 0, width, height); gl.glmatrixmode(gl10.gl_projec

ios4 - Cant find my project in the Instruments for memory profiling -

i trying run leak checks on app, not find in "choose target section". have other apps listed except mine. i'm using xcode 4. did product->perform action->profile without building when instruments app comes should notice app in selected dropdown , you'll have drag , drop tools want use monitor app library.

php - Show content only if logged in -

hello have question. have set login system cookies , works. wonder there more clean version of doing this. <? include('../config/db_config.php'); $username = $_cookie['user']; $password = $_cookie['pass']; $result = mysql_query("select * users isadmin = 1"); while($row = mysql_fetch_array($result)) { if($username == $row['username'] && $password == $row['password']) { //user entered correct username , password echo("allow"); } else { //user entered incorrect username , password echo("deny"); } } ?> you see want content shown if logged in admin. what, way of doing echo'ing out html/php/javascript instead of echoing allow because if include("somepage.php") there page still avialable usage without logging in, , if same check there still echo'ing out everything. why loading every user, comparing username , passwor

Convert select list to JSON using jQuery -

how can .val()'s , .html()'s of options multiple select list json object? preferably using jquery. thanks in advance! a little more info: i using 2 multiple select boxes. selecting items on left box , moving them right. once have items want selected push submit , take items in right select box , move them main list. here code using once json object: datalistobject = json.parse(response); if (datalistobject.length){ $(".data-list tbody").empty(); (var i=0; < datalistobject.length; i++) { var newrow = "<tr><td><input type='checkbox' name='user_id' value='" + datalistobject[i][0] + "' class='data-list-check'></td><td>" + datalistobject[i][1] + "</td></tr>"; $(newrow).appendto($(".data-list tbody")); } } example html , output be: <select name="selecteditems"> <option value="op1"&

visual studio 2010 - VS2010 - Package/Publish Web - Options Disabled -

the boxes "include iis settings in iis manager (used iis web projects) disabled wcf service , webapp created. are these not "web projects"? why box disabled, , how enable it? i'm trying test of msdepoy, , want copy name of application pool dev system. (i have iis6/winxp on dev machine.) i able "include iis settings in iis manager (used iis web projects)" check box enabled opening project properties , going web tab. (my setting servers "use visual studio development server". applies "use custom web server" well.) when changed servers "use local iis web server", setting enabled. i re-opened project properties windows before going "package/publish web" tab, step may unnecessary. i hope helps save time. 1 took while me figure out.

iis 7 - iis7 integrated mode asp.net 4.0 forms authentication problem using IE8 -

anyone experience issues iis7, integrated mode forms authentication while using ie8? have website login form, once logged in, postback causes user logged out. doesn't happen consistently, can login , not experience issue, other times happens instantly. can not replicate problem in other browser , cannot replicate on development machine running / debugging vs2010. is application on server farm? if so, ensure web.config's have matching machine keys - http://msdn.microsoft.com/en-us/library/w8h3skw9(v=vs.100).aspx

android - How to find installed application's name in device? -

i develop android application,so need 1 form you,i want find what applications installed in our device , want uninstalled given application name user using intent .how possible? thanks to list existing applications. check this this blog post may helpful uninstalling applications:

c switch statement -

void display() { printf("every thing ok"); } void main() { int ch; while(1) { printf("enter choice"); scanf("%d",&ch); switch(ch) { case 1: clrscr();printf("when choice 1 every thing fine"); display(); break; case 2: clrscr();printf("when chice 2 confusing"); display(); break; case 3: exit(0); default: printf("enter choice 1 or 2 or exit enter 3"); } } } when trace c program , enter choice 2 calls display function case 1 block. not understand this. please reply explanation. confused. the compiler re-arranging source statements collapsing basic blocks . debugger matches calls display() in both cases same source line number. usual when optimization enabled.

sql server - SSIS: Data transform delimited rows to field -

i have got table containing rows of related data need transform within ssis package , not sure how go it. in table rows related each other separated row contains pipe character e.g. test line 1_1 test line 1_2 test line 1_3 | test line 2_1 test line 2_2 test line 2_3 | test line 3_1 test line 3_2 test line 3_3 etc.. i need move table , concatenate lines of each group of rows 1 line separated pipe delimiter. above example need end in table: test line 1_1 test line 1_2 test line 1_3 test line 2_1 test line 2_2 test line 2_3 test line 3_1 test line 3_2 test line 3_3 i not sure how it. thought exporting text file reimporting using pipe delimiter - work dealing millions of rows , rather aviod overhead, there must way in ssis @ moment not sure how. any appreciated, thanks. you can create data flow task uses source component. source retrieve data sql statement. then, add script component transformation. script component must set asynchronous. s

sql - Should I use flat tables or a normalized database? -

i have web application working on uses mysql database back-end, , need know better situation before continue further. simply put, in application users able construct own forms number fields (they decide) , right have stored in couple tables linked foreign keys. friend of mine suggests keep things "easy/fast" should convert each user's form flat table querying data them stays fast (in case of large growth). should keep database normalized pooled relational tables foreign keys (indexes, etc) or should construct flat tables every new form user creates? obviously positives of creating flat tables data separation (security) , query speeds cut down. how gain this? don't want 10000 tables , dropping, altering, , adding of time, if better it... need input. thank you rule of thumb. it's easier go normalized denormalized other way around. start reasonable level of database normalization (by reasonable mean readable, maintainable, , efficient not pre

javascript - window.clipboardData.getData("Text") returns 0 in IE8 -

Image
i'm trying implement maxlength on textarea. in ie7, window.clipboarddata.getdata("text") returns correct number of characters copied. in ie8, same call returns 0. what's wrong? here js var somerule= { "textarea" : function(element) { element.onpaste = function() { var copied = window.clipboarddata.getdata("text"); alert('copied length = '+copied.length); } } }; behaviour.register(somerule); there security setting in ie8: to prevent web site reading clipboard, take following steps: go tools->internet options. click on security tab. click on "custom level." scroll down scripting section under settings. set "allow paste operations via script" disable or prompt. press ok buttons close dialog boxes. in case, setting disabled.

c - Do mmap/mprotect-readonly zero pages count towards committed memory? -

i want keep virtual address space reserved in process memory used not presently needed. i'm interested in situation host kernel linux , it's configured prevent overcommit (which detailed accounting committed memory). if want prevent data application no longer using occupying physical memory or getting swapped disk (wasting resources either way), can madvise kernel it's unneeded, or mmap new 0 pages on top of it. neither of these approaches reduce amount of memory counts committed, other processes prevented using. what if replace pages fresh 0 pages marked read-only? intent don't count towards committed memory, , further can later use mprotect make them writable, , fail if making them writable go on committed memory limit. understanding correct? work? if you're not using page (reading or writing it), won't commited address space (only reserved). but address space limited, can't play want/like it. see example electricfence may fail larg

What is this in rails? -

create! |success, failure| success.html { redirect_to admin_blogs_path } end seems doing alot it....is part of rails presuming being called in context of activerecord model, doesn't appear core. function of create! either create record or throw exception if failure occurs. such, failure block wouldn't execute. what might wrapper around activerecord object used actioncontroller instance , handles states accordingly. may want see method defined in order better sense of it's doing. one way track down mystery methods this: raise method(:create!).source_location.inspect you'll array lists source file , source line if can resolved.

Open XML file from res/xml in Android -

i created java application opens xml file looks this: <animaltree> <animal> <mammal>canine</mammal> <color>blue</color> </animal> <!-- ... --> </animaltree> and can open using: file fxmlfile = getresources.getxml("res/xml/data.xml"); documentbuilderfactory dbfactory = documentbuilderfactory.newinstance(); documentbuilder dbuilder = dbfactory.newdocumentbuilder(); document doc = dbuilder.parse(fxmlfile); doc.getdocumentelement().normalize(); nodelist animalnodes = doc.getelementsbytagname("animal"); then can create node, push object listarray, want objects loop through listarray. for (int temp = 0; temp < animalnodes.getlength(); temp++) { node nnode = animalnodes.item(temp); if (nnode.getnodetype() == node.element_node) { element eelement = (element) nnode; question thisanimal = new animal(); thisanimal.mammal = gettagvalue("mammal",eelement); // ... plain , simple!

mysql - sql union order -

i have table students names , heights. want query order students higher 150cm alphabetically , students smaller 150cm in descending order of names. something this: (select * students height >= 150 order name) union (select * students height < 150 order name desc) it's not working because union mess order of rows in subqueries. know it's normal, union output set , in set order it's not important. there append? select * students order if(height >= 150, 1,0 ) desc, if(height >= 150, name, '') asc, name desc sample output +------+--------+ | name | height | +------+--------+ | | 189 | | m | 666 | | thy | 166 | | yyy | 1277 | | zz | 101 | | swq | 122 | | n | 111 | | g | 145 | +------+--------+

Java: how to parse an html string for XML tool consume? -

which library allow me evaluate xpath on html string ? i have tried using javax package seems fail: string docroot = "<div><i>items <b>sold</b></i></div>"; xpath xxpath = xpathfactory.newinstance().newxpath(); inputsource docroot = new inputsource(new stringreader(subelements)); string result = (string) xxpath.evaluate("//b", docroot, xpathconstants.string); try following instead, there errors in code sample: import java.io.stringreader; import javax.xml.xpath.xpath; import javax.xml.xpath.xpathconstants; import javax.xml.xpath.xpathfactory; import org.xml.sax.inputsource; public class demo { public static void main(string[] args) throws exception { string docroot = "<div><i>items <b>sold</b></i></div>"; xpath xxpath = xpathfactory.newinstance().newxpath(); inputsource inputsource = new inputsource(new stringreader(docroot)); s

Is there anyway to give a Zookeeper node a NULL ACL via python-bindings? -

i'm trying create node using python bindings bundled zookeeper distribution ( src/contrib/zkpython/ ). using zookeeper-3.3.1. the pydoc create states if acl null node inherit parents acl setting parameter none causes invalid acl exception. i've taken @ parse_acls in zookeeper.c , seems conflict pydoc don't have experience py c api. if can't set acl null there other acl cause inherit parent? i had same problem , found no solution. workaround add additional step. example: import zookeeper zk parent_path = "/" stat, acl = zk.get_acl(zoohandle, parent_path) ret = zk.create(zoohandle, node_path, "", acl, 0) further tip: in zookeeper-3.3.1 zk.get() returns 512 bytes of node data. should fixed in next release (3.3.3).

multithreading - Thread Fails to Exit On Application Exit - C++ -

my application creates thread polls windows messages. when time close down, application sends wm_quit message. in application thread, how attempting shut things down: if ( _hnotifywindowthread != null ) { assert(_pobjnotifywindow != null); ::sendmessage( _pobjnotifywindow->m_hwnd, wm_quit, 0, 0 ); ::waitforsingleobject( _hnotifywindowthread, 50000l ); ::closehandle( _hnotifywindowthread ); // <-- pc never gets here. _hnotifywindowthread = null; } this message pump running in thread function: // start message pump... while ( (bretval = ::getmessage( &msg, // message structure _pobjnotifywindow->m_hwnd, // handle window messages retrieved wm_devicechange, // lowest message value retrieve wm_devicechange // highest message value retrieve )) != 0 ) { switch ( bretval ) { case -1: // error generated in getmessage. trace(

iphone - How do you ensure a UIView to be frontmost? -

i have uilabels animating on mainview , want have custom uiview pop onto main view when button pressed. labels animating in background continue animate , problem i'm having labels animate on top of custom uiview. does know how can ensure custom uiview front-most view uilabels animate behind it? you may want at - (void)bringsubviewtofront:(uiview *)view in parent view.

c# 4.0 - Can required WCF4 DataMemeber's be organized into required groups? -

is there way have required datamember's within datacontract organized groups require group 1 or group 2 no both provided? i looking see if there functionality similar workflow activity validation can flag inargument's requiredargument , use overloadgroup attribute put these groups arguments in 1 of specified groups required. it not possible out of box datacontractserializer can switch xmlserializer , use xsd:choice ( xmlchoiceidentifierattribute ) aware affect data class beacuse construct has own requirements.

java - HTML no longer working in JLabel (and other components) -

i have java applet i've written , have been running quite while. in applet have bunch of jlabels use html in text content (which allowed, , has been working years). main reason use html allow line breaks in jlabels. the issue: jlabels have html in them (some don't) stopped displaying text. think might have recent java update (java se 6 update 22, on 2010-oct-12) not 100 percent sure, problems did seem start around then. maybe bug has been introduced? or feature removed? i tried jeditorpane , seemed have same issues when content html. also important note first time load applet (first time java runtime starts) works fine, if refresh webpage has issues described. does have similar issues? have insights? or doing dumb? i made simple test applet , can reproduce issues 100% regularity (remembering first time runtime loads work fine, successive refreshes cause issues): [helloworldapplet.java] import javax.swing.*; public class helloworldapplet extends japplet {

Comparing two rows in mysql with additional check -

heysa, i have little problem im not quite @ mysql queries , don't know proper terminology question i'll roll can :) i have 2 rows in 1 table want compare if not 0 , equal. in php this: if(!empty($row1) && !empty($row2)){ if($row1==$row2){ return true; }else{ return false; } }else{ return false; } here table if that's help id | b | t | ----------- 1 | 2 | 1 | 2 | 0 | 0 | 3 | 1 | 1 | and this: select * table b=t returns 0=0 record id=2 ( don't want ) correct query should return record id=3 select * table b = t , b <> 0 , t <> 0 since we're testing b = t , know if b <> 0 true, t <> 0 true. can therefore shorten to select * table b = t , b <> 0

python - Transform invalid nested json to valid one and change to list -

under link : http://dev1.gecoloco.com/rte/done_json.php have json-like object, i'm operating on. cannot load simplejson, because wrongly formatted. , code fails : conn = httplib.httpconnection("dev1.gecoloco.com") conn.request("get", "/rte/done_json.php") r = conn.getresponse() data = r.read() logging.debug(data) json = simplejson.loads(data) as result i'd list of dictionaries. first question how load proper json? read string , replace quotes or different ? second question how transform formatted json list of dictionaries ? (do need json easily?) ? help. the nice thing json it's so, close python literal syntax. use ast.literal_eval() parse it.

class - How to bind two classes in java? -

how can bind 2 java classes? i'm programming 3d opengl program have several different classes. know how bind classes main class, can't bind 2 separate classes together. have class terrain have list containing data terrain. need data in class called figure isn't main class. have tried bind these classes this: in terrain class have: figure fig; public void bindclasses(figure fg) { fig = fg; } and in figure class have: terrain ter; public void bindterrain(terrain tr) { ter = tr; } and in both classes call functions. shouldn't bind them , variables? @ least that's how have bound classes main class. just start off terminology. class blueprint tells how instantiated object - moment write new figure() , you've created instance, an object of class figure (often have several objects of 1 class ). when "binding" above, not binding classes, binding objects . the above code fine. convention, write sort of things setters , i

objective c - Add a (double) variable to NSMutableArray -

i have user input variable , want add array. firststore bool type t determine if array has been initialize. first time store called, initialize array. tried make num equal operand (which double) masking nsnumber doesn't seem work because have error "nsnumber may not respond +operand", program crashes when hits line [memarray addobject:num]. i'm new @ stuff appreciated. else if ([operation isequal:@"store"]) { if(!firststore){ memarray = [[nsmutablearray alloc] init]; nsnumber *num = [nsnumber operand]; [memarray addobject:num]; firststore = yes; } else { //nsnumber *num = [nsnumber operand]; //[memarray addobject:num]; } } try changing [nsnumber operand] [nsnumber numberwithdouble:operand] .

sql server - Which one is a valid create table Sql Statement and why? -

query 1 create table [dbo].[vararray[]](column int) go begin tran insert vararray(i) select 1 rollback go while(1=1)]( [column] [int] null ) on [primary] query 2 create table [dbo].[vararray](column int) go begin tran insert vararray(i) select 1 rollback go while(1=1)]( [column] [int] null ) on [primary] this asked whil on sqlservercentral variable array table . there full explanation @ topic . why asking question here. have tried running yourself?

iphone sdk 3.0 - What is the difference between .tag and tag -

i have query on this. please @ sample code below: uibutton *button; button.tag = 1; and int = (int)[(uibutton*)sender tag]; the first line set tag number 1 button variable, using .tag method. , in second line, used (int)[(uibutton*)sender tag]; extract , cast sender integer value. question be, difference between .tag , tag method? there should no difference. before objective c 2.0, dot methods didn't exist; these added, function shortcuts longer bracketed call. in particular code example, in first code block, button doesn't hold pointer button. you'd need call uibutton *button = [uibutton buttonwithtype:uibuttonroundedrect]; button.tag = 1; this set tag 1. second code block takes existing button , extracts tag int , indicated. better example of parallel methods be: button.tag = 1; , [button settag:1]; , or int tag = button.tag; , int tag = [button tag];

java - creating soft phone using j2me -

my requirement create sip based softphone supported phones using j2me. i know possible in java(j2se) . know possible in j2me? if yes, can please guide me tutorials , tips. i dont know how possible same topic discussed in nokia forum. see link, discussion

java - What is empty session path in tomcat? -

i have read apache tomcat documentation day before, , confused emptysessionpath . knowledge, if it's set true, emptysessionpath stored @ root folder of web application. please give right definition of term emptysessionpath , happens if set true , false? please guide me.thanks in advance. the emptysessionpath field states whether cookie should stored in root url path / (if emptysessionpath=true ) or not (otherwise). this used apache's connector. see details here (this ajp connector, part of connnector object). what means is: if emptysessionpath enabled in tomcat, jsessionid cookie written root "/" path. means whatever webapp on use same cookie. each webapp re-write cookie's value hold webapp's session id, , different. when enabled , servlets in different webapps used, requests same user different servlets end overwriting cookie when servlet again interacted create new session , loose sessi

button - Progress Bar in android -

i have tried implement progressbar in application gets displayed when click on button plays sound. i have done coding run time exception , application not starting. here posting code reference. holder.imgplaybtn.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { progressdialog progressdialog; onclicklistener mycontext = this; progressdialog = new progressdialog((context) mycontext); progressdialog.setprogressstyle(progressdialog.style_horizontal); progressdialog.setmessage("..."); progressdialog.setcancelable(false); } }); the logcat output : 12-02 12:19:58.268: error/androidruntime(392): java.lang.classcastexception: com.android.soundmachine.switch2datalist$soundmachineadapter$2 12-02 12:19:58.268: error/androidruntime(392): @ com.android.

import - How to deploy zippedfolder.sql.gz.gz on my MYSQL server on my windowsplatform -

how deploy zippedfolder.sql.gz.gz (its backup existing database) on mysql server on windowsplatform? extracting twice throws error 'archives not found' though size not zero also, importing directly via phpmyadmin throws error because extracted file has linux commands mysqldump doesn't recognize you may try removing .gz extension. i've received mysql files disguised .gz @ end, , not in gzip format.

cocoa touch - Loading data in NSUserDefaults -

i have done coding save highscore in nsuserdefaults, not sure how can load data nsuserdefaults , display in table. please help. nsstring *name; name = nametextbox.text; nsdictionary *player = [nsdictionary dictionarywithobjectsandkeys: [nsstring stringwithformat:@"%@", name], @"name",[nsstring stringwithformat:@"%d", myscore], @"score",nil]; [highscore addobject:player]; nssortdescriptor *sort = [[nssortdescriptor alloc] initwithkey:@"score" ascending:no]; [highscore sortusingdescriptors:[nsarray arraywithobject:sort]]; [sort release]; [[nsuserdefaults standarduserdefaults] setobject:highscore forkey:@"highscore"]; you should able load way you'd expect (like accessing value in nsdictionary ): nsarray *highscore = [[nsuserdefaults standarduserdefaults] objectforkey:@"highscore"]; update to display data array in table view, you'll need create view controller , use array data source. eas

database - programatically access car dealers inventory -

not sure whether question makes sense on so, i'm working on website provide list of new cars of interest user, bit autotrader.com. guys know how type of websites operate? on autotrader.com thinking maybe dealers have upload , update inventory themselves. know whether case? felt when go dealer in us, can search specific car through dealerships. bottom line: inventory seems accessible third parties - knows more? autotrader gets data dealer manually adding vehicles dealers third party services pushing data autotrader nightly (ftp or emailed) services like. website providers / inventory management tools such autojini.com , vinsolutions (now owned atc) lot management companies such dealer specialties, kbb cdmdata (these companies come dealers lot , take pictures , send data out website providers, classifieds sites etc. feed processing company digital motor works. or autotrader pulling data dealer management system (reynolds & reynolds, adp, arkona, etc) pull

MySQL int definition explanation -

for years have been under assumption when create new column of type bigint(12) mysql table field limited integers 12 digits. however, noticed values 16 digits able written , selected out of bigint(12) defined column without warnings or issues. can please me understand why case , column definition means? in advance! bigint(12) not truncated @ all. 12 used display purposes. have @ numeric types numeric type attributes mysql supports extension optionally specifying display width of integer data types in parentheses following base keyword type. example, int(4) specifies int display width of 4 digits. optional display width may used applications display integer values having width less width specified column left-padding them spaces. (that is, width present in metadata returned result sets. whether used or not application.) the display width not constrain range of values can stored in column. nor prevent values wider column

winforms - System.ComponentModel.BackgroundWorker never invokes ProgressChanged -

i rewrote windows forms application use backgroundworker instances instead of using manually created "worker threads". after checkin noticed tests started fail. after debugging can demonstate problems showing following 2 tests: [test] public void test_a() { bool progresschanged = false; var worker = new backgroundworker(); worker.workerreportsprogress = true; worker.dowork += (s, e) => worker.reportprogress(0, null); worker.progresschanged += (s, e) => progresschanged = true; worker.runworkerasync(); thread.sleep(100); progresschanged.shouldbetrue(); } [test] public void test_b() { //creation of o form component causes (?) test fail, dispose var view = new form(); view.dispose(); bool progresschanged = false; var worker = new backgroundworker(); worker.workerreportsprogress = true; work