Posts

Showing posts from February, 2012

html - Displaying Attachments (pdf/jpeg) in IE -

i trying display attachments inline in popup using window.open(). i using object tag display data. everytime see grey screen in ie. works fine in other browsers firefox, chrome etc please let me know if missing anything. thanks

Rump unikernel persistance storage -

i learning rump unikernels, , ran tutorial to run nginx static server . however many services might require sort of persistence. how can add persistence rump unikernel ? you can attach disk , use store persistent data information. rump supports mounting external disks - see here: https://github.com/rumpkernel/rumprun/blob/master/doc/config.md#blk-block-devices-and-filesystems you configure mount-point , device, , attach them in same order (for example in qemu -drive argument). example, qemu virtio device, use these values: source: "dev" mountpoint: whatever path want device accessible in unikernel fstype: "blk" (in aws use etfs) path: /dev/ld0a ("0" - first device, "a" - first partition) of course in software, can use database or other network based storage. also, checkout project unik (full disclosure, 1 of creator) - try create management platform unikernels, rump included. 1 of our features persistent volume sup

php - Changed my style.css file - Nothing happened -

i'm trying create wordpress theme , i'm coding on local server using xampp. after 10 hours of pulling hair out trying fix errors figure out how theme uploaded, , changes make style.css file aren't being applied. it uploads fine , tried changing php files , seemed work fine. any suggestions? ps. css code * { margin: 0px; padding: 0px; font: 13px tahoma; } body,div,hgroup { display: block; } body { text-align: center; width: 100%; display: -webkit-box; -webkit-box-pack: center; background-color: blue; } #wrapper{ display: -webkit-box; margin-bottom: 15px; -webkit-box-flex: 1; -webkit-box-orient: vertical; border: 1px a2a2a2 solid; width: 90%; text-align: left; } #header { font: 65px tahoma; border: 2px #a2a2a2 solid; } #content { width: 75%; border: 2px #a2a2a2 solid; float: left; } #sidebar { width: 23%; border: 2px #a2a2a2 solid; float: right; } /*#delimiter { clear: b

python - In Django ORM: Select record from each group with maximal value of a given attribute -

say have 3 models follows representing prices of goods sold @ several retail locations of same company: class store(models.model): name = models.charfield(max_length=256) address = models.textfield() class product(models.model): name = models.charfield(max_length=256) description = models.textfield() class price(models.model): store = models.foreignkey(store) product = models.foreignkey(product) effective_date = models.datefield() value = models.floatfield() when price set, set on store-and-product-specific basis. i.e. same item can have different prices in different stores. , each of these prices has effective date. given store , given product , currently-effective price 1 latest effective_date . what's best way write query return currently-effective price of items in stores? if using pandas, myself dataframe columns ['store', 'product', 'effective_date', 'price'] , run dataframe\ .sort_values

c# - How can I make sure that a file inside a Dropbox is really gone after delete? -

