Posts

Showing posts from April, 2011

Convert .java to .class within a java program -

this question has answer here: how can compile , deploy java class @ runtime? 7 answers i have several .java files created during runtime. want use created .java files classes in program. how may this, without starting program second time ? want compile .java files during runtime , use new .class files on... use java compiler api: public class simplecompiletest { public static void main(string[] args) { string filetocompile = "test" + java.io.file.separator +"myclass.java"; javacompiler compiler = toolprovider.getsystemjavacompiler(); int compilationresult = compiler.run(null, null, null, filetocompile); if(compilationresult == 0){ system.out.println("compilation successful"); }else{ system.out.println("compilation failed"); }

c++ - How to push_back multiple values into a vector? -

Image
i know question has been asked before, , know in c++11 can do vector<int> v = {2,5,8,11,14}; vector<int> v{2,5,8,11,14}; and v.push_back({x,y}); but gives me compile error. i'm using visual studio express 2012. how accomplish this? edit: error screenshot attached: visual studio 2012 does not support vector initialization via initializer lists . there lot of c++11 support missing standard library included vs2012 supported vs2012 c++ compiler itself. sadly, case vs2012 , case gcc 4.7, awesome compiler support new c++11 features hampered partial library support seems lag behind compiler.

jquery - How to call JavaScript function during Pageload? -

i have html page contains several pages data-role = page page1,page2 etc. trying call js method during pageload of page1 using following code $("#page1").on("load",function () { alert("hi") $.ajax({ type: "get", url: "", data: "{}", contenttype: "application/json", datatype:"json", success: function (msg) { var bprlist = ''; $.each(msg, function(i,v){ bprlist += '<li onclick="getbprdetails('+ v.bprno +')"><a href="#bprpage" data-transition="slide"><p class="title">' + v.bprno + '</p><p class="bodyele">' + v.bpr_product +'</p><p class="bodyele">' + v.bpr_details+ '</p><br/>

android - Dynamically adding/removing pages from FragmentStatePagerAdapter -

i looking @ example of fragmentstatepageradapter @ http://developer.android.com/reference/android/support/v4/app/fragmentstatepageradapter.html public static class myadapter extends fragmentstatepageradapter { public myadapter(fragmentmanager fm) { super(fm); } @override public int getcount() { return num_items; } @override public fragment getitem(int position) { return arraylistfragment.newinstance(position); } } i've looked around @ other posts in stackoverflow, still unsure how add/remove pages fragmentstatepageradapter, , how getitem method called. if looking add method myadapter add pages, how done? or not standard way of adding pages? information appreciated. after adding new item you'll need call myadapter.notifydatasetchanged(); also, seems use const number or items num_items , you'll need change dynamic can change.

java - Informix DDL execution for constraint disabling -

i planning disable foreign key constraint avoid recursive relationship while purging data. main steps written below: connection conn = getconnection(si_single_url2, si_uname2, si_pass2); // return valid java,sql.connection statement stmt = conn.createstatement(); boolean isconstraintdisabled = stmt.execute("alter table zee_temp_tab_2 nocheck constraint all"); stmt.executequery("delete zee_temp_tab_2 id = 'a'"); boolean isconstraintenabled = stmt.execute("alter table zee_temp_tab_2 check constraint all"); please advise how it. to disable constraints table (pk, uniques, not null, check) set constraints table <table> disabled; or specific contraint set constraints <constraint_name> disabled; to enable, use "enabled" parameter. observation: pk, fks , uniques recreate internal index... depending of # of records, maybe take time.... careful. other options use "deferred" option (this way do

html - Create banner with gradient opacity overlay -

i need create following banner: http://schuub.net/banner.png my question is, how can create gardient white transparent overlays image partially on left. my html can found here: http://schuub.net/banner.html <!doctype html> <html lang="en"> <head> <style> body { margin: 0 auto; width: 1024px; } .my-banner { background-repeat: no-repeat; background-position: right -175px; background-image: url("http://sphotos-c.ak.fbcdn.net/hphotos-ak-ash3/s720x720/3755_4323318453951_692396489_n.jpg"); height: 200px; width: 100%; position: relative; border:solid 1px; } .banner-data { position: absolute; left: 0; top: 0; width: 70%; height: 100%; background: -ms-linear-gradient(left, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 1

c - how do remove enclosing brackets from string? -

i have char s9[7] = "[abcd]"; how remove brackets [] that s9 == "abcd" i have tried s9 = s9.substring(1, s9.length-2); throws error in cygwin a2v2.c:42:13: error: request member ‘substring’ in not structure or union a2v2.c:42:29: error: request member ‘length’ in not structure or union edit: i realised error, beginner @ c , couldnt differentiate between c , c++ code, regards someone correct me if i'm wrong, since c standard know couple of decades old, far know, c doesn't offer standard support string manipulation, , in fact doesn't officially have concept of strings. (or of object functions, matter.) instead, c uses pointers, more powerful, more dangerous in can mess things if don't learn way around them. the important thing, if want c programmer learn c. @ least, need "string manipulation c" , read of pages pop up. there many ways want. think 1 of faster ones (though modifies string you're lookin

extend wordpress core class in functions.php -

i trying extend wordpress core class inside theme's functions.php, & class trying extend wp_customize_image_control class wp-customize-control.php in wp-includes. it extends "wp_customize_upload_control". i allow .svg mime-type uploaded within theme customizer. in theme's functions.php adding these lines: class wp_customize_image_control_svg extends wp_customize_image_control { public $extensions = array( 'jpg', 'jpeg', 'gif', 'png', 'svg' ); }; but sadly breaks everything. any help, hints or tips appreciated. you close. /* extend image control */ class wp_customize_image_control_svg extends wp_customize_image_control { public function __construct( $manager, $id, $args = array() ) { parent::__construct( $manager, $id, $args ); $this->remove_tab('uploaded'); $this->extensions = array( 'jpg', 'jpeg',

Entity Framework 5 on framework 4, contains and multiple outer joins with same table -

i having strange issue on application when deploying on windows 2008 r2 server. given simple linq snippet: return invoice in me.invoices loggedcustomerid.contains(invoice.contract.customerid) order invoice.date descending the application works, in some cases (on customer server), generated t-sql strange: select [extent1].[contractid] [contractid], ... [dbo].[invoice] [extent1] inner join [dbo].[contract] [extent2] on [extent1].[contractid] = [extent2].[contractid] left outer join [dbo].[contract] [extent3] on [extent1].[contractid] = [extent3].[contractid] [extent2].[customerid] = 482283 or [extent3].[customerid] in (498565,482282,498564,498566) table linked multiple times (?) the in statement broken multiple t-sql conditions instead of single in statement obviously same package runs fine on system generating correct query without linking same table multiple times , creating single in statem

ios - Scrolling is not proper When i used SDWebImage -

i have serious problem of scrolling table. initially used gcd loading image in background , setting on table cell. table not scrolling smoothly. used sdwebimage same thing happening. could let me know reason this. why table scrolling not smooth expected. please let me know views app waiting release same purpose. code : -(uitableviewcell*)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath{ nsstring *cellidentifier = @"cell"; customcellforexhibitor *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { nsarray *xibpath = [[nsbundle mainbundle]loadnibnamed:@"customcellforexhibitor" owner:self options:nil]; (id fileobject in xibpath) { cell = (customcellforexhibitor*)fileobject; } } objdatamodel = [parserdatacontentarray objectatindex:indexpath.section]; cell.exhibito

java - Move from bottom animation JDialog -

i have write animation jdialog, if in listener of jbutton works in constructor no . have try thread , timer , it's not working too. my code : testthedialog.java import java.awt.event.actionlistener; import javax.swing.jframe; import javax.swing.jbutton; import java.awt.event.windowadapter; import java.awt.event.windowevent; import java.awt.event.actionevent; public class testthedialog implements actionlistener { jframe mainframe = null; jbutton mybutton = null; public testthedialog() { mainframe = new jframe("testthedialog tester"); mainframe.addwindowlistener(new windowadapter() { public void windowclosing(windowevent e) {system.exit(0);} }); mybutton = new jbutton("test dialog!"); mybutton.addactionlistener(this); mainframe.setlocationrelativeto(null); mainframe.getcontentpane().add(mybutton); mainframe.pack(); mainframe.setvisible(true); }

android - Amazon Mobile Ads Request Error -

i'm trying integrate amazon mobile ads sdk app. i've done described in guide - https://developer.amazon.com/sdk/mobileads/quick-start.html i've added xml amazon layout this: <com.amazon.device.ads.adlayout android:id="@+id/adview" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#fefefe" android:layout_alignparentbottom="true"/> i've included xmlns namespace in parent layout 3.set permissions manifest 4.set adactivity in manifest 5.set application key but request_error , message: we we'll unable create webview rendering ad due unknown issue webview can please tell me what's problem? it bit late answer this, useful drifts here via search... please declare layout include ad size well <com.amazon.device.ads.adlayout android:id="@+id/amazon_ad_layout" android:layout_width="320dp" android:layout_height=

javascript - HTML5 drag and drop for directory upload using local htnl5 file -

this question has answer here: does html5 allow drag-drop upload of folders or folder tree? 7 answers i have problem: following code perfeclty works http server, not local html5 file (file:///). any idea why? suggestion allow file drag , drop directory upload? css: #drop_zone { font-size: 30px; text-align: center; width: 100%; height: 200px; border: 1px solid black; } html: <div id="drop_zone">drop files here</div> javascript: function error(e) { console.log('error'); console.log(e); } function error_from_readentries(e) { console.log('error_from_readentries'); console.log(e); } function traversefiletree(item, path) { path = path || ""; if (item.isfile) { // file item.file(function(file) { console.log("file: " + path + file.

java - What is happens before relations in Synchronization? What is premature object leak? -

Image
i reading synchronizedmethodsoracledoc , unable understand concept. says that. warning: when constructing object shared between threads, careful reference object not "leak" prematurely. example, suppose want maintain list called instances containing every instance of class. might tempted add following line constructor: instances.add(this); other threads can use instances access object before construction of object complete. what mean? it states :- second, when synchronized method exits,it automatically establishes happens-before relationship subsequent invocation of synchronized method same object. what meaning of happens before relationship? can elaborate on these 2 points? thanks. premature leak leaking reference object not yet created. example: class someclass{ public someclass(list list){ list.add(this); //this leaked outside before complete creation, constructor still not complete //do other cho

c++ - Do I need to write the `const` keyword when passing a `const_iterator` as argument? -

static void myclassmethod( std::list<aclass> & anobject, const std::list<aclass>::const_iterator & beginningpoint); in code, i'm passing const_iterator of const stl object. feels 1 of constantnesses redundant. how differ if remove const keyword, or if change const_iterator iterator ? std::list<aclass>::iterator& you can change value through iterator , can change iterator points outside function. std::list<aclass>::const_iterator& you can't change value through iterator can change iterator points outside function. const std::list<aclass>::iterator& you can change value through iterator can't change iterator points outside function. const std::list<aclass>::const_iterator& you can't change value through iterator , can't change iterator points outside function. take note iterators passed reference. if passed value, first const wouldn't matt

python - Writing a table in a text file -

i trying write condensed list of music tracks,times have been played , artist text file in tabular form. however tracks in list form, i.e. 08:04:10 current track playing = skinny genes - eliza doolittle 08:07:09 current track playing = keep on walking - scouting girls 08:10:45 current track playing = thinking of me - olly murs 08:14:01 current track playing = hangin' on string - loose ends 08:17:34 current track playing = again - janet jackson throughout text file. my code looks this open('log','w').writelines([(line[:33]+line[42:]) line in open(fl) if "current track playing" in line]) any ideas on how put data table rather list? use csv.writer write csv-style data files. example: import csv import re pattern = re.compile('([0-9]*:[0-9]*:[0-9]*) current track playing = ([^-]*?) - ([^-]*)$') csv_file = open('music.csv', 'wb') csv_writer = csv.writer(csv_file, delimi

python - Beautifulsoup url loading error -

so trying content of this page using beautiful soup. want create dictionary of css color names , seemed quick , easy way access this. naturally did quick basic: from bs4 import beautifulsoup bs url = 'http://www.w3schools.com/cssref/css_colornames.asp' soup = bs(url) for reason getting url in p tag inside body , that's it: >>> print soup.prettify() <html> <body> <p> http://www.w3schools.com/cssref/css_colornames.asp </p> </body> </html> why wont beautifulsoup give me access information need? beautifulsoup not load url you. you need pass in full html page, means need load url first. here sample using urllib2.urlopen function achieve that: from urllib2 import urlopen bs4 import beautifulsoup bs source = urlopen(url).read() soup = bs(source) now can extract colours fine: css_table = soup.find('table', class_='reference') row in css_table.find_all('tr'): cells =

java - Unable to open Alfresco admin-consle.jsp -

Image
when try launch alfresco's admin-console.jsp, page not move,it gives blank page no error below jsp, <h:panelgrid id="admin-panel" columns="1" cellpadding="6" cellspacing="6" border="0" width="100%"> <a:actionlink value="#{msg.manage_users}" image="/images/icons/users.gif" action="dialog:manageusers" styleclass="title" rendered="#{navigationbean.allowusergroupadmin}" /> <a:actionlink value="#{msg.manage_groups}" image="/images/icons/group.gif" padding="2" action="dialog:managegroups" styleclass="title" rendered="#{navigationbean.allowusergroupadmin}" /> <a:actionlink value="#{msg.category_management}" image="/images/icons/categories.gif" padding="2" action="dialog:managecategories" actionlistener="#{categoriesdialog.resetcategorynavigation}

c++ - GetProcessTimes called periodically returns the same results -

i'm calling getprocesstimes() periodically in loop same thing on each iteration, seems generate same results every time , changes time time. normal behaviour ? shouldn't results change little bit on time ? void imcalledperiodically() { static const dword dwpid = ::getcurrentprocessid(); static const handle hproc = ::openprocess( process_query_information, false, dwpid ); static filetime ftunused1, ftunused2; // unused, mandatory parameters. ularge_integer uliusr, ulikrn; ::getprocesstimes( hproc, & ftunused1, & ftunused2, (_filetime *)& ulikrn, (_filetime *)& uliusr); printf("usr=%i64d krn=%i64d", uliusr.quadpart, ulikrn.quadpart ); // etc... } the output values change time times, example : 641002, 641002, 641002, 641002 1092007, 1092007, 1092007, 1092007 etc... shouldn't change few every time ? there kind of refresh rate internal function ? thanks help. you noticing values changing every 16

java - Generic multi dimensional array conversion function -

this function converts 2-dimensional collection of string s 2-dimensional array of string s: public static string[][] toarray( collection<? extends collection<string>> values){ string[][] result = new string[ values.size() ][]; int i=0; for( collection<string> row : values ){ result[i] = row.toarray( new string[ row.size() ] ); i++; } return result; } how function written in order generically: public static <x> x[][] arrayarray(collection<? extends collection<x>> values){ // ? } generics , arrays don't mix. 1 alternative pass class instance representing x , use create return array (see array.newinstance() ). believe better approach pass x[][] in argument, fill it, , return it: public static <x> x[][] toarray(collection<? extends collection<x>> values, x[][] result) { int = 0; (collection<x> row : values)

html - How to avoid text over flow? -

Image
in table td how fit proper text how avoid overlap , overflow actual output ? actual code 1 <td align="left" valign="top"> sample text <td> how fit text ? removing nowrap attribute force text stay within table.

c# - How to get List data from class to Form -

how can var finalquestions class question groupexmstart form in string questionset = ""; ? how can in form , conversions need store string? want store string because questionset have pass here: int z = quiz(questionset); ,how this? better way can achieve this? groupexmstart form public partial class groupexmstart : form { string questionset = ""; public groupexmstart(string groupname, string durationid) { initializecomponent(); this.grpid=groupname; topiid=db.gettopicidforgroup(grpid); question qsn = new question(); string[] conf = db.getconfiguration(convert.toint16(durationid)).split('|'); qsn.foo(topiid, conf); int z = quiz(questionset); } int quiz(string data) { string[] words = data.split('$'); randomqsn = new string[totqsn + 1]; qanda = new string[words.length + 1]; (int = 0; < words.length; i++) {

Force mysql to record NULL if field was left empty? -

here situation: i have optional input fields, don't care if user fills in or not. if leave empty, want null recorded. and there field example: decimal (10,2), marked can null , default value set null. and example have input field corresponds it: <input type="text" name="foo" size="4"/> if submit form without touching field mysql records 0.00. there way force record null instead? ps. same goes other field types. example have int well. in case 0 gets recorded. pps. if go insert given record through phpmyadmin, , leave given fields empty, null values gets recorded desired. html <label>svoris: <input type="text" name="load_weight1" size="4"></label> <label>tūris(m<sup>3</sup>)<input type="text" name="load_volume1" size="4"></label> php $data["load_weight"] = $this->input->post("load_weight1")

php - Wordpress custom field only displaying 10 posts -

i've used wordpress advanced custom fields plugin make portfolio page. i've setup fields image, title, category , yes/no weather project featured. my code project page follows: <?php $args = array( 'post_type' => 'project' ); $query = new wp_query( $args ); ?> <?php starkers_utilities::get_template_parts( array( 'parts/shared/html-header', 'parts/shared/header' ) ); ?> <h1 class="lead"><?php the_title(); ?></h1> <div id="triggers"> <strong>filter:</strong> <span id="filterdouble">filter all</span> <span id="filter1">filter 1</span> <span id="filter2">filter 2</span> </div> <ul id="gallery" class="group"> <?php if ( have_posts() ) while ( $query->have_posts() ) : $query->the_post(); ?> <li class=&quo

intuit partner platform - balanceDate of an account vs postedDate of transactions in AggCat -

i noticed account a, lasttransactiondate date such transactions happen before available through getaccounttransactions . it's not date such only transactions happen before taken account when calculating balance of account because transactions happen after lasttransactiondate have taken account yield correct balance. can confirm observation? another thing transactions happen on same date balancedate exact time being after time of balancedate taken account yield account's balance. example, balanceamount = 7682.16, balancedate = 2013-08-06 12:53:21 - 07:00 transaction posteddate = 2013-08-06 16:49:41 - 07:00 included. mean should care date portion of balancedate ? , balancedate of 2013-08-06 12:53:21 - 07:00 includes transactions posted on 2013-08-06? the lasttransactionsdate date of last captured transaction in our system. balance of account captured fi's website perform no calculation of transactions come number. if there pending transactions , fi

c# - How to find a match with 2 comma separated strings with LINQ -

i new linq. i trying compare 2 comma separated strings see if contain matching value. i have string contains list of codes. masterformlist = "aaa,bbb,ccc,fff,ggg,hhh" i trying compare list of objects. in given field formcode contains comma separated string of codes. want see if @ lease 1 code in string in masterformlist. how write linq accomplish this? right have: resultslist = (from r in resultslist r.formcodes.split(',').contains(masterformlist) select r).tolist(); it not return matching items list. please advise you'd need build collection of items search for, check see if there contained within set: var masterset = new hashset<string>(masterformlist.split(',')); resultslist = resultslist .where(r => r.formcodes.split(',') .any(code => masterset.contains(code))) .tolist();

c++ - How can I implement a class which can be constructed with an input iterator? -

the std::vector class has convenient constructor allows input iterator parameter. implement similar pattern in own class, because class needs take in collection when instantiated, have iterator on collection encapsulation purposes. 1 way thought of template-ing whole class input iterator type, can't stl does, because vector templated type being iterated over. of course, 1 option templated generator function, i'd know how it's done compilers implement stl - somehow, inputiterator type typename specific constructor, if constructors can't templated. (yes, have tried @ vector.tpp not understand it). your class should have templated constructor (templated on iterator type): class my_class { template <typename inputiterator> my_class(inputiterator first, inputiterator last) { // ... } // ... };

html5 - javascript image slider hyperlinks -

i working on website , client wants image slider each slide links different page on site. prefer if stay in javascript cant seem wrap head around jquery. here code javascript code in header `<script type="text/javascript"> <!-- var img1 = new image() img1.src="downtowneventnew.jpg" var img2 = new image() img2.src="shakespeare.jpg" var img3 = new image() img3.src="downtownconcertnew.jpg" var img4 = new image() img4.src="rangerettes.jpg" //--> </script> html 5 , javascript in body <div class="content"> <div id="slide"> <div class="slide_container"> <a href="restaurants.html"><img src="downtowneventnew.jpg" name="slide" /> </a> <script type="text/javascript"> <!-- var pic =1 function slides() { if (!document.images) return document.images.slide.src=eval("img" +pic+&

javascript - How do you make words type out from a list? ex. instructables.com -

i'm trying create similar "let make" _ words typed out list on http://www.instructables.com/ . tried searching here or google "random word list" , similar terms not getting anywhere. would appreciate guidance on what language or function used create that. something ( http://jsfiddle.net/arsyj/ ) may point in right direction: var arrwordslist = ["ice cream", "bikes", "jewelry"]; var icurrentwordindex = 0; var icurrentletterindex = 0; var iintervalid; function startprintwords(iinterval) { iintervalid = setinterval(printwords, iinterval); } function stopprintwords() { clearinterval(iintervalid); } function printwords() { if(icurrentwordindex + 1 > arrwordslist.length) { stopprintwords(); return; } var strcurrenttext = $("#textbox").val(); var strcurrentword = arrwordslist[icurrentwordindex]; $("#textbox").val(strcurrenttext

objective c - NSMutableURLRequest setValue:forHTTPHeaderField failing for really long values -

here's code snippet i'm working on: nserror *error = nil; nsdata *data = [nsjsonserialization datawithjsonobject:body options:0 error:&error]; nsstring *string = [[nsstring alloc]initwithdata:data encoding:nsutf8stringencoding]; [request setvalue:[[nsstring alloc] initwithformat:@"%d", string.length] forhttpheaderfield:@"content-length"]; [request setvalue:string forhttpheaderfield:@"json"]; [request sethttpbody:data]; nslog(@"request.values: %@", [request allhttpheaderfields]); the nslog returns first value:header (i.e. "content-length" = 74288), not show value:header containing string property. i've checked string exists, it's long. guess it's length of value field causing not set header. that, or json format weird (it's dictionary containing array of dictionaries). any thoughts?0

Youtube Api v3, category and country specifications -

i working youtube api v3 , collecting information videos. more specifically, interested in category , country/region parameter. video-list , videotype="movie" 1 can retrieve categoryid of each video. how can correspond each categoryid, number, specified movie categoty, e.g comedy. possible retrieve region comes each video? thank in advance. you can videocategories->list category information id. api doesn't expose region code each video, though can search->list filtering region . api exposes video's associated location or file's recording location if that's available.

java - Finding a way to load appropriate jars in different OSs as per requirement -

this discussion involves getting way load different jars in different operating systems. case scenario i working on specific os known nsk. unix flavour , powers hp nsk servers. running 1 of middleware app ( java application) on nsk. requirement make app off-platform. i.e. must work in other platforms linux or windows well. to implement this, introduced 1 more jar. need introduce logic where-in jvm must load appropriate jar @ runtime (jar1 on nsk , jar2 on other non-nsk platform). used following logic implement: code: if (system.getproperty(os.name).equals("nsk")) load jar1 else load jar2 the above code works fine until hit 1 of security exceptions "securityexception" in getproperty api used above. tells user running app not have necessary permission use getproperty(). so, above logic goes toss here. is there way tackle exception , still able find out os details , load correct jar? or better, there better logic implement same? please re

python shutil: only copy part of the file -

the code read xls file directory, convert csv file , copy directory. filepath = os.path.join('.', 'attachments') filepaths = [f f in os.listdir(filepath) if os.path.isfile(os.path.join(filepath, f)) , f.endswith('.xls')] f in filepaths: wb = xlrd.open_workbook(os.path.join(filepath, f)) sheet = wb.sheet_by_index(0) filename = f + '.csv' fp = open(os.path.join(filepath, filename), 'wb') wr = csv.writer(fp, quoting=csv.quote_all) rownum in xrange(sheet.nrows): wr.writerow(sheet.row_values(rownum)) fp.close shutil.copy(os.path.join('.', 'attachments', filename), new_directory) the result is: xls file converted csv file, in new_directory, copied file contains part of csv file. for example, original csv file has 30 rows, in copied file, there 17 rows. idea of why happen? here's problem: fp.close you need call close method, not reference method. so: fp.close() how

Use Twitter Bootstrap 3 RC1 with Meteor -

i trying use latest twitter bootstrap 3 rc1 meteor. tried install using bower, meteor threw error because of html or js included in bootstrap package (the _includes directory). aware meteor has bootstrap package , bootstrap 2.3. i wonder if there's way either ignore files meteor not try , serve these files, or other way around this. have tried custom atmosphere package bootstrap3-less ? ad. question: know test subdirectory ignored on clients/server, that's awful place. have tried putting lib/external? unofficial meteor faq might starting point.

.net - Temporarily change manifest requestedExecutionLevel when debugging -

i'm developing application in visual studio require administrator permissions after installed on user's system. i've added proper application manifest file make sure happens: <requestedexecutionlevel level="requireadministrator" uiaccess="false" /> however if want debug program in visual studio, required run visual studio administrator. no bueno. , annoying part program doesn't need administrator privileges during debugging. requires privileges after being installed on user's system. is there clean, easy way "throw switch" disables administrator requirement during development, , re-enables when release application? edit: when release application user, run build script uses msbuild. i'm trying make visual studio build solution in release configuration without administrator manifest. when run build script, want msbuild include administrator manifest while keeping same release configuration. you can pre-b

c# - Entity Framework foreign key problems on Oracle - code-first -

i have following mapping using code-first: { /// <summary> /// entity framework dc.dc database table object representation /// </summary> [table("dcdc", schema = "mzmesdb")] public class efdcdc { /// <summary> /// element id /// </summary> [column("id")] public int id { get; set; } /// <summary> /// name of dc /// </summary> [column("name")] public string name { get; set; } /// <summary> /// dc description /// </summary> [column("description")] public string description { get; set; } /// <summary> /// foreign key /// </summary> public virtual efsystemdatamodule module { get; set; } /// <summary> /// name of module /// </summary> [column("enabled&q

MySQL UPDATE error to line 2 -

i have script: include ('connect.php'); $data = mysql_query("select * projects id='2'") ; $da = mysql_fetch_array($data); if(isset($_post['submit'])){ $name = $_post['project_name']; $date = $_post['date']; $amount = $_post['amount']; $curr = $_post['curr']; $spec = $_post['spec']; $sql = "update projects set (name='$name', date='$date', amount='$amount', currency='$curr', specifications='$spec') id=2"; $res = mysql_query($sql); if($res) { echo "upadate successfull!"; } else { echo "sorry!"; echo mysql_error($connect)."<br />"; echo error_reporting(e_all)."<br />"; echo ini_set('desplay_errors','1'); } note: connect.php file working ok since i've used before

c - iOS: Best practice for placing the close brace -

i know, best coding practice have close brace (}) in objective c based enterprise project. define method , condition statements below. please advise, best coding practice in objective c , why. have not seen in apple's coding standard document though. which correct, close brace should same line or below? i. -(void) method { .... } (or) -(void) method { .... } ii. -(void) method { if ( ... ) { ..... } else { ..... } } (or) -(void) method { if ( ... ) { ..... } else { ..... } } i haven't seen standards on code formatting. it's preferential. although tend whatever can reduce whitespace. for example: -(void)mymethod{ [self dosomething]; }

python - sorting numbers using recursion -

the purpous of using recursion instead of using for in range(11): because advantagous start top trying solve specific mathematical problem. function changed returns [n] that matches criteria. print(numbers)=[[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]] why there brackets? print(numbers[7])=indexerror: list index out of range has brackets? # function supposed sorting numbers in list def sorting_numbers(n): if n > 1: return [n] + sorting_numbers(n-1) else: return [1] numbers = [] n = 10 numbers = (sorting_numbers(n)) print(numbers) print(numbers)=[[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]] why there brackets? print(numbers[7])=indexerror: list index out of range has brackets? well if really want use recursion such simple problem - warned it's terribly inefficient , cause maximum recursion depth exceeded error values of n close 1000 (python not designed handle recursion efficiently): def storing_numbers(n): if n > 1: return [n] + stor

css - Make images scale to parent div only when larger, all while using an explicit max-width -

i can make image scale responsively parent div on smaller screens still limit explicit max width: img { max-width: 500px; width: 100%; } however, if image smaller parent div, still stretched fill div. is there way have scale 100% when larger , maintain original dimensions when smaller, without knowing image's dimensions beforehand? you can set image's max-width: 100%; limit size if it's bigger parent. img { height: auto; max-width: 100%; } demo here: http://jsfiddle.net/lmewc/

Must jQuery be verbose? -

i see lot of jquery code this: if $('#contactme').attr('checked') { $(':radio').attr('disabled', false) } else { $(':radio').attr('disabled', true) } ...but why not way: var checked = $('#contactme').attr('checked'); $(':radio').attr('disabled', not checked); ...or way: $(':radio').attr('disabled', not $('#contactme').attr('checked')); is not possible, or considered ugly/hard maintain? update to assertion "not" should "!" (a la c#, etc.), this: http://jsfiddle.net/uvxha/ ...where works jqueryui-ify button: $("button:not(:ui-button)").button(); ...but this: $("button:!(:ui-button)").button(); ...does not (or should say, "does !")? you can that, long use ! , not not . $(':radio').attr('disabled', !$('#contactme').attr('checked')); this has not

mysql - Using ORDER BY while still maintaining use of index -

i'd retrieve rows utilizing index on columns , b. told way ensure index being used retrieve rows use order clause, example: a b offset 1 5 1 1 4 2 2 5 3 2 4 4 select a,b tablex offset > 0 , offset < 5 order a,b asc but results rows returned ordered column b , not a,b. a b 1 4 2 4 2 5 1 5 how can , still ensure index being used , not full table scan? if use order b doesn't mean mysql scan b , defeat purpose of having 2 column index? any index includes or b cloumns have no effect on query, regardless of order by . need index on offset field being used in hte where clause.

html - Continuous read of USB attached device using JavaScript? -

right have windows app continuously reads usb-attached scale , displays (and uses) value. can via web page? mentioned "javascript input event listener", maybe? have simple html example? thanks i doubt able information hardware using browser without using java applet or similar. you write web interface communicates process running on machine, not able access hardware directly through browser. for more information regarding protections surrounding browsers, here: http://www.australianscience.com.au/research/google/35779.pdf my suggestion: if have windows application want run interface in browser, vlc ( http://www.howtogeek.com/117261/how-to-activate-vlcs-web-interface-control-vlc-from-a-browser-use-any-smartphone-as-a-remote/ )

iphone - iOS Drawing a grid view for dragging/dropping objects that snap to that grid -

i working on project requires custom view segmented squares. need able drag view on , when drop object snap grid squares. need able iterate on every square in grid , determine if object inside particular grid square. i realize bit of general question i'm looking direction on start, classes or frameworks might exist reference. direction @ appreciated. thanks. question #1: user needs able drag view on , when drop object snap grid squares. lets dragging uiview. on touchesended of uiview use center property contains x , y coordinate center values of uiview , pass function tests see grid square inside of. this (assume uiview name draggingview): for (cgrect gridsquare in gridarray) { if (cgrectcontainspoint(gridrect, draggingview.center)) { // return gridsquare contains object } } now in case wondering gridarray is, array of grid squares make game board. if need creating let me know. question #2: user needs able iterate on every square in grid ,

javascript - How to use Google Dart with Firebase Simple login (pass function inside function) -

has figured out how use firebase simple login google dart? trying figure out how define function(error, user){} when calling firebasesimplelogin. both error , user() objects. this sample javascript code firebase var mydataref = new js.proxy(js.context.firebase, 'https://johnstest1.firebaseio.com/'); var mydataref = new firebase('https://johnstest1.firebaseio.com/'); var auth = new firebasesimplelogin(mydataref, function(error, user) { if (error) { // error occurred while attempting login console.log(error); } else if (user) { // user authenticated firebase console.log('user id: ' + user.id + ', provider: ' + user.provider); } else { // user logged out } }); this code added html file use both dart , firebase <script type='text/javascript' src='https://cdn.firebase.com/v0/firebase.js'></script> <script type='text/javascript

Splitting a list into two lists in scala -

i have list containing like: val lines: list[string] = list("bla blub -- id_1", "sdkfjdf -- id_2", "blubber blab -- id_1", "foo -- id_3", "ieriuer -- id_2", "bar -- id_3") so list contains identifier exists twice (id_x) , string belongs 1 of identifiers. i want split 1 list 2 lists each contains unique set of id_s belonging strings, this: l1("bla blub -- id_1", "sdkfjdf -- id_2", "foo -- id_3") l2("blubber blab -- id_1", "ieriuer -- id_2", "bar -- id_3") how in functional way? best regards, sven lines.groupby(_.split(" -- ")(1)).tolist.map(_._2).transpose that's rough , ready way it; in reality if want more data it'll better parse items case class, la: case class item(id: string, text: string) val items = { line <- lines array(text, id) = line.split(" -- ") } yield item(id, text) then same above, excep