Posts

Showing posts from April, 2014

imagemagick - acrobat reduced size pdf with gs/im/other? -

in acrobat 11 pro, can file > save other > reduced size pdf (setting acrobat 10 viewer or later), cut pdf 40% , looks same. i wondering how can achieve same result open source tool ghost script, image magick, or adobe tools on linux server via cl or php. gswin64c -sdevice=pdfwrite -dcompatibilitylevel=1.4 -dpdfsettings=/screen -dnopause -dquiet -dbatch -soutputfile=output.pdf input.pdf this works pretty reduce pdf file size. when getting used ghostscript inside batch script wary of special characters. example "%" special character postscript when using variable in cmd have escape character % -> %% , %% -> %%%% can cause headache depending on trying do. paths pain, use cd , relative file paths. source

How can I get entitlements from my WSO2 Identity Server? -

i trying use entitlementservice operation getentitledattributes against policies in wso2 identity server. expecting if make call passing in subject_id,(role name,) should resources , actions applicable role, no matches @ all. in sample provided below, expecting resource "echoservice" , action "read". using wso2 4.1.0 default policy , attribute finders. can tell me need entitlements wso2 identity server? thank you, katrina this request: <?xml version='1.0' encoding='utf-8'?> <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:body> <getentitledattributes xmlns="http://org.apache.axis2/xsd" xmlns:ns2="http://dto.entitlement.identity.carbon.wso2.org/xsd"> <subjectname>manager</subjectname> <resourcename/> <subjectid/> <action/> &

c++ - Why linker doesn't find my template function declared in class? -

this question has answer here: why can templates implemented in header file? 13 answers well, title says everything. message when linking(compilation successful): f:/android/ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/ ../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.ex e: ./obj/local/armeabi/objs/hellondk/player/renderer.o: in function renderer::on surfacecreated():jni/player/renderer.cpp:63: error: undefined reference 'void gameobject::test<void>()' gameobject.h: class gameobject { public: ... template<typename t> t test(); } gameobject.cpp: template<typename t> t gameobject::test() { } renderer.cpp(using template): object = new gameobject(); ... object->test<void>(); // error here you must define template functions in header file, otherwise

javascript - WebRTC - scalable live stream broadcasting / multicasting -

[ ! ] question still open problem: webrtc gives peer-to-peer video/audio connections. perfect p2p calls, hangouts. broadcasting (one-to-many, example, 1-to-10000)? lets have broadcaster "b" , 2 attendees "a1", "a2". of course seems solvable: connect b a1 , b a2. b sends video/audio stream directly a1 , stream a2. b sends streams twice. now lets imagine there 10000 attendees: a1, a2, ..., a10000. means b must send 10000 streams. each stream ~40kb/s means b needs 400mb/s outgoing internet speed maintain broadcast. unacceptable. original question (obsolete) is possible somehow solve this, b sends 1 stream on server , attendees pull stream server? yes, means outgoing speed on server must high, can maintain it. or maybe means ruining webrtc idea? [ ! ] up-to-date question solve cpu/bandwidth - there server-less solution (aka multicasting or similar)? solve cpu - possible encode stream once , send peers? solve cpu/bandwidth - multicast

python - How can I get "is not" to be highlighted as a pythonOperator? -

Image
i'm trying modify python.vim syntax file "is not" highlighted single pythonoperator. for example, happen now: i've tried changing python.vim in several ways. example: --- python.vim.orig 2013-08-19 10:21:54.379892386 -0700 +++ python.vim 2013-08-19 10:21:58.979892308 -0700 @@ -152,6 +152,7 @@ syn keyword pythonprecondit import syn keyword pythonexception try except syn keyword pythonoperator , in not or +syn match pythonoperator "is not" if s:python2syntax() if !s:enabled("g:python_print_as_function") but nothing seems work. what's interesting if remove "is" , "not" , other python.vim syntax files, in: --- python.vim.orig 2013-08-19 10:21:54.379892386 -0700 +++ python.vim 2013-08-19

