Posts

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 ...