Posts

Showing posts from February, 2012

c++ - Clang line directive -

i'm writing syntax translator outputs c++ code , have run interesting issue. have 2 files: ln.x , ln.cpp . in ln.x : abc in ln.cpp : #line 1 "ln.x" ( when try compile using gcc, prints corresponding line in ln.x : ln.x:1:1: error: expected unqualified-id @ end of input abc ^ ln.x:1:1: error: expected ‘)’ @ end of inpu however, clang prints line of same file: ln.x:1:2: error: expected unqualified-id ( ^ ln.x:1:2: error: expected ')' ln.x:1:1: note: match '(' ( ^ 2 errors generated. is there way clang print line of file gcc? this looks more bug feature. why want it? printing file nominated #line works long line matches text getting parsed, character-for-character. , if file exists in first place. i don’t see in gcc preprocessor manual (gcc 4.9 edition). however, there note once upon time (up 2001), gcc assume named file existed locally, or @ least parent directory existed. holdover bug. and, no, there's no way clan

if statement - Python: How to keep running program until some value becomes 0 and checking how long it takes -

i have following code: time_counter = 0 in range(time_counter): if pred > 0: prey, pred = prey*(1+a-b*pred), pred*1-c+d*prey) else: print time_counter time_counter +=1 the values a, b, c, , d fixed 0.1, 0.01, 0.01, 0.00009. pred 20 , prey 1000. i'm trying figure out how long takes pred become 0 (as integer, not float) , display time. logically, can think of starting time @ 0 , running formula...if pred greater 0 repeat , until pred 0 or less 0 stop , display time. not sure doing wrong. please try keep basic. i'd able using loop conditional statements , using python 2.7 syntax. edit: sorry if confusing. want count time periods (which in case number of iterations) loop runs until pred equal 0. however, pred should considered 0 once < 1 0.999 0. here's sloppy answer mobile: import time time.time() while (pred > 0): # smooth jazz time.time() apologies if kind of answer bit lacking don't have ide available

.htaccess manual redirects followed by a general everything else redirect to another domain -

i trying lot of manual redirects followed rule redirect else isn't covered manual redirect. i have written lot of rules following structure shown below: redirect 301 /articles/1/1/1.htm http://newdomain.com/relevant-page/relevant-inner-page/ i need finish off general redirect redirect other pages not covered root of new domain. any or suggestions appreciated! i found easiest way php redirect in header of website. works me no problems!

c# - Strange behavior in circular textbox wpf project -

Image
i have page in wpf project in visual studio 2013 but when execute it, show this: if maximize it, show this: this xaml page code: <page x:class="controldomotico.client.menuprincipal" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:ignorable="d" title="menuprincipal" d:designheight="633.654" d:designwidth="877.835"> <grid> <grid.background> <imagebrush imagesource="d:\documents\visual studio 2013\projects\controldomotico\controldomotico.client\images\menu.jpg"> <imagebrush.transform> <transformgroup> <scaletransform scaley="1.05"/>

documentation - apidoc swagger error when trying to run -

hi i'm having issue using apidoc-swagger, , know pretty new, wondering if has used has gotten error: env: node\r: no such file or directory error when try run in folder in created documentation. if knows how solve issue appreciate help.

Mysql INSERT with multidimensional php array -

i'm trying write insert sql request populate table of db multidimensional array. the array use session variables (it's shopping cart) $_session['panier'], , has following content : array (size=3) 'artcod' => array (size=2) 0 => string 'na1818blcfez' (length=12) 1 => string 'ser5151blcfez' (length=13) 'collib' => array (size=2) 0 => string 'blanc' (length=5) 1 => string 'blanc' (length=5) 'quantite' => array (size=2) 0 => int 6 1 => int '8' my table has more field : 'id' field, wich need auto increment. the 'reference' field, wich contains reference of order, generate randmly. the 'artcod' field, it's code associated article, here it's in $_session['panier']['artcod']. the 'clicod' field, it's code associated client wich ordering, here it's in $_s

javascript - Sending and deleting records to database with a drag and drop table -

i have 3 db tables. -paid -partially paid -owes when registers account send user_id, name, etc 'owes' db table , output name drag , drop table have in 'owes' column. of if move anyone's name other category (paid/partially paid) not sure how delete record owes db , insert name new db table changes permanent. what's throwing me off how drag , drop table. i'm not sure how apply logic when dropped column past record deleted , new 1 added specific table or how make changes without submit button or page reload. what way can , how structure it? php <?php //payment section $con = mysqli_connect("localhost", "root", "", "db"); $paid_run = mysqli_query($con,"select * paid order id desc"); $partially_paid_run = mysqli_query($con,"select * partial_payment order id desc"); $owes_run = mysqli_query($con,"select * owes order id desc"); $paid_numrows = mysqli_nu