javascript - without jquery i need to find out if the mouse is over an element, not determine when it becomes over (in case it doesn't move to trigger onmouseover) -

without jquery basically looking ability see if mouse on div when countdown finishes if user on div perform action div onmouseover triggers when mouse crosses threshold of div, if mouse hasn't moved wouldn't trigger, wouldn't work i need determine if mouse on div @ specific point in time, if has moved or not starting point all of hunting has found onmousover , , nothing see if mouse happens there begin with i don't have javascript skills determine overall coords of div, map mouse coords , see if fits there... believe need do set flag true onmouseover , false onmouseleave. when countdown finishes if flag true on element. html <div id="div-name">the section of code working has countdown timer, when reaches 0 need know if mouse on specific box</div> <button id="notification" onclick="javascript: letscountit(5);">click start countdown</button> js window.ev = false; document.getelementby

iphone - How can I make my UINavigationBar not look all scrunched up? -

Image
following these instructions of making view controller 2 child controllers pans similar sidebar layout, makes navigation bar scrunched when sidebar opened. is there way me fix autolayout issue? edit - - (void)viewdidload { [super viewdidload]; self.leftcon.constant = -280; // additional setup after loading view. //[self slidetotheright]; } -(void)slidetotheright{ self.sidebaropened = yes; [uiview animatewithduration:0.5 animations:^{ self.leftcon.constant = 0; }]; } -(void) slideback{ self.sidebaropened = no; [uiview animatewithduration:0.5 animations:^{ self.leftcon.constant = -280; }]; } basically right bar button item , titleview somehow end squished against right side of screen when left constraint changed -280 0. i had remove constraint right child view trailing width.

sqlite - sqlite3 autoincrement - am I missing something? -

i want create unique order numbers each day. ideally, in postgresql instance, create sequence , read these unique numbers, because readback both gets me new number , atomic. @ close of day, i'd reset sequence. in sqlite3, however, see autoincrement integer field type. set table autoincrement field, , insert record new number (seems awfully inefficient way it, anyway...) when go read max back, task hasn't gone in there , inserted record, thereby causing me read miss, number 1 far advanced (and duplicate of other task reads back.) conceptually, require: fast lock wait other tasks increment number retrieve number unlock ...i don't see how sqlite3. can enlighten me? in sqlite, autoincrementing fields intended used actual primary keys records. should id orders table. if want have atomic counter independent of corresponding table records, use table single record. acid ensured transactions: begin; select number mytable; update mytable set number = ? +

Is there a way to limit SQL Server Developer Edition to features found in more restrictive versions? -

essentially, we're developing sql server web edition databases , sql server standard edition others. we'd prevent possibility of introducing feature such vardecimal in development if won't supported in staging (and consequently production) versions. ideally there option similar compatibility level. thanks! there no such feature microsoft, kimble group advise in the microsoft data warehouse toolkit push code through test or uat environments (hopefully through continuous integration) version/edition match production. of course relies on assumption deployment strategy anyway.

graphics - Transparency issue loading texture from PNG in Monogame -

Image
i'm trying accomplish figure should quite simple in monogame gl on windows.. load texture png file , render screen sprite. far i'm having lot of trouble this. i'm loading png texture2d following code (f#): use file = system.io.file.openread("testtexture.png") this.texture <- texture2d.fromstream(this.graphicsdevice, file) and rendering with: this.spritebatch.begin(spritesortmode.immediate, blendstate.nonpremultiplied); this.spritebatch.draw(this.texture, vector2.zero, color.white) this.spritebatch.end() the problem kind of weird effect alpha channels, if there's channels not being alpha pre-multiplied or something, can't place sure what's happening. what's notable though exact same code renders using official xna libraries. issue in monogame, tested version 3.0 , 3.2, both of have same issue. here's rendering test png in monogame illustrate problem: the background in each image cornflower blue, pure red,

android - getSupportActionBar from inside of Fragment ActionBarCompat -

i'm starting new project uses appcompat/actionbarcompat in v7 support library. i'm trying figure out how use getsupportactionbar within fragment. activity hosts fragment extends actionbaractivity , don't see similar support class fragments. from within fragment public class crimefragment extends fragment { //... getactivity().getsupportactionbar().setsubtitle(r.string.subtitle); // getsupportactionbar not defined in v4 version of fragment //... } the google page using ( http://android-developers.blogspot.in/2013/08/actionbarcompat-and-io-2013-app-source.html ) says there should no changes v4 fragment. need cast getactivity() calls actionbaractivity ? seems poor design. after fragment.onactivitycreated(...) you'll have valid activity accessible through getactivity(). you'll need cast actionbaractivity make call getsupportactionbar(). ((appcompatactivity)getactivity()).getsupportactionbar().setsubtitle(

javascript - Detect changes in the DOM -

i want execute function when div or input added html. possible? for example, text input added, function should called. 2015 update, new mutationobserver supported modern browsers: chrome 18+, firefox 14+, ie 11+, safari 6+ if need support older ones, may try fall other approaches ones mentioned in 5 (!) year old answer below. there dragons. enjoy :) someone else changing document? because if have full control on changes need create own domchanged api - function or custom event - , trigger/call everywhere modify things. the dom level-2 has mutation event types , older version of ie don't support it. note mutation events deprecated in dom3 events spec , have performance penalty . you can try emulate mutation event onpropertychange in ie (and fall brute-force approach if non of them available). for full domchange interval over-kill. imagine need store current state of whole document, , examine every element's every property same. maybe if yo

c# - error "unable to copy file because it is being used by another process -

i use windowsform application using c# language, have many forms, , when want traverse 1 another, use this.hide(); when use method, receive shown error, i know solution end process using windows task manager, question is there way can use travel between forms without leading error? error 9 unable copy file "obj\x86\debug\windowsformsapplication1.exe" "bin\debug\windowsformsapplication1.exe". process cannot access file 'bin\debug\windowsformsapplication1.exe' because being used process. c:\windows\microsoft.net\framework\v4.0.30319\microsoft.common.targets 2868 although hide() forms, still remain part of process. if don't close every form properly, process remain running , cannot recompile project , have kill process using taskmanager. visual studio tries rewrite executable , if executable runs process, windows refuse write .exe.

How to get older updates for Visual Studio 2012 -

i'm using visual studio 2012 c++ desktop development. company writes libraries other developers, , because customers understandably loathe upgrade once settle on development platform, need support developers @ various update (née "service pack") levels. it seems microsoft (equally understandably) pushing service packs when any, since when ask download update 1 here , pushes me update 3, includes updates 1 & 2. i have archived update 3 (using /layout flag on installer), don't see way update 1 or update 2, , yet need. how can these updates? answer microsoft : there no longer update 1 , 2 official site, cannot provide link either. recommend customer update vs avoid possible development problems. there logs of fixes vs on update 3.

android - Identifying NFC tag ID -

i trying identify unique identifier of nfc tag on android using following code: @suppresslint("newapi") @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); tag mytag = (tag) getintent().getparcelableextra(nfcadapter.extra_tag); string nfcid = mytag.getid().tostring(); toast.maketext(getapplicationcontext(), "nfc id is: "+ nfcid, toast.length_short).show(); } unfortunately, when deploy app real device , scan nfc tag, app crash stating "unfortunately xyz has stop...". know getid() return byte array , have parse string. @ least expect code return values rather crashing app. ideas how fix it? edited: logcat outputs: w/dalvikvm(25548): threadid=1: thread exiting uncaught exception group=0x41b652a0) e/androidruntime(25548): fatal exception: main e/androidruntime(25548): java.lang.runtimeexception: unable start activity componentinfo{com.xyz.nfcid/co

How to get back the layout after setting the visibility to GONE in android -

xml- <relativelayout xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/one" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <relativelayout xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/two" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > </relativelayout> </relativelayout> the layout 2 hidden after pressing button view.gone, want layout 2 when swipe down on screen, how can it, swipe down detection , getting layout back. yourrelativelayout.setvisibility(view.visible);

javascript - Only last of multiple ajax requests gets completed -

i'm trying create script allows me make ajax call few lines of code. script works 1 ajax request, when comes handling multiple request @ once fails. have done wrong ? the code processes last request, while leaving others "loading ...". here's code: /**************** related javascript inside html document ****************/ // first request var ajax1 = new ajax_class(); ajax1.meth = "get"; ajax1.file = "ajax_info.txt"; ajax1.elem = "results"; ajax1.send = null; ajax1.ajax_call(ajax1.meth, ajax1.file, ajax1.elem, ajax1.send); ... // third request var ajax3 = new ajax_class(); ajax3.meth = "get"; ajax3.file = "ajax_info3.txt"; ajax3.elem = "results3"; ajax3.send = null; ajax3.ajax_call(ajax3.meth, ajax3.file, ajax3.elem, ajax3.send); /**************** related html inside html document ****************/ <body> <div id="results">nothing has happend yet 1....</div> <

VB.NET For Each Loop exits after one iteration -

i have each loop iterating 1 element. begins 6th element out of 32 in test, , happens 1 comp.includeme evaluates true. after outer if statement executed, begins 2nd iteration exits loop , returns after comp.includeme evaluated false. no errors or warnings present, , have verified there elements in components object. can explain doing wrong, , why syntax doesn't work? public class bom public property components new list(of component) public function totalarea(byval adjusted boolean) double dim total double = 0 each comp component in components if comp.includeme = true if adjusted total += comp.getadjustedsize() * comp.quantity else total += comp.area * comp.quantity end if end if next return total end function public sub add(byval comp component) components.add(comp) end sub end class public clas

java - && Syntax Error AGP for Dummies -

so, learning off of android game programming dummies book, , have run problem (on page 128) i'm given code case motionevent.action_down: if (x > (screenw-playbuttonup.getwidth())/2 && x < ((screenw-playbuttonup.getwidth())/2) + playbuttonup.getwidth()) && y > (int)(screenh*0.45) && y < (int)(screenh*0.45) + playbuttonup.getheight()) { playbuttonpressed = true; } break; and 4th 6th lines accompanied error "syntax error on token "&&", throw expected". have no idea on how fix this, i'd appreciate alternatives or help. the parentheses messed up. specifically, second ) in line: // -- 1 // v playbuttonup.getwidth()) && matches ( starting if condition, meaning && after not part of condition. remove ) . here's parentheses analysis: if (x > (

