Posts

Showing posts from April, 2010

how to fix the SyntaxError: unterminated string literal when embed php in javascript? -

when try this: var app_app = <?=$app_app?>; i got error: syntaxerror: unterminated string literal var app_app = '<br /> strange, can me ? var app_app = "<?php echo $app_app; ?>"; note : have echo out php variable define javascript , wrap inside quotes

c# - Generic LINQ to SQL Extension Methods on collection of various derived types -

i'm trying create generic extension method iqueryable<t> . t abstract player , iqueryable can contain concrete types goalkeeper , striker . public abstract class player { public string name { get; set; } public string fouls { get; set; } } public class goalkeeper : player { public int saves { get; set; } } public class striker : player { public int goals { get; set; } } the extension methods working (the simple ones) this: public static iqueryable<goalkeeper> notperforming(this iqueryable<goalkeeper> goalkeepers) { return goalkeepers.where(g => g.saves < goalkeepers.average(x => x.saves)); } public static iqueryable<striker> notperforming(this iqueryable<striker> strikers) { return strikers.where(g => g.goals < strikers.average(x => x.goals)); } which can use this: var badgoalies = players.oftype<goalkeeper>().notperforming(); var badstrikers = players.oftype<striker>().notperfor...

python - Force thread execution on a specific CPU core -

i have 2 threads in python , want force execution of thread1 on cpu core 0 , thread2 on cpu core 1. possible? if so, how? thanks import threading import time #i execute thread on cpu core 0 class thread1(threading.thread): def __init__(self): self.running = 1; super(thread1, self).__init__() def run(self): while self.running: print "thread1" #i execute thread on cpu core 1 class thread2(threading.thread): def __init__(self): self.running = 1; super(thread2, self).__init__() def run(self): while self.running: print "thread2" if __name__ == "__main__": thread1 = thread1() thread1.start() thread2 = thread2() thread2.start() start_time = time.time() while (time.time() - start_time) <= 5: print "main" thread1.running = 0; thread2.running = 0; thread1.join() thread2.join() as now, not possible determine on core p...

text editor - Documentation for custom fonts and colors in Visual Studio environment options -

Image
the documentation on each display item in visual studio's environment options fonts , colors lacking. there documentation page on msdn , incomplete (not display items listed), , contains limited descriptions. makes difficult customize code editor styling understand items need manipulate. lack of search function further complicates things. the main question answer question is, is there more extended documentation on available somewhere? since highly doubt (at least search efforts have failed me far), suggest start bundling more elaborate documentation needed (complicated display items) posted answers question. encouraged add screenshots visible impact instantly visible. there no documentation available for highlighted definition , highlighted reference , , highlighted written reference . these pertain highlighting similar items within source code item selected. highlighted definition : specifies highlight color selected item defined (e.g., member definition, t...

php - Uninstall Magento custom extension with its database -

i have created extension , created zip file of extension can install through magento connect. when uninstall custom extension using magento connect delete extension files , folders database tables of extension not deleted. i want remove database table of extension. want process done automatically not using phpmyadmin , manually or writing upgrade script because want when extension being used user not face issue. sadly, there no rollback or uninstall script may find on other framework. the install , data folders of modules meant bump version there no way provided framework bump down or in case remove totally.

Code-Snippet not refreshed in Visual-Studio -

i creating code snippet in visual-studio 2010 using "snippet editor". working fine when first save snippet in folder ... visual studio 2010\code snippets\visual c#\my code snippets . snippet executed when ctrl-k ctrl-x , choose in list, , intellissence using snippet shortcut. my problem comes when change code of snippet , save again : the new code executed when hit ctrl-k ctrl-x the old code executed when using intellisense ?? the problem still here when reopen vs i don't think "snippet editor" issue. there "intelissence cache" have reset ? seems bug in visual studio 2010, no more problem on next version of vs

java - Webdriver MS Edge browser does not get URL -

i tried navigate url ms edge browser giving me error. environment follows: windows: 10 64x pro. browser: ms edge 25.10586.0.0 selenium webdriver: 2.48.2 import org.openqa.selenium.webdriver; import org.openqa.selenium.edge.edgedriver; public class edgebrowser { public static void main(string[] args) { system.setproperty("webdriver.edge.driver", "c:\\program files (x86)\\microsoft web driver\\microsoftwebdriver.exe"); webdriver driver = new edgedriver(); driver.get("http://www.google.com"); } } ms edge browser opens not navigate google.com , received following error received request http://localhost:17347/session existing microsoft edge process (pid: 64400) terminated forcibly. waiting new request... received request http://localhost:17347/shutdown stopping server. exception in thread "main" org.openqa.selenium.remote.sessionnotfoundexception: null (warning: server did ...

