Posts

Showing posts from September, 2015

Function that returns a formatted array in VBA -

i have function prints excel data text file in array format following: [ ['id', 'label', 'longitude', 'latitude', 'country', 'region', 'ttl_wt_flw_thru', 'sum-of-bol-wt', 'count of wdr_ref', 'ratio'], ['aeauh', 'abu dhabi, united arab emirates', 54.3666667, 24.4666667, 'ae', 'eame', 66, 30, 8432, 281.066666666667], ['aedxb', 'dubai, united arab emirates', 55.307485, 25.271139, 'ae', 'eame', 682, 3, 8369, 2789.66666666667] ] my code writing array is: function fillsourcearray() dim long, j long, s string dim lastrow double dim s1 string 'opens file filepath = filepath & "dataarray" & ".txt" open filepath output #1 'read source data dataarray = sheets("nodes").cells(1).currentregion.value 'determine lastrow lastrow = sheets("nodes").range...

gwt - Using Gin to Inject Multiple Views -

i'm attempting put multi-project application, wherein 1 of sub-projects has multiple views single presenter. using gin inject views presenters. the sub-project contains presenter , 2 different views. have 2 separate gin modules, each binding 1 of views view interface. as per thomas broyer's suggestion on answer this post , ginjectors wrapped in "holder" class calls gwt.create on particular ginjector. appropriate holder configured in gwt.xml file using replace-with statement. when run project in dev mode, see alternate view appear expect to. however, when compile project, still default view. also, 6 permutations (i expect more on account of replace-with logic), , not view expect in different scenarios. here code illustrate. subproject.gwt.xml contains this: <replace-with class="com.example.ginjectordesktopholder"> <when-type-is class="com.example.ginjectorholder" /> </replace-with> <replace-wi...

android - Checking for getActivity() == null on user action -