linux - In 'grep' - Why does it behave this way? -

file still contains: a b c d and grep -v -e "a" -e "d" still gives: b c which expected. now, file fill contains: a,b,c,d my command grep -v -e "a" -e "d" fill i expected give me ,b,c, . but, no output. why ? first of all, first example should give : b c not b d because have -v your 2nd attempt gave nothing, because grep match line-wise. if whole line doesn't match, line won't in output. if want remove a , d in 2nd example, use sed: kent$ echo "a,b,c,d"|sed 's/[ad]//g' ,b,c,

java - Where can I find the JBoss source for the implementation of 12.1 and 12.2 of the servlet spec? -

http://download.oracle.com/otn-pub/jcp/servlet-3.0-fr-oth-jspec/servlet-3_0-final-spec.pdf this under chapter 12: mapping requests servlets. reviewed maven repository jboss, , although spec interface available can't seem find underlying implementation of 12.1 , 12.2 regard servlet url pattern matching. i'm interested in reviewing how expressions mapped rules project. i'm considering tomcat 7.0.42. links in below answer point 7.0.42 source code in grepcode.com. the servlet mappings during application startup parsed , added wrapper inside org.apache.tomcat.util.http.mapper.mapper#addwrapper() source code copypasted here (note: term "wrapper" stands here "a mapped servlet"): 360 protected void addwrapper(contextversion context, string path, 361 object wrapper, boolean jspwildcard, boolean resourceonly) { 362 363 synchronized (context) { 364 wrapper newwrapper = new wrapper(); 365 newwrapp