C++ data block management -

(having trouble coming question title here!) in last few months, seem keep writing code doing same task (in minor variations). i'm wondering if there's in c++ standard libraries (or maybe boost) can help. let me try explain i'm trying do… as concrete example, suppose have logical file that's made of several physical files on disk. want write function like void readdata(void * buffer, uint64 offset, uint64 size); seems simple enough, right? however, it's quite fiddly: first, need figure out physical file contains requested logical offset. next, need check whether requested size spans physical file boundary. actually, in worst case, it's plausible size span multiple files , although that's unlikely. finally, need fread() right blocks of data, right files, right offsets in buffer . checking neither offset nor size exceeds available data prudent well. none of astonishingly hard , it's fiddly , easy screw up. there endless opportuni...

pseudocode - Knapsack restore solution complexity -

in order solve integer knapsack problem, used iterative memorization algorithm (via n*w sized matrix n number of items, , w knapsack's max weight capacity). asked restore solution (the items inserted knapsack) using matrix. we're not sure restore algorithm run time complexity. restore pseudo code follows (where w(j) weight of item j , v(j) value of item j ): **restoreitems(m)** empty set. j=n, t = w. while j>0 , t>0 if m[j,t] = m[j-1,t] j=j-1 if m[j,t] = m[j-1,t-w(j)] +v(j) , w(j) <= t = + j j = j-1 t = t - w(j) return

c# - How to dynamically make columns of jQuery DataTable disappear -

here information development environment: microsoft visual studio professional 2013 .net framework 4.0 jquery-2.1.4.min.js jquery datatables 1.10.7 newtonsoft.json.7.0.1 jquery ui 1.11.2 var getauserslogs = function (sortcolumn, isdescending) { $('#personaluserslogtable').datatable({ "aocolumns": [ { "stitle": "logbsonvalueid" }, { "stitle": "userid" }, { "stitle": "driver name" }, { "stitle": "log date" }, { "stitle": "duty cycle" }, { "mdata": null, "mrender": function (obj) { return '<a href="#" id="' + obj....

css - Table overflows width of parent only in Firefox. Not caused by padding/margin/border -

i have table reason keeps overflowing width of container. works fine in chrome, in firefox refuses. site can found here: http://goo. gl/vkn5s i've tried using box-sizing: border-box; (with -moz prefix) on table, no difference (i don't see why make difference). images in table has margin, after removing margin still overflows container @ least 20px. table has width of 100% should fill container. td's have 50% width. 50% width more enough images fit (even image margin). i've read similar questions , of suggests removing padding/margin/border , not having display: block; (which don't have). i'm out of ideas. if use border-collapse:collapse remove it.

xamarin - On iOS device UIViewController returns System.Reflection.TargetInvocationException instead of actual View -

i'm upgrading existing game work ios 9.2. i'm using xamarin studio v5.10.1 (build 6) , xamarin ios v9.4.0.0 (i'm current on stable , beta channels). i've got piece of code in uiviewcontroller contructor. public mainviewcontroller() : base { mainview = (mainview)this.view; mainview.mvc = this; initializedate(); initializegame(); gameloop(); } on simulator running ios 9.2 works correctly–this.view returns instance of mainview stored in instance variable mainview. on device, iphone 5s running ios 9.2, this.view throws system.reflection.targetinvocationexception (the inner exception system.nullreferenceexception). on versions of ios prior 7.0 code ran on device without throwing exception. moving code above viewdidload or viewwillappear did not on device–the exception still thrown. i can post stack trace if thinks helpful. thanks in advance.

sass - Chrome dev tools CSS source mapping doesn't work by default -

myself , other developers seeing issue chrome dev tools not recognizing our css source maps immediately. our minified css file , .map file being served , available dev tools, have open settings > sources > uncheck , recheck "enabled css source maps" inspector reference actual _partial.scss files styles. if don't uncheck , recheck source maps toggle, shows direct line reference minified css file, not useful. has encountered issue before or know better workaround it? happening on latest chrome version , several before it.

android - Scrollview autoscrolls after changing visibility of Ad -

i have scrollview contains textview , imageview , webview , sticky publisheradview @ bottom of relativelayout contains scrollview , publisheradview . my ad's visibility gone default, after ad loads, change visibility of publisheradview visible . problem when change visibility, scrollview auto scrolls location, , don't want that. how can fix this? this layout <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="fill_parent" android:background="@color/windowbackground"> <linearlayout android:layout_above="@+id/ad_view_sticky" android:layout_width="match_parent" android:layout_height="fill_parent" android:background="@color/windowbackground" android:orientation="vertical"> <linearlayout a...

css - HTML5 alternative for ::-moz-list-number -

this question exact duplicate of: custom numbering reversed ordered list 3 answers how define style list numbering in html5, compatible <ol reversed> ? i found ::-moz-list-number works in firefox. know better alternative same? i totally missed obvious reverse part. looks might need <li><span>item</span></li> , unstyle in <span> styled <li> . old answer (might useful some). you can style ::before , add content: counter(somecounter) . ol { list-style: none; counter-reset: item; } ol li::before { counter-increment: item; content: counter(item) ". "; color: red; font-weight: bold; } here's quick demo: https://jsfiddle.net/crswll/toggchgd/1/

.net - How to fix retargeting warning -

i have .net solution produces following warning when compiled using visual studio 2013 update 5 on win7 x64 build agent using .net 4.5.2. projects in solution target .net 4.5.2 framework: c:\program files (x86)\msbuild\12.0\bin\microsoft.common.currentversion.targets (991): reference assemblies framework ".netframework,version=v4.5.2" not found. resolve this, install sdk or targeting pack framework version or retarget application version of framework have sdk or targeting pack installed. can explain need resolve this? somewhere else refers 'repairing windows sdk' if indeed solution not sure entails. should worried warning? i had same issue , fixed installing microsoft .net framework 4.5.2 developer pack: https://www.microsoft.com/en-us/download/details.aspx?id=42637

sql server - linking OMOperatingUnit table to CompanyInfo in AX 2012 -

Image
my first table temporary return result of companyinfo , second table temporary return result of omoeratingunit want link both table don't know how can .so i"m trying test query return 0 record. select * dirpartytable party inner join microsoftdynamicsax.dbo.dirpartytable common on common.recid = party.recid , common.instancerelationtype = 2376 left outer join microsoftdynamicsax.dbo.dirpartytable omoperating on omoperating.recid = common.recid , omoperating.instancerelationtype = 2377 , omoperating.recid = party.recid left outer join microsoftdynamicsax.dbo.dirpartytable companyinfo on companyinfo.recid = common.recid , companyinfo.instancerelationtype = 41 , companyinfo.recid = party.recid , companyinfo.dataarea = 'usmf' so there relation between companyinfo table , omoperatingunit table any body in regards. ax extended tables saved in sql flatte...

mysql - Adding a value into a field -

inherited 20,000 book database particular field called 'keywords' mess, in 1 huge table called books. trying prepend value each of 'keywords' fields reads words in field , identifies exact category 1 clear phrase. so, looking word 'ancient' , prepending value 'menu-ancient'. update books set keywords=concat('menu-ancient, ',keywords) keywords '%ancient%'; that works, following query doesn't want! it's supposed find ones done , go through them find of them have word 'medieval' in there - give submenu menu-ancient-medieval well. update books set keywords=concat('menu-ancient-medieval, ',keywords) keywords = 'menu-ancient' , keywords '%medieval%'; one example field this: menu-ancient, war., middle ages, ancient , medieval, ancient 19th century, i have got menu-ancient prepended getting medieval bit! you can use find_in_set() function this. this works in following example ...

javascript - Additive Blending in custom shader -

Image
i have 2 custom shader materials blend additively. changing blending option in material not having effect. need add shaders themselves? if so, there example might follow somewhere?

oracle - Using a sum to return a number of records -

i trying return number of records based on page count added records selected. page counts vary, each batch returned have page count falls in range. .. data print id page_count status 1000 50 ready 1001 50 ready 1002 50 ready 1003 75 ready select print_id, page_count,status print_job status = 'ready' , sum (page_count)>100 , sum(page_count)<200 returned print_id page count status 1000 50 ready 1001 50 ready 1002 50 ready i have tried having , using sub query. seems bring individual pieces have page counts fall in range, not sum total number of pages. ideas? if question can reformulated in grouping records in order of print_id , each group has sum(page_count) > 100 (or rest of records @ end of table); here 1 solution using recursive subquery factoring in first step add sequential id table ordered s...

gulp-preprocess and environment variables on Windows 10 -

i building js app on osx, , windows 10, both running node.js v4.2.x. as part of build process run build_type={my-build-type} gulp build which builds particular configuration of app, using gulp-preprocess . the relevant part of gulp file looks like var env = process.env; ... .pipe(plug.preprocess({context: { build_type: env.build_type}})) ... the relevant part of html looks like <!-- @if build_type='live' --> <script src="config/live.js"></script> <!-- @endif --> <!-- @if build_type='dev' --> <script src="config/dev.js"></script> <!-- @endif --> <!-- @ifndef build_type --> <script src="config/dev.js"></script> <!-- @endif --> <p>build type - <!-- @echo build_type --></p> on osx works great, running build_type=dev gulp build results in: <script src="config/dev.js"></script> <p>build type...

c# - Why System.Core fails to load when adding Coded UI support for Silverlight 5 application? -

i'm having following problem: trying add support creating coded ui test silverlight 5 application ([msdn][1]). first step reference assembly microsoft.visualstudio.testtools.uitest.extension.silverlightuiautomationhelper.dll in silverlight 5 project. unfortunately, after reference has been added, projects stops compile number of similar errors: > error 25 cannot resolve reference assemblies. please check reference assemblies. not load file or assembly 'system.core, version=5.0.5.0, culture=neutral, publickeytoken=7cec85d7bea7798e' or 1 of dependencies. located assembly's manifest definition not match assembly reference. (exception hresult: 0x80131040) ....\errorreportdialog.xaml looks system.core 5.0.5.0 fails load, okay, debugging assemblies loading fuslogw produces 2 interesting logs: first log: > assembly binder log entry (04.03.2013 @ 14:07:49) operation successful. bind result: hr = 0x0. operation completed successfully. assembly manager loa...

html - Jquery ToolTip - working but needs tweaking -

i'm using code here : http://cssglobe.com/easiest-tooltip-and-image-preview-using-jquery/ this seems work fine apart issue table. my table wide, has on 80 columns , requires me scroll see all. that's fine because of layout works scrolling. each header has tooltip assigned gives details on column below. again works 1 exception. the tooltips starts wrap near right hand edge of page, header / tooltip of screen , requires scrolling wrapped. is there anyway fixed width on tooltip regardless of appears on page in relation right edge ? this jquery : /* * tooltip script * powered jquery (http://www.jquery.com) * * written alen grakalic (http://cssglobe.com) * * more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery * */ this.tooltip = function(){ /* config */ xoffset = 10; yoffset = 20; // these 2 variable determine popup's distance cursor // might want adjust...

android - FileProvider.GetUriForFile () throwing Exception. Cannot find configured root -

here code in trying create contenturi can call pdf viewer. ~ provider inside <application> , <authority> matches package name <provider android:name="android.support.v4.content.fileprovider" android:authorities="com.company.fileprovider" android:exported="false" android:granturipermissions="true"> <meta-data android:name="android.support.file_provider_paths" android:resource="@xml/file_paths"/> </provider> ~ xml/filepaths.xml <?xml version="1.0" encoding="utf-8" ?> <paths xmlns:android="http://schemas.android.com/apk/res/android"> <files-path name="assets" path="library/offlineassets/"/> </paths> ~ .cs have exception var dir = "/data/data/com.tripleplay_services.triplesport/files/../library/offlineassets/xamarin_documentation1_v1.pdf"; var newfile = new fi...

eclipse - Problems generating ant scripts for java when linking to Rhino -

when try build project using ant, get: "java.lang.noclassdeffounderror: sun/org/mozilla/javascript/internal/scriptable" this stems usage of rhino (the bundled java-script comes oracle jdk) when build project eclipse, works fine. the ant file using generated eclipse, , works fine except java-script dependencies. these dependencies located in rt.jar comes oracle jdk. i have tried both jdk6_0_u41 , jdk7, , both give same results: success in eclipse, fail ant. i have tried build on both ubuntu 10, , 12 i have seen 2 other suggestions seem unacceptible me: one thread suggested copying rt.jar project lib directory. (rt entire java runtime! ) another thread suggested shouldn't use:sun/org/mozilla/javascript/internal. since doing advanced manipulation (calling object methods, registering callbacks, etc) see no alternative using sun.org.mozilla.javascript.internal family of classes. a comment oracle's site: users should not write code depen...

c++11 - vgAppendPathData and vgModifyPathCoords, how to change visibility of path segments -

i have question regarding changing visibility of path segments via vg_line_to_abs , vg_move_to_abs first, i've been told it's resource expensive create , destroy openvg paths, , it's fast create path, modify it therefore, in init function have vg3dpath = vgcreatepath(vg_path_format_standard, vg_path_datatype_f, 1.0f, 0.0f, seg_pts, seg_pts * 2, vg_path_capability_all); vgappendpathdata(vg3dpath, seg_pts, (const vgubyte *)vg3dpathsegments, points); and in draw function have, vgmodifypathcoords(vg3dpath, 0, seg_pts, points); the number of points, seg_pts not change, location of points, stored in points array (defined 2*seg_pts in size x , y coordinates of each point) . this works fine. my issue vgmodifypathcoords() not take segment description array, vg3dpathsegments (defined seg_pts+1 in size, vg_move_to_abs, vg_line_to_abs ... vg_line_to_abs, vg_close_path) if want change visibility of segments. i. e. change of vg_line_to_abs vg_move_to_abs, can...

ios - MFMailComposeViewController Large Pdfs attachments get stuck -

so using mfmailcomposeviewcontroller attach pdf files email , send out using default ios mail app set exchange account. if send file size 4863k works perfectly. goes off expected. if send file size 5688k seems working , gets mfmailcomposeresultsent result sent delegate. however, mail never arrives , when in mail app, see stuck in outbox error of: the server rejected message what's super weird when try resent message outbox, sends out fine , gives no further error message. i sort of @ wits end , have not first clue going wrong. cannot screw around apple's code, there don't seem many options mfmailcomposeviewcontroller possibly have screwed up. the code straightforward: - (void) setattachments:(nsarray*)attatchments ofdraft:(mfmailcomposeviewcontroller*)draft { if (attatchments) { (nsstring* path in attatchments) { nsdata* data = [self getdataforattachmentpath:path]; nsstring* basename = [self getbasena...

sql - In SSRS Report Builder, how to only show something when it's the last row of a group? -

i trying build report show specific notes below last line in grouping, grouping may part of data set. quick example: have 2 orders 3 rows of information each. after each row, have row hidden, when visible displays notes. these 2 orders separated "line number". data set has 6 rows, need distinguish if row last row of line number, row can shown.

ios - NSLocaleCountryCode returns nil -

i have bugreport states crash in following line, client instance of nsmutabledictionary [client setobject:[[nslocale currentlocale] objectforkey:nslocalecountrycode] forkey:@"country"]; my guess is, nslocalecountrycode returns nil in line, leads adding nil object nsdictionary lead crash. question is, has experienced issue before? there reasons nslocalecountrycode nil currentlocale ? documentation doesn't returning nil value , thought return valid country. best regards, michael there others have experienced issue, when nslocale "system locale". need more defensive in coding, either not populating key if it's nil or using [nsnull null] : nslocale *locale = [nslocale currentlocale]; nsstring *country = [locale objectforkey:nslocalecountrycode]; if (country != nil) { [client setobject:country forkey:@"country"]; }

python - REPLACE rows in mysql database table with pandas DataFrame -

python version - 2.7.6 pandas version - 0.17.1 mysqldb version - 1.2.5 in database ( product ) , have table ( xml_feed ). table xml_feed huge ( millions of record ) have pandas.dataframe() ( processed_df ). dataframe has thousands of rows. now need run replace table product.xml_feed (col1, col2, col3, col4, col5), values (processed_df.values) question:- is there way run replace table in pandas? checked pandas.dataframe.to_sql() not need. not prefer read xml_feed table in pandas because huge. till version (0.17.1) unable find direct way in pandas. reported feature request same. did in project executing queries using mysqldb , using dataframe.to_sql(if_exists='append') suppose 1) product_id primary key in table product 2) feed_id primary key in table xml_feed. simple version import mysqldb import sqlalchemy import pandas con = mysqldb.connect('localhost','root','my_password', 'database_name') con_str = ...

java - Should the interface define implementation specific enum values? -

consider following organization of classes: interface restaurant { public void dine(object dish); } class italianrestaurant implements restaurant { public void dine(object dish) { // eat spoon , forks } } class chineserestaurant implements restaurant { public void dine(object dish) { // eat chopsticks } } since both restaurants serve different sets of dishes, correct way (design-wise) represent type of dish in interface? will design decision define enum listing dishes -- italian , chinese -- part of interface, , use enum type dish ? you've used object type dish. meaning can considered dish here. does mean can serve phone or pen dish? no; dish dish. why not create abstraction dish well? better design : interface restaurant { void dine(dish dish); } dish interface or abstract class; choose 1 more appropriate. every kind of dish served go separate class inherits/implements dish .

java - Apache POI Not Recaclulating -

i have workbook large number of formulas, including formulas depend on results of other formulas depend on vlookups, etc. of these lead calculation of single value. when try value via poi 3.13, it's #value!. however, if open workbook in excel, it's calculated correctly. before getting value need, call: book.getcreationhelper().createformulaevaluator().evaluateall(); which, according documentation, should resolve these issues. apache's documentation calls out #value! issue , suggests above step resolution, yet can't work. not formula exceptions. i've tried calling evaluateall() after each time set value (about 100 set scenario), still it's #value! public boolean setvalue(final int value, final string tabname, final int rownum, final int colnum) { boolean returnval; try { final cell currentcell = getcell(tabname, rownum, colnum); currentcell.setcellvalue(value); currentcell.setcelltype(cell.cell_type_numeric); ...

asp.net - Crystal Report Asking parameter again -

dear working on asp .net application in using crystal report showing reports. in application works fine including reports. real problem comes when start clicking on crystal report toolbar. if click on buttons on crystal report tool bar (export, next page ...etc.) asking parameters again. there way that crystal report viewer not ask parameter have given ? i have given true property reuseparametervaluesonrefresh . passing parameters report document. reportdocument rd = new reportdocument(); rd.setparametervalue("@date", request["date"]); crystalreportviewer1.reportsource = rd; try change crystal report parameter type date string .

xsd - jaxb2 simplify plugin binding issue -

i tried use jaxb2 simplify plugin using xjc 2.2.4. d:\>xjc -d . -extension -p org.my.space sample.xsd parsing schema... [error] unsupported binding namespace "http://jaxb2-commons.dev.java.net/basic/simplify". perhaps meant "http://jaxb.dev.java.net/plugin/code-injector"? line 7 of file:/d:/sample.xsd failed parse schema. sample.xsd has declared simplify <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.1" xmlns:simplify="http://jaxb2-commons.dev.java.net/basic/simplify" jaxb:extensionbindingprefixes="simplify" xmlns="http://www.example.org/samplexml" targetnamespace="http://www.example.org/samplexml" elementformdefault="qualified"> any thoughts? edit: tried other way around bindings file xjb , still same error. mean xjc version(2.2) not support jaxb2 simplify ? xjc -d . -e...

web services - cURL command for HTTP GET -

Image
i have web service contains method dowork(). method used retrieve data database , pass data caller in json format. [operationcontract] [webinvoke(method = "get", uritemplate = "dowork")] public stream dowork() { return new memorystream(encoding.utf8.getbytes("<html><body>work done</body></html>")); } i have composed fiddler request verify method available. if execute fiddler, method in web service gets called. can't seem figure out how construct curl command same thing. perhaps easiest approach having chrome create curl command line you, when request involves many headers , complicated post data. open developer tools pressing f12 , going network . run whatever call want monitor. (in example can see happens when open questions here on stack overflow) then right click on relevant line , select copy curl (cmd) if on windows (for linux use other) this give command line si...

python - Django Invalid block tag: 'static' -

i have in <head> of base.html. {% load staticfiles %} <link rel="stylesheet" type="text/css" href="{% static "mystylesheet.css" %}"> and error invalid block tag: 'static' within installed_apps i've included 'django.contrib.staticfiles', and i've included within settings.py static_url = '/static/' static_root = os.path.join(os.path.dirname(__file__), "static/") why load error? the actual problem here, i'm sorry say, within app.yaml file had specified different directory static files , seemed overriding else. once removed, sorted.

asp.net - Passing a value back from ImageButton -

i'm learning doing wrong. want display multiple avatar images on screen (75 when suss bit) , have user select one. when click 1 calls procedure avatar_click need recognise 1 has been clicked.. how do ? have far.. <td><asp:imagebutton id="imagebutton1" runat="server" width="20px" imageurl="~/files/images/avatars/a01 copy.gif" onclick="avatar_click" /></td> <td><asp:imagebutton id="imagebutton2" runat="server" width="20px" imageurl="~/files/images/avatars/a02 copy.gif" onclick="avatar_click" /></td> <td><asp:imagebutton id="imagebutton3" runat="server" width="20px" imageurl="~/files/images/avatars/a03 copy.gif" onclick="avatar_click" /></td> protected sub avatar_click(sender object, e eventargs) end sub what need put in vb procedure avatar_click ? any apprecia...

python - SQLAlchemy cascading polymorphic column updates -

i have parent employee table , child engineer table. client perspective want interact employee model. implemented read , delete, issues arise when trying update or insert. the sqlalchemy docs state: warning currently, 1 discriminator column may set, typically on base-most class in hierarchy. “cascading” polymorphic columns not yet supported. so seem default not going work. i'm looking ideas on how make work. here's complete test setup using postgres psycopg2. sql might work other sql databases, have test others. sql script create test database (testdb) , tables (employee, engineer): create database testdb; \c testdb; create table employee( id int primary key not null, name text, type text ); create table engineer( id int primary key not null, engineer_name text, employee_id int references employee(id) on update cascade on delete cascade ); python test script: as-is insert test fail, delete pass. if...

c# - Is it possible to deserialize an encrypted file via DataContractSerializer? -

i'm serializing object via datacontractserializer without problems. but if try serialize object encrypted file exception when deserializing. here code: public static bool serializedatacontract<t>(stream filestream, t o, bool bcrypt = false) { datacontractserializer serializer = new datacontractserializer(typeof(t)); if(bcrypt) { tripledescryptoserviceprovider crypt = new tripledescryptoserviceprovider(); crypt.iv = crypt_init_vector; crypt.key = crypt_key; crypt.padding = paddingmode.zeros; using(cryptostream cryptostream = new cryptostream(filestream, crypt.createencryptor(), cryptostreammode.write)) { serializer.writeobject(cryptostream, o); cryptostream.close(); } } else serializer.writeobject(filestream, o); return true; } public static bool deserializedatacontract<...

javascript - How can I enable scrolling only for a parent window using window.showModelessDialog() in IE7 without jQuery? -

i want javascript open popup modifying data rows have been selected via checkboxes. rows exist in parent window. i having trouble enabling scroll control in parent window. using window.showmodelessdialog() , enables of parent controls. need scroll. my app intended work on ie7, , cannot use jquery.

sql - PostgreSQL sum quantity of children items -

i have subscription service delivers many items. subscribers add items delivery creating row in delivery_items . until subscribers add 1 of each item delivery. have added quantity column delivery_items table. given this schema, , outdated query (on sql fiddle), how can select total amount of item need each day's deliveries? this provided table of days, , items being delivered day doesn't account quantity: select d.date, sum((di.item_id = 1)::int) "bread", sum((di.item_id = 2)::int) "eggs", sum((di.item_id = 3)::int) "coffee" deliveries d join users u on u.id = d.user_id join delivery_items di on di.delivery_id = d.id group d.date order d.date ideally, query agnostic specifics of items, id/name. thanks edit add schema: deliveries (table) id int4(10) date timestamp(29) user_id int4(10) delivery_items (table) delivery_id int4(10) item_id int4(10) quantity int4(10) items (table) id int4(10) name varchar(10) users ...

javascript - Using John Papa's AngularJS style guide, what is the proper way to declare data objects? -

let's have angularjs data service makes call server , returns object can extended additional methods. example, assume following function part of angularjs service nerddinner. function getdinner(dinnerid) { return $http.get('api/dinner/' + dinnerid) .then(loaddinnercomplete) .catch(loaddinnerfailed); function loaddinnercomplete(response) { return new dinner(response.data); } } what's best practice place define dinner class? factory in separate file? define in nerddinner service? or define in getdinner class (assuming that's method can create dinners)? i did not find specific reference creating objects in style guide , forgive me if it's covered , missed it. edit decided accept jeroen's answer because matched needs rather simple use case. however, daniel's answer pure gold, , should not overlooked. if chose extend functionality of dto simple crud or additional server based operations, $resource great approac...

c - Why do I get a segmentation fault when I try to add a NUL terminator at the end of my string? -

according gdb, segmentation fault when try assign '\0' last position in request_line . can't use memory on heap ( alloc , malloc , calloc ) since server implementation control handlers can make hard free space. the size of request_targetsize 24, correct. #include <string.h> #include <stdio.h> int main() { const char line[80] = "get /index.html/search?q=cat http/1.1"; char *abs_path; char *str = null; char *request_target= null; char *query = null; //get request target char* startofrequest_target = strchr(line, '/'); char* endofrequest_target = strchr(startofrequest_target, ' '); int request_targetsize = endofrequest_target - startofrequest_target; if (startofrequest_target != null && endofrequest_target != null) { memcpy(request_target, startofrequest_target, request_targetsize); request_target[request_targetsize] = '\0'; } .... my guess has initializing r...

javafx - How to make an Alpha Gradient Mask? -

i'm trying make : alpha gradient mask using javafx any idea on how this? i found way "alphacomposite" function. here code : private image mask; private image dest; private float alpha = 1f; private void loadimages() { mask = new imageicon("resources/source.png").getimage(); dest = new imageicon("resources/destination.png").getimage(); } private void dodrawing(graphics g) { graphics2d g2d = (graphics2d) g.create(); bufferedimage buffimg = new bufferedimage(500, 400, bufferedimage.type_int_argb); graphics2d gbi = buffimg.creategraphics(); alphacomposite ac = alphacomposite.getinstance( alphacomposite.src_in, alpha); gbi.drawimage(mask, 0, 0, null); gbi.setcomposite(ac); gbi.drawimage(dest, 0, 0, null); g2d.drawimage(buffimg, 20, 20, null); gbi.dispose(); g2d.dispose(); } here : original image & mask result i same thing in javafx because i...

Rails + Google Polymer -

Image
i getting error when try hit homepage. trying integrate polymer rails app. suggestions? gem 'polymer-rails', '~> 0.1.9' gem 'polymer-core-rails' gem 'polymer-paper-rails actionview::template::error (couldn't find file 'webcomponentsjs/webcomponents-lite' type 'application/javascript'): 3: <head> 4: <title>polymer rails example</title> 5: <%= stylesheet_link_tag 'application', media: 'all' %> 6: <%= javascript_include_tag 'application' %> 7: <%= html_import_tag 'application'%> 8: <%= csrf_meta_tags %> 9: </head> app/assets/javascripts/application.js:13 app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb___3181512530753562001_70181169375440'

dns - Magento store blank screen after domain change -

after attempting change domain magento store (ver 1.4.1.1), presented blank screen on frontend. site has not been moved, domain change. on backend (admin panel), allow me login, however, once in panel, upper header menu options , footer. however, after clicking through admin options loads. content area absolutely blank. there has been no error reports far, , after going through several forums these have been unsuccessful attempts @ solving issue: 1. ...checked local.xml file db connection. 2. ...in db, under core_config_data have pointed new domain secure , unsecure 3. ...increased memory size in htaccess 4. ...i've enabled php error logging in .htaccess so: php_flag log_errors on php_value error_log /home/path/public_html/domain/php_errors.log and error output 500 internal server error 5. ..in index.php have changed line $mageruncode = isset($_server['mage_run_code']) ? $_server['mage_run_code'] : ''; to 1 $magerunc...

Remove Google Drive Web Auth token javascript -

i have set web authentication google drive api. used tutorial here , , can upload , download files. cannot, though, find reference in api how revoke authentication (i want give users option). found on : gapi.auth.signout() not remove auth, nor give error in console. there not gapi.auth method remove token? to revoke token, can make rest call : https://accounts.google.com/o/oauth2/revoke and includes token parameter: curl https://accounts.google.com/o/oauth2/revoke?token= {token} google reference

wordpress - Google Analytics -> Ecommerce -> UTM Tags not showing up -

i'm having google analytics. utm tags not being tracked. , fyi, transaction , product name showing up, it's utm parameters not. this done within functions.php of wordpress site. upon submission of gravity form, grabbing info entered , placing them in $ga_body array. submitting https://www.google-analytics.com/collect wp_remote_post function. here's code: fyi i'm using stripe ( https://stripe.com/ ) process donations, $stripe_id transaction id. $ga_body = array(); //clear out ga_body $ga_body['v'] = 1; // version. $ga_body['tid']= 'ua-xxxxxxxx-2'; // tracking id / property id. $ga_body['cid']= $stripe_id; // anonymous client id. $ga_body['cn'] = 'this utm source'; $ga_body['cs'] = 'this utm campaign'; $ga_body['cm'] = 'this utm source'; $ga_body['dl'] = 'www.example.com'; $ga_body['t'] = 'item'; // transaction hit type. $ga...

r - Query from dataset -

i have 2 data sets following. dat1 <- read.table(header=true, text=" id log dist ab7 1.1 2 ab8 1.6 1.5 ab21 3 1 ab3 2.05 1.09 ab300 1.5 0.45 ab4 1.78 1.11 ab10 1.9 2 ab501 1.5 0.2 ") dat1 id log dist 1 ab7 1.10 2.00 2 ab8 1.60 1.50 3 ab21 3.00 1.00 4 ab3 2.05 1.09 5 ab300 1.50 0.45 6 ab4 1.78 1.11 7 ab10 1.90 2.00 8 ab501 1.50 0.20 dat2 <- read.table(header=true, text=" id lfrom lto it1 it2 it3 it4 ab7 1 1.05 47 152 259 140 ab7 1.05 1.96 29 45 39 30 ab7 1.96 2.35 59 65 47 40 ab7 2.35 4.45 27 36 31 37 ab7 4.45 5 58 60 60 56 ab8 1.1 2.1 88 236 251 145 ab8 2.1 3.1 51 66 47 43 ab8 3.1 3.5 31 6...