mysql - SQL Query performance -

i have table set in database results of games: table players id ... name 1 .... alice 2 .... bob 3 .... charlie ... etc table games player1 player2 myscore oppscore result 1 ... 3 .... 25 ... 18 .... w 3 ... 2 .... 15 ... 20 .... l 2 ... 1 .... 17 ... 17 .... t myscore refers player1, oppscore refers player2 i want query returns player's frequent opponents, along win-loss record between them. (i win-loss record second query on each opponent.) so use this: select count( * ) p2.name "opponent", games, players p1, players p2 p1.name = ? , games.gametype = ? , games.player1 = p1.id , games.player2 = p2.id group player2, gametype order count( * ) desc in order pick games (regardless of player1 , player2) store every game twice: i.e. have: player1 player2 myscore oppscore result 1 ... 3 .... 25 ... 18 .... w 3 ... 1 .... 18 ... 25 .... l 3 ... 2 .... 15 ... 20 .... l 2 ... 3 .... 20 ... 15 .... w 2 ... 1 .... 17 ... 17 .

regex - Capture numbers and strings from comma separatated value file -

i have file contains strings begins , end double quotes. each string can contain comma. numbers not begin or end double quotes. each integer , string separated comma. possible have null value. i make groups witch each string , number. trying capture each group 1 @ time. i have created regex, works every case unless there comma in string: /(?:"?([^"]*)"?,){2}/u if remove ungreedy operator, regex works every case except null values. here example of log file: 196778,"df,fdfsdf","4.4","ds-sdads231-33","mmh",1,,,,,,,023,1,"20150,62519535ty" https://regex101.com/r/ko5wm4/3 you can use regex: (?:(?:"([^"]*)"|([^,]*))(?:,|$)){2} regex demo

java - This method must return a result of type int? Farkle Game -