sas - single quoting values using sql to create macro variable -

i using macro in sas loop on data tables in specific library. put metadata information in data null step , make comparison statement , macro variable. my sql step looks like: proc sql; select quote(trim(code)) :procedures separated ', ' procedures; quit; some values of code contain values "45.10" , "g0102", cannot coerced numeric. macro contains line: %macro filter_codes(indata, outdata); data &outdata; set &indata(where = (code in (&procedures))); run; %mend; but decimal values create issue when double-quoted using "quote" function. can separate values single quotes? edit: issue caused fact filter_codes macro run within call execute step (over range of datasets) , double quotes resolved in macro variables inside of double quotes end call execute. try this: proc sql; select catt("'", code, "'") :procedures separated ', ' procedures; quit; also fix option in

Ways to improve first time indexing in ElasticSearch -

in application, have need re-index of data time time. have noticed time takes index data first time (via bulk index) slower subsequent re-indexing. in 1 scenario, takes 2 hours perform indexing first time, , 15 minutes (indexing same data) subsequent indexing. while 2 hours index first time reasonable, curious why subsequent iterations re-index faster. , more so, wondering if there's can improve performance when indexing first time, e.g. perhaps indicating how large index be, etc. thanks, eric edited strike out references merge_factor has been removed in es 2.0 : https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking_20_setting_changes.html#_merge_and_merge_throttling_settings as damien indicates, can indeed influence (bulk) indexing settings - refresh_interval can set -1 temporarily , set default value of 1s after complete bulk indexing. another setting modify merge.policy.merge_factor ; set higher value such 30 , default of 10 onc