whenever of our fragments asynchronous response network request, check whether getactivity() == null if have touch activity or use context . so our code flow looks this: protected void onnetworkresponse(string response) { if (getactivity() == null) return; getactivity().setprogressbarvisibility(false); // rest of processing here } this makes sense (please comment if we're doing wrong! :) ). however, check getactivity() == null on user feedback, in onclicklistener, if we're going reference activity. me seems we're being overly cautious, because definition if button on fragment clicked, had attached activity. being overly cautious?

javascript - Google Map Marker Missing On Custom Map -

i managed customize colors of google map through javascript, legend , marker won't appear. i'm not worried legend, i'm focusing on marker appearing. tried putting in custom-made marker. why doesn't marker appear? it's right size, png transparency. please! <script type="text/javascript"> window.onload = function () { } function initialize() { var mapoptions = { center: new google.maps.latlng(32.817323, -96.788059), zoom: 16, maptypeid: google.maps.maptypeid.map }; var map = new google.maps.map(document.getelementbyid("map"), mapoptions); var point = new google.maps.latlng(32.817323, -96.788059); var marker = new google.maps.marker({ position: point, map: map, title: "commercial ideas" }); } var latlng = new google.maps.latlng(32.817323, -96.788059); var styles = [ { featuretype: "landscap...

ruby - Does self ALWAYS refer to the current instance in an instance method definition? -

i understand question in instance method, self refers current instance of class. true no matter how many layers of methods or loops deep in within instance method definition? generally, yes, though there metaprogramming methods can strange things self - instance, object#instance_eval allows pass block evaluated in context of instance. in case, self within block of other instance, so: class foo end class bar def wacky puts self.class #"bar" foo.new.instance_eval puts self.class #"foo" end end end without careful reading, might tempted think self within block refers bar instance, not so. so see, purposes, can assume self self bound when entering method. although have ability pass blocks around different binding, self doesn't re-bound "by accident" in ruby. more interesting reading, might @ ruby binding class' documentation.

python - performance - finding all points within certain distance by lat/long -

i have csv file points tagged lat/long (~10k points). i'd search points within given distance of user/specified lat/long coordinate — say, example, centroid of manhattan. i'm pretty new programming , databases, may basic question. if so, apologize. performant search in pure python without using database? in, read csv memory , search python script? if performant, scale number of points increases? or infeasible in python, , need investigate using database supports geospatial queries? additionally, how go understanding performance of these types of calculations can develop intuition this? this possible in python without databases. recommend using numpy. following: read points csv numpy array calculate distance of each point given point sort distance or find 1 minimum distance using argmin because calculations vectorized, happen @ close c speed. with okay computer, i/o take 2-3 seconds , calculation take less 100-200 milliseconds. in terms of math, ca...

shell - /usr/bin/tidy is called before /usr/local/bin/tidy -

i installed newer version of tidy through homebrew, somehow still version within /usr/bin/tidy called. haven't noticed problems homebrew before , there no issues brew doctor can find. :) here get, when call echo $path (i removed ruby related stuff): /usr/local/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/x11/bin:/usr/local/macgpg2/bin and that's /etc/paths /usr/local/bin /usr/local/sbin /usr/bin /bin /usr/sbin /sbin thanks in advance! did execute old tidy , installed new version without restarting shell? if so, use hash -r clear shell's cache go through path again next time try execute it. if not, ensure can execute /usr/local/bin/tidy .

Can a SilverLight component instantiate a registration-free COM-visible .NET object -

we trying load in silverlight 5.0 component running in ie com-visible .net object registration-free using activation context api. http://msdn.microsoft.com/en-us/library/ms973913.aspx the silverlight component runnning trusted application in browser described in http://msdn.microsoft.com/en-us/library/gg192793(v=vs.95).aspx . the object can loaded in stand-alone test application using activation context api manifest formed. in siverlight running inside browser, component loader dll (loaded appdata/locallow) creates , activates activation context fails load com-visible .net object dll appdata/locallow. result "the file not found". does have experience silverlight/com in similar setup? tia i filed ticket microsoft , suggested solution workaround actual activation context bug. //create own activation context pointing manifest actctx actctx; ulong_ptr pctxcookie; //initialize actctx manifest name , path .... handle hactctx = createactctx(&actctx);...

browser - Why would HTML show up in view:source but not be displayed or rendered on the page? -

what cause html table , form (viewable in view:source ) not render or appear on page? it not appear in chrome's developer tools console or firebug console. i have been trying figure out day , searching not helping. any changes raw html see in view source rendered dom in browser caused javascript. there must code on page removing table. can please provide code examples of scripts on page , including?

internet explorer - Joomla 2.5.4 administration screen loading white page on a single computer -

i have case joomla administrator page not load on single computer. other computers on network can access admin page. the browser ie 10: - cleared cache , history in browser - rebooted pc - , complete norton anti-virus scan completed i can main site. from computer went administrator page cleared cache. the computer having problem laptop take home work. login admin in joomla , go template manager. select template. if displays normal or better in web browser platform using, template might not compatible version of web browser. if it's commercial template, go vendor , updates work web browser having issues with.

android - Making gps calls faster and more efficient -

i've been working on simple speed calculations application i'm working on, code have takes far long retrieve location, , know questions have been asked before, none of answers seem retrieve results i'm looking for. so, how can make code have gps fixes within matter of seconds, , possible? locationlistener: package me.dylan.acf; import java.text.decimalformat; import java.util.arraylist; import android.app.notificationmanager; import android.location.location; import android.location.locationlistener; import android.os.bundle; import android.text.format.time; import android.widget.textview; public class gpsmanager implements locationlistener { arraylist<double> avgspeeds = new arraylist<double>(); textview debug; notificationmanager mngr; double avgspeed; long lasttime = 0; graphview view; location lastloc; int earthradius = 6371; long delaytime = 30; arraylist<double> allspeeds = new arraylist<double>...

mfc - cannot convert parameter 1 from 'const char [6]' to 'const wchar_t * -

i'm new mfc , don't know error. error error c2664: 'void atl::cstringt::format(const wchar_t *,...)' : cannot convert parameter 1 'const char [6]' 'const wchar_t *' heres line: m_echo1.format("%d %",state.dwmemoryload); by default windows app set use 16-bit characters, not 8-bit characters. change quoted string l"%d %" specify string of 16-bit characters.

mongodb - Showing newest values in subdocument when finding a document -

given following document structure: { _id: "abc123", name: "some name", properties: [ { definition: "temp", values: [ { created: 1376061128, value: 82 }, { created: 1376062368, value: 85 }, { created: 1376062627, value: 88 } ] }, { definition: "alert", values: [ { created: 1376061128, value: 0 }, { created: 1376062368, value: 1 }, { created: 1376062627, value: 0 } ] } ] } i want able return document "newest" (based on created) values each property so: { _id: "abc123", name: "some name", properties: [ { definition: "temp", values: [ created: 1376062627, value: 88 ] }, { ...

sql server - xquery to order with header values in the way -

can partially order xml data types using xquery when logical columns aren't consistent (such when there headers in first row(s))? edit had bad example, mislead answers away original question. how order typ column values, leaving th headers @ top? or vice versa, ordering integer column rts instead? say have xml stored in mssql xml field ( select thexml xmldata returns 1 row containing following): <table cellpadding="2" cellspacing="3" border="1"> <tr> <th>typ</th> <th>rts</th> </tr> <tr> <td>abc</td> <td>26</td> </tr> <tr> <td>dcc</td> <td>21</td> </tr> <tr> <td>dbb</td> <td>4</td> </tr> <tr> <td>xbq</td> <td>152</td> </tr> <tr> <td>ahi</td> <td>349</td> ...

ruby on rails - How do i set a parent_id using s3_direct_upload gem? -

newbie on rails 3.2.14, testing on heroku, uploading image files s3 s3_direct_upload gem. i've got gem working fine. drag , drop, progress bars , direct upload s3 work great. upload tied attachment model. new record created on upload. fine far. the issue i'm having want set parent_id field of new record don't know how pass in. gem doesn't use conventional form submit upload, it's handled via javascript: <%= s3_uploader_form callback_url: attachments_url, callback_param: "attachment[attachment_url]", id: "mys3uploader" %> <%= file_field_tag :file, multiple: true %> <% end %> the create action in attachments_controller.rb : def create @attachment = attachment.create(params[:attachment]) end calls javascript view create.js.erb : <% if @attachment.new_record? %> alert("failed upload attachment: <%= j @attachment.errors.full_messages.join(', ').html_safe %>"); <% else %> ...

opencv - 3D Reconstruction upto real scale -

i working on project detect 3d location of object. have 2 cameras set @ 2 corners of room , have obtained fundamental matrix between them. these cameras internally calibrated. images 2592 x 1944 k = [1228 0 3267 0 1221 538 0 0 1 ] f = [-1.098e-7 3.50715e-7 -0.000313 2.312e-7 2.72256e-7 4.629e-5 0.000234 -0.00129250 1 ] now, how proceed given 3d point in space, should able points on image correspond same object in room. if can obtain right projection matrices (with correct scale) can use them later inputs opencv's traingulatepoints function obtain location of object. i have been stuck @ since long time. so, please me. thanks. sorry not coming in size of comment.. @user2167617 reply comment. pretty much. few pointers, though: singular values should (s,s,0), (1.3, 1.05, 0) pretty guess. r: technically, right, however, ignoring signs. might rotation matrix not satisfy constraint deteminant(r) = 1 ...

How to work with Interlization concept in javascript or jQuery -

in project using interlization using spring mvc it's working fine .but want show alret() message end user according selected language .how 1 me.i using hidden fields in view layer performance issue occur way read properties file data using javascript or jquery you can use nested objects. example: // init dictionary var messages = { en : {}, es : {} }; // populate messages.en['welcome'] = 'welcome'; messages.es['welcome'] = 'bienvenido'; // test var lang = 'es'; alert(messages[lang]['welcome']);

php - Link an image on the front page to post, but when the post is open link to the image. (WordPress) -

i have wordpress blog: http://technosting.com/ on homepage each post has image before it, image linked post. when post opened same image still linked post url. use fancybox plugin makes gallery of photo linked self. example @ of other images inside post, excluding first image of coarse. on front page image linked blog post when blog post opened, image link self fancybox can used view image. looked hours online not able find solution this. how can make work? thanks in advance, what want here, is_single() . add in functions.php function enqueue_fancybox(){ wp_enqueue_script('my_custom_js', '/path/to/my/custom.js', array('jquery', 'fancybox')); } if(is_single(){ add_action('wp_head', 'enqueue_fancybox'); } where custom.js calls code required create fancybox. code indicates has dependency on enqueued scripts jquery , fancybox this ensure it's not fired on front page, it's pulling list of multi...

android - ActionBar overflowing on pre-ICS devices -

Image
i'm developing application needs compatible android 2.2+ it's using actionbarsherlock customize actionbar on pre-ics devices. i'm facing problem on 2.2 , 2.3 devices makes content of actionbar overflow though content fits device screen. this: i've tested (on emulator) device screen size (mdpi on 320x480) runnning android 4.0 , works fine, believe problem related actionbarsherlock. i'm tried drastically reducing icon files, though images smaller, content still overflowing. here styles.xml file: <style name="appbasetheme" parent="theme.sherlock.light.darkactionbar"> </style> <style name="apptheme" parent="appbasetheme"> <item name="actionbarstyle">@style/appbasetheme.actionbarstyle</item> <item name="actionbartabstyle">@style/appbasetheme.actionbartabstyle</item> <item name="actionbartabbarstyle">@style/appbasetheme.actionb...

How to benchmark disk IO in PHP? with MySQL? -

are there benchmark test written in php can test disk io, preferably involving mysql? if write one, how should write one? basic fwrite() of random data inserting large number of entry mysql , avg() or max() without index? zipping file if there opensource scripts these great. thanks! no not know, best tools native linux programs iostat , htop you want make analist tool can analyse why query slow or not??

Gerrit + Jenkins: how to trigger an action after the merge is complete OR the review is abandoned? -

i current trigger jenkins builds on git push refs/for/ via gerrit trigger in jenkins (at start of review). produces build suitable testing , verification prior review completion. when review done (and necessary rebasing finished) review marked complete , triggers final merge of code git (fast-forward only). this works, i'd prefer park build artifacts jenkins somewhere special until review merged, @ time last build's artifacts go somewhere else (if review abandoned artifacts instead purged). i thought might create special post-merge job in jenkins , have trigger on merge, since want trigger such job if branch abandoned don't think merge trigger cut it. is there gerrit/jenkins trigger that'll me automate more exactly? (currently have main build job per major component... might need 1 global job triggers merged component handle final disposition of said artifacts.) jenkins has trigger "change abandoned" too. there's no problem having more ...

javascript - Text field to array -

i trying create array text field. need paste fifty lines text field. convert lines array, each line being different element in array. given input field this: <textarea id="myinput"></textarea> you can value text field follows: var myvalue = document.getelementbyid("myinput").value; and split this var myarray = myvalue.split("\n");

Git track a remote branch using netbeans -

i using netbeans, , there feature call push upstream . when click message: no tracked remote branch specified local master is there way track remote branch in netbeans, or in config file? here config file: [core] repositoryformatversion = 0 filemode = false logallrefupdates = true bare = false [remote "master"] url = https://github.com/thecolorred/jgame.git fetch = +refs/heads/master:refs/remotes/master/master i don't have git installed on computer, netbeans comes git package git operations. don't want download git run 1 line, there way in netbeans or in config file track branch? i don't have git installed on computer yet, remains safest solution: unzip archive msysgit (it on windows), , a: git branch -u master origin/master even other users came same conclusion .

Python (VTK): Connect two 3D points by an oriented cylinder -

consider have 2 points in 3d space, wishing connect them cylinder specified radius. apparently height (length) of cylinder distance between tow 2 points. standard cylinder object has nothing oriented follow above. how this? the simplest way can see using tubefilter . draw line between 2 points , apply filter. here example in c++, should straightforward port python. edit : , here there's example in python if helps.

php - Layer navigation menu -

i have 3 tables, top_category, bottom_category, products, @ moment have listed top_category, confused how approach listing second category have list knows top_category belongs too, why have foreign keys parent, if top_category example is: prod1 prod2 prod3 etc and want load bottom category these top_categories this: prod1 -subprod1 -subprod2 -subprod3 prod2 -subprod4 -subprod5 prod3 -subprod6 etc this database: create table top_category ( id int primary key, name varchar(100) ); create table bottom_category ( id int primary key, name varchar(100) , top_category_id int references top_category ); create table product ( id int primary key, name varchar(100) , bottom_category_id int references bottom_category ); this php & html code: <?php include('dbconnect.php'); try { $result = $pdo->query(" select * top_category order top_name asc; "); } // end try catch (pdoexception $e) { e...

How can I completely remove an object from an array in Javascript? -

i have been using following code: formdata.objectivedetails.push(emptyobjectivedetail); this pushes new emptyobjectivedetail object onto end of array called objectivedetails. if example array of objectivedetails contains 13 objects how remove 1 @ position 5? assume make null want remove length of array becomes 12. this might off topic have been considering adding underscore.js. done underscore? using underscore.js objectivedetails = _.without(objectivedetails, _.findwhere(arr, {id: 5}));

android - update My App Issue -

i'm developing non-public android app, i.e. app won't available in global android market. app installed on limited number of clients, e.g. using apk file.i have .apk in sd card , trying update application application. that, i'm using intent my code intent intent = new intent(intent.action_view); intent.setdataandtype(uri.fromfile(new file(environment.getexternalstoragedirectory().getpath()+"/" +"test.apk")), "application/vnd.android.package-archive"); startactivity(intent); note : working fine, after updating it, application closed. the question " how prevent ? " i'm use broadcast receiver re-open app public class autostart extends broadcastreceiver{ @override public void onreceive(context context, intent intent) { if (intent.getaction().equals(intent.action_boot_completed)){ intent = new intent(context, abcactivity.class); i.addflags(intent.flag_activity_new_task); conte...

Wordpress dynamic widget by location? -

i need show widget based on user location , testing purpose have created using following code if( function_exists( 'register_sidebar' ) ) register_sidebar( array( 'name'=>'madurai-right', 'before_widget' => '<div class="widget relativ">', 'after_widget' => '</div>', 'before_title' => '<h2>', 'after_title' => '</h2>', ) ); and getting widget below <?php $city="madurai"; echo $side_bar= "'$city-right'"; ?> <?php if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar($side_bar) ) :?> &nbsp; <?php endif; ?> here city location, based on location getting sidebar dynamic_sidebar($side_bar) doesn't working but if use without variable inside dynamic_sidebar('madurai-right') working well, idea? wrong code ? dude replace $side_bar= "'$cit...

Python SQLite near "?": syntax error -

another 1 of questions. i'm trying do: self.table = 'table' = 'column' b = 'value' c.execute('insert ? (?) values (?)', (self.table, a, b)) but i'm getting <class 'sqlite3.operationalerror'>:near "?": syntax error at same time, c.execute('insert {0} ({1}) values ({2})'.format(self.table, a, b)) works flawlessly, except security concerns. i realize i'm not first 1 have issue, have yet find solution works me. table names, column names cannot parameterized. try following instead. self.table = 'table' b = 'value' c.execute('insert {} ({}) values (?)'.format(self.table, a), (b,))

regex - How to match the pattern regardless of the number of whitespaces -

not in regexp, how can match pattern regardless of how many whitespaces there is? var pattern = / void main$/; //here var pool1 = "abdodfo void main"; var pool2 = "abdodfo void main"; console.log(pattern.test(pool1)); // true console.log(pattern.test(pool2)); // must true change pattern to: /\s+void\s+main$/

NULL POINTER EXCEPTION in android application -

this simple activity takes message user , displays in second activity. getting java.lang null pointer exception. data in file follows : // activity_main.xml // xml file main activity <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".mainactivity" > <textview android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true"...

java - Error: taglib definition is not consistent with specific version during parsing web.xml -

i tried create simple jsp custom tag(empty tag) example in apache 7. got error during parsing web.xml file "taglib definition not consistent specific version during parsing web.xml". files given below.please me <!--web.xml--> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="webapp_id" version="3.0" > <!-- register tld context , associating unique uri can further used refer tld. optional declaration, you![enter image description here][1] can refer tld directly, explain other options of referring tld in jsp page after example --> <taglib> <taglib-uri>mytags</taglib-uri> <taglib-location>/web-inf/mytags.tld</taglib-location> </taglib> </web-app> <!--mytags.tld-...

python - Making image white space transparent, overlay onto imshow() -

Image
i have plot of spatial data display imshow(). i need able overlay crystal lattice produced data. have png file of lattice loads black , white image.the parts of image want overlay black lines lattice , not see white background between lines. i'm thinking need set alphas each background ( white ) pixel transparent (0 ? ). i'm new don't know how ask question. edit: import matplotlib.pyplot plt import numpy np lattice = plt.imread('path') im = plt.imshow(data[0,:,:],vmin=v_min,vmax=v_max,extent=(0,32,0,32),interpolation='nearest',cmap='jet') im2 = plt.imshow(lattice,extent=(0,32,0,32),cmap='gray') #thinking of making mask white background mask = np.ma.masked_where( lattice < 1,lattice ) #confusion here b/c tho theimage gray scale in8, 0-255, numpy array lattice 0-1.0 floats...? with out data, can't test this, like import matplotlib.pyplot plt import numpy np import copy my_cmap = copy.copy(plt.cm.get_cmap(...

javascript - Change color by scrolling -

this example seems change red color blue bottom. but, want change red color blue top position scrolling. show me solution? it's okay if there using javascript. here example want to. when scroll down @ site, gray line change red. <div id="scroll1"></div> <div id="scroll2"></div> css part #scroll1 { background-color: red; width: 50px; height: 800px; } #scroll2 { bacground-color: blue; width: 50px; height: 800px; } #scroll1{ background-color:blue; width: 50px; height:800px } #scroll2{ background-color:red; width: 50px; height:800px } according approach used in example, can done css. replace color.

html - css root element margin -

in css html element said root element, , i'm reading in this article width , height governed browser window/frame. so, make sense apply margins ? i think doesn't because if root element it's not supposed contained in higher level element. howewer every browser allows add margin html element, explainations ? the phrogz.net article wrong. that's not how works @ all. html element block-level element can styled pretty other block level element (including applying display:inline; wish!) your page painted on canvas of (logically) infinite dimensions has origin @ point (0, 0). browser has viewport shows area of canvas. there exists rectangular block called initial containing block top left hand corner @ (0, 0) , has height , width equal of viewport. root element's position , dimensions can specified relative initial containing block, other block element's position , dimensions can specified relative containing block . as aside, css not...

networking - In a network based only on switches are packet collisions possible? -

it's more of theoretical question can't seem find answer anywhere. in network built using switches packet collisions possible? using switches decreases collision probability, except in case there's microsegmentation, each computer has own port , have connection without collisions. because in way have point point full duplex connection between nodes , there's collision impossibility.

How to call HTTP URL using wifi in J2ME code for BlackBerry 5.0 and above? -

i calling web service blackberry using j2me code. when try open connection using httpconnection , checking gprs connection. now, want check wi-fi connection , call webservice through wi-fi. the following code connection section. how change code wi-fi connection? public boolean httpurl() { httpconnection conn = null; outputstream out = null; string url = "http://www.google.com"; try { conn = (httpconnection) new connectionfactory().getconnection(url).getconnection(); if (conn != null) { conn.setrequestmethod(httpconnection.post); conn.setrequestproperty("content-length", "application/x-www-form-urlencoded"); conn.setrequestproperty("content-type", "application/x-www-form-urlencoded"); conn.setrequestproperty("user-agent", "profile/midp-2.0 configuration/cldc-1.0"); } } catch (exception e) ...

android.intent.action.BOOT_COMPLETED - do not receive broadcast if boot completed by a phone call -

i using broadcast receiver in app, display photo on boot_completed. however, noticed if receive phone call on phone, photo displayed in front of incoming phone call activity, can's see calling me , worse - can't answer phone. what best way override behavior? you add mechanism listening phone calls events, , if detect phone ringing (or call answered), won't show activity... in case, please don't show such things. no user likes popups go out of nowhere. instead, use notifications tell user has happened.

python - How to add my own html template in django -

i new in django, problem how give link css , js {% load staticfiles %} <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>welcome</title> <link href="css/templatemo_style.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" type="text/css" href="{% static "css/templatemo_style.css" %}" /> <script type="text/javascript" src="js/jquery.min.js"></script> css , js not load actual path, dont know how use actual path of static folder in html trying use import os #dirname = os.path.abspath(os.path.dirname(__file__)) dirname = os.path.dirname(__fi...

Vaadin and db connection pooling -

i new vaadin framework , unsure on how proceed database connection. what don't want instatiate connection @ each session. in understading though, vaadin works @ session level. is possible create class persist no matter sessions, , then, vaadin session query database connection? you need use jdbc connection pool in application server.

java - How use a 9-patch image as background on a JPanel? -

i'm searching way use 9-patch file background javax.swing.jpanel. background image automatically resizes when dimensions of jpanel change. is possible? or have create pieces of image , manually resize of them when listener triggers (like in piece of code follows)? public class jpanelwithninepatchbackground extends jpanel { { /* define parts of background bufferedimage */ addcomponentlistener(new componentadapter() { public void componentresized(componentevent e) { // resize images . . . jpanelwithbackground.this.repaint(); } }); /* . . . */ } yes, use either of drawimage() implementations let specify corners of destination rectangle. method complete faster if source , destination rectangles match in size. rctile example.

arrays - PHP Trying to Delete Reference of Objects -

$root = new filesystemnode("~", true); $desktop = new filesystemnode("desktop", true); $root->children[$desktop->name] = &$desktop; ... $q = &$root->children["desktop"]; unset($q); i doing weird thing understand going on behind of code. real scenario: after creating , connecting objects(in first 3 lines), may want assign 'desktop' variable in code somewhere , after may want delete it. but, unfortunately, not deleted @ all. still can access $root->children["desktop"]. any suggestion? objects references of php 5. & operator has no influence in example. update: (because of question in comments): if need independent copy of object use clone : $q = clone $root->children["desktop"];

derived clases in different files c++ -

how make main class in file_x.h, , file_x.cpp , derived class class made in file_x, in file_y.h , file_y.cpp i have tried lots of things without results, please give me example both classes constructor function, variable, , regular function in both classes? i have in window.h (main class header): #ifndef window_h_ #define window_h_ #include <string> #include <vector> #include "sdl/sdl.h" #include "sdl/sdl_ttf.h" #include "../../utils/event.h" #include "../../utils/button.h" using namespace std; class bwindow{ protected: sdl_surface* up_bar; sdl_surface* content; sdl_surface* to_blit; sdl_surface* text; vector <button*> botns; string name; int x; int y; bool pressed; int sx; int sy; public: bwindow(string,int,int,int,int,int*,int*); void graphic_update(sdl_surface*); void logic_update(events*);...

python - How do you create a numpy vertical arange? -

>>> print np.array([np.arange(10)]).transpose() [[0] [1] [2] [3] [4] [5] [6] [7] [8] [9]] is there way vertical arange without having go through these steps? you can use np.newaxis : >>> np.arange(10)[:, np.newaxis] array([[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]]) np.newaxis alias none , , added numpy developers readability. therefore np.arange(10)[:, none] produce same exact result above solution.

git - GitHub local repository -

we don't have budget yet buy private repository on github . there local version of github ? thanks. to create local repository, can use git. you can run git on server, , there ton of solutions that. google that. easy setup. what github adds git nice ui , social features: easy cooperate complete strangers , teams. can run github on own server, more expensive. there open source alternatives github, can install on own server: gitlab gitorious of gitlab easiest install yourself, afaik not straightforward. bitbucket offers free private repositories , supports git well.

php - How to use foreach to create an array and later update a database -

i have dynamic form populates questionnaire rating scale information saved in database. each rating consists of "selection" , "definition". scale can consists of number or ratings. here example of 5 rating scale: strongly agree = agree statement. agree = agree statement. neither agree nor disagree = neither agree nor disagree statement. disagree = disagree statement. disagree = disagree statement. once form populated, user can edit of selections or definitions. form populates fine, cannot figure out how correctly populate post data array if user submits change or use array edit information in database. here php: if(isset($_post['submit'])){ $fields = ""; $values = ""; foreach($_post $key => $value) { $fields = mysql_real_escape_string($key); $values = mysql_real_escape_string($value); $entry .= "[". $fields . "=" . $values . "]"; //here start of q...

javascript - Ajax text field to divtag1 and other text field to divtag2 using php -

<html> <head> <meta charset="utf-8" /> <title>jquery ajax - post</title> <script type="text/javascript" src="jquery_1.6.1.js"></script> <script type="text/javascript"><!-- $(document).ready(function() { $('form').submit(function() { var data = 'name='+$('#nm').val(); var data = 'name='+$('#sn').val(); $.post('script.php', data, function(response){ $('#dv').html(response); $('#dv2').html(response); }); return false; // required not open page when form submited }); }); --></script> </head> <body> <div id="dv">here displayed response.</div><br /> <form action="script.php" method="post"> name: <input type="text" name="nm" id="nm" /><br /> <div id="dv2">here dis...

database - best strategy for multiple insertions in db from one file -

let me clarify title of question. i'm implementing web application's back-end. this create in 1 single .html file user inserts point,line or polygon on map. user fills form text data. data relative geometry inserted on map. user uploads photos , videos via html5 websockets/drag'n'drop. relative geometry inserted on map. there 1 button @ bottom of page, named "save all" saves data @ once on database (insert). the problem? have 2 seperate tables in database. 1 named "pins" , geometry data , form data. the other named "multimedia" , images/videos. now "multimedia" has column named "multipin" contains "pins" id, can relate pins , multimedia. all columns containig ids "serial" (with each insertion, id automatically grows +1). i thinking if both insertions @ same time there no way can new "pins" id , insert "multipin" column of "multimedia". have wait...

android - Launch activity with intent -

i've listapp activity list installed application, i'm trying here when user selects app list should intent/info selected app , when user click button1, should open app(with of intent retrieved earlier) selected earlier. listapp activity: @override public void onclick(view arg0) { // todo auto-generated method stub switch (arg0.getid()){ case r.id.button1: //startactivity(app.intent); //should start app of info received selecting app list break; } @override public void onitemclick(adapterview<?> parent, view v, int position, long id) { //applicationinfo app = (applicationinfo) parent.getitematposition(position); //startactivity(app.intent); //instead of launching app, info selected app & use it(start app) when clicking button1 } applicationinfo class applicationinfo { charsequence title; intent intent; drawable icon; boolean filtered; final void setactivity(componentname classname, int lau...