Posts

Showing posts from February, 2014

java - JPanels appear to go off the frame? -

Image
i working on assignment "of sorts" not school assignment. having said that, ideas great. i using windowbuilder in eclipse , have created basic form. have used nested jpanel components on border layout create it. reason, panels appear though spilling on edges of jframe. have frame dimensions set (500, 400) , panels various sizes, none greater 400 wide. code: package swingassignment; import java.awt.dimension; import java.awt.eventqueue; import javax.swing.jframe; import com.jgoodies.forms.layout.formlayout; import com.jgoodies.forms.layout.columnspec; import com.jgoodies.forms.layout.rowspec; import java.awt.gridbaglayout; import javax.swing.boxlayout; import net.miginfocom.swing.miglayout; import java.awt.borderlayout; import javax.swing.jpanel; import java.awt.flowlayout; import javax.swing.borderfactory; import javax.swing.jcombobox; import javax.swing.jtextfield; import javax.swing.jtextarea; import java.awt.component; import java.awt.gridbagconst

SQLite alternative to deprecated PRAGMA empty_result_callbacks -

according documentation: when empty-result-callbacks set in situation, callback function invoked once, third parameter set 0 (null). enable programs use sqlite3_exec() api retrieve column-names when query returns no data. i in need of functionality in program, documentation further goes on pragma deprecated , should not used in new applications. doesn't alternative is. how supposed functionality if pragma deprecated? the easiest answer not use sqlite3_exec , convenience wrapper. use sqlite3_prepare_v2 , sqlite3_step , , sqlite3_column_* (including column_count , use, column_name) explicitly. (and sqlite3_finalize , of course). if you're not sure how this, implementation of sqlite3_exec easy find in source distribution, src/legacy.c

Java - SQL Exception column doesn't have default value -

Image
i've got prepared statement: (i not want insert data column_1) pstmt = artclslctcon.preparestatement("insert `temp_articles` (`title`, `author`, `author_id`, `type`, `wfurl`, `intro`, `intro_image`, `main_image`) values (?, ?, ?, ?, ?, ?, ?, ?)"); with error: java.sql.sqlexception: field 'content_1' doesn't have default value my database looks this: there lots of image , content columns (17 of each). is there anyway keep default value of image_n , content_n columns none ? phpmyadmin says: the columns don't have default value , don't support null values, impossible insert data in if don't provide value (as you're doing). define valid default value these columns or make support null values.

wcf net.tcp binding throwing error The URI prefix is not recognized, http binding works -

Image
i have simple wcf service hosted in iis 7 on local computer running windows7, nettcp binding trying access using winform, keep getting same error no matter try. can access service via http though. at point have spent whole day trying figure reason , have gone through of post on topic on stack overflow. @ point feel missing basic , feedback experts highly appreciated. even if guide me how debug or exact cause lot not seeing useful in event log or failed request tracing :( steps have taken set new website on localhost net.tcp enabled (without spaces) ! made sure 3 services net.tcp running disabled security in webconfig (none instead of windows) . my service details namespace wcfservice1 { public class service1 : iservice1 { public string echo(string msg) { return datetime.now.tostring(); } } } web config <?xml version="1.0"?> <configuration> <appsettings> <add key="aspnet:use

sql server - Mysql query issue, case when column is not null insert row -

this query : select vehicle, case when vehicle not null (insert tbl_vehicle_on_user (vehicle, userid) values (select `vehicle` `tbl_missions` `id` = 4 ), (select `id` `tbl_users` `id` = 12)) tbl_missions id = 4; i need insert row tbl_vehicle_on_user when vehicle not null on id 4. when execute query receive error mysql workbench, 01:24:49 select vehicle, case when vehicle not null (insert tbl_vehicle_on_user (vehicle, userid) values (select vehicle tbl_missions id = 4 ), (select id tbl_users id = 12)) tbl_missions id = 4 error code: 1064. have error in sql syntax; check manual corresponds mysql server version right syntax use near 'into tbl_vehicle_on_user (vehicle, userid) values (select vehicle `tbl_mi' @ line 4 0.000 sec and red line under 'into' when hover on it, says 'syntax error, unexpected into, expecting ('. i don't know means tried search web couldn't find if know how fix appreciate if answer question :) th