ruby on rails - Update charge field after stripe charge is processed -

i'm using stripe gem, , followed basic setup charge card. trying have field in database changed when charge has been processed. below code not updating :charge (boolean type) field of database 1. after processing has succeeded redirects user create.html.erb, redirect them different path, haven't been able find out how that. thanks stack! charges controller: class chargescontroller < applicationcontroller def index end def new end def create @event = event.find(session[:event_id]) #amount in cents @amount = 199 customer = stripe::customer.create( :email => "user email", :card => params[:stripetoken] ) charge = stripe::charge.create( :customer => customer.id, :amount => @amount, :description => 'description', :currency => 'usd' ) @event[:charge] == 1 rescue stripe::carderror => e flash[:error] = e.message redirect_to charge

java - Is there an implementable (non-theoretical) way to prove if email address belong to real email account? -

is there way prove email address "real", therefore belongs existing email account ? masses of registrations via emails valid according email pattern definition, not exist. sending fake mail addresses costs lot of money, (and others) pay per mail (100.000 sendings fake mail accounts can cost four-digit numbers per year, show number). i want check moment. don't care if email adress offline 1 minute later. an ideal solution bash one-liner (that called every major language). what have done far: checking this similar 3yo thread , wrong real-world case. want check if email adress exist, in moment i'm sending mail (to prevent costs). checking if hostname pingable. checking if email adress pingable, here . tried rebuild in bash script, failed (fetching adress hard!). what want: a reliable check if mail account exists implementable average coder, in php or java. bash one-liner or php/java library this. free or commercial. i'll provide bounty! i

dll - Python ctypes ValueError - too many arguements? -

i trying access custom dll using ctypes. there several functions inside dll , functions except particular function work when called using windll call procedure. i created seperate python function wraps around s = ctypes.windll(r'mydll.dll') def setupoptions(window_area, minimumruntime, igu_flag, innerpanestopflag, mass_1, x_glassfail_1, x_winfail_1, mass_2=0, x_glassfail_2=0, x_winfail_2=0, x_gap=0, maxsteps=10000, maxnumcycles=2, supp_coeff=0.40528, failvelocityfactor=1.0, p_atm=14.7, time_step=0.01, z=0.2, initialstaticload=0.0, x_initial_1=0.0, initial_velocity_1=0.0, x_initial_2=0.0, initial_velocity_2=0.0): # flag identifying whether window igu or not apiiguflag = c_long(igu_flag) apiinnerpanestopflag = c_long(innerpanestopflag) # percentage of critical damping z = c_double(z) # timestep (this can increased - didn

google app engine - Failed to load module from user agent at localhost -

