Posts

Showing posts from July, 2011

joomla1.5 - CSV Export returning index.php not able to download instead of open CSV file -

i have employee record calling server using crul, process result , create csv file , offer download or open. when clicked open opens csv file .html extension in browser , when clicked on save option says "unable download index.php file sitename.com". here php code it: $url = 'sitename.com/myemployee.php?mid=101'; $headers[] = 'content-type: content-type: text/csv; charset=utf-8'; $process = curl_init(); curl_setopt($process, curlopt_url, $url); curl_setopt($process, curlopt_httpheader, $headers); curl_setopt($process, curlopt_header, 0); curl_setopt($process, curlopt_referer, "my_employee"); curl_setopt($process, curlopt_timeout, 30); curl_setopt($process, curlopt_returntransfer, 1); curl_setopt($process, curlopt_followlocation, 1); $return = curl_exec($process); curl_close($process); header('content-type: text/csv'); header('cache-control: cache, must-revalidate...

ios - Navigating from one viewController to another -

i have problem in app related navigation.my app consists of initial configurationvc, loginvc , after logging in landingvc. after logging in if anywhere in app, user encounters condition 'invalid id' need take him configuration controller.everywhere have handled keeping common navigation controller begins configurationvc , using poptorootviewcontroller on encountering 'invalid id'. on landingvc open leavevc in different navigation cntroller.i doing need present leavevc modally in formsheet style on landing page. if poptorootviewcontroller wont directly navigate configurationvc. should directly configurartion screen in case. have searched few links wasnt able adzact solution. kindly help, newbie ios you can have configurationvc , loginvc seperate navigationcontrollers. when ever want configurationvc change application window rootviewcontroller configurationvc.

business objects - BusinessObjects Tree Structure as in Pivot Table -

is possible in businessojects 4.1. implement tree structure should function tree structure in ms excel pivot table? if not possible, there alternative? backround story ist - have hierarchy , user wants have tree structure (the user not happy drill up/down bo functions) this assuming you're working in web intelligence. you use breaks visual indication of structure , combine outlines allow user fold , unfold @ different break levels. work if hierarchy you're referring consists of different dimension objects (which think judging question). for more information, have @ sap businessobjects web intelligence users guide ; section 4.2.3.2 deals breaks while outline functionality discussed in section 4.1.4.

jqGrid PHP - exportToPdf/exportToExcel throws Call to Undefined Method -

have run problem wiht jqgrid when try export table pdf, excel or csv. every time run code "call undefined method::jqgrid::exporttopdf" (or excel or csv, depending on method using. here snip of client side: .jqgrid('navbuttonadd', '#ors_registrant_pager', { id: 'exporttopdf', caption: '', title: 'download pdf', onclickbutton: function(){ grid.jqgrid('excelexport',{tag:"pdf","url":"info.php"}); } here server side php script in info.php: $conn = new pdo(db_dsn,db_user,db_password); $conn->query("set names utf8"); $grid = new jqgrid($conn); $grid->selectcommand = "select lastname, firstname user_table"; $grid->exportcommand = "select lastname user_table"; $grid->datatype = "json"; $export = $_post["oper"]; if($export == "pdf") { $grid->exporttopdf(); } else { $grid->querygrid(); } the grid loads...

How to get list of "Collection Level Security Groups" in TFS 201X Api (SDK) [Resolved] -

i developing utility, , need retrieve list of collection level security groups, tfsteamprojectcollection projectcollection = tfsteamprojectcollectionfactory.getteamprojectcollection(new uri(projecturi)); igroupsecurityservice gss = projectcollection.getservice<igroupsecurityservice>(); in igroupsecurityservice there listapplicationgroups(projecturi) method returns security groups in project, need groups on team project collection, i can't make sql query on tfs database , don't want use tfs command line tools. it solved passing null listapplicationgroups(null)

codeigniter - A PHP Error was encountered Severity: Notice Message: Array to string conversion Filename: mysql/mysql_driver.php Line Number: 552 -

model : function trans_gdc_add() { $trans_gdc_gc_package[0] = $this->input->post('trans_gdc_gc_package'); $trans_gdc_gc_package1 = implode(",", $trans_gdc_gc_package[0]); $add=array( 'trans_gdc_no' => $this->input->post('trans_gdc_no'), 'trans_gdc_to' => $this->input->post('trans_gdc_to'), 'trans_gdc_vehicle_no' => $this->input->post('trans_gdc_vehicle_no'), 'trans_gdc_vehicle_type' => $this->input->post('trans_gdc_vehicle_type'), 'trans_gdc_vehicle_chas' => $this->input->post('trans_gdc_vehicle_chas'), 'trans_gdc_vehicle_make' => $this->input->post('trans_gdc_vehicle_make'), 'trans_gdc_vehicle_eng' => $this->input->post('trans_gdc_vehicle_eng'), 'trans_gdc_ve...

java - How to save information from a combobox in the database -

Image
i use combobox database information. want add product of respective category. category want selected combobox , recorded in database there. public void addproducts() { try { products p1 = new products(); p1.setidproduct(jtidproduct.gettext()); p1.setdescproduct(jtdescproduct.gettext()); p1.setstockactual(jtstocka.gettext()); p1.setstockmin(jtstockm.gettext()); p1.setprice(jtprice.gettext()); p1.setnumorc(jtnorc.gettext()); --------> p1.setcategory( don't know code add); productdao dao = new productdao(); dao.addproduct(p1); } catch (sqlexception ex) { logger.getlogger(jtproduct.class.getname()).log(level.severe, null, ex); } } ----------------------class dao------------------------------------------- public void addproducts(products p1) throws sqlexception { string sql = "insert products (idproduct, descproduct, stockactual, stockmin, price, numorc, ca...

javascript - Custom element.prototype function has undefined "this" -

i'm trying create function used in case browser doesn't support classlist if(!element.prototype.classlist) { element.prototype.classlist = {}; element.prototype.classlist.contains = function(class_name){ console.log(this) } } the console.log(this) returns "undefined", how element on function called then? it may ie8's console.log() "breaking" result somehow. in console in ie8 compatibility mode (in ie11), correctly shows [object object] { } return value, expandable show attached contains() function: element.prototype.classlist = {}; element.prototype.classlist.contains = function() { return this; }; var n = document.createelement('div'); n.classlist.contains(x); but, wrapping return value in console.log() shows undefined . letting "flow through" console, however, shows object expected. possibly related ancient ie quirk, wherein console doesn't exist unless developer tools opened? ...

Python pygame writing text in sprite -

i making game shall shoot down diffrent boxes diffrent nummber , text on , wondring if can write text sprite first off feel haven't done research, song free code. answer question, don't think ever again. class text(pygame.sprite.sprite): def __init__(self, text, size, color, width, height): # call parent class (sprite) constructor pygame.sprite.sprite.__init__(self) self.font = pygame.font.sysfont("arial", size) self.textsurf = self.font.render(text, 1, color) self.surf = pygame.surface((width, height)) w = self.textsurf.get_width() h = self.textsurf.get_height() self.surf.blit(self.textsurf, width/2 - w/2, height/2 - h/2) i hope helps, draw text centered on surface in sprite

javascript - RequireJS Load Module Gone Wrong? -

using requirejs, planning load module in page, example home page, (for sake of reading, have translated code coffeescript javascript): require(["tmp/assets/scripts/modules/_image"], function(_image) { return $('ul li img')._image.basicimagehover(); }); and im _image.js file: $.fn.basicimagehover = function() { $(this).on('hover', function() { $(this).parent().find('div.caption').slideup('fast'); return $(this).css('opacity', '.5'); }); return this; }; my project structure (sorry don't know how draw better graphs): tmp/assets/scripts/modules/_image.js tmp/assets/scripts/front/home.js error in console said @ home.js _image undefined, i'm guessing changing module return function instead of plugin might work, wondering wrong current setup. can explain? thanks there couple problems code. first, there's problem of how access jquery plugin. these install on jquery o...

javascript - How to Require Angular Controllers -

im new angularjs , trying integrate application uses requirejs. have application working on test page using ng-submit . however, in app.js file dont think "require"ing controllers in best way. i using angularjs v1.1.5 here's tree: resources - css - js - controllers - testcontroller1.js - testcontroller2.js - testcontroller3.js - testcontroller4.js - testcontroller5.js - libs - angular.js - jquery.js - require.js - mondernizr.js ...... ...... ...... main.js app.js pages test1.html test2.html test3.html test4.html test5.html main.js (function(require) { 'use strict'; require.config({ baseurl: '/libs', paths: { 'zepto' : 'zepto', 'jquery' : 'jquery', ...

php - Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given -

wtf? - becoming nightmare, seem error after error.. im willing pay time me achieve seems unachievable, please.. alls want dropdown menu selects data table according category , displays it.. help! :( <form action="portfolio.php" method="post"> <select onload="displayproject(this.value);" onchange="displayproject(this.value);"> <option value='none'>all</option> <option value='1'>fencing</option> <option value='2'>driveway</option> </select> </form> <?php $db = new mysqli('localhost', 'wlarter_user', 'pw', 'wlarter_portfolio'); if($db->connect_errno > 0){ die('unable connect database [' . $db->connect_error . ']'); } $option= $_post['option']; $queries = "select * image"; if ($option != 'none'){ $queries = "select * image category=".$option; } $...

sticky footer - Jquery - Stick element on bottom of the page until scrolled to it - page with accordion -

i have element, sticked bottom of page using waypoints.js , following code: $('.sticky-container').waypoint(function (direction) { if (direction == 'down') { $(this).addclass('active'); } else { $(this).removeclass('active'); } },{offset:'100%'}); this works fine, have accordions on page - when open accordion item, page height changes, change isn't reflected in waypoint script , sticky element disappears soon. i created jsfiddle explain better mean: http://jsfiddle.net/scr5l/3/ how can fixed? for needing this, got response waypoints.js support: bootstrap's hide.bs.collapse , show.bs.collapse fire @ beginning of collapse transitions. want use events fire when transition complete, hidden.bs.collapse , shown.bs.collapse: $('.collapse').on('shown.bs.collapse hidden.bs.collapse', function (e) { e.stoppropagation(); $.waypoints('refresh...

the else part is not working in php -

php code <?php $hostname="localhost"; $username="root"; $password="tiger"; /* @var $dbhandle type */ $dbhandle = \mysqli_connect($hostname, $username, $password) or die("unable connect mysql"); /* @var $select type */ $select= \mysqli_select_db($dbhandle,"sample") or mysqli_error($dbhandle); $tnumber=(\filter_input(input_post,'tnumber')); $capacity=(\filter_input(\input_post,'capacity')); $status=(\filter_input(\input_post,'status')); $sql1="select * tablecheck "; $res=mysqli_query($dbhandle,$sql1); $row= mysqli_fetch_array($res); if($row['status'] === 'booked') { echo "please select table"; } else{ $sql="update tablecheck set status='booked' tnumber='$tnumber' "; /* @var $result type */ $result= \mysqli_query($dbhandle,$sql) or die(\mysqli_error($dbhandle)); echo "success"; mysqli_close($dbhandle); } ...

.net - How to edit and read the header of a MP3 file before encrypting it in c#? -

i encrypting mp3 file format, want is, should able write header of new format file. , want save duration of song in header of new format file. new file in encrypted format, want write duration in header. later on if need duration of encrypted song file, read header instead of decrypting whole file. i writing code of mp3 encryption technique. public static void encryptfile(string inputfile, string outputfile) { try { string password = @"mykey123"; // key here unicodeencoding ue = new unicodeencoding(); byte[] key = ue.getbytes(password); string cryptfile = outputfile; filestream fscrypt = new filestream(cryptfile, filemode.create); rijndaelmanaged rmcrypto = new rijndaelmanaged(); cryptostream cs = new cryptostream(fscrypt, rmcrypto.createencryptor(key, key), cryptostreammode.write); ...

r - parcoord, only one line accross all groups -

i have data frame, both vectors have same elements in different orders: df <- data.frame(g1=c("b","a","e","d","c"), g2=c("c","d","e","b","a")) and compare them, using g1 reference. terms re-ordered accordingly in g2 df$g1.num <- 1:length(df$g1) df$g2.num <- match(df$g2,df$g1) when plot parcoord , see how positions of elements in g1 change when in g2 df <- subset(df,select = c(g1.num, g2.num)) parcoord(df, col = rainbow(nrow(df))) since have large data set, many elements, plot looks confusing. therefore. 1 plot per elements. for example: element "b" only, changing position 1 position 4. you can apply(df, 1, plot, type="l") this loop through rows, , plot. if you're in interactive session, they'll loop through quite quickly. if surround apply file(pdf="lines.pdf") , dev.off() you'll capture lines...

java - Custom View Width -

i've created class custom view, , overrode onmeasure method show next. when call getter width , height, returns 0. why happen? @override protected void onmeasure(int widthmeasurespec, int heightmeasurespec){ super.onmeasure(widthmeasurespec, heightmeasurespec); int parentwidth = measurespec.getsize(widthmeasurespec); int parentheight = measurespec.getsize(heightmeasurespec); this.setmeasureddimension(parentwidth, parentheight); } the getwidth() , getheight() values available after first full layout pass (onmeasure -> onlayout) if need access values in between use getmeasuredwidth() , getmeasuredheight()

Passing a two-dimensional array to a struct (C++) -

i have problem includes pointers , two-dimensional arrays. i've got struct, looks this: typedef struct { int row; int col; int **a; } test; now want use object of type other functions. i'm having problems passing two-dimensional array object of type. for example tried this: int main(int argc, char * argv[]){ //just fill array integers int rows = 3; int cols = 3; int a[rows][cols]; srand(time(null)); (int x = 0; x < rows; x++){ (int y = 0; y < cols; y++){ a[x][y] = rand() % 10 + 1; } } test * t = (test *) calloc(1,sizeof(test)); t->row = rows; t->col = cols; t->a = a; return 0; } how can properly? i'm thankful help. if need allocate test object dynamically can this: int main(int argc, char * argv[]) { //just fill array integers int rows = 3; int cols = 3; test* t = new test; t->row = rows; t->col = cols; t...

javascript - want to show and hide div with jquery -

i new jquery, , don't understand 100%. want div containing text or image, , when click on it, show div. html: <div class="mytrigger">click here</div> <div class="mycontent">show when clicking on above</div> jquery: <script> $( ".mytrigger" ).click(function() { $( ".mycontent" ).toggle( "slow", function() { }); }); </script> so, when click on "mytrigger", must show "mycontent. just leave function inside toggle-call away: $(function() { $( ".mytrigger" ).click(function() { $(".mycontent").toggle("slow"); }); }); see: http://jsfiddle.net/a8np4/3/ edit: wrapped in dom-ready-call

android - MediaStore.Images.Media.insertImage is returning null when trying to save the image -

i using custom view , in using canvas in user can draw , after want save image in sd card bt not able that. don't know going on. else if(view.getid()==r.id.save_btn){ //save drawing alertdialog.builder savedialog = new alertdialog.builder(this); savedialog.settitle("save drawing"); savedialog.setmessage("save drawing device gallery?"); savedialog.setpositivebutton("yes", new dialoginterface.onclicklistener(){ private fileoutputstream fout; public void onclick(dialoginterface dialog, int which){ //save drawing drawview.setdrawingcacheenabled(true); //attempt save string imgsaved = mediastore.images.media.insertimage( getcontentresolver(), drawview.getdrawingcache(), uuid.randomuuid().tostring()+".png", "dra...

How can I convert the first character of a C# string to lowercase? -

can tell me how can this. know there functions convert lowercase first character. there must multiple ways of doing that, can use char.tolower on first character , substring starting index 1. can try: string str = "aaaaaa"; str = char.tolower(str[0]) + str.substring(1); it better if check string length, avoid exception. if(str.length > 0) { str = char.tolower(str[0]) + str.substring(1); }

javascript - jQuery - dynamically create classes to match existing classes -

i have 3 divs <div class="box opacity1 red"></div> <div class="box opacity.5 green"></div> <div class="box opacity0 blue"></div> i want have jquery @ page, see these classes , create 3 different classes. opacity1{ opacity: 1 } opacity.5{ opacity: 0.5 } opacity0{ opacity: 0 } so when user adds class, eg "opacity75" element. want jquery script find "opacity" , find number attached it, use number create matching css class eg. opacity75{opacity:0.75} i have little knowledge of js. need start me off in right direction. can save having loads of css classes. var stylestring = "<style type=\"text/css\">"; $("div").each(function() { $.each($(this).attr("class").split(" "), function () { var class = + " {"; //add style string class += "}"; stylestring += class; ...

jquery - Access to primefaces widgetvars on document ready -

im trying access primefaces components on document ready this: $(function() { var showdialog = geturlparameter("showdialog"); if (showdialog == "true") { pf('mydialog').show(); } }); but in moment primefaces widgetvars not available , following error: widget var 'mydialog' not available! when primefaces widgetvars ready accessed? i had success adding javascript initialization code in page after component widgetvar, ie <p:datatable widgetvar="test"> </p:datatable> <script type="text/javascript"> $(document).ready(function() { pf('test'); // access , whatever here } </script> putting script tag before p:datatable doesn't work. more info here: http://forum.primefaces.org/viewtopic.php?f=3&t=35718

c# - How to add a number of days to a Date while skipping weekends and other holidays and start day is weekend or holiday -

below code calculates number of workdays added , if end date falls on holidays/weekends, shift date next day. but code on assumption start date not on weekends/holidays. i want code works if start date falls on weekend/holiday. please note code posted elenasofea on 17 jun'13 not able comment on asking new question. reference: how add number of days date while skipping weekends , other holidays static datetime calculatefuturedate(datetime fromdate, int numberofworkdays, icollection<datetime> holidays) { var futuredate = fromdate; (var = 0; < numberofworkdays; i++ ) { if (futuredate.dayofweek == dayofweek.saturday || futuredate.dayofweek == dayofweek.sunday || (holidays != null && holidays.contains(futuredate))) { futuredate = futuredate.adddays(1); numberofworkdays++; } else { futuredate = futuredate....

android - Invalidating 1 Custom View Causes All Custom Views In A View Group To Be Invalidated? -

i have custom view group. in custom view group number of custom views. custom views overlap each other in layout. the overlapping views intential create "layers". 1 layer may create static content, layered view creates different animated content. problem comes when call .postinvalidate thread on 1 view animation runs @ 60fps. outside of layered views 60fps achievable device i'm using (galaxy s3). inside custom view group, .invalidate causes 1 out of 2 hardware rendered views invalidate, , of software views invalidate it. mycustomviewthatshouldnotinvalidate(abstractdiallayer).ondraw(canvas) line: 68 mycustomviewthatshouldnotinvalidate.ondraw(canvas) line: 79 mycustomviewthatshouldnotinvalidate(view).draw(canvas) line: 13650 mycustomviewthatshouldnotinvalidate(view).draw(canvas, viewgroup, long) line: 13534 mycustomviewgroup(viewgroup).drawchild(canvas, view, long) line: 2938 mycustomviewgroup(viewgroup).dispatchdraw(canvas) line: 2808 mycu...

linux - I have accidentally removed apt-get and aptitude (Debian 6) -

after have removed libusb-0.1-4 packet, tried install new 1 when realized have removed apt-get. tbarry@darkstar:~$ sudo apt-get install libusb-1.0-0 sudo: apt-get: command not found tbarry@darkstar:~$ sudo aptitude install libusb-1.0-0 sudo: aptitude: command not found could know how reinstall apt without apt? download apt...version.deb https://packages.debian.org/search?keywords=apt , install via sudo dpkg -i /path/to/apt..version.deb . long dpkg not removed recoverable. install aptitude via apt-get .

php - How do I update my database with mysqli and javascript -

i have website audioplayer , integrated lyricviewer on screen, user should able sync music hear playing. have 1 problem, , is; how on earth i, javascript function, call mysqli update statement? when user clicks save button, content gets thrown div, want php after javascript has been run take content , put database. what best way that? why doesn't work? function saveinphp() { //alert("came here"); //var superstr = $( "#savelyric" ).text(); var superstr = 'lol'; $.ajax({ type: "post", url: "includes/sendlyrics.php", data: superstr, cache: false, contenttype: false, processdata: false, success: function(data){ alert("---"+data); alert("settings has been updated successfully." + data + "~~~" + superstr); //window.location.reload(true); } }); } and php...

Where can I find a list of differences between Rails 2.x and Rails 4.x? -

i'd see list of major differences between rails 2.x , rails 4.x. i've searched through lots of blogs , sites, in vain. perhaps upgrading ruby on rails page helpful. lists steps take upgrade application. also interesting because lists differences: rails 3.0 release notes rails 3.1 release notes rails 3.2 release notes rails 4.0 release notes

user interface - Java GUI Button unpressable -

code: public void actionperformed(actionevent evt) { ....... while(true) { if (source==button1) { //button1 code } if(source==button2) { // button2 code } } //while true ..... //some other code don't want execute until while breaks }//action performed so problem when above code executed gui stuck , no buttons can pressed. if remove infinite loop, rest of code executed , stop algorithm. there work around issue? thanks! you blocking gui thread. try looking @ tutorial, explains how run user actions in background thread. http://docs.oracle.com/javase/tutorial/uiswing/concurrency/worker.html

bash - How do I pipe in command run using backtick? -

i have bash command, a=`xyz | head -n 1 | awk '{print $2}'` which used version number i using number of times, avoid redundancy, decided store string , execute whenever need, stdout of xyz getting stored variable. this how i'm doing it, cmd="xyz | head -n 1 | awk '{print \$2}'" a=`$cmd` what doing wrong? how fix it? suggest if there simpler/better way of achieving it. suggest if there simpler/better way of achieving it. you command can shortened to: xyz | awk '{print $2; exit}' and can create function rather storing in string: mycmd() { xyz | awk '{print $2; exit}' } and use as: a=$(mycmd)

python - sklearn ImportError: No module named _check_build -

i'm trying import sklearn, when attempt receive following: --------------------------------------------------------------------------- importerror traceback (most recent call last) <ipython-input-2-8fd979e02004> in <module>() ----> 1 import sklearn c:\users\alpine\appdata\local\enthought\canopy\user\sklearn\__init__.py in <module>() 29 # process, may not compiled yet 30 else: ---> 31 . import __check_build 32 .base import clone 33 c:\users\alpine\appdata\local\enthought\canopy\user\sklearn\__check_build\__init__.py in <module>() 44 ._check_build import check_build 45 except importerror e: ---> 46 raise_build_error(e) c:\users\alpine\appdata\local\enthought\canopy\user\sklearn\__check_build\__init__.py in raise_build_error(e) 39 build package before using it: run `python setup.py install` or 40 `make` in source directory. ---> 41 %s""...

css - Google Map v3 Initializing with horizontal gray line w/ Foundation in Chrome -

Image
seems css related because initializing map in simple html page works fine. have added suggested css fix known issues (below), can't seem rid of this. #map { *, *:before, *:after { -moz-box-sizing: content-box!important; -webkit-box-sizing: content-box!important; box-sizing: content-box!important; } img { max-width: none; height: auto; } label { width: auto; display: inline; } } for else looking temp solution bug: css .map *, .map *:before, .map *:after { -webkit-transform: none !important; } sass .map { *, *:before, *:after { -webkit-transform: none!important; } }

openpgp - How to start gpg-agent manually as service on Windows -

for specific purpose, i'd start gpg-agent manually gpg-agent --daemon but everytime , problem process doesn't run in background on windows 7. i have tested on linux , works normally. is there way achieve want ? thanks

html - Clean XHTML tags -

i required import xml piece of software, xml provided created different bit of software , sent myself. go through xml document , strip out cdata tags , have find , replace tags uppercase lowercase , remove strong tags or ol tags. but have reorganise tags allow imported software, example: <b>got text here<p/>more bold text</b> this not import unless manually go in , change <b>got text here</b><p/><b>more bold text</b> i have looked @ htmltidy , other such tools strip out <p/> tag completely. in need of keeping data in original formatting, if there way this? using xslt, can this: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="1.0"> <xsl:output indent="no" omit-xml-declaration="yes"/> <xsl:template match="node()|@*"> <xsl:copy...

python - Django self referencing model filter ForeignKey -

say have following model in django: class category(models.model): parent = models.foreignkey('self', null=true, blank=true) is there way prevent referencing same category? right django generates select field in admin area im able select same category parent. there way filter select in admin? use foreignkey.limit_choices_to - see documentation here you haven't provided enough of code snippet see how done in case, i'm guessing on parent foreignkey, you'd want limit choices lambda function checks see if name of category same 1 doing referencing. you want lambda function here, not single expression.

c# - Error handling - global error catalog? -

back when writing c code might have used global #defines error numbers. can't in c#. use error class, i'd have pass around. such serious faux pas have global error catalog class? class containing, example, dictionary of errors , messages? how handled better? ok, have been clearer... sorry. let's accessing database, or several databases, in different classes. if error accessing database want display error message of sort, don't want display system generated error message - have own error catalog want use. let's have standard "database access error" string want show, want add database name , table. achieve couple of #defines in c. how should handle c# - singleton class globally accessible contains dictionary? bad thing? if want define custom dictionary code , message work you, it's not practice. if code become more , more larger, giving meaningful name exception better code. think when there more 1 person work on project if us...

c# - Retrieve type from a String -

i have class: namespace ns1.ns2.domain { public class process { private iindex indexbuilderconcr { get; set; } public processo(string processtype) { indexbuilderconcr = new unitycontainer().registertype<iindex, *>().resolve<iindex>(); } } } here have constructor takes string . string represent type should replace * sign @ line 8. have googled araound no luck. what you'll need type in way james s suggests, you'll need pass value method in different way calling method<resolvedprocesstype> invalid: var type = type.gettype("some.name.space." + processtype); var methodinfo = typeof(unitycontainer).getmethod("registertype"); // method's argument params type[] keep adding commas // each <,,,> var method = methodinfo.makegenericmethod(iindex, type); // supply null second argument because method has no parameters unitycontainer = (unitycontainer)method.invoke(unitycont...

How to let someone test run iOS app on device without revealing code? -

i have created universal ios app , tested on both ios simulator , on ipad. have developer friend has iphone, , has agreed test run on own device. send app him. wondering if there way send without revealing entire code? p.s. have been registered ios dev several years haven't yet released apps. first one. you should create *.ipa file , send friend , how create give here. http://bmpradeep.wordpress.com/2013/01/01/how-to-create-an-ipa-file-in-xcode-4-3-or-higher/ you can check testflight .

convert a matrix of characters into a matrix of strings in R -

i have large matrix of characters , want convert matrix of strings, without looping on each row individually, wondering there smart way fast, tried paste(data[,4:((i*2)+3)],collapse=""), problem combines rows large 1 string, while need have same initial number of rows original matrix, , each row contains 1 column string contains characters in specific row in other words: want convert matrix a= { d e r p g k s k p s l n s k p s l n s k p s l n s k p s l n } into a= { derpgki skpasln skpasln skpasln skpasln } apply loop, should still pretty efficient in case. it's use be: apply(x, 1, paste, collapse = "") alternatively, can try: do.call(paste0, data.frame(x)) which might faster.... a reproducible example (not sure why i'm wasting time here)... x <- structure(c("d", "s", "s", "s", "s", "e", "k", "k", "k...

javascript - Angularjs Partial View vs Directive -

our spa has 2 distinctive top level views. compare windows file explorer showing tree view on 1 side , content details on other side. these top level views, considering have 2 partial views. other alternative pack these views directives. our initial thoughts going toward partial views, because these quite larger blocks of functionalties , each view can have multiple controllers. experience/thoughts on similar lines decide. note communicate between these views using eventing mechanism. we not intend reuses these views. specifically, there issues going partial views? performance, maintainability, etc. i'm not sure i'm understanding problem here, sorry if wrong (also sorry english). need 2 views; if 'inside' views use directive or not, it's thing. thing i'm pretty sure 2 views need have they're own scope . to me seems lot 'navigation menu' vs. 'view' kind of problem (only navigation part gonna sort of tree-view), solution should...

stringstream - Cant get this to update the variables C++ -

i'm writing program calculator type in sum , give answer. part works fine. problem having taking answer of previous sum , doing calculation that. like: 5 + 5 = 10 ans + 10 = 20 when run code below works fine, when doing normal calculations on , on again. when type eg. ans*2 uses previous values set operate , numb . if was: 5 + 5 , want use result , times eg 2 this: 10 + 5 = 15 here's code: #include <iostream> #include <cmath> #include <iomanip> #include <sstream> #include "bell.h" using namespace std; int main() { stringstream ss; double numa; char operate; double numb; double ans=0; string temp; cout<<"input: "; getline(cin, temp); ss.str(temp); ss>>numa>>operate>>numb; cout<<setprecision(9); while(temp[0] != 'q' && temp[0] != 'q') { if(temp[0]=='a' && temp[1]=='n' &...

ruby on rails - Using the Mechanize gem with the Nokogirl gem? -

i'm trying scrape website requires authentication element on page id of #celltotal . right now, using mechanize have logged page want access, using basic nokogiri functions like: @selector = page.css("#celltotal").text gives me error: undefined method `css' #<mechanize::page:0x61234f8> here have far: agent = mechanize.new agent.get("example.com") agent.page.forms[0]["username_field"] = "username" agent.page.forms[0]["password_field"] = "password" agent.page.forms[0].submit @selector = agent.page.css("#celltotal").text how can select element on page? you can use page.parser gain access underlying nokogiri object. http://mechanize.rubyforge.org/mechanize/page.html#method-i-parser require 'mechanize' agent = mechanize.new agent.get("http://stackoverflow.com/questions/23064821/using-the-mechanize-gem-with-the-nokogirl-gem/") agent.page.parser.class # =>...

c# - HL7 text message, how to find the specific field information -

msh|^~\&|a|b|c|d|201402141402||orm^o01|33987|d|2.3 pid|1|99989392|99989392||uhcmcdo^two^^^^||19810101|m|||5678 candy cane lane^^euclid^oh^44117^united states||(212)353-6048|(212)323-6078||||99576837||||nonhispan||||||||n pv1|1|o|320|r|c||49762^abouassaly^robert||||||||||||99576837||||||||||y|||||||||||||||201402141402||||||a49417331 in1|1|43||medicaid-oh: cuyahoga county dept of children & family services|3955 euclid ave^^cleveland^oh^44115-2505||(216)431-4500|||||||||uhcmcdo^two^|s|||||1||||||||||||||123456789001|||||||m gt1|1||uhcmcdo^two^^^||5678 candy cane lane^^euclid^oh^44117|(212) 353-6048||19810101|||s orc|nw||||||||20140214140256 obr|1|36358||gc1^non gyn - cytology|r||201403281402||||||||nongync^non gyn - cytology|49762^abouassaly^robert|||||||||||^^^^^r dg1|1|i9|v70.0|routine medical exam - v70.0 obx|1|tx|pth_site1^site a|1|left||||||f||||||| obx|2|tx|pth_spec1^specimen a||c-fna^fine needle aspiration||||||f||||||| i have hl7 files need on pid segment patient na...

java - "Add cast to textview" in Eclipse -

i'm doing teamtreehouse android course , have problem. have code line: textview answerlabel = findviewbyid(r.id.textview1); and after moving cursor on text "findviewbyid" should see window "add cast textview" , code line should looks here: textview answerlabel = (textview) findviewbyid(r.id.textview1); but in example happens nothing (there no window "add cast textview). do know, reason , how fix problem? did: project - clean, didn't anything, will grateful answers. :) this how mainactivity.java looks: public class mainactivity extends activity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); textview answerlabel = findviewbyid(r.id.textview1); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.main, menu); return true; } @over...

html - Prevent linebreak of floated elements -

Image
im trying create header of website has logo left aligned, navigation div 960px wide , centered , log in area right aligned. here screen shot of progress the issue login breaks new line , don't know how prevent it. floating elements doesn't work. here fiddle but doesnt produce same results i'm seeing when run locally. html <div id="header"><!-- outside container, holds logo , log in --> <div id="logoholder"> <p>logo</p> </div> <div id="navigation"> <p>navigation</p> </div> <div id="loginholder"> <p>login</p> </div> </div> css /*header options*/ #header{ width:100%; background-color:green; height:125px; } #logoholder{ float:left; } #navigation{ width:960px; background-color:blue; margin-...

android - What are the newest Play service Version? -

at moment compile app line compile 'com.google.android.gms:play-services:4.2.42' , use version 4.2.42 of play services, newest? there page can find out? ** edit: compile 'com.google.android.gms:play-services:4.3' with line got e problem can't become compiled, why?

java - How to print out a string between certain dates from log file -

so i've got log file need search strings , print out lines fall in between date ranges. ive got first part done im stuck on second. how print out string within date. want print strings between 2012-09-01 , 2012-09-15 log example: 2012-09-13 16:04:22 debug sid:34523 bid:1329 rid:65d33 'starting new session' 2012-09-13 16:04:30 debug sid:34523 bid:1329 rid:54f22 'authenticating user' 2012-09-13 16:05:30 debug sid:42111 bid:319 rid:65a23 'starting new session' 2012-09-13 16:04:50 error sid:34523 bid:1329 rid:54ff3 'missing authentication token' 2012-09-13 16:05:31 debug sid:42111 bid:319 rid:86472 'authenticating user' 2012-09-13 16:05:31 debug sid:42111 bid:319 rid:7a323 'deleting asset id 543234' 2012-09-13 16:05:32 warn sid:42111 bid:319 rid:7a323 'invalid asset id' this code far: import java.io.file; import java.io.filenotfoundexception; import java.util.arraylist; import java.util.date; import java.util...

c# - how to query nullable datetime in linq -

i calling following query, display latest date fieldname 'uploaddate', experiencing exception error such as: the entity or complex type 'cdwmodel.database_bd' cannot constructed in linq entities query.","exceptiontype":"system.notsupportedexception","stacktrace": code: public ienumerable<database_bd> getdate() { var data = (from c in db.database_bd select new database_bd() { uploaddate = c.uploaddate }).tolist().orderbydescending(c => c.uploaddate).take(1); return data; } database_bd model class: public partial class database_bd { public nullable<system.datetime> uploaddate { get; set; } } working solution: public datetime? getdate() { return data = db.database_bd.select(d => d.uploaddate) .orderbydescending(c => c) .firstordefault(); } if want dis...

string - How to get element type in C++? -

i beginner @ programming in c++, ask you, algorithm/ way see kind of element following in char / string. for example, if have char b[]="ab 3"; and index, let's "i" i=2; this means on i=3 there '3'. question: there exist algorithm, tells me, if on index 2, type of element on index 3? in our case 'int'. thank much! the type element in char array char. can, however, check if char digit isdigit (ch).

animation - C Animated Roulette Wheel -

for class have been tasked animating roulette wheel must: read standard input 1 valid bet on single number. randomly select winning number. display animation of roulette wheel consisting of @ least 2 images. 4.display user bet, winning number , payout value (calculated on basis each bet value 1) on image @ end of animation. i have animated wheel using loop , have random winner require assistance user input. for user input have comments , feedback: char userbet[3]; int result1; scanf( "%s" , &userbet); if(atoi(userbet) >=0 && atoi(userbet) <= 36){result1 = 1; printf("you bet on number %s", &userbet);} else { printf("please enter valid bet", &userbet);} this works, tested several numbers , got results wanted. can me using trigger animation? hoping use 'result' trigger animation through if statement instead program skips past whole section , plays anim...

Visual Studio 2010 formatting after saving -

Image
visual studio 2010 giving me grief. when make changes aspx file , save formatted code changes this: to this... every time. here's formatting. in tag specific options under html p tag missing. added didn't fix problem. can help? to format section: ctrl + k, ctrl + f or ctrl + e, ctrl + f to format document ctrl + e, ctrl + d

php - Installing Bootstrap theme in Symfony 2 project -

i looking @ installing this theme in sf2 project, , note there 4 files @ top of page download, namely: bootstrap.min.css bootstrap.css variables.less bootswatch.less i have less.php ( oyejorge/less.php ) parser installed along bootstrap itself, , have assetic setup compressing css , outputting page: <link href="/app_dev.php/css/425e28c.css" type="text/css" rel="stylesheet"> however, install superhero theme in link above can't find tutorials on how this? case of overwriting variables.less , importing bootswatch.less ? also read usage , customization sections of docs @ https://github.com/thomaspark/bootswatch . if want use theme (without customization) should include bootstrap.min.css or bootstrap.css html: <link href="/bootstrap.min.css" type="text/css" rel="stylesheet"> alternatively can compile own version of theme: download bootstrap's source files @ http://getbootstra...