this have far. reason, program won't let me return scoreone. method trying find repeated number , use points. import java.util.scanner; public class farkle { // may not declare static fields in farkle // values must passed , methods (as described method // headers) /** * <p>users set number of players (2-6) , score needed win * game of farkle. * * <p>players take turns rolling dice , try accumulate required * number of points. game ends when first player accumulate * enough points declared winner. * * <p>program execution starts here. * * @param args unused */ public static void main(string[] args) { // todo scanner in = new scanner(system.in); /* * should put welcome message , main * program loop. make sure match output what's described * in project specification. */ system.out.println("welcome far

apache - Redirecting non-www to www in htaccess -

this have written in .htaccess file. rewriteengine on rewritecond %{http_host} ^www\.spreadcreativity\.org$ rewriterule ^/?$ "https\:\/\/spreadcreativity\.org\/" [r=301,l] in browser displaying https://spreadcreativity.org but want show https://www.spreadcreativity.org please me rectify . thanks. try after clearing cache of web browser : rewriteengine on rewritecond %{http_host} !^www\. [nc] rewriterule ^/?$ https://www.spreadcreativity.org/ [r=301,l]

sockets - Python 3 SOCKSIPY Module prints error -

i downloaded socks.py file , placed in python lib folder. when run script: import socks import socket socks.setdefaultproxy(socks.proxy_type_socks5, "localhost", 9150) socket.socket = socks.socksocket import requests bs4 import beautifulsoup url = 'http://www.google.ca' r = requests.get(url) soup = beautifulsoup(r.content) print (soup) it sends error this: traceback (most recent call last): file "/users/raphael/desktop/whatsmyip.py", line 8, in <module> r = requests.get(url) file "/library/frameworks/python.framework/versions/3.4/lib/python3.4/site-packages/requests/api.py", line 68, in return request('get', url, **kwargs) file "/library/frameworks/python.framework/versions/3.4/lib/python3.4/site-packages/requests/api.py", line 50, in request response = session.request(method=method, url=url, **kwargs) file "/library/frameworks/python.framework/vers

jquery - how to get tablesorter to work if loading with getscript. -

i loading tablesorter using jquery .getscript. woi_.loadeddatatables = false; $.getscript("//cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.22.1/js/jquery.tablesorter.min.js").done(function(script, textstatus ){ console.log("text status " + textstatus); woi_.loadeddatatables = true; }).fail(function(jqxhr, settings, exception){ console.log(jqxhr); }); later on have code checks if woi_.loadeddatatables true , calls sorttable if is. woi_.functions.sorttable = function(el){ console.log(el); el.tablesorter(); } if(woi_.loadeddatatables){ woi_.functions.sorttable($("#userwidgetstats")); } my text status success, script has loaded, if check in resources panel can see has loaded. console.log(el) gives me jquery element length of 1. the table has structure seems tablesorter looking - thead , tbody, thead tr , multiple th elements, tbody multiple tr. @ rate if there problem table structure expect raise

java - How to copy the entire values of array strings into a single string along with the empty spaces? -

i'm using eclipse, have argument on run configuration: hello hello hello apparently, it's on string[] args. there method can concatenate array values along empty spaces between them? i have tried splicing arrays char arrays, used tostring method(garbage value reason), , stringbuilder. gives values not spaces itself. @@ you can use string.join method: string[] arr = {"hello", "hello", "hello"}; system.out.println(string.join(" ", arr)); string#join available in java 8. using stringbuilder: stringbuilder sb = new stringbuilder(); string sep = ""; (string str : arr) { sb.append(sep); sb.append(str); sep = " "; } system.out.println(sb.tostring());

wsgi - django and uwsgi configuration issues -

i trying django project work uswgi , virtualenv i confused location of of parameters , output of daemon so far configuration **[uwsgi] socket=172.26.1.87:8000 chdir=/home/bischofs/1065/1065-calculation-tool/testsite/ module=testsite.wsgi:application master=true pidfile=/tmp/project-master.pid vacuum=true max-requests=5000 #daemonize=/var/log/uwsgi/testsite.log virtualenv=/home/bischofs/1065/python3.4/% ** my question when load python version: 2.7.8 (default, oct 20 2014, 15:08:52) [gcc 4.9.1] set pythonhome /home/bischofs/1065/python3.4/ *** python threads support disabled. can enable -- enable-threads *** python main interpreter initialized @ 0xfcd820 server socket listen backlog limited 100 connections mercy graceful operations on workers 60 seconds even though running python3.4 in virtualenv, why not picking on correct interpreter , libraries? i getting *** operational mode: single process *** importerror: no module named testsite.wsgi even though have corr

oop - Python suds attirbuteError: Fault instance has no attribute 'detail' -

howdie do, i've created package class sets default values such shipper, consignee, packages , commodities. the issue when go call method shippackage suds client, receive error: attributeerror: fault instance has no attribute 'detail' the first file listed below test file sets necessary dictionaries: import ship # create new package object package1 = ship.package('tx') # set consignee package1.setconsignee('dubs enterprise', 'jw', '2175 14th street', 'troy', 'ny', '12180', 'usa') # set default packaging package1.setdefaults('custom', '12/12/15', 'oktoleave') # add commodity description each package package1.addpackage('12.3 lbs', '124.00') package1.addcommodity('this package number 1', '23.5 lbs') # add commodity list defaults dictionary package1.setcommoditylist() # add package list packages dictionary package1.setpackagelist() package1

c# - Pattern not found with Omnisharp, VIM and csharp -

i'm been trying set omnisharp work csharp projects vim. here setup here setup lsb_release -a distributor id: ubuntu description: ubuntu 14.04.2 lts release: 14.04 codename: trusty i'm using crouton, on chromebook. use sudo enter-chroot , use vim way. my vim info vim - vi improved 7.4 (2013 aug 10, compiled jan 2 2014 19:39:32) included patches: 1-52 modified pkg-vim-maintainers@lists.alioth.debian.org compiled buildd@ huge version without gui. features included (+) or not (-): +acl +farsi +mouse_netterm +syntax +arabic +file_in_path +mouse_sgr +tag_binary +autocmd +find_in_path -mouse_sysmouse +tag_old_static -balloon_eval +float +mouse_urxvt -tag_any_white -browse +folding +mouse_xterm -tcl ++builtin_terms -footer +multi_byte +terminfo +byte_offset +fork() +multi_lang +termresponse +cindent +gettext -mzsch

memory - luajit copy table is slow -

within larger lua-script, have copy several tables dt: for i=1,dt:nrow() local r = {} j=1,dt:ncol() r[j] = dt[i][j] end rslt:append(r) end the tables 50,000 lines x 25 cols, containing doubles. luajit takes 10 times long "standard" lua. on other calculations/operations before, luajit faster (1.5 3 times). as silly may sound, try pre-allocating r table 25 values: local r = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} unfortunately lua api doesn't allow pre-allocation of tables, way avoid re-allocations caused array assignment in inner loop. tests show noticeable improvement, not close 10x (although don't use methods, results may vary).

