Posts

Showing posts from July, 2013

.net - change css class in div tag using asp.net(C#) -

hi want change css class properties using c#, background image, font size, font style, , font. there interface user change these values. once save them add them db. once user login can retrieve them db problem how show them. this structure of master page <html> <head></head> <body> <div id="wrapper" class="abc"> </div> </body> </html> what easy way change values of abc class according relevant user? try this client side code <div id="wrapper" runat="server" class="abc"> server side code string classname="yourclassname";//you can change name on runtime wrapper.attributes["class"] = classname;

How to pass struct byref and readonly to a function in C#? -

is possible pass struct byref , readonly function? (just t const& in c++) struct { public int b; } void func1(ref a) // want make `a` immutable { } how that? update my biggest concern passing (1) immutable state (2) efficiently. second concern mutating state must simple , easy mutable object. currently doing this. kind of boxing. class immutablebox<t> t : struct, new() { public readonly t state; immutablebox(t state) { this.state = state; } } struct examplestatea { public string somefield; } void func1(immutablebox<examplestatea> passimmutablestatewithbox) { } by keeping instance of immutablebox<t> , can pass immutable object pointer copy, , it's still easy edit state because state mutable. gain chance optimize equality comparison pointer comparison.

python - How to write custom django manage.py commands in multiple apps -

imagine have 2 or more apps in django project, able write , execute custom manage.py commands when had 1 app, a . now have new app, b , , mentioned in https://docs.djangoproject.com/en/dev/howto/custom-management-commands/ created directory structure of b/manangement/commands , wrote custom module. when run python manage.py , keeps complaining unknown command . if move command other app, i.e. folder a/management/commands , run python manage.py <command> , works seamlessly. any idea how can resolve this? as @babu said in comments, looks may not have added app installed_apps in settings.py . it's possible you're missing __init__.py files (that required in python modules) management , commands folders. alternatively, (sorry this) may have misspelt "management" or "commands", or name of command you're running.

.net 4.0 - Scrollviewer Scrollbar doesn't appear -

i not able scrollviewer working in wpf . guess doing wrong not able figure out what. made sure not using scrollviewer in side stackpanel . please note there 2 of them , none seems work. i did try fix size of scrollviewer parent container restrict size, works, that's not want do. want make sure on resizing window, increase of size happens in containers appropriately. here code, did change strings , paths part of client application: <window x:class="common.views.someview" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:wnd="clr-namespace:common" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" xmlns:dxgt="http://sch...

.htaccess - Print out entire apache configuration for a particular directory -

php, postfix, , other applications have functions or flags ( phpinfo() or postconf -n ) print out current configuration information. apache has mod_info can enabled print configuration information to specific location: loadmodule info_module modules/mod_info.so <location /server-info> sethandler server-info order deny,allow deny allow 1.2.3.4 </location> however apache configuration change on directory-by-directory basis, instance .htaccess files. how might 1 print out entire apache configuration for specific directory including paths files used make configuration? you can try using <files> container: loadmodule info_module modules/mod_info.so <files "server-info"> sethandler server-info order deny,allow deny allow 1.2.3.4 </files> that make can request server-info in existing directory. however, keep in mind of mod_info limitations : configuration directives .htaccess files not lis...

jquery ui - Refresh CSS ellipsis when resizing container -

Image
i'm using jquery ui , have setup table resize columns. span { -ms-text-overflow: ellipsis; -o-text-overflow: ellipsis; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; } i apply simple ellipsis cells when small ... if @ page looks like: when resize column however, doesn't re-apply ellipsis :( is there simple way this? tried removing overflow making visible, re-applying hidden, ellipsis goes original view when rendered. the problem table cell had fixed width in css: width: 120px; which resized javascript. when resizing happens cell content in cell stayed same width. changing css min-width: 120px; , resizing javascript width min-width solved problem.

android - I can't work emulator in eclipse -

i can't work emulator in eclipse in ubuntu.i clicked window->avd manager , selected my_device clicked start button. emulator not working. how can run it? you need patient. depending on avd select, api level , hardware running on, can take long time start. if seeing no window appear @ all, different matter. errors see in console?

excel - Regarding converting .CSV file dates -

Image
i working in software. got out put .csv format file. need convert .csv file in excel 2007 , have use file. in have previous month date , current month date. example working may month means date 13/05/2013 standard format, in cells found format changed 3/5/2013 (05-mar-13) should 5/3/2013. how change - formula or formatting? instead of double-clicking on .csv file try data > external data - text, import , @ step 3 of 3 format date suit. edit attempt @ clarification i little confused op’s comment here ( it not working when coupled green tick) , not quite sure whether dmy or mdy required output given source in columna, importing dmy gives columnb (after formatting) , mdy gives columnc (after formatting). both columns b , c in general format appear numbers ( b5 41338 , c5 412397 – vice versa in row6). if 1/4/13 april 1st , 1/5/13 5th january see no solution given data presently available. normal problem excel has default setting such 6/7/13 converts july 6t...

javascript - Can arguments be overwritten? -

according mozilla document , arguments can set: arguments[1] = 'new value'; but jshint refuses accept that. can arguments set or not? this have now: handlebars.registerhelper('proppartial', function(property, options) { var name = ember.handlebars.get(this, property); // have because arguments[0] = name; not work, contrary stated here: // https://developer.mozilla.org/en-us/docs/web/javascript/reference/functions_and_function_scope/arguments var args = [], i, l; args.push(name); (i = 1, l = arguments.length; < l; i++) { args.push(arguments[i]); } return ember.handlebars.helpers.partial.apply(this, args); }); update, reference thanks @tjcrowder, working code, fooling jshint : handlebars.registerhelper('proppartial', function(property, options) { var name = ember.handlebars.get(this, property); var args = arguments; args[0] = name; return ember.handlebars.helpers.partial.apply(this, a...

java - MYSQL connector saying it has connected even with the wrong username? -

i building database connection scanner security course @ university. have used drivermanager.getconnection(connectionurl, username, password) , seems work fine 1 exception cannot understand. if enter wrong username still returning connection??? test code pasted below. pointers appreciated. returns correct error if put wrong password in, if turn server off tells me. unknown reason not tell me if username wrong, if not checking! public class dbconnector { connection connection = null; string dburl = "jdbc:mysql://localhost:3306"; string username; string password; public dbconnector() { // todo auto-generated constructor stub } public connection tryconnection(string username, string password){ try { class.forname("com.mysql.jdbc.driver").newinstance(); connection = drivermanager.getconnection(dburl, username, password); system.out.println("connected"); } catch (instantiationexception e) { system.out.pri...

c# - Is there a way to propagate input validation in model through viewmodel -

i have model few properties , in model validation checks (checking if values don't exceed ranges, if number, if valid postal code etc). these checks should done model, think. i have choice of using 1 of these validation interfaces: inotifydataerrorinfo or idataerrorinfo . not have preference. i have viewmodel exposes many of model's properties along couple of additional, view-specific , housekeeping properties such isselected, isinscope, issaved etc. the view (in case dxgrid devexpress) bound collection of viewmodels, hiding model's validation checks (it bound viewmodel's interface). there easy way propagate model's validation checks view, , through viewmodel? edit : fyi, i'm using simple mvvm toolkit, has incorporated inotifydataerrorinfo in model base class, not in viewmodel base class.

command line interface - Expect and Spawn with PowerShell -

is there way expect , spawn powershell. have parse cli program powershell asking password there way input password via powershell. in perl or python in bash can use expect/spawn there solution in powershell ? you can use read-host prompt user input. see here more information. $pass = read-host 'what password?' -assecurestring $decodedpass = [system.runtime.interopservices.marshal]::ptrtostringauto([system.runtime.interopservices.marshal]::securestringtobstr($pass)) i'm sure want spawn, can execute other scripts or executables calling them .\myotherscript.ps1

xml - EXSLT custom function causes stylesheet to return "too many nested apply-templates calls" error -

i tried implement "ternary operator" extension function use in stylesheet using exslt's func:function element. compatibility reasons, have use xslt 1.0. came this: <func:function name="myext:ternary"> <xsl:param name="expr" /> <xsl:param name="iftrue" /> <xsl:param name="iffalse" /> <func:result> <xsl:choose> <xsl:when test="boolean($expr)"><xsl:value-of select="$iftrue"/></xsl:when> <xsl:otherwise><xsl:value-of select="$iffalse" /></xsl:otherwise> </xsl:choose> </func:result> </func:function> and works fine wherever use it. however , tried implement substring-after-last function (from here ). code works fine: <func:function name="myext:substring-after-last"> <xsl:param name="string" select="''"/> <xsl:param name=...

c++ - End of file on pipe magic during open -

i have c++ application in starting process(wireshark) following. if (fp == null){ fp = popen(processpath, "r"); //processpath process want start if (!fp){ throw std::invalid_argument("cannot start process"); } fprintf(fp, d_msg);//d_msg input want provide process } else if(fp != null){ fprintf(fp, d_msg); } the problem when execute c++ application, start wireshark error end of file on pipe magic during open what should avoid that? also tried using mkfifo create named pipe , execute it. used this: if (fp == null){ system("mkfifo /tmp/mine.pcap"); fp = popen("wireshark -k -i /tmp/mine.pcap", "r"); if (!fp){ dout << "cannot start wireshark"<<std::endl; throw std::invalid_argument("cannot start wireshark"); } input = fopen("/tmp/mine.pcap", "wb"); fprintf(input , d_msg); fclose(input)...

How to use css to put an item just above the top of the screen? -

i'm working on page animates slides out of screen. how it. var previousoffset = ($(window).height())*-1; previousoffset = previousoffset+'px' $('.current').animate({ top: previousoffset, }, 500, function(){...} i wondering, there cleaner way it, pure css, without measuring height of of screen. currently, item has position:absolute , not requierment. to clear css of .current is: .current{ top: -"height of screen"; position: absolute; } i without "height of screen". this may depend heavily on other markup, try setting height of .current element 100% , deal percentages. implicitly handle resizing of window you. note must set html & body element 100% work. css html, body { margin:0; height:100%; } .current { position:absolute; height:100%; width:100%; } js $('#nextbutton').click(function(){ $('.current').animate({ top: '-100%' }, 500, functio...

linux - Does it affect the performance of server if many socket connections are in TIMEWAIT state -

lets have 15000 connections in timewait state affect performance in anyway? problem connecting erlang redis , redis timeout , firing man y queries lets 15000 in 1-2 seconds. problem not socket limit i open connection fire query , close connection leads many connections in timewait state ok me because have 60k available sockets. on erlang side have 20 second timewait think more sufficient task redis fast. what can problem? btw using eredis library it more efficient not open connection redis @ will, have pool of stable connections. eliminate significant overhead on starting tcp session each time. may face "too many open files" error. consider tune /etc/sysctl.conf (if on linux). params worth at: net.ipv4.tcp_tw_recycle net.ipv4.tcp_tw_reuse net.ipv4.tcp_fin_timeout

asp.net - how to retrieve the updated data from the gridbox and update it in the database -

my code returns data has got database unable updated data gridcontrol. this default.aspx designing has been done of gridview. <asp:content id="headercontent" runat="server" contentplaceholderid="headcontent"> </asp:content> <asp:content id="bodycontent" runat="server" contentplaceholderid="maincontent"> <asp:gridview id="gridview1" runat="server" autogeneratecolumns="false" onrowupdating="gridview1_rowupdating" onrowediting="gridview1_rowediting" onrowupdated="gridview1_rowupdated" onrowcommand="gridview1_rowcommand"> <columns> <asp:commandfield showeditbutton="true" showdeletebutton="true" showinsertbutton="true" /> <asp:templatefield headertext="id" sortexpression="id"> <itemtemplate> <as...

ios - touchesBegan: withEvent: is not called when tapped on a UIButton -

what want implement column matching type functionality. have 3 buttons on right column , 3 on left column info on them. want draw path 1 button on right side of button on left side dragging finger. i use uibezierpath path draw path, , start , end point needed. now issue how can trigger touchesbegan , touchesmoved , touchesended methods tapping on buttons can start , end points. another option thinking cover buttons invisible uiview, , somehow check if point touched of overlay view lies in of button frames. btw can replace these buttons simple uiimageview well. added buttons sake of getting touch points. any help. create subclass of uibutton , add this... - (void)touchesbegan:(nsset *)touches withevent:(uievent *)event { [super touchesbegan:touches withevent:event]; [self.nextresponder touchesbegan:touches withevent:event]; } this touches within button.

javascript - jquery mobile swipe function only works after page refresh -

i using jquery mobile sideswipe gestures on ipad. the below code in file referenced in html file. my html file has: <div data-role="page" id="device1"> <!--content part of html page --> </div> <!--more divs incrementing id --> <div data-role="page" id="device4"> <!--content part of html page --> </div> this format used in multiple html files. i use code (found on stackoverflow) - didnt want post on old thread. $(document).ready(function() { $('.ui-slider-handle').on('touchstart', function(){ // when user touches slider handle, temporarily unbind page turn handlers dounbind(); }); $('.ui-slider-handle').on('mousedown', function(){ // when user touches slider handle, temporarily unbind page turn handlers dounbind(); }); $('.ui-slider-handle').on('touchend', function(){ //when us...

c++ - How to embed path to resource file / CMake (on linux) -

i creating c++ class has constructor this: myclass(const std::string& config_file); i.e. configuration file should passed constructor when instantiating object. part of project create default configuration file used in ~90% of cases, , people able use class as: myclass myinstance(default_config_file); i.e. want symbol 'default_config_file' point path of configuration file have created part of project. problem have no clue people install library. there (cmake ??) trick/best practices here? i guess like set( default_config_file ${cmake_install_prefix}/share/app/default_config.json) but things not work in build directory?! joakim after set command have shown, can add in cmakelists.txt line this: add_definitions(-ddefault_config_file=${default_config_file}) or add_definitions(-d`default_config_file=${default_config_file}`) (you should experiment happens if path contains spaces, general) this should give default_config_file used @ compile t...

website - Centos Apache VirtualHost setup -

apologies if problem perhaps basic issue , i'm overlooking something. i attempting setup websites on apache virtualhost. my virtualhost configuration included in /etc/httpd/conf/httpd.conf , following: <virtualhost *:80> servername test.site.com serveralias test.site.com test.site-london.com documentroot /var/www/site-dev <directory /var/www/site-dev> options -indexes followsymlinks multiviews allowoverride order allow,deny allow </directory> my problem when visit test.site.com or test.site-london.com , oops! google chrome not find test.site.com message. instead, websites accessible when utilize ip address in following format: 172.54.88.203/test.site.com . bit more confusingly, test.site.com see if typed ip address address bar , push enter. i tried setting /etc/hosts file following input still not work properly: 127.0.0.1 localhost localhost 172.54.88.203 test.si...

How to format the file in powershell -

am trying format 1 file below. ipaddresss hostname result none sinuiy01.infra.go2uti.com notvalid none sinuid20.devtst.go2uti.com notvalid 172.21.40.204 usem9999.essilor.res success 172.21.40.204 webmail.nscorp.com notvalid 172.21.40.204 nsc.nscorp.com unsuccess 172.21.40.204 bp-nsc.nscorp.com notvalid but need result below:-- ipaddresss hostname result none sinuiy01.infra.go2uti.com notvalid none sinuid20.devtst.go2uti.com notvalid 172.21.40.204 usem9999.essilor.res success 172.21.40.204 webmail.nscorp.com notvalid 172.21.40.204 nsc.nscorp.com unsuccess 172.21.40.204 bp-nsc.nscorp.com notvalid could please suggest whcih function should use above results? belo...

android - Session state CLOSED_LOGIN_FAILED -

i'm working on facebook android sdk. i'm getting hash key using following code .now i'm getting error session state closed_login_failed after login facebook. ref : if(session.isopen()), facebook login on android returning false try { packageinfo info = getpackagemanager().getpackageinfo( "your.root.package", packagemanager.get_signatures); (signature signature : info.signatures) { messagedigest md = messagedigest.getinstance("sha"); md.update(signature.tobytearray()); log.d("keyhash:", base64.encodetostring(md.digest(), base64.default)); } } catch (namenotfoundexception e) { } catch (nosuchalgorithmexception e) { } ok sons! listen solution , saved go solution , folow carefully: http://www.helloandroid.com/tutorials/using-facebook-sdk-android-development-part-1 now pay close attention: must java 1.6!! in case did...

Chrome doesn't load untrusted SSL content in iframe -

whenever try load page ssl certificate untrusted inside iframe , chrome 29 displays error page inside instead. error code err_insecure_response. for same scenario, firefox displays ssl warning in iframe option ignore it. example: http://codepen.io/anon/pen/glpdv how can force chrome display either page or dismissable ssl warning? this problem cause while ssl integration not completed properly. details available here : https://support.mozilla.org/en-us/kb/connection-untrusted-error-message if using amazon , godaddy server combination let me know can provide working guide fix issue.

.net - VB.NET Array with Double Bracket ()() -

i came accross double bracket after variable name , wondering mean. what below mean? private orgidfield()() string i aware of; private orgidfield() string it jagged array (an array of arrays). can find more info @ this msdn article .

BASH - Check if a number exists in one CSV and display warning if in new CSV -

so have 1 csv file contains following: number,name,phone 11111,dr spoon, 0115 1234 567 11112,mrs eggface, 07711111111 and csv long list of numbers: number 11145 15687 11598 11112 now need somehow check row in first csv doesn't exist in second, , if show me does. suggestions? cheers! this print lines in file1 first field found in file2 : $ awk -f, 'nr>1&&nr==fnr{a[$1];next}fnr>1&&($1 in a)' file2 file1 11112,mrs eggface, 07711111111 add block format printing like: $ awk -f, 'nr>1&&nr==fnr{a[$1];next}fnr>1&&($1 in a){print $1,"in both!"}' f2 f1 11112 in both!

thrift - Why I am getting java.lang.AbstractMethodError errors? -

what possible causes abstractmethoderror? exception in thread "pool-1-thread-1" java.lang.abstractmethoderror: org.apache.thrift.processfunction.isoneway()z @ org.apache.thrift.processfunction.process(processfunction.java:51) @ org.apache.thrift.tbaseprocessor.process(tbaseprocessor.java:39) @ com.gemfire.gemstone.thrift.hbase.threadpoolserver$clientconnnection.run(unknown source) @ java.util.concurrent.threadpoolexecutor$worker.runtask(threadpoolexecutor.java:886) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:908) @ java.lang.thread.run(thread.java:662) the simple answer this: code trying call method declared abstract . abstract methods have no body , cannot executed. since have provided little information can't elaborate more on how can happen since compiler catches problem - as described here, means class must have changed @ runtime.

python - Arelle Xbrl validation - unable to start web service - socket error 10013 -

Image
i'm using arelle project implement validation of xbrl files. http://arelle.org/documentation/api-web-services/ when try start webserver can call code receive following error. been looking how fix , points disabling antivirus. got disabled , still error. arelle python project this should start webservice can reach on www.localhost:8082/rest/xbrl appearently issue previous release of project. i installed latest version 2013-07-25 , no longer had socket error

BGI Error in opening C++ program with DOSBox -

i have program in c++ uses graphic.h want open dos-box when try error dos-box: bgi error: graphics not initialized (use 'initgraph') have used initgraph in program in way: gd=detect; initgraph(&gd,&gm,""); check initgraph(), should like initgraph(&gd,&gm,"c:\tc\bgi"); if doesnot work try giving slash like: initgraph(&gd,&gm,"c:\\tc\\bgi"); if again doesnot not work check environmental variables also. you may refer existing post in bgi error, how resolve it?

bash - unix: renaming batch of files - how do I add numbers from 1 to 4000 to the filenames of 4000 files? -

i have 4000 files, , need add nrs 1 4000 @ beginning of filenames. for example: file_a.cel file_c.cel file_g.cel file_x.cel ... other_file.cel should become: 1_file_a.cel 2_file_c.cel 3_file_g.cel 4_file_x.cel ... 4000_other_file.cel it important underscore after number gets added. filenames totally different (there no system filenames), , doesn't matter in order numbered. there easy way using bash? many in advance! using a for loop , mv should give desired effect. it's not particularly interesting solution, it's simple. count=1 file in ./*; mv "$file" "${count}_$file" let count++ done

android - cast a class to an activity -

i'm trying create listview wich enable open 2 other activities created before. i've got problem intent. i'm quite sure understand lactivity activity wich exists. explain me why? thank you!! public listmenu extends activity { private listview malistview; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.list); // create list of elements list<elementofconstruction> liste = new arraylist<elementofconstruction>(); string columns = null; class<?> calculcolumns = null; elementofconstruction columns = new elementofconstruction(columns, 0, r.drawable.columns, calculcolumns, 100); liste.add(columns); string beam1 = null; class<?> calculbeam = null; elementofconstruction beam1 = new elementofconstruction(beam1, 0, r.drawable.beam1, calculbeam, 200); //récupération de la listview créée dans le fichier main.xml malistview = (...

apache - Moving a file from a remote server using CGI script -

this need i have local server hosting cgi shell scripts. have file in remote server. want cgi script copy file remote server local server. this tried to avoid entering password every time, created key file using ssh-keygen command , copied public key file remote server /root/.ssh/authorised_keys file , worked. whenever execute scp user@remotehost:/root/ . intended file copied local server without manual authentication , works perfect. now, want same thing apache user triggeres cgi script. used below command generate key file apache user sudo -u _apache ssh-keygen -t rsa and system response enter file in save key (/library/webserver/.ssh/id_rsa) normally .ssh keys stored in location /root/.ssh , why system command defaulting /library/webserver ? can have 2 .ssh files? is there other solution trying? thank you every user in system should have his/her own ~/.ssh directory. when ssh runs, .ssh directory in user's home directory. can check user's ...

selenium webdriver - Where the assert message will be displayed -

i tried code package base; import org.testng.assert; import org.testng.annotations.test; public class assertcheck { @test public void check() { assert.asserttrue(true, "testing string true"); } } and code succeeds message "testing string true" not displayed. checked in console output , in testng results. just information, message parameter executed if assert condition false. message appear in console. but in case assert condition passed, message part not executed, not see message in case. if want see message in both cases, should use try-catch statement like try{ assert.asserttrue(true, "testing string true"); //print message case assert pass and/or perform other event }catch (exception e){ //print message case assert fails and/or perform other event loggerobj.debug("assert failed "+e.getmessage()); }

apache - How to route specific URL segments to separate web root directories? -

my yii project has following structure: webapp ----frontend --------www ------------index.php ----backend --------www ------------index.php ----api --------www ------------index.php https://github.com/tonydspaniard/yiinitializr-advanced apache 2.2 each www directory has own .htaccess file. example "webapp/frontend/www/.htaccess": options +followsymlinks rewriteengine on rewritebase / rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^([^/].*)$ /index.php/$1 [l] for separate parts of application use subdomains "api.webapp.com","admin.webapp.com" (symlinks in public_html folder): webapp.com -> webapp/frontend/www api.webapp.com -> webapp/api/www admin.webapp.com -> webapp/backend/www but have problems cross domain ajax requests api, , want this: http://webapp.com -> webapp/frontend/www/index.php http://webapp.com/api/ -> webapp/api/www/index.php ...

dll - Compile a C++/SDL with static library? -

in windows system need keep .dll files in same .exe ? wish merge files in 1 single .exe , there way how? i linux , windows user, in linux use terminal, in windows use codeblocks ! dlls in windows .so in linux, made separate. if want merge library, don't use dll, use static library instead (.lib) edit: if not writing library (somebody gave dll), take @ this

jQuery autocomplete filtering incorrectly -

i have input field has auto complete jquery field. <input id="peoplerolecodeauto" type="text" size="50"/> that when type "a" see "atpl" value listed. when type "at" disappears, when type "atp" shows again. have limited jquery exposure , wondered if had suggestions. jquery('#peoplerolecodeauto').icisautocomplete({ source: rolecodes, localjson: true, mustmatch: true, linkedfields: ['peoplerolecode', 'peoplerolecodedescription'], select: function(event, ui){ jquery('#peoplerolecode').val(ui.item.id); jquery('#peoplerolecodedescription').val(ui.item.desc); }, change: function(event, ui){ jquery('#peoplerolecode').val(ui.item.id); jquery('#peoplerolecodedescription').val(ui.item.desc); } }) function icisautocomplete(param...

rounding error - Matlab: finding position of last nonzero digit of a number -

i have column vector pp filled numbers, instance: 23.234000 3.1237340 4.4359000 i want find number of places right of decimal smallest nonzero digit in vector occupies, in case 6 , because of 4 in 3.123734 . want multiply every number in vector 10^6, rid of decimals in vector. want eliminate rounding errors. what's best way done? the actual value may different being displayed matlab. instance, consider following example: >> x = 1.4 - [0.1; 0.09999999] x = 1.3000 1.3000 matlab shows both values 1.3, in fact, none of them is: >> x - 1.3 ans = -2.2204e-16 1.0000e-08 my suggestion therefore decide on fixed accuracy (say, 6 digits), , multiply corresponding power of 10.

ruby on rails - Many to Many association with Single table inheritance -

i looking many-to-many association within child models. below. can please guide what's best way it. parent class < activerecord::base end child1 class b < has_many :bc has_many :c ,through: :bc end child2 class c < has_many :bc has_many :b, through: :bc end if don't need columns, use has_and_belongs_to_many can read http://guides.rubyonrails.org/association_basics.html

sql server - Read XML child node attributes using SQL query -

i have 1 xml column (criteria) in table (qualifications) contains different xml: <training id="173"><badge id="10027" /><badge id="10028" /></training> <book category="hobbies , interests" propertyname="c#" categoryid="44" /> <sport category="hobbies , interests" propertyname="cricket" categoryid="46" /> <education id="450" school="jai ambe vidyalaya"></education> i want read "badge" node "id" attributes nodes under "training" node. can help? ids of badge elements inside training only select t.c.value('.', 'int') id qualifications q cross apply q.criteria.nodes('//training[badge]/badge[@id]/@id') t(c) ids of badge elements anywhere (not inside training ) select t.c.value('.', 'int') id qualifications q cross apply q.criteria.n...

Remove a programatically added <li> tag using jQuery -

good day, i have been struggling particular piece of code while now. have read , have tried jquery stackoverflow. main problem answers (well find) address generated html or static pages. my delete code (below), both commented , uncommented, works on page created static html list. $(function () { //$(".deletebutton").click(function () { // //$(this).closest("li").remove(); // jquery(this).closest('li').fadeout(400, function () { $(this).remove(); }); //}); $('.deletebutton').on({ click: function () { jquery(this).closest('li').fadeout(400, function () { $(this).remove(); }); } }); }); however use jquery add "li" tag, delete button deletes text within delete button leaving "li" on page. here code use add "li" function updatepage() { $.ajax({ type: 'get', url: "newadditions", contenttype: "application/json...

autocomplete - Twitter Bootstrap Typeahead only populating letter "a" -

so i'm trying populate list of countries using bootstrap typeahead. want person start typing in text field country live in , show options choose from. initially, had data-source set variable huge array of countries strings. getting 1 singular "a" show when type in "a" itself. literally letter a. then changed source directly hold array , array held inside of 2 single quotes. when hit key comes results, literally when put "a" text box, result is: a a a a a or sort... weird. here code: in jsp here portion inside of "head": <head> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>disti tool wireframe</title> <script type="text/javascript" src="${pagecontext.request.contextpath}/js/disti.js"></script> <link rel="stylesheet" href="${pagecontext.request.contextpath}/css/style.css" /> <...