when tried run gwt quick start tutorial got error message! how can fix issue? p.s. i installed gwt developer plugin firefox 1.23 i installed eclipse ubuntu 13.04 repository (version 3.8.1) i gwt ubuntu 13.04 repository (version 2.4.0) 00:27:29.230 [error] [hellostupid] failed load module 'hellostupid' user agent 'mozilla/5.0 (x11; ubuntu; linux x86_64; rv:23.0) gecko/20100101 firefox/23.0' @ localhost:40544 java.lang.nullpointerexception: null @ com.google.gwt.dev.javac.jsnichecker.getsuppressedwarnings(jsnichecker.java:565) @ com.google.gwt.dev.javac.jsnichecker$jsnideclchecker.visit(jsnichecker.java:135) @ org.eclipse.jdt.internal.compiler.ast.typedeclaration.traverse(typedeclaration.java:1233) @ org.eclipse.jdt.internal.compiler.ast.compilationunitdeclaration.traverse(compilationunitdeclaration.java:679) @ com.google.gwt.dev.javac.jsnichecker.check(jsnichecker.java:615) @ com.google.gwt.dev.javac.jsnichecker.check(jsnichecke

html - Getting text to display to the left and right of a text-align: center -

alright have <div id='1'></div> <div id='2'></div> <div id='3'></div> only 1 word go each div. want width of each div auto and want word #2 in middle of screen using text-align: center; word in #1 being displayed directly left of #2 , #3 directly right of #2. i have been trying different css while, no effect. hoping has simple answer. simply float divs left. display in order. <style> .my-dvis { float:left; width:33.33%; margin:0; padding:0; border:none; } </style> <div class="my-divs"></div> <div class="my-divs"></div> <div class="my-divs"></div>

PHP MySQL Trouble With the Syntax -

need advice php mysql syntax. work hard that, still facing problem query , error : you have error in sql syntax; check manual corresponds mysql server version right syntax use near '$bagianwhere = ""' @ line 1: $bagianwhere = "" you can see demo here please help! if "bagianwhere" empty, sql query becomes invalid orphan "where" @ end. can $bagianwhere = "1 = 1"; at top counter that. also rid of "$bagianwhere .= " , make "$bagianwhere = " also error mentioning here sql fiddle, have put in php code in there. can run php on web server , show error get.

subfolder - Custom modification of the "new folder" command in windows 7 -

Image
a while ago todofixthis, answering else's question, provided nice little .cmd file, called open_dos_here.cmd. if put file in arbitrary folder,then clicking on open command window in folder, rather in default folder. i'd extend facility avoid having copy , paste .cmd file new folder every time create one. easiest way if customize windows' new folder command copy , paste automatically whenever new folder created. possible? if not, there way of accomplishing same thing? thanks suggestions. good news you. functionality comes built-in windows 7 . just press shift before right-click on folder , select open command window here .

php - SQL Export - Wordpress plugin DEV -

hi have following code.. function export_file() { $tmpname = '/tmp/' . sha1( uniqid() ) . $ext; $filename = 'export.sql'; $cmd = sprintf( "/applications/xampp/xamppfiles/bin/mysqldump -h'%s' -u'%s' -p'%s' %s --single-transaction %s > %s", db_host, db_user, db_password, db_name, $compression_pipe, $tmpname ); exec( $cmd ); header( 'content-type: application/bzip' ); header( 'content-length: ' . filesize( $tmpname ) ); header( 'content-disposition: attachment; filename="' . $filename . '"' ); readfile( $tmpname ); unlink( $tmpname ); exit(); } now, works doesnt download file. saying headers sent. headers sent (output started @ /applications/xampp/xamppfiles/htdocs/~/wp-admin/includes/template.php:1642) now understand headers have been sent main plugin file include javascript , css files needed plugin creating. function admi

continuous deployment - I want zero downtime deploys on CloudBees - but my app needs to warm up -

i want 0 downtime deployment of apps on cloudbees (i using continuous deployment) - app needs time warm up? also, able roll if things go horribly wrong, there way this? what want, may not realise - blue-green deployment, have active/standby app pair - , deploy standby, cut on when ready. see here better description. well, news - there plugin here . you can automate part of jenkins build, example, in freestyle job script (this assumes have setup app per above link: # install , configure bees sdk export bees_home=/opt/cloudbees/cloudbees-sdk/ export path=$path:$bees_home if [ ! -d ~/.bees ]; bees init -f -a <account name> -ep -k $bees_api -s $bees_secret fi bees plugin:install com.cloudbees.sdk.plugins:bg-plugin # deploy bees app:bg:deploy -n <your app name> target/web-webapp.war # warm new servers - example - smoke test here: echo "preparing new servers router switch over..." in {1..50} curl -s "http://yourwebsite.com/&q

sql - Python threading with Postgres: things are not being updated properly -

i have thread runs independently thread.start_new_thread(listeningtf2servers, ()) which calls method eventually: def updatestats(): ... player in pastgames[i]['players']: ... cursor.execute('select yes newstats nick = \'' + player['nick'] + '\' order totalgames desc limit 1') row in cursor.fetchall(): if row[0] == 1: if scoredict[player['team']] == 1: cursor.execute('update newstats set totalgames = totalgames + 1, wins = wins + 1, medicgames = medicgames + 1, medicwins = medicwins +1 nick = \'' + lower(player['nick']) + '\'') cursor.execute('commit;') else: #similar query else:

Python: Using CSV to parse(?) variables and then output that to another file -

i server administrator. i've skated without having scripting, alas -- has reared ugly head. summary: have example.csv looks following; stan,marsh,stan marsh,1001,899,smarsh,smarsh@info.com eric,cartman,eric cartman,1002,898,ecartman,ecartman@info.com now. i'm trying read in csv file. then, want take value each row , put this; dn: cn=$cn,ou=people,dc=domain,dc=com cn: $cn gidnumber: 20 givenname $fn homedirectory /home/users/$user loginshell: /bin/sh objectclass: inetorgperson objectclass: posixaccount objectclass: top sn: $ln uid: $username telephonenumber: $tele uidnumber: $uidn userpassword: {crypt}mrpoo mail: $email as can see, i'm attempting make ldif file allows me import user names , auto fill in variables. i can't seem put pieces together. i haven't gotten far either. learned print rows, yay... ! import csv open('example.csv', 'rb') f: reader = csv.reader(f) row in reader: print row i thin

android - SherlockFragmentActivity.onSaveInstanceState how to? -

i working on application has multiple fragments, using viewpageindicator library , sherlocakactionbar library. in 1 of fragment, have button call intent startactivityforresult image camera.. error getting savefragmentbasicstate. have worked in activity , know still dont understand how fragment works , people doing make ways make me more confuse. how should save state?? addmonitoring.java public class addmonitoring extends sherlockfragmentactivity { private static final string[] content = new string[] { "info", "budget", "accessibility", "engagement", "effictiveness", "additional info","documents","picture","video","finalize" }; private fragmentpageradapter adapter; private viewpager pager; public static final string prefs_name = "myprefsfile"; private static final int[] icons = new int[] { r.drawable.ic_info, /*

php - how can i check crypted password in login page? -

i encrypted password crypt() function. when user wants login how can check password stored in database 1 entered? for ex: $pass = "fgyi34".$pass."@1187gh"; $hashed_password = crypt($pass); for new user. crypt password , store in database. for existing user crypt password , store in variable when user clicks submit button, compare crypted password earlier crypted password on database. if password doesn't match, display message user password wrong.

ssl - linux wget not certified? -

i'm trying simple wget on server that's brand new , i'm getting error. i've never encountered - @ all... [root@ip-219-140 ~]# wget https://dl.dropboxusercontent.com/u/60455970/litecoin-0.6.3c-linux.tar.gz --10:11:52-- https://dl.dropboxusercontent.com/u/60455970/litecoin-0.6.3c-linux.tar.gz resolving dl.dropboxusercontent.com... 54.243.119.191 connecting dl.dropboxusercontent.com|54.243.119.191|:443... connected. error: cannot verify dl.dropboxusercontent.com's certificate, issued `/c=us/o=digicert inc/ou=www.digicert.com/cn=digicert high assurance ca-3': unable locally verify issuer's authority. connect dl.dropboxusercontent.com insecurely, use `--no-check-certificate'. unable establish ssl connection. follow instructions: to connect dl.dropboxusercontent.com insecurely, use `--no-check-certificate'. run: wget --no-check-certificate https://dl.dropboxusercontent.com/u/60455970/litecoin-0.6.3c-linux.tar.gz it worked

crystal reports xi - How to load rpt file using c# in visual studio 2010? -

am using visual studio 2010 , trying load rpt file. have used following code. reportdocument rpt = new reportdocument(); rpt.load("e:\\crystal reports docs\\crystal reports samples\\crosstab report"); then used isloaded() function check whether loaded. when compile program, keeps on running. any suggestions??? thanks in advance!!!! here sample code how load crystal report (.rpt) file saved on local drive instead of embedded. advantage program not need re-compiled each time report modified. also, .rpt can upload application , stored in database , written file. not embed .rpt file when using method. using system;using crystaldecisions.crystalreports.engine; using crystaldecisions.shared; namespace report { public partial class report : document { public void reportload() { reportdocument reportdocument = new reportdocument(); string filepath = "c:\projects\application\report\crystalr

crud - iCloud files keep reappearing after deleting -

i have following setup: app writes uidocument instances icloud. files synced , works fine. when try delete them keep reappearing. before delete files close them. here code deletes files: - (void)deletedocumentwithname:(nsstring*)name completion:(void (^)(bool success))completion { [self stopquery]; nsurl* todelete = [self urlforfilewithname:name]; uidocument* doc = [[uidocument alloc] initwithfileurl:todelete]; void (^deletedocument)() = ^() { // wrap in file coordinator dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, 0), ^(void) { nsfilecoordinator* filecoordinator = [[nsfilecoordinator alloc] initwithfilepresenter:nil]; [filecoordinator coordinatewritingitematurl:todelete options:nsfilecoordinatorwritingfordeleting error:nil byaccessor:^(nsurl* writingurl) {

entity framework - Cannot insert explicit value for identity column in table 'LeistungGruppe' when IDENTITY_INSERT is set to OFF -

i'm trying add entityobject database calling addtoleistunggruppe. leistunggruppe in case table primary_key leistunggruppe_id identity true , identity increment 1 , seed 1. i search lot issue , alot of people got same error. told set storegeneratedpattern identity , solve problem. i tried out , still got same issue. i'm new entity framework , have no idea how solve problem. somehow think model isn't updated because if switch around these settings i'm getting same error on , on again. every appreciated. you trying save object database explicit id set while database expecting generate value itself. leistunggruppe_id property in object set other 0 , not identified ef framework identity field. if want id generated database post suggests, corresponding property in object should decorated [key] attribute. if using fluent api should have in dbcontext: protected override void onmodelcreating(system.data.entity.modelconfiguration.modelbuilder modelbui

java - RecognizerIntent change default language -

i start recognizerintent code: intent intent = new intent(recognizerintent.action_recognize_speech); intent.putextra(recognizerintent.extra_language_model,"us-us"); startactivityforresult(intent, result_speech_guest); but phone configurated in italian , when speech example "wait minute" return me "uait minut"(the italian pronunciation). why? best regards i solved problem: string language = "us-us"; intent intent = new intent(recognizerintent.action_recognize_speech); intent.putextra(recognizerintent.extra_language_model,language); intent.putextra(recognizerintent.extra_language, language); intent.putextra(recognizerintent.extra_language_preference, language); intent.putextra(recognizerintent.extra_only_return_language_preference, language); startactivityforresult(intent, result_speech_guest);

asp.net - VS2012 C# Application cannot save value? -

the same code,application's key can saved in vs2010 after closing page,but cannot save in vs2012 protected void page_load(object sender, eventargs e) { object value = application["a"]; // value = 'abc' in 2010,value = null in 2012 application["a"] = "abc"; //save value } if closing page , , restart ,application's key exists in vs2010,but had nothing in vs2012,it seems no matter how many values set in application,if restart page, it's gone.. why ? can me ?

javascript - Make an object falsy -

this question has answer here: change truthy/falsey value of javascript object 3 answers force object evaluate false 1 answer is possible override on object in javascript appears 'falsy'? for exampe, create object this: function busystate{ var self = this; self.isset = false; self.enter = function () { self.isset = true; }; self.exit = function () { self.isset = false; }; }; var isloading = new busystate(); isloading.enter(); i can check busy this: if (isloading.isset) { } but i'd able write shorthand: if (isloading) { } can object have appear truthy or falsy depending on value of isset? as far know can't done. if read ecmascript-specification you'll see if(isloading) evaluated if(toboolean(isloading) === true) , toboolean

javascript - How to calculate the actual screen distance jQuery? -

i want place ad in page column. when scroll down, want ad follow way, position in vertical middle of page. using script right can set distance cannot set exact 50% distance. i have tired $window.height()/2 or $document.height()/2 , calculate table height instead of actual screen height. how solve this? thanks! <html> <head> <script type='text/javascript' src='http://code.jquery.com/jquery-1.9.1.js'></script> <script type="text/javascript"> $(function () { var $sidebar = $("#sidebar"), $window = $(window); $window.scroll(function () { if ($window.scrolltop() > $window.height() / 2) { $sidebar.css('position', 'absolute'); $sidebar.css('top', $window.scrolltop() + $window.height() / 2); $sidebar.slidedown(500); } else { $sidebar.css('position', 'auto'); $sidebar.css('top', 'auto'); } }); }); </