c++ - D3D line draw split into trinangles -almost- works, but need a hint -

Image
i'm trying write general d3d11 line draw variable width. works when line 45 degrees. 'breaks up' shown in pic. ignore model , triangle.... first, calls attempt draw lines, pretty basic: g_uilineshader.setactive(); (float x = 0; x < 800; x = x + 10) { g_uilineshader.drawuiline(pd3ddevice, x, 0, 800-x, 600, 3, xmfloat4(1.0f, 1.0f, 0.0f, 1.0f)); } g_uilineshader.render(pd3ddevice); and ultimately, render code triangle list: hresult render(id3d11device * pd3ddevice) { auto devcon = dxutgetd3d11devicecontext(); // copy of vertices in array vertex buffer d3d11_mapped_subresource ms; devcon->map(_pvertexbuffer, null, d3d11_map_write_discard, null, &ms); // map buffer memcpy(ms.pdata, &_vertices[0], _vertices.size() * sizeof(uilinevertex)); // copy data devcon->unmap(_pvertexbuffer, null); // unmap buffer // set vertex buffer on device context uint stride = sizeof(

c++ - Overloading of << operator using iterator as a parameter -

i`d print enum values text , use overloading. suppose have following code: #include <iostream> #include <map> #include <string> #include <vector> #include <unordered_set> enum enm{ one, 2 }; class complex{ public: friend std::ostream& operator<<(std::ostream& out, std::unordered_multiset<int>::const_iterator i){ switch (*i){ case one:{ return out<<"one"; } case two:{ return out << "two"; } } } void func(std::unordered_multiset<int> _v); }; void complex:: func(std::unordered_multiset<int> _v){ _v.insert(one); _v.insert(two); (std::unordered_multiset<int>::const_iterator i(_v.begin()), end(_v.end()); != end; ++i){ std::cout <<"num: " << *i <<std::endl; //need here "one", "two" instead of 0, 1 } } int main(){ complex c; std::unorde

Calling php file from javascript using jQuery.get(), location of php? -

before closing duplicate, please know read many similar questions on , none of them answers doubt. i trying call .php file using jquery.get() $.ajax({ url: url, data: data, success: success, datatype: datatype }); i using wordpress , javascript code trying call php file included in page's header. i put php file in my-includes folder in root of server, can access using url:/my-includes/xxx.php . (thanks go osdm answer ) but publically accessible using domain-name/my-includes/xxx.php my question is- is how websites work. isn't security risk? can make file inaccessible general public yet keep working site? if make url this: url: '/folderintheroot/file.php' start root of website no matter url is. key here is: '/' @ beginning. regarding security issues. if people can visit website, means can see send server computer. when script called jquery.get() same. whatever public, public. else have start working login , password, whole other st

php - Magento search results in wrong order -

i'm working on magento 1.9.1.0 project , search results aren't being displayed in correct order. i've modified function fetch results in order of position (which works), appears looping through each category first, listing products category in order of position , name , moving on next category - example, if search "a": anti-slip bath mat, bath safety strips, square shower mat, walking frame, (here order breaks, because it's entered new category) alarm clock, amplified phone. i'd have liked have returned: alarm clock, amplified phone, bath safety strips, square shower mat, walking frame, anti-slip bath mat (anti-slip bath mat last, because position of else 0 product has position of 10). is there way can amend search display products without ordering them in category order? function i'd written achieve have far is: public function setlistorders() { $category = mage::getsingleton('catalog/layer') ->getcurrentcategory

java - Changing date format and storing it in a variable in mysql -

import java.sql.connection; import java.sql.date; import java.sql.drivermanager; import java.sql.preparedstatement; import java.sql.resultset; import java.sql.statement; import java.util.*; public class sql_type4 { public static void main(string args[]){ date fun; date fun2; try{ class.forname("com.mysql.jdbc.driver"); connection con=drivermanager.getconnection( "jdbc:mysql://localhost:3306/mca2b","root","siddheshkk"); statement stmt=con.createstatement(); resultset result=stmt.executequery("select id,name, date_format(from_unixtime(dateee),'%d/%m/%y') datee empwhere dateee >= curdate()"); while(result.next()) { fun=result.getdate("datee"); system.out.println(fun); } con.close(); } catch(exception e) { system.out.println(e); } } } here want change format of date , store result in

jquery - Play local video from code when dynamically change src Phonegap + javascript -

i'm have issue when im try play (.play()) javascript code video tag, i'm using phonegap , jquerymobile. this videoplayer page. <div data-role="page" id="page-reproduccion" data-theme="b"> <div data-role="content"> <video id="reproductor" autostart> </video> </div> </div> and method change src. var videoplayer = $('#reproductor'); videoplayer.bind('loadeddata', function(){ console.log('datos cargados'); }); videoplayer.bind('ended', function(){ console.log('fin del video!'); }); videoplayer.bind('canplay',function() { console.log("can play"); }); videoplayer.src = listavideos[indexvideo].ruta_local; videoplayer[0].autoplay = true; videoplayer[0].load(); videoplayer[0].play(); i need when change src, automatically autoplay video. i put code in ways: videoplayer.bind('loaded

xml - Windows 8 Javascript app activation/launch deferral -

so in windows 8 winjs app i'm coding, trying loading of xml file take place in app startup sequence, while splash screen still showing, xmldoc element needed when home page loads, , loading of home page fail without it. this initiation sequence in default.js: (function () { "use strict"; var activation = windows.applicationmodel.activation; var app = winjs.application; var nav = winjs.navigation; var sched = winjs.utilities.scheduler; var ui = winjs.ui; app.addeventlistener("activated", function (args) { if (args.detail.kind === activation.activationkind.launch) { if (args.detail.previousexecutionstate !== activation.applicationexecutionstate.terminated) { // todo: application has been newly launched. initialize // application here. console.log("newly launched!"); var localsettings = windows.storage.applicationd

ios - Does my Xcode project broken -

Image
my xcode ios project kind of broken think.when create new file in group,the file's location different other xcode ios project.for example,when create cocoa touch class called eeviewcontroller ,you can find location long in identity , type of file inspector . but when right click file , click show in finder ,drag file desktop , drag original group.the location's patch seems okay.(it can referenced in storyboard custom class) i think has xcode configuration,but can't figured out.hope can me. to understanding, ../../../benson/onehome/onehome/eeviewcontroller.swift relatively same eeviewcontroller.swift in case it's based on location related group. ../ means go 1 level in path, 3 level dive in 3 makes same path. i think issue here case of home dir. in second screenshot shows " b enson" , first shows " b enson". os x case sensitive file system, might problem xcode.

node.js - Mongodb find and then update -

i want run query gets documents has 'active' field true , run custom function on them checks if 'date' field inside document older 10 days. if both of them true make active field false. this how current code looks like: db.ad.find( { $and : [ // check if active true , $where clause equals true { 'active' : true }, { '$where' : function() { // custom compare function var date = new moment(this.date); // gets date current document var date2 = new moment(); return math.abs(date.diff(date2, 'days')) > 10; } } ]}, function(err, result) { // how update document here? } ); can tell me how update documents after find query? use update() method $set modifier operator update active field. update query object, can set date object ten days previous subtracting ten date: var d = new date(); d.setdate(d.getdate() - 10); var query = { /* query object find records need upda

calendar - Constantly check time in Java -

Image
so digging around in old java projects never finished , pulled out little number of best projects ever built. it's desktop clock widget coded in java , works fine except 1 thing. way have check current time stay updated in loop , loop "crashes" in matter of seconds widget no longer gets current time. this how loop constructed (reduced in size): public class getcurrenttime { public static void gettime() throws interruptedexception { int hour = global.calendar.get(calendar.hour); int minute = global.calendar2.get(calendar.minute); if(hour == 0) { global.hour.seticon(new imageicon("resources/hours/12.png")); }else if(hour == 23) { global.hour.seticon(new imageicon("resources/hours/11.png")); }else { global.hour.settext("?"); } if(minute == 0) { global.minute.seticon(new imageicon("resources/minutes/00.png"));

split document by using MarkLogic mlcp -

i need split document <?xml version="1.0"?> <!doctype docs system "../rom11.dtd"> <docs> <stwtext id="rd-10-00258" update="03.2011" seq="rq-10-00001"> <head> <ti> <i>j</i> </ti> <ff-list> <ff id="0103" /> </ff-list> </head> <p> symbol f&#x00fc;r die <vw idref="rd-19-04447">stromdichte</vw> . </p> </stwtext> <stwtext id="rd-10-00209" update="12.2007" seq="rq-10-00223"> <head> <ti>jz</ti> <ff-list> <ff id="0932" /> </ff-list> </head> <p> abk&#x00fc;rzung f&#x00fc;r jod-zahl, siehe <vw idref="rd-06-00645">fettkennzahlen</vw&g

c# - Incorrect syntax near '455555' - When i try to search on database -

i have search field on form , have 2 radionbuttons, 1 called rg , called nome , bascially these search criteria : name or rg. search name works normal search rg returning error. below code. if (rdbporrg.checked) // faz consulta com o rg { if (txtpesquisar.text == "") { messagebox.show("favor escolher um parâmetro de busca \r\n" + "e preencher o campo de pesquisa \r\n" + "para efetuar consulta.", "consultar item", messageboxbuttons.ok, messageboxicon.exclamation); } else { txtpesquisar.readonly = true; cmsql.remove(0, cmsql.length); cmsql.append("select * tb_cadastro "); cmsql.append("where rg = " + convert.toint64(txtpesquisar.text) + " ");

FFMPEG with javaCV can't open stream -

i having strange behavior when testing video stream of mobotix camera, i'm using javacv 0.11. when set timeout can't open stream, stream open if don't set timeout parameter. i verified behavior javacv 0.11 , java cv 0.11 in version 0.9 , 0.8 works timeout. probably error of lib javacv or way i'm using :p my question ffmpeg experts following: when i'm calling: avformat_open_input the function returns -138 i called function av_strerror fir error code , function returned "error number -138 occurred". a description not useful, can tell me error means? error -138 flags timeout. from errno.h : #define etimedout 138

gcc - I am using CLION w/ MinGW 3.2, is this ideal for C++11? -

i student more general question , not related hw i using clion mingw 3.2 , cmake 3.2.2 ideal c++11? or better phrased @ minimum compatible , not crash c++11 features? a lot of classmates having issues compiling or getting crashes, instructor suggested due many of them not using class recommended ide (visual studio) , default compiler may because compiler not c++11 compatible. we have not used many c++11 features-in fact 1 have used far auto . (i did searching before , found c++11 new feature, correct?). should worried compatibility issues given environment (mingw 3.2 - clion uses gcc 32 last checked) , cmake (ver 3.2.2)? also clion ide in general? have access vs2013 year though use webstorm , pycharm other classes , personal projects thought i'd stick in jetbrains family , use clion.

laravel 5 - No error show blank page -

after uploading laravel 5.0 on server, not show error. showing blank page. debug set true. please me. i have php5.4 version using hostgator hosting. do following sudo chmod 755 -r storage if 755 not work try 777 update already answered here sudo chmod -r ug+rw storage permissions 664 or 775

amazon web services - Integrating AWS EC2, RDS and... S3? -

i'm following tutorial , 100% works charm : http://docs.aws.amazon.com/gettingstarted/latest/wah-linux/awsgsg-wah-linux.pdf but, in tutorial, use amazon ec2 , rds only. wondering if servers scaled multiple ec2 instances need update php files. do have distribute manually across instances? because, far know, instances not synced each other. so, decided use s3 replacement of /var/www php files centralised in 1 place. so, whenever ec2 scaled up, files remains in 1 place , don't need upload multiple ec2. is best practice have centralised file server (s3) /var/www ? because still having permission issue when it's mounted using s3fs. thank you. you have put /var/www/ in s3 , when instances scaled have make 'aws s3 sync' bucket, can in userdata. have select 'master' instance make changes, sync script upload changes s3 , rsync copy changes alive fe. because if have 3 fe downloaded /var/www/ s3 , want make new change have make s3 sync in ins

c - Compile-time assertion fails without GCC optimization -

i have following compile-time assertion fails if compile without -o[1-3] flags. #ifndef __compiletime_error #define __compiletime_error(message) #endif #ifndef __compiletime_error_fallback #define __compiletime_error_fallback(condition) { } while (0) #endif #define __compiletime_assert(condition, msg, prefix, suffix) \ { \ int __cond = !(condition); \ extern void prefix ## suffix(void) __compiletime_error(msg); \ if (__cond) \ prefix ## suffix(); \ __compiletime_error_fallback(__cond); \ } while (0) #define _compiletime_assert(condition, msg, prefix, suffix) \ __compiletime_assert(condition, msg, prefix, suffix) #define compiletime_assert(condition, msg) \ _compiletime_assert(condition, msg, __compiletime_assert_, __line__) #endif this combine following macro located in (gcc-4 specific) file: #define __compiletime_error(m