javascript - streamline jquery autosave text -

$("textarea").bind("keyup", function () { var keyname = $(this).attr("data-rkn-keyname"); autosave(keyname, this.value); }); function autosave(key, value) { $.ajax({ url: "/admin/savelookup", type: "post", data: ("keyname=" + key + "&value=" + value), success: function (data) { if (data) { $('#saved-signal').show().fadeout(1500); } } }); } i have few textareas on page , i'd them autosave user input. data being edited set of key/value pairs, textarea being value , textarea's 'data-rkn-keyname' attribute being key. so above code kinda works if user types fast won't catch last character or two. altered so: $("textarea").bind("keydown", function () { var keyname = $(this).attr("data-rk

winapi - Free a Windows heap without releasing memory pages -

i'm implementing heap pool utility , need pool_clear() function (like apache portable runtime apr_pool_clear() ). functions allow free @ once (single function call) memory allocated on pool without releasing memory pages underlying system. windows api provides heapfree() (multiple function calls) , heapdestroy() (releases memory pages). are there way on windows (using native api)? heapcreate , other heap* functions kernel32 don't provide kind of power. meant provide same functionality c standard library, plus debugging/diagnostic features. it sounds rtlcreateheap ntdll fit bill, allocating memory , specifying heapbase , initialcommit , initialreserve , , commitroutine . this means can call rtldestroyheap without giving of virtual memory, then, call rtlcreateheap again same heapbase , effectively, creating new heap in same virtual memory unfortunately, knowledge, these entry points in ntdll undocumented , as of native api , there risk associated ca

jquery - Combine onLoad and Change functions? -

is there way simplify , combine these 2 functions? i'm doing large number of elements , it's becoming far cumbersome. i've uploaded working example of code here: http://jsfiddle.net/jfjsa/5/ $(document).ready(function () { var goalval = $("[name=objective]").val(); $("#goal_minimize, #goal_maximize, #altscenario").hide(); if (goalval === "minimize") { $("#goal_minimize").show(); } else if (goalval == "maximize") { $("#goal_maximize").show() } else if (goalval == "altscenario") { $("#altscenario").show() }; }); $("[name=objective]").change(function () { var goalval = $("[name=objective]").val(); $("#goal_minimize, #goal_maximize, #altscenario").hide(); if (goalval == "minimize") { $("#goal_minimize").show(); } else if (goalval == "maximize") { $("

spring - Trouble filtering in Camel -