i using files inside dropbox communicate between servers. after while realized every once in while there delay in basic file operations when executed on file inside dropbox. what need this: public class myfile { const int maxwaitcount = 60; //.. /// <summary> /// remove file - has work inside dropbox directory /// </summary> /// <returns>0 ok or error code</returns> public int rm() { string name = os.wininternal(fullname); if (file.exists(name)) { file.delete(name); #region double check if file gone if (ensure) return awaitfilevanishing(name); #endregion } return 0; } //.. private int awaitfilematerializing(string filename) //.. private int awaitfilevanishing(string filename) //.. /// <summary> /// constructor: auto-ensure mode file systems not synchronously wait end of io operation i.e. dr

java - Implementing enum for reverse compatibility -

an application running in java 1.8 have run in few boxes java 1.4. application uses lot of constants (thousands of them) , implemented using functional enums. best way make reverse compatible? edit : i have seen few answers none of them satisfactory. make clear trying achieve here please take @ small example below public class sometype { public enum type { error("allerror","4"), input("allinput","5"), offline("alloffline","6"),; private final string type; private final string desc; type(string type, string desc) { this.type = type; this.desc = desc; } public string gettype(){ return this.type; } public string getdesc(){ return this.type; } } } } which consumed like for (sometype.type type: sometype.type.values()) { if(nodevalue.equalsignoreca

upgrading to ruby 2.3.0 NameError: uninitialized constant I18n::Config::Backend -

i upgraded ruby 2.2.2 2.3.0. whenever run rake task following error: christians-air:my_rails_app cman77$ rake --trace rake aborted! nameerror: uninitialized constant i18n::config::backend /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/i18n-0.7.0/lib/i18n/config.rb:19:in `backend' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/i18n-0.7.0/lib/i18n.rb:147:in `translate' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/actionview-4.2.6/lib/action_view/helpers/translation_helper.rb:69:in `translate' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/i18n-0.7.0/lib/i18n/config.rb:19:in `backend' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/i18n-0.7.0/lib/i18n.rb:147:in `translate' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/actionview-4.2.6/lib/action_view/helpers/translation_helper.rb:69:in `translate' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/railties-4.2.6/lib/rails/engine.rb:658:in `block in run_tasks_blocks' /users/cman77/.rvm/gems/rub

java - Android use and intent values from AsyncTask.execute(new Runnable() -

i ask, how use , intent values asynctask. this on top: ( this values use ) double confidence; string platenumbertest; this actual asynctask asynctask.execute(new runnable() { @override public void run() { string result = openalpr.factory.create(index.this, android_data_dir).recognizewithcountryregionnconfig("eu", "", destination.getabsolutepath(), openalprconffile, 10); log.d("open alpr", result); try { final results results = new gson().fromjson(result, results.class); runonuithread(new runnable() { @override public void run() { if (results == null || results.getresults() == null || results.getresults().size() == 0) { toast.maketext(index.this, r.string.notdetecttoast, toast.length_

How to reverse the Linked List in Swift extension? -

i want reverse single linked list in extension , it's failed.can me? thanks. public class list<t: equatable> { var value: t! var nextitem: list<t>? public convenience init!(_ values: t...) { self.init(array(values)) } init!(var _ values: array<t>) { if values.count == 0 { return nil } value = values.removefirst() nextitem = list(values) } } // reverse linked list. extension list { func reverse() { } } i have solution here. please read comments, evident code too. have added 'description' via customstringconvertible list debugging , printing. public class list<t: equatable>{ var value: t! var nextitem: list<t>? public convenience init!(_ values: t...) { self.init(array(values)) } init!(_ values: array<t>) { if values.count == 0 { return nil } var valuesc

ruby on rails - Nested Form Not Passing Id Attribute on Update -

i using rails5 nested form , nested form below permitted params params.require(:audit_type).permit(:name, :total_score, :id, risk_scoring_attributes: [:low, :medium, :high, :zero_tolerance, :_destroy, :id], audit_ratings_attributes: [ :id, :from, :to, :description, :_destroy]) view <%= nested_form_for(@audit_type, method: :patch) |f| %> <div class="table-responsive"> <table class="table table-search table-striped table-responsive" id="condensedtable"> <thead> <tr> <th>from</th> <th>to</th> <th>result</th> <th>actions</th> </tr> </thead> <tbody id='audit_rating_data'> <%= f.fields_for :audit_ratings, @audit_type.audit_ratings, :wrapper => false |builder| %>

VB.Net : Creating Multiple Balloontips Notification with NotifyIcon Control -

i'm developing simple program company approve , acknowledge request, using visual studio notifyicon showing notification via balloontip. however, i'm unable show 2 balloontips in same time, instead latter notification overwrites first balloontip. is there way show multiple balloontips without old 1 being overwritten? i'm using visual studio 2010 .net framework 4.0 develop program. thank before. best regard, jeff

Avoiding namespace pollution in python by using Classes -

a bit of background i'm writing python module own use, , i'm using python's logging module. there handlers , formatters , pair of functions create (for part) won't used anywhere else. however, still want able access , modify these variables elsewhere (for instance, other closely-coupled modules or scripts) a simple namespace what i'm doing using class definition group of variables together, this: class _logging: '''a little namespace our logging facilities. don't try instantiate it: group logging objects , keep them out of global namespace''' global logger def __init__(self): raise typeerror("that's not how works...") def gz_log_rotator(source, dest): '''accept source filename , destination filename. copy source dest , add gzip compression. use logging.handlers.rotatingfilehandler.rotator.''' gzip.open(dest, 'wb', 1

node.js - how can I parse url query string by C++? -

is there light-weight library this? i'm use node.js parse url log file, found it's slow it's default module querystring , tj's qs . so wonder if there c++ library parse url (better json string directly) , it's light-weight enough compile node c++ addon. qs.parse('/?0=foo') qs.parse('/?a[>=]=23') qs.parse('/?foo=bar&baz') qs.parse('/?a[b][c]=d') qs.parse('/?a[b][c][d]=e') qs.parse('/?a=b&a=c') qs.parse('/?a[]=b') qs.parse('/?a[]=b&a[]=c&a[]=d') qs.parse('/?a=b&a[]=c') qs.parse('/?a[]=b&a=c') qs.parse('/?a=b&a[0]=c') qs.parse('/?a=b&a[1]=c') qs.parse('/?a[b][]=c&a[b][]=d') qs.parse('/?a[1]=c&a[0]=b&a[2]=d') qs.parse('/?a[1]=c&a[0]=b') qs.parse('/?a[20]=a') qs.parse('/?a[12b]=c') qs.parse('/?he%3dllo=th%3dere') qs.parse('/?a[b]=c%20d') qs.parse('/?foo[0]=

asp.net mvc 3 - Unable to pass routing values from jquery to mvc action method -

javascript <script type="text/javascript"> $(function () { $("[id*=btnadd]").click(function () { //here passing routing value i.e student var url = '@url.action("getpv", "home", new { students=model.students })'; $('#grid1').load(url); }); }); html <div id="grid1"></div> <input type="button" id="btn" value="submit"/> mvc action //here iam getting students parameter null public actionresult getpv(list<student> students) { students.add(new student()); studentmodel objstudentmodel = new studentmodel(); objstudentmodel.studentlist = students; return partialview("_demopv", objstudentmodel); } model public class studentmodel { public list<student> studentlist { get; set; } } p

python - Adding permissions to django-allauth's OAuth token -

when using django-allauth, oauth handshake various social services handed automatically. in process add privileges oatuh token returned? for example, when using allauth github, login prompt on github "grants read-only access public information", default , minimum level of access. how pass additional scopes oauth handshake managed allauth? allauth lets pass parameters auth handshake using auth_params key in settings of social account provider. example, put following in settings.py add repo scope returned github token: socialaccount_providers = { "github": { "auth_params": {"scope": "repo"} }, }

ios - Get UITableViewCell from indexPath not Working -

i trying updated cell item while updating height of cell not working. [_tblbillhistory beginupdates]; [_tblbillhistory endupdates]; these method have used updated cell height err- > exc_bad_access(code=2,address=0x7fff5b4daf98) error message getting cellforrowatindexpath method. nslog printing selected row correctly. idea??? thank you. - (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath { if((selectedpath!=nil ) & ([indexpath isequal:selectedpath])) { nslog(@"%ld",indexpath.row); uitableviewcell *tempcell = [_tblbillhistory cellforrowatindexpath:indexpath]; uistackview *stkitems=(uistackview *)[tempcell viewwithtag:8]; for(int i=0;i<20;i++) { uibutton *btn=[uibutton buttonwithtype:uibuttontypesystem]; [btn settitle:@"test button" forstate:uicontrolstatenormal]; [stkitems addarrangedsubview:btn]; } return

android - Getting " Gradle sync failed " on Xabber import -

i importing xabber demo github android studio . , shows me error - gradle sync failed: configuration name 'default' not found. i tried change outer gradle , of no use still getting same error on syncing gradle. outer gradle - // top-level build file can add configuration options common sub-projects/modules. buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.5.0' } } allprojects { repositories { jcenter() } } and settings.gradle is include ':xabber' include ':xabber:otr4j' include ':xabber:memorizingtrustmanager' include ':xabber:emojicon' i have tried using tips this question no luck. do 1 have suggestion or faced same situation , resolved , please help. it common error in multiprojects gradle setup when project configuration in unavailable. gradle trying load configuration each project lister in settings.gradle , failed on of them. try fetch

Sql server select three different rows in same table with one query -

i have table 2 column(id , span) , 3 different rows id 1,2,3. table looks below: id span 1 30 2 -30 3 -7 i need these span various id. declare @leadlookupspan smallint, @notificationresendspan smallint; select @leadlookupspan = span usedcarnotificationconfig id=2; select @notificationresendspan = span usedcarnotificationconfig id=3; i doing select table check each row everytime. can me optimize query can retrieve span multiple id in 1 go. you can use conditional aggregation: declare @leadlookupspan smallint, @notificationresendspan smallint; select @leadlookupspan = max(case when id = 2 span end), @notificationresendspan = max(case when id = 3 span end) usedcarnotificationconfig id in(2, 3);

wordpress - How to set custom filler for product attributes like SIZE,COLOUR,PRICE,etc -

how set custom fillter product attributes size,colour,price,etc , knw there many plugin want custom code fillter. product attributes rows in table wp_postmeta . can select corresponding posts building query on tables wp_posts , wp_postmeta . here example using $wpdb->prepare() , $wpdb->get_results() : $posts = $wpdb->get_results( $wpdb->prepare( "select p.* {$wpdb->posts} p, {$wpdb->postmeta} m ". "where p.id = m.post_id , m.meta_key = %s , m.meta_value = %s ". "and p.post_status = 'publish' ". "and p.post_type = '<your_post_type>', array($attribute_name, $attribute_value) ) );

if statement - Python condition aggregation -

a block_id const t 2 4.620981e-01 0.050000 4 1.737035e+00 0.107291 5 1.103824e+00 0.138629 7 2.772589e-01 0.069315 8 2.255064e+00 0.383144 9 5.771610e-17 0.050000 b block_id number 2 1.666667 4 4.500000 5 2.750000 7 1.250000 8 4.833333 i have 2 dataframes above , block_id common key. ask how change value of a['const'] if respective row of a['t'] > 0.01. , new value of a['const'] respective value in b['number']*0.6 has same block_id. is np.where(a['t'] > 0.01, ......] applicable here? dfa = dfa.set_index('block_id') dfb = dfb.set_index('block_id') dfb.rename(columns={'number':'const'}, inplace=true) # maybe not needed dfa.loc[:, 'const'] = dfa.const.where(

php - Laravel5.2 with auth2.0 not working -

i have set auth server laravel5.2 following tutorial. http://discountry.github.io/tutorial/2016/02/20/laravel-restful-oauth2/ all things done well. when call url http://localhost/myprojectname/public/oauth/access_token using postman rest client not working. i get 500 internal server error getting fixed errors loged in apache error log.now gives following error when try access token. tokenmismatchexception in verifycsrftoken.php line 67: what wrong have done ?

difference between $a==5 and 5==$a in php -

today have faced question, unable answer it, have tried making php program unable find out exact reason if $a=5 both($a==5 , 5==$a) giving me output boolean true and, if $a != 5 both ($a==5 , 5==$a ) giving me output boolean false can tell me difference between $a==5 , 5==$a language point of view. **program** $a = 3; var_dump( 5==$a ); var_dump( $a==5 ); $a = 5; var_dump( 5==$a ); var_dump( $a==5 ); **output** boolean false boolean false boolean true boolean true comparisons not affected value write first. however, best practice put literal first, e.g. 5 == $x because if mess , enter 1 equals sign, you'll error instead of accidental value assignment, far easier debug.

Can we create multiple users for single neo4j database -

i want create multiple users access single neo4j database each user having own database location. possible? neo4j doesn't support that, there 3rd party solution that. securing neo4j graphaware enterprise

Running soapui tests from testrunner.bat -

i'm attempting run testrunner.bat during our build process, execution hangs. when logged on server different account , tried running manually noticed started popup asking usage data, assume happening during automated build. how can turn off build account can't logon with? there computer wide setting of sort? updated info: have set disable usage statistics in preferences. output when run testrunner.bat build process using service account: 07:40:29,362 info [defaultsoapuicore] creating new settings @ [c:\users\tfsservice\soapui-settings.xml] slf4j: failed load class "org.slf4j.impl.staticloggerbinder". slf4j: defaulting no-operation (nop) logger implementation slf4j: see http://www.slf4j.org/codes.html#staticloggerbinder further details. 07:40:40,945 info [pluginmanager] 0 plugins loaded in 1 ms 07:40:40,946 info [defaultsoapuicore] plugins loaded if logon server , run manually using admin account following output instead (errors): 2016-04-

Search bar in html using user input for url redirection -

i wish have search bar goes specific url. have code pasted below, goes image_edit?path={path}. invoked tbox class assume. want path along lines of image_edit/path/index.html. meaning variable inputted user used directly in url , not method variable variable 'path'. in advance help. edit: better explanation: code below forms form goes url image_edit?path={path} {path} user's input in form. want url image_edit/{path}/index.html instead. <form style="position: absolute; top: 115px; left: 1165px;" id="quick-search" method="get" action="image_edit"> <fieldset class="search"> <label for="path">search:</label> <input class="tbox" id="input" type="text" name="path" value="" /> <button class="btn">search</button> </fieldset> </form> why dont use javascript redirect location first

python - How to set a minimum value when performing cumsum on a dataframe column (physical inventory cannot go below 0) -

how perform cumulative sum minimum value in python/pandas? in table below: the "change in inventory" column reflects daily sales/new stock purchases. data entry/human errors mean applying cumsum shows negative inventory level of -5 not physically possible . as shown "inventory" column, data entry errors continue problem @ end (100 vs 95). dataframe change in inventory inventory cumsum 2015-01-01 100 100 100 2015-01-02 -20 80 80 2015-01-03 -30 50 50 2015-01-04 -40 10 10 2015-01-05 -15 0 -5 2015-01-06 100 100 95 one way achieve use loops messy , there more efficient way this. here code generate dataframe: import pandas pd df = pd.dataframe.from_dict({'change in inventory': {'2015-01-01': 100, '2015-01-02': -20, '2015-01-03

conv neural network - Which part of the deploy.prototxt file in caffe is absolutely necessary for testing? -

in recent discussion, found out parts of deploy.prototxt exist because have been directly copied train_test.prototxt , ignored during testing. example: layer { name: "conv1" type: "convolution" bottom: "data" top: "conv1" param { #starting here lr_mult: 1 } param { lr_mult: 2 } #to here convolution_param { #is section useful? num_output: 20 kernel_size: 5 stride: 1 weight_filler { type: "xavier" } bias_filler { type: "constant" } } } i told section containing lr weights biases useless in deploy files , deleted. got me thinking, convolution_param portion absolutely required? if yes, still have define weight , bias fillers testing using file , fillers initialized when need train network. there other detail unnecessary? the convolution_param portion required can remove weight_filler , bi

android - Connecting toolbar with the navigation drawer -

i have several activities want use same navigation drawer. here's part of activity class code related drawer: toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); getsupportactionbar().setdisplayshowtitleenabled(false); drawerlayout drawer = (drawerlayout) findviewbyid(r.id.drawer_layout); actionbardrawertoggle toggle = new actionbardrawertoggle( this, drawer, toolbar, r.string.navigation_drawer_open, r.string.navigation_drawer_close); drawer.adddrawerlistener(toggle); toggle.syncstate(); navigationview navigationview = (navigationview) findviewbyid(r.id.nav_view); navigationview.setnavigationitemselectedlistener(this); i'm planning make draweractivity class , extend activities want navigation drawer. therefore, have move drawer code draweractivity. the problem: toolbar important initialization of actionbardrawertoggle . every activity has different toolbar depending upon needs of activity. therefore, toolbar layouts mu

Java Catch Object Error -

this code below method header , body, following error: no exception of type object can thrown exception type must subclass of throwable . i'm attempting execute block of code: catch(object object) . public void method15665(class435 class435, int i) { { try { try { byte[] = new byte[(int) class435.method7563(1085678935)]; int i_3_; (int i_4_ = 0; i_4_ < is.length; i_4_ += i_3_) { i_3_ = class435.method7564(is, i_4_, is.length - i_4_, (byte) -10); if (i_3_ == -1) throw new eofexception(); } class224_sub8 class224_sub8 = new class224_sub8(is); if ((class224_sub8.abytearray8535.length - class224_sub8.anint8536 * 475822179) < 1) { try { class435.meth

java - Maven web project is not properly deployed on Tomcat 8 -

i have maven web project working fine when run maven build , take war file , manually deploy in standalone server. when use 'run on server' option in eclipse, project seems deployed in tomcat server class files missing in workspace server location. pom.xml , pom.properties available. not sure why war file not deployed when run through 'run on server' option. (i tried mvn eclipse:eclipse command convert maven java web project unsuccessful on deployment) i have m2e plugin in eclipse. tomcat version tomcat 8. edited: pom.xml <?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>com.abc</groupid> <artifactid>reports</