Posts

Showing posts from April, 2015

c# list and enumerator with properties -

i have following problem: have list , add string items list. create enumerator out of list. when loop through list movenext() command works when access enumerator directly. when use enumerator properties access enumerator doesn't work. movenext() command doesn't increment index. here code used. lot help. public class dummyklasse { public list<string>.enumerator enumerator; public list<string> list; public dummyklasse() { console.writeline("test"); list = new list<string>(); enumerator = new list<string>.enumerator(); } public list<string>.enumerator enumerator { { return enumerator; } set { enumerator = value;} } public list<string> list { { return list; } set { list = new list<string>(value); } } public void dummyfunction() { list.add("test1"); list.add("test2")...

c# - Microsoft.Office.Interop.Word how to stop the file opening -

i have bunch of word documents want read , text value in string.i trying to microsoft.office.interop.word code looking similar one: var wordapp = new word.application(); object file = filename; object nullobj = system.reflection.missing.value; word.document doc = wordapp.documents.open(ref file, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj); doc.activewindow.selection.wholestory(); doc.activewindow.selection.copy(); idataobject data = clipboard.getdataobject(); doc.close(); and @ the: word.document doc = wordapp.documents.open line prompts me opening file(with few options including:"open read copy" etc.) code works fine me besides fact opens document.is there way content without opening it? want object have data loaded inside of don't want ...

Getting Logs from child project created in Jenkins Parameterized Build Plugin for Email Ext plugin -

i have created parent child project in jenkins using parameterized build plugin problem faced when attaching logs our team whenever build fail. the email-ext plugin sending email build log of parent project calling project , not logs of child project. any highly appreciated. ok got solution. need discard pramaeterized plugin using build flow plugin [https://wiki.jenkins-ci.org/display/jenkins/build+flow+plugin] the benefit is giving me log placed in parent job without modification in child project. the usage follows: def today = new date() out.println '----------------- build started @ '+ today+ '----------------------------' b=build("<basebuild>",parentworkspace:build.properties["workspace"],param:"value") today=new date() out.println '-------- build log -------------- ' out.println b.log out.println '----------------- build ended @ '+ today+ '----------------------------' ...

swing - java.lang.ArrayIndexOutOfBoundsException: 0 >= 0 -

here complete code: stat = con.preparestatement("select exceltable.payorbankroutno, exceltable.amount, exceltable.accountno, exceltable.serialno, exceltable.presentingbankroutno, exceltable.presentmentdate exceltable exceltable.creationdate = ? inner join (select payorbankroutno, amount, accountno, serialno exceltable group payorbankroutno, amount, accountno, serialno having (count(payorbankroutno) > 1) , (count(amount) > 1) , (count(accountno) > 1) , (count(serialno) > 1)) dup on exceltable.payorbankroutno = dup.payorbankroutno , exceltable.amount = dup.amount , exceltable.accountno = dup.accountno , exceltable.serialno = dup.serialno order exceltable.serialno"); stat.setstring(1, datename); rs = stat.executequery(); metadata = rs.getmetadata(); li_cols = metadata.getcolumncount(); allrows = new vector(); while(rs.next()) { vector newrow = new vector(); ...

internet explorer - jQuery loading and rendering incorrectly on different PCs -

when try run webpage on browser/test in other browsers, work no bugs or error messages. include ie6,7,8,9,10,newer versions of firefox, , chrome. typically, today, decided run on bosses pc , - guessed - went kaput straight away. have simple jquery hover-over effect expands menu. not work on internet explorer 10 or firefox 22.0. after turning on ie dev tools , waiting ~30seconds following error message received on pc, not mine : script5009: 'jquery' undefined jquery.easing.1.3.js, line 39 character 1 script5009: '$' undefined slidedownboxmenu, line 142 character 13 the end of index.html looks : <!-- javascript --> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript" src="jquery.easing.1.3.js"></script> <script type="text/javascript"> $(func...

Dynamic Pivot for multiple columns in SQL Server 2000 -

i know, bad etiquette post same question link in other forum, here question link : http://www.sqlservercentral.com/forums/topic1474579-8-1.aspx microsoft sql server 2000 - 8.00.2039 (intel x86) may 3 2005 23:18:38 copyright (c) 1988-2003 microsoft corporation enterprise edition on windows nt 5.2 (build 3790: service pack 2) table structure , sample insert statements : create table consumption ( code varchar(6), prodname varchar(50), department varchar(20), netqty decimal(10,2), netmrp decimal(10,2) ) insert consumption values ('u00180','usg jelly im-k','sono',11.4,130.40) insert consumption values ('u00280','unidine 1 litre solution','akd',1.4,10.40) insert consumption values ('v02401','volini gel 50gm','physiotherapy',8,15) insert consumption values ('v02402','x ray film digital 14"x 17"','mri',3,26.40) insert consumption values ('u00380','tropac p drops ...

Does JavaScript's typeof function check for null -

does javascripts typeof expression check null? var test = {}; console.log(typeof test['test']);//"undefined" var test = null; console.log(typeof test['test']);//typeerror: test null obviously, why error, if typeof null object? edit: know how avoid type error, , null has no properties, i'm wondering there explanation behavior of typeof . var test = { test: null }; console.log(typeof test['test']);// object your code throws exception because reading property of null this: null['test']

ios - What is wrong with my CGContextclip. -

i beginner core garphics , try around understanding of cgcontextclip. doing simple program custom uibutton drawrect below rect dimension passed drawrect method custombutton *button = [[custombutton alloc]initwithframe:cgrectmake(0, 0, 100, 50)]; @implementation custombutton - (id)initwithframe:(cgrect)frame { self = [super initwithframe:frame]; if (self) { [self setbackgroundcolor:[uicolor clearcolor]]; } return self; } - (void)drawrect:(cgrect)rect { cgcontextref context = uigraphicsgetcurrentcontext(); cgcolorref colorref = [[uicolor bluecolor] cgcolor]; cgcontextsetstrokecolorwithcolor(context, colorref); cgcontextsetfillcolorwithcolor(context, [[uicolor bluecolor] cgcolor]); cgcontextsetlinewidth(context, 3.0f); cgcontextaddrect(context, rect); cgcontextstrokerect(context, rect); //cgcontextfillrect(context, rect); cgcontextsavegstate(context); cgcontextsetstrokecolorwithcolor(context, [[uicolor redcolor] cgcolor]); cgcontextsetfillcolorwithcolor(context, [[uicolor ...

Python extract value beautifulsoup regex -

i have below through regex , beautifulsoup. need extract uid value e.g 5968723334. [u'/home.html', u'browse_settings.html', u'browse.html?', u'test.html?uid=5415292833', u'test.html?uid=5968723334', u'test.html?uid=5968723334', u'test.html?uid=5453943714', u'test.html?uid=5453943714', u'test.html?uid=6740871094', u'test.html?uid=6740871094', u'test.html?uid=5991868792', u'test.html?uid=5991868792', u'test.html?uid=25072413', u'test.html?uid=25072413', u'test.html?uid=6739965683', u'test.html?uid=6739965683', u'test.html?uid=7272910004', u'test.html?uid=7272910004', u'test.html?uid=13179298', u'test.html?uid=13179298', u'test.html?uid=5392816266', u'test.html?uid=5392816266', u'test.html?uid=5992588819', u'test.html?uid=5992588819', u'test.html?uid=6727114420', u'test.html?uid=672...

Zend Lucene : index database data or not? -

i'll try indexing , zend lucene search first time , i'm wondering if datas database should indexed or not, considering performance. if when (in case) ? my first goal index documents (pdf) search in. in communications module of application develop, users can search communications entering keywords. app searches in subject , content of communications stored in database , now, index, searches in content of documents attached communications. in way i've search in database , in index. so i'm wondering if should index subject , content (e.g. : unindexed lucene field) of communication ? faster ? considering number of documents , communications increase quickly, , index too. anyone has experience ? yes, bringing in content want able search idea. run couple of problems searching both database , index. first, performance worse. having run search against 2 different sources expected slower having searchable content in 1 place. second, merging , orderi...

undefined method `parameters' for nil:NilClass in rails 3 -

in rails app have 2 controllers coordinates , tweets , tables respectively.i have 2 text fields in search button , need fetch queries tweets table using conditions in coordinates table . getting error "undefined method `parameters' nil:nilclass" . coordinates_controller.rb class coordinatescontroller<applicationcontroller def paramas(b) @b = params[:show] return @b end def coor(latitude,longitude) @latitude=0`enter code here` @longitude=0 end def search @a=coordinates.where(city: params[:show]).take if(params[:show]== a.city) @latitude= a.latitude @longitude=a.longitude end if(@latitude=0 && @longitude=0) return @sql="select * tweets tweet_text '%search%' , user_loc 'a.paramas' order id desc" else if (@latitude!=0 && @longitude!=0) @min_lat = @latitude - 1.0 ...

.htacces Appears only html with no CSS or PHP -

i've been wondering on internet on how work htacces(really hard learn it). , when lurking in internet, found this: http://www.generateit.net/mod-rewrite/ well, inserted url(working on localhost): empresa.com/index.php?p=sub_artigo&id=1&cat=mercearia and gave me this(with options default): http://empresa.com/sub_artigo/5/mercearia.html and .htacces code this: rewriterule ^([^/]*)/([^/]*)/([^/]*)\.html$ /index.php?p=$1&id=$2&cat=$3 [l] and when generate url in php do <a href=\"sub_artigo/".$response2['id_sub_artigo']."/".$response2['url'].".html\">$response2[nome_sub_artigo]</a> and then, when click button, appears like, html. example: http://s14.postimg.org/wr137fx4x/htacces_error.jpg any idea happening ? it looks using relative links assets (images, javascript, css). that means when css/my_stylesheet.css , new url, browser request url http://empresa.com/sub_artigo/5/css/my_...

asp.net - Text displaying on top of img in dropdown with input in IE8 -

i have input before dropdown acts ui dropdown <input type="text" value="" name=" " class="txtfield"> <asp:dropdownlist runat="server" id="ddamt" skinid="form" datasourceid="ldsamt" datatextfield="xyz" datavaluefield="abc" width="220px" cssclass="dd" appenddatabounditems="true" autopostback="true" onselectedindexchanged="index"> </asp:dropdownlist> .txtfield{ background: url("img.png") no-repeat scroll 98% center #fff; position: absolute; width: 175px; border-radius: 4px; padding-right:26px; overflow:hidden;} .dd{ background-position: left center; height: 32px; opacity: 0; filter: alpha(opacity = 0); padding-left: 5px; text-align: left; width: 209px; position : relative; z-index : 10; display:inline-block;} my issue in ie8, if dropdown option text more, textbox display text goes on top of image til...

java - jax-ws client don't reuse classes -

i've created webservice client wsimport tool authentication. ws client working fine i've monitorized application visual vm , i've seen every time ws called, number of loaded classes increments. if call webservice much, memory used increased too. think classes generated wsimport not reusinging. i'm using: -tomcat 7.0.27 -jdk_1.6.0_23

ruby on rails - rmagick gem installed on windows but bundle fails -

from rails , bundler newbie. i able install rmagick 2.13.2 on ms windows 7 with: gem install rmagick -v 2.13.2 -- --with-opt-lib=c:/imagemagick/lib --with-opt-include=c:/imagemagick/include --local which worked, shown in output: temporarily enhancing path include devkit... building native extensions. take while... installed rmagick-2.13.2 1 gem installed installing ri documentation rmagick-2.13.2... installing rdoc documentation rmagick-2.13.2... but can't bundler use gemfile, contains line: gem "rmagick" but command: bundle install --path vendor/bundle/ faults on rmagick this: installing rmagick (2.13.2) gem::installer::extensionbuilderror: error: failed build gem native extension . c:/railsinstaller/ruby1.9.3/bin/ruby.exe extconf.rb checking ruby version >= 1.8.5... yes checking stdint.h... *** extconf.rb failed *** not create makefile due reason, lack of necessary libraries and/or headers. check mkmf.log file more details. may need co...

c# - Why Ninject does not release disposed objects with InCallScope? -

i'm trying use ninject (version 3.0.1) in winforms application, have several (currently) self-binded service class, construct using ninject. service class needs other service classes (sub-services). of these service classes need repository interact database, have abstract irepository interface. need have same repository whole service-hierarchy in service class, i'm using incallscope() scope when binding irepository. i'm using xpo orm tool, have xporepository implementation, i'm binding to. see other question scenario. my binding looks this: bind<irepository>().to<xporepository>().incallscope(); i don't have explicit toself() bindings each service class, assume when them ninject, should have transient scope, interpret have manually dispose them. assume have services1 , services2 service class, both having constructor parameter of type irepository. assume services1 use methods of services2, add constructor parameter services1 type services2....

javascript - Submit form with multiple submit buttons in Windows CE -

i have application, running on mobile device (scanner) windows ce , ie mobile browser: generated html-code statis, cannot change here: <form method="post" name="myform" action="/sap(...=)/.../example/.../~...="> <div id="buttons">. <input class="okay" id="submitbutton" type=submit name="~okcode=confrm" value="select"> <input class="back" id="backbutton" type=submit name="~okcode=back" value="back"> </div> ... other forms datas ... </form> i want submit form when user press specific key, added javascript: function navigate(){ document.onkeyup = function(event) { if (event.keycode == '55') { var mybutton = document.getelementbyid("submitbutton"); mybutton.click(); } if (event.keycode == '57') { var mybutton = document.getelementbyid("backbutton"); ...

PostgreSQL Performance: keep seldomly used small database in memory while server busy with big database -

i have server 64gb ram , postgresql 9.2. on 1 small database "a" 4gb queried once hour or , 1 big database "b" 60gb gets queried 40-50x per second! as expected, linux , postgresql fill ram bigger database's data more accessed. my problem queries small database "a" critical , have run in <500ms. logfile shows couple of queries per day took >3s though. if execute them hand they, too, take 10ms indexes fine. so guess long runners happen when postgresql has load chunks of small databases indexes disk. i have kind of "cache warmer" script repeats "select * x order y" queries small database every second wastes lot of cpu power , improves situation little bit. any more ideas how tell postgresql want small database "sticky" in memory? postgresql doesn't offer way pin tables in memory, though community welcome people willing work on thought out, tested , benchmarked proposals allowing people who...

scaling - Matlab Bug -- Matrix Elements Keep Maxing Out -

there's peculiar bug in code can't seem figure out. context, image, matrix, consisting of scaled values 0 255. getspatavg function not included here. problem i'm facing elements in ngtdm max out @ 255. when function finishes, matrix ngtdm consisting of many many values 255. code below shows on computer. function ngtdm = getngtdm(i,d) [rowi, coli] = size(i); ngtdm = zeros(256, 1); r=1+d:rowi-d c=1+d:coli-d term = i(r,c)-getspatavg(r,c); ngtdm(i(r,c)+1)=ngtdm(i(r,c)+1)+term; end end end i isolated specific value in i, 254, in code below. function ngtdm = getngtdm(i,d) [rowi, coli] = size(i); ngtdm = zeros(256, 1); r=1+d:rowi-d c=1+d:coli-d if(i(r,c)==254) term = i(r,c)-getspatavg(r,c); disp(term); ngtdm(i(r,c)+1)=ngtdm(i(r,c)+1)+term; end end end end the variable 'term', in instanc...

jquery - Type Error: c is not a constructor/c.widget is not a function -

i trying jquery ui dialogs working on drupal site. after checking web console, found getting error: $(...).dialog not function i did researching (aka. googling) , found have been because didn't add necessary js files drupal page. added jquery.ui.dialog.min.js , of dependencies. however, getting the: type errors: c not constructor , c.widget not function. since jquery.ui.widget.min.js doesn't depend on anything, not sure do... also haven't found conclusive answers these errors... edit: js files added (in order): jquery.ui.widget.min.js jquery.ui.dialog.min.js jquery.ui.button.min.js jquery.ui.draggable.min.js jquery.ui.mouse.min.js jquery.ui.position.min.js jquery.ui.resizable.min.js my_module.js figured out. added: drupal_add_library('system', 'ui'); instead of each script separately.

sql - Having trouble passing variables between pages through php -

so here's code on first page: <?php $db = mysql_connect( ':/applications/mamp/tmp/mysql/mysql.sock', 'root', 'root' ); if(!$db) die("error connecting mysql database."); mysql_select_db('onlineform', $db); $newquery1 = mysql_query("select newcampsessions onlineformdata order id desc limit 1") or die('error ' . mysql_error()); $newfoo = mysql_fetch_array($newquery1); $newquery2 = mysql_query("select priceperweek onlineformdata order id desc limit 1") or die('error ' . mysql_error()); $newfoo1 = mysql_fetch_array($newquery2); $newoldstring = $newfoo['newcampsessions']; $newoldstring2 = $newfoo1['priceperweek']; $newchangedstring = unserialize($newoldstring); $newchangedstring2 = unserialize($newoldstring2); sql_close(); ?> <html> <head> (all tags in here) </head> <body> <form id="paymentform" action="amd8....

css - Show on desktop, Then Hide Banner Advertisements on mobile -

is there bit of css @media coding use me showing , hiding banner advertisements on site? like, on desktop view,the leaderboard ads of 728x90 showing, on mobile, hide leaderboard , go 468x60 or 300x250??? appreciate this. you can try hide small ads default @ first using display: none; . under media query make visible applying display: block; , hide large ads. can see example here http://jsfiddle.net/tkxck/

regex - PHP .htaccess removing .php extension and language directory to parameter -

i'm looking regulair expression .htaccess file inside php server. what want detects language first directory parameter: nl en be de any other options must treated directory or filename. language must given parameter without corrupting other parameters. also want last / replaced .php . some examples: host.com/nl/index/ -> host.com/index.php?lang=nl host.com/de/test/abc/ -> host.com/test/abc.php?lang=de host.com/be/a/b/c/?t=23 -> host.com/a/b/c.php?lang=be&t=23 is possible? can't work, hope me out! <ifmodule mod_rewrite.c> rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename}.php -f rewriterule >>> requested expression , replacing pattern <<< </ifmodule> rewriterule ^/([a-z]{2})(/.+)/?$ $2.php?lang=$1 [qsa] regexes easiest interpret considering piece @ time. let's break down: ^ - start of url / - match first slash ([a-z]{2}) - match , capture 2 letters (goes...

asp.net - Glimpse MVC3 DLL being 'forgotten' as part of Application Pool recycle -

we're trying glimpse , running in our environment coming across strange problem. we've installed glimpse.core, glimpse.aspnet, , glimpse.mvc3.dll , when configure web.config enable glimpse works fine until application pool recycles . once apppool recycles, it's if site 'forgets' glimpse.mvc3.dll , mvc3 tabs (execution, model, metadata) disappear. here steps (for us) reproduce: modify web.config include glimpse configuration all tabs show including execution, metadata, , model binding perform application pool recycle the mvc3 glimpse tabs no longer show (but others will) prior apppool recycle, glimpse.axd shows following registered tabs: glimpse.aspnet (1.3.1) configuration - glimpse.aspnet.tab.configuration environment - glimpse.aspnet.tab.environment request - glimpse.aspnet.tab.request routes - glimpse.aspnet.tab.routes server - glimpse.aspnet.tab.server session - glimpse.aspnet.tab.session glimpse (1.5.0) timeline - glimpse.core.tab....

wordpress - Custom Post Type Admin Post Status Not Working -

for life of me, can not figure out. i set custom post type in wordpress so: register_post_type( 'myposttype', array( 'labels' => array( 'name' => __( 'myposttypename' ), 'singular_name' => __( 'myposttypename' ) ), 'public' => true, 'has_archive' => true, 'supports' => array('title', 'custom-fields') ) ); when first started added add_filter( 'map_meta_cap', 'my_map_meta_cap', 10, 4 ); basic capabilities. think may have set part wrong, got rid of , returned post type normal capabilities. now whenever try access custom post type in admin, run weird problems. namely, no matter post status click on (published, drafts, private, etc.) published posts. sorting columns , other similar admin functions don't work @ all. it's edit.php broken, specific custom post type. works fine on o...

selenium - seleniumIDE - how to store a hyperlinks address and then visit that URL? Was working before -

i had working fine couple of months ago when run test fails , don't know why or how fix. background: have screen several links 'admin' user logged in can login 1 of 'practitioners' via login hyperlink presented. details: test click on 'login link' hyperlink(s), enter & confirm new password required, , practitioners screen 'as them'. 'wrinkle' pop-up user enter (new) password happened on new window selenium ide used new window. clicking on hyperlink didn't work. around able store hyperlink's href - a@href - in selenium variable first_login_link_to , use open instead of clickandwait visit page, i.e. open ${first_login_link_to} this working fine few months ago.... not working now. i page doesn't exist , when @ url - urgh! somehow includes locator stuff , getting http://dmplanning-stage.herokuapp.com//tr[td[contains(.,'6 day')]][1]/td[8]/a@href instead of http://dmplanning-stage.herokuapp.com...

java - Android: Google Maps v2 API loading blank map on Android 4.0 and above -

i using google maps android v2 in android project. i have tested on 3 devices: htc vivid (4.0.3), asus nexus 7 (4.2.2), , galaxy s2 (2.2). map shows on galaxy s2 using above information, know should work fine. question: need add compatibility, or fix errors higher api versions? i have done following: generated keystores (both debug , custom) , registered both of sha-1 codes package name google apis console. have tried program both api keys , both returned same blank screen , error. using program out of debug mode shows attempts made access api in report logs in console. imported android-support-v4.jar file imported google-play-services_lib project folder, set library, , configured project use library. set "my_map.xml" layout following code <?xml version="1.0" encoding="utf-8"?> <fragment xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/map" android:layout_width="match_pa...

asp.net mvc - How to Prevent Entity Framework to Make all the attributes in the database -

the entity framework make attributes fields in database how make entity not create 1 or more attributes database fields ? you can use notmapped, before attribute [notmapped] public string username{get; set;}

c# - Technique to prevent accidental re-enumeration of IEnumerable? -

i spent time scratching head when breakpoint seemed magically appear twice in same spot, inside enumerator. it turned out bug straight forward oversight: protected override void extract() { loggettingoffers(); var offerids = cakemarketingutility.offerids(advertiserid); logextractingclicks(offerids); foreach (var offerid in offerids) { int rowcount; var clicks = retryutility.retry(3, 10000, new[] { typeof(exception) }, () => { return cakemarketingutility.enumerateclicks(daterange, advertiserid, offerid); }); foreach (var clickbatch in clicks.inbatches(1000)) { logextractedclicks(offerid, clickbatch); // should clickbatch, not clicks add(clicks); } } end(); } this leads me wonder (if any) kind of preventative measures 1 might take write code catches error this. ...

Jquery dialog - button tooltip -

how set tooltip jquery dialog buttons ? please see below ...here no id or style classes. jquery("#dialog-form").dialog ({ autoopen: false, height: 600, width: 700, modal: true, resizable: false, draggable: false, buttons : { "search" : function() {},"edit":function()} when mouse on button or ready click button, message needs showup. please advise. easiest way enumerate buttons , assign title attribute. $('button').eq(0).attr('title','delete items'); $('button').eq(1).attr('title','cancel'); jsfiddle example

video - Obtain frame rate from MP4 with Media Foundation .NET -

i want obtain frames per second of mp4 video file. since mp4 not supported directshow, looking other alternatives such media foundation. problem after hours of google, wasn´t able find example learn how use mediafoundation. have found in c++, use vb or c#, , never understood how simple task. windows 7 (and possibly windows vista well) provides shell api access media file properties. includes frame rate of video stream in mpeg-4 files ( .mp4 ), frame rate can access pkey_video_framerate property in property store via ipropertystore interface.

java - How to handle the different packets in both the server and client? -

in gameserver & client i'm planning make, i'm gonna have lot of packets in long run have handle. i'm wondering best-practices on how handle different packets. my packets payload start packetid. would idea create seperate class extending packet , handle logics there? example packet001login? give me lot of classes in long run. is better make gigantic switch statement? doubt it. is best way didn't think of? any advice appreciated. if have enougth calculation time on server side should work on technique create prototypes different package types. to illustrate point , idea of give uml class descriptions uml: class packetprototype + packetprototype(packettype) + adddata(datatype, bitlength, ...) + deserilize(bitstream stream) : receivedpacket + serilizethis() : tosendpacket + getpackettype() : int you need class have packetprototypes , decides on type of each packetprototype object prototype should used deserilize data. you need 1 cla...

optimization - Make MySQL table FIXED by splitting TEXT field into chunks of type CHAR(255) -

fixed mysql table has well-known performance advantages on dynamic table. there table tags 1 description text field. idea split field 4-8 char(255) fields. insert/update queries divide description chunks (php function str_split() ). make table fixed. have practiced technique? worth it? ok, done, done have seen done historical reasons, such particular client-server model requires it, or legacy reports segments de facto fields in layout. the examples have seen free form text entries (remarks, notes, contact log) in insurance/collections applications , formatting on printed report important or there need avoid confusion in post post processing dress format multiple platforms involved. (\r\n vs \n , ebcdic vertical tabs). so not space/performance/recovery purposes. if row "mostly" field, alternative create row each segment , add low-range sequence number key. in way have 1 row short values , 8 long. consider statistics. caveats : always acutely awar...

spring - Camel context properties from DB -

right now, bootstrap camel using spring. using spring, can point camel contexts respective properties files injected @ boot time. issues want move properties file database, yet still able use property placeholders before. what's best way go doing this? i've noticed there's propertiesresolver interface implement, wouldn't know how tell camel implementation. camel's documentation lacking in area. i wouldn't opposed having spring properties database me, although don't see happening. the propertiesresolver designed camel locate properties files osgi bundle or normal class path. if want setup owner propertiesresolver , can try use org.apache.camel.spring.spi.bridgepropertyplaceholderconfigurer . you can inject customer implementation of propertiesresolver there.

Java URL encoding -

from web application doing redirect external url has credentials part of url string. encode credential part alone before redirection. have following url: string url1 = "http://servername:7778/reports/rwservlet?server=server1&oracle_shutdown=yes&paramform=no&report=test.rdf&desformat=pdf&desname=test.pdf&destype=cache&param1=56738&faces-redirect=true&"; i encoding as: string url = "userid=username/passwd@dbname"; encodedurl = urlencoder.encode(url, "utf-8"); string redirecturl = url1 + encodedurl1; the url generated code is http://servername:7778/reports/rwservlet?server=server1&oracle_shutdown=yes&paramform=no&report=test.rdf&desformat=pdf&desname=test.pdf&destype=cache&param1=56738&faces-redirect=true&userid=%3dusername%2fpasswd%40dbname as can see towards end of encoded url, special characters / have been encoded. i.e. userid=username/passwd@dbname has become userid=...

c# - How change variable value depending on architecture -

title clear: how can change value in c# depending on destination architecture? in particular, want change string depending on x86 or x64. many thanks! edit: need check if x64 office version installed if application x64 too. environment.is64bitprocess should trick

java - Auto create JLabels should be under themselves -

i have code automatically create jlabels . i want each label should @ row, not beside! i use code: lbl = new jlabel[rows]; (int = 0; < rows; i++) { lbl[i] = new jlabel(arrayresultrow[i].tostring()+ "\n" ); } but \n not work! google , study java swing layout manager tutorial , start reading. likely you're adding jlabels jpanel uses flowlayout default, , need change layout of container gridlayout or boxlayout. edit: here's link: laying out components . i.e., // add jlabels jpanel uses gridlayout set have // 1 column , "rows" number of rows. jpanel labelholder = new jpanel(new gridlayout(rows, 1); lbl = new jlabel[rows]; (int = 0; < rows; i++) { lbl[i] = new jlabel(arrayresultrow[i].tostring()); labelholder.add(lbl[i]); }

automated tests - Android library assembles with Gradle but "package R does not exist" error raise on connectedCheck -

i have android library file structure below. android_library ├── libs └── src ├── instrumenttest │   ├── assets │   └── java └── main ├── aidl ├── gen ├── java └── res when assemble library gradle, task runs successfully. however, when try running connectedcheck following errors r file not being found: :validatedebugsigning :packagedebug :assembledebug :preparetestdependencies :compiletestaidl :processtesttestmanifest :generatetestbuildconfig :mergetestassets :compiletestrenderscript :mergetestresources :processtestresources :compiletest android_library/src/instrumenttest/java/com/example/library/util/utiltests.java:514: error: package r not exist case r.plurals.time_days_ago: { ^ ... note: recompile -xlint:unchecked details. 18 errors :compiletest failed failure: build failed exception. * went wrong: execution failed task ':compiletest'. > compilatio...

asp.net mvc 4 - Why is this returning System.Threading.Tasks.Task`1[System.Web.Mvc.ActionResult] -

not sure why not returning view after task completed , can find on google why. public async task<actionresult> getuserasync() { var value = task.factory.startnew(() => _userservice.getuser("ausername")); await task.whenall(value); return view("getuser"); } was project upgraded prior version? check libraries you're referencing not referencing old version of mvc dependency. fix exact issue i... removed following web.config: <dependentassembly> <assemblyidentity name="system.web.mvc" publickeytoken="31bf3856ad364e35" /> <bindingredirect oldversion="0.0.0.0-4.0.0.0" newversion="4.0.0.0" /> </dependentassembly> ensured targetframework .net 4.5 <compilation debug="true" targetframework="4.5"> and removed reference library fluent filters legacy solution global filters. with changes able return task...

Need help php array that i didnt know -

i have array: array ( [_edit_last] => array ( [0] => 1 ) [mymail-campaigns] => array ( [0] => a:1:{i:379;a:3:s:4:"sent";b:1;s:9:"timestamp";i:1374085107;s:4:"open";i:1374085295;}} ) [_edit_lock] => array ( [0] => 1374095131:1 ) [mymail-userdata] => array ( [0] => :a5:{s:9:"firstname";s:0:"";s:8:"lastname";s:0:"";s:17:"nombre-y-apellido";s:16:"**fabrizio di tata**";s:7:"celular";s:13:"**0261155890069**";s:5:"_meta";a:1:{s:2:"ip";s:0:"";}} ) ) and need data in bold. i know need use foreach, not typical array know. please me. the data in array item result of serialize() , can expanded array using unserialize() serialize() unserialize()

c# - Cannot load DLL or one of its dependencies -

on dev machine works fine. on test machine can't run .exe because says "lib.dll or 1 of dependencies not found". lib.dll in same directory .exe , ran corflags against both dll , exe: both of them report "pe32" both 32 bit. lib.dll doesn't have other dependencies. removed of them , tested. why else might failing? i used dependencywalker suggested in comments. dependencywalker showed had couple missing dlls traced belonging visual c++ 2012 redistributable. make sure have correct version of visual c++ redistributable installed on testing/production machines. switched project in visual studio debug release mode, mistake i've made in past, won't making mistake again anytime soon. if leave project in debug mode, dll dependencies different if put release mode. visual c++ redistributable not have debug dlls present, release ones - if testing, change might necessary unless know find debug dlls (which installed visual studio on development machin...

javascript - How do assertion libraries such as Chai work without forcing a call to a function? -

in chai , can stuff following: expect({}).to.exist; exist not function call, still works in testing frameworks. opposite ( expect({}).to.not.exist ) causes tests fail, again, exist not function call. how these assertions work without making me call function? in fact, if try expect({}).to.exist() test fails because exist not function. i figured out (or @ least, figured out a method). use javascript getters : var throws = { a() { throw new error('a'); }, b() { throw new error('b'); }, c() { throw new error('c'); } }; when doing throws.a , throws.b , or throws.c , appropriate error thrown. from point rather easy build assertions contained within chai.

spring - An H2 embedded database with oracle syntax? -

i have set h2 datasource oracle mode both in connector string , in init script set mode oracle; however, many functions cannot executed; such date trunc function, quite common in our code. what practical way test out db applications? looks may have go full-blown qa/dev test oracle instance. indeed, implement syntactical replica of oracle huge task, can imagine lightweight in-memory dbs testing going miss many oracle features. how approach problem? in opinion unit testing , integration testing should distinguished. unit testing should not have external dependencies, should mock dao classes (eg: using mockito). testing against real database should done during integration testing. as might have seen problem using embedded database during unit testing syntax might different production database. one approach mitigate setup integration testing environment (eg: using bamboo ci tool) have dedicated production-like (oracle) database testing. test as can using embedded da...

java - Call proper subclass method after previous cast to superclass type -

assume have base class bc subclasses sc1, sc2, ... , collection c of objects (some of type sc1 , of type sc2, ...). method m defined in subclasses, not in bc. i'm hoping this: class anotherclass { private bc getobj(container c) { /*return c*/ } private void anothermethod() { ... bc o = getobj(c); o.m(); } } now getobj return reference o object , far know must of type bc (or there way apply generics here?). compile error (m() doesn't exist in bc). i'm assuming there there nice way (without having "manually" figure out real type of o somehow)? why isn't method defined in bc ? polymorphism about. your other option have objects implement interface contains m , have collection of interface instead of bc . or use reflection (ew), or check type (ew).

c# - Load specific XML attributes/values -

i've been trying 2 days understand linq xml in c# but, i'm messed 'cause never saw tutorial other one, mean different , since i'm beginner in c#, , need c# in serverside of game wondering how to access skill1 type(attribute) name(attribute) "mychar" access description of skill1 name(att) "mychar1" <chars> <character name="mychar1"> <skill1 type="attack" damage="30"> description of skill1 <name>skill name</name> <class1 type="the class type"></class1> <class2 type="the class type 2"></class2> </skill1> //almost same thing till skill4 <skill2>...</skill4> <character name="mychar2"> <skill1 type="attack" damage="30"></skill1> <skill2>....</skill4> ...

asp.net mvc 3 - How to handle a string with apostrophe in DotNet.highcharts -

i have code: categories = new[] { "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec" }; this works nicely dotnet.highcharts in mvc3. however, trying dynamically populate categories result querying northwind database such ienumerable <string> fname = u in db.order_details.take(12) join w in db.products on u.productid equals w.productid select w.productname; string[] namearr = (string[])fname.toarray(); ..... .setxaxis(new xaxis { categories = namearr .... now of namarr have apostrophes in them , highcharts cannot handle those. how solve issue? woah!!! found solution after digging through internet. , answering own question might find useful , save loads if time. apparently there 2 approaches string[] namearr ...

visual studio 2010 - ReportViewer how to display a boolean value differently -

my data stored in bit field in sql server (0 or 1) when display in reportviewer shows true or false i change yes or no please advice. you can change in report using iif. =iif(fields!yourbool.value, "yes", "no") if data null evaluate "no". if want blank instead use one =iif(isnothing(fields!yourbool.value), "", iif(fields!yourbool.value, "yes", "no"))

Java: Using key names from properties file without using hardcoded strings as keys -

problem statement i have properties file that's accessed throughout java project. example contents of .properties file: appname=myapp apptype=typea let's access single property, appname , throughout java project props.getproperty("appname"); i don't want iterate through properties file property value; i'm getting single property value properties file. don't fact have access property using hardcoded string because can lead maintenance issues (i.e. changing instances of hardcoded string). my current approach in current approach, have utility class creates static final variables representing key names in properties file, , use variable access property value: public static final string app_name = "appname"; ... props.getproperty(app_name); but seems overkill because it's being redundant, , still potential maintenance concern. key exists in properties file, , i'm declaring them again in utility class. is there more ...

html - Clear CSS from all child Element -

i have add content admin side ckditor , want show same content display on front side. my front css going change how can prevent , remove css 1 div , div withing ol, ul , many more stuff. you can't remove css element using css. instead have overwrite using more specific css. e.g. .class { background: red; } is overwritten by .parent .class { background: none; }

cookies - C# Hiding a process (Process doesn't hide) -

Image
i'm trying hide process before , after start it, doesn't seem work @ all. can explain this? system.diagnostics.processstartinfo startinfo = new system.diagnostics.processstartinfo("rundll32.exe", "inetcpl.cpl,clearmytracksbyprocess 2"); startinfo.windowstyle = processwindowstyle.hidden; process.start(startinfo); startinfo.windowstyle = processwindowstyle.hidden; if trying hide process not showing in task manager example, need 1 of following: api hooking. (ring-3) altering eprocess structure of targeted process. (ring-0) i hope understood question correctly, cause question , posted snippet not match really.

c# - Implementing a Derived Class of TextWriter -

i have 2 classes, none of can change in way: class 1: takes textwriter constructor parameter , uses output stream. class 2: provides method writeline(string) . i need adapter, such output of class1 written class2. therefore started adapter extends textwriter , buffers incoming text, flushing class2 instance new line arrives. however, there many , more methods in textwriter - should implement? output in class1 string only. according msdn 1 should override write(char) minimum, however, enforces me \r\n new line handling myself well... q1: know of better way reach goal? q2: if no, textwriter methods should override have minimum implementation effort. implementing write(char) on textwriter derived class need do. if calls writeline on new class, base class writeline method called. right thing: call write method individual \r , \n characters. actually, writeline(string) looks this: void writeline(string s) { write(s); write("\r\n"); } ...