i attempting filter out null bodies route. route polls function every half second or so. so, error in console every half-second. here stack trace: message history --------------------------------------------------------------------------------------------------------------------------------------- routeid processorid processor elapsed (ms) [route1 ] [route1 ] [browserbean ] [ 0] [route1 ] [filter1 ] [filter[simple{(${body} == null)}] ] [ 0] exchange --------------------------------------------------------------------------------------- ------------------------------------------------ exchange[ id id-co183ltcs06-54352-1403798372606-0-1058 exchangepattern inonly headers {breadcrum

javascript - Angular two way binding does not appear to work while the documentation says that it should -

i trying use value of $scope.commenttext when call addcomment() scoped variable empty eventhough bound. workaround pass commentext parameter value works still should work. question how clear out commenttext bound text input ... not work expected either. looked around... , missing cause doing docs tell me how to. so... anyone? $scope.user = "wm"; $scope.commenttext=''; $scope.addcomment = function(plan, commenttext) { console.log(commenttext) plan.comments.push({text:commenttext, user:$scope.user); commenttext=null; $scope.commenttext=null; }; and view: <form ng-submit="addcomment(plan, commenttext)"> <div class="input-group"> <input class="form-control" type="text" ng-model="commenttext" size="30" placeholder="add new comment here"> <span class="input-group-btn"> <input clas

Ember.js: Uncaught TypeError: Cannot read property 'enter' of undefined on transitionTo -

i have simple ember.js app. inside view call this.transitionto gives me error: uncaught typeerror: cannot read property 'enter' of undefined the error in ember.js @ line 24596, currentstate undefined here relevant parts of app: window.plan = ember.application.create({}); plan.router = ember.router.extend({ location: 'hash' }); plan.indexcontroller = ember.objectcontroller.extend({ }); plan.router.map(function() { this.route('application', { path: '/' }) this.route('index', { path: "/:current_savings/:monthly_deposit/:time_horizon" }); }); plan.applicationroute = ember.route.extend({ redirect: function(){ this.transitionto('index', 200, 200, 200); } }) plan.indexroute = ember.route.extend({ model: function(params) { var result = this.store.find('calculation', params).then(function(data) {

merge - sbt: how to write a MergeStrategy to choose a specific library version -

here attempt exclude javax.servlet classes: librarydependencies ++= seq( .. ("org.apache.spark" % "spark-core_2.10" % sparkversion \ % "compile->default" withsources()).exclude("org.mortbay.jetty", "servlet-api"), here attempt @ mergestrategy: mergestrategy in assembly <<= (mergestrategy in assembly) { (old) => { .. case pathlist("javax", "servlet", xs @ _*) => mergestrategy.singleorerror .. following shows multiple copies of javax.servlet classes being loaded: [error] (*:assembly) singleorerror: found multiple files same target path: [error] c:\users\s80035683.ivy2\cache\org.mortbay.jetty\servlet-api-2.5\jars\servlet-api-2.5-6.1.14.jar:javax/servlet/filter.class [error] c:\users\s80035683.ivy2\cache\javax.servlet\servlet-api\jars\servlet-api-2.5.jar:javax/servlet/filter.class [error] c:\users\s80035683.ivy2\cache\org.eclipse.jetty.orbit\javax.servlet

asp.net mvc - Is there a way around restarting my MVC dev server every time I add an asset? -

in order add asset asp.net mvc project in visual studio, have stop debug server, add file, , restart server. however, once visual studio aware of file (an image, say), can change content using external app , debug server serve changes fine. same thing applies renaming files (i.e., can't while server running). when working on large content-driven site, gets rather tedious , unproductive. i presume has way files packaged assembly in mvc deployment (by contrast rails or local static site generators, files served off of file system), it's understandable. i'm wondering if there way around limitation make local site development less cumbersome. you can start without debugging using ctrl + f5 this run code without debugger attached, how code run in production. have performance benefits. if never need debugger can put project in release mode (instead of debug mode) better performance.

vb.net - Adding 150,000 records to a listview without freezing UI -

Image
i have listview loop adding 150,000 items listview. testing purposes moved code background worker delegates, still freezes ui. trying find solution can add these items in background while other stuff in app. solutions guys recommend? this using public class form1 private sub button1_click(sender object, e eventargs) handles button1.click listview1.clear() listview1.beginupdate() bw.workerreportsprogress = true bw.runworkerasync() end sub private sub button2_click(sender object, e eventargs) handles button2.click if bw.isbusy bw.cancelasync() end sub private sub bw_dowork(byval sender object, byval e system.componentmodel.doworkeventargs) handles bw.dowork x = 1 125000 dim lvi new listviewitem("item " & x) if bw.cancellationpending e.cancel = true exit else bw.reportprogress(0, lvi) end if

php - Get ALL results from database with username -

how can keep checking posts php? have piece of code goes through , gets posts. when echo $row['post_message']; of messages. when set variable $post = $row['post_message']; , , <h2><?php echo $post;?></h2> 1 result. here's code $stmt = $con->prepare("select post_message posts post_user = :username"); $stmt->bindvalue(':username', $username, pdo::param_str); $row = $stmt->fetchall(); $stmt->execute(); while($row = $stmt->fetch(pdo::fetch_assoc)){ $post = $row['post_message']; } so when echo i pie pie 2alex likes food , , when store in variable alex likes food . ideas? your issue lies in while loop. keep overwriting $post variable. should be: $posts = array(); while($row = $stmt->fetch(pdo::fetch_assoc)){ $posts[] = $row['post_message']; } which should return: array ( [0] => pie pie 2, [1] => alex likes food ) this allows (

ios - Cocos2d v3: What do you pass into drawPolyWithVerts? -

i've looked @ documentation ccdrawnode, , method draw polygon is - (void)drawpolywithverts:(const cgpoint *)verts count:(nsuinteger)count fillcolor:(cccolor *)fill borderwidth:(cgfloat)width bordercolor:(cccolor *)line http://www.cocos2d-swift.org/docs/api/classes/ccdrawnode.html#//api/name/drawpolywithverts:count:fillcolor:borderwidth:bordercolor : i'm confused (const cgpoint *)certs parameter. thought cgpoint struct, , didn't need pointer. also, i'm assuming you'll need series of points construct polygon, , thought cgpoint represented 1 point. i've checked through cocos 2d programming guide , couldn't see method in there. https://www.makegameswith.us/docs/#!/cocos2d/1.1/overview i've check out cggeometry reference on apple's site, couldn't see there. https://developer.apple.com/library/mac/documentation/graphicsimaging/reference/cggeometry/reference/referen

iOS Swift - UITableViewCell Custom Subclass not displaying content -

Image
i have uitableview i've created in uistoryboard has 2 dynamic prototype uitableviewcells: the screenshot show have first uitableviewcell's style set subtitle, , second set custom label "tap add" in center. first has identifier of "cell" , second "addcell". i've set uitableviewcontroller (i've tried uitableview in uiviewcontroller), uitableviewcell subclass in swift , i've connected of outlets. however, when run simulator cell loaded , tappable, have not been able display content. (i've tried adding other controls, nothing appear when cell loaded. thing can change contentview's backgroundcolor.) i have following swift code uitableviewcontroller: import uikit class listtableviewcontroller: uitableviewcontroller { var listobjects: listobject[] = datamanager.instance.alllistobjects() listobject[] init(style: uitableviewstyle) { super.init(style: style) // custom initialization } in

java - Setting up a toString() method for an array list -

sorry probley simple question how go setting tostring() method array list? is simple points = new arraylist<point>(); public string tostring() { return points.tostring();} which not seem working me, or more complex since array list? because reason when execute mine printing first value or object. p.s i'm trying return values have added list. more in detail constructer public cloud() { points = new arraylist<point>(); } add point public void addpoint(point p) { // done if (points.contains(p)) { // if p in list nothing } else { points.add(p); // if p not in list adds end } } tostring public string tostring() { return points.tostring(); } main public static void main(string[] args) { cloud cloud = new cloud(); cloud.setdebug(false); system.out.println("cloud.debug off"); system.out.println("initial cloud: " + cloud.tostring()); point p1 = new point(3.0, 1.0); cloud

linux - How to prevent the accidental deletion of a file but give write permission -

i have status file called dbstatus.log in linux , want prevent accidental deletion. tried chattr -a filename , when try write file using script, it's giving error e212: can't open file writing. can please suggest me how prevent deletion of file give write permission. current permissions -rw-rw-r-- .

java - Is there any way to load a component from filesystem in Oracle Commerce(ATG)? -

i'm trying find out if can load oracle commerce component file system. assemble code ear file , deploy it, however, got requirement in have store components in file system rather packaging them along ear file. i know can use urlclassloader load class shown below, file classdir = new file("a:\\lodeemodule\\classes"); url[] url = { classdir.touri().tourl() }; classloader loader = new urlclassloader(url); (file file : classdir.listfiles()) { string filename = file.getname().replace(".class", ""); loader.loadclass("com.buddha.testers." + filename).getconstructor().newinstance(); } but how can use same component has resolved nucleus @ later point of time? there way instruct nucleus resolve component file system? you should able add jar contains components classes classpath system variable used application server instance. then in component configuration define implementing class would $class=some.class.path.class if

zend regex route with negative lookahead -

i'm trying write regex route in zend (1.11) matches urls ending in /foo not if start /bar e.g. /foo - match /any/words/foo - match /any/words - no match (doesn't end in /foo) /any/words/barfoo - no match (doesn't end in /foo) /bar/foo - no match (starts /bar) /bar/any/words/foo - no match (starts /bar) my regext route looks this: '^foo$|^(?!/bar/).+/foo$' but find matches ending in /foo, if starts /bar. you need negative lookahead lucky you, have 1 in pocket. try this: ^(?!/bar).*/foo$ see matches in demo . the ^ anchor asserts @ beginning of string the negative lookahead (?!/bar) asserts follows not /bar .* matches characters (dot character except newlines, star repeats 0 or more times) /foo matches /foo the $ anchor asserts @ end of string reference lookahead , lookbehind zero-length assertions mastering lookahead , lookbehind

excel - Assigning two column association to third column -

i have following structure in excel 2010 col1 col2 col3 12 c.e c.e 13 d.c.e c.e 14 p.e p.e 100 a.o.h a.o.h c.e p.e ... ... output: col3 12 12 14 100 12 14 ... ... that col1 , col2 logically linked means c.e has value 12 , d.c.e has value 13.what want assign association col3 ever there c.e no matter how many times replaced 12 , ever there p.e replaced 14. having hard times doing please guide me how it? if swap first 2 columns, can use vlookup function value associated particular text, so: col1 col2 col3 col4 c.e. 12 c.e d.c.e 13 c.e p.e 14 p.e a.o.h 100 a.o.h col4 cell value = vlookup(col4cell, $col1$firstrow : $col2$lastrowwithdata, 2, 0) note cannot directly replace values in col3 because lead circular references - check value in cell , replace in same cell!

Write a batch file in Windows to rename folders yearwise -

i have 123 folders. want rename them 1895 2013. tried: for /d in (j:\cinema\years\*) rename "%%k" "%%~nx(d+1894)" but think d not integer varaible. i've done stupid. you'd have create variable , increment it. this code tested locally: setlocal enableextensions enabledelayedexpansion set count=1985 /d %%k in (j:\cinema\years\*) ( rename "%%k" "!count!" set /a "count+=1" )

c# - Force developer to use string from special class -

i have objectresult return error message if error occurs. i’d developer not able type own message this; should have use 1 of set of predetermined message string in special class (just manage message). for example, don’t want possible: objectresult obj = new objectresult() {message = "xxx"}; a developer should have write: objectresult obj = new objectresult() {message = messagesstore.somemessage}; how can implement this? declare enum , decorate entries description attributes public enum messagesstore { [description("everything ok")] ok, [description("everything not ok")] notok } use following extension method public static class enumextensions { public static string getenumdescription(this enum value) { var fi = value.gettype().getfield(value.tostring()); var attributes = (descriptionattribute[])fi.getcustomattributes( typeof(descriptionattribute), f

json - Accessing POST data from controller in CakePHP -

if json data being post-ed , sent controller. { "email" : "xyz@something.com" , "password" : "mypassword" } and want access email , password , assign them separate variables in controller function login () how go it? should ? public function login( ) { $temp=$this->request->email ; $foo=$this->request->password; } please let me know how can . thanks you need json object , decode it. if json object called $jsonobject , decoding $data = json_decode($jsonobject, true); $temp= $data['email']; $foo= data['password'];

why does bower hang when installing? -

$ bower install angular-animate --save bower cached git://github.com/angular/bower-angular-animate.git#1.2.18 bower validate 1.2.18 against git://github.com/angular/bower-angular-animate.git#* bower cached git://github.com/angular/bower-angular.git#1.2.18 bower validate 1.2.18 against git://github.com/angular/bower-angular.git#1.2.18 bower cached git://github.com/angular/bower-angular.git#1.2.18 bower validate 1.2.18 against git://github.com/angular/bower-angular.git#>=1.2.* bower cached git://github.com/angular/bower-angular.git#1.2.18 bower validate 1.2.18 against git://github.com/angular/bower-angular.git#^1.0.8 bower cached git://github.com/angular/bower-angular.git#1.2.18 bower validate 1.2.18 against git://github.com/angular/bower-angular.git#>=1.0.0 <1.4.0 i removed bower_components , reinstalled , worked fine. thing fixed problem of resolving dependencies run bower cache clean

node.js - MongoDB and Redis as cache layer architecture -

suppose have social network app (using nodejs, express) , mongodb primary database engine. in of api calls clients (mobile app, web app, etc.) don't want make complex query each request. these sort of requests can replied cache layer, redis instance. but question how/when should update cache layer, because write operations performed in mongodb database, not cache layer (redis). correct approach/architecture address problem? it depends on needs, here's common one: on_get_request if data_in_redis serve_data_from _redis else get_data_from_mongo set_data_in_redis set_expire_in_redis serve_data_from_memory the data bit stale @ times, that's ok use cases. works in combination cache invalidation when important data written: on_important_data delete_invalid_redis_keys but assumes low write, high read, , stable set of queries. what high load use case like?

Fragment Replace null pointer exception -

i trying replace fragment inside onitemclick of list view , want send selected item name list fragment fragment showing null pointer exception @override public void onitemclick(adapterview arg0, view view, int position, long id) { try { log.e("----- inside onitemclick -----", cityselected); mapvisiblefragment newfragment = new mapvisiblefragment(); bundle args = new bundle(); args.putstring("cityname", cityselected); newfragment.setarguments(args); ((basecontainerfragment) getparentfragment()).replacefragment( newfragment, true); } catch (exception e) { e.printstacktrace(); } } but same concept working inside button click below one try { listfragmentfromdbrecords2 newfragment = new listfragmentfromdbrecords2(); bundle args = new bundle(); args.putstringarraylist("names", alldata); newfragment.setarguments(args);

mysqli - Dynamic populating the drop down list based on the selected value of first list in php -

i have small php page contains 2 drop down lists i need populate second 1 according result selected in first drop down list. possible? in other words need use value selected first drop down list , use in db query used populate second drop down list (but should populated upon selection of first drop down list. if possible hints please? (you can assume able populate first drop down list db) connecting db <?php include ("db_connect.php"); ?> javascript: function abc() { var val = document.getelementbyid('customer_type').value; self.location='add.php?customer_type=' + val ; } php <div class="heading"> <h1>add products</h1> </div> <div class="content"> <form action="" method="post" enctype="multipart/form-data">

android - Unable to connect to server. XMPPException No response from server -

i using asmack library android chat on xmpp. below code have used connect server. app not able connect server. xmppexception no response server. can login desktop chat. not able problem is. here code have used. public class mainactivity extends activity implements messagelistener{ public static final string host = "mail.speedymx.com"; public static final int port = 5222; //public static final string service = "testservice"; public static final string username = "username@speedymx.com"; public static final string password = "password"; private connection connection; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); system.setproperty("java.net.preferipv6addresses", "false"); setcontentview(r.layout.activity_main); connect(); connection.disco

compilation error while android project executes -

here using android api(platform-19) , create project in android eclipse , install maven plugin version 3.0.5(embedded) , create pom.xml file in project , given android maven plugin version 3.8.2 gives error. of android maven plugin version need specify android api-19.` error :android-904-002: found aidl files: count = 0 [info] manifest merging disabled. using project manifest [info] d:\nagarjunawork\adt-bundle-windows-x86_64-20140321\sdk\build-tools\android-4.4.2\aapt.exe [package, -m, -j, d:\26-6-20140929\quickrideapp\quickride\target\generated-sources\r, -m, d:\26-6-20140929\quickrideapp\quickride\androidmanifest.xml, -s, d:\26-6-20140929\quickrideapp\quickride\res, --auto-add-overlay, -a, d:\26-6-20140929\quickrideapp\quickride\assets, -i, d:\nagarjunawork\adt-bundle-windows-x86_64-20140321\sdk\platforms\android-19\android.jar] [info] d:\26-6-20140929\quickrideapp\quickride\androidmanifest.xml:51: error: error: no resource found matches given name (at 'value' value &

layout - Laravel CSS not working when going to sub-links -

i beginner in laravel, , having trouble in laravel css layouts. i have multiple links in web, example: testing.com/main testing.com/aboutus testing.com/contactus which used layout stored in /layouts/main.blade.php in views folder. inside layout, wrote css link based on public folder. ex: <link href="stylesheet" href="/css/styles.css"> and works fine on links except ones sub-links, example: testing.com/main/clients testing.com/main/solutions the css seem have dissapear when navigate sub-links. not declaring css in laravel? css works when not sub-link. you should use laravel helpers add assets views generate correct urls. either use url::asset('css/styles.css') or asset('css/styles.css') if need link arbitrary asset. alternatively, can bit cleverer , laravel hard lifting: {{ html::style('css/site.css') }} {{ html::script('js/site.js') }} {{ html::image('images/logo.png') }} these write

python - Debian 7 + django + gunicorn + virtualenv : site-packages egg-link not in pythonpath -

context : debian 7 gunicorn (installed debian package in order use /etc/gunicorn.d configuration) project dependencies installed via pip in virtualenv dependencies installed using pip install -r requirements.txt in file have 3 packages comes github repository. eg. -e git+https://github.com/truc/bidule.git#egg=bidule-master here gunicorn.d configuration : config = { 'mode': 'django', 'environment': { 'pythonpath': '/path/to/my/django/project/:/path/to/virtualenv/lib/python2.7/site-packages/', 'production': '1', }, 'working_dir': '/path/to/my/django/project/', 'user': 'user', 'group': 'group', 'args': ( '--bind=127.0.0.1:8090', '--workers=3', # '--worker-class=egg:gunicorn#sync', #'--timeout=30', #'--preload', 'myproject.settings'

html - Customizing Bootstrap -

so working on site uses bootstrap. need customize many of default bootstrap , feel - color scheme , rounded boxes. know less used entering default values in variables , recompiling it. not know less not think hard learn. but ease of testing various color schemes doing adding custom class every element want test. e.g. want change , feel of jumbotron . doing <div class = "jumbotron test-jumbotron"> content here.. </div> test-jumbotron test class. in css do: .test-jumbotron { border: "<my-test-border-style>" !important; background: "<my-test-background-style>" !important; } my idea once have nailed styles , effects need, can use less (still don't know how, question day) integrate test-* styles bootstrap , delete test-* styles files. i think might come across opinionated question - approach work? not want best optimal world-class solution, want know if can work, or there chance hit road-block later down pa

mysql - Trigger update on another table after insert -

i want field current_price in table stock updated when insert new table stock_changes. so stock.current_price should updated stock_changes.current_price i have tried triggers wont work. create trigger update_stock after insert on stock_changes each row update stock set current_price =new.current_price id = new.stock_id; you need use delimiter . try : delimiter $$ create trigger update_stock after insert on stock_changes each row begin update stock set current_price =new.current_price id = new.stock_id; end; $$ delimiter ;

wordpress - get_attachment from functions.php -

i'm trying open image lightbox (colorbox) , when did, have button opens link it's attachment-page . i made attribute data-att="" link attachment-page should get. here have in functions.php right now: add_filter('the_content', 'add_colorbox'); function add_colorbox($content) { global $post; $att_url = wp_get_attachment_link($id); $pattern ="/<a(.*?)href=('|\")(.*?).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>/i"; $replacement = '<a$1href=$2$3.$4$5 class="fotos" data-att="'. $att_url .'" title="'.$post->post_title.'"$6>'; $content = preg_replace($pattern, $replacement, $content); return $content; } so $att_url = get_attachment_link($id); im trying attachment link , pass data-att="..." no luck yet...

asp.net - Run Sql Script File With Passing database name from C# -

i have sql script file contains database creation, related tables creation , other things. database name decided client side. there way can run script file database name passed code? i know way take special pattern in place of database name , in c# code replace client side added database name. there better way it? if creating tables on fly in application, missed fundamentals database design. in relational database, set of tables , columns supposed constant. may change installation of new versions, not during run-time. you can check here create proc createdb @dbname sysname declare @sql nvarchar(max) set @sql = 'create database ' + quotename(@dbname) exec (@sql) here can pass @dbname parameter